Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an liquid amount dropdown to liquid mode. #1867

Merged
merged 7 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion src/TEdit/Editor/PaintMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,32 @@ public enum JunctionBoxMode : short
Right = 36
}

public enum LiquidAmountMode : byte
{
[Description("0%")]
ZeroPercent = 0x0,
[Description("10%")]
TenPercent = 0x1A,
[Description("20%")]
TwentyPercent = 0x33,
[Description("30%")]
ThirtyPercent = 0x4D,
[Description("40%")]
FourtyPercent = 0x66,
[Description("50%")]
FiftyPercent = 0x80,
[Description("60%")]
SixtyPercent = 0x99,
[Description("70%")]
SeventyPercent = 0xB3,
[Description("80%")]
EightyPercent = 0xCC,
[Description("90%")]
NinteyPercent = 0xE6,
[Description("100%")]
OneHundredPercent = 0xFF
}

[Flags]
public enum WireReplaceMode : byte
{
Expand All @@ -54,4 +80,4 @@ public enum WireReplaceMode : byte
[Description("Yellow")]
Yellow= 0b1000
}
}
}
7 changes: 6 additions & 1 deletion src/TEdit/Editor/TilePicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class TilePicker : ObservableObject
private bool _wallStyleActive = ToolDefaultData.PaintWallActive;
private TrackMode _trackMode = TrackMode.Track;
private JunctionBoxMode _junctionboxMode = JunctionBoxMode.None;
private LiquidAmountMode _liquidAmountMode = LiquidAmountMode.OneHundredPercent;

private WireReplaceMode _wireReplaceModeRed = WireReplaceMode.Red;
private WireReplaceMode _wireReplaceModeBlue = WireReplaceMode.Blue;
Expand Down Expand Up @@ -105,7 +106,11 @@ public WireReplaceMode WireReplaceModeYellow
set { Set(nameof(WireReplaceModeYellow), ref _wireReplaceModeYellow, value); }
}


public LiquidAmountMode LiquidAmountMode
{
get { return _liquidAmountMode; }
set { Set(nameof(LiquidAmountMode), ref _liquidAmountMode, value); }
}

public bool WallCoatingIlluminant
{
Expand Down
28 changes: 27 additions & 1 deletion src/TEdit/Editor/Tools/PickerTool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,32 @@ private void PickTile(int x, int y)
{
_wvm.TilePicker.JunctionBoxMode = JunctionBoxMode.Right;
}

// Get Picker For Liquid Amount.
if (curTile.LiquidAmount == 0)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.ZeroPercent;
else if (curTile.LiquidAmount <= 0x1A)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.TenPercent;
else if (curTile.LiquidAmount <= 0x33)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.TwentyPercent;
else if (curTile.LiquidAmount <= 0x4D)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.ThirtyPercent;
else if (curTile.LiquidAmount <= 0x66)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.FourtyPercent;
else if (curTile.LiquidAmount <= 0x80)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.FiftyPercent;
else if (curTile.LiquidAmount <= 0x99)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.SixtyPercent;
else if (curTile.LiquidAmount <= 0xB3)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.SeventyPercent;
else if (curTile.LiquidAmount <= 0xCC)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.EightyPercent;
else if (curTile.LiquidAmount <= 0xE6)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.NinteyPercent;
else if (curTile.LiquidAmount <= 0xFF)
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.OneHundredPercent;
else
_wvm.TilePicker.LiquidAmountMode = LiquidAmountMode.OneHundredPercent;
}

