OpenRA.Order.Command C# (CSharp) Method

Command() public static method

public static Command ( string text ) : Order
text string
return Order
        public static Order Command(string text)
        {
            return new Order("Command", null, false) { IsImmediate = true, TargetString = text };
        }

Usage Example

Example #1
0
        public static void RestartGame()
        {
            var replay     = OrderManager.Connection as ReplayConnection;
            var replayName = replay != null ? replay.Filename : null;
            var lobbyInfo  = OrderManager.LobbyInfo;
            var orders     = new[] {
                Order.Command("sync_lobby {0}".F(lobbyInfo.Serialize())),
                Order.Command("startgame")
            };

            // Disconnect from the current game
            Disconnect();
            Ui.ResetAll();

            // Restart the game with the same replay/mission
            if (replay != null)
            {
                JoinReplay(replayName);
            }
            else
            {
                CreateAndStartLocalServer(lobbyInfo.GlobalSettings.Map, orders);
            }
        }