Skip to content

Commit

Permalink
refactor: Change the access modifier for sample code to hide APIs fro…
Browse files Browse the repository at this point in the history
…m documents (#644)
  • Loading branch information
karasusan authored Feb 16, 2022
1 parent 3f3d4ff commit af5af72
Show file tree
Hide file tree
Showing 15 changed files with 26 additions and 52 deletions.
4 changes: 2 additions & 2 deletions RenderStreaming~/ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace Unity.RenderStreaming.Editor
{
[CustomPropertyDrawer(typeof(StreamingSizeAttribute))]
public class StreamingSizeDrawer : PropertyDrawer
class StreamingSizeDrawer : PropertyDrawer
{
readonly GUIContent[] streamingSizeText =
{
Expand Down
12 changes: 10 additions & 2 deletions com.unity.renderstreaming/Runtime/Scripts/RemoteInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ enum GamepadKeyCode {
Axis1
}

public static class RemoteInputReceiver
internal static class RemoteInputReceiver
{
private static readonly Dictionary<RemoteInput, uint> s_mapRemoteInputAndInputUserId;
private static readonly List<RemoteInput> s_listRemoteInput;
Expand Down Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Unity.RenderStreaming.Samples
#endif
[Preserve]
[DisplayStringFormat("{button}+{delta}")]
public class DeltaWithButton : InputBindingComposite<Vector2>
class DeltaWithButton : InputBindingComposite<Vector2>
{
#if UNITY_EDITOR
static DeltaWithButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Unity.RenderStreaming.Samples
{
public class SimpleCameraControllerV2 : MonoBehaviour
class SimpleCameraControllerV2 : MonoBehaviour
{
class CameraState
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Unity.RenderStreaming.Samples
{
public class Multiplay : SignalingHandlerBase,
class Multiplay : SignalingHandlerBase,
IOfferHandler, IAddChannelHandler, IDisconnectHandler, IDeletedConnectionHandler
{
[SerializeField] GameObject prefab;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Unity.RenderStreaming.Samples
{
public enum ActionType
enum ActionType
{
ChangeLabel = 0,
}
Expand All @@ -20,12 +20,12 @@ class Message
///
/// </summary>
[Serializable]
public class ChangeLabelEvent : UnityEvent<string> {};
class ChangeLabelEvent : UnityEvent<string> {};

/// <summary>
///
/// </summary>
public class MultiplayChannel : DataChannelBase
class MultiplayChannel : DataChannelBase
{
public ChangeLabelEvent OnChangeLabel;

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Unity.RenderStreaming.Samples
{
public class PlayerController : MonoBehaviour
class PlayerController : MonoBehaviour
{
[SerializeField] GameObject player;
[SerializeField] GameObject cameraPivot;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using UnityEngine.UI;
using UnityEngine.InputSystem;

namespace Unity.RenderStreaming
namespace Unity.RenderStreaming.Samples
{
[RequireComponent(typeof(RectTransform))]
public class UIController : MonoBehaviour
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Mouse>();
RemoteKeyboard = Keyboard.current != null ? Keyboard.current : UnityInputSystem.AddDevice<Keyboard>();
RemoteTouchscreen = Touchscreen.current != null ? Touchscreen.current : UnityInputSystem.AddDevice<Touchscreen>();
RemoteGamepad = Gamepad.current != null ? Gamepad.current : UnityInputSystem.AddDevice<Gamepad>();
}

public void MakeCurrent()
{
RemoteMouse.MakeCurrent();
RemoteKeyboard.MakeCurrent();
RemoteTouchscreen.MakeCurrent();
RemoteGamepad.MakeCurrent();
}
}

static class TouchScreenExtension
{
Expand All @@ -54,7 +24,7 @@ public static IEnumerable<EnhancedTouch> GetTouches(this Touchscreen screen)
}

[RequireComponent(typeof(InputChannelReceiverBase))]
public class SimpleCameraController : MonoBehaviour
class SimpleCameraController : MonoBehaviour
{
class CameraState
{
Expand Down

0 comments on commit af5af72

Please sign in to comment.