From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/Guild/XGuildTerritoryDocument.cs | 1220 ++++++++++++++++++++ 1 file changed, 1220 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Guild/XGuildTerritoryDocument.cs (limited to 'Client/Assets/Scripts/XMainClient/Guild/XGuildTerritoryDocument.cs') diff --git a/Client/Assets/Scripts/XMainClient/Guild/XGuildTerritoryDocument.cs b/Client/Assets/Scripts/XMainClient/Guild/XGuildTerritoryDocument.cs new file mode 100644 index 00000000..897ec27d --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Guild/XGuildTerritoryDocument.cs @@ -0,0 +1,1220 @@ +using System; +using System.Collections.Generic; +using System.Text; +using KKSG; +using UILib; +using UnityEngine; +using XMainClient.UI; +using XMainClient.UI.UICommon; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class XGuildTerritoryDocument : XDocComponent + { + public override uint ID + { + get + { + return XGuildTerritoryDocument.uuID; + } + } + + public uint bHavaTerritoryRecCount + { + get + { + return this.mHaveTerritoryCount; + } + set + { + this.mHaveTerritoryCount = value; + DlgBase.singleton.RefreshH5ButtonState(XSysDefine.XSys_GuildTerritoryAllianceInterface, true); + } + } + + public XGuildTerritoryDocument.GuildTerritoryStyle TerritoryStyle + { + get + { + return this.mCurTerritoryStyle; + } + set + { + this.mCurTerritoryStyle = value; + DlgBase.singleton.RefreshH5ButtonState(XSysDefine.XSys_GuildTerritoryIconInterface, true); + this.RefreshGuildTerritoryInfo(); + } + } + + public bool bHavaShowMessageIcon + { + get + { + return this.mShowMessageIcon; + } + set + { + this.mShowMessageIcon = value; + DlgBase.singleton.RefreshH5ButtonState(XSysDefine.XSys_GuildTerritoryMessageInterface, true); + } + } + + public List GuildTerrChallList + { + get + { + return this.mGuildTerrChall; + } + } + + public List CityDataList + { + get + { + return this.mCityDataList; + } + } + + public List GuildTerrAllianceInfos + { + get + { + return this.mGuildTerritoryAllianceList; + } + } + + public new static readonly uint uuID = XSingleton.singleton.XHash("XGuildTerritoryDocument"); + + public static readonly uint GAME_INFO = 1u; + + public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader(); + + private static FightDesignation mGuildDestination = new FightDesignation(); + + public static GuildTransfer mGuildTransfer = new GuildTransfer(); + + public static TerritoryBattle mGuildTerritoryList = new TerritoryBattle(); + + public static TerritoryRewd mTerritoryRewd = new TerritoryRewd(); + + public XFx[] fxJvDians = new XFx[9]; + + public Vector3[] fxJvPos = new Vector3[3]; + + private float lastShowInfoTime; + + public Queue qInfo = new Queue(); + + public uint mapid = 0u; + + public List jvdians = new List(); + + public List guilds = new List(); + + public List roles = new List(); + + public List fields = new List(); + + public List rwds = new List(); + + public GCFRoleBrief mmyinfo = new GCFRoleBrief(); + + public uint feats = 0u; + + public GCFGuildBrief winguild; + + public uint ready_lefttime = 0u; + + public uint fight_lefttime = 0u; + + public uint territoryid = 0u; + + public bool myPostion = true; + + private uint[] maptoken = new uint[3]; + + private string[] fxs = new string[] + { + "Effects/FX_Particle/UIfx/UI_xdtts_white", + "Effects/FX_Particle/UIfx/UI_xdtts_bule", + "Effects/FX_Particle/UIfx/UI_xdtts_red" + }; + + private Dictionary mCityDataDic = new Dictionary(); + + private List mCityDataList = new List(); + + private List mGuildTerrChall = new List(); + + private List mGuildTerritoryAllianceList = new List(); + + private uint mHaveTerritoryCount = 0u; + + private XGuildTerritoryDocument.GuildTerritoryStyle mCurTerritoryStyle = XGuildTerritoryDocument.GuildTerritoryStyle.NONE; + + public ulong Allianceid = 0UL; + + public GUILDTERRTYPE CurrentType = GUILDTERRTYPE.TERR_NOT_OPEN; + + public uint SelfGuildTerritoryID = 0u; + + public uint SelfTargetTerritoryID = 0u; + + public List guildAllianceInfos; + + public bool mShowMessage = true; + + public bool mShowMessageIcon = false; + + public ulong SelfAllianceID = 0UL; + + public uint CurrentTerritoryID = 0u; + + public uint EnterBattleTime = 0u; + + public enum GuildTerritoryStyle + { + NONE, + INFORM, + ACTIVITY + } + + protected override void OnReconnected(XReconnectedEventArgs arg) + { + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + this.SendGCFCommonReq(GCFReqType.GCF_FIGHT_REPORT); + } + } + + public static void Execute(OnLoadedCallback callback = null) + { + XGuildTerritoryDocument.AsyncLoader.AddTask("Table/TerritoryBattleDesignation", XGuildTerritoryDocument.mGuildDestination, false); + XGuildTerritoryDocument.AsyncLoader.AddTask("Table/TerritoryBattleTransfer", XGuildTerritoryDocument.mGuildTransfer, false); + XGuildTerritoryDocument.AsyncLoader.AddTask("Table/territorybattle", XGuildTerritoryDocument.mGuildTerritoryList, false); + XGuildTerritoryDocument.AsyncLoader.AddTask("Table/TerritoryRewd", XGuildTerritoryDocument.mTerritoryRewd, false); + XGuildTerritoryDocument.AsyncLoader.Execute(callback); + } + + public static void OnLoadcallback() + { + } + + public override void OnEnterScene() + { + base.OnEnterScene(); + bool flag = XSingleton.singleton.SceneType == SceneType.SCENE_HALL; + if (flag) + { + GuildMiniReportHandler.msgs.Clear(); + } + bool flag2 = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT; + if (flag2) + { + XSingleton.singleton.InitBoard(); + } + bool flag3 = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT; + if (flag3) + { + for (int i = 0; i < this.fxJvDians.Length; i++) + { + bool flag4 = i % 3 == 0; + if (flag4) + { + this.fxJvDians[i] = XSingleton.singleton.CreateFx("Effects/FX_Particle/Roles/Lzg_Ty/Ty_ldzd_fanwei_grey", null, true); + } + else + { + bool flag5 = i % 3 == 1; + if (flag5) + { + this.fxJvDians[i] = XSingleton.singleton.CreateFx("Effects/FX_Particle/Roles/Lzg_Ty/Ty_ldzd_fanwei_red", null, true); + } + else + { + this.fxJvDians[i] = XSingleton.singleton.CreateFx("Effects/FX_Particle/Roles/Lzg_Ty/Ty_ldzd_fanwei_blue", null, true); + } + } + bool flag6 = i / 3 == 0; + if (flag6) + { + List floatList = XSingleton.singleton.GetFloatList("GuildTerritoryUpPos"); + Vector3 vector; + vector= new Vector3(floatList[0], floatList[1], floatList[2]); + float num = float.Parse(XSingleton.singleton.GetValue("TerritoryBattleUpRadius")) * float.Parse(XSingleton.singleton.GetValue("TerritoryBattleClientRadiusK")); + this.fxJvDians[i].Play(vector, Quaternion.identity, new Vector3(num, 1f, num), 1f); + this.fxJvPos[0] = vector; + } + else + { + bool flag7 = i / 3 == 1; + if (flag7) + { + List floatList2 = XSingleton.singleton.GetFloatList("GuildTerritoryMidPos"); + Vector3 vector2; + vector2= new Vector3(floatList2[0], floatList2[1], floatList2[2]); + float num2 = float.Parse(XSingleton.singleton.GetValue("TerritoryBattleMidRadius")) * float.Parse(XSingleton.singleton.GetValue("TerritoryBattleClientRadiusK")); + this.fxJvDians[i].Play(vector2, Quaternion.identity, new Vector3(num2, 1f, num2), 1f); + this.fxJvPos[1] = vector2; + } + else + { + List floatList3 = XSingleton.singleton.GetFloatList("GuildTerritoryBtmPos"); + Vector3 vector3; + vector3= new Vector3(floatList3[0], floatList3[1], floatList3[2]); + float num3 = float.Parse(XSingleton.singleton.GetValue("TerritoryBattleBtmRadius")) * float.Parse(XSingleton.singleton.GetValue("TerritoryBattleClientRadiusK")); + this.fxJvDians[i].Play(vector3, Quaternion.identity, new Vector3(num3, 1f, num3), 1f); + this.fxJvPos[2] = vector3; + } + } + } + } + } + + public override void OnEnterSceneFinally() + { + base.OnEnterSceneFinally(); + this.CheckJvDianState(); + bool flag = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT; + if (flag) + { + bool flag2 = DlgBase.singleton.IsLoaded() && DlgBase.singleton.IsVisible(); + if (flag2) + { + DlgBase.singleton.SkillHandler.SetVisible(false); + } + } + bool flag3 = Process_RpcC2G_DoEnterScene.runstate > 0u; + if (flag3) + { + bool flag4 = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT || XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT; + if (flag4) + { + XLevelRewardDocument specificDocument = XDocuments.GetSpecificDocument(XLevelRewardDocument.uuID); + bool flag5 = specificDocument != null; + if (flag5) + { + bool flag6 = DlgBase.singleton.IsLoaded(); + if (flag6) + { + DlgBase.singleton.SkillHandler.ResetPressState(); + DlgBase.singleton.SetVisiblePure(false); + DlgBase.singleton.Show(false); + DlgBase.singleton.SetFakeHide(true); + } + specificDocument.ShowLevelReward(); + } + } + } + } + + public override void OnLeaveScene() + { + bool flag = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT; + if (flag) + { + XSingleton.singleton.ClearAll(); + bool flag2 = DlgBase.singleton.IsLoaded() && DlgBase.singleton.IsVisible(); + if (flag2) + { + DlgBase.singleton.SkillHandler.SetVisible(true); + } + } + bool flag3 = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT; + if (flag3) + { + for (int i = 0; i < this.fxJvDians.Length; i++) + { + bool flag4 = this.fxJvDians[i] != null; + if (flag4) + { + XSingleton.singleton.DestroyFx(this.fxJvDians[i], true); + } + this.fxJvDians[i] = null; + } + XBattleDocument.DelMiniMapFx(this.maptoken[0]); + XBattleDocument.DelMiniMapFx(this.maptoken[1]); + XBattleDocument.DelMiniMapFx(this.maptoken[2]); + } + base.OnLeaveScene(); + } + + public override void OnDetachFromHost() + { + this.jvdians.Clear(); + this.roles.Clear(); + this.guilds.Clear(); + this.rwds.Clear(); + base.OnDetachFromHost(); + } + + public override void PostUpdate(float fDeltaT) + { + base.PostUpdate(fDeltaT); + bool flag = Time.frameCount % 60 == 0; + if (flag) + { + bool flag2 = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_WAIT; + if (flag2) + { + this.SendGCFReadysInfo(); + this.SendGFCFightInfo(); + } + else + { + bool flag3 = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT; + if (flag3) + { + this.SendGFCFightInfo(); + } + } + } + bool flag4 = Time.time > this.lastShowInfoTime + 10f; + if (flag4) + { + bool flag5 = this.qInfo.Count != 0; + if (flag5) + { + this.qInfo.Clear(); + } + bool flag6 = DlgBase.singleton.IsVisible() && DlgBase.singleton.m_miniReportHandler != null; + if (flag6) + { + DlgBase.singleton.m_miniReportHandler.ShowBuffs(); + } + } + } + + public FightDesignation.RowData GetDesignation(uint hit) + { + FightDesignation.RowData[] table = XGuildTerritoryDocument.mGuildDestination.Table; + for (int i = table.Length - 1; i >= 0; i--) + { + bool flag = table[i].ID <= hit; + if (flag) + { + return table[i]; + } + } + return null; + } + + public void ActiveJvDian(GCFJvDianType type, int index) + { + bool flag = type == GCFJvDianType.GCF_JUDIAN_UP; + if (flag) + { + bool flag2 = this.fxJvDians[0] != null && this.fxJvDians[1] != null && this.fxJvDians[2] != null; + if (flag2) + { + this.fxJvDians[0].SetActive(index == 0); + this.fxJvDians[1].SetActive(index == 1); + this.fxJvDians[2].SetActive(index == 2); + } + } + else + { + bool flag3 = type == GCFJvDianType.GCF_JUDIAN_MID; + if (flag3) + { + bool flag4 = this.fxJvDians[3] != null && this.fxJvDians[4] != null && this.fxJvDians[5] != null; + if (flag4) + { + this.fxJvDians[3].SetActive(index == 0); + this.fxJvDians[4].SetActive(index == 1); + this.fxJvDians[5].SetActive(index == 2); + } + } + else + { + bool flag5 = this.fxJvDians[6] != null && this.fxJvDians[7] != null && this.fxJvDians[8] != null; + if (flag5) + { + this.fxJvDians[6].SetActive(index == 0); + this.fxJvDians[7].SetActive(index == 1); + this.fxJvDians[8].SetActive(index == 2); + } + } + } + } + + public void SendGCFEnterin(int index) + { + this.mapid = XGuildTerritoryDocument.mGuildTransfer.GetByid((uint)index).sceneid; + this.SendGCFCommonReq(GCFReqType.GCF_JOIN_FIGHT_SCENE); + } + + public void SendWaitScene(uint tid) + { + this.territoryid = tid; + this.SendGCFCommonReq(GCFReqType.GCF_JOIN_READY_SCENE); + } + + public void SendGCFCommonReq(GCFReqType type) + { + RpcC2M_GCFCommonReq rpcC2M_GCFCommonReq = new RpcC2M_GCFCommonReq(); + rpcC2M_GCFCommonReq.oArg.mapid = this.mapid; + rpcC2M_GCFCommonReq.oArg.reqtype = type; + rpcC2M_GCFCommonReq.oArg.territoryid = this.territoryid; + XSingleton.singleton.Send(rpcC2M_GCFCommonReq); + } + + public void RespGCFCommon(GCFReqType type, GCFCommonRes res) + { + this.jvdians = res.jvdians; + this.guilds.Clear(); + for (int i = 0; i < res.guilds.Count; i++) + { + GCFGuild gcfguild = new GCFGuild(); + gcfguild.brief = res.guilds[i]; + gcfguild.groupScore = this.GetGroupPoint(res.guilds, gcfguild.brief.group); + this.guilds.Add(gcfguild); + } + this.roles = res.roles; + this.rwds = res.rewards; + this.fields = res.fields; + this.mmyinfo = res.myinfo; + bool flag = this.mmyinfo != null; + if (flag) + { + this.feats = this.mmyinfo.feats; + } + this.territoryid = res.territoryid; + this.winguild = res.winguild; + bool flag2 = type == GCFReqType.GCF_FIGHT_REPORT; + if (flag2) + { + bool flag3 = DlgBase.singleton.IsVisible(); + if (flag3) + { + DlgBase.singleton.RefreshAll(); + } + } + else + { + bool flag4 = type == GCFReqType.GCF_JOIN_READY_SCENE; + if (!flag4) + { + bool flag5 = type == GCFReqType.GCF_FIGHT_RESULT; + if (flag5) + { + LevelRewardTerritoryHandler territoryHandler = DlgBase.singleton.GetTerritoryHandler(); + bool flag6 = territoryHandler != null; + if (flag6) + { + territoryHandler.RefreshAll(); + } + else + { + XSingleton.singleton.AddErrorLog("level reward is nil", null, null, null, null, null); + } + } + else + { + bool flag7 = type == GCFReqType.GCF_JOIN_FIGHT_SCENE; + if (flag7) + { + } + } + } + } + } + + public void SendGCFReadysInfo() + { + RpcC2M_GCFReadysInfoReq rpc = new RpcC2M_GCFReadysInfoReq(); + XSingleton.singleton.Send(rpc); + } + + public void RespGCFReadysInfo(GCFReadyInfoRes ores) + { + this.ready_lefttime = ores.lefttime; + bool flag = DlgBase.singleton.IsVisible() && !XSingleton.singleton.isOpen && this.ready_lefttime > 0u; + if (flag) + { + DlgBase.singleton.SetLeftTime(this.ready_lefttime, -1); + } + XSingleton.singleton.UpdateInfo(ores.allinfo); + } + + public void SendGFCFightInfo() + { + RpcC2M_GCFFightInfoReqC2M rpc = new RpcC2M_GCFFightInfoReqC2M(); + XSingleton.singleton.Send(rpc); + } + + public void RespGCFFightInfo(GCFFightInfoRes res) + { + this.fight_lefttime = res.lefttime; + bool flag = DlgBase.singleton.IsVisible() && XSingleton.singleton.isOpen && this.fight_lefttime > 0u; + if (flag) + { + DlgBase.singleton.SetLeftTime(this.fight_lefttime, -1); + } + XGuildDocument specificDocument = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + this.guilds.Clear(); + for (int i = 0; i < res.guilds.Count; i++) + { + GCFGuild gcfguild = new GCFGuild(); + gcfguild.brief = res.guilds[i]; + gcfguild.groupScore = this.GetGroupPoint(res.guilds, gcfguild.brief.group); + gcfguild.isPartern = (res.guilds[i].group == res.mygroup); + bool flag2 = gcfguild.brief.guildid == specificDocument.UID; + if (flag2) + { + this.myPostion = gcfguild.isPartern; + } + this.guilds.Add(gcfguild); + } + this.jvdians = res.JvDians; + this.guilds.Sort(new Comparison(this.SortGuildsInfo)); + GuildBattleMiniRankHandler miniRankHandler = DlgBase.singleton.m_miniRankHandler; + bool flag3 = miniRankHandler != null; + if (flag3) + { + miniRankHandler.RefreshAll(); + } + this.CheckJvDianState(); + GuildMiniReportHandler miniReportHandler = DlgBase.singleton.m_miniReportHandler; + bool flag4 = miniReportHandler != null; + if (flag4) + { + miniReportHandler.RefreshMyInfo(res.myinfo); + } + } + + private uint GetGroupPoint(List guilds, int group) + { + uint num = 0u; + for (int i = 0; i < guilds.Count; i++) + { + bool flag = guilds[i].group == group; + if (flag) + { + num += guilds[i].point; + } + } + return num; + } + + private int SortGuildsInfo(GCFGuild x, GCFGuild y) + { + bool flag = x.groupScore != y.groupScore; + int result; + if (flag) + { + result = (int)(y.groupScore - x.groupScore); + } + else + { + result = (int)(y.brief.point - x.brief.point); + } + return result; + } + + public void OnFeatsChange(uint feat) + { + this.feats = feat; + } + + public void OnZhanLingNotify(GCFZhanLingPara data) + { + GCFZhanLingType zltype = data.zltype; + XEntity entity = XSingleton.singleton.GetEntity(data.roleID); + bool flag = entity == null || entity.Attributes == null; + if (!flag) + { + XTerritoryComponent xterritoryComponent = entity.GetXComponent(XTerritoryComponent.uuID) as XTerritoryComponent; + bool flag2 = zltype == GCFZhanLingType.GCFZL_BEGIN; + if (flag2) + { + xterritoryComponent.ToStart(); + } + else + { + bool flag3 = zltype == GCFZhanLingType.GCFZL_BREAK; + if (flag3) + { + xterritoryComponent.Interupt(); + } + else + { + bool flag4 = zltype == GCFZhanLingType.GCFZL_END; + if (flag4) + { + xterritoryComponent.Success(); + } + } + } + } + } + + public void ModifyMinimapState(GCFJvDianType type1, int index2) + { + int num = XFastEnumIntEqualityComparer.ToInt(type1); + Vector3 pos = this.fxJvPos[num - 1]; + string fx = this.fxs[index2]; + bool flag = type1 == GCFJvDianType.GCF_JUDIAN_UP; + if (flag) + { + XBattleDocument.DelMiniMapFx(this.maptoken[0]); + this.maptoken[0] = XBattleDocument.AddMiniMapFx(pos, fx); + } + else + { + bool flag2 = type1 == GCFJvDianType.GCF_JUDIAN_MID; + if (flag2) + { + XBattleDocument.DelMiniMapFx(this.maptoken[1]); + this.maptoken[1] = XBattleDocument.AddMiniMapFx(pos, fx); + } + else + { + XBattleDocument.DelMiniMapFx(this.maptoken[2]); + this.maptoken[2] = XBattleDocument.AddMiniMapFx(pos, fx); + } + } + } + + public void OnGCFSynG2CNtf(GCFG2CSynPara data) + { + GuildMiniReportHandler miniReportHandler = DlgBase.singleton.m_miniReportHandler; + bool flag = miniReportHandler != null; + if (flag) + { + miniReportHandler.Push(data.type, data); + } + bool flag2 = data.type == GCFG2CSynType.GCF_G2C_SYN_KILL_COUNT; + if (flag2) + { + XEntity entity = XSingleton.singleton.GetEntity(data.roleid); + bool flag3 = entity != null; + if (flag3) + { + bool flag4 = entity.BillBoard != null; + if (flag4) + { + entity.BillBoard.OnFightDesignationInfoChange(data.killcount); + } + } + } + } + + public void ReceiveBattleSkill(PvpBattleKill battleSkillInfo) + { + bool flag = XSingleton.singleton.SceneType != SceneType.SCENE_CASTLE_FIGHT; + if (!flag) + { + GVGBattleSkill gvgbattleSkill = new GVGBattleSkill(); + gvgbattleSkill.killerID = battleSkillInfo.killID; + gvgbattleSkill.deadID = battleSkillInfo.deadID; + gvgbattleSkill.contiKillCount = battleSkillInfo.contiKillCount; + XEntity entityConsiderDeath = XSingleton.singleton.GetEntityConsiderDeath(gvgbattleSkill.killerID); + XEntity entityConsiderDeath2 = XSingleton.singleton.GetEntityConsiderDeath(gvgbattleSkill.deadID); + bool flag2 = entityConsiderDeath == null || entityConsiderDeath2 == null; + if (flag2) + { + XSingleton.singleton.AddErrorLog("entity id: " + gvgbattleSkill.killerID, " dead id: " + gvgbattleSkill.deadID, null, null, null, null); + } + else + { + gvgbattleSkill.killerName = entityConsiderDeath.Name; + gvgbattleSkill.deadName = entityConsiderDeath2.Name; + bool flag3 = XSingleton.singleton.IsAlly(entityConsiderDeath); + gvgbattleSkill.killerPosition = (this.myPostion ? flag3 : (!flag3)); + DlgBase.singleton.AddBattleSkill(gvgbattleSkill); + XSingleton.singleton.AddGreenLog(string.Format("ReceiveBattleSkill:{0} --- ,{1} ,.... {2}", gvgbattleSkill.killerName, gvgbattleSkill.deadName, gvgbattleSkill.contiKillCount), null, null, null, null, null); + } + } + } + + private void CheckJvDianState() + { + bool flag = XSingleton.singleton.SceneType == SceneType.SCENE_CASTLE_FIGHT; + if (flag) + { + for (int i = 0; i < this.jvdians.Count; i++) + { + bool flag2 = string.IsNullOrEmpty(this.jvdians[i].guildname); + if (flag2) + { + this.ActiveJvDian(this.jvdians[i].type, 0); + this.ModifyMinimapState(this.jvdians[i].type, 0); + } + else + { + this.ActiveJvDian(this.jvdians[i].type, this.IsPartener(this.jvdians[i].guildname) ? 2 : 1); + this.ModifyMinimapState(this.jvdians[i].type, this.IsPartener(this.jvdians[i].guildname) ? 1 : 2); + } + } + } + } + + private bool IsPartener(string guildname) + { + for (int i = 0; i < this.guilds.Count; i++) + { + bool flag = this.guilds[i].brief.guildname == guildname; + if (flag) + { + return this.guilds[i].isPartern; + } + } + return false; + } + + public void OnAddBuff(ulong roleID, uint doodadID) + { + BuffTable.RowData buffData = XSingleton.singleton.GetBuffData((int)doodadID, 1); + string text = string.Empty; + bool flag = buffData == null; + if (flag) + { + XSingleton.singleton.AddErrorLog(string.Format("GuildTerritory: Buff data not found: [{0} {1}]", doodadID, 1), null, null, null, null, null); + } + else + { + text = buffData.BuffName; + } + XEntity entity = XSingleton.singleton.GetEntity(roleID); + bool flag2 = entity == null; + if (flag2) + { + XSingleton.singleton.AddWarningLog("entity is null", null, null, null, null, null); + } + else + { + string name = entity.Name; + StringBuilder stringBuilder = new StringBuilder(); + bool flag3 = false; + for (int i = 0; i < text.Length; i++) + { + bool flag4 = text[i] == '['; + if (flag4) + { + flag3 = true; + } + bool flag5 = text[i] == ')'; + if (flag5) + { + flag3 = false; + } + bool flag6 = flag3; + if (flag6) + { + stringBuilder.Append(text[i]); + } + bool flag7 = text[i] == '('; + if (flag7) + { + flag3 = true; + } + bool flag8 = text[i] == ']'; + if (flag8) + { + flag3 = false; + } + } + this.AddBuffInfo(name, stringBuilder.ToString()); + } + } + + private void AddBuffInfo(string left, string right) + { + this.lastShowInfoTime = Time.time; + XBattleCaptainPVPDocument.KillInfo item = default(XBattleCaptainPVPDocument.KillInfo); + item.KillName = left; + item.DeadName = right; + this.qInfo.Enqueue(item); + bool flag = (long)this.qInfo.Count > (long)((ulong)XGuildTerritoryDocument.GAME_INFO); + if (flag) + { + this.qInfo.Dequeue(); + } + bool flag2 = DlgBase.singleton.IsVisible() && DlgBase.singleton.m_miniReportHandler != null; + if (flag2) + { + DlgBase.singleton.m_miniReportHandler.ShowBuffs(); + } + } + + public void OnClickTerritoryIcon() + { + XGuildTerritoryDocument.GuildTerritoryStyle territoryStyle = this.TerritoryStyle; + if (territoryStyle != XGuildTerritoryDocument.GuildTerritoryStyle.INFORM) + { + if (territoryStyle == XGuildTerritoryDocument.GuildTerritoryStyle.ACTIVITY) + { + DlgBase.singleton.SetVisibleWithAnimation(true, null); + } + } + else + { + this.TerritoryStyle = XGuildTerritoryDocument.GuildTerritoryStyle.NONE; + XSingleton.singleton.ShowModalDialog(XStringDefineProxy.GetString("NOTICE_TERRITORY_STRING"), XStringDefineProxy.GetString("NOTICE_TERRITORY_STRING_GO"), XStringDefineProxy.GetString("NOTICE_TERRITORY_STRING_ENSURE"), new ButtonClickEventHandler(this.OnInformClick)); + } + } + + private bool OnInformClick(IXUIButton btn) + { + XSingleton.singleton.CloseModalDlg(); + DlgBase.singleton.SetVisibleWithAnimation(true, null); + return false; + } + + public bool TryTerritoryAlliance(uint terriroryID, out int messageID) + { + bool result = false; + messageID = 0; + bool flag = terriroryID == this.SelfGuildTerritoryID; + if (flag) + { + messageID = 4; + } + else + { + uint targetTerrioryType = this.GetTargetTerrioryType(terriroryID); + uint targetTerrioryType2 = this.GetTargetTerrioryType(this.SelfGuildTerritoryID); + bool flag2 = targetTerrioryType == 0u; + if (flag2) + { + messageID = 0; + } + int num = (int)(targetTerrioryType - targetTerrioryType2); + bool flag3 = num > 1; + if (flag3) + { + bool flag4 = targetTerrioryType == 3u; + if (flag4) + { + messageID = 2; + } + else + { + bool flag5 = targetTerrioryType == 2u; + if (flag5) + { + messageID = 1; + } + } + } + else + { + bool flag6 = num < 1; + if (flag6) + { + bool flag7 = targetTerrioryType2 == 3u; + if (flag7) + { + messageID = 5; + } + else + { + messageID = 3; + } + } + else + { + result = true; + } + } + } + return result; + } + + public uint GetTargetTerrioryType(uint cityID) + { + uint result = 0u; + bool flag = cityID > 0u; + if (flag) + { + TerritoryBattle.RowData byID = XGuildTerritoryDocument.mGuildTerritoryList.GetByID(cityID); + bool flag2 = byID != null; + if (flag2) + { + result = byID.territorylevel; + } + } + return result; + } + + public bool TryGetCityData(uint cityID, out CityData data) + { + return this.mCityDataDic.TryGetValue(cityID, out data); + } + + public void SendGuildTerritoryCityInfo() + { + RpcC2M_ReqGuildTerrCityInfo rpc = new RpcC2M_ReqGuildTerrCityInfo(); + XSingleton.singleton.Send(rpc); + } + + public void ReceiveGuildTerritoryCityInfo(ReqGuildTerrCityInfo res) + { + XGuildDocument specificDocument = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + this.CurrentType = res.type; + this.SelfTargetTerritoryID = res.targetid; + this.SelfGuildTerritoryID = 0u; + this.SelfAllianceID = res.allianceId; + this.mCityDataList.Clear(); + XSingleton.singleton.AddGreenLog("ReceiveGuildTerritoryCityInfo:", this.CurrentType.ToString(), res.targetid.ToString(), res.cityinfo.Count.ToString(), null, null); + int i = 0; + int count = res.cityinfo.Count; + while (i < count) + { + bool flag = this.mCityDataDic.ContainsKey(res.cityinfo[i].id); + if (flag) + { + this.mCityDataDic[res.cityinfo[i].id] = res.cityinfo[i]; + } + else + { + this.mCityDataDic.Add(res.cityinfo[i].id, res.cityinfo[i]); + } + bool flag2 = res.cityinfo[i].guildid > 0UL; + if (flag2) + { + this.mCityDataList.Add(res.cityinfo[i]); + } + bool flag3 = specificDocument.BasicData.uid == res.cityinfo[i].guildid; + if (flag3) + { + this.SelfGuildTerritoryID = res.cityinfo[i].id; + } + i++; + } + this.mCityDataList.Sort(new Comparison(this.CompareCityData)); + bool flag4 = DlgBase.singleton.IsVisible(); + if (flag4) + { + DlgBase.singleton.RefreshData(); + } + } + + public void SetGuildTerritoryCityInfo(uint cityID, ulong guildID) + { + this.RefreshGuildTerritoryInfo(); + } + + private int CompareCityData(CityData city1, CityData city2) + { + return (int)(city2.id - city1.id); + } + + public void RefreshGuildTerritoryInfo() + { + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + this.SendGuildTerritoryCityInfo(); + } + bool flag2 = DlgBase.singleton.IsVisible(); + if (flag2) + { + this.SendGuildTerritoryChallInfo(this.CurrentTerritoryID); + } + } + + public void SendGuildTerritoryChallInfo(uint uid) + { + bool flag = uid == 0u; + if (!flag) + { + RpcC2M_ReqGuildTerrChallInfo rpcC2M_ReqGuildTerrChallInfo = new RpcC2M_ReqGuildTerrChallInfo(); + rpcC2M_ReqGuildTerrChallInfo.oArg.id = uid; + this.CurrentTerritoryID = uid; + XSingleton.singleton.Send(rpcC2M_ReqGuildTerrChallInfo); + } + } + + public void ReceiveGuildTerritoryChallInfo(ReqGuildTerrChallInfoArg arg, ReqGuildTerrChallInfoRes res) + { + XSingleton.singleton.AddGreenLog("ReceiveGuildTerritoryChallInfo:", res.challinfo.Count.ToString(), null, null, null, null); + this.mGuildTerrChall.Clear(); + this.mGuildTerrChall.AddRange(res.challinfo); + this.mGuildTerritoryAllianceList.Clear(); + this.EnterBattleTime = res.cdtime; + Dictionary dictionary = new Dictionary(); + int i = 0; + int count = res.challinfo.Count; + while (i < count) + { + bool flag = dictionary.ContainsKey(res.challinfo[i].allianceid); + if (flag) + { + dictionary[res.challinfo[i].allianceid].Add(res.challinfo[i]); + } + else + { + bool flag2 = !dictionary.ContainsKey(res.challinfo[i].guildid); + if (flag2) + { + GuildTerritoryAllianceInfo guildTerritoryAllianceInfo = new GuildTerritoryAllianceInfo(); + guildTerritoryAllianceInfo.Set(res.challinfo[i]); + dictionary.Add(res.challinfo[i].guildid, guildTerritoryAllianceInfo); + } + } + i++; + } + this.mGuildTerritoryAllianceList.AddRange(dictionary.Values); + bool flag3 = this.CurrentTerritoryID > 0u; + if (flag3) + { + bool flag4 = DlgBase.singleton.IsVisible(); + if (flag4) + { + DlgBase.singleton.RefreshWhenShow(); + } + else + { + DlgBase.singleton.SetVisibleWithAnimation(true, null); + } + } + } + + public void SendReceiveTerritroyInfo() + { + RpcC2M_ReqGuildTerrIntellInfo rpc = new RpcC2M_ReqGuildTerrIntellInfo(); + XSingleton.singleton.Send(rpc); + } + + public void ReceiveTerritoryInterllInfo(ReqGuildTerrIntellInfoRes oRes) + { + bool flag = DlgBase.singleton.IsVisible(); + if (flag) + { + DlgBase.singleton.SetNewInfo(oRes.intellInfo); + } + } + + public bool TryGetTerritoryGuildName(ulong guildid, out string guildName) + { + guildName = string.Empty; + int i = 0; + int count = this.mGuildTerrChall.Count; + while (i < count) + { + bool flag = this.mGuildTerrChall[i].guildid == guildid; + if (flag) + { + guildName = this.mGuildTerrChall[i].guildname; + return true; + } + i++; + } + return false; + } + + public void SendGuildTerrAllianceInfo() + { + RpcC2M_ReqGuildTerrAllianceInfo rpc = new RpcC2M_ReqGuildTerrAllianceInfo(); + XSingleton.singleton.Send(rpc); + } + + public void ReceiveGuildTerrAllianceInfo(ReqGuildTerrAllianceInfoRes res) + { + this.Allianceid = res.allianceid; + this.guildAllianceInfos = res.allianceinfo; + DlgBase.singleton.RefreshData(); + } + + public void SendAllianceGuildTerr(uint territoryID) + { + XGuildDocument specificDocument = XDocuments.GetSpecificDocument(XGuildDocument.uuID); + bool flag = specificDocument.Position == GuildPosition.GPOS_LEADER || specificDocument.Position == GuildPosition.GPOS_VICELEADER; + if (flag) + { + RpcC2M_AllianceGuildTerr rpcC2M_AllianceGuildTerr = new RpcC2M_AllianceGuildTerr(); + rpcC2M_AllianceGuildTerr.oArg.id = territoryID; + XSingleton.singleton.Send(rpcC2M_AllianceGuildTerr); + } + else + { + XSingleton.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_TB_DECLEAR_NO_PERMISSON"), "fece00"); + } + } + + public void ReceiveAllianceGuildTerr(AllianceGuildTerrArg arg, AllianceGuildTerrRes res) + { + bool flag = res.errorcod > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(res.errorcod, "fece00"); + bool flag2 = res.errorcod == ErrorCode.ERR_DECLAREWAR_OUT_TIME; + if (flag2) + { + this.RefreshGuildTerritoryInfo(); + } + } + else + { + this.RefreshGuildTerritoryInfo(); + } + } + + public void SendTryAlliance(ulong guildID) + { + XSingleton.singleton.AddGreenLog("SendTryAlliance", guildID.ToString(), null, null, null, null); + RpcC2M_TryAlliance rpcC2M_TryAlliance = new RpcC2M_TryAlliance(); + rpcC2M_TryAlliance.oArg.guild = guildID; + XSingleton.singleton.Send(rpcC2M_TryAlliance); + } + + public void ReceiveTryAlliance(TryAllianceArg arg, TryAlliance res) + { + XSingleton.singleton.AddGreenLog("ReceiveTryAlliance", null, null, null, null, null); + bool flag = res.errorcode > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(res.errorcode, "fece00"); + } + else + { + this.SendGuildTerritoryChallInfo(this.CurrentTerritoryID); + } + } + + public void SendRecAlliance(ulong guildID) + { + RpcC2M_RecAlliance rpcC2M_RecAlliance = new RpcC2M_RecAlliance(); + rpcC2M_RecAlliance.oArg.guildid = guildID; + XSingleton.singleton.Send(rpcC2M_RecAlliance); + } + + public void ReceiveRecAlliance(RecAllianceArg arg, RecAllianceRes res) + { + bool flag = res.errorcode > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(res.errorcode, "fece00"); + } + else + { + this.bHavaTerritoryRecCount = 0u; + DlgBase.singleton.SetVisibleWithAnimation(false, null); + } + } + + public void SendClearGuildTerrAlliance() + { + RpcC2M_ClearGuildTerrAlliance rpc = new RpcC2M_ClearGuildTerrAlliance(); + XSingleton.singleton.Send(rpc); + } + + public void ReceiveClearGuildTerrAlliance(ClearGuildTerrAllianceRes res) + { + bool flag = res.errorcode > ErrorCode.ERR_SUCCESS; + if (flag) + { + XSingleton.singleton.ShowSystemTip(res.errorcode, "fece00"); + } + else + { + this.bHavaTerritoryRecCount = 0u; + DlgBase.singleton.SetVisibleWithAnimation(false, null); + } + } + } +} -- cgit v1.1-26-g67d0