少年修仙传客户端代码仓库
client_linchunjie
2018-09-03 8a5662c78ff064a457c3e3d2330b0c1cb51fbb34
System/Dungeon/TrialExchangeBehaviour.cs
@@ -9,11 +9,13 @@
{
    public class TrialExchangeBehaviour : MonoBehaviour
    {
        [SerializeField] RectTransform m_ContainerSpecial;
        [SerializeField] RectTransform m_ContainerNormal;
        [SerializeField] Image m_Bottom;
        [SerializeField] ItemCell m_Item;
        [SerializeField] Text m_Description;
        [SerializeField] ItemBehaviour m_Token;
        [SerializeField] Button m_Exchange;
        [SerializeField] LongPressButton m_Exchange;
        [SerializeField] Image m_Redpoint;
        [SerializeField] Image m_Up;
        [SerializeField] Image m_Down;
@@ -25,7 +27,8 @@
        int trialExchangeId = 0;
        private void Awake()
        {
            m_Exchange.AddListener(Exchange);
            m_Exchange.onClick.AddListener(Exchange);
            m_Exchange.onPress.AddListener(LongPress);
        }
        private void Exchange()
@@ -47,9 +50,29 @@
            }
        }
        private void LongPress()
        {
            if (trialExchangeId != 0)
            {
                var config = Config.Instance.Get<TrialExchangeConfig>(trialExchangeId);
                if (config != null)
                {
                    var itemConfig = Config.Instance.Get<ItemConfig>(model.GetExchangeItemByJob(config));
                    if (itemConfig.EquipPlace == 0)
                    {
                        return;
                    }
                    ItemAttrData itemAttrData = new ItemAttrData(itemConfig.ID, true, (ulong)config.exchangeItemCount, -1, config.exchangeItemIsBind, true);
                    ModelCenter.Instance.GetModel<ItemTipsModel>().SetItemTipsModel(itemAttrData);
                }
            }
        }
        public void Display(int id, bool equipBetter = true, bool first = false)
        {
            m_Bottom.SetSprite(first ? "SpecialExchangeBottom" : "Title_PopupWindow");
            m_ContainerSpecial.gameObject.SetActive(first);
            m_ContainerNormal.gameObject.SetActive(!first);
            trialExchangeId = id;
            var config = Config.Instance.Get<TrialExchangeConfig>(id);
            if (config == null)
@@ -69,7 +92,8 @@
            m_Description.text = config.description;
            m_Token.SetItem(config.tokenId, config.tokenCount);
            var count = model.GetTrialTokenCount(config.tokenId);
            m_Token.count.color = UIHelper.GetUIColor(count >= config.tokenCount ? TextColType.Green : TextColType.NavyBrown, true);
            m_Token.count.text = StringUtility.Contact(count >= config.tokenCount ? "<color=#35e112>" : "<color=#ff0303>", count,
                "</color>/", config.tokenCount);
            var equipCompare = model.EquipCompare(model.GetExchangeItemByJob(config));
            m_Up.gameObject.SetActive(equipCompare == 1);
            m_Down.gameObject.SetActive(equipCompare == -1);