Esempio n. 1
0
        private int SeleSkillByPriority()
        {
            int nSelectSkillId = GetChangeStateNormalSkillID();
            int nMaxPriority   = -1;

            for (int ii = 0; ii < m_player.OwnSkillInfo.Length; ++ii)
            {
                int         nCurrSkillId = m_player.OwnSkillInfo[ii].SkillId;
                Tab_SkillEx tabSkillEx   = TableManager.GetSkillExByID(nCurrSkillId, 0);
                if (null != tabSkillEx)
                {
                    Tab_SkillBase tabSkillBase = TableManager.GetSkillBaseByID(tabSkillEx.BaseId, 0);
                    if (null != tabSkillBase)
                    {
                        if (1 == m_player.IsAutoSelSkillID(ii) || (-1 == m_player.IsAutoSelSkillID(ii) && 0 < tabSkillBase.PriorityAutoFight))
                        {
                            if (m_player.CheckBeforUseSkill(nCurrSkillId, false) &&
                                CheckXpSkill(tabSkillBase)
                                )
                            {
                                int nCurrPriority = tabSkillBase.PriorityAutoFight;
                                if (nCurrPriority > nMaxPriority)
                                {
                                    nSelectSkillId = nCurrSkillId;
                                    nMaxPriority   = nCurrPriority;
                                }
                            }
                        }
                    }
                }
            }
            return(nSelectSkillId);
        }
Esempio n. 2
0
    void _initSkill( )
    {
        Obj_MainPlayer rUser = Singleton <ObjManager> .Instance.MainPlayer;

        if (rUser == null)
        {
            return;
        }

        for (int i = 0; i < rUser.OwnSkillInfo.Length; ++i)
        {
            if (skillId0 != GlobeVar.INVALID_ID && skillId0 == rUser.OwnSkillInfo[i].SkillId)
            {
                m_skillGameObj[0].SetActive(true);

                if (rUser.IsAutoSelSkillID(i) == 1)
                {
                    m_skillToggle[0].value = true;
                }
                else
                {
                    m_skillToggle[0].value = false;
                }
            }

            else if (skillId1 != GlobeVar.INVALID_ID && skillId1 == rUser.OwnSkillInfo[i].SkillId)
            {
                m_skillGameObj[1].SetActive(true);

                if (rUser.IsAutoSelSkillID(i) == 1)
                {
                    m_skillToggle[1].value = true;
                }
                else
                {
                    m_skillToggle[1].value = false;
                }
            }
            else if (skillId2 != GlobeVar.INVALID_ID && skillId2 == rUser.OwnSkillInfo[i].SkillId)
            {
                m_skillGameObj[2].SetActive(true);

                if (rUser.IsAutoSelSkillID(i) == 1)
                {
                    m_skillToggle[2].value = true;
                }
                else
                {
                    m_skillToggle[2].value = false;
                }
            }
            else if (skillId3 != GlobeVar.INVALID_ID && skillId3 == rUser.OwnSkillInfo[i].SkillId)
            {
                m_skillGameObj[3].SetActive(true);

                if (rUser.IsAutoSelSkillID(i) == 1)
                {
                    m_skillToggle[3].value = true;
                }
                else
                {
                    m_skillToggle[3].value = false;
                }
            }
            else if (skillId4 != GlobeVar.INVALID_ID && skillId4 == rUser.OwnSkillInfo[i].SkillId)
            {
                m_skillGameObj[4].SetActive(true);

                if (rUser.IsAutoSelSkillID(i) == 1)
                {
                    m_skillToggle[4].value = true;
                }
                else
                {
                    m_skillToggle[4].value = false;
                }
            }
            else if (skillId5 != GlobeVar.INVALID_ID && skillId5 == rUser.OwnSkillInfo[i].SkillId)
            {
                m_skillGameObj[5].SetActive(true);

                if (rUser.IsAutoSelSkillID(i) == 1)
                {
                    m_skillToggle[5].value = true;
                }
                else
                {
                    m_skillToggle[5].value = false;
                }
            }
            else if (skillId6 != GlobeVar.INVALID_ID && skillId6 == rUser.OwnSkillInfo[i].SkillId)
            {
                m_skillGameObj[6].SetActive(true);

                if (rUser.IsAutoSelSkillID(i) == 1)
                {
                    m_skillToggle[6].value = true;
                }
                else
                {
                    m_skillToggle[6].value = false;
                }
            }
            else if (skillId7 != GlobeVar.INVALID_ID && skillId7 == rUser.OwnSkillInfo[i].SkillId)
            {
                m_skillGameObj[7].SetActive(true);

                if (rUser.IsAutoSelSkillID(i) == 1)
                {
                    m_skillToggle[7].value = true;
                }
                else
                {
                    m_skillToggle[7].value = false;
                }
            }
        }
    }