553 lines
16 KiB
C#
553 lines
16 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Cute;
|
|
using LitJson;
|
|
using UnityEngine;
|
|
using Wizard;
|
|
using Wizard.Bingo;
|
|
using Wizard.Lottery;
|
|
using Wizard.UI.Dialog;
|
|
|
|
public abstract class MyPageBannerBase : MonoBehaviour
|
|
{
|
|
public class BannerInfo
|
|
{
|
|
public string ImageName;
|
|
|
|
public string Click;
|
|
|
|
public string Status;
|
|
|
|
public List<string> ImagePaths;
|
|
|
|
public float _changeTime = 5f;
|
|
|
|
public bool NeedBadge;
|
|
|
|
public override bool Equals(object obj)
|
|
{
|
|
if (obj == null || GetType() != obj.GetType())
|
|
{
|
|
return false;
|
|
}
|
|
BannerInfo bannerInfo = obj as BannerInfo;
|
|
if (ImageName == bannerInfo.ImageName && Click == bannerInfo.Click && Status == bannerInfo.Status && _changeTime == bannerInfo._changeTime && NeedBadge == bannerInfo.NeedBadge)
|
|
{
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public override int GetHashCode()
|
|
{
|
|
return ImageName.GetHashCode() ^ Click.GetHashCode() ^ Status.GetHashCode();
|
|
}
|
|
}
|
|
|
|
[SerializeField]
|
|
private BannerDialog _prefabDialogMypageBanner;
|
|
|
|
[SerializeField]
|
|
private GameObject _deckIntroductionPrefab;
|
|
|
|
protected List<BannerInfo> _bannerList;
|
|
|
|
private List<string> _loadAssetList;
|
|
|
|
private bool _isActive = true;
|
|
|
|
private bool _isCreateEnd;
|
|
|
|
private bool _isCreate;
|
|
|
|
private Coroutine _createCoroutine;
|
|
|
|
public bool _isFirstTips { private get; set; }
|
|
|
|
public bool IsEnableBanner
|
|
{
|
|
get
|
|
{
|
|
if (_bannerList == null || _bannerList.Count == 0)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
|
|
protected abstract IEnumerator CreateBannerImage();
|
|
|
|
private IEnumerator CreateBanner()
|
|
{
|
|
yield return CreateBannerImage();
|
|
_isCreateEnd = true;
|
|
_createCoroutine = null;
|
|
if (IsEnableBanner && _bannerList.Count > 0)
|
|
{
|
|
SetActive(_isActive);
|
|
}
|
|
}
|
|
|
|
public void SetActive(bool inActive)
|
|
{
|
|
_isActive = inActive;
|
|
if (_isCreateEnd)
|
|
{
|
|
if (!IsEnableBanner)
|
|
{
|
|
base.gameObject.SetActive(value: false);
|
|
_isActive = false;
|
|
}
|
|
else
|
|
{
|
|
base.gameObject.SetActive(inActive);
|
|
_isActive = inActive;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
_isActive = inActive;
|
|
}
|
|
}
|
|
|
|
public static void SceneChangeBySetting(string click, string status)
|
|
{
|
|
switch (click)
|
|
{
|
|
case "announce":
|
|
|
|
UIManager.GetInstance().WebViewHelper.OpenAnnounceWebView(status);
|
|
return;
|
|
case "colosseum":
|
|
|
|
OpenColosseumRound();
|
|
return;
|
|
case "dialog_text":
|
|
OnClickDialogText(status);
|
|
return;
|
|
case "lottery":
|
|
OnClickIncentiveCampaign(int.Parse(status));
|
|
return;
|
|
case "beginner_mission":
|
|
OnClickBeginnerMission();
|
|
return;
|
|
case "webview":
|
|
|
|
UIManager.GetInstance().WebViewHelper.OpenWebviewWithPageId(status);
|
|
return;
|
|
case "webview_limited":
|
|
|
|
UIManager.GetInstance().WebViewHelper.OpenWebViewDirectly(status, isLimited: true);
|
|
return;
|
|
case "battle_pass_buy":
|
|
|
|
BattlePassPurchaseDialog.Create();
|
|
return;
|
|
case "browser":
|
|
OnClickOpenBrowser(status);
|
|
return;
|
|
case "data_link":
|
|
MyPageOtherButtons.CreateDataLinkDialog();
|
|
return;
|
|
case "account_link":
|
|
MyPageOtherButtons.CreateDialogAccountLink();
|
|
return;
|
|
case "mypage_battle":
|
|
if (MyPageMenu.Instance != null)
|
|
{
|
|
|
|
MyPageMenu.Instance.ChangeMenu(2);
|
|
}
|
|
return;
|
|
case "mypage_deck":
|
|
if (MyPageMenu.Instance != null)
|
|
{
|
|
|
|
MyPageMenu.Instance.ChangeMenu(4);
|
|
MyPageMenu.Instance.GoToCardDeck();
|
|
}
|
|
return;
|
|
case "competition":
|
|
|
|
OnClickCompetitionBanner();
|
|
return;
|
|
case "bingo":
|
|
OnClickBingoEvent();
|
|
return;
|
|
case "upgrade_treasure_box_cp_dialog":
|
|
OnClickTreasureBoxCpDialog();
|
|
return;
|
|
case "red_ether":
|
|
|
|
UIManager.GetInstance().ChangeViewScene(UIManager.ViewScene.RedEtherCampaignLobby);
|
|
return;
|
|
case "ts_rotation_deck":
|
|
|
|
DeckListUI.ChangeSceneToDeckList(Format.Rotation);
|
|
return;
|
|
case "account_transition_with_two":
|
|
StartTransititonTask();
|
|
return;
|
|
case "crystal":
|
|
return;
|
|
case "special_crystal":
|
|
return;
|
|
}
|
|
if (click.StartsWith("speed_challenge"))
|
|
{
|
|
HandleSpeedChallenge(click, status);
|
|
}
|
|
else if (SceneTransition.TransitionData.HasTransitionData(click))
|
|
{
|
|
SceneTransition.TransitionData transitionData = new SceneTransition.TransitionData(click);
|
|
if (int.TryParse(status, out var result))
|
|
{
|
|
transitionData.Status = result;
|
|
}
|
|
|
|
SceneTransition.ChangeScene(transitionData, null);
|
|
}
|
|
}
|
|
|
|
private static void OnClickOpenBrowser(string url)
|
|
{
|
|
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
|
SystemText systemText = Data.SystemText;
|
|
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_GrayBtn);
|
|
dialogBase.SetButtonText(systemText.Get("Dia_Web_001_Button"), systemText.Get("Common_0005"));
|
|
dialogBase.SetText(systemText.Get("Common_0208"));
|
|
dialogBase.onPushButton1 = delegate
|
|
{
|
|
BrowserURL.Open(url);
|
|
};
|
|
}
|
|
|
|
private static void HandleSpeedChallenge(string kind, string status)
|
|
{
|
|
SystemText systemText = Data.SystemText;
|
|
if (kind == "speed_challenge")
|
|
{
|
|
SceneChangeBySetting("mypage_battle", status);
|
|
return;
|
|
}
|
|
if (kind == "speed_challenge_clear")
|
|
{
|
|
|
|
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
|
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
|
dialogBase.SetTitleLabel(systemText.Get("SpeedChallenge_0001"));
|
|
dialogBase.SetSize(DialogBase.Size.M);
|
|
GameObject gameObject = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/DialogSpeedChallenge")) as GameObject;
|
|
dialogBase.SetObj(gameObject);
|
|
DialogSpeedChallenge component = gameObject.GetComponent<DialogSpeedChallenge>();
|
|
string text = systemText.Get("SpeedChallenge_0003");
|
|
if (Data.MyPage.data.SpeedChallengeInfo != null)
|
|
{
|
|
string arg = ConvertTime.ToLocal(Data.MyPage.data.SpeedChallengeInfo.Announce, ConvertTime.FORMAT.TIME_DATE_LONG_SPECIAL);
|
|
text = string.Format(text, arg);
|
|
}
|
|
component.SetText(text);
|
|
component.SetTexture("banner_000764");
|
|
return;
|
|
}
|
|
|
|
DialogBase dialogBase2 = UIManager.GetInstance().CreateDialogClose();
|
|
dialogBase2.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
|
dialogBase2.SetTitleLabel(systemText.Get("SpeedChallenge_0001"));
|
|
dialogBase2.SetSize(DialogBase.Size.M);
|
|
GameObject gameObject2 = UnityEngine.Object.Instantiate(Resources.Load("UI/layoutParts/Dialog/DialogSpeedChallengeResult")) as GameObject;
|
|
dialogBase2.SetObj(gameObject2);
|
|
DialogSpeedChallengeResult component2 = gameObject2.GetComponent<DialogSpeedChallengeResult>();
|
|
if (kind == "speed_challenge_lottery")
|
|
{
|
|
component2.SetRankText(systemText.Get("Mission_0055"));
|
|
}
|
|
else
|
|
{
|
|
component2.SetRankWithNumber(int.Parse(status));
|
|
}
|
|
if (Data.MyPage.data.SpeedChallengeInfo == null)
|
|
{
|
|
return;
|
|
}
|
|
if (Data.MyPage.data.SpeedChallengeInfo.Message != null)
|
|
{
|
|
if (kind == "speed_challenge_lottery")
|
|
{
|
|
component2.SetText(Data.MyPage.data.SpeedChallengeInfo.Message);
|
|
}
|
|
else
|
|
{
|
|
component2.SetText(string.Format(Data.MyPage.data.SpeedChallengeInfo.Message, status));
|
|
}
|
|
}
|
|
if (Data.MyPage.data.SpeedChallengeInfo.ApplyUrl != null)
|
|
{
|
|
component2.SetUrl(Data.MyPage.data.SpeedChallengeInfo.ApplyUrl);
|
|
}
|
|
}
|
|
|
|
private static void OpenColosseumRound()
|
|
{
|
|
ColosseumEntryInfoTask task = new ColosseumEntryInfoTask();
|
|
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, ColosseumEntryInfoConnectSuccess));
|
|
}
|
|
|
|
private static void ColosseumEntryInfoConnectSuccess(NetworkTask.ResultCode error)
|
|
{
|
|
bool flag = false;
|
|
if (Data.ArenaData.ColosseumData.IsTwoPickRule)
|
|
{
|
|
if (Data.ArenaData.ColosseumData.isJoin)
|
|
{
|
|
flag = true;
|
|
}
|
|
}
|
|
else if (Data.ArenaData.ColosseumData.isJoin && Data.ArenaData.ColosseumData.IsDeckEntry)
|
|
{
|
|
flag = true;
|
|
}
|
|
if (flag)
|
|
{
|
|
ChangeScene(UIManager.ViewScene.Colosseum);
|
|
return;
|
|
}
|
|
MyPageMenu.Instance.GoToColosseum(isColosseumTask: false);
|
|
MyPageMenu.Instance.ChangeMenu(3, isCutCardMotion: true);
|
|
}
|
|
|
|
private static void OnClickCompetitionBanner()
|
|
{
|
|
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(new CompetitionCheckPeriodTask(), delegate
|
|
{
|
|
GoToCompetition();
|
|
}));
|
|
}
|
|
|
|
private static void GoToCompetition()
|
|
{
|
|
ArenaCompetition competitionData = Data.ArenaData.CompetitionData;
|
|
if (competitionData == null)
|
|
{
|
|
return;
|
|
}
|
|
if (competitionData.Rule == ArenaColosseum.eRule.TwoPick)
|
|
{
|
|
if (competitionData.IsCompletedTwoPickDeck > 0)
|
|
{
|
|
ChangeScene(UIManager.ViewScene.CompetitionLobby);
|
|
return;
|
|
}
|
|
if (competitionData.EntryStatus == ArenaCompetition.EntryStatusType.NotRegistDeck || competitionData.EntryStatus == ArenaCompetition.EntryStatusType.InBattle)
|
|
{
|
|
ChangeScene(UIManager.ViewScene.Competition2Pick);
|
|
return;
|
|
}
|
|
}
|
|
else if (competitionData.IsInFreeBattleRegistDeck)
|
|
{
|
|
ChangeScene(UIManager.ViewScene.CompetitionLobby);
|
|
return;
|
|
}
|
|
MyPageMenu.Instance.GoToCompetition();
|
|
MyPageMenu.Instance.ChangeMenu(3, isCutCardMotion: true);
|
|
}
|
|
|
|
private void OnClickDeckIntroduction(string status, Format format)
|
|
{
|
|
|
|
int seriesId = int.Parse(status);
|
|
DeckIntroduction.Create(_deckIntroductionPrefab, MyPageMenu.Instance.HomeMenu.ContentsRoot, seriesId, format);
|
|
}
|
|
|
|
private static void OnClickTreasureBoxCpDialog()
|
|
{
|
|
|
|
TreasureBoxCpDialog.CreateDialog();
|
|
}
|
|
|
|
private static void OnClickIncentiveCampaign(int no)
|
|
{
|
|
|
|
// LotteryPage removed (DEAD-COLD engine cleanup Task 12)
|
|
}
|
|
|
|
private static void OnClickBingoEvent()
|
|
{
|
|
|
|
// BingoPage removed (DEAD-COLD engine cleanup Task 12)
|
|
}
|
|
|
|
private static void OnClickBeginnerMission()
|
|
{
|
|
|
|
ChangeScene(UIManager.ViewScene.BeginnerMission);
|
|
}
|
|
|
|
private static void ChangeScene(UIManager.ViewScene scene)
|
|
{
|
|
// Pre-Phase-5b: Battle scene routed through GameMgr.GetBattleCtrl().BattleEnd. BattleControl
|
|
// was stubbed in chunk 7 — its BattleEnd is a no-op that just invokes the callback.
|
|
// Fall straight through to the else branch; UIManager scene change is the only real
|
|
// side effect and it applies in either path.
|
|
UIManager.GetInstance().ChangeViewScene(scene);
|
|
}
|
|
|
|
private void OnClickDialogInfo(BannerInfo bannerInfo)
|
|
{
|
|
|
|
List<string> listBannerName = bannerInfo.ImagePaths;
|
|
List<string> listImagePaths = new List<string>();
|
|
for (int i = 0; i < listBannerName.Count; i++)
|
|
{
|
|
listImagePaths.Add(Toolbox.ResourcesManager.GetAssetTypePath(listBannerName[i], ResourcesManager.AssetLoadPathType.UiDownLoadInfo));
|
|
}
|
|
Toolbox.ResourcesManager.StartCoroutine_LoadAssetGroupAsync(listImagePaths, delegate
|
|
{
|
|
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
|
dialogBase.SetSize(DialogBase.Size.M);
|
|
dialogBase.SetTitleLabel(Data.SystemText.Get("Common_0036"));
|
|
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
|
dialogBase.SetPanelDepth(0);
|
|
dialogBase.OnClose = (Action)Delegate.Combine(dialogBase.OnClose, (Action)delegate
|
|
{
|
|
Toolbox.ResourcesManager.RemoveAssetGroup(listImagePaths);
|
|
});
|
|
BannerDialog bannerDialog = UnityEngine.Object.Instantiate(_prefabDialogMypageBanner);
|
|
dialogBase.SetObj(bannerDialog.gameObject);
|
|
List<Texture> list = new List<Texture>();
|
|
for (int num = 0; num < listBannerName.Count; num++)
|
|
{
|
|
list.Add(Toolbox.ResourcesManager.LoadObject(Toolbox.ResourcesManager.GetAssetTypePath(listBannerName[num], ResourcesManager.AssetLoadPathType.UiDownLoadInfo, isfetch: true)) as Texture);
|
|
}
|
|
bannerDialog.Init(list, null, null);
|
|
});
|
|
}
|
|
|
|
private void OnClickDialog(BannerInfo bannerInfo)
|
|
{
|
|
|
|
VoteDataTask voteDataTask = new VoteDataTask();
|
|
int voteId = int.Parse(bannerInfo.Status);
|
|
voteDataTask.SetParameter(voteId);
|
|
StartCoroutine(Toolbox.NetworkManager.Connect(voteDataTask, delegate
|
|
{
|
|
DialogBase dialog = UIManager.GetInstance().CreateDialogClose(isSystem: true);
|
|
dialog.SetSize(DialogBase.Size.M);
|
|
dialog.SetTitleLabel(Data.VoteInfo.title_text);
|
|
dialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
|
|
dialog.SetFadeButtonEnabled(flag: true);
|
|
if (Data.VoteInfo.is_vote)
|
|
{
|
|
dialog.SetText(string.Format(Data.VoteInfo.after_content_text, Data.VoteInfo.vote_name));
|
|
}
|
|
// Pre-Phase-5b: vote-not-yet path built a DialogWinnerPost prefab + attached per-target
|
|
// buttons via GetPrefabMgr. Purely UI dialog composition, unreachable headless.
|
|
// Stubbed to a no-op; the enclosing "already voted" branch above handles the display path
|
|
// that any surviving caller would render.
|
|
}));
|
|
}
|
|
|
|
private static void OnClickDialogText(string status)
|
|
{
|
|
|
|
SystemText systemText = Data.SystemText;
|
|
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
|
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
|
dialogBase.SetSize(DialogBase.Size.XL);
|
|
if (!(status == "netease"))
|
|
{
|
|
return;
|
|
}
|
|
dialogBase.SetTitleLabel(systemText.Get("Account_0111"));
|
|
dialogBase.SetText(systemText.Get("Account_0112"));
|
|
dialogBase.onPushButton1 = delegate
|
|
{
|
|
GetDataTranslateTask task = new GetDataTranslateTask();
|
|
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
|
{
|
|
NtDataTranslateManager instance = NtDataTranslateManager.GetInstance();
|
|
if (instance.isTranslate)
|
|
{
|
|
instance.ShowRebind();
|
|
}
|
|
else
|
|
{
|
|
instance.HongKongMacaoUserConfirm();
|
|
}
|
|
}));
|
|
};
|
|
dialogBase.SetOnClickUrl();
|
|
}
|
|
|
|
private static void StartTransititonTask()
|
|
{
|
|
TransitionInfoTask task = new TransitionInfoTask();
|
|
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
|
{
|
|
switch (task.Status)
|
|
{
|
|
case 0:
|
|
CreateTransitionDialog();
|
|
break;
|
|
case 1:
|
|
CreateDeleteCodeDialog();
|
|
break;
|
|
case 2:
|
|
CreateCheckTransitionDialog();
|
|
break;
|
|
}
|
|
}));
|
|
}
|
|
|
|
private static void CreateTransitionDialog()
|
|
{
|
|
TransitionDialog.Create(CompletePublishCode);
|
|
}
|
|
|
|
private static void CompletePublishCode()
|
|
{
|
|
TransitionPublishTask task = new TransitionPublishTask();
|
|
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
|
{
|
|
TransitionPublishDialog.Create(task.Password);
|
|
}));
|
|
}
|
|
|
|
private static void CreateDeleteCodeDialog()
|
|
{
|
|
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
|
SystemText systemText = Data.SystemText;
|
|
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
|
|
dialogBase.SetButtonText(systemText.Get("BeyondHandover_0013"), systemText.Get("Common_0005"));
|
|
dialogBase.SetTitleLabel(systemText.Get("BeyondHandover_0001"));
|
|
dialogBase.SetText(systemText.Get("BeyondHandover_0010"));
|
|
dialogBase.SetSize(DialogBase.Size.M);
|
|
dialogBase.SetButtonDelegate(new EventDelegate(delegate
|
|
{
|
|
DeleteCode();
|
|
}));
|
|
}
|
|
|
|
private static void DeleteCode()
|
|
{
|
|
TransitionDeleteTask task = new TransitionDeleteTask();
|
|
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
|
|
{
|
|
CreateTransitionDialog();
|
|
}));
|
|
}
|
|
|
|
private static void CreateCheckTransitionDialog()
|
|
{
|
|
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
|
|
SystemText systemText = Data.SystemText;
|
|
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.OkBtn);
|
|
dialogBase.SetTitleLabel(systemText.Get("BeyondHandover_0001"));
|
|
dialogBase.SetText(systemText.Get("BeyondHandover_0011"));
|
|
dialogBase.SetSize(DialogBase.Size.M);
|
|
}
|
|
}
|