Skip to content

Commit 8f44725

Browse files
feat: adding RNSM (Runtime Network Stats Monitor) to boss room [MTT-3267] (#621)
1 parent 962899c commit 8f44725

13 files changed

+462
-5
lines changed

Assets/BossRoom/Scenes/Startup.unity

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:bba284a7fe5e87da844044eb1292e927ff9cc7762c9fa55a892c7ecde64d26f6
3-
size 44788
2+
oid sha256:57ebb73c6fac9cb948a60578d22c0c76ac8980c78e51e261e867c06eeb10013e
3+
size 46492
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using UnityEngine;
3+
4+
namespace Unity.Multiplayer.Samples.Utilities
5+
{
6+
public class DontDestroyOnLoad : MonoBehaviour
7+
{
8+
void Awake()
9+
{
10+
DontDestroyOnLoad(gameObject);
11+
}
12+
}
13+
}

Packages/com.unity.multiplayer.samples.coop/Utilities/DontDestroyOnLoad.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Packages/com.unity.multiplayer.samples.coop/Utilities/Net/RNSM.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System.Collections;
2+
using UnityEngine;
3+
4+
namespace Unity.Multiplayer.Samples.Utilities
5+
{
6+
public class AutoHide : MonoBehaviour
7+
{
8+
[SerializeField]
9+
float m_TimeToHideSeconds = 5f;
10+
11+
// Start is called before the first frame update
12+
void Start()
13+
{
14+
StartCoroutine(HideAfterSeconds());
15+
}
16+
17+
IEnumerator HideAfterSeconds()
18+
{
19+
yield return new WaitForSeconds(m_TimeToHideSeconds);
20+
gameObject.SetActive(false);
21+
}
22+
}
23+
}

Packages/com.unity.multiplayer.samples.coop/Utilities/Net/RNSM/AutoHide.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using Unity.Multiplayer.Tools.NetStatsMonitor;
2+
using UnityEngine;
3+
4+
namespace Unity.Multiplayer.Samples.Utilities
5+
{
6+
public class NetStatsMonitorCustomization : MonoBehaviour
7+
{
8+
[SerializeField]
9+
RuntimeNetStatsMonitor m_Monitor;
10+
11+
const int k_NbTouchesToOpenWindow = 3;
12+
13+
void Start()
14+
{
15+
m_Monitor.enabled = false;
16+
}
17+
18+
void Update()
19+
{
20+
if (Input.GetKeyUp(KeyCode.S) || Input.touchCount == k_NbTouchesToOpenWindow && AnyTouchDown())
21+
{
22+
m_Monitor.enabled = !m_Monitor.enabled; // toggle
23+
}
24+
}
25+
26+
static bool AnyTouchDown()
27+
{
28+
foreach (var touch in Input.touches)
29+
{
30+
if (touch.phase == TouchPhase.Began)
31+
{
32+
return true;
33+
}
34+
}
35+
36+
return false;
37+
}
38+
}
39+
}

Packages/com.unity.multiplayer.samples.coop/Utilities/Net/RNSM/NetStatsMonitorCustomization.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)