using UnityEngine;
using System.Collections;
public class UIButtonTexture : MonoBehaviour {
public UIAtlas ReferenceAtlas;
public GameObject ReplacementAtlas;
public string HomePanelTopBG;
public string TopNavBar;
bool AtlasSwitch;
/*public UIButtonTexture(bool AtlasSwitch) {
this.AtlasSwitch = AtlasSwitch;
} */
public enum Trigger {
OnClick,
}
public Trigger trigger = Trigger.OnClick;
void Start() {
AtlasSwitch = false;
}
public void OnClick() {
Debug.Log("---> Inside OnClick");
if (AtlasSwitch == false) {
AtlasSwitch = true;
Debug.Log("---> AtlasSwitch = "+AtlasSwitch);
UpdateAtlas();
} else {
AtlasSwitch = false;
Debug.Log("---> AtlasSwitch = "+AtlasSwitch);
UpdateAtlas();
}
}
public void UpdateAtlas() {
if (AtlasSwitch == true) {
Debug.Log("---> Inside UpdateAtlas [true side]");
ReplacementAtlas = Resources.Load("HomePanelTopBG") as GameObject;
Debug.Log("---> Setting texture GO to 'Clicked'");
}
else {
Debug.Log("---> Inside UpdateAtlas [false side]");
ReplacementAtlas = Resources.Load("TopBlackBar") as GameObject;
Debug.Log("---> Setting texture GO to 'Default'");
}
Debug.Log("---> Replacing Atlas. ReferenceAtlas = "+ ReferenceAtlas + " ReplacementAtlas = "+ReplacementAtlas);
ReferenceAtlas.replacement = ReplacementAtlas.GetComponent<UIAtlas>();
Debug.Log("Atlas Replaced");
} // end UpdateAtlas()
}