]> Dogcows Code - chaz/carfire/blob - Project06/CS 3505 Project 06/CS 3505 Project 06/LobbyGUI.cs
74bc9a7d4305b8f06430f3c70a5469e87aa6eec8
[chaz/carfire] / Project06 / CS 3505 Project 06 / CS 3505 Project 06 / LobbyGUI.cs
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using Microsoft.Xna.Framework.Net;
6 using System.Diagnostics;
7 using Microsoft.Xna.Framework.GamerServices;
8 using Microsoft.Xna.Framework.Graphics;
9 using Microsoft.Xna.Framework;
10 using Microsoft.Xna.Framework.Input;
11 using Microsoft.Xna.Framework.Content;
12
13 namespace CS_3505_Project_06
14 {
15 public class lobbyGUI : ILobby
16 {
17 #region local variables
18 float scale;
19
20 Texture2D background;
21 Texture2D spotLight;
22 Texture2D cs;
23 Texture2D selectGameScreen;
24
25 Vector2 backgroundPos;
26 Vector2 spotLightPos;
27 Vector2 spotLightCenter;
28 Vector2 csPos;
29
30 Vector2 zero;
31 Vector2 spotLightVelocity;
32
33 int MaxX;
34 int MinX;
35 int MaxY;
36 int MinY;
37
38 Texture2D checkedBox;
39 Texture2D deselectBox;
40 Texture2D emptySelectBox;
41 Texture2D menuItem;
42
43 Boolean ready;
44
45 SpriteFont menuFont;
46 string selected;
47 Vector2 createGamePos;
48 string createGameText;
49 Vector2 findGamePos;
50 string findGameText;
51
52 Vector2 returnToMainPos;
53 string returnToMainText;
54
55 KeyboardState previousKeyboardState;
56 KeyboardState currentKeyboardState;
57
58 GamerCollection<NetworkGamer> players;
59 LocalNetworkGamer localPlayer;
60 AvailableNetworkSessionCollection availableSessions;
61 bool allReady;
62
63 int selectedSessionIndex;
64
65 bool chatActive;
66 String chatMessage;
67 Queue<ChatInfo> currentChat;
68
69
70
71 private enum lobbyState
72 {
73 Welcome,
74 CreateGame,
75 FindGame,
76 FindingGames, // TODO: New state.
77 JoiningGame, // TODO: New state.
78 Connected
79 }
80
81 lobbyState currentState;
82 #endregion
83
84 public lobbyGUI()
85 {
86 currentState = lobbyState.Welcome;
87 selectedSessionIndex = 0;
88 ready = false;
89 chatActive = false;
90 chatMessage = "";
91 currentChat = new Queue<ChatInfo>();
92 }
93
94 public void LoadContent(ContentManager contentManager, GraphicsDeviceManager graphics)
95 {
96 background = contentManager.Load<Texture2D>("background");
97 spotLight = contentManager.Load<Texture2D>("spotlight");
98 cs = contentManager.Load<Texture2D>("cs");
99 selectGameScreen = contentManager.Load<Texture2D>("selectGameScreen");
100 backgroundPos = new Vector2(0f, 0f);
101 spotLightPos = new Vector2(100f, graphics.GraphicsDevice.Viewport.Height - 98);
102 spotLightCenter = new Vector2(800f, 800f);
103 spotLightVelocity = new Vector2(-100, 33);
104 csPos = new Vector2(10f, graphics.GraphicsDevice.Viewport.Height - 98);
105
106 zero = new Vector2(0, 0);
107
108 MaxX = graphics.GraphicsDevice.Viewport.Width;
109 MinX = 0;
110 MaxY = graphics.GraphicsDevice.Viewport.Height;
111 MinY = 100;
112
113 scale = MaxX / 1600f;
114
115 //playerlist stuff
116 checkedBox = contentManager.Load<Texture2D>("checkedBox");
117 deselectBox = contentManager.Load<Texture2D>("deselectBox");
118 emptySelectBox = contentManager.Load<Texture2D>("emptySelectBox");
119 menuItem = contentManager.Load<Texture2D>("menuItem");
120
121
122
123 //menu fonts
124 menuFont = contentManager.Load<SpriteFont>("menuFont");
125 createGamePos = new Vector2(100f, MaxY / 3);
126 createGameText = "Create Game";
127 selected = createGameText;
128
129 findGamePos = new Vector2(100f, (MaxY / 3) + 60);
130 findGameText = "Find Game";
131
132 returnToMainPos = new Vector2(MaxX / 2, MaxY - 120);
133 returnToMainText = "press [ X ] to return to main menu";
134
135
136 }
137
138 public void UnloadContent()
139 {
140
141 }
142
143 /// <summary>
144 /// Transition into connected state
145 /// </summary>
146 void JoinedSession(NetworkSession session, NetworkGame networkGame)
147 {
148 if (session != null)
149 {
150 currentState = lobbyState.Connected;
151 }
152 else
153 {
154 // TODO: This should do something more than just throw the player back to the welcome screen.
155 currentState = lobbyState.Welcome;
156 Console.WriteLine("Couldn't create/join the session.");
157 }
158 }
159
160 /// <summary>
161 /// Called when Async FindSession returns. Available sessions is then updated
162 /// </summary>
163 void FoundSessions(AvailableNetworkSessionCollection sessions, NetworkGame networkGame)
164 {
165 availableSessions = sessions;
166 }
167
168 /// <summary>
169 /// Catches exceptions for and Async calls
170 /// </summary>
171 void AsyncCallbackFailed(Exception exception, NetworkGame networkGame)
172 {
173 currentState = lobbyState.Welcome;
174 Console.WriteLine("Exception as thrown during async call: " + exception.Message);
175 }
176
177 /// <summary>
178 /// Adds and new chats to the chat list. If chat list is full, older messages are removed.
179 /// </summary>
180 private void UpdateChat(GameTime gameTime, NetworkGame networkGame)
181 {
182 List<ChatInfo> chts = networkGame.ReceiveChats();
183 for (int x = 0; x < chts.Count(); x++)
184 currentChat.Enqueue(chts[x]);
185
186 //if number of chat messages has reached max remove older messages as new ones are added
187 if (currentChat.Count() > 8)
188 {
189 for (int x = 0; x < chts.Count(); x++)
190 {
191 currentChat.Dequeue();
192 }
193 }
194
195 }
196
197 /// <summary>
198 /// Main update call for Lobby, what is actually updated is determined by what the current state is.
199 /// </summary>
200 public long Update(GameTime gameTime, NetworkGame networkGame)
201 {
202
203 UpdateSpotLight(gameTime);
204 currentKeyboardState = Keyboard.GetState();
205
206 if (networkGame.HasActiveSession)
207 {
208 players = networkGame.NetworkGamers;
209 }
210
211 //check inputs
212 switch (currentState)
213 {
214 case lobbyState.Welcome:
215 if (selected == createGameText)
216 {
217 if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))
218 currentState = lobbyState.CreateGame;
219 if (currentKeyboardState.IsKeyDown(Keys.Down))
220 selected = findGameText;
221 }
222 else
223 {
224 if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))
225 currentState = lobbyState.FindGame;
226 if (currentKeyboardState.IsKeyDown(Keys.Up))
227 selected = createGameText;
228 }
229 break;
230
231 case lobbyState.CreateGame:
232 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))
233 {
234 currentState = lobbyState.Welcome;
235 ready = false;
236 if (networkGame.HasActiveSession)
237 {
238 players = null;
239 networkGame.LeaveSession();
240 }
241 }
242 if (currentKeyboardState.IsKeyDown(Keys.Y) && previousKeyboardState.IsKeyUp(Keys.Y))
243 {
244 currentState = lobbyState.JoiningGame;
245 networkGame.ErrorDelegate = AsyncCallbackFailed;
246 networkGame.CreateSession(JoinedSession);
247 }
248 break;
249
250 case lobbyState.FindGame:
251 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))
252 {
253 currentState = lobbyState.Welcome;
254 ready = false;
255 }
256 availableSessions = null;
257 networkGame.ErrorDelegate = AsyncCallbackFailed;
258 networkGame.FindSessions(FoundSessions);
259 currentState = lobbyState.FindingGames;
260 break;
261
262 case lobbyState.FindingGames:
263 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))
264 {
265 currentState = lobbyState.Welcome;
266 ready = false;
267 }
268 if (availableSessions != null && availableSessions.Count == 0)
269 currentState = lobbyState.FindGame;
270 else if (availableSessions != null && availableSessions.Count > 0)
271 {
272 if (currentKeyboardState.IsKeyDown(Keys.D1) && previousKeyboardState.IsKeyUp(Keys.D1) && availableSessions.Count > 0)
273 {
274 networkGame.JoinSession(availableSessions[0], JoinedSession);
275 }
276 else if (currentKeyboardState.IsKeyDown(Keys.D2) && previousKeyboardState.IsKeyUp(Keys.D2) && availableSessions.Count > 1)
277 {
278 networkGame.JoinSession(availableSessions[1], JoinedSession);
279 }
280 else if (currentKeyboardState.IsKeyDown(Keys.D3) && previousKeyboardState.IsKeyUp(Keys.D3) && availableSessions.Count > 2)
281 {
282 networkGame.JoinSession(availableSessions[2], JoinedSession);
283 }
284 else if (currentKeyboardState.IsKeyDown(Keys.D4) && previousKeyboardState.IsKeyUp(Keys.D4) && availableSessions.Count > 3)
285 {
286 networkGame.JoinSession(availableSessions[3], JoinedSession);
287 }
288
289 currentState = lobbyState.JoiningGame;
290
291 availableSessions.Dispose();
292 availableSessions = null;
293 }
294
295 break;
296
297 case lobbyState.Connected:
298 if (chatActive) //If chat is activated by pressing T all inputs go to chat. Enter finishes chat esc returns
299 {
300 if (currentKeyboardState.IsKeyDown(Keys.Escape) && previousKeyboardState.IsKeyUp(Keys.Escape))
301 {
302 chatActive = false;
303 break;
304 }
305 if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))
306 {
307 networkGame.SendChat(chatMessage);
308 chatActive = false;
309 break;
310 }
311 Keys[] k = currentKeyboardState.GetPressedKeys();
312 Keys[] kp = previousKeyboardState.GetPressedKeys();
313 List<Keys> newKeys = new List<Keys>();
314
315 for (int x = 0; x < k.Count(); x++) //copy new keys into array
316 {
317 if (!kp.Contains(k[x]))
318 {
319 newKeys.Add(k[x]);
320 }
321 }
322
323 foreach(Keys ky in newKeys)
324 {
325 if (ky.Equals(Keys.Back))
326 chatMessage = chatMessage.Substring(0, chatMessage.Length-1);
327 else if(ky.Equals(Keys.Space))
328 chatMessage = chatMessage + " ";
329 else
330 chatMessage = chatMessage + ky.ToString();
331 }
332
333 }
334 else //normal op mode
335 {
336 UpdateChat(gameTime, networkGame);
337 chatMessage = "";
338 if (currentKeyboardState.IsKeyDown(Keys.T) && previousKeyboardState.IsKeyUp(Keys.T))
339 {
340 chatActive = true;
341 }
342 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))
343 {
344 ready = false;
345 currentChat.Clear();
346 if (networkGame.HasActiveSession)
347 {
348 players = null;
349 networkGame.LeaveSession();
350 }
351 currentState = lobbyState.Welcome;
352
353 }
354 if (currentKeyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R))
355 networkGame.LocalGamer.IsReady = true;
356
357 if (networkGame.HasActiveSession)
358 {
359 localPlayer = networkGame.LocalGamer;
360 players = networkGame.NetworkGamers;
361 if (players != null)
362 {
363 allReady = true;
364 foreach (NetworkGamer p in players)
365 if (p.IsReady == false)
366 {
367 allReady = false;
368 break;
369 }
370 }
371
372 //allows host to start the game when all players are ready, change count below to different number for testing with less then 4 players
373 if (allReady && players.Count == 4 && localPlayer == players[0])
374 {
375 if (currentKeyboardState.IsKeyDown(Keys.B) && previousKeyboardState.IsKeyUp(Keys.B))
376 {
377 networkGame.ForceStartGame();
378 }
379 }
380 }
381 else
382 currentState = lobbyState.Welcome;
383 }
384 break;
385
386 }
387 previousKeyboardState = Keyboard.GetState();
388
389 return 1;
390 }
391
392 /// <summary>
393 /// Draws the lobby GUI. Has different states for difference menu configurations
394 /// </summary>
395 public long Draw(SpriteBatch spriteBatch)
396 {
397 spriteBatch.Draw(background, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0);
398 spriteBatch.Draw(cs, csPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0);
399 spriteBatch.Draw(spotLight, spotLightPos, null, Color.White, 0, spotLightCenter, 1f, SpriteEffects.None, 0);
400
401 switch (currentState)
402 {
403 case lobbyState.Welcome:
404 spriteBatch.DrawString(menuFont, "press [ Home ] to login", new Vector2(350, 20), Color.LightGray, 0f, zero, .6f, SpriteEffects.None, 0.5f);
405 if (selected == createGameText)
406 spriteBatch.DrawString(menuFont, createGameText, createGamePos, Color.Red, 0, zero, 1f, SpriteEffects.None, 0.5f);
407 else
408 spriteBatch.DrawString(menuFont, createGameText, createGamePos, Color.Gray, 0, zero, 1f,SpriteEffects.None, 0.5f);
409 if (selected == findGameText)
410 spriteBatch.DrawString(menuFont, findGameText, findGamePos, Color.Red, 0, zero, 1f, SpriteEffects.None, 0.5f);
411 else
412 spriteBatch.DrawString(menuFont, findGameText, findGamePos, Color.Gray, 0, zero, 1f, SpriteEffects.None, 0.5f);
413 break;
414
415 case lobbyState.CreateGame:
416 DrawPlayerList(spriteBatch);
417 spriteBatch.DrawString(menuFont, "You are now the Host!", new Vector2(MaxX / 2, MaxY / 3), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
418 spriteBatch.DrawString(menuFont, "press: Y to continue", new Vector2(MaxX /2, (MaxY / 3) + menuFont.LineSpacing), Color.White, 0f, zero, .6f, SpriteEffects.None, 0.5f);
419 spriteBatch.DrawString(menuFont, "X to return to main menu", new Vector2(MaxX /2 + 40, (MaxY / 3) + 2 * menuFont.LineSpacing), Color.White, 0f, zero, .6f, SpriteEffects.None, 0.5f);
420
421 break;
422
423 case lobbyState.FindingGames:
424 spriteBatch.Draw(selectGameScreen, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0);
425 spriteBatch.DrawString(menuFont, "select game by pressing listed games index", new Vector2(250, 400), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);
426 if(availableSessions == null)
427 spriteBatch.DrawString(menuFont, "searching for available games ....", new Vector2(150, 100), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);
428 else if (availableSessions.Count == 0)
429 spriteBatch.DrawString(menuFont, "no games currently available, searching ....", new Vector2(150, 100), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);
430 else
431 {
432 for (int sessionIndex = 0; sessionIndex < availableSessions.Count; sessionIndex++)
433 {
434 Color color = Color.Gray;
435
436 if (sessionIndex == selectedSessionIndex)
437 color = Color.Red;
438
439 spriteBatch.DrawString(menuFont, sessionIndex+1 + " " + availableSessions[sessionIndex].HostGamertag, new Vector2(150, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f);
440 spriteBatch.DrawString(menuFont, availableSessions[sessionIndex].CurrentGamerCount + " / 4",
441 new Vector2(450, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f);
442 }
443 }
444 break;
445
446 case lobbyState.Connected:
447 DrawPlayerList(spriteBatch);
448 DrawChatInfo(spriteBatch);
449 if(allReady && players.Count == 2 && localPlayer == players[0])
450 spriteBatch.DrawString(menuFont, "Press B to begin game!", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
451 else if(allReady)
452 spriteBatch.DrawString(menuFont, "The game will begin soon.", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
453 else
454 spriteBatch.DrawString(menuFont, "Waiting for ready players...", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
455 break;
456 }
457
458 return 1;
459 }
460
461 /// <summary>
462 /// Updates backgound animation with moving spotlight. Spotlight bounces off walls
463 /// </summary>
464 private void UpdateSpotLight(GameTime gameTime)
465 {
466 spotLightPos = new Vector2(spotLightPos.X + spotLightVelocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds,
467 spotLightPos.Y + spotLightVelocity.Y * (float)gameTime.ElapsedGameTime.TotalSeconds);
468
469 if (spotLightPos.X > MaxX || spotLightPos.X < MinX) //right or left wall
470 {
471 spotLightVelocity = new Vector2(spotLightVelocity.X * -1, spotLightVelocity.Y);
472 }
473 else if (spotLightPos.Y > MaxY || spotLightPos.Y < MinY) //top or bottom wall
474 {
475 spotLightVelocity = new Vector2(spotLightVelocity.X, spotLightVelocity.Y * -1);
476 }
477 }
478
479 /// <summary>
480 /// Draws the list of current chat messages received by the local client.
481 /// </summary>
482 private void DrawChatInfo(SpriteBatch spriteBatch)
483 {
484 if (currentChat.Count > 0)
485 {
486 for (int y = 0; y < currentChat.Count; y++)
487 {
488 spriteBatch.DrawString(menuFont, currentChat.ElementAt(y).Sender + ": " + currentChat.ElementAt(y).Message
489 , new Vector2(400, 10 + y*15), Color.Blue, 0f, zero, .6f, SpriteEffects.None, 1f);
490 }
491
492 }
493 if(chatActive)
494 spriteBatch.DrawString(menuFont, chatMessage, new Vector2(400, 10 + 15*(currentChat.Count + 1)), Color.Green, 0f, zero, .6f, SpriteEffects.None, 1f);
495 }
496
497 /// <summary>
498 /// Draws player list objects for the connected state.
499 /// </summary>
500 private void DrawPlayerList(SpriteBatch spriteBatch)
501 {
502
503 //reference point
504 Vector2 topOfList = new Vector2(MaxX / 8, MaxY / 4);
505
506 //command info
507 spriteBatch.DrawString(menuFont, "Current Players", new Vector2(topOfList.X + 15, topOfList.Y - 25), Color.White);
508 spriteBatch.DrawString(menuFont, "Command Options: to mark your self as ready", new Vector2(20, 20), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
509 spriteBatch.DrawString(menuFont, "type players # to toggle chat", new Vector2(175, 40), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
510 spriteBatch.DrawString(menuFont, "return to main menu", new Vector2(175, 80), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
511 spriteBatch.DrawString(menuFont, "enter chat mode", new Vector2(175, 60), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
512 spriteBatch.DrawString(menuFont, "R", new Vector2(145, 20), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
513 spriteBatch.DrawString(menuFont, "#", new Vector2(145, 40), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
514 spriteBatch.DrawString(menuFont, "X", new Vector2(145, 80), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
515 spriteBatch.DrawString(menuFont, "T", new Vector2(145, 60), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
516
517 //Background squares
518 spriteBatch.Draw(menuItem, topOfList, null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
519 spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 65), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
520 spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 130), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
521 spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 195), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
522
523 //Ready Labels
524 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
525 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
526 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
527 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
528
529 //Ready CheckBoxs
530 if (players == null)
531 {
532 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
533 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
534 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
535 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
536 }
537 else
538 {
539 if (!(players.Count >= 1 && players[0].IsReady))
540 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
541 else
542 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
543 if (!(players.Count >= 2 && players[1].IsReady))
544 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
545 else
546 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
547 if (!(players.Count >= 3 && players[2].IsReady))
548 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
549 else
550 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
551 if (!(players.Count >= 4 && players[3].IsReady))
552 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
553 else
554 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
555 }
556
557 //Chat Labels
558 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
559 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
560 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
561 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
562
563 //Chat CheckBoxs
564 Boolean chatwith = true; // change to reflect info from network, move to update and create one for each player
565 if (!chatwith)
566 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X +218, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
567 else
568 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
569
570 if (!chatwith)
571 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
572 else
573 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
574
575 if (!chatwith)
576 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
577 else
578 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
579
580 if (!chatwith)
581 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
582 else
583 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
584
585
586 //draw player names
587 if (players != null)
588 {
589 for (int g = 0; g < players.Count; g++)
590 {
591 spriteBatch.DrawString(menuFont, players[g].Gamertag, new Vector2(topOfList.X + 10, topOfList.Y + 10 + 65*g), Color.White, 0f, zero, .75f, SpriteEffects.None, 1f);
592 }
593 }
594 }
595 }
596 }
This page took 0.061426 seconds and 3 git commands to generate.