feat(battle-engine): copy-loop closure to 3282 files (member-surface frontier)

This commit is contained in:
gamer147
2026-06-05 20:41:25 -04:00
parent 3dcd53933a
commit f9982f5249
41 changed files with 3030 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
namespace Wizard;
public class AdjustSettingUpdateTask : BaseTask
{
public class TaskParam : BaseParam
{
public int is_allow_send_adjust;
}
public AdjustSettingUpdateTask()
{
base.type = ApiType.Type.AdjustSettingUpdate;
}
public void SetParameter(bool arrow)
{
TaskParam taskParam = new TaskParam();
taskParam.is_allow_send_adjust = (arrow ? 1 : 0);
base.Params = taskParam;
}
}

View File

@@ -0,0 +1,131 @@
using UnityEngine;
namespace Wizard;
public class ArenaBuyDialog : MonoBehaviour
{
[SerializeField]
private UISprite m_SpriteConfirmClystal;
[SerializeField]
private UISprite m_SpriteHaveClystal;
[SerializeField]
private UISprite m_SpriteConfirmRupy;
[SerializeField]
private UISprite m_SpriteHaveRupy;
[SerializeField]
private UISprite m_SpriteConfirmTicket;
[SerializeField]
private UISprite m_SpriteHaveTicket;
[SerializeField]
private UILabel m_LabelUseItemCnt;
[SerializeField]
private UILabel m_LabelBuyPack;
[SerializeField]
private UILabel m_LabelItemName;
[SerializeField]
private UILabel m_LabelBeforeItemCnt;
[SerializeField]
private UILabel m_LabelAfterItemCnt;
[SerializeField]
private GameObject _jpnLawRoot;
[SerializeField]
private UIButton _jpnLawButton;
[SerializeField]
private UIScrollView _scrollView;
[SerializeField]
private GameObject _scrollBar;
[SerializeField]
private UILabel _expirtyTextLabel;
public void SetClystalConfirmDialog(int useItemNum, int haveItemCnt, string arenaModeNameId, ShopExpirtyInfo expirtyInfo)
{
m_SpriteConfirmClystal.gameObject.SetActive(value: true);
m_SpriteHaveClystal.gameObject.SetActive(value: true);
m_SpriteConfirmRupy.gameObject.SetActive(value: false);
m_SpriteHaveRupy.gameObject.SetActive(value: false);
m_SpriteConfirmTicket.gameObject.SetActive(value: false);
m_SpriteHaveTicket.gameObject.SetActive(value: false);
int num = haveItemCnt - useItemNum;
string useItemNumText = Data.SystemText.Get("Shop_0091", useItemNum.ToString());
string afterItemNum = Data.SystemText.Get("Shop_0055", num.ToString());
SetLabelText(Data.SystemText.Get("Common_0201"), useItemNumText, afterItemNum, haveItemCnt, arenaModeNameId);
_jpnLawButton.onClick.Add(new EventDelegate(delegate
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_COMMON_BUTTON);
UIManager.GetInstance().WebViewHelper.OpenWebView(WebViewHelper.WebViewType.LEGALTEXT);
}));
if (expirtyInfo.IsEnableText)
{
_expirtyTextLabel.text = expirtyInfo.GetText();
}
else
{
_expirtyTextLabel.gameObject.SetActive(value: false);
}
_jpnLawRoot.SetActive(value: false);
}
private void HideScrollBar()
{
_scrollView.enabled = false;
_scrollBar.SetActive(value: false);
_jpnLawRoot.SetActive(value: false);
}
public void SetTicketConfirmDialog(int useItemNum, int haveItemCnt, string arenaModeNameId, string ticketSpriteName)
{
m_SpriteConfirmClystal.gameObject.SetActive(value: false);
m_SpriteHaveClystal.gameObject.SetActive(value: false);
m_SpriteConfirmRupy.gameObject.SetActive(value: false);
m_SpriteHaveRupy.gameObject.SetActive(value: false);
m_SpriteConfirmTicket.gameObject.SetActive(value: true);
m_SpriteHaveTicket.gameObject.SetActive(value: true);
m_SpriteConfirmTicket.spriteName = ticketSpriteName;
m_SpriteHaveTicket.spriteName = ticketSpriteName;
int num = haveItemCnt - useItemNum;
string useItemNumText = Data.SystemText.Get("Shop_0042", useItemNum.ToString());
string afterItemNum = Data.SystemText.Get("Shop_0054", num.ToString());
SetLabelText(Data.SystemText.Get("Common_0114"), useItemNumText, afterItemNum, haveItemCnt, arenaModeNameId);
HideScrollBar();
}
public void SetRupyConfirmDialog(int useItemNum, int haveItemCnt, string arenaModeNameId)
{
m_SpriteConfirmClystal.gameObject.SetActive(value: false);
m_SpriteHaveClystal.gameObject.SetActive(value: false);
m_SpriteConfirmRupy.gameObject.SetActive(value: true);
m_SpriteHaveRupy.gameObject.SetActive(value: true);
m_SpriteConfirmTicket.gameObject.SetActive(value: false);
m_SpriteHaveTicket.gameObject.SetActive(value: false);
int num = haveItemCnt - useItemNum;
string useItemNumText = Data.SystemText.Get("Shop_0090", useItemNum.ToString());
string afterItemNum = Data.SystemText.Get("Shop_0056", num.ToString());
SetLabelText(Data.SystemText.Get("Common_0115"), useItemNumText, afterItemNum, haveItemCnt, arenaModeNameId);
HideScrollBar();
}
private void SetLabelText(string itemName, string useItemNumText, string afterItemNum, int haveItemCnt, string arenaModeNameId)
{
SystemText systemText = Data.SystemText;
m_LabelUseItemCnt.text = useItemNumText;
m_LabelBuyPack.text = systemText.Get(arenaModeNameId);
m_LabelItemName.text = itemName;
m_LabelBeforeItemCnt.text = haveItemCnt.ToString();
m_LabelAfterItemCnt.text = afterItemNum;
}
}

View File

