Ejemplo n.º 1
0
    public void OnLevelup()
    {
        int exp_max = LevelInfoManager.Instance.GetCharacterExpMax(m_Creature.Level);

        if (exp_max == 0)
        {
            Tooltip.Instance.ShowMessageKeyFormat("CharacterLevelupLimit", m_Creature.Level);
            return;
        }

        int level_limit = m_Creature.LevelLimit;

        if (m_Creature.Level >= level_limit)
        {
            Tooltip.Instance.ShowMessageKeyFormat("CharacterLevelupLimit", level_limit);
            return;
        }

        if ((exp_max - m_Creature.Exp) > Network.PlayerInfo.GetGoodsValue(PacketInfo.pe_GoodsType.token_exp_powder))
        {
            //Tooltip.Instance.ShowMessageKey("NotEnoughExpPowder");
            Popup.Instance.Show(ePopupMode.ExpPowderMove);
            return;
        }

        C2G.CreatureLevelup packet = new C2G.CreatureLevelup();
        packet.creature_idx = m_Creature.Idx;
        packet.level        = m_Creature.Level;
        packet.grade        = m_Creature.Grade;
        packet.exp          = m_Creature.Exp;
        packet.add_level    = 1;
        Network.GameServer.JsonAsync <C2G.CreatureLevelup, C2G.CreatureLevelupAck>(packet, OnLevelupAck);
    }
Ejemplo n.º 2
0
    void OnLevelupAck(C2G.CreatureLevelup packet, C2G.CreatureLevelupAck ack)
    {
        m_LevelupParticleContainer.Play();
        m_Creature.UpdateExp(ack.creature_exp_add_info);
        m_Creature.CheckNotify();
        Network.PlayerInfo.UseGoodsValue(ack.use_goods.goods_type, ack.use_goods.goods_value);

        Init();

        var menu_info = GameMain.Instance.GetCurrentMenu();

        if (menu_info.obj != null)
        {
            var menu = menu_info.obj.GetComponent <HeroInfoDetail>();
            menu.UpdateMenu();
            menu.Levelup();
        }

        if (ack.maxlevel_reward_mail_idx > 0)
        {
            C2G.MailRewardDirect reward_mail = new C2G.MailRewardDirect();
            reward_mail.mail_idx = ack.maxlevel_reward_mail_idx;
            Network.GameServer.JsonAsync <C2G.MailRewardDirect, C2G.MailRewardDirectAck>(reward_mail, OnMailRewardAck);
        }
    }