Skip to content

Commit

Permalink
Bugfix/fallthrough attributes causing problems (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
araszka authored Jun 9, 2024
1 parent 91610d0 commit a01520e
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/EvoSC.Manialinks/EvoSC.Manialinks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ManiaTemplates" Version="0.0.22-alpha" />
<PackageReference Include="ManiaTemplates" Version="0.0.24-alpha" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/EvoSC.Manialinks/Templates/Containers/Window.mt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ The window is designed to only be used once per Manialink.

<IconButton className="evosc-window-closebtn"
id="btnClose-{{ id }}"
dataId="{{ id }}"
icon="{{ Icons.Close }}"
style="round"
type="accent"
Expand Down
12 changes: 4 additions & 8 deletions src/EvoSC.Manialinks/Templates/Controls/Button.mt
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@
radius='{{ style == "normal" ? 0.5 : Theme.UI_Button_Size(size, height)/2 }}'
color='{{ disabled ? Theme.UI_Button_Disabled_Bg : Theme.UI_Button_Bg(type) }}'
quadrant="TopLeft"
scriptevents="{{ disabled ? 0 : 1 }}"
scriptevents="{{ !disabled }}"
data-id="{{ id }}"
enableScriptEvents="true"
/>

<QuarterCircle
Expand All @@ -105,9 +104,8 @@
color='{{ disabled ? Theme.UI_Button_Disabled_Bg : Theme.UI_Button_Bg(type) }}'
quadrant="TopRight"
x='{{ width-(style == "normal" ? 0.5 : Theme.UI_Button_Size(size, height)/2) }}'
scriptevents="{{ disabled ? 0 : 1 }}"
scriptevents="{{ !disabled }}"
data-id="{{ id }}"
enableScriptEvents="true"
/>

<QuarterCircle
Expand All @@ -116,9 +114,8 @@
color='{{ disabled ? Theme.UI_Button_Disabled_Bg : Theme.UI_Button_Bg(type) }}'
quadrant="BottomLeft"
y='{{ -Theme.UI_Button_Size(size, height)+(style == "normal" ? 0.5 : Theme.UI_Button_Size(size, height)/2) }}'
scriptevents="{{ disabled ? 0 : 1 }}"
scriptevents="{{ !disabled }}"
data-id="{{ id }}"
enableScriptEvents="true"
/>

<QuarterCircle
Expand All @@ -128,9 +125,8 @@
quadrant="BottomRight"
x='{{ width-(style == "normal" ? 0.5 : Theme.UI_Button_Size(size, height)/2) }}'
y='{{ -Theme.UI_Button_Size(size, height)+(style == "normal" ? 0.5 : Theme.UI_Button_Size(size, height)/2) }}'
scriptevents="{{ disabled ? 0 : 1 }}"
scriptevents="{{ !disabled }}"
data-id="{{ id }}"
enableScriptEvents="true"
/>

<!-- Text -->
Expand Down
2 changes: 1 addition & 1 deletion src/EvoSC.Manialinks/Templates/Controls/Switch.mt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
width="10"
height="5"
scriptEvents="true"
dataid="{{ id }}"
dataId="{{ id }}"
cornerRadius="0.5"
/>
<Panel className='evosc-toggleswitch'
Expand Down
2 changes: 1 addition & 1 deletion src/EvoSC.Manialinks/Templates/Drawing/Circle.mt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Draws a circle.
-->
<component>
<!-- Unique identifier of the circle -->
<property type="string" name="id" default="evosc_rectangle" />
<property type="string" name="id" default="evosc_circle" />

<!-- Radius of the circle -->
<property type="double" name="radius" />
Expand Down
10 changes: 5 additions & 5 deletions src/EvoSC.Manialinks/Templates/Drawing/QuarterCircle.mt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Draws a quarter of a circle from different quadrants.
<property type="string" name="color" />

<!-- Enable/disable script events for the quarter -->
<property type="bool" name="scriptEvents" default="false" />
<property type="bool" name="scriptevents" default="false" />

<!-- Action to trigger when mouse is clicked on the quarter -->
<property type="string" name="action" default="" />
Expand All @@ -36,7 +36,7 @@ Draws a quarter of a circle from different quadrants.
if='quadrant == "TopLeft"'
opacity="{{ Util.ColorOpacity(color) }}"
class="{{ className }}"
scriptevents="{{ scriptEvents ? 1 : 0 }}"
scriptevents="{{ scriptevents ? 1 : 0 }}"
/>

<quad
Expand All @@ -47,7 +47,7 @@ Draws a quarter of a circle from different quadrants.
if='quadrant == "TopRight"'
opacity="{{ Util.ColorOpacity(color) }}"
class="{{ className }}"
scriptevents="{{ scriptEvents ? 1 : 0 }}"
scriptevents="{{ scriptevents ? 1 : 0 }}"
/>

<quad
Expand All @@ -58,7 +58,7 @@ Draws a quarter of a circle from different quadrants.
if='quadrant == "BottomLeft"'
opacity="{{ Util.ColorOpacity(color) }}"
class="{{ className }}"
scriptevents="{{ scriptEvents ? 1 : 0 }}"
scriptevents="{{ scriptevents ? 1 : 0 }}"
/>

<quad
Expand All @@ -69,7 +69,7 @@ Draws a quarter of a circle from different quadrants.
if='quadrant == "BottomRight"'
opacity="{{ Util.ColorOpacity(color) }}"
class="{{ className }}"
scriptevents="{{ scriptEvents ? 1 : 0 }}"
scriptevents="{{ scriptevents ? 1 : 0 }}"
/>
</frame>
</template>
Expand Down
8 changes: 4 additions & 4 deletions src/EvoSC.Manialinks/Templates/Drawing/Rectangle.mt
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ Draws a rectangle.
>
<frame>
<frame if="cornerRadius > 0">
<QuarterCircle scriptevents="{{ scriptEvents ? 1 : 0 }}" if='Util.HasItem(corners, "TopLeft")' quadrant="TopLeft" radius="{{ cornerRadius }}" x="0" y="0" color="{{ bgColor }}" data-id="{{ dataId }}" />
<QuarterCircle scriptevents="{{ scriptEvents ? 1 : 0 }}" if='Util.HasItem(corners, "TopRight")' quadrant="TopRight" radius="{{ cornerRadius }}" x="{{ width-cornerRadius }}" y="0" color="{{ bgColor }}" data-id="{{ dataId }}" />
<QuarterCircle scriptevents="{{ scriptEvents ? 1 : 0 }}" if='Util.HasItem(corners, "BottomLeft")' quadrant="BottomLeft" radius="{{ cornerRadius }}" x="0" y="-{{ height-cornerRadius }}" color="{{ bgColor }}" data-id="{{ dataId }}" />
<QuarterCircle scriptevents="{{ scriptEvents ? 1 : 0 }}" if='Util.HasItem(corners, "BottomRight")' quadrant="BottomRight" radius="{{ cornerRadius }}" x="{{ width-cornerRadius }}" y="-{{ height-cornerRadius }}" color="{{ bgColor }}" data-id="{{ dataId }}" />
<QuarterCircle scriptevents="{{ scriptEvents }}" if='Util.HasItem(corners, "TopLeft")' quadrant="TopLeft" radius="{{ cornerRadius }}" x="0" y="0" color="{{ bgColor }}" data-id="{{ dataId }}" />
<QuarterCircle scriptevents="{{ scriptEvents }}" if='Util.HasItem(corners, "TopRight")' quadrant="TopRight" radius="{{ cornerRadius }}" x="{{ width-cornerRadius }}" y="0" color="{{ bgColor }}" data-id="{{ dataId }}" />
<QuarterCircle scriptevents="{{ scriptEvents }}" if='Util.HasItem(corners, "BottomLeft")' quadrant="BottomLeft" radius="{{ cornerRadius }}" x="0" y="-{{ height-cornerRadius }}" color="{{ bgColor }}" data-id="{{ dataId }}" />
<QuarterCircle scriptevents="{{ scriptEvents }}" if='Util.HasItem(corners, "BottomRight")' quadrant="BottomRight" radius="{{ cornerRadius }}" x="{{ width-cornerRadius }}" y="-{{ height-cornerRadius }}" color="{{ bgColor }}" data-id="{{ dataId }}" />
</frame>

<!-- Top -->
Expand Down
12 changes: 6 additions & 6 deletions src/EvoSC.Manialinks/Templates/Scripts/Button.ms
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ Void HighlightButton(Text _Id, Boolean _Highlight, Text _ButtonType) {
foreach (buttonPart in Page.GetClassChildren_Result) {
declare part <=> buttonPart as CMlQuad;

declare ColorFocus = {{ Color.ToMlColor(Theme.UI_Button_Default_BgFocus) }};
declare ColorNormal = {{ Color.ToMlColor(Theme.UI_Button_Default_Bg) }};
declare ColorFocus = {! Color.ToMlColor(Theme.UI_Button_Default_BgFocus) !};
declare ColorNormal = {! Color.ToMlColor(Theme.UI_Button_Default_Bg) !};

if (_ButtonType == "secondary") {
ColorFocus = {{ Color.ToMlColor(Theme.UI_Button_Secondary_BgFocus) }};
ColorNormal = {{ Color.ToMlColor(Theme.UI_Button_Secondary_Bg) }};
ColorFocus = {! Color.ToMlColor(Theme.UI_Button_Secondary_BgFocus) !};
ColorNormal = {! Color.ToMlColor(Theme.UI_Button_Secondary_Bg) !};
} else if (_ButtonType == "accent") {
ColorFocus = {{ Color.ToMlColor(Theme.UI_Button_Accent_BgFocus) }};
ColorNormal = {{ Color.ToMlColor(Theme.UI_Button_Accent_Bg) }};
ColorFocus = {! Color.ToMlColor(Theme.UI_Button_Accent_BgFocus) !};
ColorNormal = {! Color.ToMlColor(Theme.UI_Button_Accent_Bg) !};
}

if (_Highlight) {
Expand Down
4 changes: 2 additions & 2 deletions src/EvoSC.Manialinks/Templates/Scripts/Switch.ms
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ Void SetSwitchState(Text idName, Boolean value) {
icon.SetText("{{ Icons.Check }}");
AnimMgr.Add(head, """<quad pos='5 0' />""", 250, CAnimManager::EAnimManagerEasing::ExpOut);
AnimMgr.Add(icon, """<label pos='7.5 -2.1' />""", 250, CAnimManager::EAnimManagerEasing::ExpOut);
icon.TextColor = {{ Color.ToMlColor(Theme.Green) }};
icon.TextColor = {! Color.ToMlColor(Theme.Green) !};
entry.SetText("True", False);
} else {
AnimMgr.Add(head, """<quad pos='0 0' />""", 250, CAnimManager::EAnimManagerEasing::ExpOut);
AnimMgr.Add(icon, """<label pos='2.5 -2.1' />""", 250, CAnimManager::EAnimManagerEasing::ExpOut);
icon.SetText("{{ Icons.Close }}");
icon.TextColor = {{ Color.ToMlColor(Theme.Red) }};
icon.TextColor = {! Color.ToMlColor(Theme.Red) !};
entry.SetText("False", False);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Modules/Scoreboard/Templates/Scoreboard.mt
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@
CurrentScoreMode = -1;
SettingsVisible = False;

{{ string.Join("\n", PositionColors.Select(pc => $"PositionColors[{pc.Key}] = \"{pc.Value}\";")) }}
{! string.Join("\n", PositionColors.Select(pc => $"PositionColors[{pc.Key}] = \"{pc.Value}\";")) !}
***

*** OnLoop ***
Expand Down

0 comments on commit a01520e

Please sign in to comment.