private void PickmaskTile(int x, int y)
Expand All @@ -93,4 +119,4 @@ private void PickmaskTile(int x, int y)
_wvm.TilePicker.WallMask = curTile.Wall;
}
}
}
}
27 changes: 18 additions & 9 deletions src/TEdit/Properties/Language.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/TEdit/Properties/Language.ar-BH.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1347,4 +1347,7 @@
<data name="tool_paint_illuminantcoating" xml:space="preserve">
<value>مضيئة</value>
</data>
<data name="liquid_amount" xml:space="preserve">
<value>الكمية السائلة:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TEdit/Properties/Language.de-DE.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1347,4 +1347,7 @@ Klicke auf „Wiederholen“, um einen neuen Ordner auszuwählen, oder auf „Ab
<data name="tool_paint_illuminantcoating" xml:space="preserve">
<value>Leuchtmittel</value>
</data>
<data name="liquid_amount" xml:space="preserve">
<value>Flüssigkeitsmenge:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TEdit/Properties/Language.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1347,4 +1347,7 @@ Press retry to pick a new folder or cancel to use {0} as your terraria path.</va
<data name="tool_paint_illuminantcoating" xml:space="preserve">
<value>Illuminant</value>
</data>
<data name="liquid_amount" xml:space="preserve">
<value>Liquid Amount:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TEdit/Properties/Language.pl-PL.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1347,4 +1347,7 @@ Naciśnij spróbuj ponownie aby wybrać nowy folder lub anuluj aby użyć {0} ja
<data name="tool_paint_illuminantcoating" xml:space="preserve">
<value>Oświetlenie</value>
</data>
<data name="liquid_amount" xml:space="preserve">
<value>Płynna ilość:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TEdit/Properties/Language.pt-BR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1347,4 +1347,7 @@ Clique em tentar novamente para escolher uma nova pasta ou cancelar para usar {0
<data name="tool_paint_illuminantcoating" xml:space="preserve">
<value>Iluminante</value>
</data>
<data name="liquid_amount" xml:space="preserve">
<value>Quantidade Líquida:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TEdit/Properties/Language.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1350,4 +1350,7 @@ Press retry to pick a new folder or cancel to use {0} as your terraria path.</va
<value>Illuminant</value>
<comment>Illuminant</comment>
</data>
<data name="liquid_amount" xml:space="preserve">
<value>Liquid Amount:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TEdit/Properties/Language.ru-RU.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1347,4 +1347,7 @@
<data name="tool_paint_illuminantcoating" xml:space="preserve">
<value>Источник света</value>
</data>
<data name="liquid_amount" xml:space="preserve">
<value>Количество жидкости:</value>
</data>
</root>
3 changes: 3 additions & 0 deletions src/TEdit/Properties/Language.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1347,4 +1347,7 @@
<data name="tool_paint_illuminantcoating" xml:space="preserve">
<value>光源</value>
</data>
<data name="liquid_amount" xml:space="preserve">
<value>液体量:</value>
</data>
</root>
3 changes: 2 additions & 1 deletion src/TEdit/Themes/Templates.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<enum:EnumItemList x:Key="HalfBlockMode" ResourceType="{x:Type p:Language}" EnumType="{x:Type Editor:HalfBlockMode}" x:Shared="false" SortBy="Value" />
<enum:EnumItemList x:Key="BrickStyle" ResourceType="{x:Type p:Language}" EnumType="{x:Type Terraria:BrickStyle}" x:Shared="false" SortBy="Value" />
<enum:EnumItemList x:Key="LiquidType" ResourceType="{x:Type p:Language}" EnumType="{x:Type Terraria:LiquidType}" x:Shared="false" SortBy="Value" />
<enum:EnumItemList x:Key="LiquidAmountEnum" ResourceType="{x:Type p:Language}" EnumType="{x:Type Editor:LiquidAmountMode}" SortBy="Value" />
<enum:EnumItemList x:Key="WireReplaceModeEnum" ResourceType="{x:Type p:Language}" EnumType="{x:Type Editor:WireReplaceMode}" SortBy="Value" />

<DataTemplate x:Key="ColorPickerTemplate" >
Expand Down Expand Up @@ -97,4 +98,4 @@
</CollectionViewSource.SortDescriptions>
</CollectionViewSource>

</ResourceDictionary>
</ResourceDictionary>
3 changes: 3 additions & 0 deletions src/TEdit/View/Popups/NotificationsWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<ListItem>
<Paragraph>Fixed the checkbox for old Chinese world formats.</Paragraph>
</ListItem>
<ListItem>
<Paragraph>Added an liquid amount dropdown to liquids.</Paragraph>
</ListItem>
</List>

<Paragraph>Version 4.15</Paragraph>
Expand Down
7 changes: 6 additions & 1 deletion src/TEdit/View/TopPanel/PaintModeView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,16 @@
</tedit:AutoGrid>
</GroupBox>
<GroupBox Header="Liquid" Style="{StaticResource LiquidVisibleStyle}">
<StackPanel Orientation="Horizontal" VerticalAlignment="Top">
<StackPanel VerticalAlignment="Top">
<ComboBox ItemsSource="{StaticResource LiquidType}"
SelectedValue="{Binding TilePicker.LiquidType}"
SelectedValuePath="Value" Width="100"
ItemTemplate="{StaticResource EnumTemplate}" />
<TextBlock Text="{x:Static p:Language.liquid_amount}" HorizontalAlignment="Left"/>
<ComboBox ItemsSource="{StaticResource LiquidAmountEnum}"
SelectedValue="{Binding TilePicker.LiquidAmountMode}"
SelectedValuePath="Value" Width="100"
ItemTemplate="{StaticResource EnumTemplate}" />
</StackPanel>
</GroupBox>
<GroupBox Style="{StaticResource BrickStyleVisiblity}">
Expand Down
2 changes: 1 addition & 1 deletion src/TEdit/ViewModel/WorldViewModel.Editor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ public void SetPixel(int x, int y, PaintMode? mode = null, bool? erase = null)
case PaintMode.Liquid:
SetPixelAutomatic(
curTile,
liquid: (isErase || TilePicker.LiquidType == LiquidType.None) ? (byte)0 : (byte)255,
liquid: (isErase || TilePicker.LiquidType == LiquidType.None) ? (byte)0 : (byte)TilePicker.LiquidAmountMode,
liquidType: TilePicker.LiquidType);
break;
case PaintMode.Track:
Expand Down
Loading