@@ -0,0 +1,33 @@
namespace Wizard;
public class CompetitionPermanentEntryTask : BaseTask
{
public class CompetitionPermanentEntryTaskParam : BaseParam
{
public int consume_item_type;
}
public CompetitionPermanentEntryTask()
{
base.type = ApiType.Type.CompetitionPermanentEntry;
}
public void SetParameter(ArenaData.eARENA_PAY inPayType)
{
CompetitionPermanentEntryTaskParam competitionPermanentEntryTaskParam = new CompetitionPermanentEntryTaskParam();
competitionPermanentEntryTaskParam.consume_item_type = (int)inPayType;
base.Params = competitionPermanentEntryTaskParam;
}
protected override int Parse()
{
int num = base.Parse();
if (num != 1)
{
return num;
}
PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]);
Data.ArenaData.CompetitionData.SetRestChallangeCountByEntry(base.ResponseData["data"]);
return num;
}
}

View File

@@ -0,0 +1,28 @@
namespace Wizard;
public class FriendApplySendTask : BaseTask
{
public class FriendApplySendTaskParam : BaseParam
{
public int friend_id;
}
public FriendApplySendTask()
{
base.type = ApiType.Type.FriendApplySend;
}
public void SetParameter(int friend_id)
{
FriendApplySendTaskParam friendApplySendTaskParam = new FriendApplySendTaskParam();
friendApplySendTaskParam.friend_id = friend_id;
base.Params = friendApplySendTaskParam;
}
protected override int Parse()
{
int result = base.Parse();
_ = 1;
return result;
}
}

View File

@@ -0,0 +1,39 @@
using LitJson;
namespace Wizard;
public class FriendUserSearchTask : BaseTask
{
public class FriendUserSearchTaskParam : BaseParam
{
public int search_viewer_id;
}
public FriendUserSearchTask()
{
base.type = ApiType.Type.FriendUserSearch;
}
public void SetParameter(int search_viewer_id)
{
FriendUserSearchTaskParam friendUserSearchTaskParam = new FriendUserSearchTaskParam();
friendUserSearchTaskParam.search_viewer_id = search_viewer_id;
base.Params = friendUserSearchTaskParam;
}
protected override int Parse()
{
int num = base.Parse();
if (num != 1)
{
return num;
}
Data.SearchUserInfo.Initizalize();
JsonData jsonData = base.ResponseData["data"]["user_info"];
if (jsonData.Count > 0)
{
Data.SearchUserInfo.data.user = new UserFriend(jsonData);
}
return num;
}
}

View File

@@ -0,0 +1,60 @@
using System.Collections.Generic;
namespace Wizard;
public class GatheringEntryTask : BaseTask
{
public class DeckEntry
{
public int deck_no;
public string deck_name;
public DeckEntry(DeckData deck)
{
deck_no = deck.GetDeckID();
deck_name = deck.GetDeckName();
}
}
public class GatheringEntryTaskParam : BaseParam
{
public string gathering_id;
public Dictionary<string, DeckEntry> deck_list = new Dictionary<string, DeckEntry>();
}
public GatheringEntryTask()
{
base.type = ApiType.Type.GatheringEntry;
}
public void SetParameter(string id, List<DeckData> deckList)
{
GatheringEntryTaskParam gatheringEntryTaskParam = new GatheringEntryTaskParam();
gatheringEntryTaskParam.gathering_id = id;
if (deckList != null)
{
for (int i = 0; i < deckList.Count; i++)
{
gatheringEntryTaskParam.deck_list[i.ToString()] = new DeckEntry(deckList[i]);
}
}
else
{
gatheringEntryTaskParam.deck_list = null;
}
base.Params = gatheringEntryTaskParam;
}
protected override int Parse()
{
int num = base.Parse();
if (num != 1)
{
return num;
}
Data.MyPageNotifications.data.IsInviteGathering = false;
return num;
}
}

View File

@@ -0,0 +1,22 @@
using UnityEngine;
namespace Wizard;
public class GatheringFriendInviteListPlate : MonoBehaviour
{
[SerializeField]
private GameObject _alreadyAddGathering;
[SerializeField]
private GameObject _alreadyInvited;
[SerializeField]
private UserListViewPlate _friendListPlate;
public void Initialize(GatheringFriendListTask.InviteFriendData inviteData)
{
_alreadyAddGathering.SetActive(inviteData.IsJoinGathering);
_friendListPlate.SetButtonVisible(!inviteData.IsJoinGathering && !inviteData.IsInvited);
_alreadyInvited.SetActive(inviteData.IsInvited);
}
}

View File

@@ -0,0 +1,21 @@
namespace Wizard;
public class GatheringInviteCancelTask : BaseTask
{
public class GatheringInviteCancelTaskParam : BaseParam
{
public string invite_id;
}
public GatheringInviteCancelTask()
{
base.type = ApiType.Type.GatheringInviteCancel;
}
public void SetParameter(string inviteId)
{
GatheringInviteCancelTaskParam gatheringInviteCancelTaskParam = new GatheringInviteCancelTaskParam();
gatheringInviteCancelTaskParam.invite_id = inviteId;
base.Params = gatheringInviteCancelTaskParam;
}
}

View File

@@ -0,0 +1,21 @@
namespace Wizard;
public class GatheringInviteRejectTask : BaseTask
{
public class GatheringInviteRejectTaskParam : BaseParam
{
public string invite_id;
}
public GatheringInviteRejectTask()
{
base.type = ApiType.Type.GatheringInviteReject;
}
public void SetParameter(string inviteId)
{
GatheringInviteRejectTaskParam gatheringInviteRejectTaskParam = new GatheringInviteRejectTaskParam();
gatheringInviteRejectTaskParam.invite_id = inviteId;
base.Params = gatheringInviteRejectTaskParam;
}
}

View File

