Пример #1
0
 public void ClearCommand()
 {
     ButtonPool.Store(buttons);
     buttons.Clear();
     activateButton = null;
     //if (attackIndicator != null)
     //{
     //    AttackIndicator.Collecet(attackIndicator);
     //    attackIndicator = null;
     //}
 }
Пример #2
0
        public void AddActivateCommand(int index, int description, int flag)
        {
            Debug.Log(string.Format("[{0}] wants to add activate, index={1}, flag={2}", DataService.GetName(Data.Code), index, flag));
            int response = 0;

            if (GameInfo.Instance.CurrentMessage == GameMessage.SelectIdleCmd)
            {
                response = (index << 16) + 5;
            }
            else if (GameInfo.Instance.CurrentMessage == GameMessage.SelectBattleCmd)
            {
                response = index << 16;
            }
            else
            {
                response = index;
            }
            if (flag == 1)
            {
                var btn = ButtonPool.New();
                btn.Set(DataService.SysString(1161), response, Transform);
                buttons.Add(btn);
            }
            else if (flag == 2)
            {
                var btn = ButtonPool.New();
                btn.Set(DataService.SysString(1162), response, Transform);
                buttons.Add(btn);
            }
            else
            {
                if (activateButton != null)
                {
                    activateButton.AddOption(new Tuple <int, int>(index, description));
                    return;
                }
                activateButton = ButtonPool.New();
                if (description != 0)
                {
                    activateButton.AddOption(new Tuple <int, int>(index, description));
                }
                activateButton.Set(DataService.SysString(1150), response, Transform);
                buttons.Add(activateButton);
            }
            for (int i = 0; i < buttons.Count; ++i)
            {
                buttons[i].ButtonObject.transform.localPosition = new Vector3(0, -2 * (buttons.Count - 1) * 0.5f + i * 2, -0.1f);
            }
        }