| | |
| | | {
|
| | | public class TrialExchangeBehaviour : MonoBehaviour
|
| | | {
|
| | | [SerializeField] Image m_Bottom;
|
| | | [SerializeField] ItemCell m_Item;
|
| | | [SerializeField] Text m_Description;
|
| | | [SerializeField] ItemBehaviour m_Token;
|
| | | [SerializeField] Button m_Exchange;
|
| | | [SerializeField] Image m_Redpoint;
|
| | | [SerializeField] Image m_Up;
|
| | | [SerializeField] Image m_Down;
|
| | | TrialDungeonModel model { get { return ModelCenter.Instance.GetModel<TrialDungeonModel>(); } }
|
| | | DailyQuestModel dailyQuestModel { get { return ModelCenter.Instance.GetModel<DailyQuestModel>(); } }
|
| | |
|
| | | PlayerPackModel packModel { get { return ModelCenter.Instance.GetModel<PlayerPackModel>(); } }
|
| | |
|
| | | int trialExchangeId = 0;
|
| | | private void Awake()
|
| | |
| | | {
|
| | | if (error == 1)
|
| | | {
|
| | | var config = ConfigManager.Instance.GetTemplate<TrialExchangeConfig>(trialExchangeId);
|
| | | var config = Config.Instance.Get<TrialExchangeConfig>(trialExchangeId);
|
| | | if (config != null)
|
| | | {
|
| | | ModelCenter.Instance.GetModel<GetItemPathModel>().SetChinItemModel(config.tokenId);
|
| | | }
|
| | | }
|
| | | model.ProcessTrialError(error);
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | public void Display(int id)
|
| | | public void Display(int id, bool equipBetter = true, bool first = false)
|
| | | {
|
| | | m_Bottom.SetSprite(first ? "SpecialExchangeBottom" : "Title_PopupWindow");
|
| | | trialExchangeId = id;
|
| | | var config = ConfigManager.Instance.GetTemplate<TrialExchangeConfig>(id);
|
| | | var config = Config.Instance.Get<TrialExchangeConfig>(id);
|
| | | if (config == null)
|
| | | {
|
| | | trialExchangeId = 0;
|
| | |
| | | }
|
| | | m_Item.cellBtn.RemoveAllListeners();
|
| | | m_Item.gameObject.SetActive(true);
|
| | | ItemCellModel cellModel = new ItemCellModel(config.exchangeItemID, true, (ulong)config.exchangeItemCount, config.exchangeItemIsBind);
|
| | | ItemCellModel cellModel = new ItemCellModel(model.GetExchangeItemByJob(config), true, (ulong)config.exchangeItemCount, config.exchangeItemIsBind);
|
| | | m_Item.Init(cellModel);
|
| | | m_Item.cellBtn.AddListener(() =>
|
| | | {
|
| | | ItemAttrData itemAttrData = new ItemAttrData(config.exchangeItemID, true, (ulong)config.exchangeItemCount, -1, config.exchangeItemIsBind);
|
| | | ItemAttrData itemAttrData = new ItemAttrData(model.GetExchangeItemByJob(config), true, (ulong)config.exchangeItemCount, -1, config.exchangeItemIsBind, true);
|
| | | ModelCenter.Instance.GetModel<ItemTipsModel>().SetItemTipsModel(itemAttrData);
|
| | | });
|
| | | 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.Red, true);
|
| | | m_Token.count.color = UIHelper.GetUIColor(count >= config.tokenCount ? TextColType.Green : TextColType.NavyBrown, true);
|
| | | var equipCompare = model.EquipCompare(model.GetExchangeItemByJob(config));
|
| | | m_Up.gameObject.SetActive(equipCompare == 1);
|
| | | m_Down.gameObject.SetActive(equipCompare == -1);
|
| | |
|
| | | m_Redpoint.gameObject.SetActive(count >= config.tokenCount
|
| | | && dailyQuestModel.trialExchangeRedpoint.state == RedPointState.Simple);
|
| | | var exchangeItemConfig = Config.Instance.Get<ItemConfig>(model.GetExchangeItemByJob(config));
|
| | | m_Redpoint.gameObject.SetActive(count >= config.tokenCount && (equipBetter || exchangeItemConfig.EquipPlace == 0));
|
| | | }
|
| | | }
|
| | | } |