private int currentButtonID = -1; //last touched button, for touch mode only public void OnAbilityButton(GameObject butObj, int pointerID = -1) { int ID = GetButtonID(butObj); if (UIMainControl.InTouchMode()) { if (currentButtonID >= 0) { buttonList[currentButtonID].imgHighlight.enabled = false; } if (currentButtonID != ID) { currentButtonID = ID; buttonList[ID].imgHighlight.enabled = true; OnHoverButton(butObj); return; } ClearTouchModeButton(); } string exception = AbilityManagerFaction.SelectAbility(ID); if (exception != "") { UIMessage.DisplayMessage(exception); } buttonList[ID].imgHighlight.enabled = true; }
public void OnPurchaseButton() { string text = PerkManager.PurchasePerk(perkItemList[selectID].perkID); if (text != "") { UIMessage.DisplayMessage(text); return; } UpdatePerkItemList(); UpdateDisplay(); }
private int currentButtonID = -1; //last touched button, for touch mode only public void OnAbilityButton(GameObject butObj, int pointerID = -1) { int ID = GetButtonID(butObj); if (UIMainControl.InTouchMode()) { if (currentButtonID >= 0) { buttonList[currentButtonID].imgHighlight.enabled = false; } currentButtonID = ID; buttonList[ID].imgHighlight.enabled = true; } else { string exception = GameControl.GetSelectedUnit().SelectAbility(ID); if (exception != "") { UIMessage.DisplayMessage(exception); } } }
public void OnReleaseAbilityButton(GameObject butObj, int pointId = -1) { if (UIMainControl.InTouchMode()) { if (tooltipObj.activeSelf) { OnExitButton(null); if (currentButtonID >= 0) { buttonList[currentButtonID].imgHighlight.enabled = false; } currentButtonID = -1; } else { int ID = GetButtonID(butObj); if (currentButtonID == ID) // this check is BS because the buttons seem to capture focus, but leave it in since it doesn't break anything HACK { string exception = GameControl.GetSelectedUnit().SelectAbility(ID); if (exception != "") { UIMessage.DisplayMessage(exception); buttonList[currentButtonID].imgHighlight.enabled = false; } else { bool isInTargetMode = GameControl.GetSelectedUnit().abilityList[ID].requireTargetSelection; if (!isInTargetMode) { buttonList[currentButtonID].imgHighlight.enabled = false; currentButtonID = -1; } } } } } }