1 #region Copyright & License Information 2 /* 3 * Copyright 2007-2020 The OpenRA Developers (see AUTHORS) 4 * This file is part of OpenRA, which is free software. It is made 5 * available to you under the terms of the GNU General Public License 6 * as published by the Free Software Foundation, either version 3 of 7 * the License, or (at your option) any later version. For more 8 * information, see COPYING. 9 */ 10 #endregion 11 12 using System; 13 using OpenRA.Network; 14 15 namespace OpenRA.Server 16 { 17 // Returns true if order is handled InterpretCommand(Server server, Connection conn, Session.Client client, string cmd)18 public interface IInterpretCommand { bool InterpretCommand(Server server, Connection conn, Session.Client client, string cmd); } LobbyInfoSynced(Server server)19 public interface INotifySyncLobbyInfo { void LobbyInfoSynced(Server server); } ServerStarted(Server server)20 public interface INotifyServerStart { void ServerStarted(Server server); } ServerEmpty(Server server)21 public interface INotifyServerEmpty { void ServerEmpty(Server server); } ServerShutdown(Server server)22 public interface INotifyServerShutdown { void ServerShutdown(Server server); } GameStarted(Server server)23 public interface IStartGame { void GameStarted(Server server); } ClientJoined(Server server, Connection conn)24 public interface IClientJoined { void ClientJoined(Server server, Connection conn); } GameEnded(Server server)25 public interface IEndGame { void GameEnded(Server server); } Tick(Server server)26 public interface ITick { void Tick(Server server); } 27 28 public abstract class ServerTrait { } 29 30 public class DebugServerTrait : ServerTrait, IInterpretCommand, IStartGame, INotifySyncLobbyInfo, INotifyServerStart, INotifyServerShutdown, IEndGame 31 { InterpretCommand(Server server, Connection conn, Session.Client client, string cmd)32 public bool InterpretCommand(Server server, Connection conn, Session.Client client, string cmd) 33 { 34 Console.WriteLine("Server received command from player {1}: {0}", cmd, conn.PlayerIndex); 35 return false; 36 } 37 GameStarted(Server server)38 public void GameStarted(Server server) 39 { 40 Console.WriteLine("GameStarted()"); 41 } 42 LobbyInfoSynced(Server server)43 public void LobbyInfoSynced(Server server) 44 { 45 Console.WriteLine("LobbyInfoSynced()"); 46 } 47 ServerStarted(Server server)48 public void ServerStarted(Server server) 49 { 50 Console.WriteLine("ServerStarted()"); 51 } 52 ServerShutdown(Server server)53 public void ServerShutdown(Server server) 54 { 55 Console.WriteLine("ServerShutdown()"); 56 } 57 GameEnded(Server server)58 public void GameEnded(Server server) 59 { 60 Console.WriteLine("GameEnded()"); 61 } 62 } 63 } 64