using System; using System.Collections.Generic; using ET; using FairyGUI; using UI.MiniGame; using UnityEngine; namespace GFGGame { public class FlipGameStartView : BaseView { private UI_FlipGameStartUI _ui; //后续这里改成读表内容 private List name = new List(){ "翻牌", "2048" }; private List CustemsDesc = new List() { "首次评价达到卓越奖励:", "首次评价达到优秀奖励:", "首次评价达到良好奖励:", }; private int currentGame = 0; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_FlipGameStartUI.PACKAGE_NAME; _ui = UI_FlipGameStartUI.Create(); this.viewCom = _ui.target; isfullScreen = true; _ui.m_settingTypeList.itemRenderer = RenderListType; _ui.m_descList.itemRenderer = RenderDescList; _ui.m_failRewardList.itemRenderer = RenderFailReward; _ui.m_passRewardList.itemRenderer = RenderPassReward; _ui.m_btnBack.onClick.Add(OnClickBtnBack); _ui.m_shop.onClick.Add(OnClickBtnShop); _ui.m_addIcon.onClick.Add(OnClickBtnAdd); _ui.m_gameStart.onClick.Add(OnClickBtnStart); } protected override void OnShown() { base.OnShown(); UpdateView(); UpdateList(); } protected override void OnHide() { base.OnHide(); } private void UpdateView() { //_ui.m_showGame.url = _ui.m_c1.selectedIndex; _ui.m_ticketNum.text = "999"; } private void UpdateList() { _ui.m_settingTypeList.numItems = name.Count; _ui.m_descList.numItems = 3; _ui.m_passRewardList.numItems = name.Count; _ui.m_failRewardList.numItems = name.Count; } private void OnClickBtnBack() { this.Hide(); } private void RenderFailReward(int index, GObject item) { //这里也读表 } private void RenderPassReward(int index, GObject item) { //这里也读表 } private void RenderDescList(int index, GObject item) { UI_descItem descItem = UI_descItem.Proxy(item); descItem.m_desc.text = CustemsDesc[index]; descItem.m_rewardNum.text = index.ToString(); switch (index) { case 0: break; case 1: descItem.m_star3.visible = false; break; case 2: descItem.m_star3.visible = false; descItem.m_star2.visible = false; break; default: break; }; UI_descItem.ProxyEnd(); //这里也读表 } private void RenderListType(int index, GObject item) { UI_Button6 button6 = UI_Button6.Proxy(item); button6.m_title1.text = name[index]; button6.m_title2.text = name[index]; button6.target.onClick.Add(OnClickChangeGame); button6.target.data = name; UI_Button6.ProxyEnd(); } private void OnClickChangeGame(EventContext param) { if(currentGame == _ui.m_c1.selectedIndex) { return; } currentGame = _ui.m_c1.selectedIndex; UpdateView(); UpdateList(); } private void OnClickBtnShop() { } private void OnClickBtnAdd() { } private void OnClickBtnStart() { if(_ui.m_c1.selectedIndex == 0) { ViewManager.Show(); this.Hide(); } } } }