| System/Dungeon/TrialExchangeBehaviour.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Dungeon/TrialExchangeBehaviour.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Dungeon/TrialExchangeCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Dungeon/TrialExchangeCell.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Dungeon/TrialExchangeTitleCell.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Dungeon/TrialExchangeTitleCell.cs.meta | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| System/Dungeon/TrialExchangeWin.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
System/Dungeon/TrialExchangeBehaviour.cs
New file @@ -0,0 +1,74 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TableConfig; using System; namespace Snxxz.UI { public class TrialExchangeBehaviour : MonoBehaviour { [SerializeField] ItemCell m_Item; [SerializeField] Text m_Description; [SerializeField] ItemBehaviour m_Token; [SerializeField] Button m_Exchange; [SerializeField] Image m_Redpoint; TrialDungeonModel model { get { return ModelCenter.Instance.GetModel<TrialDungeonModel>(); } } DailyQuestModel dailyQuestModel { get { return ModelCenter.Instance.GetModel<DailyQuestModel>(); } } int trialExchangeId = 0; private void Awake() { m_Exchange.AddListener(Exchange); } private void Exchange() { if (trialExchangeId != 0) { int error = 0; if (!model.TrialSendExchange(trialExchangeId, out error)) { if (error == 1) { var config = ConfigManager.Instance.GetTemplate<TrialExchangeConfig>(trialExchangeId); if (config != null) { ModelCenter.Instance.GetModel<GetItemPathModel>().SetChinItemModel(config.tokenId); } } model.ProcessTrialError(error); } } } public void Display(int id) { trialExchangeId = id; var config = ConfigManager.Instance.GetTemplate<TrialExchangeConfig>(id); if (config == null) { trialExchangeId = 0; return; } m_Item.cellBtn.RemoveAllListeners(); m_Item.gameObject.SetActive(true); ItemCellModel cellModel = new ItemCellModel(config.exchangeItemID, 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); 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_Redpoint.gameObject.SetActive(count >= config.tokenCount && dailyQuestModel.trialExchangeRedpoint.state == RedPointState.Simple); } } } System/Dungeon/TrialExchangeBehaviour.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 9ebb65b796d3424439f2dff414553268 timeCreated: 1533181655 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Dungeon/TrialExchangeCell.cs
@@ -1,72 +1,35 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using TableConfig; using System; using UnityEngine; namespace Snxxz.UI { public class TrialExchangeCell : CellView { [SerializeField] ItemCell m_Item; [SerializeField] Text m_Description; [SerializeField] ItemBehaviour m_Token; [SerializeField] Button m_Exchange; [SerializeField] Image m_Redpoint; [SerializeField] TrialExchangeBehaviour[] m_TrialExchanges; TrialDungeonModel model { get { return ModelCenter.Instance.GetModel<TrialDungeonModel>(); } } DailyQuestModel dailyQuestModel { get { return ModelCenter.Instance.GetModel<DailyQuestModel>(); } } int trialExchangeId = 0; private void Awake() public void Display(int _class, int _line) { m_Exchange.AddListener(Exchange); } private void Exchange() { if (trialExchangeId != 0) List<TrialExchangeConfig> list; if (!model.TryGetTrialExchanges(_class, out list)) { int error = 0; if (!model.TrialSendExchange(trialExchangeId, out error)) { if (error == 1) { var config = ConfigManager.Instance.GetTemplate<TrialExchangeConfig>(trialExchangeId); if (config != null) { ModelCenter.Instance.GetModel<GetItemPathModel>().SetChinItemModel(config.tokenId); } } model.ProcessTrialError(error); } } } public void Display(int id) { trialExchangeId = id; var config = ConfigManager.Instance.GetTemplate<TrialExchangeConfig>(id); if (config == null) { trialExchangeId = 0; return; } m_Item.cellBtn.RemoveAllListeners(); m_Item.gameObject.SetActive(true); ItemCellModel cellModel = new ItemCellModel(config.exchangeItemID, true, (ulong)config.exchangeItemCount, config.exchangeItemIsBind); m_Item.Init(cellModel); m_Item.cellBtn.AddListener(() => for (int i = 0; i < m_TrialExchanges.Length; i++) { ItemAttrData itemAttrData = new ItemAttrData(config.exchangeItemID, true, (ulong)config.exchangeItemCount, -1, config.exchangeItemIsBind); 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_Redpoint.gameObject.SetActive(count >= config.tokenCount && dailyQuestModel.trialExchangeRedpoint.state == RedPointState.Simple); var index = _line * 4 + i; if (index < list.Count) { m_TrialExchanges[i].gameObject.SetActive(true); m_TrialExchanges[i].Display(list[index].id); } else { m_TrialExchanges[i].gameObject.SetActive(false); } } } } } System/Dungeon/TrialExchangeCell.cs.meta
@@ -1,6 +1,6 @@ fileFormatVersion: 2 guid: 9ebb65b796d3424439f2dff414553268 timeCreated: 1533181655 guid: 5c0805e8cad6c2e44bbd30aaaff7008f timeCreated: 1534302392 licenseType: Pro MonoImporter: serializedVersion: 2 System/Dungeon/TrialExchangeTitleCell.cs
New file @@ -0,0 +1,19 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; namespace Snxxz.UI { public class TrialExchangeTitleCell : CellView { [SerializeField] Image m_BackGround; [SerializeField] Text m_Title; public void Display(int _class) { m_Title.text = Language.Get("TrialExchangeTitle", _class); } } } System/Dungeon/TrialExchangeTitleCell.cs.meta
New file @@ -0,0 +1,12 @@ fileFormatVersion: 2 guid: 62d21c0bcc1b7ad4e8528d2bfb9f7b91 timeCreated: 1534303452 licenseType: Pro MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 icon: {instanceID: 0} userData: assetBundleName: assetBundleVariant: System/Dungeon/TrialExchangeWin.cs
@@ -98,8 +98,19 @@ #endregion private void OnRefreshCell(ScrollerDataType type, CellView cell) { TrialExchangeCell trialExchangeCell = cell as TrialExchangeCell; trialExchangeCell.Display(cell.index); switch (type) { case ScrollerDataType.Header: var _class = cell.index / 100; var _line = cell.index % 100; TrialExchangeCell trialExchangeCell = cell as TrialExchangeCell; trialExchangeCell.Display(_class, _line); break; case ScrollerDataType.Normal: TrialExchangeTitleCell trialExchangeTitleCell = cell as TrialExchangeTitleCell; trialExchangeTitleCell.Display(cell.index); break; } } private void SelectClassUp() @@ -124,10 +135,19 @@ m_Controller.Refresh(); if (model.selectEquipClass == 1) { var configs = ConfigManager.Instance.GetAllValues<TrialExchangeConfig>(); for (int i = 0; i < configs.Count; i++) var trialClasses = model.GetTotalClass(); for (int i = 0; i < trialClasses.Count; i++) { m_Controller.AddCell(ScrollerDataType.Header, configs[i].id); List<TrialExchangeConfig> list; if (model.TryGetTrialExchanges(trialClasses[i], out list)) { m_Controller.AddCell(ScrollerDataType.Normal, trialClasses[i]); var line = Mathf.CeilToInt((float)list.Count / 4); for (int k = 0; k < line; k++) { m_Controller.AddCell(ScrollerDataType.Header, trialClasses[i] * 100 + k); } } } } else @@ -135,9 +155,10 @@ List<TrialExchangeConfig> list; if (model.TryGetTrialExchanges(model.selectEquipClass, out list)) { for (int i = 0; i < list.Count; i++) var line = Mathf.CeilToInt((float)list.Count / 4); for (int i = 0; i < line; i++) { m_Controller.AddCell(ScrollerDataType.Header, list[i].id); m_Controller.AddCell(ScrollerDataType.Header, model.selectEquipClass * 100 + i); } } }