/// <summary> /// Adds a two way mapping between the packet ID and packet class. /// </summary> static void AddIdClassMapping(int par0, bool par1, bool par2, Type par3Class) { if (PacketIdToClassMap.ContainsItem(par0)) { throw new System.ArgumentException((new StringBuilder()).Append("Duplicate packet id:").Append(par0).ToString()); } if (PacketClassToIdMap.ContainsKey(par3Class)) { throw new System.ArgumentException((new StringBuilder()).Append("Duplicate packet class:").Append(par3Class).ToString()); } PacketIdToClassMap.AddKey(par0, par3Class); PacketClassToIdMap[par3Class] = par0; if (par1) { ClientPacketIdList.Add(par0); } if (par2) { ServerPacketIdList.Add(par0); } }
public static void ResetKeyBindingArrayAndHash() { Hash.ClearMap(); KeyBinding keybinding; for (IEnumerator <KeyBinding> iterator = KeybindArray.GetEnumerator(); iterator.MoveNext(); Hash.AddKey(keybinding.KeyCode, keybinding)) { keybinding = iterator.Current; } }
/// <summary> /// Copy the supplied image onto a newly-allocated OpenGL texture, returning the allocated texture name /// </summary> public virtual int AllocateAndSetupTexture(Bitmap par1Bitmap) { SingleIntBuffer.Clear(); GLAllocation.GenerateTextureNames(SingleIntBuffer); int i = SingleIntBuffer.Get(0); SetupTexture(par1Bitmap, i); TextureNameToImageMap.AddKey(i, par1Bitmap); return(i); }
/// <summary> /// Add an ID to Entity mapping to entityHashSet /// </summary> public virtual void AddEntityToWorld(int par1, Entity par2Entity) { Entity entity = GetEntityByID(par1); if (entity != null) { SetEntityDead(entity); } EntityList.Add(par2Entity); par2Entity.EntityId = par1; if (!SpawnEntityInWorld(par2Entity)) { EntitySpawnQueue.Add(par2Entity); } EntityHashSet.AddKey(par1, par2Entity); }