/// <summary>Set the instance that is wrapped.</summary> /// <param name="obj"/> public virtual void Set(IWritable obj) { instance = obj; Type instanceClazz = instance.GetType(); Type[] clazzes = GetTypes(); for (int i = 0; i < clazzes.Length; i++) { Type clazz = clazzes[i]; if (clazz.Equals(instanceClazz)) { type = unchecked ((byte)i); return; } } throw new RuntimeException("The type of instance is: " + instance.GetType() + ", which is NOT registered."); }
public bool GetOpcode(IWritable message, out GameMessageOpcode opcode) { return(serverMessageOpcodes.TryGetValue(message.GetType(), out opcode)); }
/// <summary> /// Return <see cref="ServerRawOpcode"/> for supplied <see cref="IWritable"/>. /// </summary> public static bool GetRawOpcode(IWritable message, out ServerRawOpcode opcode) { return(rawMessageOpcodes.TryGetValue(message.GetType(), out opcode)); }
/// <summary> /// Return <see cref="UpdateType"/> for supplied <see cref="IWritable"/>. /// </summary> public static bool GetUpdateType(IWritable message, out UpdateType updateType) { return(updateMessageTypes.TryGetValue(message.GetType(), out updateType)); }
public static bool GetOpcodeTypes(IWritable message, out Opcodes opcode) { return(ServerMessageStructures.TryGetValue(message.GetType(), out opcode)); }
public override string ToString() { return("GW[" + (instance != null ? ("class=" + instance.GetType().FullName + ",value=" + instance.ToString()) : "(null)") + "]"); }