@@ -0,0 +1,21 @@
namespace Wizard;
public class GatheringInviteTask : BaseTask
{
public class GatheringInviteTaskParam : BaseParam
{
public string target_viewer_id;
}
public GatheringInviteTask()
{
base.type = ApiType.Type.GatheringInvite;
}
public void SetParameter(string targetViewerId)
{
GatheringInviteTaskParam gatheringInviteTaskParam = new GatheringInviteTaskParam();
gatheringInviteTaskParam.target_viewer_id = targetViewerId;
base.Params = gatheringInviteTaskParam;
}
}

View File

@@ -0,0 +1,56 @@
using System;
using Cute;
using UnityEngine;
namespace Wizard;
public class GatheringKickConfirm : MonoBehaviour
{
[SerializeField]
private UIToggle _toggleEternal;
[SerializeField]
private UserPlateBase _userPlate;
private Action<bool> OnKickDecide;
private bool _toggleClickFirst = true;
public static void Create(GameObject prefab, GatheringUserInfo userInfo, Action<bool> onKickDecide)
{
GatheringKickConfirm component = UnityEngine.Object.Instantiate(prefab).GetComponent<GatheringKickConfirm>();
DialogBase dialog = UIManager.GetInstance().CreateDialogClose();
component.Initialize(dialog, userInfo, onKickDecide);
}
private void Initialize(DialogBase dialog, GatheringUserInfo userInfo, Action<bool> onKickDecide)
{
OnKickDecide = onKickDecide;
SystemText systemText = Data.SystemText;
string titleLabel = systemText.Get("Gathering_Member_0012");
string text_btn = systemText.Get("Gathering_Member_0005");
dialog.SetTitleLabel(titleLabel);
dialog.SetButtonText(text_btn);
dialog.SetObj(base.gameObject);
dialog.SetSize(DialogBase.Size.S);
dialog.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn);
_userPlate.InitializeSimplePlate(userInfo);
dialog.onPushButton1 = delegate
{
OnKickDecide.Call(_toggleEternal.value);
};
_toggleEternal.onChange.Add(new EventDelegate(delegate
{
OnClickToggle();
}));
}
private void OnClickToggle()
{
if (!_toggleClickFirst)
{
GameMgr.GetIns().GetSoundMgr().PlaySe(_toggleEternal.value ? Se.TYPE.SYS_TOGGLE_ON : Se.TYPE.SYS_TOGGLE_OFF);
}
_toggleClickFirst = false;
}
}

View File

@@ -0,0 +1,24 @@
namespace Wizard;
public class GatheringKickTask : BaseTask
{
public class GatheringKickTaskParam : BaseParam
{
public string target_viewer_id;
public int is_restrict;
}
public GatheringKickTask()
{
base.type = ApiType.Type.GatheringKick;
}
public void SetParameter(string targetViewerId, bool isRestrict)
{
GatheringKickTaskParam gatheringKickTaskParam = new GatheringKickTaskParam();
gatheringKickTaskParam.target_viewer_id = targetViewerId;
gatheringKickTaskParam.is_restrict = (isRestrict ? 1 : 0);
base.Params = gatheringKickTaskParam;
}
}

View File

@@ -0,0 +1,59 @@
using System;
using Cute;
using UnityEngine;
namespace Wizard;
public class GatheringMemberPlate : UserPlateBase
{
[SerializeField]
private UIButton _friendRequestButton;
[SerializeField]
private UIButton _dropOutButton;
[SerializeField]
private UIButton _kickButton;
[SerializeField]
private UILabel _ownerOrGuestLabel;
[SerializeField]
private GameObject _friendRequestSending;
[SerializeField]
private GameObject _friendIcon;
public Action<GatheringUserInfo> OnClickFriendRequest;
public Action OnClickDropOut;
public Action<GatheringUserInfo> OnClickKick;
public void Initialize(GatheringInfo info, GatheringUserInfo userInfo)
{
InitializeBase(userInfo);
_dropOutButton.gameObject.SetActive(info.Role == GatheringRule.eRole.GUEST && userInfo.IsSelf);
_friendRequestButton.gameObject.SetActive(userInfo.IsFriend == false && !userInfo.IsSelf && userInfo.IsFriendRequestSending == false);
_friendIcon.SetActive(userInfo.IsFriend.Value);
_friendRequestSending.SetActive(userInfo.IsFriendRequestSending.Value);
_kickButton.gameObject.SetActive(info.Role == GatheringRule.eRole.OWNER && !userInfo.IsSelf);
_friendRequestButton.onClick.Clear();
_dropOutButton.onClick.Clear();
_kickButton.onClick.Clear();
_friendRequestButton.onClick.Add(new EventDelegate(delegate
{
OnClickFriendRequest.Call(userInfo);
}));
_dropOutButton.onClick.Add(new EventDelegate(delegate
{
OnClickDropOut.Call();
}));
_kickButton.onClick.Add(new EventDelegate(delegate
{
OnClickKick.Call(userInfo);
}));
SystemText systemText = Data.SystemText;
_ownerOrGuestLabel.text = (userInfo.IsOwner ? systemText.Get("Gathering_Information_0013") : systemText.Get("Gathering_Member_0001"));
}
}

View File

@@ -0,0 +1,49 @@
using UnityEngine;
namespace Wizard;
public class GatheringRankingPlate : UserPlateBase
{
private const string BG_RANK_1 = "ranking_plate_01";
private const string BG_RANK_2 = "ranking_plate_02";
private const string BG_RANK_3 = "ranking_plate_03";
private const string BG_RANK_OTHER = "ranking_plate_common";
[SerializeField]
private UILabel _winCount;
[SerializeField]
private UILabel _ranking;
[SerializeField]
private GameObject _youMark;
[SerializeField]
private UISprite _bg;
public void Initialize(GatheringRankingTask.RankingUserInfo userInfo)
{
InitializeBase(userInfo.gatheringUserInfo);
_winCount.text = Data.SystemText.Get("Gathering_Ranking_0001", userInfo.WinCount.ToString());
_ranking.text = userInfo.Order.ToString();
_youMark.SetActive(userInfo.gatheringUserInfo.IsSelf);
switch (userInfo.Order)
{
case 1:
_bg.spriteName = "ranking_plate_01";
break;
case 2:
_bg.spriteName = "ranking_plate_02";
break;
case 3:
_bg.spriteName = "ranking_plate_03";
break;
default:
_bg.spriteName = "ranking_plate_common";
break;
}
}
}

