123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137 |
- 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.GetBgImgPath("zjm_2_2");
- _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_ListTeaParty.itemRenderer = ListTeaPartyItemRender;
- teapartyRoleCfg = TeapartyRoleCfgArray.Instance.GetCfgsByid(1); //LeagueDataManager.Instance.TeaPartyId
- }
- private void ListTeaPartyItemRender(int index, GObject obj)
- {
- UI_comTeaPartyItem itemObj = UI_comTeaPartyItem.Proxy(obj);
- itemObj.m_btnDetail.onClick.Add(OnBtnDetailClick);
- itemObj.m_iconRole.onClick.Add(OnBtnIconRoleClick);
- itemObj.m_txtRoleName.text = teapartyRoleCfg[index].name;
- itemObj.target.onClick.Add(OnTeaPartyItemTipsClick);
- UI_comTeaPartyItem.ProxyEnd();
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- }
- protected override void OnShown()
- {
- base.OnShown();
- GetRoleContainerInfos();
- var openCfg = TeapartyOpenCfgArray.Instance.GetCfg(1);//LeagueDataManager.Instance.TeaPartyId
- _ui.m_txtTeaName.text = openCfg.name;
- _ui.m_btnRule.onClick.Add(RuleController.ShowRuleView);
- _ui.m_btnRule.data = 300022;
- _ui.m_teaPartyItemTips.target.visible = false;
- _ui.m_ListTeaParty.numItems = 6;
- }
- private async void GetRoleContainerInfos()
- {
- bool result = await LeagueSproxy.GetRoleContainerInfos();
- if (result)
- {
- var roleContainerList = LeagueDataManager.Instance.RoleContainerList;
- for (int index = 0; index < roleContainerList.Count; index++){
- teaPartyItemList[index].m_txtMaxValue.text = roleContainerList[index].MaxScore.ToString();
- }
- }
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- }
- private void OnBtnChatClick()
- {
- ViewManager.Show<LeagueChatView>();
- }
- private void OnBtnChallengeClick()
- {
- PromptController.Instance.ShowFloatTextPrompt("开始挑战");
- ViewManager.Show<LeagueTeaPartyOverView>();
- }
- private void OnBtnRewardClick()
- {
- ViewManager.Show<LeagueTeaPartyRewardView>();
- }
-
- private void OnBtnBackClick()
- {
- ViewManager.GoBackFrom(typeof(LeagueView).FullName);
- }
- private void OnBtnDetailClick()
- {
- _ui.m_teaPartyItemTips.target.visible = true;
- }
-
- private void OnTeaPartyItemTipsClick()
- {
- _ui.m_teaPartyItemTips.target.visible = false;
- }
- private void OnBtnIconRoleClick()
- {
- FieldCfg _curCfg;
- _curCfg = FieldCfgArray.Instance.dataArray[FieldDataManager.Instance.difficulty];
- int curLevelId = StoryLevelCfgArray.Instance.GetCfgsBytypeAndsubTypeAndchapterId(_curCfg.type, 0, _curCfg.id)[0].id;
- ViewManager.Show<DressUpFightView>(0, new object[] { typeof(LeagueTeaPartyView).FullName, null }, true);
- }
- }
- }
|