-
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
161 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using ClientCore; | ||
using ClientGUI; | ||
using DTAClient.Domain; | ||
using Localization; | ||
using Microsoft.Xna.Framework; | ||
using Rampastring.Tools; | ||
using Rampastring.XNAUI; | ||
using Rampastring.XNAUI.XNAControls; | ||
|
||
namespace DTAClient.DXGUI.Generic | ||
{ | ||
public class CampaignTagSelector : INItializableWindow | ||
{ | ||
private const int DEFAULT_WIDTH = 576; | ||
private const int DEFAULT_HEIGHT = 475; | ||
private string _iniSectionName; | ||
private DiscordHandler discordHandler; | ||
|
||
public CampaignTagSelector(WindowManager windowManager, string iniName, DiscordHandler discordHandler) : base(windowManager) | ||
{ | ||
_iniSectionName = iniName; | ||
this.discordHandler = discordHandler; | ||
} | ||
protected XNAClientButton btnCancel; | ||
protected XNAClientButton btnShowAllMission; | ||
public override void Initialize() | ||
{ | ||
CampaignSelector = new CampaignSelector(WindowManager, discordHandler); | ||
DarkeningPanel.AddAndInitializeWithControl(WindowManager, CampaignSelector); | ||
CampaignSelector.Disable(); | ||
|
||
Name = _iniSectionName; | ||
|
||
if (!ClientConfiguration.Instance.CampaignTagSelectorEnabled) return; | ||
|
||
ClientRectangle = new Rectangle(0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT); | ||
BorderColor = UISettings.ActiveSettings.PanelBorderColor; | ||
|
||
base.Initialize(); | ||
|
||
WindowManager.CenterControlOnScreen(this); | ||
|
||
btnCancel = FindChild<XNAClientButton>(nameof(btnCancel)); | ||
btnCancel.LeftClick += BtnCancel_LeftClick; | ||
btnShowAllMission = FindChild<XNAClientButton>(nameof(btnShowAllMission)); | ||
btnShowAllMission.LeftClick += (sender, e) => | ||
{ | ||
CampaignSelector.LoadMissionsWithFilter(null); | ||
CampaignSelector.Enable(); | ||
Disable(); | ||
}; | ||
|
||
const string TagButtonsPrefix = "ButtonTag_"; | ||
var tagButtons = FindChildrenStartWith<XNAClientButton>(TagButtonsPrefix); | ||
foreach (var tagButton in tagButtons) | ||
{ | ||
string tagName = tagButton.Name.Substring(TagButtonsPrefix.Length); | ||
tagButton.LeftClick += (sender, e) => | ||
{ | ||
CampaignSelector.LoadMissionsWithFilter(new HashSet<string>() { tagName }); | ||
CampaignSelector.Enable(); | ||
Disable(); | ||
}; | ||
} | ||
} | ||
|
||
private void BtnCancel_LeftClick(object sender, EventArgs e) | ||
{ | ||
Disable(); | ||
} | ||
|
||
public void Open() | ||
{ | ||
if (ClientConfiguration.Instance.CampaignTagSelectorEnabled) | ||
Enable(); | ||
else | ||
CampaignSelector.Enable(); | ||
} | ||
|
||
CampaignSelector CampaignSelector; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters