コード例 #1
0
    public void StartTurn()
    {
        isPlayerTurn = PlayerBattleList.Contains(CurrentBattleOrder[0]);

        CurrentBattleOrder[0].CurrentActionpoints = CurrentBattleOrder[0].UnitStats.ActionPoints;
        UIBattleMap.instance.EndTurnButton.SetActive(isPlayerTurn);
        if (!isPlayerTurn)
        {
            StartCoroutine(EnemyturnCD());
        }
        else
        {
            BattlePlayerControls.instance.selectedUnit = CurrentBattleOrder[0];

            CurrentBattleOrder[0].HighlightEnable(Color.cyan);

            //TODO Move it into UI script
            foreach (FightAction action in CurrentBattleOrder[0].Actions)
            {
                GameObject go = Instantiate(Resources.Load("SkillButton"), UIBattleMap.instance.UnitSkillPanel.transform) as GameObject;
                UIBattleMap.instance.SkillList.Add(go);

                BattleSkillButton bsb = go.GetComponent <BattleSkillButton>();
                bsb.CostText.text = "" + action.Cost;
                bsb.Icon.sprite   = action.icon;
                bsb.action        = action;
                bsb.unit          = CurrentBattleOrder[0];
                UIBattleMap.instance.SkillList.Add(go);
            }
        }
    }
コード例 #2
0
    private void InitSkillBtnList()
    {
        SkillList_     = new List <BattleSkillButton>();
        SkillListRoot_ = transform.FindChild("Root/SkillList/Content");
        for (int i = 0; i < SkillBtnCount; i++)
        {
            GameObject go = Global.CreateUI("BattleSkillButton", SkillListRoot_.gameObject);
            go.name = i.ToString();
            BattleSkillButton script = go.AddComponent <BattleSkillButton>();
            SkillList_.Add(script);
            ClientSkill skill = CommandShip_.GetSkillByIndex(i);
            if (skill == null)  //为空的时候理解为未解锁,现在没这个状态,以后再加
            //进入未解锁状态
            {
            }
            else
            {
                script.SkillID = skill.ID;
                bool isAble = true;//是否激活,待取
                script.ConfigIcon(skill.Prop.disableicon, skill.Prop.enableicon);
                script.EnableSkill(isAble);
                BattleSceneDisplayManager.EventOnSkillSing    += script.ForbidFireSkill;
                BattleSceneDisplayManager.EventOnSkillTrigger += script.CoolDownSkill;
            }

            script.SelectedSkillCallback += SetSelectSkill;
            script.FireSkillCallback     += FireSkill;
        }
    }