コード例 #1
0
ファイル: Player.cs プロジェクト: wt616/JxqyHD
 private void ToLevel(int exp)
 {
     if (LevelIni != null)
     {
         var count = LevelIni.Count;
         var i     = 1;
         for (; i <= count; i++)
         {
             if (LevelIni.ContainsKey(i))
             {
                 if (LevelIni[i].LevelUpExp > exp)
                 {
                     break;
                 }
             }
         }
         SetLevelTo(i);
     }
 }
コード例 #2
0
ファイル: Player.cs プロジェクト: wt616/JxqyHD
        public override void SetLevelTo(int level)
        {
            if (LevelIni == null)
            {
                Level = level;
                return;
            }
            Utils.LevelDetail detail = null, currentDetail = null;
            if (LevelIni.ContainsKey(level) &&
                LevelIni.ContainsKey(Level))
            {
                detail        = LevelIni[level];
                currentDetail = LevelIni[Level];
            }
            if (detail != null)
            {
                LifeMax   += (detail.LifeMax - currentDetail.LifeMax);
                ThewMax   += (detail.ThewMax - currentDetail.ThewMax);
                ManaMax   += (detail.ManaMax - currentDetail.ManaMax);
                Life       = LifeMax;
                Thew       = ThewMax;
                Mana       = ManaMax;
                Attack    += (detail.Attack - currentDetail.Attack);
                Defend    += (detail.Defend - currentDetail.Defend);
                Evade     += (detail.Evade - currentDetail.Evade);
                LevelUpExp = detail.LevelUpExp;
                if (!string.IsNullOrEmpty(detail.NewMagic))
                {
                    AddMagic(detail.NewMagic);
                }
            }
            else
            {
                Exp        = 0;
                LevelUpExp = 0;
            }

            Level = level;
        }