Exemplo n.º 1
0
    public void OnEnchantResultHandler(C2G.RuneEnchant send, C2G.RuneEnchantAck recv)
    {
        //m_RuneEnchantIdle.Play();
        Network.PlayerInfo.UseGoods(recv.use_goods);
        GameMain.Instance.UpdatePlayerInfo();
        if (recv.is_success == true)
        {
            RuneManager.Instance.EnchantRune(Rune);

            m_SuccessTween.gameObject.SetActive(true);
            m_SuccessTween.AddOnFinished(SuccessTweenDelegate);
            m_SuccessTween.ResetToBeginning();
            m_SuccessTween.PlayForward();

            m_RuneEnchantSuccess.Play();
        }
        else
        {
            m_FailTween.gameObject.SetActive(true);
            m_FailTween.AddOnFinished(FailTweenDelegate);
            m_FailTween.ResetToBeginning();
            m_FailTween.PlayForward();

            m_RuneEnchantFail.Play();
        }
    }
Exemplo n.º 2
0
    //public void OnValueChanged(UIToggle toggle)
    //{
    //    if (toggle.instantTween == true)
    //        return;
    //    int cost = Rune.GetEnchantCostValue(toggle.name.Equals("EnchantNormal"));
    //    EventInfo event_info;
    //    if (toggle.name.Equals("EnchantNormal") == true)
    //    {
    //        event_info = EventInfoManager.Instance.GetInfoByID("rune_enchant_discount");
    //        m_EnchantSuccessLabel.text = string.Format("{0} %", Rune.GetEnchantPercent(true));
    //    }
    //    else
    //    {
    //        event_info = EventInfoManager.Instance.GetInfoByID("rune_enchant_premium_discount");
    //        m_EnchantSuccessLabel.text = string.Format("{0} %", Rune.GetEnchantPercent(false));
    //    }
    //    if (event_info.IsEventTime())
    //        cost = (int)(cost * event_info.Percent);
    //    m_EnchantCostLabel.text = cost.ToString();
    //}

    public void OnClickConfirm(GameObject btn_obj)
    {
        bool is_gold = btn_obj.name.Contains("Gold");

        if (Rune.Level == Rune.Info.GradeInfo.MaxLevel)
        {
            Tooltip.Instance.ShowMessageKey("MaxRuneLevel");
            return;
        }

        int cost;

        PacketInfo.pd_EventHottime event_info;
        if (is_gold)
        {
            cost       = Rune.GetEnchantCostValue(false);
            event_info = EventHottimeManager.Instance.GetInfoByID("rune_enchant_discount");
        }
        else
        {
            cost       = Rune.GetEnchantCostValue(true);
            event_info = EventHottimeManager.Instance.GetInfoByID("rune_enchant_premium_discount");
        }
        if (event_info != null)
        {
            cost = (int)(cost * event_info.Percent);
        }

        if (Network.PlayerInfo.GetGoodsValue(is_gold ? PacketInfo.pe_GoodsType.token_gold : PacketInfo.pe_GoodsType.token_gem) < cost)
        {
            Popup.Instance.Show(ePopupMode.MoveStore, is_gold ? PacketInfo.pe_GoodsType.token_gold : PacketInfo.pe_GoodsType.token_gem);
            return;
        }

        m_EnchantingBlock.SetActive(true);

        C2G.RuneEnchant packet = new C2G.RuneEnchant();
        packet.is_premium = !is_gold;
        packet.rune_idx   = Rune.RuneIdx;
        packet.rune_level = Rune.Level;
        packet.rune_grade = Rune.Info.Grade;
        Network.GameServer.JsonAsync <C2G.RuneEnchant, C2G.RuneEnchantAck>(packet, OnEnchantResultHandler);
    }