Merge pull request #10015 from atlimit8/MapEditorTooltips
Add map editor only tooltips
This commit is contained in:
@@ -12,12 +12,23 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
[Desc("Shown in the build palette widget.")]
|
public abstract class TooltipInfoBase : ITraitInfo
|
||||||
public class TooltipInfo : ITraitInfo, ITooltipInfo
|
|
||||||
{
|
{
|
||||||
[Translate] public readonly string Description = "";
|
[Translate] public readonly string Description = "";
|
||||||
[Translate] public readonly string Name = "";
|
[Translate] public readonly string Name = "";
|
||||||
|
|
||||||
|
public abstract object Create(ActorInitializer init);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Desc("Shown in map editor.")]
|
||||||
|
public class EditorOnlyTooltipInfo : TooltipInfoBase
|
||||||
|
{
|
||||||
|
public override object Create(ActorInitializer init) { return this; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Desc("Shown in the build palette widget.")]
|
||||||
|
public class TooltipInfo : TooltipInfoBase, ITooltipInfo
|
||||||
|
{
|
||||||
[Desc("An optional generic name (i.e. \"Soldier\" or \"Structure\")" +
|
[Desc("An optional generic name (i.e. \"Soldier\" or \"Structure\")" +
|
||||||
"to be shown to chosen players.")]
|
"to be shown to chosen players.")]
|
||||||
[Translate] public readonly string GenericName = null;
|
[Translate] public readonly string GenericName = null;
|
||||||
@@ -34,7 +45,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Sequence of the actor that contains the cameo.")]
|
[Desc("Sequence of the actor that contains the cameo.")]
|
||||||
public readonly string Icon = "icon";
|
public readonly string Icon = "icon";
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new Tooltip(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new Tooltip(init.Self, this); }
|
||||||
|
|
||||||
public string TooltipForPlayerStance(Stance stance)
|
public string TooltipForPlayerStance(Stance stance)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
Footprint = new ReadOnlyDictionary<CPos, SubCell>(footprint);
|
Footprint = new ReadOnlyDictionary<CPos, SubCell>(footprint);
|
||||||
}
|
}
|
||||||
|
|
||||||
var tooltip = Info.TraitInfoOrDefault<TooltipInfo>();
|
var tooltip = Info.TraitInfoOrDefault<EditorOnlyTooltipInfo>() as TooltipInfoBase ?? Info.TraitInfoOrDefault<TooltipInfo>();
|
||||||
Tooltip = (tooltip == null ? " < " + Info.Name + " >" : tooltip.Name) + "\n" + owner.Name + " (" + owner.Faction + ")"
|
Tooltip = (tooltip == null ? " < " + Info.Name + " >" : tooltip.Name) + "\n" + owner.Name + " (" + owner.Faction + ")"
|
||||||
+ "\nID: " + ID + "\nType: " + Info.Name;
|
+ "\nID: " + ID + "\nType: " + Info.Name;
|
||||||
|
|
||||||
|
|||||||
@@ -136,7 +136,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
item.Bounds.Height = preview.Bounds.Height + 2 * preview.Bounds.Y;
|
item.Bounds.Height = preview.Bounds.Height + 2 * preview.Bounds.Y;
|
||||||
item.IsVisible = () => true;
|
item.IsVisible = () => true;
|
||||||
|
|
||||||
var tooltip = actor.TraitInfoOrDefault<TooltipInfo>();
|
var tooltip = actor.TraitInfoOrDefault<EditorOnlyTooltipInfo>() as TooltipInfoBase ?? actor.TraitInfoOrDefault<TooltipInfo>();
|
||||||
item.GetTooltipText = () => (tooltip == null ? "Type: " : tooltip.Name + "\nType: ") + actor.Name;
|
item.GetTooltipText = () => (tooltip == null ? "Type: " : tooltip.Name + "\nType: ") + actor.Name;
|
||||||
|
|
||||||
panel.AddChild(item);
|
panel.AddChild(item);
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ CRATE:
|
|||||||
Units: mcv
|
Units: mcv
|
||||||
|
|
||||||
mpspawn:
|
mpspawn:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (multiplayer player starting point)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
@@ -35,6 +37,8 @@ mpspawn:
|
|||||||
QuantizedFacings: 1
|
QuantizedFacings: 1
|
||||||
|
|
||||||
waypoint:
|
waypoint:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (waypoint for scripted behavior)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
@@ -50,6 +54,8 @@ waypoint:
|
|||||||
Palette: colorpicker
|
Palette: colorpicker
|
||||||
|
|
||||||
CAMERA:
|
CAMERA:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (reveals area to owner)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
WithSpriteBody:
|
WithSpriteBody:
|
||||||
RenderSpritesEditorOnly:
|
RenderSpritesEditorOnly:
|
||||||
@@ -64,6 +70,8 @@ CAMERA:
|
|||||||
Type: CenterPosition
|
Type: CenterPosition
|
||||||
|
|
||||||
CAMERA.small:
|
CAMERA.small:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (reveals small area to owner)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
WithSpriteBody:
|
WithSpriteBody:
|
||||||
RenderSpritesEditorOnly:
|
RenderSpritesEditorOnly:
|
||||||
|
|||||||
@@ -125,6 +125,8 @@ crate:
|
|||||||
CustomBounds: 20,20
|
CustomBounds: 20,20
|
||||||
|
|
||||||
mpspawn:
|
mpspawn:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (multiplayer player starting point)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
@@ -134,6 +136,8 @@ mpspawn:
|
|||||||
QuantizedFacings: 1
|
QuantizedFacings: 1
|
||||||
|
|
||||||
waypoint:
|
waypoint:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (waypoint for scripted behavior)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
@@ -151,6 +155,8 @@ waypoint:
|
|||||||
Palette: colorpicker
|
Palette: colorpicker
|
||||||
|
|
||||||
camera:
|
camera:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (reveals area to owner)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
RenderSpritesEditorOnly:
|
RenderSpritesEditorOnly:
|
||||||
WithSpriteBody:
|
WithSpriteBody:
|
||||||
@@ -165,6 +171,8 @@ camera:
|
|||||||
Type: CenterPosition
|
Type: CenterPosition
|
||||||
|
|
||||||
wormspawner:
|
wormspawner:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (worm spawning location)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
|
|||||||
@@ -332,6 +332,8 @@ U2:
|
|||||||
Inherits: ^Plane
|
Inherits: ^Plane
|
||||||
Health:
|
Health:
|
||||||
HP: 2000
|
HP: 2000
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: U2 Spy Plane
|
||||||
Armor:
|
Armor:
|
||||||
Type: Heavy
|
Type: Heavy
|
||||||
Aircraft:
|
Aircraft:
|
||||||
|
|||||||
@@ -207,6 +207,8 @@ HIND.Husk:
|
|||||||
|
|
||||||
U2.Husk:
|
U2.Husk:
|
||||||
Inherits: ^PlaneHusk
|
Inherits: ^PlaneHusk
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: Husk (U2 Spy Plane)
|
||||||
Aircraft:
|
Aircraft:
|
||||||
ROT: 7
|
ROT: 7
|
||||||
Speed: 373
|
Speed: 373
|
||||||
|
|||||||
@@ -118,6 +118,8 @@ HEALCRATE:
|
|||||||
Effect: heal
|
Effect: heal
|
||||||
|
|
||||||
CAMERA:
|
CAMERA:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (reveals area to owner)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
@@ -134,17 +136,23 @@ CAMERA:
|
|||||||
|
|
||||||
camera.paradrop:
|
camera.paradrop:
|
||||||
Inherits: CAMERA
|
Inherits: CAMERA
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (support power proxy camera)
|
||||||
RevealsShroud:
|
RevealsShroud:
|
||||||
Range: 6c0
|
Range: 6c0
|
||||||
|
|
||||||
camera.spyplane:
|
camera.spyplane:
|
||||||
Inherits: CAMERA
|
Inherits: CAMERA
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (support power proxy camera)
|
||||||
DetectCloaked:
|
DetectCloaked:
|
||||||
Range: 10c0
|
Range: 10c0
|
||||||
CloakTypes: Cloak, Hijacker
|
CloakTypes: Cloak, Hijacker
|
||||||
|
|
||||||
SONAR:
|
SONAR:
|
||||||
Inherits: camera.spyplane
|
Inherits: camera.spyplane
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (support power proxy camera)
|
||||||
-RevealsShroud:
|
-RevealsShroud:
|
||||||
DetectCloaked:
|
DetectCloaked:
|
||||||
CloakTypes: Underwater
|
CloakTypes: Underwater
|
||||||
@@ -307,6 +315,8 @@ aircraft.upgraded:
|
|||||||
ProvidesPrerequisite:
|
ProvidesPrerequisite:
|
||||||
|
|
||||||
mpspawn:
|
mpspawn:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (multiplayer player starting point)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
@@ -316,6 +326,8 @@ mpspawn:
|
|||||||
QuantizedFacings: 1
|
QuantizedFacings: 1
|
||||||
|
|
||||||
waypoint:
|
waypoint:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (waypoint for scripted behavior)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
|
|||||||
@@ -724,6 +724,8 @@
|
|||||||
QuantizedFacings: 1
|
QuantizedFacings: 1
|
||||||
|
|
||||||
^Railway:
|
^Railway:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: Railway
|
||||||
Inherits: ^TerrainOverlay
|
Inherits: ^TerrainOverlay
|
||||||
|
|
||||||
^Tunnel:
|
^Tunnel:
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
mpspawn:
|
mpspawn:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (multiplayer player starting point)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
@@ -8,6 +10,8 @@ mpspawn:
|
|||||||
QuantizedFacings: 1
|
QuantizedFacings: 1
|
||||||
|
|
||||||
waypoint:
|
waypoint:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (waypoint for scripted behavior)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
Immobile:
|
Immobile:
|
||||||
OccupiesSpace: false
|
OccupiesSpace: false
|
||||||
@@ -32,6 +36,8 @@ waypoint:
|
|||||||
Palette: colorpicker
|
Palette: colorpicker
|
||||||
|
|
||||||
CAMERA:
|
CAMERA:
|
||||||
|
EditorOnlyTooltip:
|
||||||
|
Name: (reveals area to owner)
|
||||||
AlwaysVisible:
|
AlwaysVisible:
|
||||||
RenderSpritesEditorOnly:
|
RenderSpritesEditorOnly:
|
||||||
WithSpriteBody:
|
WithSpriteBody:
|
||||||
|
|||||||
Reference in New Issue
Block a user