View File

@@ -0,0 +1,72 @@
using System;
using Cute;
using UnityEngine;
namespace Wizard;
public class GatheringReceiveInfoDialog : MonoBehaviour
{
[SerializeField]
private GatheringRuleView _ruleView;
private Action _onReject;
private const int ADDITIONAL_DIALOG_DEPTH = 10;
public static void Create(GameObject prefab, string id, Action onReject)
{
GatheringGetInfoTask task = new GatheringGetInfoTask();
task.SetParameter(id);
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
{
CreateDialog(prefab, task, onReject);
}));
}
public static void CreateDialog(GameObject prefab, GatheringGetInfoTask task, Action onReject)
{
GatheringInfo info = task.Info;
DialogBase dialog = UIManager.GetInstance().CreateDialogClose();
UnityEngine.Object.Instantiate(prefab).GetComponent<GatheringReceiveInfoDialog>().Initialize(info, dialog, onReject);
}
private void Initialize(GatheringInfo info, DialogBase dialog, Action onReject)
{
_onReject = onReject;
SystemText systemText = Data.SystemText;
dialog.SetObj(base.gameObject);
dialog.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_RedBtn);
dialog.SetTitleLabel(systemText.Get("Gathering_Menu_0002"));
dialog.SetSize(DialogBase.Size.M);
dialog.SetButtonText(systemText.Get("Gathering_Join_0003"), systemText.Get("Gathering_Join_0004"));
dialog.onPushButton1 = delegate
{
OnClickJoinButton(info);
};
dialog.onPushButton2 = delegate
{
_onReject.Call();
};
_ruleView.SetGatheringInfo(info);
}
private static void OnClickJoinButton(GatheringInfo info)
{
if (info.Rule.IsEntryDeckOnly || info.Rule.IsTournament)
{
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
dialogBase.SetButtonText(Data.SystemText.Get("Gathering_0022"));
dialogBase.SetTitleLabel(Data.SystemText.Get("Gathering_0025"));
dialogBase.SetText(Data.SystemText.Get("Gathering_Join_0007"));
dialogBase.onPushButton1 = delegate
{
GatheringEntryConfirm.ShowDeckListDialog(info);
};
}
else
{
GatheringEntryConfirm.EntryGathering(null, info);
}
}
}

View File

@@ -0,0 +1,73 @@
using Cute;
using UnityEngine;
namespace Wizard;
public class GatheringSettingDialog : MonoBehaviour
{
[SerializeField]
private GatheringRuleView _ruleView;
[SerializeField]
private UIButton _stopButton;
private const int ADDITIONAL_DIALOG_DEPTH = 15;
private DialogBase _dialog;
public static void Create(GameObject prefab, GatheringInfo info)
{
DialogBase dialog = UIManager.GetInstance().CreateDialogClose();
Object.Instantiate(prefab).GetComponent<GatheringSettingDialog>().Initialize(info, dialog);
}
private void Initialize(GatheringInfo info, DialogBase dialog)
{
_dialog = dialog;
dialog.SetObj(base.gameObject);
dialog.SetButtonLayout(DialogBase.ButtonLayout.CloseBtn);
dialog.SetTitleLabel(Data.SystemText.Get("Gathering_Information_0012"));
dialog.SetSize(DialogBase.Size.M);
_ruleView.SetGatheringInfo(info);
}
private void Start()
{
_stopButton.onClick.Add(new EventDelegate(delegate
{
OnClickStopButton();
}));
}
private void OnClickStopButton()
{
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE);
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
SystemText systemText = Data.SystemText;
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.RedBtn_CancelBtn);
dialogBase.SetButtonText(systemText.Get("Gathering_Information_0018"), systemText.Get("Common_0005"));
dialogBase.SetText(systemText.Get("Gathering_Information_0017"));
dialogBase.SetTitleLabel(Data.SystemText.Get("Gathering_Information_0020"));
dialogBase.SetSize(DialogBase.Size.S);
dialogBase.SetPanelDepth(15);
dialogBase.onPushButton1 = delegate
{
StopGathering();
};
}
private void StopGathering()
{
GatheringInterruptTask task = new GatheringInterruptTask();
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
{
_dialog.SetActive(inActive: false);
DialogBase dialogBase = UIManager.GetInstance().CreateConfirmationDialog(Data.SystemText.Get("Gathering_Information_0019"));
dialogBase.SetPanelDepth(15);
dialogBase.OnCloseStart = delegate
{
Gathering.BackToMyPageForDrop();
};
}));
}
}

View File

