| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169 | using ET;using FairyGUI;using Hutool;using System.Collections.Generic;using UI.League;using UnityEngine;namespace GFGGame{    public class LeagueTeaPartyView : BaseWindow    {        private UI_LeagueTeaPartyUI _ui;        private List<UI_comTeaPartyItem> teaPartyItemList = new List<UI_comTeaPartyItem>();        private List<TeapartyRoleCfg> teapartyRoleCfg;        public override void Dispose()        {            if (_ui != null)            {                _ui.Dispose();                _ui = null;            }            base.Dispose();        }        protected override void OnInit()        {            base.OnInit();            packageName = UI_LeagueTeaPartyUI.PACKAGE_NAME;            _ui = UI_LeagueTeaPartyUI.Create();            this.viewCom = _ui.target;            isfullScreen = true;            _ui.m_loaBg.url = ResPathUtil.GetDressUpPath("chahuibg");            _ui.m_btnBack.onClick.Add(OnBtnBackClick);            _ui.m_btnChat.onClick.Add(OnBtnChatClick);            _ui.m_btnChallenge.onClick.Add(OnBtnChallengeClick);            _ui.m_btnReward.onClick.Add(OnBtnRewardClick);            _ui.m_teaPartyItemTips.target.onClick.Add(OnTeaPartyItemTipsClick);            _ui.m_btnRule.onClick.Add(RuleController.ShowRuleView);            _ui.m_btnRule.data = 300022;            _ui.m_ListTeaParty.itemRenderer = ListTeaPartyItemRender;            teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(LeagueDataManager.Instance.TeaPartyId);         }        private void ListTeaPartyItemRender(int index, GObject obj)        {            UI_comTeaPartyItem itemObj = UI_comTeaPartyItem.Proxy(obj);            Vector2 localpos = obj.position;//.LocalToGlobal();            itemObj.m_btnDetail.data = localpos;            itemObj.m_btnDetail.onClick.Add(OnBtnDetailClick);            itemObj.m_iconRole.data = index;            itemObj.m_iconRole.onClick.Add(OnBtnIconRoleClick);            itemObj.m_txtRoleName.text = teapartyRoleCfg[index].name;            var roleContainerList = LeagueDataManager.Instance.RoleContainerList;            itemObj.m_txtMaxValue.text = roleContainerList[index].MaxScore.ToString();            itemObj.m_txtNumber.text = roleContainerList[index].PerNum.ToString();            itemObj.m_txtMaxName.text = roleContainerList[index].MaxScoreRoleName;            UI_comTeaPartyItem.ProxyEnd();        }        protected override void AddEventListener()        {            base.AddEventListener();        }        protected override void OnShown()        {            base.OnShown();            var openCfg = TeapartyOpenCfgArray.Instance.GetCfg(LeagueDataManager.Instance.TeaPartyId);            _ui.m_txtTeaName.text = openCfg.name;            _ui.m_teaPartyItemTips.target.visible = false;            int myPos = LeagueDataManager.Instance.GetMyPos();            bool isLeader = myPos == LeaguePos.Owner || myPos == LeaguePos.SubOwner;            _ui.m_btnChallenge.visible = isLeader;            GetRoleContainerInfos();        }        private void UpDataOverTime()        {            ET.Log.Debug("打印测试-------挑战剩余时间----11------" + TimeInfo.Instance.ServerNow());            ET.Log.Debug("打印测试------挑战剩余时间-----22------" + LeagueDataManager.Instance.TeaPartyCloseTime);            _ui.m_txtOverTime.text = "挑战剩余时间:" + TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), LeagueDataManager.Instance.TeaPartyCloseTime);        }        private async void GetRoleContainerInfos()        {            bool result = await LeagueSproxy.GetRoleContainerInfos();            if (result)            {                _ui.m_ListTeaParty.numItems = 6;                UpDataOverTime();            }        }        protected override void OnHide()        {            base.OnHide();        }        protected override void RemoveEventListener()        {            base.RemoveEventListener();        }        private void OnBtnChatClick()        {            ViewManager.Show<LeagueChatView>();        }        private void OnBtnChallengeClick()        {            TeapartyStartChallenge();        }        private async void TeapartyStartChallenge()        {            bool result = await LeagueSproxy.TeapartyStartChallenge(RoleDataManager.roleId);            if (result)            {                string stroyStartID = "50001";                ViewManager.Show<StoryDialogView>(new object[] { stroyStartID, false, new OnCompleteStoryDialogCall(OnCompletePriorStoryDialog), null, true }, null, true);            }        }        private static void OnCompletePriorStoryDialog(bool isSkip, object param)        {            ViewManager.Show<LeagueTeaPartyOverView>();        }        private void OnBtnRewardClick()        {            ViewManager.Show<LeagueTeaPartyRewardView>();        }                private void OnBtnBackClick()        {            ViewManager.GoBackFrom(typeof(LeagueView).FullName);        }        private void OnBtnDetailClick(EventContext context)        {            GObject obj = context.sender as GObject;            var pos = (Vector2)obj.data;            //_ui.m_teaPartyItemTips.m_window.position = pos;            _ui.m_teaPartyItemTips.target.visible = true;        }        private void OnTeaPartyItemTipsClick()        {            _ui.m_teaPartyItemTips.target.visible = false;        }        private void OnBtnIconRoleClick(EventContext context)        {            GObject obj = context.sender as GObject;            LeagueDataManager.Instance.ChooseTeaPartId = (int)obj.data + 1;            DressUpFightType dressUpFightType = new DressUpFightType();            dressUpFightType.levelID = 0;            dressUpFightType.teaPartID = LeagueDataManager.Instance.ChooseTeaPartId;            ViewManager.Show<DressUpFightView>(dressUpFightType, new object[] { typeof(LeagueTeaPartyView).FullName, null }, true);        }    }}
 |