Exemplo n.º 1
0
        public void UpdateDisplay(Unit unit = null)
        {
            List <Unit> unitList = FactionManager.GetDeployingUnitList();
            int         unitID   = FactionManager.GetDeployingUnitID();

            if (buttonList.Count < unitList.Count)
            {
                buttonList.Add(UIButton.Clone(buttonList[0].rootObj, "Button" + (buttonList.Count + 1)));
                buttonList[buttonList.Count - 1].SetCallback(this.OnHoverButton, this.OnExitButton, this.OnButton, null);
            }

            for (int i = 0; i < buttonList.Count; i++)
            {
                if (i < unitList.Count)
                {
                    buttonList[i].imgIcon.sprite       = unitList[i].iconSprite;
                    buttonList[i].imgHighlight.enabled = (unitID == i);
                    buttonList[i].rootObj.SetActive(true);
                }
                else
                {
                    buttonList[i].rootObj.SetActive(false);
                }
            }

            butAutoNCom.label.text = FactionManager.IsDeploymentComplete() ? "Complete" : "Auto Deploy";
            butAutoNCom.imgHighlight.gameObject.SetActive(FactionManager.IsDeploymentComplete());

            lbStatus.text = unitList.Count > 0 ? "Deploying Unit:" : "All Unit Deployed";
        }
Exemplo n.º 2
0
        public void OnButton(GameObject butObj, int pointerID = -1)
        {
            int prevID = FactionManager.GetDeployingUnitID();

            buttonList[prevID].imgHighlight.enabled = false;

            int ID = GetButtonID(butObj);

            buttonList[ID].imgHighlight.enabled = true;

            FactionManager.SetDeployingUnitID(ID);
        }