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

Feature/switch different landscape #13

Merged
merged 52 commits into from
Oct 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
1e480cd
modify coverage setting
mahaweilu Sep 18, 2023
5d3c06f
modify asset build/load path setting
mahaweilu Sep 18, 2023
06ead04
add feature: switch image/video stage
mahaweilu Sep 18, 2023
5e75659
add feature: modify to download imgae
mahaweilu Sep 18, 2023
7422a67
add feature: host can switch spaces
mahaweilu Sep 19, 2023
20b83a9
add virtual space into build setting
mahaweilu Sep 19, 2023
a68be90
update extreal libraries
mahaweilu Sep 19, 2023
2643fb0
modify: host can switch spaces
mahaweilu Sep 19, 2023
d59ff59
refactoring
mahaweilu Sep 19, 2023
f849e19
modify: host and client switch space
mahaweilu Sep 19, 2023
cf6f0bf
add catch exception, modify build setting etc
mahaweilu Sep 19, 2023
89c3f9c
delete unused asset group
mahaweilu Sep 19, 2023
e4a7d64
modify scene name
mahaweilu Sep 19, 2023
b8a518d
fix coverage setting
mahaweilu Sep 19, 2023
697d3f4
fix coverage setting
mahaweilu Sep 19, 2023
8fff9bf
delete unused landscape type
mahaweilu Sep 20, 2023
bbbd5ce
modify landscape message
mahaweilu Sep 20, 2023
091d864
delete unnecessary space StageName
mahaweilu Sep 20, 2023
bef592b
delete unnecessary override method
mahaweilu Sep 20, 2023
e554ecc
move DoPlayAsync after Play
mahaweilu Sep 20, 2023
a833f4c
reorder argments
mahaweilu Sep 20, 2023
ae672d7
delete unnecessary space
mahaweilu Sep 20, 2023
4c361dc
Fix stretch time out
sasuke9410 Sep 20, 2023
797aebd
typescript ngo version up
mahaweilu Sep 20, 2023
3104c16
delete unnecessary { }
mahaweilu Sep 20, 2023
7daea02
delete unnecessary space
mahaweilu Sep 20, 2023
19bfb0a
delete unncessary override method
mahaweilu Sep 20, 2023
b8dc2ef
Update extreal modules
sasuke9410 Sep 20, 2023
736ee0e
Merge branch 'feature/switch-different-landscape' of https://github.c…
sasuke9410 Sep 20, 2023
0009f12
Update extreal modules
sasuke9410 Sep 21, 2023
86478d1
modify switchSpace
mahaweilu Sep 21, 2023
de50e93
move space intialized code
mahaweilu Sep 21, 2023
1db2a80
Update extreal modules
sasuke9410 Sep 26, 2023
c1a0b48
update yarn.lock because package.json
mahaweilu Sep 26, 2023
701779e
Update extreal modules
sasuke9410 Sep 27, 2023
8db0843
Merge branch 'feature/switch-different-landscape' of https://github.c…
mahaweilu Sep 28, 2023
cffda15
delete unnecessary fields and space
mahaweilu Sep 28, 2023
f7a0636
delete unnecessary import
mahaweilu Sep 28, 2023
e27a004
add readme webgl
mahaweilu Sep 28, 2023
b5534b1
make createAsync no async method
mahaweilu Sep 28, 2023
427e475
refactoring
mahaweilu Sep 28, 2023
29e3e57
modify because CreateAsync->Create change
mahaweilu Sep 28, 2023
5c682b9
change dropdown list size
mahaweilu Sep 28, 2023
91a81ca
modify namespace
mahaweilu Sep 28, 2023
94dd2ec
delete unused assetname field
mahaweilu Sep 28, 2023
d88f914
delete unncessary request error logic
mahaweilu Sep 29, 2023
4109c12
delete unnecessary logger
mahaweilu Sep 29, 2023
b5525b2
modify webgl readme
mahaweilu Sep 29, 2023
21b6a00
add holiday readme
mahaweilu Sep 29, 2023
97e4d0d
mote initial space to SpaceControl
mahaweilu Sep 29, 2023
3aae019
move initial space to SpaceControl
mahaweilu Sep 29, 2023
5de6299
fix readme
mahaweilu Oct 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ Servers/AppUsage/.data
# WebGL
Assets/WebGLScripts~/node_modules
WebGLBuild/Holiday/*
WebGLBuild/PanoramicData/Panorama/
kiyohome marked this conversation as resolved.
Show resolved Hide resolved
WebGLBuild/Data/*
Assets/WebGLTemplates/Holiday/index.js
Assets/WebGLTemplates/Holiday/index.js.meta
7 changes: 3 additions & 4 deletions Assets/AddressableAssetsData/AddressableAssetSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ MonoBehaviour:
m_DefaultGroup: f2b2967d531f20348b75f02e0528aacd
m_currentHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
Hash: 9e3aeab7e3ad3cb4a0628f9608695942
m_OptimizeCatalogSize: 0
m_BuildRemoteCatalog: 1
m_BundleLocalCatalog: 0
Expand Down Expand Up @@ -46,7 +46,6 @@ MonoBehaviour:
m_GroupAssets:
- {fileID: 11400000, guid: d57c51f5be2793546828e3518fc49122, type: 2}
- {fileID: 11400000, guid: a103d381e22f4cb4c8c8ee4801c6ebaf, type: 2}
- {fileID: 11400000, guid: 5ed5c3f447c830a4eb4cf3b808b10549, type: 2}
- {fileID: 11400000, guid: 7b2ad813c3811e540927b4ed7827ba8b, type: 2}
m_BuildSettings:
m_CompileScriptsInVirtualMode: 0
Expand Down Expand Up @@ -161,11 +160,11 @@ MonoBehaviour:
m_Key: HostingServiceUploadSpeed
- m_AssemblyName: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
m_ClassName: System.String
m_Data: WebGLBuild/Data/assets/0.1.0/StandaloneWindows64
m_Data: WebGLBuild/Data/assets/0.1.0/WebGL
m_Key: ContentRoot
- m_AssemblyName: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
m_ClassName: System.Boolean
m_Data: True
m_Data: False
m_Key: IsEnabled
- m_AssemblyName: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
m_ClassName: System.String
Expand Down
20 changes: 15 additions & 5 deletions Assets/AddressableAssetsData/AssetGroups/AppCommon.asset
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ MonoBehaviour:
m_SerializedData: []
m_GUID: f2b2967d531f20348b75f02e0528aacd
m_SerializeEntries:
- m_GUID: c6ae014bfb0f10d45a7451f05c0c220b
m_Address: AvatarArmature
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: 5dd0a9896b950494ca1303948d70b252
m_Address: MessageConfig
m_ReadOnly: 0
Expand All @@ -47,6 +42,21 @@ MonoBehaviour:
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: c6ae014bfb0f10d45a7451f05c0c220b
m_Address: AvatarArmature
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: d2d735dc7a9b2a04aaac4b867f92ca5d
m_Address: LandscapeConfig
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
- m_GUID: dac329d0652cea1478e0d98a0696f88d
m_Address: SpaceConfig
m_ReadOnly: 0
m_SerializedLabels: []
FlaggedDuringContentUpdateRestriction: 0
m_ReadOnly: 0
m_Settings: {fileID: 11400000, guid: 70324997c374a0844916ed3e0c6c273b, type: 2}
m_SchemaSet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ MonoBehaviour:
m_RedirectLimit: -1
m_RetryCount: 0
m_BuildPath:
m_Id: 2ff51ae6a25533741a6db0e46a3dd5a4
m_Id: bfd6bf59170f8934dae7ab70a80c51a0
m_LoadPath:
m_Id: 6cc7f50c87664584ba7690908e9d1bd0
m_Id: b265ebd845b3b074c829603b1d1f6854
m_BundleMode: 0
m_AssetBundleProviderType:
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ MonoBehaviour:
m_RedirectLimit: -1
m_RetryCount: 0
m_BuildPath:
m_Id: 2ff51ae6a25533741a6db0e46a3dd5a4
m_Id: bfd6bf59170f8934dae7ab70a80c51a0
m_LoadPath:
m_Id: 6cc7f50c87664584ba7690908e9d1bd0
m_Id: b265ebd845b3b074c829603b1d1f6854
m_BundleMode: 0
m_AssetBundleProviderType:
m_AssemblyName: Unity.ResourceManager, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
Expand Down

This file was deleted.

29 changes: 0 additions & 29 deletions Assets/AddressableAssetsData/AssetGroups/VirtualSpace.asset

This file was deleted.

61 changes: 46 additions & 15 deletions Assets/Holiday/App/AppState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Extreal.SampleApp.Holiday.Controls.RetryStatusControl;
using Extreal.SampleApp.Holiday.Screens.ConfirmationScreen;
using UniRx;
using Message = Extreal.SampleApp.Holiday.App.P2P.Message;

namespace Extreal.SampleApp.Holiday.App
{
Expand All @@ -20,6 +21,7 @@ public class AppState : DisposableBase

public string PlayerName { get; private set; } = "Guest";
public AvatarConfig.Avatar Avatar { get; private set; }
public SpaceConfig.Space Space { get; private set; }
public bool IsHost => role == PeerRole.Host;
public bool IsClient => role == PeerRole.Client;
public string GroupName { get; private set; } // Host only
Expand All @@ -35,6 +37,12 @@ public class AppState : DisposableBase
public IReadOnlyReactiveProperty<bool> P2PReady => p2PReady.AddTo(disposables);
private readonly ReactiveProperty<bool> p2PReady = new ReactiveProperty<bool>(false);

public IObservable<Message> OnMessageSent => onMessageSent.AddTo(disposables);
private readonly Subject<Message> onMessageSent = new Subject<Message>();

public IObservable<Message> OnMessageReceived => onMessageReceived.AddTo(disposables);
private readonly Subject<Message> onMessageReceived = new Subject<Message>();

public IObservable<string> OnNotificationReceived => onNotificationReceived.AddTo(disposables);
private readonly Subject<string> onNotificationReceived = new Subject<string>();

Expand All @@ -45,6 +53,7 @@ public class AppState : DisposableBase
private readonly Subject<RetryStatus> onRetryStatusReceived = new Subject<RetryStatus>();

private readonly BoolReactiveProperty multiplayReady = new BoolReactiveProperty(false);
private readonly BoolReactiveProperty landscapeInitialized = new BoolReactiveProperty(false);

private readonly CompositeDisposable disposables = new CompositeDisposable();

Expand All @@ -53,16 +62,20 @@ public class AppState : DisposableBase
public AppState()
{
multiplayReady.AddTo(disposables);
landscapeInitialized.AddTo(disposables);

MonitorPlayingReadyStatus();
RestorePlayingReadyStatus();
}

[SuppressMessage("Usage", "CC0033")]
private void MonitorPlayingReadyStatus() =>
Observable.
CombineLatest(multiplayReady, spaceReady, p2PReady)
.Where(readies => readies.All(ready => ready))
multiplayReady.Merge(spaceReady, p2PReady, landscapeInitialized)
.Where(_ =>
{
LogWaitingStatus();
return multiplayReady.Value && spaceReady.Value && p2PReady.Value && landscapeInitialized.Value;
})
.Subscribe(_ =>
{
if (Logger.IsDebug())
Expand All @@ -75,30 +88,48 @@ public AppState()

[SuppressMessage("Usage", "CC0033")]
private void RestorePlayingReadyStatus() =>
Observable
.CombineLatest(multiplayReady, spaceReady, p2PReady)
.Where(readies => readies.All(ready => !ready))
.Subscribe(_ =>
{
if (Logger.IsDebug())
{
Logger.LogDebug("Stop playing");
}
playingReady.Value = false;
})
.AddTo(disposables);
spaceReady.Merge(landscapeInitialized)
.Where(_ =>
{
LogWaitingStatus();
return !spaceReady.Value && !landscapeInitialized.Value;
})
.Subscribe(_ =>
{
if (Logger.IsDebug())
{
Logger.LogDebug("Stop playing");
}
playingReady.Value = false;
})
.AddTo(disposables);

private void LogWaitingStatus()
{
if (Logger.IsDebug())
{
Logger.LogDebug($"Multiplay, Space Ready, P2P Ready, Landscape Initialized: " +
$"{multiplayReady.Value}, {spaceReady.Value}, {p2PReady.Value}, {landscapeInitialized.Value}");
}
}

public void SetPlayerName(string playerName) => PlayerName = playerName;
public void SetAvatar(AvatarConfig.Avatar avatar) => Avatar = avatar;
public void SetSpace(SpaceConfig.Space space) => Space = space;
public void SetRole(PeerRole role) => this.role = role;
public void SetGroupName(string groupName) => GroupName = groupName;
public void SetGroupId(string groupId) => GroupId = groupId;
public void SetSpaceName(string spaceName) => SpaceName = spaceName;
public void SetP2PReady(bool ready) => p2PReady.Value = ready;
public void SetMultiplayReady(bool ready) => multiplayReady.Value = ready;
public void SetSpaceReady(bool ready) => spaceReady.Value = ready;
public void SetLandscapeInitialized(bool initialized) => landscapeInitialized.Value = initialized;
public void SetStage(StageName stageName) => StageState = new StageState(stageName);

public void SendMessage(Message message) => onMessageSent.OnNext(message);

public void ReceivedMessage(Message message) => onMessageReceived.OnNext(message);

public void Notify(string message)
{
Logger.LogError(message);
Expand Down
9 changes: 8 additions & 1 deletion Assets/Holiday/App/AppUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static bool IsTouchDevice()
=> false;
#endif

private static readonly HashSet<StageName> SpaceStages = new HashSet<StageName> { StageName.VirtualStage };
private static readonly HashSet<StageName> SpaceStages = new HashSet<StageName> { StageName.VirtualStage, StageName.PanoramicVideoStage, StageName.PanoramicImageStage };

public static bool IsSpace(StageName stageName) => SpaceStages.Contains(stageName);

Expand Down Expand Up @@ -47,6 +47,13 @@ public static void NotifyRetried(AppState appState, bool result, string successM
}
}

public static string ConcatUrl(string baseUrl, string relativePath)
{
baseUrl = baseUrl.TrimEnd('/');
relativePath = relativePath.TrimStart('/');
return $"{baseUrl}/{relativePath}";
}

public static long ToMb(long bytes) => bytes >> 20;
}
}
5 changes: 5 additions & 0 deletions Assets/Holiday/App/AssetWorkflow/AssetHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ public class AssetHelper : DisposableBase

public VoiceChatConfig VoiceChatConfig { get; private set; }

public SpaceConfig SpaceConfig { get; private set; }
public LandscapeConfig LandscapeConfig { get; private set; }

private static readonly ELogger Logger = LoggingManager.GetLogger(nameof(AssetHelper));

private readonly StageNavigator<StageName, SceneName> stageNavigator;
Expand All @@ -56,11 +59,13 @@ public void DownloadCommonAssetAsync(StageName nextStage)
MessageConfig = await LoadAndAddToDisposablesAsync<MessageConfig>();
PeerConfig = await LoadAndReleaseAsync<P2PConfig, PeerConfig>(asset => asset.PeerConfig);
AvatarConfig = await LoadAndAddToDisposablesAsync<AvatarConfig>();
SpaceConfig = await LoadAndAddToDisposablesAsync<SpaceConfig>();
(NgoHostConfig, NgoClientConfig)
= await LoadAndReleaseAsync<MultiplayConfig, (HostConfig, ClientConfig)>(
asset => (asset.HostConfig, asset.ClientConfig));
VoiceChatConfig = await LoadAndReleaseAsync<ChatConfig, VoiceChatConfig>(
asset => asset.VoiceChatConfig);
LandscapeConfig = await LoadAndAddToDisposablesAsync<LandscapeConfig>();
stageNavigator.ReplaceAsync(nextStage).Forget();
};
DownloadAsync(nameof(MessageConfig), nextFunc).Forget();
Expand Down
2 changes: 1 addition & 1 deletion Assets/Holiday/App/Config/AppConfig.asset
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
verticalSyncs: 0
targetFrameRate: 60
downloadTimeoutSeconds: 10
downloadTimeoutSeconds: 60
downloadMaxRetryCount: 5
downloadConnectRetryMessage: 'Reconnect for download : {0}'
downloadRetrySuccessMessage: Successfully reconnected for download.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ MonoBehaviour:
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5834b5087d578d24c926ce20cd31e6d6, type: 3}
m_Name: VirtualSpace_ContentUpdateGroupSchema
m_Script: {fileID: 11500000, guid: de095b56920b482458a182e93f616a58, type: 3}
m_Name: LandscapeConfig
m_EditorClassIdentifier:
m_Group: {fileID: 11400000, guid: 5ed5c3f447c830a4eb4cf3b808b10549, type: 2}
m_StaticContent: 0
baseUrl: http://localhost:3333/Panorama/

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions Assets/Holiday/App/Config/LandscapeConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using UnityEngine;

namespace Extreal.SampleApp.Holiday.App.Config
{
[CreateAssetMenu(
menuName = nameof(Holiday) + "/" + nameof(LandscapeConfig),
fileName = nameof(LandscapeConfig))]
public class LandscapeConfig : ScriptableObject
{
[SerializeField] private string baseUrl;

public string BaseUrl => baseUrl;
}
}