]> Dogcows Code - chaz/carfire/blob - Project06/CS 3505 Project 06/CS 3505 Project 06/LobbyGUI.cs
Chat display finished and working pretty good.
[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
173 //if number of chat messages has reached max remove older messages as new ones are added
174 if (currentChat.Count() > 8)
175 {
176 for (int x = 0; x < chts.Count(); x++)
177 {
178 currentChat.Dequeue();
179 }
180 }
181
182 }
183
184 public long Update(GameTime gameTime, NetworkGame networkGame)
185 {
186
187 UpdateSpotLight(gameTime);
188 currentKeyboardState = Keyboard.GetState();
189
190 if (networkGame.HasActiveSession)
191 {
192 players = networkGame.NetworkGamers;
193 }
194
195 //check inputs
196 switch (currentState)
197 {
198 case lobbyState.Welcome:
199 if (selected == createGameText)
200 {
201 if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))
202 currentState = lobbyState.CreateGame;
203 if (currentKeyboardState.IsKeyDown(Keys.Down))
204 selected = findGameText;
205 }
206 else
207 {
208 if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))
209 currentState = lobbyState.FindGame;
210 if (currentKeyboardState.IsKeyDown(Keys.Up))
211 selected = createGameText;
212 }
213 break;
214
215 case lobbyState.CreateGame:
216 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))
217 {
218 currentState = lobbyState.Welcome;
219 ready = false;
220 if (networkGame.HasActiveSession)
221 {
222 players = null;
223 networkGame.LeaveSession();
224 }
225 }
226 if (currentKeyboardState.IsKeyDown(Keys.Y) && previousKeyboardState.IsKeyUp(Keys.Y))
227 {
228 currentState = lobbyState.JoiningGame;
229 networkGame.ErrorDelegate = AsyncCallbackFailed;
230 networkGame.CreateSession(JoinedSession);
231 }
232 break;
233
234 case lobbyState.FindGame:
235 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))
236 {
237 currentState = lobbyState.Welcome;
238 ready = false;
239 }
240 availableSessions = null;
241 networkGame.ErrorDelegate = AsyncCallbackFailed;
242 networkGame.FindSessions(FoundSessions);
243 currentState = lobbyState.FindingGames;
244 break;
245
246 case lobbyState.FindingGames:
247 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))
248 {
249 currentState = lobbyState.Welcome;
250 ready = false;
251 }
252 if (availableSessions != null && availableSessions.Count == 0)
253 currentState = lobbyState.FindGame;
254 else if (availableSessions != null && availableSessions.Count > 0)
255 {
256 if (currentKeyboardState.IsKeyDown(Keys.D1) && previousKeyboardState.IsKeyUp(Keys.D1))
257 {
258 networkGame.JoinSession(availableSessions[0], JoinedSession);
259 currentState = lobbyState.JoiningGame;
260
261 availableSessions.Dispose();
262 availableSessions = null;
263 }
264 if (currentKeyboardState.IsKeyDown(Keys.D2) && previousKeyboardState.IsKeyUp(Keys.D2))
265 {
266 networkGame.JoinSession(availableSessions[0], JoinedSession);
267 currentState = lobbyState.JoiningGame;
268
269 availableSessions.Dispose();
270 availableSessions = null;
271 }
272 }
273
274 break;
275
276 case lobbyState.Connected:
277 if (chatActive) //If chat is activated by pressing T all inputs go to chat. Enter finishes chat esc returns
278 {
279 if (currentKeyboardState.IsKeyDown(Keys.Escape) && previousKeyboardState.IsKeyUp(Keys.Escape))
280 {
281 chatActive = false;
282 break;
283 }
284 if (currentKeyboardState.IsKeyDown(Keys.Enter) && previousKeyboardState.IsKeyUp(Keys.Enter))
285 {
286 networkGame.SendChat(chatMessage);
287 chatActive = false;
288 break;
289 }
290 Keys[] k = currentKeyboardState.GetPressedKeys();
291 Keys[] kp = previousKeyboardState.GetPressedKeys();
292 List<Keys> newKeys = new List<Keys>();
293
294 for (int x = 0; x < k.Count(); x++) //copy new keys into array
295 {
296 if (!kp.Contains(k[x]))
297 {
298 newKeys.Add(k[x]);
299 }
300 }
301
302 foreach(Keys ky in newKeys)
303 {
304 if (ky.Equals(Keys.Back))
305 chatMessage = chatMessage.Substring(0, chatMessage.Length-1);
306 else if(ky.Equals(Keys.Space))
307 chatMessage = chatMessage + " ";
308 else
309 chatMessage = chatMessage + ky.ToString();
310 }
311
312 }
313 else
314 {
315 UpdateChat(gameTime, networkGame);
316 chatMessage = "";
317 if (currentKeyboardState.IsKeyDown(Keys.T) && previousKeyboardState.IsKeyUp(Keys.T))
318 {
319 chatActive = true;
320 }
321 if (currentKeyboardState.IsKeyDown(Keys.X) && previousKeyboardState.IsKeyUp(Keys.X))
322 {
323 ready = false;
324 currentChat.Clear();
325 if (networkGame.HasActiveSession)
326 {
327 players = null;
328 networkGame.LeaveSession();
329 }
330 currentState = lobbyState.Welcome;
331
332 }
333 if (currentKeyboardState.IsKeyDown(Keys.R) && previousKeyboardState.IsKeyUp(Keys.R))
334 networkGame.LocalGamer.IsReady = true;
335
336 if (networkGame.HasActiveSession)
337 {
338 localPlayer = networkGame.LocalGamer;
339 players = networkGame.NetworkGamers;
340 if (players != null)
341 {
342 allReady = true;
343 foreach (NetworkGamer p in players)
344 if (p.IsReady == false)
345 {
346 allReady = false;
347 break;
348 }
349 }
350
351 //allows host to start the game when all players are ready, change count below to different number for testing with less then 4 players
352 if (allReady && players.Count == 2 && localPlayer == players[0])
353 {
354 if (currentKeyboardState.IsKeyDown(Keys.B) && previousKeyboardState.IsKeyUp(Keys.B))
355 {
356 networkGame.ForceStartGame();
357 }
358 }
359 }
360 else
361 currentState = lobbyState.Welcome;
362 }
363 break;
364
365 }
366 previousKeyboardState = Keyboard.GetState();
367
368 return 1;
369 }
370
371 /// <summary>
372 /// Draws the lobby GUI. Has different states for difference menu configurations
373 /// </summary>
374 public long Draw(SpriteBatch spriteBatch)
375 {
376 spriteBatch.Draw(background, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0);
377 spriteBatch.Draw(cs, csPos, null, Color.White, 0, zero, 0.5f, SpriteEffects.None, 0);
378 spriteBatch.Draw(spotLight, spotLightPos, null, Color.White, 0, spotLightCenter, 1f, SpriteEffects.None, 0);
379
380 switch (currentState)
381 {
382 case lobbyState.Welcome:
383 spriteBatch.DrawString(menuFont, "press [ Home ] to login", new Vector2(350, 20), Color.LightGray, 0f, zero, .6f, SpriteEffects.None, 0.5f);
384 if (selected == createGameText)
385 spriteBatch.DrawString(menuFont, createGameText, createGamePos, Color.Red, 0, zero, 1f, SpriteEffects.None, 0.5f);
386 else
387 spriteBatch.DrawString(menuFont, createGameText, createGamePos, Color.Gray, 0, zero, 1f,SpriteEffects.None, 0.5f);
388 if (selected == findGameText)
389 spriteBatch.DrawString(menuFont, findGameText, findGamePos, Color.Red, 0, zero, 1f, SpriteEffects.None, 0.5f);
390 else
391 spriteBatch.DrawString(menuFont, findGameText, findGamePos, Color.Gray, 0, zero, 1f, SpriteEffects.None, 0.5f);
392 break;
393
394 case lobbyState.CreateGame:
395 DrawPlayerList(spriteBatch);
396 spriteBatch.DrawString(menuFont, "You are now the Host!", new Vector2(MaxX / 2, MaxY / 3), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
397 spriteBatch.DrawString(menuFont, "press: Y to continue", new Vector2(MaxX /2, (MaxY / 3) + menuFont.LineSpacing), Color.White, 0f, zero, .6f, SpriteEffects.None, 0.5f);
398 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);
399
400 break;
401
402 case lobbyState.FindingGames:
403 spriteBatch.Draw(selectGameScreen, backgroundPos, null, Color.White, 0, zero, scale, SpriteEffects.None, 0);
404 spriteBatch.DrawString(menuFont, "select game by pressing listed games index", new Vector2(250, 400), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);
405 if(availableSessions == null)
406 spriteBatch.DrawString(menuFont, "searching for available games ....", new Vector2(150, 100), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);
407 else if (availableSessions.Count == 0)
408 spriteBatch.DrawString(menuFont, "no games currently available, searching ....", new Vector2(150, 100), Color.Gray, 0f, zero, .7f, SpriteEffects.None, 0.5f);
409 else
410 {
411 for (int sessionIndex = 0; sessionIndex < availableSessions.Count; sessionIndex++)
412 {
413 Color color = Color.Gray;
414
415 if (sessionIndex == selectedSessionIndex)
416 color = Color.Red;
417
418 spriteBatch.DrawString(menuFont, sessionIndex+1 + " " + availableSessions[sessionIndex].HostGamertag, new Vector2(150, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f);
419 spriteBatch.DrawString(menuFont, availableSessions[sessionIndex].CurrentGamerCount + " / 4",
420 new Vector2(450, 125 + sessionIndex * menuFont.LineSpacing), color, 0f, zero, .7f, SpriteEffects.None, 0.5f);
421 }
422 }
423 break;
424
425 case lobbyState.Connected:
426 DrawPlayerList(spriteBatch);
427 DrawChatInfo(spriteBatch);
428 if(allReady && players.Count == 2 && localPlayer == players[0])
429 spriteBatch.DrawString(menuFont, "Press B to begin game!", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
430 else if(allReady)
431 spriteBatch.DrawString(menuFont, "The game will begin soon.", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
432 else
433 spriteBatch.DrawString(menuFont, "Waiting for ready players...", new Vector2(MaxX / 2, MaxY / 2), Color.White, 0f, zero, .7f, SpriteEffects.None, 0.5f);
434 break;
435 }
436
437 return 1;
438 }
439
440 private void UpdateSpotLight(GameTime gameTime)
441 {
442 spotLightPos = new Vector2(spotLightPos.X + spotLightVelocity.X * (float)gameTime.ElapsedGameTime.TotalSeconds,
443 spotLightPos.Y + spotLightVelocity.Y * (float)gameTime.ElapsedGameTime.TotalSeconds);
444
445 if (spotLightPos.X > MaxX || spotLightPos.X < MinX) //right or left wall
446 {
447 spotLightVelocity = new Vector2(spotLightVelocity.X * -1, spotLightVelocity.Y);
448 }
449 else if (spotLightPos.Y > MaxY || spotLightPos.Y < MinY) //top or bottom wall
450 {
451 spotLightVelocity = new Vector2(spotLightVelocity.X, spotLightVelocity.Y * -1);
452 }
453 }
454
455 private void DrawChatInfo(SpriteBatch spriteBatch)
456 {
457 if (currentChat.Count > 0)
458 {
459 for (int y = 0; y < currentChat.Count; y++)
460 {
461 spriteBatch.DrawString(menuFont, currentChat.ElementAt(y).Sender + ": " + currentChat.ElementAt(y).Message
462 , new Vector2(400, 10 + y*15), Color.Blue, 0f, zero, .6f, SpriteEffects.None, 1f);
463 }
464
465 }
466 if(chatActive)
467 spriteBatch.DrawString(menuFont, chatMessage, new Vector2(400, 10 + 15*(currentChat.Count + 1)), Color.Green, 0f, zero, .6f, SpriteEffects.None, 1f);
468 }
469
470 private void DrawPlayerList(SpriteBatch spriteBatch)
471 {
472
473 //reference point
474 Vector2 topOfList = new Vector2(MaxX / 8, MaxY / 4);
475
476 //command info
477 spriteBatch.DrawString(menuFont, "Current Players", new Vector2(topOfList.X + 15, topOfList.Y - 25), Color.White);
478 spriteBatch.DrawString(menuFont, "Command Options: to mark your self as ready", new Vector2(20, 20), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
479 spriteBatch.DrawString(menuFont, "type players # to toggle chat", new Vector2(175, 40), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
480 spriteBatch.DrawString(menuFont, "return to main menu", new Vector2(175, 80), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
481 spriteBatch.DrawString(menuFont, "enter chat mode", new Vector2(175, 60), Color.Gray, 0f, zero, .6f, SpriteEffects.None, 1f);
482 spriteBatch.DrawString(menuFont, "R", new Vector2(145, 20), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
483 spriteBatch.DrawString(menuFont, "#", new Vector2(145, 40), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
484 spriteBatch.DrawString(menuFont, "X", new Vector2(145, 80), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
485 spriteBatch.DrawString(menuFont, "T", new Vector2(145, 60), Color.DarkGreen, 0f, zero, .6f, SpriteEffects.None, 1f);
486
487 //Background squares
488 spriteBatch.Draw(menuItem, topOfList, null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
489 spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 65), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
490 spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 130), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
491 spriteBatch.Draw(menuItem, new Vector2(topOfList.X, topOfList.Y + 195), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
492
493 //Ready Labels
494 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
495 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
496 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
497 spriteBatch.DrawString(menuFont, "Ready", new Vector2(topOfList.X + 5, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
498
499 //Ready CheckBoxs
500 if (players == null)
501 {
502 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
503 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
504 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
505 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
506 }
507 else
508 {
509 if (!(players.Count >= 1 && players[0].IsReady))
510 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
511 else
512 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
513 if (!(players.Count >= 2 && players[1].IsReady))
514 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
515 else
516 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
517 if (!(players.Count >= 3 && players[2].IsReady))
518 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
519 else
520 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
521 if (!(players.Count >= 4 && players[3].IsReady))
522 spriteBatch.Draw(emptySelectBox, new Vector2(topOfList.X - 32, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
523 else
524 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X - 32, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
525 }
526
527 //Chat Labels
528 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 45), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
529 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 110), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
530 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 175), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
531 spriteBatch.DrawString(menuFont, "Chat with", new Vector2(topOfList.X + 152, topOfList.Y + 240), Color.DarkGray, 0f, zero, .6f, SpriteEffects.None, 1f);
532
533 //Chat CheckBoxs
534 Boolean chatwith = true; // change to reflect info from network, move to update and create one for each player
535 if (!chatwith)
536 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X +218, topOfList.Y + 35), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
537 else
538 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 30), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
539
540 if (!chatwith)
541 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 100), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
542 else
543 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 95), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
544
545 if (!chatwith)
546 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 165), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
547 else
548 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 160), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
549
550 if (!chatwith)
551 spriteBatch.Draw(deselectBox, new Vector2(topOfList.X + 218, topOfList.Y + 230), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
552 else
553 spriteBatch.Draw(checkedBox, new Vector2(topOfList.X + 218, topOfList.Y + 225), null, Color.White, 0, zero, scale, SpriteEffects.None, 1f);
554
555
556 //draw player names
557 if (players != null)
558 {
559 for (int g = 0; g < players.Count; g++)
560 {
561 spriteBatch.DrawString(menuFont, players[g].Gamertag, new Vector2(topOfList.X + 10, topOfList.Y + 10 + 65*g), Color.White, 0f, zero, .75f, SpriteEffects.None, 1f);
562 }
563 }
564 }
565 }
566 }
This page took 0.059379 seconds and 4 git commands to generate.