public Menu(int playerid, String title, List<MenuItem> contents, CAMain.MenuAction del = null) { this.contents = contents; this.PlayerID = playerid; this.title = title; if (del != null) this.MenuActionHandler = del; if (CAMain.PlayerList[playerid] != null) CAMain.PlayerList[playerid].InMenu = true; this.DisplayMenu(); }
public Menu(int playerid, String title, List <MenuItem> contents, CAMain.MenuAction del = null) { this.contents = contents; this.PlayerID = playerid; this.title = title; if (del != null) { this.MenuActionHandler = del; } if (CAMain.PlayerList[playerid] != null) { CAMain.PlayerList[playerid].InMenu = true; } this.DisplayMenu(); }
// --------------------------- STATIC METHODS ------------------------- public static Menu CreateMenu(int playerID, string title, List <MenuItem> data, CAMain.MenuAction callback) { var player = CAMain.PlayerList[playerID]; try { if (player != null && !player.InMenu) { player.Menu = new Menu(playerID, title, data, callback); return(player.Menu); } } catch (Exception ex) { Log.ConsoleError(ex.ToString()); } return(null); }