/// <summary> /// Handles the server action /// </summary> /// <param name="parameters"></param> public void OnAction(Hashtable parameters) { Console.WriteLine("This server DDTankII, edit and build by Trminhpc!"); Console.WriteLine("Starting FightingServer ... please wait a moment!"); FightServerConfig config = new FightServerConfig(); try { config.Load(); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.ReadKey(); return; } FightServer.CreateInstance(config); FightServer.Instance.Start(); bool run = true; while (run) { try { Console.Write("> "); string line = Console.ReadLine(); string[] para = line.Split(' '); switch (para[0].ToLower()) { case "clear": Console.Clear(); break; case "list": if (para.Length > 1) { switch (para[1]) { case "-client": Console.WriteLine("server client list:"); Console.WriteLine("--------------------"); ServerClient[] list = FightServer.Instance.GetAllClients(); foreach (ServerClient client in list) { Console.WriteLine(client.ToString()); } Console.WriteLine("-------------------"); break; case "-room": Console.WriteLine("room list:"); Console.WriteLine("-------------------------------"); ProxyRoom[] rooms = ProxyRoomMgr.GetAllRoom(); foreach (ProxyRoom room in rooms) { Console.WriteLine(room.ToString()); } Console.WriteLine("-------------------------------"); break; case "-game": Console.WriteLine("game list:"); Console.WriteLine("-------------------------------"); List <BaseGame> games = GameMgr.GetGames(); foreach (BaseGame g in games) { Console.WriteLine(g.ToString()); } Console.WriteLine("-------------------------------"); break; } } else { Console.WriteLine("list [-client][-room][-game]"); Console.WriteLine(" -client:列出所有服务器对象"); Console.WriteLine(" -room:列出所有房间对象"); Console.WriteLine(" -game:列出所有游戏对象"); } break; case "exit": run = false; break; default: break; } } catch (Exception ex) { Console.WriteLine("Error:" + ex.ToString()); } } if (FightServer.Instance != null) { FightServer.Instance.Stop(); } }
public void OnAction(System.Collections.Hashtable parameters) { System.Console.WriteLine("This server GunnyII, edit and build by MrPhuong!"); System.Console.WriteLine("Starting FightingServer ... please wait a moment!"); FightServerConfig fightServerConfig = new FightServerConfig(); try { fightServerConfig.Load(); } catch (System.Exception ex) { System.Console.WriteLine(ex.Message); System.Console.ReadKey(); return; } FightServer.CreateInstance(fightServerConfig); FightServer.Instance.Start(); bool flag = true; while (flag) { try { System.Console.Write("> "); string text = System.Console.ReadLine(); string[] array = text.Split(new char[] { ' ' }); string a; if ((a = array[0].ToLower()) != null) { if (!(a == "clear")) { if (!(a == "list")) { if (a == "exit") { flag = false; } } else { if (array.Length > 1) { string a2; if ((a2 = array[1]) != null) { if (!(a2 == "-client")) { if (!(a2 == "-room")) { if (a2 == "-game") { System.Console.WriteLine("game list:"); System.Console.WriteLine("-------------------------------"); System.Collections.Generic.List <BaseGame> games = GameMgr.GetGames(); foreach (BaseGame current in games) { System.Console.WriteLine(current.ToString()); } System.Console.WriteLine("-------------------------------"); } } else { System.Console.WriteLine("room list:"); System.Console.WriteLine("-------------------------------"); ProxyRoom[] allRoom = ProxyRoomMgr.GetAllRoom(); ProxyRoom[] array2 = allRoom; for (int i = 0; i < array2.Length; i++) { ProxyRoom proxyRoom = array2[i]; System.Console.WriteLine(proxyRoom.ToString()); } System.Console.WriteLine("-------------------------------"); } } else { System.Console.WriteLine("server client list:"); System.Console.WriteLine("--------------------"); ServerClient[] allClients = FightServer.Instance.GetAllClients(); ServerClient[] array3 = allClients; for (int j = 0; j < array3.Length; j++) { ServerClient serverClient = array3[j]; System.Console.WriteLine(serverClient.ToString()); } System.Console.WriteLine("-------------------"); } } } else { System.Console.WriteLine("list [-client][-room][-game]"); System.Console.WriteLine(" -client:列出所有服务器对象"); System.Console.WriteLine(" -room:列出所有房间对象"); System.Console.WriteLine(" -game:列出所有游戏对象"); } } } else { System.Console.Clear(); } } } catch (System.Exception ex2) { System.Console.WriteLine("Error:" + ex2.ToString()); } } if (FightServer.Instance != null) { FightServer.Instance.Stop(); } }
public static void CreateConfig() { Configuration = new FightServerConfig(); Configuration.Refresh(); }