public void Encode(ProtocolBuffer protocolBuffer, object data) { ComponentChangeCommand command = (ComponentChangeCommand)data; this.entityCodec.Encode(protocolBuffer, command.Entity); this.EncodeVaried(protocolBuffer, command.Component); }
public object Decode(ProtocolBuffer protocolBuffer) { ComponentChangeCommand instance = Activator.CreateInstance <ComponentChangeCommand>(); this.DecodeToInstance(protocolBuffer, instance); return(instance); }
public void DecodeToInstance(ProtocolBuffer protocolBuffer, object instance) { ComponentChangeCommand command = (ComponentChangeCommand)instance; EntityInternal internal2 = (EntityInternal)this.entityCodec.Decode(protocolBuffer); long uid = (long)this.longCodec.Decode(protocolBuffer); Type typeByUid = this.protocol.GetTypeByUid(uid); Component component = null; component = !internal2.HasComponent(typeByUid) ? ((Component)Activator.CreateInstance(typeByUid)) : internal2.GetComponent(typeByUid); this.protocol.GetCodec(typeByUid).DecodeToInstance(protocolBuffer, component); command.Entity = internal2; command.Component = component; }