]> Dogcows Code - chaz/carfire/blob - CarFire/CarFire/CarFire/ScreenManager.cs
git-svn-id: https://bd85.net/svn/cs3505_group@168 92bb83a3-7c8f-8a45-bc97-515c4e399668
[chaz/carfire] / CarFire / CarFire / CarFire / ScreenManager.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 CarFire
14 {
15 public class ScreenManager : IScreenManager
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 ScreenManager()
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, NetworkManager networkManager)
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, NetworkManager networkManager)
164 {
165 availableSessions = sessions;
166 }
167
168 /// <summary>
169 /// Catches exceptions for and Async calls
170 /// </summary>
171 void AsyncCallbackFailed(Exception exception, NetworkManager networkManager)
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, NetworkManager networkManager)
181 {
182 List<ChatInfo> chts = networkManager.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, NetworkManager networkManager)
201 {
202
203 UpdateSpotLight(gameTime);
204 currentKeyboardState = Keyboard.GetState();
205
206 if (networkManager.HasActiveSession)
207 {
208 players = networkManager.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 (networkManager.HasActiveSession)
237 {
238 players = null;
239 networkManager.LeaveSession();
240 }
241 }
242 if (currentKeyboardState.IsKeyDown(Keys.Y) && previousKeyboardState.IsKeyUp(Keys.Y))
243 {
244 currentState = lobbyState.JoiningGame;
245 networkManager.ErrorDelegate = AsyncCallbackFailed;
246 networkManager.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 networkManager.ErrorDelegate = AsyncCallbackFailed;
258 networkManager.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))
273 {
274 networkManager.JoinSession(availableSessions[0], JoinedSession);
275 currentState = lobbyState.JoiningGame;
276
277 availableSessions.Dispose();
278 availableSessions = null;
279 }
280 if (currentKeyboardState.IsKeyDown(Keys.D2) && previousKeyboardState.IsKeyUp(Keys.D2))
281 {
282 networkManager.JoinSession(availableSessions[0], JoinedSession);
283 currentState = lobbyState.JoiningGame;
284
285 availableSessions.Dispose();
286 availableSessions = null;
287 }
288 }
289
290 break;
291
292 case lobbyState.Connected:
293 if (chatActive) //If chat is activated by pressing T all inputs go to chat. Enter finishes chat esc returns
294 {
295 if (currentKeyboardState.IsKeyDown(Keys.Escape) && previousKeyboardState.IsKeyUp(Keys.Escape))
296 {
297 chatActive = false;
298 break;
299 }
300 if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))
301 {
302 networkManager.SendChat(chatMessage);
303 chatActive = false;
304 break;
305 }
306 Keys[] k = currentKeyboardState.GetPressedKeys();
307 Keys[] kp = previousKeyboardState.GetPressedKeys();
308 List<Keys> newKeys = new List<Keys>();
309
310 for (int x = 0; x < k.Count(); x++) //copy new keys into array
311 {
312 if (!kp.Contains(k[x]))
313 {
314 newKeys.Add(k[x]);
315 }
316 }
317
318 foreach(Keys ky in newKeys)
319 {
320 if (ky.Equals(Keys.Back))
321 chatMessage = chatMessage.Substring(0, chatMessage.Length-1);
322 else if(ky.Equals(Keys.Space))
323 chatMessage = chatMessage + " ";
324 else
325 chatMessage = chatMessage + ky.ToString();
326 }
327
328 }
329 else //normal op mode
330 {
331 UpdateChat(gameTime, networkManager);
332 chatMessage = "";
333 if (currentKeyboardState.IsKeyDown(Keys.T) && previousKeyboardState.IsKeyUp(Keys.T))
334 {
335 chatActive = true;
336 }
337 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))
338 {
339 ready = false;
340 currentChat.Clear();
341 if (networkManager.HasActiveSession)
342 {
343 players = null;
344 networkManager.LeaveSession();
345 }
346 currentState = lobbyState.Welcome;
347
348 }
349 if (currentKeyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R))
350 networkManager.LocalGamer.IsReady = true;
351
352 if (networkManager.HasActiveSession)
353 {
354 localPlayer = networkManager.LocalGamer;
355 players = networkManager.NetworkGamers;
356 if (players != null)
357 {
358 allReady = true;
359 foreach (NetworkGamer p in players)
360 if (p.IsReady == false)
361 {
362 allReady = false;
363 break;
364 }
365 }
366
367 //allows host to start the game when all players are ready, change count below to different number for testing with less then 4 players
368 if (allReady && players.Count <= 4 && localPlayer == players[0])
369 {
370 if (currentKeyboardState.IsKeyDown(Keys.B) && previousKeyboardState.IsKeyUp(Keys.B))
371 {
372 networkManager.ForceStartGame();
373 }
374 }
375 }
376 else
377 currentState = lobbyState.Welcome;
378 }
379 break;
380
381 }
382 previousKeyboardState = Keyboard.GetState();
383
384 return 1;
385 }
386
387 /// <summary>
388 /// Draws the lobby GUI. Has different states for difference menu configurations
389 /// </summary>
390 public long Draw(SpriteBatch spriteBatch)
391 {
392 spriteBatch.Draw(background, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0);
393 spriteBatch.Draw(cs, csPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0);
394 spriteBatch.Draw(spotLight, spotLightPos, null, Color.White, 0, spotLightCenter, 1f, SpriteEffects.None, 0);
395
396 switch (currentState)
397 {
398 case lobbyState.Welcome:
399 spriteBatch.DrawString(menuFont, "press [ Home ] to login", new Vector2(350, 20), Color.LightGray, 0f, zero, .6f, SpriteEffects.None, 0.5f);
400 if (selected == createGameText)
401 spriteBatch.DrawString(menuFont, createGameText, createGamePos, Color.Red, 0, zero, 1f, SpriteEffects.None, 0.5f);
402 else
403 spriteBatch.DrawString(menuFont, createGameText, createGamePos, Color.Gray, 0, zero, 1f,SpriteEffects.None, 0.5f);
404 if (selected == findGameText)
405 spriteBatch.DrawString(menuFont, findGameText, findGamePos, Color.Red, 0, zero, 1f, SpriteEffects.None, 0.5f);
406 else
407 spriteBatch.DrawString(menuFont, findGameText, findGamePos, Color.Gray, 0, zero, 1f, SpriteEffects.None, 0.5f);
408 break;
409
410 case lobbyState.CreateGame:
411 DrawPlayerList(spriteBatch);
412 spriteBatch.DrawString(menuFont, "You are now the Host!", new Vector2(MaxX / 2, MaxY / 3), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
413 spriteBatch.DrawString(menuFont, "press: Y to continue", new Vector2(MaxX /2, (MaxY / 3) + menuFont.LineSpacing), Color.White, 0f, zero, .6f, SpriteEffects.None, 0.5f);
414 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);
415
416 break;
417
418 case lobbyState.FindingGames:
419 spriteBatch.Draw(selectGameScreen, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0);
420 spriteBatch.DrawString(menuFont, "select game by pressing listed games index", new Vector2(250, 400), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);
421 if(availableSessions == null)
422 spriteBatch.DrawString(menuFont, "searching for available games ....", new Vector2(150, 100), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);
423 else if (availableSessions.Count == 0)
424 spriteBatch.DrawString(menuFont, "no games currently available, searching ....", new Vector2(150, 100), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);
425 else
426 {
427 for (int sessionIndex = 0; sessionIndex < availableSessions.Count; sessionIndex++)
428 {
429 Color color = Color.Gray;
430
431 if (sessionIndex == selectedSessionIndex)
432 color = Color.Red;
433
434 spriteBatch.DrawString(menuFont, sessionIndex+1 + " " + availableSessions[sessionIndex].HostGamertag, new Vector2(150, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f);
435 spriteBatch.DrawString(menuFont, availableSessions[sessionIndex].CurrentGamerCount + " / 4",
436 new Vector2(450, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f);
437 }
438 }
439 break;
440
441 case lobbyState.Connected:
442 DrawPlayerList(spriteBatch);
443 DrawChatInfo(spriteBatch);
444 if(allReady && players.Count <= 4 && localPlayer == players[0])
445 spriteBatch.DrawString(menuFont, "Press B to begin game!", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
446 else if(allReady)
447 spriteBatch.DrawString(menuFont, "The game will begin soon.", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
448 else
449 spriteBatch.DrawString(menuFont, "Waiting for ready players...", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
450 break;
451 }
452
453 return 1;
454 }
455
456 /// <summary>
457 /// Updates backgound animation with moving spotlight. Spotlight bounces off walls
458 /// </summary>
459 private void UpdateSpotLight(GameTime gameTime)
460 {
461 spotLightPos = new Vector2(spotLightPos.X + spotLightVelocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds,
462 spotLightPos.Y + spotLightVelocity.Y * (float)gameTime.ElapsedGameTime.TotalSeconds);
463
464 if (spotLightPos.X > MaxX || spotLightPos.X < MinX) //right or left wall
465 {
466 spotLightVelocity = new Vector2(spotLightVelocity.X * -1, spotLightVelocity.Y);
467 }
468 else if (spotLightPos.Y > MaxY || spotLightPos.Y < MinY) //top or bottom wall
469 {
470 spotLightVelocity = new Vector2(spotLightVelocity.X, spotLightVelocity.Y * -1);
471 }
472 }
473
474 /// <summary>
475 /// Draws the list of current chat messages received by the local client.
476 /// </summary>
477 private void DrawChatInfo(SpriteBatch spriteBatch)
478 {
479 if (currentChat.Count > 0)
480 {
481 for (int y = 0; y < currentChat.Count; y++)
482 {
483 spriteBatch.DrawString(menuFont, currentChat.ElementAt(y).Sender + ": " + currentChat.ElementAt(y).Message
484 , new Vector2(400, 10 + y*15), Color.Blue, 0f, zero, .6f, SpriteEffects.None, 1f);
485 }
486
487 }
488 if(chatActive)
489 spriteBatch.DrawString(menuFont, chatMessage, new Vector2(400, 10 + 15*(currentChat.Count + 1)), Color.Green, 0f, zero, .6f, SpriteEffects.None, 1f);
490 }
491
492 /// <summary>
493 /// Draws player list objects for the connected state.
494 /// </summary>
495 private void DrawPlayerList(SpriteBatch spriteBatch)
496 {
497
498 //reference point
499 Vector2 topOfList = new Vector2(MaxX / 8, MaxY / 4);
500
501 //command info
502 spriteBatch.DrawString(menuFont, "Current Players", new Vector2(topOfList.X + 15, topOfList.Y - 25), Color.White);
503 spriteBatch.DrawString(menuFont, "Command Options: to mark your self as ready", new Vector2(20, 20), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
504 spriteBatch.DrawString(menuFont, "type players # to toggle chat", new Vector2(175, 40), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
505 spriteBatch.DrawString(menuFont, "return to main menu", new Vector2(175, 80), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
506 spriteBatch.DrawString(menuFont, "enter chat mode", new Vector2(175, 60), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
507 spriteBatch.DrawString(menuFont, "R", new Vector2(145, 20), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
508 spriteBatch.DrawString(menuFont, "#", new Vector2(145, 40), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
509 spriteBatch.DrawString(menuFont, "X", new Vector2(145, 80), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
510 spriteBatch.DrawString(menuFont, "T", new Vector2(145, 60), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
511
512 //Background squares
513 spriteBatch.Draw(menuItem, topOfList, null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
514 spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 65), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
515 spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 130), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
516 spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 195), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
517
518 //Ready Labels
519 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
520 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
521 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
522 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
523
524 //Ready CheckBoxs
525 if (players == null)
526 {
527 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
528 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
529 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
530 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
531 }
532 else
533 {
534 if (!(players.Count >= 1 && players[0].IsReady))
535 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
536 else
537 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
538 if (!(players.Count >= 2 && players[1].IsReady))
539 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
540 else
541 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
542 if (!(players.Count >= 3 && players[2].IsReady))
543 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
544 else
545 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
546 if (!(players.Count >= 4 && players[3].IsReady))
547 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
548 else
549 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
550 }
551
552 //Chat Labels
553 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
554 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
555 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
556 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
557
558 //Chat CheckBoxs
559 Boolean chatwith = true; // change to reflect info from network, move to update and create one for each player
560 if (!chatwith)
561 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X +218, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
562 else
563 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
564
565 if (!chatwith)
566 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
567 else
568 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
569
570 if (!chatwith)
571 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
572 else
573 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
574
575 if (!chatwith)
576 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
577 else
578 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
579
580
581 //draw player names
582 if (players != null)
583 {
584 for (int g = 0; g < players.Count; g++)
585 {
586 spriteBatch.DrawString(menuFont, players[g].Gamertag, new Vector2(topOfList.X + 10, topOfList.Y + 10 + 65*g), Color.White, 0f, zero, .75f, SpriteEffects.None, 1f);
587 }
588 }
589 }
590 }
591 }
This page took 0.06311 seconds and 4 git commands to generate.