예제 #1
0
 //进入选择模式
 void StartStrSelect()
 {
     for (int i = 0; i < VoteStrs.Count; i++)
     {
         VoteStrs[i].StrSelectToggle.interactable = true;
         VoteStrs[i].StrSelectToggle.isOn         = false;
     }
     VoteSelectStrs.Clear();
 }
예제 #2
0
 public void SkillStrSelect(StrategyInfo sStr, bool add)
 {
     if (add == true)
     {
         VoteSelectStrs.Add(sStr);
         if (VoteSelectStrs.Count >= StrSelectNum)
         {
             for (int i = 0; i < VoteStrs.Count; i++)
             {
                 VoteStrs[i].StrSelectToggle.interactable = false;
             }
         }
     }
     else
     {
         if (VoteSelectStrs.Contains(sStr))
         {
             VoteSelectStrs.Remove(sStr);
         }
         if (VoteSelectStrs.Count >= StrSelectNum)
         {
             for (int i = 0; i < VoteStrs.Count; i++)
             {
                 VoteStrs[i].StrSelectToggle.interactable = true;
             }
         }
     }
     if (VoteSelectStrs.Count > 0)
     {
         SkillConfirmButton.SetActive(true);
     }
     else
     {
         SkillConfirmButton.SetActive(false);
     }
 }
예제 #3
0
    public void SkillConfirm()
    {
        bool SkillActive = false;//各种技能需要选择的战略不一样,确定选择了对应战略再发动技能

        //因为开会不暂停所以此处要再检测一遍体力
        if (MeetingSkillNum == 1 && GC.Stamina >= 10)
        {
            if (VoteSelectStrs[0].Active == true)
            {
                SkillActive = true;
                GC.Stamina -= 10;
                List <StrategyInfo> TempInfos = new List <StrategyInfo>();
                for (int i = 0; i < VoteStrs.Count; i++)
                {
                    if (VoteStrs[i].Active == false)
                    {
                        TempInfos.Add(VoteStrs[i]);
                    }
                }

                if (TempInfos.Count <= 3)
                {
                    for (int i = 0; i < TempInfos.Count; i++)
                    {
                        VoteStrs.Remove(TempInfos[i]);
                        Destroy(TempInfos[i].gameObject);
                    }
                }
                else
                {
                    for (int i = 0; i < 3; i++)
                    {
                        int DesNum = Random.Range(0, TempInfos.Count);
                        VoteStrs.Remove(TempInfos[DesNum]);
                        Destroy(TempInfos[DesNum].gameObject);
                    }
                }
                VoteSelectStrs[0].VoteNum = 0;
                VoteSelectStrs[0].UpdateUI();
                CheckVoteStatus();
            }
        }
        else if (MeetingSkillNum == 2 && GC.Stamina >= 10)
        {
            bool allCheck = true;
            for (int i = 0; i < VoteSelectStrs.Count; i++)
            {
                if (VoteSelectStrs[i].Active == true)
                {
                    allCheck = false;
                    break;
                }
            }
            if (allCheck == true)
            {
                SkillActive = true;
                GC.Stamina -= 10;
                for (int i = 0; i < VoteSelectStrs.Count; i++)
                {
                    VoteStrs.Remove(VoteSelectStrs[i]);
                    Destroy(VoteSelectStrs[i]);
                }
                CheckVoteStatus();
            }
        }
        else if (MeetingSkillNum == 4 && GC.Stamina >= 20)
        {
            if (VoteSelectStrs.Count == 1)
            {
                SkillActive = true;
                GC.Stamina -= 20;
                VoteSelectStrs[0].VoteNum += (int)(VoteSelectStrs[0].VoteNum * 0.5f);
                VoteSelectStrs[0].UpdateUI();
                CheckVoteStatus();
            }
        }
        else if (MeetingSkillNum == 5 && GC.Stamina >= 30)
        {
            if ((VoteSelectStrs[0].Active == true && VoteSelectStrs[1].Active == false) || (VoteSelectStrs[0].Active == false && VoteSelectStrs[1].Active == true))
            {
                SkillActive = true;
                GC.Stamina -= 30;
                int num1 = VoteSelectStrs[0].VoteNum, num2 = VoteSelectStrs[1].VoteNum;
                VoteSelectStrs[0].VoteNum = num2;
                VoteSelectStrs[1].VoteNum = num1;
                VoteSelectStrs[0].UpdateUI();
                VoteSelectStrs[1].UpdateUI();
                CheckVoteStatus();
            }
        }

        if (SkillActive == true)
        {
            for (int i = 0; i < VoteStrs.Count; i++)
            {
                VoteStrs[i].StrSelectToggle.interactable = false;
                VoteStrs[i].StrSelectToggle.isOn         = false;
            }
            VoteSelectStrs.Clear();
            SkillConfirmButton.gameObject.SetActive(false);
        }
    }