예제 #1
0
    public void OnClick()
    {
        m_btnLevelUp.isEnabled = false;
        m_btnLevelUp.SetPressed(false);

        C2G.SkillEnchantLevel packet = new C2G.SkillEnchantLevel();
        packet.creature_idx = m_Skill.Creature.Idx;
        packet.creature_id  = m_Skill.Creature.Info.ID;
        packet.skill_id     = m_Skill.Info.ID;
        packet.skill_index  = m_Skill.Index;
        packet.skill_level  = m_Skill.Level;

        if (add_level > 1)
        {
            packet.add_level = add_level;
        }
        else
        {
            if (m_Skill.Creature.Level <= m_Skill.Level)
            {
                Tooltip.Instance.ShowMessageKey("NotAvailableSkillEnchantLevel");
                return;
            }
            if (current_enchant_gold > current_gold)
            {
                Popup.Instance.Show(ePopupMode.MoveStore, pe_GoodsType.token_gold);
                return;
            }

            add_level        = 1;
            packet.add_level = add_level;
        }

        if (Tutorial.Instance.Completed == false)
        {
            C2G.TutorialState tutorial_packet = new C2G.TutorialState();
            tutorial_packet.tutorial_state      = (short)Tutorial.Instance.CurrentState;
            tutorial_packet.next_tutorial_state = (short)Tutorial.Instance.NextState;
            tutorial_packet.skill_enchant       = packet;
            Network.GameServer.JsonAsync <C2G.TutorialState, C2G.TutorialStateAck>(tutorial_packet, OnTutorialSkillEnchant);
        }
        else
        {
            Network.GameServer.JsonAsync <C2G.SkillEnchantLevel, C2G.SkillEnchantAck>(packet, OnSkillEnchant);
        }
    }
예제 #2
0
    void OnSkillEnchant(C2G.SkillEnchantLevel packet, C2G.SkillEnchantAck ack)
    {
        if (Network.PlayerInfo.UseGoods(ack.use_gold) == false)
        {
            Popup.Instance.Show(ePopupMode.MoveStore, pe_GoodsType.token_gold);
            return;
        }

        m_ParticleContainer.Play();

        string tooptip = m_Skill.GetLevelupTooltip(packet.add_level);

        string[] tooltips = tooptip.Split(new char[] { '\n' });

        float delay = 0f;

        foreach (string tip in tooltips)
        {
            if (string.IsNullOrEmpty(tip))
            {
                continue;
            }

            var levelup = m_LevelupContainer.GetNewObject <SkillEnchantItemLevelup>(transform, Vector3.zero);
            levelup.Init(delay, tip, OnFinishLevelup);
            delay += 0.3f;
        }

        CreatureManager.Instance.SkillLevelUP(m_Skill.Creature, packet.skill_index, packet.add_level);
        Init(m_Skill, m_LevelupContainer);
        GameMain.Instance.UpdatePlayerInfo();

        if (m_Skill.Creature.AvailableSkillEnchant == false)
        {
            CreatureManager.Instance.UpdateNotify();
        }

        if (_OnSkillEnchant != null)
        {
            _OnSkillEnchant();
        }

        //InitSkillEnchantValue();
    }