OnConnectionFailSignal
How do I use On Connection Fail Signal
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
File name: NetworkAdapter.cs
Copy
138 private void Awake()
139 {
140 OnBeginConnectingSignal = new Signal();
141 OnConnectedToMasterSignal = new Signal();
142 OnDisconnectedFromMasterSignal = new Signal();
143 OnConnectionFailSignal = new Signal
144 OnJoinedRoomSignal = new Signal();
145 OnAllPlayersConnectedSignal = new Signal();
146 OnRemoteBoardChangeSignal = new Signal
147 OnNewGameStartedSignal = new Signal();
148
149 ServiceLocator.AddService
150 }
File name: NetworkAdapter.cs
Copy
167 private void OnFailToConnectToPhoton()
168 {
169 OnConnectionFailSignal.Dispatch("Connection failed doe to invalid AppId or some network issues");
170 }
File name: NetworkAdapter.cs
Copy
172 private void OnConnectionFail(DisconnectCause cause)
173 {
174 OnConnectionFailSignal.Dispatch("Connection failed doe to " + cause);
175 }
File name: Connecting.cs
Copy
28 protected override void Start()
29 {
30 base.Start();
31
32 NetworkService.OnBeginConnectingSignal.AddListener(Show);
33 NetworkService.OnConnectedToMasterSignal.AddListener(OnConnectedToMaster);
34 NetworkService.OnConnectionFailSignal.AddListener(OnConnectionFail);
35 }
File name: Connecting.cs
Copy
37 protected override void OnDestroy()
38 {
39 base.OnDestroy();
40
41 NetworkService.OnBeginConnectingSignal.RemoveListener(Show);
42 NetworkService.OnConnectedToMasterSignal.RemoveListener(OnConnectedToMaster);
43 NetworkService.OnConnectionFailSignal.RemoveListener(OnConnectionFail);
44 }
OnConnectionFailSignal 136 lượt xem
Gõ tìm kiếm nhanh...