123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- using System;
- using System.Collections.Generic;
- using ET;
- using FairyGUI;
- using UI.MatchingCompetition;
- using UnityEngine;
- namespace GFGGame
- {
- class MatchingCompetitionSelectView : BaseWindow
- {
- private UI_MatchingCompetitionSelectUI _ui;
- private int _seasonIndex = 0;
- private bool isRefresh = false;
- public override void Dispose()
- {
- if (_ui != null)
- {
- _ui.Dispose();
- }
- _ui = null;
- base.Dispose();
- }
- protected override void OnInit()
- {
- base.OnInit();
- packageName = UI_MatchingCompetitionSelectUI.PACKAGE_NAME;
- _ui = UI_MatchingCompetitionSelectUI.Create();
- this.viewCom = _ui.target;
- isReturnView = true;
- isfullScreen = true;
- _ui.m_BtnBack.onClick.Add(OnClickBtnBack);
- _ui.m_select1.target.onClick.Add(OnClickBtnSelect1);
- _ui.m_select2.target.onClick.Add(OnClickBtnSelect2);
- _ui.m_ruleBtn.onClick.Add(MatchingCompetitionDataManager.Instance.OnClickBtnRule);
- }
- protected override void OnShown()
- {
- base.OnShown();
- _ui.m_bg.url = ResPathUtil.GetBgImgPath("gzs_fb_bj");
- _ui.m_BtnBack.touchable = true;
- _ui.m_titleText.text = JudgingRoundOpenCfgArray.Instance.dataArray[MatchingCompetitionDataManager.Instance.MatchingCompetitionSeason].Name;
- //isRefresh = (bool)this.viewData;
- UpdateView();
- UpdatePlayer();
- }
- protected override void OnHide()
- {
- base.OnHide();
- }
- protected override void AddEventListener()
- {
- base.AddEventListener();
- EventAgent.AddEventListener(ConstMessage.DOWNLOAD_FINISH, UpdatePlayer);
- }
- protected override void RemoveEventListener()
- {
- base.RemoveEventListener();
- EventAgent.RemoveEventListener(ConstMessage.DOWNLOAD_FINISH, UpdatePlayer);
- }
- private void UpdatePlayer()
- {
- _ui.m_playerShow1.m_playerImage.m_playerImage.texture = MatchingTwoDataManager.Instance.LeftRoleInfo.Ntexture;
- _ui.m_playerShow2.m_playerImage.m_playerImage.texture = MatchingTwoDataManager.Instance.RightRoleInfo.Ntexture;
- MatchingPhotoWorksData otherLeftdata = MatchingTwoDataManager.Instance.LeftRoleInfo;
- JudgingRoundRoleInfo otherLeftInfo = otherLeftdata.JudgingInfo;
- RoleInfoManager.Instance.UpdateHead(_ui.m_player1.m_head, otherLeftInfo.HeadItemId, otherLeftInfo.HeadBorderItemId);
- _ui.m_player1.m_nameText.text = otherLeftInfo.RoleName.ToString();
- _ui.m_select1.m_numText.text = otherLeftInfo.Score.ToString();
- MatchingPhotoWorksData otherRightdata = MatchingTwoDataManager.Instance.RightRoleInfo;
- JudgingRoundRoleInfo otherRightInfo = otherRightdata.JudgingInfo;
- RoleInfoManager.Instance.UpdateHead(_ui.m_player2.m_head, otherRightInfo.HeadItemId, otherRightInfo.HeadBorderItemId);
- _ui.m_player2.m_nameText.text = otherRightInfo.RoleName.ToString();
- _ui.m_select2.m_numText.text = otherRightInfo.Score.ToString();
- }
- private void UpdateView()
- {
- _ui.m_selectText1.alpha = 0;
- _ui.m_selectText2.alpha = 0;
- _ui.m_timeText.text = string.Format("剩余次数:{0}", MatchingCompetitionDataManager.Instance.MatchingRemainingTimes);
- }
- private void OnClickBtnBack()
- {
- _ui.m_BtnBack.touchable = true;
- ViewManager.GoBackFrom(typeof(MatchingCompetitionSelectView).FullName);
- }
- private async void OnClickBtnSelect1()
- {
- if(MatchingCompetitionDataManager.Instance.MatchingRemainingTimes<=0)
- {
- PromptController.Instance.ShowFloatTextPrompt("评选次数不足");
- return;
- }
- bool result = await MatchingCompetitionSproxy.ReqCheckMatchingCompetitionWork(
- MatchingTwoDataManager.Instance.LeftRoleInfo.JudgingInfo.WorksId,MatchingTwoDataManager.Instance.RightRoleInfo.JudgingInfo.WorksId
- ) ;
- if(result)
- {
- _ui.m_select1.m_c1.selectedIndex = 1;
- _ui.m_select1.m_numText.text = string.Format("心动值{0}", MatchingTwoDataManager.Instance.LeftRoleInfo.JudgingInfo.Score.ToString());
- _ui.m_timeText.text = string.Format("剩余次数:{0}", MatchingCompetitionDataManager.Instance.MatchingRemainingTimes);
- _ui.m_BtnBack.touchable = false;
- _ui.m_t0.Play(() => OnClickBtnBack());
- }
- }
- private async void OnClickBtnSelect2()
- {
- if (MatchingCompetitionDataManager.Instance.MatchingRemainingTimes <= 0)
- {
- PromptController.Instance.ShowFloatTextPrompt("评选次数不足");
- return;
- }
- bool result = await MatchingCompetitionSproxy.ReqCheckMatchingCompetitionWork(
- MatchingTwoDataManager.Instance.RightRoleInfo.JudgingInfo.WorksId, MatchingTwoDataManager.Instance.LeftRoleInfo.JudgingInfo.WorksId
- );
- if (result)
- {
- _ui.m_select2.m_c1.selectedIndex = 1;
- _ui.m_select2.m_numText.text = string.Format("心动值{0}", MatchingTwoDataManager.Instance.RightRoleInfo.JudgingInfo.Score.ToString());
- _ui.m_timeText.text = string.Format("剩余次数:{0}", MatchingCompetitionDataManager.Instance.MatchingRemainingTimes);
- _ui.m_BtnBack.touchable = false;
- _ui.m_t1.Play(() => OnClickBtnBack());
- }
- }
- }
- }
|