@@ -0,0 +1,304 @@
using System.Collections.Generic;
using System.Linq;
using LitJson;
namespace Wizard;
public class GatheringTournamentInfoTask : BaseTask
{
private class Match
{
public int MatchId;
public int ParentMatchId;
public int ParentMatchUserIndex;
public int Status;
public int ViewerId1;
public int ViewerId2;
public int WinnerViewerId;
public int RoomId;
public bool IsForceLose1;
public bool IsForceLose2;
public bool IsForceLoseWinner;
public bool IsExtra;
public bool IsFinalMatchReset;
public bool IsActive
{
get
{
if (ViewerId1 > 0 && ViewerId2 > 0)
{
return WinnerViewerId == 0;
}
return false;
}
}
}
public List<TournamentData> TournamentDataList { get; private set; }
public GatheringTournamentInfoTask()
{
base.type = ApiType.Type.GatheringTournamentInfo;
}
protected override int Parse()
{
int num = base.Parse();
if (num != 1)
{
return num;
}
TournamentDataList = ParseTournamentDataList(base.ResponseData["data"]);
return num;
}
private List<TournamentData> ParseTournamentDataList(JsonData data)
{
if (data == null)
{
return null;
}
Dictionary<int, (string, long)> userInfo = CollectUserInfo(data);
List<TournamentData> list = new List<TournamentData>();
if (data.TryGetValue("1", out var value))
{
list.Add(ParseTournamentData(value, isWinners: true, userInfo));
}
if (data.TryGetValue("2", out var value2))
{
list.Add(ParseTournamentData(value2, isWinners: false, userInfo));
}
return list;
}
private TournamentData ParseTournamentData(JsonData data, bool isWinners, Dictionary<int, (string, long)> userInfo)
{
Match[][] matches = ConvertToMatch(data);
Dictionary<TournamentCellData, int> cellMatchIdDict = new Dictionary<TournamentCellData, int>();
TournamentData tournamentData = new TournamentData();
int num = matches.Length + 1;
List<TournamentRoundData> list = (tournamentData.Rounds = new List<TournamentRoundData>(num));
for (int i = 0; i < num; i++)
{
TournamentRoundData item = new TournamentRoundData
{
RoundNo = i + 1,
Cells = new List<TournamentCellData>(),
Watchs = new List<TournamentWatchData>()
};
list.Add(item);
}
Match match = matches[matches.Length - 1][0];
TournamentCellData.CellState cellState = GetCellState(match, match.WinnerViewerId, match.IsForceLoseWinner);
CreateCell(list[num - 1], match.WinnerViewerId, match.MatchId, cellState, isWinners).IsTerminal = true;
int i2 = matches.Length - 1;
while (i2 >= 0)
{
Match[] source = matches[i2];
TournamentRoundData tournamentRoundData = list[i2 + 1];
TournamentRoundData tournamentRoundData2 = list[i2];
foreach (TournamentCellData cell in tournamentRoundData.Cells)
{
if (cell == null || !cellMatchIdDict.ContainsKey(cell))
{
continue;
}
int matchId = cellMatchIdDict[cell];
Match match2 = source.FirstOrDefault((Match m) => m.MatchId == matchId);
TournamentCellData tournamentCellData = CreateCell(tournamentRoundData2, match2.ViewerId1, GetChildMatchId(1), GetCellState(match2, match2.ViewerId1, match2.IsForceLose1), isChampion: false);
tournamentCellData.Line = TournamentCellData.LineType.Down;
tournamentCellData.Parent = cell;
tournamentCellData.IsFinalMatchReset = false;
TournamentCellData tournamentCellData2 = CreateCell(tournamentRoundData2, match2.ViewerId2, GetChildMatchId(2), GetCellState(match2, match2.ViewerId2, match2.IsForceLose2), isChampion: false);
tournamentCellData2.Line = TournamentCellData.LineType.Up;
tournamentCellData2.Parent = cell;
tournamentCellData2.IsFinalMatchReset = match2.IsFinalMatchReset;
cell.Children = new TournamentCellData[2] { tournamentCellData, tournamentCellData2 };
tournamentRoundData2.IsExtraRound = match2.IsExtra;
if (match2.RoomId > 0)
{
CreateWatch(tournamentRoundData2, match2);
}
if (match2.IsExtra)
{
i2--;
match2 = matches[i2][0];
matchId = match2.MatchId;
tournamentRoundData2 = list[i2];
tournamentCellData = CreateCell(tournamentRoundData2, match2.ViewerId1, GetChildMatchId(1), GetCellState(match2, match2.ViewerId1, match2.IsForceLose1), isChampion: false);
tournamentCellData.Line = TournamentCellData.LineType.Down;
tournamentCellData.IsPreExtra = true;
tournamentCellData2 = CreateCell(tournamentRoundData2, match2.ViewerId2, GetChildMatchId(2), GetCellState(match2, match2.ViewerId2, match2.IsForceLose2), isChampion: false);
tournamentCellData2.Line = TournamentCellData.LineType.Up;
tournamentCellData2.IsPreExtra = true;
if (match2.RoomId > 0)
{
CreateWatch(tournamentRoundData2, match2);
}
}
int GetChildMatchId(int parentMatchUserIndex)
{
if (i2 == 0)
{
return 0;
}
return matches[i2 - 1].FirstOrDefault((Match m) => m.ParentMatchId == matchId && m.ParentMatchUserIndex == parentMatchUserIndex)?.MatchId ?? 0;
}
}
int num2 = i2 - 1;
i2 = num2;
}
return tournamentData;
TournamentCellData CreateCell(TournamentRoundData round, int viewerId, int num3, TournamentCellData.CellState state, bool isChampion)
{
TournamentCellData tournamentCellData3 = new TournamentCellData
{
State = state
};
(string, long) tuple = userInfo[viewerId];
tournamentCellData3.Name = tuple.Item1;
tournamentCellData3.EmblemId = tuple.Item2;
tournamentCellData3.ViewerId = viewerId;
tournamentCellData3.IsChampion = isChampion;
tournamentCellData3.Round = round;
round.Cells.Add(tournamentCellData3);
if (num3 > 0)
{
cellMatchIdDict.Add(tournamentCellData3, num3);
}
return tournamentCellData3;
}
static TournamentWatchData CreateWatch(TournamentRoundData round, Match match3)
{
TournamentWatchData tournamentWatchData = new TournamentWatchData
{
RoomId = match3.RoomId,
ViewerId0 = match3.ViewerId1,
ViewerId1 = match3.ViewerId2
};
round.Watchs.Add(tournamentWatchData);
return tournamentWatchData;
}
}
private TournamentCellData.CellState GetCellState(Match match, int viewerId, bool isForceLose)
{
if (isForceLose)
{
if (viewerId != 0)
{
return TournamentCellData.CellState.LoseByDefault;
}
return TournamentCellData.CellState.Blank;
}
if (match.Status == 5)
{
if (viewerId == 0)
{
return TournamentCellData.CellState.LoseByDefault;
}
if (match.WinnerViewerId != viewerId)
{
return TournamentCellData.CellState.Lose;
}
return TournamentCellData.CellState.Win;
}
if (viewerId == 0)
{
return TournamentCellData.CellState.Blank;
}
if (match.IsActive)
{
return TournamentCellData.CellState.Active;
}
return TournamentCellData.CellState.Unresolved;
}
private Dictionary<int, (string, long)> CollectUserInfo(JsonData data)
{
Dictionary<int, (string, long)> dictionary = new Dictionary<int, (string, long)> {
{
0,
(string.Empty, 0L)
} };
foreach (string key2 in data.Keys)
{
JsonData jsonData = data[key2];
foreach (string key3 in jsonData.Keys)
{
JsonData jsonData2 = jsonData[key3];
for (int i = 0; i < jsonData2.Count; i++)
{
JsonData jsonData3 = jsonData2[i];
Add(jsonData3["user1"], dictionary);
Add(jsonData3["user2"], dictionary);
}
}
}
return dictionary;
static void Add(JsonData userData, Dictionary<int, (string, long)> dict)
{
if (userData != null)
{
int key = userData["viewer_id"].ToInt();
if (!dict.ContainsKey(key))
{
string item = userData["name"].ToString();
long item2 = userData["emblem_id"].ToLong();
dict.Add(key, (item, item2));
}
}
}
}
private Match[][] ConvertToMatch(JsonData data)
{
Match[][] array = new Match[data.Count][];
for (int i = 0; i < data.Count; i++)
{
JsonData jsonData = data[(i + 1).ToString()];
Match[] array2 = new Match[jsonData.Count];
for (int j = 0; j < jsonData.Count; j++)
{
JsonData jsonData2 = jsonData[j];
bool isFinalMatchReset = false;
if (jsonData2.TryGetValue("is_show_one_more_win", out var value))
{
isFinalMatchReset = value.ToInt() == 1;
}
Match match = new Match
{
MatchId = jsonData2["matching_id"].ToInt(),
ParentMatchId = jsonData2["winner_parent_matching_id"].ToInt(),
ParentMatchUserIndex = jsonData2["winner_parent_matching_viewer_id_suffix"].ToInt(),
Status = jsonData2["status"].ToInt(),
ViewerId1 = jsonData2["viewer_id1"].ToInt(),
ViewerId2 = jsonData2["viewer_id2"].ToInt(),
WinnerViewerId = jsonData2["winner_viewer_id"].ToInt(),
RoomId = jsonData2["display_room_id"].ToInt(),
IsForceLose1 = (jsonData2["is_force_lose1"].ToInt() == 1),
IsForceLose2 = (jsonData2["is_force_lose2"].ToInt() == 1),
IsExtra = (jsonData2["side_type"].ToInt() == 3),
IsFinalMatchReset = isFinalMatchReset
};
match.IsForceLoseWinner = ((match.ViewerId1 == match.WinnerViewerId) ? match.IsForceLose1 : match.IsForceLose2);
array2[j] = match;
}
array[i] = array2;
}
return array;
}
}

