unhardcode and increase the exit delay
This commit is contained in:
@@ -339,7 +339,11 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public interface ILintPass { void Run(Action<string> emitError, Action<string> emitWarning, Map map); }
|
public interface ILintPass { void Run(Action<string> emitError, Action<string> emitWarning, Map map); }
|
||||||
|
|
||||||
public interface IObjectivesPanel { string PanelName { get; } }
|
public interface IObjectivesPanel
|
||||||
|
{
|
||||||
|
string PanelName { get; }
|
||||||
|
int ExitDelay { get; }
|
||||||
|
}
|
||||||
|
|
||||||
public interface INotifyObjectivesUpdated
|
public interface INotifyObjectivesUpdated
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -250,13 +250,18 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public class ObjectivesPanelInfo : ITraitInfo
|
public class ObjectivesPanelInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public string PanelName = null;
|
public string PanelName = null;
|
||||||
|
|
||||||
|
[Desc("in ms")]
|
||||||
|
public int ExitDelay = 1400;
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new ObjectivesPanel(this); }
|
public object Create(ActorInitializer init) { return new ObjectivesPanel(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ObjectivesPanel : IObjectivesPanel
|
public class ObjectivesPanel : IObjectivesPanel
|
||||||
{
|
{
|
||||||
ObjectivesPanelInfo info;
|
readonly ObjectivesPanelInfo info;
|
||||||
public ObjectivesPanel(ObjectivesPanelInfo info) { this.info = info; }
|
public ObjectivesPanel(ObjectivesPanelInfo info) { this.info = info; }
|
||||||
public string PanelName { get { return info.PanelName; } }
|
public string PanelName { get { return info.PanelName; } }
|
||||||
|
public int ExitDelay { get { return info.ExitDelay; } }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,10 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
using OpenRA.Traits;
|
||||||
using OpenRA.Widgets;
|
using OpenRA.Widgets;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.Widgets.Logic
|
namespace OpenRA.Mods.Common.Widgets.Logic
|
||||||
@@ -41,7 +43,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
resumeDisabled = true;
|
resumeDisabled = true;
|
||||||
|
|
||||||
var exitDelay = 1200;
|
var iop = world.WorldActor.TraitsImplementing<IObjectivesPanel>().FirstOrDefault();
|
||||||
|
var exitDelay = iop != null ? iop.ExitDelay : 0;
|
||||||
if (mpe != null)
|
if (mpe != null)
|
||||||
{
|
{
|
||||||
Game.RunAfterDelay(exitDelay, () => mpe.Fade(MenuPaletteEffect.EffectType.Black));
|
Game.RunAfterDelay(exitDelay, () => mpe.Fade(MenuPaletteEffect.EffectType.Black));
|
||||||
|
|||||||
@@ -106,7 +106,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
Sound.PlayNotification(world.Map.Rules, null, "Speech", "Leave",
|
Sound.PlayNotification(world.Map.Rules, null, "Speech", "Leave",
|
||||||
world.LocalPlayer == null ? null : world.LocalPlayer.Country.Race);
|
world.LocalPlayer == null ? null : world.LocalPlayer.Country.Race);
|
||||||
|
|
||||||
var exitDelay = 1200;
|
var exitDelay = iop != null ? iop.ExitDelay : 0;
|
||||||
if (mpe != null)
|
if (mpe != null)
|
||||||
{
|
{
|
||||||
Game.RunAfterDelay(exitDelay, () => mpe.Fade(MenuPaletteEffect.EffectType.Black));
|
Game.RunAfterDelay(exitDelay, () => mpe.Fade(MenuPaletteEffect.EffectType.Black));
|
||||||
|
|||||||
Reference in New Issue
Block a user