Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and Testing #113

Merged
merged 76 commits into from
Nov 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
c9fda20
chor: commented out bugged code
momintlh Oct 25, 2024
3f635b0
chore: restructured files, introduced interfaces
momintlh Oct 25, 2024
a106c0f
chore: separated initoptions, renamed interfaces
momintlh Oct 25, 2024
929a53f
chore: imported interop
momintlh Oct 25, 2024
33b112f
chore: renamed
momintlh Oct 25, 2024
90cb4dd
chore: scene saved
momintlh Oct 25, 2024
05f35ce
chore: test commit
aarijimam Oct 25, 2024
640fa61
refactor: added new PlayroomKit.cs
aarijimam Oct 25, 2024
86860dc
refactor: added di params
aarijimam Oct 25, 2024
b16ec42
refactor: some player functions and playeroomkit
aarijimam Oct 25, 2024
a2ea65a
refactor: playroomkit functions
aarijimam Oct 25, 2024
4aaa578
refactor: added start matchmaking, isRunningBrowser and GetPlayers
aarijimam Oct 25, 2024
edbcde8
refactor: added playroom services
aarijimam Oct 25, 2024
019ab4d
refactor: added new rpc
aarijimam Oct 25, 2024
2f2eeb1
refactor: remove dedundant functions from playroom kit
aarijimam Oct 25, 2024
1ebc238
feat: implemented ondisconnect with di
aarijimam Oct 25, 2024
4475dfe
refactor: added rpc and removed player constructor
aarijimam Oct 25, 2024
9844619
refactor: added totalObjects, from og constructor but never used
aarijimam Oct 25, 2024
6f1a9d4
refactor: remove localrpc temporarily out of folder
aarijimam Oct 25, 2024
0e786f9
refactor: updated 2d-platformer
aarijimam Oct 25, 2024
d8f466f
refactor: remove myplayer from player to kit
aarijimam Oct 25, 2024
265a85f
refactor: updated discord-activity
aarijimam Oct 25, 2024
f1e01d2
refactor: updated GameManager.cs
aarijimam Oct 25, 2024
6391cf8
refactor: updated lobby.cs
aarijimam Oct 25, 2024
4582a1b
refactor: added playroomkit constructor
aarijimam Oct 25, 2024
4983622
feat: added tests
aarijimam Oct 25, 2024
9a39d25
feat: added rpc interop to wrapper
aarijimam Oct 25, 2024
6fc3ecf
feat: added tests for rpc
aarijimam Oct 25, 2024
0374553
chore: moved files
momintlh Oct 28, 2024
08165f3
fix: fixed failed tests, fixed editor ui
momintlh Oct 28, 2024
c8e71d8
feat: removing dev manager script to get into builds
momintlh Oct 28, 2024
feddf85
Merge branch 'tests/rpc' into refactor/kit-functions
aarijimam Oct 28, 2024
a981872
refactor: removed redundant functions from main playroomkit file
aarijimam Oct 28, 2024
6139afd
feat: added IsStreamScreen function with new imp
aarijimam Oct 28, 2024
56ac6a4
feat: test for IsStreamScreen build
aarijimam Oct 28, 2024
b1fbcc3
feat: test for IsStreamScreen local
aarijimam Oct 28, 2024
07d7165
refactor: removed redundant OnPlayJoinCallbacks list, removed repende…
aarijimam Oct 28, 2024
75a93d5
feat: updated WaitForState with DI
aarijimam Oct 28, 2024
a5b9797
feat: test for Wait for State and exposed function
aarijimam Oct 28, 2024
9bcc091
refactor: removed unused function
aarijimam Oct 28, 2024
cc9c360
feat: wait for player state updated
aarijimam Oct 28, 2024
830a95b
feat: test for wait for player state
aarijimam Oct 28, 2024
a46aeac
feat: ResetStates
aarijimam Oct 28, 2024
6c68de8
feat: test for reset states build
aarijimam Oct 28, 2024
8856565
feat: test for reset states local
aarijimam Oct 28, 2024
35c462c
feat: reset player states updated
aarijimam Oct 28, 2024
551bb1d
feat: reset player states test build
aarijimam Oct 28, 2024
aae620e
feat: reset player states test local
aarijimam Oct 28, 2024
bfd9602
feat: joystick functions updated
aarijimam Oct 28, 2024
11a05ed
feat: joystick functions test
aarijimam Oct 28, 2024
3aa9748
refactor: move matchmaking options
aarijimam Oct 28, 2024
67d71e0
feat: my player updated
aarijimam Oct 28, 2024
f096009
feat: move ParseJsonToDict ot helpers
aarijimam Oct 28, 2024
b38d65d
feat: unsubscribe on quit updated
aarijimam Oct 28, 2024
6e8ffeb
feat: added tests for myplayer
aarijimam Oct 28, 2024
c774bc2
Merge pull request #1 from aarijimam/refactor/kit-functions
aarijimam Oct 28, 2024
ca63d67
chore: moved mm options to new file
momintlh Oct 29, 2024
d6ffc1c
refactor: added PlayerBase to Player class and updated GetProfile
aarijimam Oct 29, 2024
f842658
feat: added get profile with service
aarijimam Oct 29, 2024
495a530
refactor: wrapper for player internal functions and test for get profile
aarijimam Oct 29, 2024
9a996b5
feat: added set state and test for set state
aarijimam Oct 29, 2024
a646679
feat: updated on quit
aarijimam Oct 29, 2024
699d73e
feat: updated player kick
aarijimam Oct 29, 2024
b4575a6
feat: updated wait for state
aarijimam Oct 29, 2024
e3dcad6
refactor: added id to service
aarijimam Oct 29, 2024
db484c9
feat: tests for kick, wait for state, on quit player
aarijimam Oct 29, 2024
7c655b1
feat: import package test scene
momintlh Oct 30, 2024
dba5ea8
fix: using with architecture
momintlh Oct 30, 2024
60a8a77
fix: new class useage
momintlh Oct 30, 2024
83f5402
fix: ANOTHER FIX
momintlh Oct 30, 2024
b049a91
feat: WaitForState local mode
aarijimam Oct 30, 2024
30db603
feat: wait for player state local and test
aarijimam Oct 30, 2024
1c47813
fix: removed browser mode toggle
momintlh Nov 4, 2024
666f5df
chore: removed unused variables in tests
momintlh Nov 4, 2024
d619ffa
chore: removed option from custom editor
momintlh Nov 4, 2024
bac4a1d
Merge pull request #106 from aarijimam/fork/refactor-and-testing
momintlh Nov 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: wait for player state updated
  • Loading branch information