View File

@@ -0,0 +1,21 @@
namespace Wizard;
public class GatheringUpdateDescriptionTask : BaseTask
{
public class GatheringUpdateDescriptionTaskParam : BaseParam
{
public string description;
}
public GatheringUpdateDescriptionTask()
{
base.type = ApiType.Type.GatheringUpdateDescription;
}
public void SetParameter(string description)
{
GatheringUpdateDescriptionTaskParam gatheringUpdateDescriptionTaskParam = new GatheringUpdateDescriptionTaskParam();
gatheringUpdateDescriptionTaskParam.description = description;
base.Params = gatheringUpdateDescriptionTaskParam;
}
}

View File

@@ -0,0 +1,25 @@
using UnityEngine;
namespace Wizard;
public class GuildInputDescriptionDialog : MonoBehaviour
{
[SerializeField]
private UIInput _inputText;
[SerializeField]
private UILabel _labelText;
public string InputValue
{
get
{
return _inputText.value;
}
set
{
_inputText.value = value;
_labelText.text = value;
}
}
}

View File

@@ -0,0 +1,38 @@
using System;
using UnityEngine;
namespace Wizard;
public class GuildInputViewerIdDialog : MonoBehaviour
{
[SerializeField]
private UIInput _inputId;
public int InputValue => int.Parse(_inputId.value);
public void InitInput(Action onChangeInputLength)
{
_inputId.value = string.Empty;
_inputId.onChange.Clear();
_inputId.onChange.Add(new EventDelegate(delegate
{
onChangeInputLength();
}));
}
public void InitializeDialog(DialogBase dialog)
{
UIManager.SetObjectToGrey(dialog.button1.gameObject, b: true);
InitInput(delegate
{
if (UIUtil.IsValidViewerId(_inputId.value))
{
UIManager.SetObjectToGrey(dialog.button1.gameObject, b: false);
}
else
{
UIManager.SetObjectToGrey(dialog.button1.gameObject, b: true);
}
});
}
}

View File

@@ -0,0 +1,38 @@
using UnityEngine;
namespace Wizard;
public class GuildUserDataDialog : MonoBehaviour
{
[SerializeField]
private UITexture _textureEmblem;
[SerializeField]
private UITexture _textureCountry;
[SerializeField]
private UITexture _textureRank;
[SerializeField]
private UITexture _textureDegree;
[SerializeField]
private UILabel _labelName;
[SerializeField]
private UILabel _labelDiscription;
public void SetUserData(UserInfoBase userInfo)
{
_textureEmblem.mainTexture = userInfo.GetUserEmblemTexture();
_textureRank.mainTexture = userInfo.GetUserRankTexture();
userInfo.InitializeDegreeTexture(_textureDegree);
_textureCountry.mainTexture = userInfo.GetUserCountryTexture();
_labelName.text = userInfo.Name;
}
public void SetDiscriptionLabel(string text)
{
_labelDiscription.text = text;
}
}

View File

