From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/Guild/XGuildMineMainDocument.cs | 432 +++++++++++++++++++++ 1 file changed, 432 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Guild/XGuildMineMainDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/Guild/XGuildMineMainDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/Guild/XGuildMineMainDocument.cs b/Client/Assets/Scripts/XMainClient/Guild/XGuildMineMainDocument.cs new file mode 100644 index 00000000..a9b851ab --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Guild/XGuildMineMainDocument.cs @@ -0,0 +1,432 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XGuildMineMainDocument : XDocComponent + { + public override uint ID + { + get + { + return XGuildMineMainDocument.uuID; + } + } + + public GuildMineMainView View + { + get + { + return this._view; + } + set + { + this._view = value; + } + } + + internal List ResRankInfoList + { + get + { + return this._resRankInfoList; + } + set + { + this._resRankInfoList = value; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("XGuildMineMainDocument"); + + private GuildMineMainView _view = null; + + public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader(); + + private static GuildMineralBattle _GuildMineralBattleTable = new GuildMineralBattle(); + + private static GuildMineralBufflist _GuildMineralBufflistTable = new GuildMineralBufflist(); + + public GuildMineRankHandler GuildResRankHanler; + + public static readonly uint GUILD_NUM_MAX = 3u; + + public static readonly uint BOSS_NUM_MAX = 4u; + + public static readonly uint MINE_NUM_MAX = 5u; + + public bool IsNeedShowMainUI = false; + + private List _resRankInfoList = new List(); + + public override void OnAttachToHost(XObject host) + { + base.OnAttachToHost(host); + } + + public override void OnEnterSceneFinally() + { + bool flag = this.IsNeedShowMainUI && XSingleton.singleton.CurrentStage.Stage == EXStage.Hall; + if (flag) + { + XGuildMineEntranceDocument specificDocument = XDocuments.GetSpecificDocument(XGuildMineEntranceDocument.uuID); + bool mainInterfaceState = specificDocument.MainInterfaceState; + if (mainInterfaceState) + { + specificDocument.ReqEnterMine(); + } + this.IsNeedShowMainUI = false; + } + } + + protected override void EventSubscribe() + { + base.EventSubscribe(); + base.RegisterEvent(XEventDefine.XEvent_LeaveTeam, new XComponent.XEventHandler(this.OnLeaveTeam)); + base.RegisterEvent(XEventDefine.XEvent_TeamMemberCountChanged, new XComponent.XEventHandler(this.OnTeamMemberCountChanged)); + } + + public bool OnLeaveTeam(XEventArgs args) + { + this.ClearUI(); + return true; + } + + public bool OnTeamMemberCountChanged(XEventArgs args) + { + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.RefreshMemberTips(); + } + return true; + } + + public void ClearUI() + { + DlgBase.singleton.BossMine.Clear(); + DlgBase.singleton.BossMineBuff.Clear(); + DlgBase.singleton.CanPlayNewFindAnim = true; + DlgBase.singleton.CurExploreLeftTime = 0f; + DlgBase.singleton.ExploreTimeMax = 0u; + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.RefreshBoss(); + DlgBase.singleton.RefreshExploreTime(); + DlgBase.singleton.RefreshButton(); + } + } + + public static void Execute(OnLoadedCallback callback = null) + { + XGuildMineMainDocument.AsyncLoader.AddTask("Table/GuildMineralBattle", XGuildMineMainDocument._GuildMineralBattleTable, false); + XGuildMineMainDocument.AsyncLoader.AddTask("Table/GuildMineralBufflist", XGuildMineMainDocument._GuildMineralBufflistTable, false); + XGuildMineMainDocument.AsyncLoader.Execute(callback); + } + + public static GuildMineralBattle.RowData GetMineData(uint mineID) + { + return XGuildMineMainDocument._GuildMineralBattleTable.GetByID(mineID); + } + + public static GuildMineralBufflist.RowData GetMineBuffData(uint BuffID) + { + return XGuildMineMainDocument._GuildMineralBufflistTable.GetByBuffID(BuffID); + } + + public override void Update(float fDeltaT) + { + base.Update(fDeltaT); + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + XGuildMineEntranceDocument specificDocument = XDocuments.GetSpecificDocument(XGuildMineEntranceDocument.uuID); + specificDocument.ReqEnterMine(); + } + } + + public void ReqExplore(bool iscancel) + { + RpcC2M_ResWarExplore rpcC2M_ResWarExplore = new RpcC2M_ResWarExplore(); + rpcC2M_ResWarExplore.oArg.iscancel = iscancel; + XSingleton.singleton.Send(rpcC2M_ResWarExplore); + } + + public void ReqChallenge(int mineIndex) + { + RpcC2M_StartResWarPVE rpcC2M_StartResWarPVE = new RpcC2M_StartResWarPVE(); + rpcC2M_StartResWarPVE.oArg.mine = (uint)mineIndex; + XSingleton.singleton.Send(rpcC2M_StartResWarPVE); + } + + public void ReqResWarRank() + { + RpcC2M_QueryResWarRoleRank rpc = new RpcC2M_QueryResWarRoleRank(); + XSingleton.singleton.Send(rpc); + } + + public void SetAllInfo(QueryResWarArg arg, QueryResWarRes res) + { + bool flag = res.data == null || XSingleton.singleton.CurrentStage.Stage != EXStage.Hall; + if (!flag) + { + DlgBase.singleton.SetVisibleWithAnimation(true, null); + XGuildResContentionBuffDocument.Doc.OnGetBuffAllInfo(res.data); + XGuildDocument specificDocument = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + ResWarGuildBrief data = res.data; + bool flag2 = data.mineid.Count == this.View.BossMine.Count && data.mineid.Count != 0; + if (flag2) + { + for (int i = 0; i < data.mineid.Count; i++) + { + bool flag3 = data.mineid[i] != this.View.BossMine[i]; + if (flag3) + { + this.View.CanPlayNewFindAnim = true; + break; + } + } + } + else + { + this.View.CanPlayNewFindAnim = true; + } + bool flag4 = data.mineid.Count != data.buffid.Count; + if (flag4) + { + XSingleton.singleton.AddErrorLog(string.Concat(new object[] + { + "GuildMine mineid.Count!=buffid.Count: ", + data.mineid.Count, + "!=", + data.buffid.Count + }), null, null, null, null, null); + } + this.View.BossMine.Clear(); + this.View.BossMineBuff.Clear(); + for (int j = 0; j < data.mineid.Count; j++) + { + bool flag5 = (long)j == (long)((ulong)XGuildMineMainDocument.BOSS_NUM_MAX); + if (flag5) + { + break; + } + this.View.BossMine.Add(data.mineid[j]); + } + for (int k = 0; k < data.buffid.Count; k++) + { + bool flag6 = (long)k == (long)((ulong)XGuildMineMainDocument.BOSS_NUM_MAX); + if (flag6) + { + break; + } + this.View.BossMineBuff.Add(data.buffid[k]); + } + bool cdSpecified = data.cdSpecified; + if (cdSpecified) + { + this.View.CurExploreLeftTime = res.data.cd; + } + else + { + this.View.CurExploreLeftTime = 0f; + } + bool totalcdSpecified = data.totalcdSpecified; + if (totalcdSpecified) + { + this.View.ExploreTimeMax = res.data.totalcd; + } + else + { + this.View.ExploreTimeMax = 0u; + } + bool timecoutdownSpecified = data.timecoutdownSpecified; + if (timecoutdownSpecified) + { + this.View.CurActivityLeftTime = data.timecoutdown; + } + else + { + this.View.CurActivityLeftTime = 0f; + } + bool timetypeSpecified = data.timetypeSpecified; + if (timetypeSpecified) + { + this.View.ActivityStatus = (GuildMineActivityStatus)data.timetype; + } + else + { + this.View.ActivityStatus = GuildMineActivityStatus.None; + } + this.View.RefreshUI(); + XSingleton.singleton.AddGreenLog("Open:" + this.View.CurExploreLeftTime.ToString(), null, null, null, null, null); + } + } + + public void SetNewInfo(PtcM2C_ResWarGuildBriefNtf roPtc) + { + XGuildDocument specificDocument = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + ResWarGuildBrief data = roPtc.Data; + bool flag = data.guildid == specificDocument.UID; + if (flag) + { + bool flag2 = data.mineid.Count != data.buffid.Count; + if (flag2) + { + XSingleton.singleton.AddErrorLog(string.Concat(new object[] + { + "GuildMine mineid.Count!=buffid.Count: ", + data.mineid.Count, + "!=", + data.buffid.Count + }), null, null, null, null, null); + } + bool flag3 = DlgBase.singleton.BossMine.Count == 0 && data.mineid.Count != 0; + if (flag3) + { + for (int i = 0; i < data.mineid.Count; i++) + { + bool flag4 = (long)i == (long)((ulong)XGuildMineMainDocument.BOSS_NUM_MAX); + if (flag4) + { + break; + } + DlgBase.singleton.BossMine.Add(data.mineid[i]); + } + for (int j = 0; j < data.buffid.Count; j++) + { + bool flag5 = (long)j == (long)((ulong)XGuildMineMainDocument.BOSS_NUM_MAX); + if (flag5) + { + break; + } + DlgBase.singleton.BossMineBuff.Add(data.buffid[j]); + } + bool flag6 = DlgBase.singleton.IsVisible(); + if (flag6) + { + DlgBase.singleton.RefreshBoss(); + } + } + else + { + bool flag7 = DlgBase.singleton.BossMine.Count != 0 && data.mineid.Count == 0; + if (flag7) + { + DlgBase.singleton.BossMine.Clear(); + DlgBase.singleton.BossMineBuff.Clear(); + DlgBase.singleton.CanPlayNewFindAnim = true; + bool flag8 = DlgBase.singleton.IsVisible(); + if (flag8) + { + DlgBase.singleton.RefreshBoss(); + } + } + } + bool cdSpecified = data.cdSpecified; + if (cdSpecified) + { + DlgBase.singleton.CurExploreLeftTime = data.cd; + } + else + { + DlgBase.singleton.CurExploreLeftTime = 0f; + } + bool totalcdSpecified = data.totalcdSpecified; + if (totalcdSpecified) + { + DlgBase.singleton.ExploreTimeMax = data.totalcd; + } + else + { + DlgBase.singleton.ExploreTimeMax = 0u; + } + bool flag9 = DlgBase.singleton.IsVisible(); + if (flag9) + { + DlgBase.singleton.RefreshExploreTime(); + } + bool flag10 = DlgBase.singleton.IsVisible(); + if (flag10) + { + DlgBase.singleton.RefreshButton(); + } + bool timetypeSpecified = data.timetypeSpecified; + if (timetypeSpecified) + { + bool timecoutdownSpecified = data.timecoutdownSpecified; + if (timecoutdownSpecified) + { + DlgBase.singleton.CurActivityLeftTime = data.timecoutdown; + } + else + { + DlgBase.singleton.CurActivityLeftTime = 0f; + } + DlgBase.singleton.ActivityStatus = (GuildMineActivityStatus)data.timetype; + bool flag11 = DlgBase.singleton.IsVisible(); + if (flag11) + { + DlgBase.singleton.RefreshActivityTime(); + } + } + XSingleton.singleton.AddGreenLog("Refresh:" + DlgBase.singleton.CurExploreLeftTime.ToString(), null, null, null, null, null); + } + } + + public void ActivityStatusChange(PtcM2C_ResWarTimeNtf roPtc) + { + DlgBase.singleton.CurActivityLeftTime = roPtc.Data.nTime; + DlgBase.singleton.ActivityStatus = GuildMineActivityStatus.Start; + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.RefreshActivityTime(); + } + } + + public void OnGetRankInfo(ResWarRoleRankRes oRes) + { + this._resRankInfoList.Clear(); + for (int i = 0; i < oRes.data.Count; i++) + { + ResWarRoleRank resWarRoleRank = oRes.data[i]; + this._resRankInfoList.Add(new ResRankInfo + { + guildName = resWarRoleRank.guildname, + roleID = resWarRoleRank.roleid, + roleName = resWarRoleRank.rolename, + donateValue = resWarRoleRank.res + }); + } + bool flag = this.GuildResRankHanler != null && this.GuildResRankHanler.IsVisible(); + if (flag) + { + this.GuildResRankHanler.RefreshUI(); + } + } + + public void TeamLeaderOperate(PtcM2C_ResWarStateNtf roPtc) + { + bool flag = roPtc.Data.state == ResWarState.ResWarExploreState; + if (flag) + { + XSingleton.singleton.ShowSystemTip(XSingleton.singleton.GetString("GUILD_MINE_EXPLORE_LEADER_START"), "fece00"); + } + bool flag2 = roPtc.Data.state == ResWarState.ResWarCancelState; + if (flag2) + { + XSingleton.singleton.ShowSystemTip(XSingleton.singleton.GetString("GUILD_MINE_EXPLORE_LEADER_CANCEL"), "fece00"); + } + } + } +} -- cgit v1.1-26-g67d0