aarijimam committed Oct 28, 2024
commit cc9c3602372e17bce2862f2753692747f2c550bd
24 changes: 5 additions & 19 deletions Assets/PlayroomKit/PlayroomKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ public void WaitForState(string stateKey, Action<string> onStateSetCallback = nu
_playroomService.WaitForState(stateKey, onStateSetCallback);
}

public void WaitForPlayerState(string playerID, string stateKey, Action onStateSetCallback = null)
{
_playroomService.WaitForPlayerState(playerID, stateKey, onStateSetCallback);
}

// DI END


Expand Down Expand Up @@ -221,25 +226,6 @@ public static Player Me()
return IsRunningInBrowser() ? MyPlayer() : MockMe();
}


Action WaitForPlayerCallback = null;


public void WaitForPlayerState(string playerID, string stateKey, Action onStateSetCallback = null)
{
if (IsRunningInBrowser())
{
WaitForPlayerCallback = onStateSetCallback;
WaitForPlayerStateInternal(playerID, stateKey, OnStateSetCallback);
}
}

[MonoPInvokeCallback(typeof(Action))]
void OnStateSetCallback()
{
WaitForPlayerCallback?.Invoke();
}


private static Dictionary<string, T> ParseJsonToDictionary<T>(string jsonString)
{
Expand Down
2 changes: 2 additions & 0 deletions Assets/PlayroomKit/modules/Interfaces/IPlayroomBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public void InsertCoin(InitOptions options = null, Action onLaunchCallBack = nul

public void WaitForState(string stateKey, Action<string> onStateSetCallback = null);

public void WaitForPlayerState(string playerID, string stateKey, Action onStateSetCallback = null);

[MonoPInvokeCallback(typeof(Action<string>))]
protected static void __OnPlayerJoinCallbackHandler(string id)
{
Expand Down
6 changes: 6 additions & 0 deletions Assets/PlayroomKit/modules/MockMode/LocalPlayroomService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ public void WaitForState(string stateKey, Action<string> onStateSetCallback = nu
Debug.Log("Wait for state is not supported in local mode yet!");
throw new NotImplementedException();
}

public void WaitForPlayerState(string playerID, string stateKey, Action onStateSetCallback = null)
{
Debug.Log("Wait for player state is not supported in local mode yet!");
throw new NotImplementedException();
}
}
}
}
14 changes: 14 additions & 0 deletions Assets/PlayroomKit/modules/PlayroomService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,20 @@ public void WaitForState(string stateKey, Action<string> onStateSetCallback = nu
CallbackManager.RegisterCallback(onStateSetCallback, stateKey);
_interop.WaitForStateWrapper(stateKey, IPlayroomBase.InvokeCallback);
}


Action WaitForPlayerCallback = null;
public void WaitForPlayerState(string playerID, string stateKey, Action onStateSetCallback = null)
{
WaitForPlayerCallback = onStateSetCallback;
_interop.WaitForPlayerStateWrapper(playerID, stateKey, OnStateSetCallback);
}

[MonoPInvokeCallback(typeof(Action))]
void OnStateSetCallback()
{
WaitForPlayerCallback?.Invoke();
}

[MonoPInvokeCallback(typeof(Action<string>))]
private static void onDisconnectCallbackHandler(string key)
Expand Down