@@ -0,0 +1,69 @@
using System.Collections.Generic;
using LitJson;
namespace Wizard;
public class MailReadTask : BaseTask
{
public class MailReadTaskParam : BaseParam
{
public string[] present_id_array;
public int state;
}
public const int MAIL_READ = 1;
public const int MAIL_DELETE = 3;
public MailReadTask(int state)
{
base.type = ApiType.Type.MailRead;
}
public void SetParameter(string[] present_id_array, int state, bool isTutorial)
{
base.type = (isTutorial ? ApiType.Type.MailReadTutorial : ApiType.Type.MailRead);
MailReadTaskParam mailReadTaskParam = new MailReadTaskParam();
mailReadTaskParam.present_id_array = present_id_array;
mailReadTaskParam.state = state;
base.Params = mailReadTaskParam;
}
protected override int Parse()
{
int num = base.Parse();
if (num != 1)
{
return num;
}
Data.ReadMail.data = new ReadMailDetail();
Data.ReadMail.data.total_recieve_count_list = new List<ReceivedReward>();
GameMgr.GetIns().GetMailTopTask().SetToFirstPage();
Data.MailTop.data = new MailDataDetail();
Data.MailTop.data.mail_data_list = new List<MailData>();
Data.MailTop.data.mail_history_list = new List<MailData>();
JsonData jsonData = base.ResponseData["data"]["total_receive_count_list"];
for (int i = 0; i < jsonData.Count; i++)
{
ReceivedReward item = new ReceivedReward(jsonData[i]);
Data.ReadMail.data.total_recieve_count_list.Add(item);
}
PlayerStaticData.UpdateHaveUserGoodsNumByJsonData(base.ResponseData["data"]["reward_list"]);
Data.ReadMail.data.is_unreceived_present = base.ResponseData["data"]["is_unreceived_present"].ToBoolean();
JsonData jsonData2 = base.ResponseData["data"]["present_list"];
for (int j = 0; j < jsonData2.Count; j++)
{
MailData item2 = new MailData(jsonData2[j]);
Data.MailTop.data.mail_data_list.Add(item2);
}
JsonData jsonData3 = base.ResponseData["data"]["present_history_list"];
for (int k = 0; k < jsonData3.Count; k++)
{
MailData item3 = new MailData(jsonData3[k]);
Data.MailTop.data.mail_history_list.Add(item3);
}
Data.Load.data._userTutorial.Update(base.ResponseData["data"]);
return num;
}
}

View File

@@ -0,0 +1,35 @@
namespace Wizard;
public class ReplayDetailTask : BaseTask
{
public class ReplayDetailTaskParam : BaseParam
{
public new int viewer_id;
public long battle_id;
}
public ReplayDetailTask()
{
base.type = ApiType.Type.ReplayDetail;
}
public void SetParameter(int viewerId, long battleId)
{
ReplayDetailTaskParam replayDetailTaskParam = new ReplayDetailTaskParam();
replayDetailTaskParam.viewer_id = viewerId;
replayDetailTaskParam.battle_id = battleId;
base.Params = replayDetailTaskParam;
}
protected override int Parse()
{
int num = base.Parse();
if (num != 1)
{
return num;
}
Data.ReplayBattleInfo = new ReplayDetailInfo(base.ResponseData["data"]);
return num;
}
}

View File

@@ -0,0 +1,115 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Cute;
using UnityEngine;
using Wizard.Replay;
namespace Wizard;
public class ReplayDialogContent : MonoBehaviour
{
[SerializeField]
private GameObject _rootReplayContentView;
[SerializeField]
private ReplayContentView _prefabReplayContentView;
private ReplayContentView _replayContentView;
public Action OnClickReplayButton;
private long _battle_id;
private ReplayInfoItem _replayInfo;
public void ReplayButtonClicked()
{
OnClickReplayButton.Call();
GameMgr.GetIns().GetSoundMgr().PlaySe(Se.TYPE.SYS_BTN_DECIDE_TRANS);
long battleId = _battle_id;
ReplayInfoItem replayInfo = _replayInfo;
CheckTimeSlipRotationPeriodTask task = new CheckTimeSlipRotationPeriodTask();
StartCoroutine(Toolbox.NetworkManager.Connect(task, delegate
{
GoReplay(battleId, replayInfo);
}));
}
private static void GoReplay(long battleId, ReplayInfoItem replayInfo)
{
string replayDataDirectoryPath = Application.persistentDataPath + "/NewReplay";
string text = (Directory.Exists(replayDataDirectoryPath) ? (from d in Directory.GetDirectories(replayDataDirectoryPath, "*", SearchOption.TopDirectoryOnly)
select d.Replace("\\", "/")).FirstOrDefault((string f) => f == replayDataDirectoryPath + "/" + battleId) : null);
bool num = (text == null) | (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_ALL) || (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_EXCLUDE_ROTATION) && replayInfo.BattleFormat != Format.Rotation));
UIManager.ChangeViewSceneParam param = new UIManager.ChangeViewSceneParam();
param.MyPageMenuIndex = 6;
param.IsCutCardMotion = true;
param.OnFinishChangeView = delegate
{
ReplayDialog.Create();
};
param.IsUpdateFooterMenuTexture = true;
if (num)
{
ReplayDetailTask replayDetailTask = new ReplayDetailTask();
replayDetailTask.SetParameter(PlayerStaticData.UserViewerID, battleId);
UIManager.GetInstance().StartCoroutine(Toolbox.NetworkManager.Connect(replayDetailTask, delegate
{
ReplayController.StartPlayReplay(replayInfo, UIManager.ViewScene.MyPage, param);
}));
return;
}
Data.ReplayBattleInfo = new ReplayDetailInfo(NewReplayBattleMgr.ReadJson(Directory.GetFiles(text, "*", SearchOption.TopDirectoryOnly).ToList().FirstOrDefault((string x) => x.Contains("replay_info.json"))));
Data.ReplayBattleInfo.is_two_pick = replayInfo.BattleParameter.IsTwoPick;
Data.ReplayBattleInfo._battleType = (int)replayInfo.BattleParameter.BattleType;
Data.ReplayBattleInfo._twoPickFormat = replayInfo.BattleParameter.TwoPickFormat;
Data.CurrentFormat = replayInfo.BattleFormat;
ReplayController.StartPlayReplay(UIManager.ViewScene.MyPage, param, isNewReplay: true, battleId.ToString());
}
public IEnumerator Setup(ReplayInfoItem item, List<string> loadedTextures)
{
if (_replayContentView == null)
{
_replayContentView = NGUITools.AddChild(_rootReplayContentView, _prefabReplayContentView.gameObject).GetComponent<ReplayContentView>();
}
_replayInfo = item;
_battle_id = item.BattleId;
_replayContentView.SetOpponentPlayerInfo(item);
_replayContentView.SetBattleInfo(item);
string text = Application.persistentDataPath + "/NewReplay";
if ((!Directory.Exists(text) || !(from d in Directory.GetDirectories(text, "*", SearchOption.TopDirectoryOnly)
select d.Replace("\\", "/")).Contains(text + "/" + _battle_id)) | (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_ALL) || (Data.MaintenanceCodeList.Contains(NetworkDefine.MAINTENANCE_TYPE.NEWREPLAY_EXCLUDE_ROTATION) && _replayInfo.BattleFormat != Format.Rotation)))
{
_replayContentView.SetOldReplayLabel(isActive: true);
}
else
{
_replayContentView.SetOldReplayLabel(isActive: false);
}
_replayContentView.ClearTexture();
while (true)
{
if (item.BattleId != _battle_id)
{
yield break;
}
string assetTypePath = Toolbox.ResourcesManager.GetAssetTypePath(item.OpponentEmblemId, ResourcesManager.AssetLoadPathType.Emblem_S);
string assetTypePath2 = Toolbox.ResourcesManager.GetAssetTypePath(item.OpponentCountryCode, ResourcesManager.AssetLoadPathType.Country_S);
if (!loadedTextures.Contains(assetTypePath))
{
yield return null;
continue;
}
if (string.IsNullOrEmpty(assetTypePath2) || loadedTextures.Contains(assetTypePath2))
{
break;
}
yield return null;
}
_replayContentView.SetTexture(item);
}
}

