Add support for custom mission timers: UserInterfaceGlobal
This commit is contained in:
35
OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs
Normal file
35
OpenRA.Mods.Common/Scripting/Global/UserInterfaceGlobal.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2015 The OpenRA Developers (see AUTHORS)
|
||||
* 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. For more information,
|
||||
* see COPYING.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Drawing;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.Common.Widgets;
|
||||
using OpenRA.Scripting;
|
||||
using OpenRA.Widgets;
|
||||
|
||||
namespace OpenRA.Mods.Common.Scripting.Global
|
||||
{
|
||||
[ScriptGlobal("UserInterface")]
|
||||
public class UserInterfaceGlobal : ScriptGlobal
|
||||
{
|
||||
public UserInterfaceGlobal(ScriptContext context)
|
||||
: base(context) { }
|
||||
|
||||
[Desc("Displays a text message at the top center of the screen.")]
|
||||
public void SetMissionText(string text, HSLColor? color = null)
|
||||
{
|
||||
var luaLabel = Ui.Root.Get("INGAME_ROOT").Get<LabelWidget>("MISSION_TEXT");
|
||||
luaLabel.GetText = () => text;
|
||||
|
||||
Color c = color.HasValue ? HSLColor.RGBFromHSL(color.Value.H / 255f, color.Value.S / 255f, color.Value.L / 255f) : Color.White;
|
||||
luaLabel.GetColor = () => c;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user