-
-
Notifications
You must be signed in to change notification settings - Fork 122
Expand file tree
/
Copy pathMatchFoundWindow.cs
More file actions
77 lines (62 loc) · 2.35 KB
/
Copy pathMatchFoundWindow.cs
File metadata and controls
77 lines (62 loc) · 2.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
using Rampastring.XNAUI.XNAControls;
using System;
using ClientCore;
using Rampastring.XNAUI;
using ClientGUI;
using ClientCore.Extensions;
using Rectangle = Microsoft.Xna.Framework.Rectangle;
using Color = Microsoft.Xna.Framework.Color;
namespace DTAClient.DXGUI.Generic
{
/// <summary>
/// Displays a dialog in the client when a matchmaking match is found.
/// Blocks user interaction until the game process starts.
/// </summary>
public class MatchFoundWindow : XNAPanel
{
public MatchFoundWindow(WindowManager windowManager) : base(windowManager)
{
}
private bool initialized = false;
public override void Initialize()
{
if (initialized)
throw new InvalidOperationException("MatchFoundWindow cannot be initialized twice!");
initialized = true;
BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 128), 1, 1);
PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
DrawBorders = false;
ClientRectangle = new Rectangle(0, 0, WindowManager.RenderResolutionX, WindowManager.RenderResolutionY);
XNAWindow window = new XNAWindow(WindowManager);
window.Name = "MatchFoundWindowBox";
window.BackgroundTexture = AssetLoader.CreateTexture(new Color(0, 0, 0, 220), 2, 2);
window.PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED;
window.ClientRectangle = new Rectangle(0, 0, 350, 120);
XNALabel explanation = new XNALabel(WindowManager);
explanation.FontIndex = 1;
explanation.Text = "Match found! Joining room...".L10N("Client:Main:MatchFoundLabel");
AddChild(window);
window.AddChild(explanation);
base.Initialize();
explanation.CenterOnParent();
window.CenterOnParent();
Visible = false;
Enabled = false;
GameProcessLogic.GameProcessStarted += SharedUILogic_GameProcessStarted;
}
private void SharedUILogic_GameProcessStarted()
{
Hide();
}
public void Show()
{
Visible = true;
Enabled = true;
}
public void Hide()
{
Visible = false;
Enabled = false;
}
}
}