From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/Guild/XGuildHallDocument.cs | 224 +++++++++++++++++++++ 1 file changed, 224 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Guild/XGuildHallDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/Guild/XGuildHallDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/Guild/XGuildHallDocument.cs b/Client/Assets/Scripts/XMainClient/Guild/XGuildHallDocument.cs new file mode 100644 index 00000000..98df9a70 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Guild/XGuildHallDocument.cs @@ -0,0 +1,224 @@ +using System; +using System.Collections.Generic; +using KKSG; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XGuildHallDocument : XDocComponent, ILogSource + { + public override uint ID + { + get + { + return XGuildHallDocument.uuID; + } + } + + public XGuildHallView GuildHallView { get; set; } + + private XGuildDocument GuildDoc + { + get + { + bool flag = this._GuildDoc == null; + if (flag) + { + this._GuildDoc = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + } + return this._GuildDoc; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("GuildHallDocument"); + + private List m_LogList = new List(); + + private XGuildDocument _GuildDoc; + + public List GetLogList() + { + return this.m_LogList; + } + + protected override void EventSubscribe() + { + base.EventSubscribe(); + base.RegisterEvent(XEventDefine.XEvent_GuildPositionChanged, new XComponent.XEventHandler(this.OnPositionChanged)); + base.RegisterEvent(XEventDefine.XEvent_GuildLevelChanged, new XComponent.XEventHandler(this.OnLevelChanged)); + base.RegisterEvent(XEventDefine.XEvent_InGuildStateChanged, new XComponent.XEventHandler(this.OnInGuildStateChanged)); + } + + protected bool OnPositionChanged(XEventArgs args) + { + XGuildPositionChangedEventArgs xguildPositionChangedEventArgs = args as XGuildPositionChangedEventArgs; + bool flag = this.GuildHallView != null && this.GuildHallView.IsVisible(); + if (flag) + { + this.GuildHallView.RefreshButtonsState(); + } + return true; + } + + protected bool OnLevelChanged(XEventArgs args) + { + XGuildLevelChangedEventArgs xguildLevelChangedEventArgs = args as XGuildLevelChangedEventArgs; + bool flag = this.GuildHallView != null && this.GuildHallView.IsVisible(); + if (flag) + { + this.ReqGuildBrief(); + } + return true; + } + + protected bool OnInGuildStateChanged(XEventArgs args) + { + XInGuildStateChangedEventArgs xinGuildStateChangedEventArgs = args as XInGuildStateChangedEventArgs; + bool flag = !xinGuildStateChangedEventArgs.bIsEnter; + if (flag) + { + bool flag2 = this.GuildHallView != null && this.GuildHallView.IsVisible(); + if (flag2) + { + this.GuildHallView.SetVisibleWithAnimation(false, null); + } + } + return true; + } + + public void ReqExitGuild() + { + RpcC2M_LeaveFromGuild rpcC2M_LeaveFromGuild = new RpcC2M_LeaveFromGuild(); + rpcC2M_LeaveFromGuild.oArg.roleID = XSingleton.singleton.Player.Attributes.EntityID; + XSingleton.singleton.Send(rpcC2M_LeaveFromGuild); + } + + public void OnExitGuild(LeaveGuildRes oRes) + { + bool flag = oRes.result > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(oRes.result, "fece00"); + } + } + + public void ReqGuildBrief() + { + RpcC2M_AskGuildBriefInfo rpc = new RpcC2M_AskGuildBriefInfo(); + XSingleton.singleton.Send(rpc); + } + + public void OnGuildBrief(GuildBriefRes oRes) + { + bool flag = oRes.result > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(oRes.result, "fece00"); + } + else + { + XGuildBasicData basicData = this.GuildDoc.BasicData; + basicData.Init(oRes); + bool flag2 = this.GuildHallView != null && this.GuildHallView.IsVisible(); + if (flag2) + { + this.GuildHallView.Refresh(); + } + XGuildGrowthDocument specificDocument = XDocuments.GetSpecificDocument(XGuildGrowthDocument.uuID); + specificDocument.SetPoint(this.GuildDoc.BasicData.resource, this.GuildDoc.BasicData.technology); + } + } + + public void ReqLogList() + { + RpcC2M_FetchGuildHistoryNew rpc = new RpcC2M_FetchGuildHistoryNew(); + XSingleton.singleton.Send(rpc); + } + + public void OnGetLogList(GuildHistoryRes oRes) + { + bool flag = oRes.result > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(oRes.result, "fece00"); + } + else + { + for (int i = 0; i < this.m_LogList.Count; i++) + { + (this.m_LogList[i] as XDataBase).Recycle(); + } + this.m_LogList.Clear(); + for (int j = 0; j < oRes.records.Count; j++) + { + GHisRecord ghisRecord = oRes.records[j]; + XGuildLogBase xguildLogBase = XGuildLogBase.CreateLog(ghisRecord.type); + xguildLogBase.SetData(ghisRecord); + this.m_LogList.Add(xguildLogBase); + } + bool flag2 = this.GuildHallView != null && this.GuildHallView.IsVisible(); + if (flag2) + { + bool flag3 = this.GuildHallView.LogView != null && this.GuildHallView.LogView.active; + if (flag3) + { + this.GuildHallView.LogView.Refresh(); + } + } + } + } + + public void ReqEditAnnounce(string s) + { + RpcC2M_ChangeGuildSettingNew rpcC2M_ChangeGuildSettingNew = new RpcC2M_ChangeGuildSettingNew(); + rpcC2M_ChangeGuildSettingNew.oArg.annoucement = s; + XSingleton.singleton.Send(rpcC2M_ChangeGuildSettingNew); + } + + public void OnEditAnnounceSuccess(string s) + { + bool flag = this.GuildHallView != null && this.GuildHallView.IsVisible(); + if (flag) + { + this.GuildHallView.EditAnnounceView.SetVisible(false); + } + } + + public void OnAnnounceChanged(string s) + { + this.GuildDoc.BasicData.announcement = s; + bool flag = this.GuildHallView != null && this.GuildHallView.IsVisible(); + if (flag) + { + this.GuildHallView.RefreshAnnouncement(); + } + } + + public void ReqEditPortrait(int index) + { + RpcC2M_ChangeGuildSettingNew rpcC2M_ChangeGuildSettingNew = new RpcC2M_ChangeGuildSettingNew(); + rpcC2M_ChangeGuildSettingNew.oArg.Icon = index; + XSingleton.singleton.Send(rpcC2M_ChangeGuildSettingNew); + } + + public void OnPortraitChanged(int index) + { + this.GuildDoc.BasicData.portraitIndex = index; + bool flag = this.GuildHallView != null && this.GuildHallView.IsVisible(); + if (flag) + { + this.GuildHallView.RefreshPortrait(); + } + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + bool flag = this.GuildHallView != null && this.GuildHallView.IsVisible(); + if (flag) + { + this.ReqGuildBrief(); + } + } + } +} -- cgit v1.1-26-g67d0