public MessageManager(int id) { _id = id; _priority = new SafeInteger(); _receivedByteCount = new SafeInteger(); _sentByteCount = new SafeInteger(); _stockBlocks = new VolatileHashSet<Key>(new TimeSpan(1, 0, 0, 0)); _stockProfileMetadatas = new VolatileHashSet<byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _stockSignatureMessageMetadatas = new VolatileHashSet<byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _stockWikiDocumentMetadatas = new VolatileHashSet<byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _stockChatMessageMetadatas = new VolatileHashSet<byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _pushBlocksLink = new VolatileHashSet<Key>(new TimeSpan(0, 30, 0)); _pullBlocksLink = new VolatileHashSet<Key>(new TimeSpan(0, 30, 0)); _pushBlocksRequest = new VolatileHashSet<Key>(new TimeSpan(0, 30, 0)); _pullBlocksRequest = new VolatileHashSet<Key>(new TimeSpan(0, 30, 0)); _pushBroadcastSignaturesRequest = new VolatileHashSet<string>(new TimeSpan(0, 30, 0)); _pullBroadcastSignaturesRequest = new VolatileHashSet<string>(new TimeSpan(0, 30, 0)); _pushUnicastSignaturesRequest = new VolatileHashSet<string>(new TimeSpan(0, 30, 0)); _pullUnicastSignaturesRequest = new VolatileHashSet<string>(new TimeSpan(0, 30, 0)); _pushMulticastWikisRequest = new VolatileHashSet<Wiki>(new TimeSpan(0, 30, 0)); _pullMulticastWikisRequest = new VolatileHashSet<Wiki>(new TimeSpan(0, 30, 0)); _pushMulticastChatsRequest = new VolatileHashSet<Chat>(new TimeSpan(0, 30, 0)); _pullMulticastChatsRequest = new VolatileHashSet<Chat>(new TimeSpan(0, 30, 0)); }
public MessageManager(int id) { _id = id; _priority = new SafeInteger(); _receivedByteCount = new SafeInteger(); _sentByteCount = new SafeInteger(); _stockBlocks = new VolatileHashSet <Key>(new TimeSpan(1, 0, 0, 0)); _stockProfileMetadatas = new VolatileHashSet <byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _stockSignatureMessageMetadatas = new VolatileHashSet <byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _stockWikiDocumentMetadatas = new VolatileHashSet <byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _stockChatTopicMetadatas = new VolatileHashSet <byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _stockChatMessageMetadatas = new VolatileHashSet <byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _pushBlocksLink = new VolatileHashSet <Key>(new TimeSpan(0, 30, 0)); _pullBlocksLink = new VolatileHashSet <Key>(new TimeSpan(0, 30, 0)); _pushBlocksRequest = new VolatileHashSet <Key>(new TimeSpan(0, 30, 0)); _pullBlocksRequest = new VolatileHashSet <Key>(new TimeSpan(0, 30, 0)); _pushBroadcastSignaturesRequest = new VolatileHashSet <string>(new TimeSpan(0, 30, 0)); _pullBroadcastSignaturesRequest = new VolatileHashSet <string>(new TimeSpan(0, 30, 0)); _pushUnicastSignaturesRequest = new VolatileHashSet <string>(new TimeSpan(0, 30, 0)); _pullUnicastSignaturesRequest = new VolatileHashSet <string>(new TimeSpan(0, 30, 0)); _pushMulticastWikisRequest = new VolatileHashSet <Wiki>(new TimeSpan(0, 30, 0)); _pullMulticastWikisRequest = new VolatileHashSet <Wiki>(new TimeSpan(0, 30, 0)); _pushMulticastChatsRequest = new VolatileHashSet <Chat>(new TimeSpan(0, 30, 0)); _pullMulticastChatsRequest = new VolatileHashSet <Chat>(new TimeSpan(0, 30, 0)); }
/// <summary> /// 重设战斗状态的标志 /// </summary> public void ResetBattleState(BattleStatusType eType) { // 获取状态对应的引用计数 int tmpType = (int)eType; int i = 0; for (; i < mBattleStateRefNum.GetLength(0); ++i) { tmpType = tmpType >> 1; if (tmpType == 0) { break; } } if (i < mBattleStateRefNum.GetLength(0)) { mCurBattleState = FlagOperate.RemoveFlag(mCurBattleState, (int)eType); //kActor.BattleStateRefNum[i] = 0; } else { Debug.LogError("角色状态数值溢出 : " + eType); } }
/// <summary> /// 增加战斗状态的标志 /// </summary> public void AddBattleState(BattleStatusType eType) { if (mOwner == null) { return; } // 获取状态对应的引用计数 int tmpType = (int)eType; int i = 0; for (; i < mBattleStateRefNum.GetLength(0); ++i) { tmpType = tmpType >> 1; if (tmpType == 0) { break; } } if (i < mBattleStateRefNum.GetLength(0)) { // 增加角色状态的flag if (mBattleStateRefNum[i] < 255) { mBattleStateRefNum[i] += 1; } mCurBattleState = FlagOperate.AddFlag(mCurBattleState, (int)eType); } else { Debug.LogError("角色状态数值溢出 : " + eType); } }
/// <summary> /// 重设当前战斗状态 /// </summary> public void Reset() { mCurBattleState = 0; for (int i = 0; i < mBattleStateRefNum.GetLength(0); ++i) { mBattleStateRefNum[i] = 0; } UpdateBattleState(); }
public void Load() { SessionsPoolingAmount = int.Parse(System.Configuration.Read("gameserver.maxc")); int SessionsPoolingBuffersize = 512; SocketBufferStacker = new SocketBufferStacker(SessionsPoolingAmount, SessionsPoolingBuffersize); SocketArgsStacker = new SocketArgsStacker(SessionsPoolingAmount); ThreadSupressor = new Semaphore(SessionsPoolingAmount, SessionsPoolingAmount); SessionsInteger = new SafeInteger(0, false); Sessions = new Dictionary <int, Session>(); //System.IOStreamer.AppendLog("There are " + SessionsPoolingAmount + " EventArgs loaded."); CallAsync(null); }
public MessageManager(int id) { _id = id; _priority = new SafeInteger(); _receivedByteCount = new SafeInteger(); _sentByteCount = new SafeInteger(); _stockBlocks = new VolatileHashSet <Key>(new TimeSpan(1, 0, 0, 0)); _stockLinkSeeds = new VolatileHashDictionary <string, DateTime>(new TimeSpan(1, 0, 0)); _stockStoreSeeds = new VolatileHashDictionary <string, DateTime>(new TimeSpan(1, 0, 0)); _pushBlocksLink = new VolatileHashSet <Key>(new TimeSpan(0, 30, 0)); _pullBlocksLink = new VolatileHashSet <Key>(new TimeSpan(0, 30, 0)); _pushBlocksRequest = new VolatileHashSet <Key>(new TimeSpan(0, 30, 0)); _pullBlocksRequest = new VolatileHashSet <Key>(new TimeSpan(0, 30, 0)); _pushSeedsRequest = new VolatileHashSet <string>(new TimeSpan(0, 30, 0)); _pullSeedsRequest = new VolatileHashSet <string>(new TimeSpan(0, 30, 0)); }
public PacketManager(int id) { _id = id; _priority = new SafeInteger(); _receivedByteCount = new SafeInteger(); _sentByteCount = new SafeInteger(); _countManager = new CountManager(new TimeSpan(0, 30, 0)); _pushBlocksRequest = new VolatileHashSet<Key>(new TimeSpan(0, 30, 0)); _pullBlocksLink = new VolatileHashSet<Key>(new TimeSpan(0, 30, 0)); _pullBlocksRequest = new VolatileHashSet<Key>(new TimeSpan(0, 30, 0)); _stockBroadcastMetadatas = new VolatileHashSet<byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _stockUnicastMetadatas = new VolatileHashSet<byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _stockMulticastMetadatas = new VolatileHashSet<byte[]>(new TimeSpan(1, 0, 0), new ByteArrayEqualityComparer()); _pullBroadcastMetadatasRequest = new VolatileHashSet<string>(new TimeSpan(0, 30, 0)); _pullUnicastMetadatasRequest = new VolatileHashSet<string>(new TimeSpan(0, 30, 0)); _pullMulticastMetadatasRequest = new VolatileHashSet<Tag>(new TimeSpan(0, 30, 0)); }
/// <summary> /// 根据当前角色状态标志做对应的状态处理 /// </summary> public void UpdateBattleState() { if (mOwner.GetModel() == null) { return; } if (mLastBattleState != mCurBattleState) { // 眩晕 if (FlagOperate.HasFlag((int)mCurBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_DIZZY)) { if (!FlagOperate.HasFlag((int)mLastBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_DIZZY)) { mOwner.EnterDizzyState(); } } else { if (FlagOperate.HasFlag((int)mLastBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_DIZZY)) { mOwner.ExitDizzyState(); } } // 混乱 if (FlagOperate.HasFlag((int)mCurBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_CHAOS)) { if (!FlagOperate.HasFlag((int)mLastBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_CHAOS)) { mOwner.EnterChaosState(); } } else { if (FlagOperate.HasFlag((int)mLastBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_CHAOS)) { mOwner.ExitChaosState(); } } // 隐身 if (IsActorInvisiable) { if (!mOwner.IsLocalPlayer) { if (!FlagOperate.HasFlag(mLastBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_INVISIBLE)) { mOwner.mVisibleCtrl.SetActorVisible(false, VisiblePriority.BUFF_STATE); } } else { EnterTransparenceState(); } } //else { if (!mOwner.IsLocalPlayer) { if (FlagOperate.HasFlag(mLastBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_INVISIBLE)) { mOwner.mVisibleCtrl.SetActorVisible(true, VisiblePriority.BUFF_STATE); } } else { ExitTranparenceState(); } } // 无敌 if (FlagOperate.HasFlag((int)mCurBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_SUPER)) { if (!FlagOperate.HasFlag((int)mLastBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_SUPER)) { mOwner.EnterSuperState(); } } else { if (FlagOperate.HasFlag((int)mLastBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_SUPER)) { mOwner.ExitSuperState(); } } mLastBattleState = mCurBattleState; } // 角色在地面上才能进入冰冻状态 if (mOwner.IsGrounded()) { // 冰冻 if (FlagOperate.HasFlag((int)mCurBattleState, (int)BattleStatusType.BATTLE_STATUS_TYPE_FREEZE)) { if (!mbIsInFreeze) { mbIsInFreeze = true; mOwner.EnterFreezeState(); } } else { if (mbIsInFreeze) { mbIsInFreeze = false; mOwner.ExitFreezeState(); } } } }