static void OnPlayerColorChangedRequest(ref PlayerChangeColorMsg msg, MyNetworkClient sender) { PlayerId playerId = new PlayerId(sender.SteamUserId, msg.SerialId); var player = Sync.Players.GetPlayerById(playerId); if (player == null) { List<Vector3> colors; if (!MyCubeBuilder.AllPlayersColors.TryGetValue(playerId, out colors)) return; colors[msg.ColorIndex] = msg.NewColor; return; } player.SelectedBuildColorSlot = msg.ColorIndex; player.ChangeOrSwitchToColor(msg.NewColor); }
public void RequestPlayerColorChanged(int playerSerialId, int colorIndex, Vector3 newColor) { PlayerChangeColorMsg msg = new PlayerChangeColorMsg() { SerialId = playerSerialId, ColorIndex = colorIndex, NewColor = newColor, }; Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }