Skip to content

Commit 16693e6

Browse files
committed
Quick match
1 parent 2c7f7a1 commit 16693e6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2411
-166
lines changed

BuildScripts/CopyCompiled.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ copy Newtonsoft.Json.dll %commonBinaries%Newtonsoft.Json.dll
3535
copy DiscordRPC.dll %commonBinaries%DiscordRPC.dll
3636
copy lzo.net.dll %commonBinaries%lzo.net.dll
3737
copy OpenMcdf.dll %commonBinaries%OpenMcdf.dll
38+
copy JWT.dll %commonBinaries%JWT.dll
39+
copy System.Net.Http.dll %commonBinaries%System.Net.Http.dll
3840

3941
echo Windows
4042
copy DTAClient.exe %cr%clientdx.exe

ClientCore/ClientConfiguration.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,8 @@ public string GetThemePath(string themeName)
245245

246246
public string MPMapsIniPath => clientDefinitionsIni.GetStringValue(SETTINGS, "MPMapsPath", "INI/MPMaps.ini");
247247

248+
public string QuickMatchPath => clientDefinitionsIni.GetStringValue(SETTINGS, "QuickMatchPath", "INI/QuickMatch.ini");
249+
248250
public string KeyboardINI => clientDefinitionsIni.GetStringValue(SETTINGS, "KeyboardINI", "Keyboard.ini");
249251

250252
public int MinimumIngameWidth => clientDefinitionsIni.GetIntValue(SETTINGS, "MinimumIngameWidth", 640);

ClientCore/ClientCore.csproj

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<DefineConstants>TRACE;DEBUG;XNA</DefineConstants>
5656
<ErrorReport>prompt</ErrorReport>
5757
<WarningLevel>4</WarningLevel>
58-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
58+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
5959
<PlatformTarget>x86</PlatformTarget>
6060
</PropertyGroup>
6161
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|XNAFramework' ">
@@ -65,7 +65,7 @@
6565
<DefineConstants>TRACE</DefineConstants>
6666
<ErrorReport>prompt</ErrorReport>
6767
<WarningLevel>4</WarningLevel>
68-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
68+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
6969
<PlatformTarget>x86</PlatformTarget>
7070
</PropertyGroup>
7171
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AresRelease|SharpDX' ">
@@ -83,7 +83,7 @@
8383
<DefineConstants>TRACE;ARES YR</DefineConstants>
8484
<ErrorReport>prompt</ErrorReport>
8585
<WarningLevel>4</WarningLevel>
86-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
86+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
8787
<PlatformTarget>x86</PlatformTarget>
8888
</PropertyGroup>
8989
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AresRelease|WindowsGL' ">
@@ -109,7 +109,7 @@
109109
<DefineConstants>TRACE;YR</DefineConstants>
110110
<ErrorReport>prompt</ErrorReport>
111111
<WarningLevel>4</WarningLevel>
112-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
112+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
113113
<PlatformTarget>x86</PlatformTarget>
114114
</PropertyGroup>
115115
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YRRelease|WindowsGL' ">
@@ -145,7 +145,7 @@
145145
<OutputPath>bin\XNAFramework\Debug\</OutputPath>
146146
<DefineConstants>TRACE;DEBUG;ARES YR</DefineConstants>
147147
<DebugType>full</DebugType>
148-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
148+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
149149
<PlatformTarget>x86</PlatformTarget>
150150
<LangVersion>7.3</LangVersion>
151151
<ErrorReport>prompt</ErrorReport>
@@ -176,7 +176,7 @@
176176
<OutputPath>bin\XNAFramework\Debug\</OutputPath>
177177
<DefineConstants>TRACE;DEBUG;YR</DefineConstants>
178178
<DebugType>full</DebugType>
179-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
179+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
180180
<PlatformTarget>x86</PlatformTarget>
181181
<LangVersion>7.3</LangVersion>
182182
<ErrorReport>prompt</ErrorReport>
@@ -254,6 +254,8 @@
254254
<Compile Include="CnCNet5\NameValidator.cs" />
255255
<Compile Include="Enums\AllowPrivateMessagesFromEnum.cs" />
256256
<Compile Include="Enums\SortDirection.cs" />
257+
<Compile Include="Exceptions\ClientException.cs" />
258+
<Compile Include="Exceptions\ClientRequestException.cs" />
257259
<Compile Include="Extensions\EnumExtensions.cs" />
258260
<Compile Include="Extensions\StringExtensions.cs" />
259261
<Compile Include="INIProcessing\IniPreprocessInfoStore.cs" />
@@ -323,4 +325,4 @@
323325
<Target Name="AfterBuild">
324326
</Target>
325327
-->
326-
</Project>
328+
</Project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
3+
namespace ClientCore.Exceptions
4+
{
5+
public class ClientException : Exception
6+
{
7+
public ClientException(string message, Exception innerException = null) : base(message, innerException)
8+
{
9+
}
10+
}
11+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System.Net;
2+
3+
namespace ClientCore.Exceptions
4+
{
5+
public class ClientRequestException : ClientException
6+
{
7+
public HttpStatusCode? StatusCode { get; }
8+
9+
public ClientRequestException(string message, HttpStatusCode? statusCode = null) : base(message)
10+
{
11+
StatusCode = statusCode;
12+
}
13+
}
14+
}

ClientGUI/ClientGUI.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<DefineConstants>TRACE;DEBUG;XNA</DefineConstants>
6060
<ErrorReport>prompt</ErrorReport>
6161
<WarningLevel>4</WarningLevel>
62-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
62+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
6363
</PropertyGroup>
6464
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|XNAFramework' ">
6565
<PlatformTarget>x86</PlatformTarget>
@@ -69,7 +69,7 @@
6969
<DefineConstants>TRACE;XNA</DefineConstants>
7070
<ErrorReport>prompt</ErrorReport>
7171
<WarningLevel>4</WarningLevel>
72-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
72+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
7373
</PropertyGroup>
7474
<Choose>
7575
<When Condition="'$(Platform)' != 'XNAFramework'">
@@ -187,4 +187,4 @@
187187
<Target Name="AfterBuild">
188188
</Target>
189189
-->
190-
</Project>
190+
</Project>

ClientGUI/Parser.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
using Rampastring.XNAUI.XNAControls;
2525
using System;
2626
using System.Collections.Generic;
27+
using System.Text.RegularExpressions;
2728

2829
namespace ClientGUI
2930
{
@@ -69,6 +70,9 @@ private XNAControl GetControl(string controlName)
6970
if (controlName == primaryControl.Name)
7071
return primaryControl;
7172

73+
if (controlName == primaryControl.Parent.Name)
74+
return primaryControl.Parent;
75+
7276
var control = Find(primaryControl.Children, controlName);
7377
if (control == null)
7478
throw new KeyNotFoundException($"Control '{controlName}' not found while parsing input '{Input}'");
@@ -104,7 +108,7 @@ public void SetPrimaryControl(XNAControl primaryControl)
104108
public int GetExprValue(string input, XNAControl parsingControl)
105109
{
106110
this.parsingControl = parsingControl;
107-
Input = input;
111+
Input = Regex.Replace(input, @"\s", "");
108112
tokenPlace = 0;
109113
return GetExprValue();
110114
}
@@ -115,8 +119,6 @@ private int GetExprValue()
115119

116120
while (true)
117121
{
118-
SkipWhitespace();
119-
120122
if (IsEndOfInput())
121123
return value;
122124

ClientGUI/XNAMessageBox.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,10 @@ private static void MsgBox_OKClicked(XNAMessageBox messageBox)
262262
/// <param name="caption">The caption of the message box.</param>
263263
/// <param name="description">The description in the message box.</param>
264264
/// <returns>The XNAMessageBox instance that is created.</returns>
265-
public static XNAMessageBox ShowYesNoDialog(WindowManager windowManager, string caption, string description)
265+
public static XNAMessageBox ShowYesNoDialog(WindowManager windowManager, string caption, string description)
266+
=> ShowYesNoDialog(windowManager, caption, description, null);
267+
268+
public static XNAMessageBox ShowYesNoDialog(WindowManager windowManager, string caption, string description, Action<XNAMessageBox> yesAction)
266269
{
267270
var panel = new DarkeningPanel(windowManager);
268271
windowManager.AddAndInitializeControl(panel);
@@ -274,6 +277,8 @@ public static XNAMessageBox ShowYesNoDialog(WindowManager windowManager, string
274277

275278
panel.AddChild(msgBox);
276279
msgBox.YesClickedAction = MsgBox_YesClicked;
280+
if (yesAction != null)
281+
msgBox.YesClickedAction += yesAction;
277282
msgBox.NoClickedAction = MsgBox_NoClicked;
278283

279284
return msgBox;

DTAConfig/DTAConfig.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<DefineConstants>TRACE;DEBUG;XNA TS</DefineConstants>
5858
<ErrorReport>prompt</ErrorReport>
5959
<WarningLevel>4</WarningLevel>
60-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
60+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
6161
<PlatformTarget>x86</PlatformTarget>
6262
</PropertyGroup>
6363
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|XNAFramework' ">
@@ -67,7 +67,7 @@
6767
<DefineConstants>TRACE;XNA</DefineConstants>
6868
<ErrorReport>prompt</ErrorReport>
6969
<WarningLevel>4</WarningLevel>
70-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
70+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
7171
<PlatformTarget>x86</PlatformTarget>
7272
</PropertyGroup>
7373
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TSRelease|SharpDX' ">
@@ -87,7 +87,7 @@
8787
<DefineConstants>TRACE;XNA TS</DefineConstants>
8888
<ErrorReport>prompt</ErrorReport>
8989
<WarningLevel>4</WarningLevel>
90-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
90+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
9191
</PropertyGroup>
9292
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'TSRelease|WindowsGL' ">
9393
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -115,7 +115,7 @@
115115
<DefineConstants>TRACE;XNA ARES YR</DefineConstants>
116116
<ErrorReport>prompt</ErrorReport>
117117
<WarningLevel>4</WarningLevel>
118-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
118+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
119119
</PropertyGroup>
120120
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AresRelease|WindowsGL' ">
121121
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -143,7 +143,7 @@
143143
<DefineConstants>TRACE;XNA YR</DefineConstants>
144144
<ErrorReport>prompt</ErrorReport>
145145
<WarningLevel>4</WarningLevel>
146-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
146+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
147147
</PropertyGroup>
148148
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'YRRelease|WindowsGL' ">
149149
<PlatformTarget>AnyCPU</PlatformTarget>
@@ -348,4 +348,4 @@
348348
<Target Name="AfterBuild">
349349
</Target>
350350
-->
351-
</Project>
351+
</Project>

DXMainClient/DXGUI/Generic/LoadingScreen.cs

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@
77
using DTAClient.DXGUI.Multiplayer;
88
using DTAClient.DXGUI.Multiplayer.CnCNet;
99
using DTAClient.DXGUI.Multiplayer.GameLobby;
10+
using DTAClient.DXGUI.Multiplayer.QuickMatch;
1011
using DTAClient.Online;
1112
using DTAConfig;
1213
using Microsoft.Xna.Framework;
1314
using Rampastring.XNAUI;
1415
using System.Threading.Tasks;
1516
using Rampastring.Tools;
1617
using ClientUpdater;
18+
using Rampastring.XNAUI.XNAControls;
1719
using SkirmishLobby = DTAClient.DXGUI.Multiplayer.GameLobby.SkirmishLobby;
1820

1921
namespace DTAClient.DXGUI.Generic
@@ -79,26 +81,20 @@ private void LogGameClientVersion()
7981

8082
private void LoadMaps()
8183
{
82-
mapLoader = new MapLoader();
84+
mapLoader = MapLoader.GetInstance();
8385
mapLoader.LoadMaps();
8486
}
8587

8688
private void Finish()
8789
{
88-
ProgramConstants.GAME_VERSION = ClientConfiguration.Instance.ModMode ?
90+
ProgramConstants.GAME_VERSION = ClientConfiguration.Instance.ModMode ?
8991
"N/A" : Updater.GameVersion;
9092

9193
DiscordHandler discordHandler = null;
9294
if (!string.IsNullOrEmpty(ClientConfiguration.Instance.DiscordAppId))
9395
discordHandler = new DiscordHandler(WindowManager);
9496

95-
ClientGUICreator.Instance.AddControl(typeof(GameLobbyCheckBox));
96-
ClientGUICreator.Instance.AddControl(typeof(GameLobbyDropDown));
97-
ClientGUICreator.Instance.AddControl(typeof(MapPreviewBox));
98-
ClientGUICreator.Instance.AddControl(typeof(GameLaunchButton));
99-
ClientGUICreator.Instance.AddControl(typeof(ChatListBox));
100-
ClientGUICreator.Instance.AddControl(typeof(XNAChatTextBox));
101-
ClientGUICreator.Instance.AddControl(typeof(PlayerExtraOptionsPanel));
97+
DeclareCustomControls();
10298

10399
var gameCollection = new GameCollection();
104100
gameCollection.Initialize(GraphicsDevice);
@@ -109,7 +105,7 @@ private void Finish()
109105
var cncnetManager = new CnCNetManager(WindowManager, gameCollection, cncnetUserData);
110106
var tunnelHandler = new TunnelHandler(WindowManager, cncnetManager);
111107
var privateMessageHandler = new PrivateMessageHandler(cncnetManager, cncnetUserData);
112-
108+
113109
var topBar = new TopBar(WindowManager, cncnetManager, privateMessageHandler);
114110

115111
var optionsWindow = new OptionsWindow(WindowManager, gameCollection, topBar);
@@ -120,23 +116,26 @@ private void Finish()
120116

121117
var cncnetGameLobby = new CnCNetGameLobby(WindowManager,
122118
"MultiplayerGameLobby", topBar, cncnetManager, tunnelHandler, gameCollection, cncnetUserData, mapLoader, discordHandler, pmWindow);
123-
var cncnetGameLoadingLobby = new CnCNetGameLoadingLobby(WindowManager,
119+
var cncnetGameLoadingLobby = new CnCNetGameLoadingLobby(WindowManager,
124120
topBar, cncnetManager, tunnelHandler, mapLoader.GameModes, gameCollection, discordHandler);
125-
var cncnetLobby = new CnCNetLobby(WindowManager, cncnetManager,
121+
var cncnetLobby = new CnCNetLobby(WindowManager, cncnetManager,
126122
cncnetGameLobby, cncnetGameLoadingLobby, topBar, pmWindow, tunnelHandler,
127123
gameCollection, cncnetUserData, optionsWindow);
128124
var gipw = new GameInProgressWindow(WindowManager);
129125

130126
var skirmishLobby = new SkirmishLobby(WindowManager, topBar, mapLoader, discordHandler);
127+
var quickMatchWindow = new QuickMatchWindow(WindowManager);
131128

132129
topBar.SetSecondarySwitch(cncnetLobby);
133130

134-
var mainMenu = new MainMenu(WindowManager, skirmishLobby, lanLobby,
131+
var mainMenu = new MainMenu(WindowManager, skirmishLobby, quickMatchWindow, lanLobby,
135132
topBar, optionsWindow, cncnetLobby, cncnetManager, discordHandler);
136133
WindowManager.AddAndInitializeControl(mainMenu);
137134

138135
DarkeningPanel.AddAndInitializeWithControl(WindowManager, skirmishLobby);
139136

137+
DarkeningPanel.AddAndInitializeWithControl(WindowManager, quickMatchWindow);
138+
140139
DarkeningPanel.AddAndInitializeWithControl(WindowManager, cncnetGameLoadingLobby);
141140

142141
DarkeningPanel.AddAndInitializeWithControl(WindowManager, cncnetGameLobby);
@@ -152,9 +151,11 @@ private void Finish()
152151

153152
topBar.SetTertiarySwitch(pmWindow);
154153
topBar.SetOptionsWindow(optionsWindow);
154+
topBar.SetQuickMatchWindow(quickMatchWindow);
155155

156156
WindowManager.AddAndInitializeControl(gipw);
157157
skirmishLobby.Disable();
158+
quickMatchWindow.Disable();
158159
cncnetLobby.Disable();
159160
cncnetGameLobby.Disable();
160161
cncnetGameLoadingLobby.Disable();
@@ -183,6 +184,24 @@ private void Finish()
183184
Cursor.Visible = visibleSpriteCursor;
184185
}
185186

187+
private static void DeclareCustomControls()
188+
{
189+
ClientGUICreator.Instance.AddControl(typeof(GameLobbyCheckBox));
190+
ClientGUICreator.Instance.AddControl(typeof(GameLobbyDropDown));
191+
ClientGUICreator.Instance.AddControl(typeof(MapPreviewBox));
192+
ClientGUICreator.Instance.AddControl(typeof(GameLaunchButton));
193+
ClientGUICreator.Instance.AddControl(typeof(ChatListBox));
194+
ClientGUICreator.Instance.AddControl(typeof(XNAChatTextBox));
195+
ClientGUICreator.Instance.AddControl(typeof(XNAScrollBar));
196+
ClientGUICreator.Instance.AddControl(typeof(XNAPasswordBox));
197+
ClientGUICreator.Instance.AddControl(typeof(PlayerExtraOptionsPanel));
198+
ClientGUICreator.Instance.AddControl(typeof(QuickMatchLoginPanel));
199+
ClientGUICreator.Instance.AddControl(typeof(QuickMatchLobbyPanel));
200+
ClientGUICreator.Instance.AddControl(typeof(QuickMatchMapList));
201+
ClientGUICreator.Instance.AddControl(typeof(QuickMatchStatusMessageWindow));
202+
ClientGUICreator.Instance.AddControl(typeof(XNAClientTabControl));
203+
}
204+
186205
public override void Update(GameTime gameTime)
187206
{
188207
base.Update(gameTime);

0 commit comments

Comments
 (0)