Skip to content

Commit

Permalink
wip: engine, make PrepareStart()
Browse files Browse the repository at this point in the history
  • Loading branch information
yowpark committed Dec 7, 2023
1 parent be1ad66 commit 2b8fe84
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion engine/unity/Runtime/Private/Network/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ public void SetStateHandler(IEventHandler eventHandler)
public void SetConfig(ServerConfig config)
{
_config = config;
}

public void PrepareStart()
{
AfterSetConfig();
}

Expand Down Expand Up @@ -217,7 +221,7 @@ private async Task handleCommand(Socket sock, byte[] packetbuffer)

private void AfterSetConfig()
{
if (null != _config.inputMappings)
if (null != _config.inputMappings && 0 < _config.inputMappings.Length)
{
Input.storage = new GamiumOldInputStorage(_config.inputMappings);
}
Expand Down
2 changes: 1 addition & 1 deletion engine/unity/Runtime/Public/Network/ServerBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public void Run()
Debug.LogError("USE_GAMIUM Scripting Define Symbol is not set. Please set it in Edit > Project Settings > Player > Other Settings > Scripting Define Symbols");
return;
#else
_server.PrepareStart();
var serverComponentGo = new GameObject("GamiumEngine");
ServerComponent.Behaviour _instance = serverComponentGo.AddComponent<ServerComponent.Behaviour>();
serverComponentGo.AddComponent<TaskManager.Behaviour>();
Expand All @@ -54,7 +55,6 @@ public void Run()

try
{

_instance.RequestRun(_server);
}
catch (Exception e)
Expand Down

0 comments on commit 2b8fe84

Please sign in to comment.