| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 | 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<string> name = new List<string>(){ "翻牌", "2048" };        private List<string> viewName = new List<string>() { "FlipGameView", "TZFEGameView" };        private List<string> CustemsDesc = new List<string>()        {            "首次评价达到卓越奖励:",            "首次评价达到优秀奖励:",            "首次评价达到良好奖励:",                 };        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();            _ui.m_c1.selectedIndex = 0;            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()        {            ViewManager.Show($"GFGGame.{viewName[_ui.m_c1.selectedIndex]}");            this.Hide();        }    }}
 |