public void OnHoverBuildButton(GameObject butObj) { Debug.Log(butObj); if (!ValidForInteraction()) { return; } int idx = UI.GetItemIndex(butObj, buildButtons); if (UIControl.UseDragNDropMode()) { UITooltip.Show(buildableList[idx], UI.GetCorner(buildButtons[idx].rectT, 1), 0, new Vector3(0, .25f, 0)); } else { if (UIControl.UsePieMenuForBuild()) { UITooltip.Show(sInfo.buildableList[idx]); } else { UITooltip.Show(sInfo.buildableList[idx], UI.GetCorner(buildButtons[idx].rectT, 1), 0, new Vector3(0, .25f, 0)); } } if (UIControl.UsePointNBuildMode()) { TowerManager.ShowSampleTower(sInfo.buildableList[idx].prefabID, sInfo); } }
public void OnExitAbilityButton(GameObject butObj) { int idx = UI.GetItemIndex(butObj, abilityButtons); if (AbilityManager.GetPendingTargetAbilityIndex() == idx || UIControl.GetPendingAbilityIdx() == idx) { return; } UITooltip.Hide(); }
public void OnBuildButton(GameObject butObj, int pointerID = -1) { if (!ValidForInteraction()) { return; } int idx = UI.GetItemIndex(butObj, buildButtons); if (UIControl.UsePointNBuildMode() && UIControl.InTouchMode()) { if (touchModeButtonIdx != idx) { if (touchModeButtonIdx >= 0) { ClearTouchModeSelect(); } touchModeButtonIdx = idx; buildButtons[touchModeButtonIdx].imgHighlight.gameObject.SetActive(true); OnHoverBuildButton(butObj); return; } ClearTouchModeSelect(); } if (UIControl.UsePointNBuildMode()) { if (!CheckCost(sInfo.buildableList[idx].GetCost())) { return; } TowerManager.BuildTower(sInfo.buildableList[idx], sInfo.platform, sInfo.nodeID); SelectControl.ClearNode(); OnExitBuildButton(null); Hide(); TowerManager.HideSampleTower(); } if (UIControl.UseDragNDropMode()) { if (!CheckCost(buildableList[idx].GetCost())) { return; } SelectControl.ClearUnit(); UITowerSelect.Hide(); TowerManager.CreateDragNDropTower(buildableList[idx]); } }
public void OnUpgradeButton(GameObject butObj, int pointerID = -1) { int idx = UI.GetItemIndex(butObj, upgradeButtons); List <float> upgradeCost = sTower.GetUpgradeCost(idx); if (CheckCost(upgradeCost)) { //RscManager.SpendRsc(upgradeCost); sTower.Upgrade(idx); SelectControl.ClearUnit(); Hide(); } UITooltip.Hide(); }
public void OnHoverUpgradeButton(GameObject butObj) { int idx = UI.GetItemIndex(butObj, upgradeButtons); UITooltip.ShowUpgrade(sTower, idx, UI.GetCorner(upgradeButtons[idx].rectT, 2), 0, new Vector3(0, .25f, 0)); }
public void OnAbilityButton(GameObject butObj, int pointerID = -1) { int idx = UI.GetItemIndex(butObj, abilityButtons); if (UIControl.InTargetSelectionMode()) { if (AbilityManager.GetPendingTargetAbilityIndex() == idx || UIControl.GetPendingAbilityIdx() == idx) { abilityButtons[idx].imgHighlight.gameObject.SetActive(false); UIControl.ClearSelectedAbility(); buttonClearSelect.SetActive(false); return; } } Ability._Status status = AbilityManager.IsReady(idx); if (status != Ability._Status.Ready) { if (status == Ability._Status.OnCooldown) { GameControl.InvalidAction("Ability is on cooldown"); } if (status == Ability._Status.InsufficientRsc) { GameControl.InvalidAction("Insufficient resource"); } if (status == Ability._Status.UseLimitReached) { GameControl.InvalidAction("Use limit exceeded"); } return; } if (UIControl.InTouchMode()) { if (!AbilityManager.RequireTargetSelection(idx) && touchModeButtonIdx != idx) { if (touchModeButtonIdx >= 0) { ClearTouchModeSelect(); } touchModeButtonIdx = idx; abilityButtons[touchModeButtonIdx].imgHighlight.gameObject.SetActive(true); OnHoverAbilityButton(butObj); buttonClearSelect.SetActive(true); return; } ClearTouchModeSelect(); } if (AbilityManager.RequireTargetSelection(idx)) { UIControl.SelectAbility(idx); abilityButtons[idx].imgHighlight.gameObject.SetActive(true); buttonClearSelect.SetActive(true); } else { AbilityManager.ActivateAbility(idx); abilityButtons[idx].lbMain.text = AbilityManager.GetAbility(idx).GetUseLimitText(); } }
public void OnHoverAbilityButton(GameObject butObj) { int idx = UI.GetItemIndex(butObj, abilityButtons); UITooltip.Show(AbilityManager.GetAbility(idx), UI.GetCorner(abilityButtons[idx].rectT, 2), 3, new Vector3(0, .25f, 0)); }