コード例 #1
0
    void Init()
    {
        m_SuccessTween.gameObject.SetActive(false);
        m_FailTween.gameObject.SetActive(false);

        m_Rune.RefreshRuneInfo(Rune);
        m_Rune.GetComponent <BoxCollider2D>().enabled = false;

        m_EnchantRuneLabel.text = Rune.GetName();

        m_RuneLevelObjs[0].GetComponent <UILabel>().text = Localization.Get("RuneLevel");
        m_RuneLevelObjs[1].GetComponent <UILabel>().text = Rune.Level.ToString();

        m_RuneInfoObjs[0].GetComponent <UILabel>().text = Localization.Get(string.Format("StatType_{0}", SkillInfoManager.Instance.GetInfoByID(Rune.Info.Skill.ID).Actions[0].statType));
        m_RuneInfoObjs[1].GetComponent <UILabel>().text = Rune.GetValue().ToString();

        if (Rune.Level == Rune.Info.GradeInfo.MaxLevel)
        {
            m_RuneLevelObjs[1].GetComponent <UILabel>().text = Localization.Get("MAX");
            //m_RuneInfoObjs[1].GetComponent<UILabel>().text = Rune.GetValue().ToString();

            m_RuneLevelObjs[2].SetActive(false);
            m_RuneLevelObjs[3].SetActive(false);
            m_RuneLevelObjs[4].SetActive(false);
            m_RuneInfoObjs[2].SetActive(false);
            m_RuneInfoObjs[3].SetActive(false);

            m_GoldCostLabel.text           = Localization.Get("MAX");
            m_GoldSuccessPercentLabel.text = string.Format("{0:F2} %", 0);
            m_CashCostLabel.text           = Localization.Get("MAX");
            m_CashSuccessPercentLabel.text = string.Format("{0:F2} %", 0);

            m_EventNormal.SetActive(false);
            m_EventPremium.SetActive(false);
        }
        else
        {
            var enchanted_rune = Rune.Clone();
            enchanted_rune.OnLevelUp();

            m_RuneLevelObjs[2].SetActive(true);
            m_RuneLevelObjs[3].SetActive(true);
            //m_RuneLevelObjs[4].SetActive(true);

            m_RuneLevelObjs[3].GetComponent <UILabel>().text        = string.Format("{0}", enchanted_rune.Level);
            m_RuneLevelObjs[3].GetComponent <UILabel>().color       = enchanted_rune.Level % 5 == 0 ? new_color_bonus : new_color;
            m_RuneLevelObjs[3].GetComponent <UILabel>().effectStyle = UILabel.Effect.Outline;

            //m_RuneLevelObjs[4].GetComponent<UILabel>().text = string.Format("/ {0}", enchanted_rune.Info.GradeInfo.MaxLevel);

            m_RuneInfoObjs[2].SetActive(true);
            m_RuneInfoObjs[3].SetActive(true);
            m_RuneInfoObjs[3].GetComponent <UILabel>().text        = enchanted_rune.GetValue().ToString();
            m_RuneInfoObjs[3].GetComponent <UILabel>().color       = enchanted_rune.Level % 5 == 0 ? new_color_bonus : new_color;
            m_RuneInfoObjs[3].GetComponent <UILabel>().effectStyle = UILabel.Effect.Outline;

            int cost               = Rune.GetEnchantCostValue(false);
            int premium_cost       = Rune.GetEnchantCostValue(true);
            var premium_event_info = EventHottimeManager.Instance.GetInfoByID("rune_enchant_premium_discount");
            var event_info         = EventHottimeManager.Instance.GetInfoByID("rune_enchant_discount");

            if (event_info != null)
            {
                cost = (int)(cost * event_info.Percent);
            }
            if (premium_event_info != null)
            {
                premium_cost = (int)(premium_cost * event_info.Percent);
            }

            m_GoldCostLabel.text           = cost.ToString();
            m_GoldSuccessPercentLabel.text = string.Format("{0:F2} %", Rune.GetEnchantPercent(false));

            m_CashCostLabel.text           = premium_cost.ToString();
            m_CashSuccessPercentLabel.text = string.Format("{0:F2} %", Rune.GetEnchantPercent(true));

            m_EventNormal.SetActive(EventHottimeManager.Instance.IsRuneEnchantNormalEvent);
            m_EventPremium.SetActive(EventHottimeManager.Instance.IsRuneEnchantPremiumEvent);
        }
    }