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