Extract player profile loading chrome logic to a dedicated class
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright (c) The OpenRA Developers and Contributors
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation, either version 3 of
|
||||
* the License, or (at your option) any later version. For more
|
||||
* information, see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
{
|
||||
public class LoadLocalPlayerProfileLogic : ChromeLogic
|
||||
{
|
||||
[ObjectCreator.UseCtor]
|
||||
public LoadLocalPlayerProfileLogic(Widget widget, World world)
|
||||
{
|
||||
Func<bool> minimalProfile = () => Ui.CurrentWindow() != null;
|
||||
|
||||
Game.LoadWidget(world, "LOCAL_PROFILE_PANEL", widget, new WidgetArgs()
|
||||
{
|
||||
{ "minimalProfile", minimalProfile }
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -255,16 +255,6 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
menuType != MenuType.StartupPrompts &&
|
||||
webServices.ModVersionStatus == ModVersionStatus.Outdated;
|
||||
|
||||
var playerProfile = widget.GetOrNull("PLAYER_PROFILE_CONTAINER");
|
||||
if (playerProfile != null)
|
||||
{
|
||||
Func<bool> minimalProfile = () => Ui.CurrentWindow() != null;
|
||||
Game.LoadWidget(world, "LOCAL_PROFILE_PANEL", playerProfile, new WidgetArgs()
|
||||
{
|
||||
{ "minimalProfile", minimalProfile }
|
||||
});
|
||||
}
|
||||
|
||||
menuType = MenuType.StartupPrompts;
|
||||
|
||||
void OnIntroductionComplete()
|
||||
|
||||
@@ -274,5 +274,6 @@ Container@MENU_BACKGROUND:
|
||||
Width: 200
|
||||
Height: 200
|
||||
Container@PLAYER_PROFILE_CONTAINER:
|
||||
Logic: LoadLocalPlayerProfileLogic
|
||||
X: 31
|
||||
Y: 31
|
||||
|
||||
@@ -274,5 +274,6 @@ Container@MAINMENU:
|
||||
Shadow: true
|
||||
Text: label-update-notice-b
|
||||
Container@PLAYER_PROFILE_CONTAINER:
|
||||
Logic: LoadLocalPlayerProfileLogic
|
||||
X: 25
|
||||
Y: 25
|
||||
|
||||
@@ -267,5 +267,6 @@ Container@MAINMENU:
|
||||
Width: 200
|
||||
Height: 200
|
||||
Container@PLAYER_PROFILE_CONTAINER:
|
||||
Logic: LoadLocalPlayerProfileLogic
|
||||
X: 5
|
||||
Y: 5
|
||||
|
||||
Reference in New Issue
Block a user