forked from icosa-foundation/open-brush
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into feature/snap-ghosts
- Loading branch information
Showing
205 changed files
with
26,594 additions
and
3,033 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,7 @@ updates: | |
- "mikeage" | ||
assignees: | ||
- "mikeage" | ||
groups: | ||
all-actions-updates: | ||
patterns: | ||
- "**" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,10 +13,27 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5.1.0 | ||
- uses: actions/setup-python@v5.3.0 | ||
with: | ||
python-version: '3.12' | ||
- uses: actions/setup-dotnet@v4.0.0 | ||
- uses: actions/setup-dotnet@v4.1.0 | ||
with: | ||
dotnet-version: '8.0.x' | ||
- uses: pre-commit/[email protected] | ||
- name: Install pre-commit | ||
run: python -m pip install pre-commit | ||
shell: bash | ||
- name: Cache pre-commit environments | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} | ||
- name: Setup pre-commit environments | ||
run: pre-commit run | ||
- name: Run pre-commit dotnet-format, with retries | ||
uses: Wandalen/wretry.action@v3 | ||
with: | ||
command: pre-commit run dotnet-format --show-diff-on-failure --color=always --all-files || { git checkout -- . ; exit 1 ; } # In case dotnet-format fails, reset the changes it made. This way, we can differentiate between a NuGet failure and a real formatting issue | ||
- name: Remove dotnet-format from the list of pre-commit jobs to run (since we already ran it) | ||
run: yq eval 'del(.repos[] | select(.hooks[].id == "dotnet-format"))' -i .pre-commit-config.yaml | ||
- name: Run the rest of pre-commit | ||
run: pre-commit run --show-diff-on-failure --color=always --all-files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
--- | ||
line_ending: lf | ||
formatter: | ||
include_document_start: true | ||
indent: 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
// MultiplayerManagerInspector.cs | ||
using UnityEditor; | ||
using UnityEngine; | ||
using OpenBrush.Multiplayer; | ||
using System.Threading.Tasks; | ||
using System.ComponentModel.Composition; | ||
|
||
#if UNITY_EDITOR | ||
[CustomEditor(typeof(MultiplayerManager))] | ||
public class MultiplayerManagerInspector : Editor | ||
{ | ||
private MultiplayerManager multiplayerManager; | ||
private string roomName = "1234"; | ||
private bool isPrivate = false; | ||
private int maxPlayers = 4; | ||
private bool voiceDisabled = false; | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
multiplayerManager = (MultiplayerManager)target; | ||
|
||
DrawDefaultInspector(); | ||
|
||
GUILayout.Space(10); | ||
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); | ||
GUILayout.Space(10); | ||
|
||
roomName = EditorGUILayout.TextField("Room Name", roomName); | ||
|
||
//State | ||
string connectionState = ""; | ||
if (multiplayerManager != null) connectionState = multiplayerManager.State.ToString(); | ||
else connectionState = "Not Assigned"; | ||
|
||
GUILayout.Space(10); | ||
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); | ||
EditorGUILayout.BeginHorizontal(); | ||
GUILayout.Label("Connection State: ", EditorStyles.boldLabel); | ||
EditorGUILayout.LabelField($"{connectionState}"); | ||
EditorGUILayout.EndHorizontal(); | ||
GUILayout.Space(5); | ||
|
||
if (GUILayout.Button("Connect")) | ||
{ | ||
ConnectToLobby(); | ||
EditorUtility.SetDirty(target); | ||
} | ||
|
||
|
||
if (GUILayout.Button("Join Room")) | ||
{ | ||
ConnectToRoom(); | ||
EditorUtility.SetDirty(target); | ||
} | ||
|
||
|
||
if (GUILayout.Button("Exit Room")) | ||
{ | ||
DisconnectFromRoom(); | ||
EditorUtility.SetDirty(target); | ||
} | ||
|
||
|
||
if (GUILayout.Button("Disconnect")) | ||
{ | ||
Disconnect(); | ||
EditorUtility.SetDirty(target); | ||
} | ||
|
||
if (GUILayout.Button("Refresh Room List")) | ||
{ | ||
CheckIfRoomExists(); | ||
EditorUtility.SetDirty(target); | ||
} | ||
|
||
//Local Player Id | ||
string localPlayerId = ""; | ||
if (multiplayerManager.m_LocalPlayer != null) localPlayerId = multiplayerManager.m_LocalPlayer.PlayerId.ToString(); | ||
else localPlayerId = "Not Assigned"; | ||
|
||
GUILayout.Space(10); | ||
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); | ||
EditorGUILayout.BeginHorizontal(); | ||
GUILayout.Label("Local Player ID: ", EditorStyles.boldLabel); | ||
EditorGUILayout.LabelField($"{localPlayerId}"); | ||
EditorGUILayout.EndHorizontal(); | ||
|
||
//Room Ownership | ||
string ownership = ""; | ||
if (multiplayerManager != null && multiplayerManager.IsUserRoomOwner()) ownership = "Yes"; | ||
else if (multiplayerManager != null && !multiplayerManager.IsUserRoomOwner()) ownership = "No"; | ||
else ownership = "Not Assigned"; | ||
|
||
EditorGUILayout.BeginHorizontal(); | ||
GUILayout.Label("Is Local Player Room Owner:", EditorStyles.boldLabel); | ||
EditorGUILayout.LabelField($"{ownership}"); | ||
EditorGUILayout.EndHorizontal(); | ||
|
||
//Remote Users | ||
string remoteUsersRegistered = ""; | ||
if (multiplayerManager.m_RemotePlayers != null && multiplayerManager.m_RemotePlayers.Count > 0) | ||
{ | ||
remoteUsersRegistered = "UserIds:[ "; | ||
foreach (var remotePlayer in multiplayerManager.m_RemotePlayers) | ||
{ | ||
remoteUsersRegistered += remotePlayer.PlayerId.ToString() + ","; | ||
} | ||
remoteUsersRegistered += "]"; | ||
} | ||
else remoteUsersRegistered = "Not Assigned"; | ||
|
||
//Registered remote players | ||
|
||
EditorGUILayout.BeginHorizontal(); | ||
GUILayout.Label("Registered Remote Players IDs:", EditorStyles.boldLabel); | ||
EditorGUILayout.LabelField($"{remoteUsersRegistered}"); | ||
EditorGUILayout.EndHorizontal(); | ||
|
||
// Display and edit Nickname | ||
GUILayout.Space(10); | ||
EditorGUILayout.LabelField("Nickname", GUI.skin.horizontalSlider); | ||
string currentNickname = multiplayerManager.UserInfo.Nickname; | ||
GUILayout.Label("Nickname", EditorStyles.boldLabel); | ||
string newNickname = EditorGUILayout.TextField("Edit Nickname", currentNickname); | ||
if (newNickname != currentNickname) | ||
{ | ||
ConnectionUserInfo updatedUserInfo = multiplayerManager.UserInfo; | ||
updatedUserInfo.Nickname = newNickname; | ||
multiplayerManager.UserInfo = updatedUserInfo; | ||
EditorUtility.SetDirty(target); // Mark the target as dirty to apply changes | ||
} | ||
|
||
|
||
Repaint(); | ||
|
||
} | ||
|
||
private async void ConnectToLobby() | ||
{ | ||
if (multiplayerManager != null) | ||
{ | ||
bool success = await multiplayerManager.Connect(); | ||
} | ||
} | ||
|
||
private async void ConnectToRoom() | ||
{ | ||
if (multiplayerManager != null) | ||
{ | ||
RoomCreateData roomData = new RoomCreateData | ||
{ | ||
roomName = roomName, | ||
@private = isPrivate, | ||
maxPlayers = maxPlayers, | ||
voiceDisabled = voiceDisabled | ||
}; | ||
|
||
bool success = await multiplayerManager.JoinRoom(roomData); | ||
|
||
} | ||
} | ||
|
||
private async void DisconnectFromRoom() | ||
{ | ||
if (multiplayerManager != null) | ||
{ | ||
bool success = await multiplayerManager.LeaveRoom(); | ||
|
||
} | ||
} | ||
|
||
private async void Disconnect() | ||
{ | ||
if (multiplayerManager != null) | ||
{ | ||
bool success = await multiplayerManager.Disconnect(); | ||
|
||
} | ||
} | ||
|
||
private void CheckIfRoomExists() | ||
{ | ||
if (multiplayerManager != null) | ||
{ | ||
bool roomExists = multiplayerManager.DoesRoomNameExist(roomName); | ||
} | ||
} | ||
} | ||
#endif |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.