Removes
How do I use Removes
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
154 |
ServiceLocator.RemoveService |
1 |
122 |
ServiceLocator.RemoveService |
2 |
24 | static void RemoveScrollBars() | 3 |
206 | RemoveScrollBars(); | 4 |
File name: NetworkAdapter.cs
Copy
152 private void OnDestroy()
153 {
154 ServiceLocator.RemoveService
155 }
File name: Game.cs
Copy
114 protected override void OnDestroy()
115 {
116 base.OnDestroy();
117
118 NetworkService.OnAllPlayersConnectedSignal.RemoveListener(OnAllPlayersConnected);
119 NetworkService.OnDisconnectedFromMasterSignal.RemoveListener(OnDisconnectedFromMaster);
120 NetworkService.OnRemoteBoardChangeSignal.RemoveListener(OnRemoteBoardChange);
121
122 ServiceLocator.RemoveService
123 }
File name: Program.cs
Copy
24 static void RemoveScrollBars()
25 {
26 Console.ForegroundColor = ConsoleColor.Yellow;
27 Console.BufferHeight = Console.WindowHeight;
28 Console.BufferWidth = Console.WindowWidth;
29 }
File name: Program.cs
Copy
204 static void Main(string[] args)
205 {
206 RemoveScrollBars();
207 SetInitialPositions();
208 while (true)
209 {
210 if (Console.KeyAvailable)
211 {
212 ConsoleKeyInfo keyInfo = Console.ReadKey();
213 if (keyInfo.Key == ConsoleKey.UpArrow)
214 {
215 MoveFirstPlayerUp();
216 }
217 if (keyInfo.Key == ConsoleKey.DownArrow)
218 {
219 MoveFirstPlayerDown();
220 }
221 }
222 SecondPlayerAIMove();
223 MoveBall();
224 Console.Clear();
225 DrawFirstPlayer();
226 DrawSecondPlayer();
227 DrawBall();
228 PrintResult();
229 Thread.Sleep(60);
230 }
231 }
Removes 158 lượt xem
Gõ tìm kiếm nhanh...