Esempio n. 1
0
 public void ActivateSkill(GCPushActivateSkill skill)
 {
     foreach (var a in activeSkill)
     {
         if (a.skillId == skill.SkillId)
         {
             a.SetLevel(skill.Level);
             break;
         }
     }
     MyEventSystem.PushEventStatic(MyEvent.EventType.UpdateSkill);
 }
Esempio n. 2
0
 public SkillFullInfo(GCPushActivateSkill p)
 {
     skillData = Util.GetSkillData(p.SkillId, p.Level);
 }
Esempio n. 3
0
        public static void LevelUpSkill(int skId)
        {
            Debug.Log("LevelUpSkill: " + skId);
            var pinfo      = ServerData.Instance.playerInfo;
            int totalSP    = 0;
            int skillLevel = 0;

            if (pinfo.HasSkill)
            {
                totalSP = pinfo.Skill.TotalPoint;
                foreach (var s in pinfo.Skill.SkillInfosList)
                {
                    if (s.SkillInfoId == skId)
                    {
                        skillLevel = s.Level;
                        break;
                    }
                }
            }
            var skData    = Util.GetSkillData(skId, skillLevel);
            var maxLev    = skData.MaxLevel;
            var playerLev = pinfo.Roles.Level;
            var next      = Util.GetSkillData(skId, skillLevel + 1);
            var needLev   = next.LevelRequired;

            if (totalSP > 0 && skillLevel < maxLev && playerLev >= needLev)
            {
                Log.Sys("LearnSkill");
                AddSkillPoint(-1);

                bool find = false;
                foreach (var sk in pinfo.Skill.SkillInfosList)
                {
                    if (sk.SkillInfoId == skId)
                    {
                        sk.Level++;
                        find = true;
                        break;
                    }
                }
                if (!find)
                {
                    var newinfo = SkillInfo.CreateBuilder();
                    newinfo.SkillInfoId = skId;
                    newinfo.Level       = 1;
                    pinfo.Skill.SkillInfosList.Add(newinfo.Build());
                }

                //pinfo.Skill = newSk.Build();

                var activeSkill = GCPushActivateSkill.CreateBuilder();
                activeSkill.SkillId = skId;
                activeSkill.Level   = skillLevel + 1;
                ServerBundle.SendImmediatePush(activeSkill);
            }
            else if (totalSP <= 0)
            {
                SendNotify("剩余技能点不足");
            }
            else if (playerLev < needLev)
            {
                SendNotify("等级不足");
            }
            else
            {
                SendNotify("技能已经升到满级");
            }
            PushSkillShortcutsInfo();
        }