diff options
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/Guild/XGuildCollectDocument.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/Guild/XGuildCollectDocument.cs | 798 |
1 files changed, 798 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/Guild/XGuildCollectDocument.cs b/Client/Assets/Scripts/XMainClient/Guild/XGuildCollectDocument.cs new file mode 100644 index 00000000..3033845e --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Guild/XGuildCollectDocument.cs @@ -0,0 +1,798 @@ +using System;
+using System.Collections.Generic;
+using KKSG;
+using UILib;
+using UnityEngine;
+using XMainClient.UI;
+using XMainClient.UI.UICommon;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class XGuildCollectDocument : XDocComponent
+ {
+ public override uint ID
+ {
+ get
+ {
+ return XGuildCollectDocument.uuID;
+ }
+ }
+
+ public GuildCampPartyReward RewardReader
+ {
+ get
+ {
+ return XGuildCollectDocument._rewardReader;
+ }
+ }
+
+ public bool ActivityState
+ {
+ get
+ {
+ return this._activityState;
+ }
+ }
+
+ public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("GuildCollectDocument");
+
+ public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
+
+ private static GuildCampPartyReward _rewardReader = new GuildCampPartyReward();
+
+ private bool _activityState = false;
+
+ private bool _lotteryMachineState = false;
+
+ public List<uint> NpcPool = new List<uint>();
+
+ public List<uint> LotteryMachineList = new List<uint>();
+
+ public Dictionary<uint, uint> NpcIndex = new Dictionary<uint, uint>();
+
+ public List<CollectNpcInfo> NpcList = new List<CollectNpcInfo>();
+
+ private int _npcMaxShowNum;
+
+ private CollectNpcRefreshMode _npcRefreshMode;
+
+ private uint _lastMeetLotteryUid;
+
+ private float _lotteryWaitTime;
+
+ private string _lotteryProcessText;
+
+ private string _lotteryProcessTips;
+
+ private uint _lastSendNpcID = 0u;
+
+ private float _lastSendNpcTime;
+
+ public Dictionary<uint, int> CollectUseDict = new Dictionary<uint, int>();
+
+ public bool MainInterfaceBtnState = false;
+
+ public List<XFx> _fxList = new List<XFx>();
+
+ private static readonly string m_fxPath = "Effects/FX_Particle/Scene/Lzg_scene/rwts_05";
+
+ public double SignTime;
+
+ public uint LeftTime;
+
+ private int SUMMONLEFTTIME = 300;
+
+ private string NORMALNAME = "";
+
+ private string SPECIALNAME = "";
+
+ private uint _hallTimeToken;
+
+ private LinkedList<ParabolaFx> _lotteryFxLink = new LinkedList<ParabolaFx>();
+
+ private XFx _lotteryBoxFx;
+
+ private static readonly string LotteryFlyFXPATH = "Effects/FX_Particle/UIfx/UI_ghpd_rabbit_Clip02";
+
+ private static readonly string LotteryBoxFXPATH = "Effects/FX_Particle/UIfx/UI_ghpd_rabbit_Clip01";
+
+ public Dictionary<uint, LotteryCD> LotteryCDInfo = new Dictionary<uint, LotteryCD>();
+
+ public int LotteryTimes = 3;
+
+ public float GuildCollecLotteryCD = 120f;
+
+ public static void Execute(OnLoadedCallback callback = null)
+ {
+ XGuildCollectDocument.AsyncLoader.AddTask("Table/GuildCampPartyReward", XGuildCollectDocument._rewardReader, false);
+ XGuildCollectDocument.AsyncLoader.Execute(callback);
+ }
+
+ protected override void EventSubscribe()
+ {
+ base.EventSubscribe();
+ }
+
+ public override void OnAttachToHost(XObject host)
+ {
+ base.OnAttachToHost(host);
+ this._activityState = false;
+ this._lotteryMachineState = false;
+ }
+
+ public override void OnEnterSceneFinally()
+ {
+ base.OnEnterSceneFinally();
+ bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GUILD_HALL;
+ if (flag)
+ {
+ this._lotteryWaitTime = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryWaitTime"));
+ this._lotteryProcessText = XStringDefineProxy.GetString("GuildCollectProcessText");
+ this._lotteryProcessTips = XStringDefineProxy.GetString("GuildCollectProcessTips");
+ this.LotteryTimes = int.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryTimes"));
+ this.GuildCollecLotteryCD = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryCD"));
+ List<int> intList = XSingleton<XGlobalConfig>.singleton.GetIntList("GuildCollectNpcShowNum");
+ XQualitySetting.ESetting quality = (XQualitySetting.ESetting)XQualitySetting.GetQuality();
+ int num = XFastEnumIntEqualityComparer<XQualitySetting.ESetting>.ToInt(quality);
+ bool flag2 = num > intList.Count - 1;
+ if (flag2)
+ {
+ num = intList.Count - 1;
+ }
+ this._npcMaxShowNum = intList[num];
+ this._npcRefreshMode = ((XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollectNpcRefreshMode") == "0") ? CollectNpcRefreshMode.Random : CollectNpcRefreshMode.Distance);
+ this.NpcIndex.Clear();
+ this.NpcList.Clear();
+ this.NpcPool.Clear();
+ this.LotteryMachineList.Clear();
+ bool activityState = this._activityState;
+ if (activityState)
+ {
+ this.RefreshTime(null);
+ this.InitNpcList();
+ bool lotteryMachineState = this._lotteryMachineState;
+ if (lotteryMachineState)
+ {
+ this.SetLotteryMachineState(true, true);
+ }
+ }
+ this.SetMainInterfaceBtnState(false);
+ }
+ }
+
+ public int CheckLotteryCD(uint uid)
+ {
+ LotteryCD lotteryCD;
+ bool flag = this.LotteryCDInfo.TryGetValue(uid, out lotteryCD);
+ int result;
+ if (flag)
+ {
+ bool flag2 = lotteryCD.Times < this.LotteryTimes;
+ if (flag2)
+ {
+ lotteryCD.Times++;
+ result = -1;
+ }
+ else
+ {
+ int num = (int)(Time.time - lotteryCD.LastLotteryTime - this.GuildCollecLotteryCD);
+ bool flag3 = num >= 0;
+ if (flag3)
+ {
+ lotteryCD.Times = 1;
+ lotteryCD.LastLotteryTime = Time.time;
+ result = -1;
+ }
+ else
+ {
+ result = -num;
+ }
+ }
+ }
+ else
+ {
+ lotteryCD = new LotteryCD();
+ lotteryCD.Times = 1;
+ lotteryCD.LastLotteryTime = Time.time;
+ this.LotteryCDInfo[uid] = lotteryCD;
+ result = -1;
+ }
+ return result;
+ }
+
+ public void SetActivityState(bool state)
+ {
+ bool flag = this._activityState != state;
+ if (flag)
+ {
+ this._activityState = state;
+ XSingleton<XDebug>.singleton.AddGreenLog("set guildcollect state = ", state.ToString(), null, null, null, null);
+ bool flag2 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GUILD_HALL;
+ if (flag2)
+ {
+ bool activityState = this._activityState;
+ if (activityState)
+ {
+ this.RefreshTime(null);
+ this.InitNpcList();
+ }
+ else
+ {
+ foreach (KeyValuePair<uint, uint> keyValuePair in this.NpcIndex)
+ {
+ XSingleton<XEntityMgr>.singleton.DestroyNpc(keyValuePair.Value);
+ }
+ for (int i = 0; i < this.NpcPool.Count; i++)
+ {
+ XSingleton<XEntityMgr>.singleton.DestroyNpc(this.NpcPool[i]);
+ }
+ this.NpcIndex.Clear();
+ this.NpcList.Clear();
+ this.NpcPool.Clear();
+ }
+ }
+ bool flag3 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
+ if (flag3)
+ {
+ DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.OnGuildSysChange();
+ }
+ }
+ }
+
+ public void InitNpcList()
+ {
+ int num = this._npcMaxShowNum;
+ this.NORMALNAME = XStringDefineProxy.GetString("GuildCollectSummonNormal");
+ this.SPECIALNAME = XStringDefineProxy.GetString("GuildCollectSummonSpecial");
+ uint num2 = 101u;
+ for (;;)
+ {
+ XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(num2);
+ bool flag = byNPCID == null || byNPCID.NPCType != 4u;
+ if (flag)
+ {
+ break;
+ }
+ XNpc xnpc = XSingleton<XEntityMgr>.singleton.CreateNpc(num2, true);
+ xnpc.EngineObject.Position = XGameUI.Far_Far_Away;
+ this.NpcPool.Add(num2);
+ num--;
+ bool flag2 = num <= 0;
+ if (flag2)
+ {
+ break;
+ }
+ num2 += 1u;
+ }
+ }
+
+ public void SyncNpcList(List<GuildCampSpriteInfo> list)
+ {
+ HashSet<uint> hashSet = new HashSet<uint>();
+ for (int i = 0; i < list.Count; i++)
+ {
+ hashSet.Add(list[i].sprite_id);
+ }
+ for (int j = this.NpcList.Count - 1; j >= 0; j--)
+ {
+ bool flag = hashSet.Contains(this.NpcList[j].id);
+ if (flag)
+ {
+ hashSet.Remove(this.NpcList[j].id);
+ }
+ else
+ {
+ this.SetNpcInValid(j);
+ this.NpcList.RemoveAt(j);
+ }
+ }
+ bool flag2 = false;
+ for (int k = 0; k < list.Count; k++)
+ {
+ bool flag3 = hashSet.Contains(list[k].sprite_id);
+ if (flag3)
+ {
+ flag2 = true;
+ Vector3 pos;
+ pos= new Vector3((float)(list[k].position >> 16) / 100f, 0f, (float)(list[k].position & 65535) / 100f);
+ string name = string.IsNullOrEmpty(list[k].summoner) ? this.NORMALNAME : string.Format("{0}{1}", list[k].summoner, this.SPECIALNAME);
+ this.NpcList.Add(new CollectNpcInfo(list[k].sprite_id, pos, name));
+ }
+ }
+ bool flag4 = flag2;
+ if (flag4)
+ {
+ this.SortNpcByMode(this._npcRefreshMode);
+ }
+ this.DealWithNpcList();
+ }
+
+ public void OnMeetNpc(uint uid)
+ {
+ bool flag = this.NpcIndex.ContainsValue(uid);
+ if (flag)
+ {
+ foreach (KeyValuePair<uint, uint> keyValuePair in this.NpcIndex)
+ {
+ bool flag2 = keyValuePair.Value == uid;
+ if (flag2)
+ {
+ bool flag3 = this._lastSendNpcID == keyValuePair.Key && Time.time < this._lastSendNpcTime;
+ if (flag3)
+ {
+ return;
+ }
+ RpcC2G_GetGuildCamPartyRandItem rpcC2G_GetGuildCamPartyRandItem = new RpcC2G_GetGuildCamPartyRandItem();
+ rpcC2G_GetGuildCamPartyRandItem.oArg.query_type = 2u;
+ rpcC2G_GetGuildCamPartyRandItem.oArg.npc_id = keyValuePair.Key;
+ XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetGuildCamPartyRandItem);
+ this._lastSendNpcTime = Time.time + 0.5f;
+ return;
+ }
+ }
+ }
+ XSingleton<UiUtility>.singleton.ShowSystemTip(ErrorCode.ERR_GUILDACMPPATY_SPRITE_ONTEXIST, "fece00");
+ }
+
+ public void OnMeetLottery(uint uid)
+ {
+ bool flag = DlgBase<GuildInheritProcessDlg, GuildInheritProcessBehaviour>.singleton.IsVisible();
+ if (!flag)
+ {
+ int num = this.CheckLotteryCD(uid);
+ bool flag2 = num != -1;
+ if (flag2)
+ {
+ XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("GuildCollectLotteryCDTips"), num), "fece00");
+ }
+ else
+ {
+ this._lastMeetLotteryUid = uid;
+ DlgBase<GuildInheritProcessDlg, GuildInheritProcessBehaviour>.singleton.ShowProcess(this._lotteryWaitTime, this._lotteryProcessText, this._lotteryProcessTips, new GuildInheritProcessDlg.OnSliderProcessEnd(this.QueryLottery));
+ this.SetMoveState(false);
+ XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(uid);
+ bool flag3 = npc == null;
+ if (!flag3)
+ {
+ npc.ShowUp(null);
+ bool flag4 = npc != null;
+ if (flag4)
+ {
+ XSingleton<XAudioMgr>.singleton.PlaySound(npc, AudioChannel.Motion, "Audio/UI/UI_rabbit");
+ }
+ XSingleton<XTimerMgr>.singleton.SetTimer(float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecBoxFxTime")), new XTimerMgr.ElapsedEventHandler(this.DelayCreateLotteryBoxFx), uid);
+ string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxNum").Split(new char[]
+ {
+ '='
+ });
+ bool flag5 = array.Length < 2;
+ if (!flag5)
+ {
+ int num2 = XSingleton<XCommon>.singleton.RandomInt(int.Parse(array[0]), int.Parse(array[1]) + 1);
+ array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxProduce").Split(new char[]
+ {
+ '='
+ });
+ float min = float.Parse(array[0]);
+ float max = float.Parse(array[1]);
+ for (int i = 0; i < num2; i++)
+ {
+ XSingleton<XTimerMgr>.singleton.SetTimer(XSingleton<XCommon>.singleton.RandomFloat(min, max), new XTimerMgr.ElapsedEventHandler(this.DelayCreateLotteryFlyFx), uid);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void DelayCreateLotteryBoxFx(object o)
+ {
+ uint id = (uint)o;
+ XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(id);
+ bool flag = npc == null;
+ if (!flag)
+ {
+ bool flag2 = this._lotteryBoxFx != null;
+ if (flag2)
+ {
+ XSingleton<XFxMgr>.singleton.DestroyFx(this._lotteryBoxFx, true);
+ }
+ this._lotteryBoxFx = XSingleton<XFxMgr>.singleton.CreateFx(XGuildCollectDocument.LotteryBoxFXPATH, null, true);
+ this._lotteryBoxFx.Play(npc.EngineObject.Position, Quaternion.identity, Vector3.one, 1f);
+ }
+ }
+
+ public void DelayCreateLotteryFlyFx(object o)
+ {
+ uint id = (uint)o;
+ XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(id);
+ bool flag = npc == null || XSingleton<XEntityMgr>.singleton.Player == null;
+ if (!flag)
+ {
+ this.CreatLotteryFx(npc.EngineObject.Position, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position + new Vector3(0f, 0.3f));
+ }
+ }
+
+ public void QueryLottery()
+ {
+ this.SetMoveState(true);
+ RpcC2G_GetGuildCamPartyRandItem rpcC2G_GetGuildCamPartyRandItem = new RpcC2G_GetGuildCamPartyRandItem();
+ rpcC2G_GetGuildCamPartyRandItem.oArg.query_type = 1u;
+ rpcC2G_GetGuildCamPartyRandItem.oArg.npc_id = this._lastMeetLotteryUid;
+ XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetGuildCamPartyRandItem);
+ }
+
+ public void SetMoveState(bool state)
+ {
+ bool flag = XSingleton<XEntityMgr>.singleton.Player != null && XSingleton<XEntityMgr>.singleton.Player.Nav != null;
+ if (flag)
+ {
+ XSingleton<XEntityMgr>.singleton.Player.Nav.Interrupt();
+ XSingleton<XEntityMgr>.singleton.Player.Nav.Enabled = state;
+ }
+ XSingleton<XInput>.singleton.Freezed = !state;
+ }
+
+ public void DealWithNpcList()
+ {
+ bool flag = this._npcRefreshMode == CollectNpcRefreshMode.Distance;
+ if (flag)
+ {
+ this.NpcList.Sort(new Comparison<CollectNpcInfo>(this.Compare));
+ }
+ int num = this._npcMaxShowNum;
+ for (int i = 0; i < this.NpcList.Count; i++)
+ {
+ bool flag2 = this.NpcIndex.ContainsKey(this.NpcList[i].id);
+ if (flag2)
+ {
+ num--;
+ }
+ }
+ bool flag3 = num > 0;
+ if (flag3)
+ {
+ for (int j = 0; j < this.NpcList.Count; j++)
+ {
+ bool use = this.NpcList[j].use;
+ if (!use)
+ {
+ bool flag4 = !this.NpcIndex.ContainsKey(this.NpcList[j].id);
+ if (flag4)
+ {
+ this.CreateNpc(this.NpcList[j].pos, this.NpcList[j].id, this.NpcList[j].name);
+ num--;
+ bool flag5 = num <= 0;
+ if (flag5)
+ {
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private int Compare(CollectNpcInfo x, CollectNpcInfo y)
+ {
+ bool flag = x.id == y.id;
+ int result;
+ if (flag)
+ {
+ result = 0;
+ }
+ else
+ {
+ float num = Vector3.Distance(x.pos, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position);
+ float num2 = Vector3.Distance(y.pos, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position);
+ result = ((num > num2) ? 1 : -1);
+ }
+ return result;
+ }
+
+ public void SortNpcByMode(CollectNpcRefreshMode mode)
+ {
+ bool flag = mode == CollectNpcRefreshMode.Distance;
+ if (flag)
+ {
+ this.NpcList.Sort(new Comparison<CollectNpcInfo>(this.Compare));
+ }
+ else
+ {
+ XSingleton<UiUtility>.singleton.Shuffle<CollectNpcInfo>(ref this.NpcList);
+ }
+ }
+
+ public void SetNpcInValid(int index)
+ {
+ uint num = 0u;
+ bool flag = this.NpcIndex.TryGetValue(this.NpcList[index].id, out num);
+ if (flag)
+ {
+ this.ReturnPool(num);
+ this.NpcIndex.Remove(this.NpcList[index].id);
+ bool flag2 = XSingleton<XInput>.singleton.LastNpc != null && XSingleton<XInput>.singleton.LastNpc.TypeID == num;
+ if (flag2)
+ {
+ bool flag3 = XSingleton<XEntityMgr>.singleton.Player != null && XSingleton<XEntityMgr>.singleton.Player.Nav != null;
+ if (flag3)
+ {
+ XSingleton<XEntityMgr>.singleton.Player.Nav.Interrupt();
+ }
+ XSingleton<XInput>.singleton.LastNpc = null;
+ }
+ }
+ }
+
+ public void ReturnPool(uint uid)
+ {
+ XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(uid);
+ bool flag = npc != null;
+ if (flag)
+ {
+ npc.EngineObject.Position = XGameUI.Far_Far_Away;
+ this.NpcPool.Add(uid);
+ }
+ }
+
+ public void CreateNpc(Vector3 pos, uint npcID, string name)
+ {
+ bool flag = this.NpcPool.Count == 0;
+ if (flag)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("Get guildcollect Npc by pool error! It's a empty pool.", null, null, null, null, null);
+ }
+ else
+ {
+ int index = this.NpcPool.Count - 1;
+ uint num = this.NpcPool[index];
+ this.NpcPool.RemoveAt(index);
+ XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(num);
+ bool flag2 = npc == null;
+ if (flag2)
+ {
+ XSingleton<XDebug>.singleton.AddErrorLog("create npc by pool error. id = ", num.ToString(), null, null, null, null);
+ }
+ else
+ {
+ bool flag3 = npc.BillBoard != null;
+ if (flag3)
+ {
+ npc.BillBoard.OnGuildCollectNpcNameChange(name);
+ }
+ npc.EngineObject.Position = pos;
+ npc.EngineObject.LocalEulerAngles = new Vector3(0f, XSingleton<XCommon>.singleton.RandomFloat(-180f, 180f), 0f);
+ this.NpcIndex[npcID] = num;
+ }
+ }
+ }
+
+ public void SetLotteryMachineState(bool state, bool force = false)
+ {
+ bool flag = XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_GUILD_HALL;
+ if (!flag)
+ {
+ bool flag2 = !force && state == this._lotteryMachineState;
+ if (!flag2)
+ {
+ this._lotteryMachineState = state;
+ bool lotteryMachineState = this._lotteryMachineState;
+ if (lotteryMachineState)
+ {
+ uint num = 100u;
+ for (;;)
+ {
+ XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(num);
+ bool flag3 = byNPCID == null || byNPCID.NPCType != 5u;
+ if (flag3)
+ {
+ break;
+ }
+ XNpc xnpc = XSingleton<XEntityMgr>.singleton.CreateNpc(num, true);
+ this.LotteryMachineList.Add(num);
+ XFx xfx = XSingleton<XFxMgr>.singleton.CreateFx(XGuildCollectDocument.m_fxPath, null, true);
+ bool flag4 = xfx != null && xnpc != null;
+ if (flag4)
+ {
+ this._fxList.Add(xfx);
+ xfx.Play(xnpc.EngineObject, new Vector3(-0.05f, xnpc.Height + 0.6f, 0f), Vector3.one, 1f, false, false, "", 0f);
+ }
+ num -= 1u;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < this.LotteryMachineList.Count; i++)
+ {
+ XSingleton<XEntityMgr>.singleton.DestroyNpc(this.LotteryMachineList[i]);
+ }
+ for (int j = 0; j < this._fxList.Count; j++)
+ {
+ bool flag5 = this._fxList[j] != null;
+ if (flag5)
+ {
+ XSingleton<XFxMgr>.singleton.DestroyFx(this._fxList[j], true);
+ }
+ }
+ this._fxList.Clear();
+ this.LotteryMachineList.Clear();
+ }
+ }
+ }
+ }
+
+ public override void OnLeaveScene()
+ {
+ base.OnLeaveScene();
+ this.NpcIndex.Clear();
+ this.NpcList.Clear();
+ this.NpcPool.Clear();
+ this.LotteryMachineList.Clear();
+ for (int i = 0; i < this._fxList.Count; i++)
+ {
+ bool flag = this._fxList[i] != null;
+ if (flag)
+ {
+ XSingleton<XFxMgr>.singleton.DestroyFx(this._fxList[i], true);
+ }
+ }
+ this._fxList.Clear();
+ bool flag2 = this._lotteryFxLink.Count != 0;
+ if (flag2)
+ {
+ LinkedListNode<ParabolaFx> next;
+ for (LinkedListNode<ParabolaFx> linkedListNode = this._lotteryFxLink.First; linkedListNode != null; linkedListNode = next)
+ {
+ next = linkedListNode.Next;
+ linkedListNode.Value.Destroy();
+ this._lotteryFxLink.Remove(linkedListNode);
+ }
+ XSingleton<XDebug>.singleton.AddGreenLog("Clear guildcollect fx link, cout = ", this._lotteryFxLink.Count.ToString(), null, null, null, null);
+ }
+ bool flag3 = this._lotteryBoxFx != null;
+ if (flag3)
+ {
+ XSingleton<XFxMgr>.singleton.DestroyFx(this._lotteryBoxFx, true);
+ this._lotteryBoxFx = null;
+ }
+ }
+
+ public void SetMainInterfaceBtnState(bool state)
+ {
+ this.MainInterfaceBtnState = state;
+ DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_GuildCollectMainInterface, true);
+ }
+
+ public void QuerySummon()
+ {
+ SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("GuildCampSummonSpiritCost", false);
+ string text = string.Format(XStringDefineProxy.GetString("GuildCollectSummonTips"), XLabelSymbolHelper.FormatSmallIcon(sequenceList[0, 0]), sequenceList[0, 1]);
+ text = XSingleton<UiUtility>.singleton.ReplaceReturn(text);
+ string @string = XStringDefineProxy.GetString("COMMON_OK");
+ string string2 = XStringDefineProxy.GetString("COMMON_CANCEL");
+ XSingleton<UiUtility>.singleton.ShowModalDialog(text, @string, string2, new ButtonClickEventHandler(this.OnSummonSure));
+ }
+
+ public bool OnSummonSure(IXUIButton btn)
+ {
+ DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
+ RpcC2G_GuildPartySummonSpirit rpc = new RpcC2G_GuildPartySummonSpirit();
+ XSingleton<XClientNetwork>.singleton.Send(rpc);
+ return true;
+ }
+
+ public void QueryGetRewardCount()
+ {
+ RpcC2G_GetGuildPartyReceiveInfo rpc = new RpcC2G_GetGuildPartyReceiveInfo();
+ XSingleton<XClientNetwork>.singleton.Send(rpc);
+ }
+
+ public void OnUseCountGet(List<MapIntItem> list)
+ {
+ this.CollectUseDict.Clear();
+ for (int i = 0; i < list.Count; i++)
+ {
+ this.CollectUseDict[(uint)list[i].key] = (int)list[i].value;
+ }
+ bool flag = DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.IsVisible();
+ if (flag)
+ {
+ DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.Refresh();
+ }
+ }
+
+ public void QueryGetReward(uint id)
+ {
+ RpcC2G_GetGuildCampPartyReward rpcC2G_GetGuildCampPartyReward = new RpcC2G_GetGuildCampPartyReward();
+ rpcC2G_GetGuildCampPartyReward.oArg.reward_id = id;
+ XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetGuildCampPartyReward);
+ }
+
+ protected override void OnReconnected(XReconnectedEventArgs arg)
+ {
+ }
+
+ public void CreatLotteryFx(Vector3 startPos, Vector3 endPos)
+ {
+ string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxDuration").Split(new char[]
+ {
+ '='
+ });
+ bool flag = array.Length < 2;
+ if (!flag)
+ {
+ float duration = XSingleton<XCommon>.singleton.RandomFloat(float.Parse(array[0]), float.Parse(array[1]));
+ array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxSpeed").Split(new char[]
+ {
+ '='
+ });
+ bool flag2 = array.Length < 2;
+ if (!flag2)
+ {
+ float speedY = XSingleton<XCommon>.singleton.RandomFloat(float.Parse(array[0]), float.Parse(array[1]));
+ ParabolaFx value = new ParabolaFx(XGuildCollectDocument.LotteryFlyFXPATH, duration, speedY, startPos, endPos);
+ this._lotteryFxLink.AddLast(value);
+ }
+ }
+ }
+
+ public override void Update(float fDeltaT)
+ {
+ base.Update(fDeltaT);
+ bool flag = !this._activityState;
+ if (!flag)
+ {
+ bool flag2 = this._lotteryFxLink.Count == 0;
+ if (!flag2)
+ {
+ LinkedListNode<ParabolaFx> next;
+ for (LinkedListNode<ParabolaFx> linkedListNode = this._lotteryFxLink.First; linkedListNode != null; linkedListNode = next)
+ {
+ next = linkedListNode.Next;
+ bool flag3 = !linkedListNode.Value.Update();
+ if (flag3)
+ {
+ this._lotteryFxLink.Remove(linkedListNode);
+ }
+ }
+ }
+ }
+ }
+
+ public void SetTime(uint leftTime)
+ {
+ this.SignTime = XSingleton<UiUtility>.singleton.GetMachineTime();
+ this.LeftTime = leftTime;
+ this.SUMMONLEFTTIME = XSingleton<XGlobalConfig>.singleton.GetInt("GuildCampSummonSpiritTime");
+ }
+
+ public void RefreshTime(object o = null)
+ {
+ int num = (int)(XSingleton<UiUtility>.singleton.GetMachineTime() - this.SignTime);
+ num = (int)(this.LeftTime - (uint)num);
+ int num2 = num - this.SUMMONLEFTTIME;
+ bool flag = num < 0;
+ if (flag)
+ {
+ num = 0;
+ }
+ bool flag2 = num2 < 0;
+ if (flag2)
+ {
+ num2 = 0;
+ }
+ bool flag3 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
+ if (flag3)
+ {
+ DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshGuildCollectTime(num, num2);
+ }
+ bool flag4 = DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.IsVisible();
+ if (flag4)
+ {
+ DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.RefreshTime(num);
+ }
+ this._hallTimeToken = XSingleton<XTimerMgr>.singleton.SetTimer(1f, new XTimerMgr.ElapsedEventHandler(this.RefreshTime), null);
+ }
+ }
+}
|