Add Media.DisplayMessageToPlayer
This commit is contained in:
committed by
abcdefg30
parent
847bbf5710
commit
867efcc6e8
@@ -187,7 +187,7 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Display a text message to the player.")]
|
[Desc("Display a text message to all players.")]
|
||||||
public void DisplayMessage(string text, string prefix = "Mission", Color? color = null)
|
public void DisplayMessage(string text, string prefix = "Mission", Color? color = null)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(text))
|
if (string.IsNullOrEmpty(text))
|
||||||
@@ -197,6 +197,15 @@ namespace OpenRA.Mods.Common.Scripting
|
|||||||
TextNotificationsManager.AddMissionLine(prefix, text, c);
|
TextNotificationsManager.AddMissionLine(prefix, text, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Desc("Display a text message only to this player.")]
|
||||||
|
public void DisplayMessageToPlayer(Player player, string text, string prefix = "Mission", Color? color = null)
|
||||||
|
{
|
||||||
|
if (world.LocalPlayer != player)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DisplayMessage(text, prefix, color);
|
||||||
|
}
|
||||||
|
|
||||||
[Desc("Display a system message to the player. If 'prefix' is nil the default system prefix is used.")]
|
[Desc("Display a system message to the player. If 'prefix' is nil the default system prefix is used.")]
|
||||||
public void DisplaySystemMessage(string text, string prefix = null)
|
public void DisplaySystemMessage(string text, string prefix = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ end
|
|||||||
---@return number id used to query for the objective later
|
---@return number id used to query for the objective later
|
||||||
AddPrimaryObjective = function(player, description)
|
AddPrimaryObjective = function(player, description)
|
||||||
local translation = UserInterface.Translate(description)
|
local translation = UserInterface.Translate(description)
|
||||||
Media.DisplayMessage(translation, UserInterface.Translate("new-primary-objective"))
|
Media.DisplayMessageToPlayer(player, translation, UserInterface.Translate("new-primary-objective"))
|
||||||
return player.AddObjective(translation, UserInterface.Translate("primary"), true)
|
return player.AddObjective(translation, UserInterface.Translate("primary"), true)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -29,6 +29,6 @@ end
|
|||||||
---@return number id used to query for the objective later
|
---@return number id used to query for the objective later
|
||||||
AddSecondaryObjective = function(player, description)
|
AddSecondaryObjective = function(player, description)
|
||||||
local translation = UserInterface.Translate(description)
|
local translation = UserInterface.Translate(description)
|
||||||
Media.DisplayMessage(translation, UserInterface.Translate("new-secondary-objective"))
|
Media.DisplayMessageToPlayer(player, translation, UserInterface.Translate("new-secondary-objective"))
|
||||||
return player.AddObjective(translation, UserInterface.Translate("secondary"), false)
|
return player.AddObjective(translation, UserInterface.Translate("secondary"), false)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user