-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathPrefab.cs
More file actions
57 lines (49 loc) · 3.47 KB
/
Copy pathPrefab.cs
File metadata and controls
57 lines (49 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using Bannerlord.UIExtenderEx.Attributes;
using Bannerlord.UIExtenderEx.Prefabs2;
using System.Collections.Generic;
namespace BetterTime
{
public class Prefab
{
// Replace the Center Panel with a stretched version to fit the Extra Fast Forward button.
[PrefabExtension("MapBar", "descendant::MapCurrentTimeVisualWidget")]
public class PrefabCenterPanel : PrefabExtensionInsertPatch
{
public override InsertType Type => InsertType.ReplaceKeepChildren;
[PrefabExtensionText(true)]
public string Text => "<DiscardedRoot><TimePanel DataSource=\"{MapTimeControl}\" Id=\"CenterPanel\" VisualDefinition=\"CenterPanel\" WidthSizePolicy=\"Fixed\" HeightSizePolicy=\"Fixed\" SuggestedWidth=\"500\" SuggestedHeight=\"59\" HorizontalAlignment=\"Center\" VerticalAlignment=\"Bottom\" Sprite=\"MapBar\\mapbar_center_frame\" CurrentTimeState=\"@TimeFlowState\" FastFastForwardButton=\"FastFastForwardButton\" FastForwardButton=\"FastForwardButton\" IsEnabled=\"@IsCenterPanelEnabled\" PauseButton=\"PauseButton\" PlayButton=\"PlayButton\"></TimePanel></DiscardedRoot>";
}
// Reposition the date due to the stretched Center Panel.
[PrefabExtension("MapBar", "descendant::TimePanel/Children/TextWidget")]
public class PrefabDate : PrefabExtensionSetAttributePatch
{
public override List<Attribute> Attributes => new List<Attribute> { new Attribute("SuggestedWidth", "220"), new Attribute("PositionXOffset", "15") };
}
// Add the Extra Fast Forward button to the Center Panel.
[PrefabExtension("MapBar", "descendant::TimePanel/Children/ButtonWidget[@Id='FastForwardButton']")]
public class PrefabFastFastForwardButton : PrefabExtensionInsertPatch
{
public override InsertType Type => InsertType.Prepend;
[PrefabExtensionText]
public string Text => "<ButtonWidget Id=\"FastFastForwardButton\" WidthSizePolicy=\"Fixed\" HeightSizePolicy=\"Fixed\" SuggestedWidth=\"35\" SuggestedHeight=\"24\" HorizontalAlignment=\"Right\" VerticalAlignment=\"Bottom\" PositionXOffset=\"-62\" PositionYOffset=\"-13\" Brush=\"MapBarFastForwardButton\" Command.Click=\"ExecuteTimeControlChange\" CommandParameter.Click=\"2\"><Children><HintWidget DataSource=\"{FastFastForwardHint}\" WidthSizePolicy=\"StretchToParent\" HeightSizePolicy=\"StretchToParent\" Command.HoverBegin=\"ExecuteBeginHint\" Command.HoverEnd=\"ExecuteEndHint\" IsDisabled=\"true\" /></Children></ButtonWidget>";
}
// Reposition the Fast Forward button due to the stretched Center Panel.
[PrefabExtension("MapBar", "descendant::TimePanel/Children/ButtonWidget[@Id='FastForwardButton']")]
public class PrefabFastForwardButton : PrefabExtensionSetAttributePatch
{
public override List<Attribute> Attributes => new List<Attribute> { new Attribute("PositionXOffset", "-105") };
}
// Reposition the Play button due to the stretched Center Panel.
[PrefabExtension("MapBar", "descendant::TimePanel/Children/ButtonWidget[@Id='PlayButton']")]
public class PrefabPlayButton : PrefabExtensionSetAttributePatch
{
public override List<Attribute> Attributes => new List<Attribute> { new Attribute("PositionXOffset", "-145") };
}
// Reposition the Pause button due to the stretched Center Panel.
[PrefabExtension("MapBar", "descendant::TimePanel/Children/ButtonWidget[@Id='PauseButton']")]
public class PrefabPauseButton : PrefabExtensionSetAttributePatch
{
public override List<Attribute> Attributes => new List<Attribute> { new Attribute("PositionXOffset", "-185") };
}
}
}