Example #1
0
    /// <summary>
    /// 根据升级前的等级来显示面板
    /// 用两个dungeonLvInfo来暂时作为数据类充数,正好需求的变量是相同的,就是名字有点怪。。。
    /// </summary>
    /// <param name="prevLv">升级前的等级</param>
    public void ShowLevelUpInfoUI(DungeonLvInfo prevLv, DungeonLvInfo afterLv)
    {
        gameObject.SetActive(true);
        prevLvCount.text  = "Lv." + prevLv.LvName;
        afterLvCount.text = "Lv." + afterLv.LvName;
        Hp.Find("PrevCount").GetComponent <Text>().text   = prevLv.HpReward + "";
        Hp.Find("AfterCount").GetComponent <Text>().text  = afterLv.HpReward + "";
        Hp.Find("RewardCount").GetComponent <Text>().text = "(+" + (afterLv.HpReward - prevLv.HpReward) + ")";

        Attack.Find("PrevCount").GetComponent <Text>().text   = prevLv.AttackReward + "";
        Attack.Find("AfterCount").GetComponent <Text>().text  = afterLv.AttackReward + "";
        Attack.Find("RewardCount").GetComponent <Text>().text = "(+" + (afterLv.AttackReward - prevLv.AttackReward) + ")";

        Defend.Find("PrevCount").GetComponent <Text>().text   = prevLv.DefendReward + "";
        Defend.Find("AfterCount").GetComponent <Text>().text  = afterLv.DefendReward + "";
        Defend.Find("RewardCount").GetComponent <Text>().text = "(+" + (afterLv.DefendReward - prevLv.DefendReward) + ")";

        Energy.Find("PrevCount").GetComponent <Text>().text   = prevLv.EPReward + "";
        Energy.Find("AfterCount").GetComponent <Text>().text  = afterLv.EPReward + "";
        Energy.Find("RewardCount").GetComponent <Text>().text = "(+" + (afterLv.EPReward - prevLv.EPReward) + ")";

        DrawCount.Find("PrevCount").GetComponent <Text>().text   = prevLv.DrawCount + "";
        DrawCount.Find("AfterCount").GetComponent <Text>().text  = afterLv.DrawCount + "";
        DrawCount.Find("RewardCount").GetComponent <Text>().text = "(+" + (afterLv.DrawCount - prevLv.DrawCount) + ")";
    }
Example #2
0
    /// <summary>
    /// 获得经验值
    /// </summary>
    /// <param name="count"></param>
    public void GainExp(int count)
    {
        currentExp += count;
        Debug.Log("获得了" + count + "经验");
        DungeonManager.Ins.RefreshUI();
        switch (CheckCanLevelUp())
        {
        case LvUpCheck.yes:
            DungeonLvInfo prevInfo = new DungeonLvInfo()
            {
                LvName       = this.currentLv + "",
                HpReward     = this.maxHp,
                AttackReward = this.Attack,
                DefendReward = this.Defend,
                EPReward     = this.maxEp,
                DrawCount    = this.Draw_count,
            };
            LevelUp();
            DungeonManager.Ins.RefreshUI();
            DungeonLvInfo afterInfo = new DungeonLvInfo()
            {
                LvName       = this.currentLv + "",
                HpReward     = this.maxHp,
                AttackReward = this.Attack,
                DefendReward = this.Defend,
                EPReward     = this.maxEp,
                DrawCount    = this.Draw_count,
            };
            Transform  parent = GameObject.Find("Canvas").transform;
            GameObject go     = Instantiate(LevelUpPanel, parent);
            go.transform.SetParent(parent);
            go.GetComponent <LevelUpInfoUI>().ShowLevelUpInfoUI(prevInfo, afterInfo);
            break;

        case LvUpCheck.max:
            return;

        case LvUpCheck.cost_unenough:
            return;
        }
    }
Example #3
0
    public void LevelUp()
    {
        if (currentLv >= maxLv)
        {
            return;
        }
        DungeonLvInfo _info = character.lvInfos[currentLv - 1];

        if (_info.HpReward != 0)
        {
            this.IncreaseHpMaxWithCurrentHp(_info.HpReward);
        }
        if (_info.AttackReward != 0)
        {
            this.IncreaseAttack(_info.AttackReward);
        }
        if (_info.DefendReward != 0)
        {
            this.IncreaseDefend(_info.DefendReward);
        }
        if (_info.EPReward != 0)
        {
            this.maxEp += _info.EPReward;
        }
        if (_info.DrawCount != 0)
        {
            this.Draw_count += _info.DrawCount;
        }
        currentExp -= maxExp;
        this.currentLv++;
        Debug.Log("升级成功,现在是" + currentLv + "级, 还剩下" + currentExp + "经验值");
        if (CheckCanLevelUp() == LvUpCheck.yes)
        {
            LevelUp();
        }
        DungeonManager.Ins.RefreshUI();
    }