|
1 | 1 | using System;
|
2 |
| -using System.Collections; |
3 |
| -using System.Collections.Generic; |
4 |
| -using Unity.Multiplayer.Samples.BossRoom; |
5 | 2 | using Unity.Multiplayer.Samples.BossRoom.Shared.Infrastructure;
|
6 |
| -using Unity.Multiplayer.Samples.BossRoom.Visual; |
7 | 3 | using UnityEngine;
|
8 | 4 |
|
9 |
| -public class ConnectionStatusMessageUIManager : MonoBehaviour |
| 5 | +namespace Unity.Multiplayer.Samples.BossRoom.Visual |
10 | 6 | {
|
11 |
| - |
12 |
| - IDisposable m_Subscriptions; |
13 |
| - |
14 |
| - [Inject] |
15 |
| - void InjectDependencies(ISubscriber<ConnectStatus> connectStatusSub) |
| 7 | + public class ConnectionStatusMessageUIManager : MonoBehaviour |
16 | 8 | {
|
17 |
| - m_Subscriptions = connectStatusSub.Subscribe(OnConnectStatus); |
18 |
| - } |
| 9 | + IDisposable m_Subscriptions; |
19 | 10 |
|
20 |
| - void Awake() |
21 |
| - { |
22 |
| - DontDestroyOnLoad(gameObject); |
23 |
| - } |
| 11 | + [Inject] |
| 12 | + void InjectDependencies(ISubscriber<ConnectStatus> connectStatusSub) |
| 13 | + { |
| 14 | + m_Subscriptions = connectStatusSub.Subscribe(OnConnectStatus); |
| 15 | + } |
24 | 16 |
|
25 |
| - void OnDestroy() |
26 |
| - { |
27 |
| - m_Subscriptions?.Dispose(); |
28 |
| - } |
| 17 | + void Awake() |
| 18 | + { |
| 19 | + DontDestroyOnLoad(gameObject); |
| 20 | + } |
29 | 21 |
|
30 |
| - void OnConnectStatus(ConnectStatus status) |
31 |
| - { |
32 |
| - switch (status) |
| 22 | + void OnDestroy() |
| 23 | + { |
| 24 | + m_Subscriptions?.Dispose(); |
| 25 | + } |
| 26 | + |
| 27 | + void OnConnectStatus(ConnectStatus status) |
33 | 28 | {
|
34 |
| - case ConnectStatus.Undefined: |
35 |
| - case ConnectStatus.UserRequestedDisconnect: |
36 |
| - break; |
37 |
| - case ConnectStatus.ServerFull: |
38 |
| - PopupPanel.ShowPopupPanel("Connection Failed", "The Host is full and cannot accept any additional connections."); |
39 |
| - break; |
40 |
| - case ConnectStatus.Success: |
41 |
| - break; |
42 |
| - case ConnectStatus.LoggedInAgain: |
43 |
| - PopupPanel.ShowPopupPanel("Connection Failed", "You have logged in elsewhere using the same account."); |
44 |
| - break; |
45 |
| - case ConnectStatus.GenericDisconnect: |
46 |
| - PopupPanel.ShowPopupPanel("Disconnected From Host", "The connection to the host was lost"); |
47 |
| - break; |
48 |
| - default: |
49 |
| - Debug.LogWarning($"New ConnectStatus {status} has been added, but no connect message defined for it."); |
50 |
| - break; |
| 29 | + switch (status) |
| 30 | + { |
| 31 | + case ConnectStatus.Undefined: |
| 32 | + case ConnectStatus.UserRequestedDisconnect: |
| 33 | + break; |
| 34 | + case ConnectStatus.ServerFull: |
| 35 | + PopupPanel.ShowPopupPanel("Connection Failed", "The Host is full and cannot accept any additional connections."); |
| 36 | + break; |
| 37 | + case ConnectStatus.Success: |
| 38 | + break; |
| 39 | + case ConnectStatus.LoggedInAgain: |
| 40 | + PopupPanel.ShowPopupPanel("Connection Failed", "You have logged in elsewhere using the same account."); |
| 41 | + break; |
| 42 | + case ConnectStatus.GenericDisconnect: |
| 43 | + PopupPanel.ShowPopupPanel("Disconnected From Host", "The connection to the host was lost"); |
| 44 | + break; |
| 45 | + default: |
| 46 | + Debug.LogWarning($"New ConnectStatus {status} has been added, but no connect message defined for it."); |
| 47 | + break; |
| 48 | + } |
51 | 49 | }
|
52 | 50 | }
|
53 | 51 | }
|
0 commit comments