View File

@@ -0,0 +1,45 @@
using System;
using Cute;
using UnityEngine;
namespace Wizard;
public class TweenPositionWithUpdate : TweenPosition
{
private Action<float> _onUpdate;
public static TweenPosition Begin(GameObject go, float duration, Vector3 pos, Action<float> onUpdate)
{
TweenPositionWithUpdate tweenPositionWithUpdate = UITweener.Begin<TweenPositionWithUpdate>(go, duration);
tweenPositionWithUpdate.from = tweenPositionWithUpdate.value;
tweenPositionWithUpdate.to = pos;
if (duration <= 0f)
{
tweenPositionWithUpdate.Sample(1f, isFinished: true);
tweenPositionWithUpdate.enabled = false;
}
tweenPositionWithUpdate._onUpdate = onUpdate;
return tweenPositionWithUpdate;
}
public static TweenPosition Begin(GameObject go, float duration, Vector3 pos, bool worldSpace, Action<float> onUpdate)
{
TweenPositionWithUpdate tweenPositionWithUpdate = UITweener.Begin<TweenPositionWithUpdate>(go, duration);
tweenPositionWithUpdate.worldSpace = worldSpace;
tweenPositionWithUpdate.from = tweenPositionWithUpdate.value;
tweenPositionWithUpdate.to = pos;
if (duration <= 0f)
{
tweenPositionWithUpdate.Sample(1f, isFinished: true);
tweenPositionWithUpdate.enabled = false;
}
tweenPositionWithUpdate._onUpdate = onUpdate;
return tweenPositionWithUpdate;
}
protected override void OnUpdate(float factor, bool isFinished)
{
base.value = from * (1f - factor) + to * factor;
_onUpdate.Call(factor);
}
}

View File

@@ -0,0 +1,83 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Cute;
using UnityEngine;
namespace Wizard;
public class UserDataDialog : MonoBehaviour
{
[SerializeField]
private GuildUserDataDialog _inviteView;
private bool _isFinishLoadResource;
private List<string> _loadedResourceList = new List<string>();
public DialogBase Dialog { get; private set; }
public static UserDataDialog Create(GameObject prefab, UserInfoBase user, string dialogTitle)
{
DialogBase dialogBase = UIManager.GetInstance().CreateDialogClose();
dialogBase.SetTitleLabel(dialogTitle);
dialogBase.SetSize(DialogBase.Size.S);
dialogBase.SetButtonLayout(DialogBase.ButtonLayout.BlueBtn_CancelBtn);
UserDataDialog component = UnityEngine.Object.Instantiate(prefab).GetComponent<UserDataDialog>();
_ = component.gameObject;
dialogBase.SetObj(component.gameObject);
component.Dialog = dialogBase;
component.Initialize(user, dialogBase);
return component;
}
private void Initialize(UserInfoBase user, DialogBase dialog)
{
UIManager uiManager = UIManager.GetInstance();
uiManager.StartCoroutine(LoadResource(user, delegate
{
if (base.gameObject != null)
{
_inviteView.SetUserData(user);
}
}));
dialog.OnClose = (Action)Delegate.Combine(dialog.OnClose, (Action)delegate
{
uiManager.StartCoroutine(UnloadImages(delegate
{
if (this != null)
{
UnityEngine.Object.Destroy(base.gameObject);
}
}));
});
}
private IEnumerator LoadResource(UserInfoBase userData, Action callBack)
{
_isFinishLoadResource = false;
List<string> resourcePathList = userData.GetUserAssetPathList();
yield return UIManager.GetInstance().StartCoroutine(Toolbox.ResourcesManager.LoadAssetGroupAsync(resourcePathList, delegate
{
_isFinishLoadResource = true;
}));
_loadedResourceList.AddRange(resourcePathList);
callBack.Call();
}
private IEnumerator UnloadImages(Action callBack)
{
while (!_isFinishLoadResource)
{
yield return null;
}
Toolbox.ResourcesManager.RemoveAssetGroup(_loadedResourceList);
_loadedResourceList.Clear();
callBack.Call();
}
public void SetDiscriptionLabel(string text)
{
_inviteView.SetDiscriptionLabel(text);
}
}