コード例 #1
0
 public static void command_listPlayers()
 {
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("             [PLAYERS ONLINE]           ", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("                                        ", ConsoleColor.Cyan, Console.BackgroundColor);
     foreach (Player Player in PlayerAPI.getPlayers())
     {
         ColourEngine.writeLine("  " + Player.playerName + " Ping: " + Player.Ping.ToString() + " Bal: $" + BalanceAPI.getBalance(Player).ToString() + " IP: " + Player.IP + " UID: " + Player.UID.ToString(), ConsoleColor.Yellow, Console.BackgroundColor);
     }
     ColourEngine.writeLine("                                        ", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
 }
コード例 #2
0
 public static void command_Items()
 {
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("                 [ITEMS]                ", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("                                        ", ConsoleColor.Cyan, Console.BackgroundColor);
     string[] SpaceEngineersItems = ItemAPI.getItems();
     for (int Item = 0; Item < SpaceEngineersItems.Length; Item++)
     {
         ColourEngine.writeLine("  " + SpaceEngineersItems[Item].ToString(), ConsoleColor.Yellow, Console.BackgroundColor);
     }
     ColourEngine.writeLine("                                        ", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
 }
コード例 #3
0
 public static void command_Help()
 {
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("                 [HELP]                 ", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("                                        ", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("  /bal                                  ", ConsoleColor.Yellow, Console.BackgroundColor);
     ColourEngine.writeLine("  /hello                                ", ConsoleColor.Yellow, Console.BackgroundColor);
     ColourEngine.writeLine("  /help                                 ", ConsoleColor.Yellow, Console.BackgroundColor);
     ColourEngine.writeLine("  /list [players|items]                 ", ConsoleColor.Yellow, Console.BackgroundColor);
     ColourEngine.writeLine("  /exit                                 ", ConsoleColor.Yellow, Console.BackgroundColor);
     ColourEngine.writeLine("                                        ", ConsoleColor.Cyan, Console.BackgroundColor);
     ColourEngine.writeLine("----------------------------------------", ConsoleColor.Cyan, Console.BackgroundColor);
 }
コード例 #4
0
 public static void onServerJoinHandler(Player JoinedPlayer)
 {
     if (ConfigAPI.loadProfile(JoinedPlayer))
     {
         PlayerAPI.createPlayer(JoinedPlayer);
         ColourEngine.write("[Project Eco] ", ConsoleColor.Magenta, Console.BackgroundColor);
         ColourEngine.writeLine("Welcome " + JoinedPlayer.playerName + " to the server!", ConsoleColor.Red, Console.BackgroundColor);
     }
     else
     {
         ServerAPI.playerList.Add(JoinedPlayer);
         ColourEngine.write("[Project Eco] ", ConsoleColor.Magenta, Console.BackgroundColor);
         ColourEngine.writeLine(JoinedPlayer.playerName + " joined the server.", ConsoleColor.Yellow, Console.BackgroundColor);
     }
 }
コード例 #5
0
        public static void CommandHandler(bool Repeat)
        {
            if (Repeat)
            {
                Console.Write("> ");
                string Input = Console.ReadLine().ToLower();
                if (Input.StartsWith("/"))
                {
                    if (Input.Split(' ').Length >= 1)
                    {
                        string Command = Input.Split(' ')[0];

                        switch (Command)
                        {
                        case "/hello":
                            Console.WriteLine("Hello World!");
                            CommandHandler(true);
                            break;

                        case "/exit":
                            break;

                        case "/bal":
                            string[] CommandArgs = Input.Split(' ');
                            if (CommandArgs.Length <= 1)
                            {
                                Console.WriteLine("Your balance is: $" + BalanceAPI.getBalance());
                            }
                            CommandHandler(true);
                            break;

                        case "/help":
                            command_Help();
                            CommandHandler(true);
                            break;

                        case "/list":
                            if (Input.Split(' ').Length >= 2)
                            {
                                string SubCommand = Input.Split(' ')[1];
                                switch (SubCommand)
                                {
                                case "players":
                                    command_listPlayers();
                                    CommandHandler(true);
                                    break;

                                case "items":
                                    command_Items();
                                    CommandHandler(true);
                                    break;

                                default:
                                    ColourEngine.writeLine("Syntax: /list [players|items]", ConsoleColor.DarkGreen, Console.BackgroundColor);
                                    CommandHandler(true);
                                    break;
                                }
                            }
                            else
                            {
                                ColourEngine.writeLine("Syntax: /list [players|items]", ConsoleColor.DarkGreen, Console.BackgroundColor);
                                CommandHandler(true);
                                break;
                            }
                            break;

                        default:
                            ColourEngine.writeLine("The command you entered, does not exist!", ConsoleColor.Red, Console.BackgroundColor);
                            CommandHandler(true);
                            break;
                        }
                    }
                }
                else
                {
                    ColourEngine.write(SEMod.playerName + "> ", ConsoleColor.White, Console.BackgroundColor);
                    ColourEngine.writeLine(Input, ConsoleColor.Green, Console.BackgroundColor);
                    CommandHandler(true);
                }
            }
        }