remove Misc.cs; put its contents in sensible places.
This commit is contained in:
@@ -15,6 +15,7 @@ using System.IO;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using OpenRA.FileFormats;
|
using OpenRA.FileFormats;
|
||||||
using OpenRA.FileFormats.Graphics;
|
using OpenRA.FileFormats.Graphics;
|
||||||
|
using OpenRA.Server;
|
||||||
|
|
||||||
namespace OpenRA.GameRules
|
namespace OpenRA.GameRules
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,176 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using OpenRA.Network;
|
|
||||||
using OpenRA.Server;
|
|
||||||
using OpenRA.Traits;
|
|
||||||
|
|
||||||
namespace OpenRA
|
|
||||||
{
|
|
||||||
public interface IServerExtension
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnReadyUp(Connection conn, Session.Client client);
|
|
||||||
void OnStartGame();
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnNickChange(Connection conn, Session.Client client, string newName);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnRaceChange(Connection conn, Session.Client client, string newRace);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnSlotChange(Connection conn, Session.Client client, Session.Slot slot, Map map);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnTeamChange(Connection conn, Session.Client getClient, int team);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnSpawnpointChange(Connection conn, Session.Client getClient, int spawnPoint);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnColorChange(Connection conn, Session.Client getClient, Color fromArgb, Color color);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnChat(Connection conn, string message, bool teamChat);
|
|
||||||
|
|
||||||
void OnServerStart();
|
|
||||||
void OnServerStop(bool forced);
|
|
||||||
void OnLoadMap(Map map);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return false to drop the connection
|
|
||||||
/// </summary>
|
|
||||||
bool OnValidateConnection(bool gameStarted, Connection newConn);
|
|
||||||
|
|
||||||
void OnLobbySync(Session lobbyInfo, bool gameStarted);
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnPingMasterServer(Session lobbyInfo, bool gameStarted);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Return true to use the build-in handling
|
|
||||||
/// </summary>
|
|
||||||
bool OnIngameChat(Session.Client client, string message, bool teamChat);
|
|
||||||
|
|
||||||
void OnIngameSetStance(Player player, Player stanceForPlayer, Stance newStance);
|
|
||||||
|
|
||||||
void OnLobbyUp();
|
|
||||||
void OnRejoinLobby(World world);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class NullServerExtension : IServerExtension
|
|
||||||
{
|
|
||||||
public virtual bool OnReadyUp(Connection conn, Session.Client client)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnStartGame()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnNickChange(Connection conn, Session.Client client, string newName)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnRaceChange(Connection conn, Session.Client client, string newRace)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnSlotChange(Connection conn, Session.Client client, Session.Slot slot, Map map)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnTeamChange(Connection conn, Session.Client getClient, int team)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnSpawnpointChange(Connection conn, Session.Client getClient, int spawnPoint)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnColorChange(Connection conn, Session.Client getClient, Color fromArgb, Color color)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnChat(Connection conn, string message, bool teamChat)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnServerStart()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnServerStop(bool forced)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnLoadMap(Map map)
|
|
||||||
{
|
|
||||||
// Good spot to manipulate amount of spectators! ie set Server.MaxSpectators
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnValidateConnection(bool gameStarted, Connection newConn)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnLobbySync(Session lobbyInfo, bool gameStarted)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnPingMasterServer(Session lobbyInfo, bool gameStarted)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool OnIngameChat(Session.Client client, string message, bool teamChat)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnIngameSetStance(Player player, Player stanceForPlayer, Stance newStance)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnLobbyUp()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void OnRejoinLobby(World world)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -211,7 +211,6 @@
|
|||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<Compile Include="ActorInitializer.cs" />
|
<Compile Include="ActorInitializer.cs" />
|
||||||
<Compile Include="ActorReference.cs" />
|
<Compile Include="ActorReference.cs" />
|
||||||
<Compile Include="Misc.cs" />
|
|
||||||
<Compile Include="InputHandler.cs" />
|
<Compile Include="InputHandler.cs" />
|
||||||
<Compile Include="ModData.cs" />
|
<Compile Include="ModData.cs" />
|
||||||
<Compile Include="Map.cs" />
|
<Compile Include="Map.cs" />
|
||||||
@@ -220,6 +219,8 @@
|
|||||||
<Compile Include="Network\Session.cs" />
|
<Compile Include="Network\Session.cs" />
|
||||||
<Compile Include="ObjectCreator.cs" />
|
<Compile Include="ObjectCreator.cs" />
|
||||||
<Compile Include="Network\SyncReport.cs" />
|
<Compile Include="Network\SyncReport.cs" />
|
||||||
|
<Compile Include="Server\IServerExtension.cs" />
|
||||||
|
<Compile Include="Server\NullServerExtension.cs" />
|
||||||
<Compile Include="TraitDictionary.cs" />
|
<Compile Include="TraitDictionary.cs" />
|
||||||
<Compile Include="Traits\Activities\CancelableActivity.cs" />
|
<Compile Include="Traits\Activities\CancelableActivity.cs" />
|
||||||
<Compile Include="Traits\SharesCell.cs" />
|
<Compile Include="Traits\SharesCell.cs" />
|
||||||
|
|||||||
74
OpenRA.Game/Server/IServerExtension.cs
Normal file
74
OpenRA.Game/Server/IServerExtension.cs
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.Network;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Server
|
||||||
|
{
|
||||||
|
public interface IServerExtension
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnReadyUp(Connection conn, Session.Client client);
|
||||||
|
void OnStartGame();
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnNickChange(Connection conn, Session.Client client, string newName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnRaceChange(Connection conn, Session.Client client, string newRace);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnSlotChange(Connection conn, Session.Client client, Session.Slot slot, Map map);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnTeamChange(Connection conn, Session.Client getClient, int team);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnSpawnpointChange(Connection conn, Session.Client getClient, int spawnPoint);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnColorChange(Connection conn, Session.Client getClient, Color fromArgb, Color color);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnChat(Connection conn, string message, bool teamChat);
|
||||||
|
|
||||||
|
void OnServerStart();
|
||||||
|
void OnServerStop(bool forced);
|
||||||
|
void OnLoadMap(Map map);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return false to drop the connection
|
||||||
|
/// </summary>
|
||||||
|
bool OnValidateConnection(bool gameStarted, Connection newConn);
|
||||||
|
|
||||||
|
void OnLobbySync(Session lobbyInfo, bool gameStarted);
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnPingMasterServer(Session lobbyInfo, bool gameStarted);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return true to use the built-in handling
|
||||||
|
/// </summary>
|
||||||
|
bool OnIngameChat(Session.Client client, string message, bool teamChat);
|
||||||
|
|
||||||
|
void OnIngameSetStance(Player player, Player stanceForPlayer, Stance newStance);
|
||||||
|
|
||||||
|
void OnLobbyUp();
|
||||||
|
void OnRejoinLobby(World world);
|
||||||
|
}
|
||||||
|
}
|
||||||
30
OpenRA.Game/Server/NullServerExtension.cs
Normal file
30
OpenRA.Game/Server/NullServerExtension.cs
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
using System.Drawing;
|
||||||
|
using OpenRA.Network;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
|
namespace OpenRA.Server
|
||||||
|
{
|
||||||
|
public class NullServerExtension : IServerExtension
|
||||||
|
{
|
||||||
|
public virtual bool OnReadyUp(Connection conn, Session.Client client) { return true; }
|
||||||
|
public virtual void OnStartGame() { }
|
||||||
|
public virtual bool OnNickChange(Connection conn, Session.Client client, string newName) { return true; }
|
||||||
|
public virtual bool OnRaceChange(Connection conn, Session.Client client, string newRace) { return true; }
|
||||||
|
public virtual bool OnSlotChange(Connection conn, Session.Client client, Session.Slot slot, Map map) { return true; }
|
||||||
|
public virtual bool OnTeamChange(Connection conn, Session.Client getClient, int team) { return true; }
|
||||||
|
public virtual bool OnSpawnpointChange(Connection conn, Session.Client getClient, int spawnPoint) { return true; }
|
||||||
|
public virtual bool OnColorChange(Connection conn, Session.Client getClient, Color fromArgb, Color color) { return true; }
|
||||||
|
public virtual bool OnChat(Connection conn, string message, bool teamChat) { return true; }
|
||||||
|
public virtual void OnServerStart() { }
|
||||||
|
public virtual void OnServerStop(bool forced) { }
|
||||||
|
// Good spot to manipulate number of spectators! ie set Server.MaxSpectators
|
||||||
|
public virtual void OnLoadMap(Map map) { }
|
||||||
|
public virtual bool OnValidateConnection(bool gameStarted, Connection newConn) { return true; }
|
||||||
|
public virtual void OnLobbySync(Session lobbyInfo, bool gameStarted) { }
|
||||||
|
public virtual bool OnPingMasterServer(Session lobbyInfo, bool gameStarted) { return true; }
|
||||||
|
public virtual bool OnIngameChat(Session.Client client, string message, bool teamChat) { return true; }
|
||||||
|
public virtual void OnIngameSetStance(Player player, Player stanceForPlayer, Stance newStance) { }
|
||||||
|
public virtual void OnLobbyUp() { }
|
||||||
|
public virtual void OnRejoinLobby(World world) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user