public void Close(bool force = false) { try { var player = CAMain.PlayerList[this.PlayerID]; if (player != null) { MenuEventArgs args = new MenuEventArgs(this.contents, this.PlayerID, -1, (force)?MenuStatus.ForceExit:MenuStatus.Exit); if (this.MenuActionHandler != null) { this.MenuActionHandler(this, args); } if (force || !args.Handled) { player.InMenu = false; player.Menu = null; if (!player.quitting) { CAMain.DisplayLog(player, 7); } } } } catch (Exception ex) { Log.ConsoleError(ex.ToString()); } }
public void JoinChannel(CAPlayer player) { if (player == null) { return; } if (player.Channel >= 0 && player.Channel != this.ID && CAMain.Channels[player.Channel] != null) { CAMain.Channels[player.Channel].LeaveChannel(player); } player.Channel = this.ID; if (!this.Users.Contains(player.Index)) { this.Users.Add(player.Index); CAMain.DisplayLog(player, 6); if (!this.Flags.HasFlag(ChannelFlags.BlockJoinLeaveMsg)) { NetMessage.SendData((int)PacketTypes.ChatText, -1, player.Index, String.Format("[Join] {0} has joined the channel", player.TSPlayer.Name), 255, Color.LightSalmon.R, Color.LightSalmon.G, Color.LightSalmon.B, this.ID + 1); } } }