From af5af72890b22662c0c9ea56ec4686cb2599dbee Mon Sep 17 00:00:00 2001 From: Kazuki Matsumoto <1132081+karasusan@users.noreply.github.com> Date: Wed, 16 Feb 2022 11:37:23 +0900 Subject: [PATCH] refactor: Change the access modifier for sample code to hide APIs from documents (#644) --- .../ProjectSettings/ProjectVersion.txt | 4 +-- .../PropertyDrawers/StreamingSizeDrawer.cs | 2 +- .../Runtime/Scripts/RemoteInput.cs | 12 +++++-- .../Example/Broadcast/CustomEventSystem.cs | 2 +- .../Example/Broadcast/DeltaWithButton.cs | 2 +- .../Broadcast/SimpleCameraControllerV2.cs | 2 +- .../Example/Multiplay/FollowTransform.cs | 4 +-- .../Samples~/Example/Multiplay/Multiplay.cs | 2 +- .../Example/Multiplay/MultiplayChannel.cs | 6 ++-- .../Example/Multiplay/MultiplaySample.cs | 4 +-- .../Example/Multiplay/PlayerController.cs | 2 +- .../Example}/Scripts/UIController.cs | 2 +- .../Example}/Scripts/UIController.cs.meta | 0 .../SimpleCameraController.cs | 34 ++----------------- .../SimpleCameraController.cs.meta | 0 15 files changed, 26 insertions(+), 52 deletions(-) rename com.unity.renderstreaming/{Runtime => Samples~/Example}/Scripts/UIController.cs (99%) rename com.unity.renderstreaming/{Runtime => Samples~/Example}/Scripts/UIController.cs.meta (100%) rename com.unity.renderstreaming/{Runtime/Scripts => Samples~/Example/WebBrowserInput}/SimpleCameraController.cs (91%) rename com.unity.renderstreaming/{Runtime/Scripts => Samples~/Example/WebBrowserInput}/SimpleCameraController.cs.meta (100%) diff --git a/RenderStreaming~/ProjectSettings/ProjectVersion.txt b/RenderStreaming~/ProjectSettings/ProjectVersion.txt index ffab026f2..3598ae5db 100644 --- a/RenderStreaming~/ProjectSettings/ProjectVersion.txt +++ b/RenderStreaming~/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2020.3.27f1 -m_EditorVersionWithRevision: 2020.3.27f1 (e759542391ea) +m_EditorVersion: 2020.3.28f1 +m_EditorVersionWithRevision: 2020.3.28f1 (f5400f52e03f) diff --git a/com.unity.renderstreaming/Editor/PropertyDrawers/StreamingSizeDrawer.cs b/com.unity.renderstreaming/Editor/PropertyDrawers/StreamingSizeDrawer.cs index 80ed1e92c..0c251549d 100644 --- a/com.unity.renderstreaming/Editor/PropertyDrawers/StreamingSizeDrawer.cs +++ b/com.unity.renderstreaming/Editor/PropertyDrawers/StreamingSizeDrawer.cs @@ -4,7 +4,7 @@ namespace Unity.RenderStreaming.Editor { [CustomPropertyDrawer(typeof(StreamingSizeAttribute))] - public class StreamingSizeDrawer : PropertyDrawer + class StreamingSizeDrawer : PropertyDrawer { readonly GUIContent[] streamingSizeText = { diff --git a/com.unity.renderstreaming/Runtime/Scripts/RemoteInput.cs b/com.unity.renderstreaming/Runtime/Scripts/RemoteInput.cs index c7361cd67..3c081e6c2 100644 --- a/com.unity.renderstreaming/Runtime/Scripts/RemoteInput.cs +++ b/com.unity.renderstreaming/Runtime/Scripts/RemoteInput.cs @@ -54,7 +54,7 @@ enum GamepadKeyCode { Axis1 } - public static class RemoteInputReceiver + internal static class RemoteInputReceiver { private static readonly Dictionary s_mapRemoteInputAndInputUserId; private static readonly List s_listRemoteInput; @@ -113,7 +113,15 @@ internal static void Delete(RemoteInput remoteInput) } } - public class RemoteInput : IInput, IDisposable + public interface IInput + { + Mouse RemoteMouse { get; } + Keyboard RemoteKeyboard { get; } + Touchscreen RemoteTouchscreen { get; } + Gamepad RemoteGamepad { get; } + } + + internal class RemoteInput : IInput, IDisposable { private GamepadState m_gamepadState; diff --git a/com.unity.renderstreaming/Samples~/Example/Broadcast/CustomEventSystem.cs b/com.unity.renderstreaming/Samples~/Example/Broadcast/CustomEventSystem.cs index 1ed9cdb4a..f115606e6 100644 --- a/com.unity.renderstreaming/Samples~/Example/Broadcast/CustomEventSystem.cs +++ b/com.unity.renderstreaming/Samples~/Example/Broadcast/CustomEventSystem.cs @@ -6,7 +6,7 @@ namespace Unity.RenderStreaming.Samples { using InputSystem = UnityEngine.InputSystem.InputSystem; - public class CustomEventSystem : EventSystem + class CustomEventSystem : EventSystem { #if !INPUTSYSTEM_1_1_OR_NEWER protected override void Awake() diff --git a/com.unity.renderstreaming/Samples~/Example/Broadcast/DeltaWithButton.cs b/com.unity.renderstreaming/Samples~/Example/Broadcast/DeltaWithButton.cs index b4c704249..e03396b81 100644 --- a/com.unity.renderstreaming/Samples~/Example/Broadcast/DeltaWithButton.cs +++ b/com.unity.renderstreaming/Samples~/Example/Broadcast/DeltaWithButton.cs @@ -16,7 +16,7 @@ namespace Unity.RenderStreaming.Samples #endif [Preserve] [DisplayStringFormat("{button}+{delta}")] - public class DeltaWithButton : InputBindingComposite + class DeltaWithButton : InputBindingComposite { #if UNITY_EDITOR static DeltaWithButton() diff --git a/com.unity.renderstreaming/Samples~/Example/Broadcast/SimpleCameraControllerV2.cs b/com.unity.renderstreaming/Samples~/Example/Broadcast/SimpleCameraControllerV2.cs index 7d072a1c9..f9efc2db7 100644 --- a/com.unity.renderstreaming/Samples~/Example/Broadcast/SimpleCameraControllerV2.cs +++ b/com.unity.renderstreaming/Samples~/Example/Broadcast/SimpleCameraControllerV2.cs @@ -4,7 +4,7 @@ namespace Unity.RenderStreaming.Samples { - public class SimpleCameraControllerV2 : MonoBehaviour + class SimpleCameraControllerV2 : MonoBehaviour { class CameraState { diff --git a/com.unity.renderstreaming/Samples~/Example/Multiplay/FollowTransform.cs b/com.unity.renderstreaming/Samples~/Example/Multiplay/FollowTransform.cs index 0094e8975..61c6f333d 100644 --- a/com.unity.renderstreaming/Samples~/Example/Multiplay/FollowTransform.cs +++ b/com.unity.renderstreaming/Samples~/Example/Multiplay/FollowTransform.cs @@ -1,10 +1,8 @@ -using System.Linq; -using System.Collections.Generic; using UnityEngine; namespace Unity.RenderStreaming.Samples { - public class FollowTransform : MonoBehaviour + class FollowTransform : MonoBehaviour { [SerializeField] Transform target; [SerializeField] Vector3 offset; diff --git a/com.unity.renderstreaming/Samples~/Example/Multiplay/Multiplay.cs b/com.unity.renderstreaming/Samples~/Example/Multiplay/Multiplay.cs index 2253a5412..1e9f68ee4 100644 --- a/com.unity.renderstreaming/Samples~/Example/Multiplay/Multiplay.cs +++ b/com.unity.renderstreaming/Samples~/Example/Multiplay/Multiplay.cs @@ -4,7 +4,7 @@ namespace Unity.RenderStreaming.Samples { - public class Multiplay : SignalingHandlerBase, + class Multiplay : SignalingHandlerBase, IOfferHandler, IAddChannelHandler, IDisconnectHandler, IDeletedConnectionHandler { [SerializeField] GameObject prefab; diff --git a/com.unity.renderstreaming/Samples~/Example/Multiplay/MultiplayChannel.cs b/com.unity.renderstreaming/Samples~/Example/Multiplay/MultiplayChannel.cs index 47b5a7ce0..567129e83 100644 --- a/com.unity.renderstreaming/Samples~/Example/Multiplay/MultiplayChannel.cs +++ b/com.unity.renderstreaming/Samples~/Example/Multiplay/MultiplayChannel.cs @@ -4,7 +4,7 @@ namespace Unity.RenderStreaming.Samples { - public enum ActionType + enum ActionType { ChangeLabel = 0, } @@ -20,12 +20,12 @@ class Message /// /// [Serializable] - public class ChangeLabelEvent : UnityEvent {}; + class ChangeLabelEvent : UnityEvent {}; /// /// /// - public class MultiplayChannel : DataChannelBase + class MultiplayChannel : DataChannelBase { public ChangeLabelEvent OnChangeLabel; diff --git a/com.unity.renderstreaming/Samples~/Example/Multiplay/MultiplaySample.cs b/com.unity.renderstreaming/Samples~/Example/Multiplay/MultiplaySample.cs index f56614d2b..a472218f8 100644 --- a/com.unity.renderstreaming/Samples~/Example/Multiplay/MultiplaySample.cs +++ b/com.unity.renderstreaming/Samples~/Example/Multiplay/MultiplaySample.cs @@ -1,14 +1,12 @@ using System; using System.Collections; -using System.Collections.Generic; using System.Linq; using UnityEngine; using UnityEngine.UI; -using Unity.RenderStreaming.InputSystem; namespace Unity.RenderStreaming.Samples { - public class MultiplaySample : MonoBehaviour + class MultiplaySample : MonoBehaviour { [SerializeField] ToggleGroup toggleGroupRole; [SerializeField] InputField inputFieldUsername; diff --git a/com.unity.renderstreaming/Samples~/Example/Multiplay/PlayerController.cs b/com.unity.renderstreaming/Samples~/Example/Multiplay/PlayerController.cs index c38fa639b..e2021f7f9 100644 --- a/com.unity.renderstreaming/Samples~/Example/Multiplay/PlayerController.cs +++ b/com.unity.renderstreaming/Samples~/Example/Multiplay/PlayerController.cs @@ -4,7 +4,7 @@ namespace Unity.RenderStreaming.Samples { - public class PlayerController : MonoBehaviour + class PlayerController : MonoBehaviour { [SerializeField] GameObject player; [SerializeField] GameObject cameraPivot; diff --git a/com.unity.renderstreaming/Runtime/Scripts/UIController.cs b/com.unity.renderstreaming/Samples~/Example/Scripts/UIController.cs similarity index 99% rename from com.unity.renderstreaming/Runtime/Scripts/UIController.cs rename to com.unity.renderstreaming/Samples~/Example/Scripts/UIController.cs index 443856d6c..a0deabe2c 100644 --- a/com.unity.renderstreaming/Runtime/Scripts/UIController.cs +++ b/com.unity.renderstreaming/Samples~/Example/Scripts/UIController.cs @@ -3,7 +3,7 @@ using UnityEngine.UI; using UnityEngine.InputSystem; -namespace Unity.RenderStreaming +namespace Unity.RenderStreaming.Samples { [RequireComponent(typeof(RectTransform))] public class UIController : MonoBehaviour diff --git a/com.unity.renderstreaming/Runtime/Scripts/UIController.cs.meta b/com.unity.renderstreaming/Samples~/Example/Scripts/UIController.cs.meta similarity index 100% rename from com.unity.renderstreaming/Runtime/Scripts/UIController.cs.meta rename to com.unity.renderstreaming/Samples~/Example/Scripts/UIController.cs.meta diff --git a/com.unity.renderstreaming/Runtime/Scripts/SimpleCameraController.cs b/com.unity.renderstreaming/Samples~/Example/WebBrowserInput/SimpleCameraController.cs similarity index 91% rename from com.unity.renderstreaming/Runtime/Scripts/SimpleCameraController.cs rename to com.unity.renderstreaming/Samples~/Example/WebBrowserInput/SimpleCameraController.cs index ecb13031a..6f29524f2 100644 --- a/com.unity.renderstreaming/Runtime/Scripts/SimpleCameraController.cs +++ b/com.unity.renderstreaming/Samples~/Example/WebBrowserInput/SimpleCameraController.cs @@ -9,41 +9,11 @@ #if URS_USE_AR_SUBSYSTEMS using UnityEngine.XR.ARSubsystems; #endif -namespace Unity.RenderStreaming +namespace Unity.RenderStreaming.Samples { using UnityInputSystem = UnityEngine.InputSystem.InputSystem; - public interface IInput - { - Mouse RemoteMouse { get; } - Keyboard RemoteKeyboard { get; } - Touchscreen RemoteTouchscreen { get; } - Gamepad RemoteGamepad { get; } - } - - public class DefaultInput : IInput - { - public Mouse RemoteMouse { get; } - public Keyboard RemoteKeyboard { get; } - public Touchscreen RemoteTouchscreen { get; } - public Gamepad RemoteGamepad { get; } - - public DefaultInput() - { - RemoteMouse = Mouse.current != null ? Mouse.current : UnityInputSystem.AddDevice(); - RemoteKeyboard = Keyboard.current != null ? Keyboard.current : UnityInputSystem.AddDevice(); - RemoteTouchscreen = Touchscreen.current != null ? Touchscreen.current : UnityInputSystem.AddDevice(); - RemoteGamepad = Gamepad.current != null ? Gamepad.current : UnityInputSystem.AddDevice(); - } - public void MakeCurrent() - { - RemoteMouse.MakeCurrent(); - RemoteKeyboard.MakeCurrent(); - RemoteTouchscreen.MakeCurrent(); - RemoteGamepad.MakeCurrent(); - } - } static class TouchScreenExtension { @@ -54,7 +24,7 @@ public static IEnumerable GetTouches(this Touchscreen screen) } [RequireComponent(typeof(InputChannelReceiverBase))] - public class SimpleCameraController : MonoBehaviour + class SimpleCameraController : MonoBehaviour { class CameraState { diff --git a/com.unity.renderstreaming/Runtime/Scripts/SimpleCameraController.cs.meta b/com.unity.renderstreaming/Samples~/Example/WebBrowserInput/SimpleCameraController.cs.meta similarity index 100% rename from com.unity.renderstreaming/Runtime/Scripts/SimpleCameraController.cs.meta rename to com.unity.renderstreaming/Samples~/Example/WebBrowserInput/SimpleCameraController.cs.meta