Skip to content

Commit

Permalink
chore: removed editor files getting into builds
Browse files Browse the repository at this point in the history
  • Loading branch information
momintlh committed Nov 16, 2024
1 parent 8ab77f4 commit 4a50e12
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
41 changes: 20 additions & 21 deletions Assets/PlayroomKit/PlayroomKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ public Player GetPlayer(string playerId)
}
else if (CurrentMockMode == MockModeSelector.Browser)
{
#if UNITY_EDITOR
player = new Player(playerId,
new BrowserMockPlayerService(UnityBrowserBridge.Instance, playerId));
#endif
}
}
else
Expand All @@ -115,28 +117,26 @@ public static Player GetPlayerById(string playerId)
{
return player;
}
else
{
if (!IsRunningInBrowser())
{
if (CurrentMockMode == MockModeSelector.Local)
{
player = new Player(playerId, new Player.LocalPlayerService(playerId));
}
else if (CurrentMockMode == MockModeSelector.Browser)
{
player = new Player(playerId,
new BrowserMockPlayerService(UnityBrowserBridge.Instance, playerId));
}
}
else
{
player = new Player(playerId, new Player.PlayerService(playerId));
}

Players.Add(playerId, player);
return player;
#if UNITY_WEBGL
player = new Player(playerId, new Player.PlayerService(playerId));

Players.Add(playerId, player);
return player;
#elif UNITY_EDITOR
if (CurrentMockMode == MockModeSelector.Local)
{
player = new Player(playerId, new Player.LocalPlayerService(playerId));
}
else if (CurrentMockMode == MockModeSelector.Browser)
{
player = new Player(playerId,
new BrowserMockPlayerService(UnityBrowserBridge.Instance, playerId));
}

Players.Add(playerId, player);
return player;
#endif
}

public void SetState<T>(string key, T value, bool reliable = false)
Expand Down Expand Up @@ -255,7 +255,6 @@ public void ResetStates(string[] keysToExclude = null, Action OnStatesReset = nu
public void ResetPlayersStates(string[] keysToExclude = null, Action OnStatesReset = null)
{
_playroomService.ResetPlayersStates(keysToExclude, OnStatesReset);

}

// Joystick
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Playroom
{
#if UNITY_EDITOR

public class BrowserMockPlayerService : PlayroomKit.Player.IPlayerBase
{
private readonly UnityBrowserBridge _ubb;
Expand Down Expand Up @@ -116,7 +118,7 @@ public void WaitForState(string stateKey, Action<string> onStateSetCallback = nu
MockCallbackInvoker invoker = callbackObject.AddComponent<MockCallbackInvoker>();
invoker.SetCallback(onStateSetCallback, callbackKey);
CallBacksHandlerMock.Instance.RegisterCallbackObject(callbackKey, callbackObject, "ExecuteCallback");

_ubb.CallJs("WaitForPlayerState", null, null, true, _id, stateKey, callbackKey);
}

Expand All @@ -132,4 +134,5 @@ private class PrimitiveWrapper<T>

#endregion
}
#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@
using System.Reflection;
using UBB;
using UnityEngine;

#if UNITY_EDITOR
using ParrelSync;
#endif

namespace Playroom
{
Expand All @@ -22,6 +25,7 @@ public void InsertCoin(InitOptions options = null, Action onLaunchCallBack = nul
{
_ubb.httpServerPort += 10;
}

_ubb.StartUBB();

string optionsJson = null;
Expand Down Expand Up @@ -189,7 +193,5 @@ public static void MockOnPlayerJoinWrapper(string playerId)

#endregion
}


#endif
}
Original file line number Diff line number Diff line change
Expand Up @@ -277,4 +277,4 @@ RpcCall = function (name, data, rpcMode) {
}

Playroom.RPC.call(name, data, mode);
};
};

0 comments on commit 4a50e12

Please sign in to comment.