Beispiel #1
0
        private void InitItem()
        {
            int  Career  = PlayerManager.GetInstance().MajorPlayer.Job - 1;//职业从1开始
            int  n       = 0;
            uint skillID = 0;

            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 6; j++)
                {
                    if (i * 6 + j == postions[n])
                    {
                        skillID = skillIDList[Career][n];
                        TalentSkillItem item = NGUITools.AddChild <TalentSkillItem>(gameObject);
                        GameObject      go   = GameObject.Instantiate(addBtn.gameObject) as GameObject;
                        UIEventListener.Get(go).onClick += OnUpgradeSkill;
                        item.AddPointBtn(go);
                        item.gameObject.transform.localPosition = posList[n++];
                        skillItems.Add(skillID, item);
                        KPassiveSkill    skill     = KConfigFileManager.GetInstance().GetPassiveSkill(skillID, 1);
                        PassiveSkillData skillData = new PassiveSkillData();
                        skillData.Learned = true;
                        item.SkillData    = skillData;
                        if (n == 14)
                        {
                            i = 4;
                            break;
                        }
                    }
                }
            }
            GameObject.Destroy(addBtn.gameObject);
        }
Beispiel #2
0
        private void OnUpgradeSkill(GameObject go)
        {
            TalentSkillItem item = go.transform.parent.gameObject.GetComponent <TalentSkillItem>();

            if (item != null)
            {
                SkillLogic.GetInstance().UpgradeSkill(0, (ushort)item.SkillData.SkillID);
            }
        }