-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Cho Kinken <mahaweilu@gmail.com> Co-authored-by: sus-yoshikane-t <yoshikane-t@m.sus-g.co.jp>
- Loading branch information
1 parent
6a052e7
commit bd0724f
Showing
95 changed files
with
1,696 additions
and
1,466 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
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
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,17 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 76bb3a6d466fc304aa61e96ddb7d4e17, type: 3} | ||
m_Name: MessagingConfig | ||
m_EditorClassIdentifier: | ||
messagingUrl: http://localhost:3030 | ||
timeoutSeconds: 3 | ||
maxCapacity: 100 |
2 changes: 1 addition & 1 deletion
2
...n/Multiplay/NetworkPrefabsList.asset.meta → ...day/App/Config/MessagingConfig.asset.meta
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Extreal.Integration.Messaging.Redis; | ||
using SocketIOClient; | ||
using UnityEngine; | ||
|
||
namespace Extreal.SampleApp.Holiday.App.Config | ||
{ | ||
[CreateAssetMenu( | ||
menuName = nameof(Holiday) + "/" + nameof(MessagingConfig), | ||
fileName = nameof(MessagingConfig))] | ||
public class MessagingConfig : ScriptableObject | ||
{ | ||
public RedisMessagingConfig RedisMessagingConfig | ||
=> new RedisMessagingConfig( | ||
messagingUrl, | ||
new SocketIOOptions | ||
{ | ||
ConnectionTimeout = TimeSpan.FromSeconds(timeoutSeconds), | ||
Reconnection = false, | ||
}); | ||
[SerializeField, SuppressMessage("Usage", "CC0052")] private string messagingUrl = "http://127.0.0.1:3030"; | ||
[SerializeField, SuppressMessage("Usage", "CC0052")] private int timeoutSeconds = 3; | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...ls/Common/Multiplay/NetworkString.cs.meta → ...oliday/App/Config/MessagingConfig.cs.meta
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,11 @@ | ||
using System; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Extreal.Core.Common.Retry; | ||
using Extreal.Integration.Multiplay.NGO; | ||
using UnityEngine; | ||
using UnityEngine; | ||
|
||
namespace Extreal.SampleApp.Holiday.App.Config | ||
{ | ||
[CreateAssetMenu( | ||
menuName = nameof(Holiday) + "/" + nameof(MultiplayConfig), | ||
fileName = nameof(MultiplayConfig))] | ||
public class MultiplayConfig : ScriptableObject | ||
public class MultiplayConfig : MessagingConfig | ||
{ | ||
[SerializeField, SuppressMessage("Usage", "CC0052")] private int hostMaxCapacity = 10; | ||
[SerializeField, SuppressMessage("Usage", "CC0052")] private int clientTimeoutSeconds = 5; | ||
[SerializeField, SuppressMessage("Usage", "CC0052")] private int clientMaxRetryCount = 3; | ||
|
||
public HostConfig HostConfig => new HostConfig(hostMaxCapacity); | ||
public ClientConfig ClientConfig => new ClientConfig(clientTimeoutSeconds, clientMaxRetryCount); | ||
} | ||
|
||
public class HostConfig | ||
{ | ||
public NgoConfig NgoConfig { get; private set; } | ||
public int MaxCapacity { get; private set; } | ||
public HostConfig(int maxCapacity) | ||
{ | ||
NgoConfig = new NgoConfig(); | ||
MaxCapacity = maxCapacity; | ||
} | ||
} | ||
|
||
public class ClientConfig | ||
{ | ||
public NgoConfig NgoConfig { get; private set; } | ||
public IRetryStrategy RetryStrategy { get; private set; } | ||
public ClientConfig(int timeoutSeconds, int maxRetryCount) | ||
{ | ||
NgoConfig = new NgoConfig(timeout: TimeSpan.FromSeconds(timeoutSeconds)); | ||
RetryStrategy = new CountingRetryStrategy(maxRetryCount); | ||
} | ||
} | ||
} |
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,6 @@ | ||
namespace Extreal.SampleApp.Holiday.App.P2P | ||
{ | ||
public interface IMessageContent | ||
{ | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...n/Multiplay/ClientNetworkAnimator.cs.meta → ...s/Holiday/App/P2P/IMessageContent.cs.meta
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,38 @@ | ||
using System; | ||
using Unity.Netcode; | ||
using System.Diagnostics.CodeAnalysis; | ||
using UnityEngine; | ||
|
||
namespace Extreal.SampleApp.Holiday.App.P2P | ||
{ | ||
public struct Message : INetworkSerializable | ||
[Serializable] | ||
public class Message : ISerializationCallbackReceiver | ||
{ | ||
public readonly MessageId MessageId => messageId; | ||
private MessageId messageId; | ||
public MessageId MessageId => messageId; | ||
[SerializeField, SuppressMessage("Usage", "CC0052")] private MessageId messageId; | ||
|
||
public readonly INetworkSerializable Content => content; | ||
private INetworkSerializable content; | ||
public IMessageContent Content { get; private set; } | ||
|
||
public Message(MessageId messageId, INetworkSerializable content) | ||
[SerializeField] private string contentType; | ||
[SerializeField] private string contentJson; | ||
|
||
public Message(MessageId messageId, IMessageContent content) | ||
{ | ||
this.messageId = messageId; | ||
this.content = content; | ||
Content = content; | ||
} | ||
|
||
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter | ||
public void OnAfterDeserialize() | ||
{ | ||
var contentType = serializer.IsWriter ? content.GetType().ToString() : default; | ||
serializer.SerializeValue(ref contentType); | ||
if (serializer.IsReader) | ||
if (!string.IsNullOrEmpty(contentType)) | ||
{ | ||
content = Activator.CreateInstance(Type.GetType(contentType)) as INetworkSerializable; | ||
Content = JsonUtility.FromJson(contentJson, Type.GetType(contentType)) as IMessageContent; | ||
} | ||
} | ||
|
||
serializer.SerializeValue(ref messageId); | ||
content.NetworkSerialize(serializer); | ||
public void OnBeforeSerialize() | ||
{ | ||
contentType = Content != null ? Content.GetType().ToString() : default; | ||
contentJson = JsonUtility.ToJson(Content); | ||
} | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -2,6 +2,8 @@ namespace Extreal.SampleApp.Holiday.App.P2P | |
{ | ||
public enum MessageId | ||
{ | ||
None, | ||
TextChat, | ||
SpaceTransition | ||
} | ||
} | ||
} |
Oops, something went wrong.