private static void SlaveSwitchSuccessCallback(ref SlaveModeSwitchMsg msg, MyNetworkClient sender) { MyAssembler assembler; MyEntities.TryGetEntityById(msg.EntityId, out assembler); if (assembler != null) { assembler.IsSlave = msg.SlaveModeEnabled; assembler.SetSlave(); } }
private static void SlaveSwitchRequestCallback(ref SlaveModeSwitchMsg msg, MyNetworkClient sender) { MyAssembler assembler; MyEntities.TryGetEntityById(msg.EntityId, out assembler); if (assembler != null) { Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); assembler.IsSlave = msg.SlaveModeEnabled; assembler.SetSlave(); } }
internal void RequestSlaveSwitch(bool slaveEnabled) { SlaveModeSwitchMsg msg = new SlaveModeSwitchMsg(); msg.EntityId = m_assembler.EntityId; msg.SlaveModeEnabled = slaveEnabled; if (Sync.IsServer) { Sync.Layer.SendMessageToAll(ref msg, MyTransportMessageEnum.Success); m_assembler.IsSlave = msg.SlaveModeEnabled; m_assembler.SetSlave(); } else { Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); } }