Skip to content

Commit

Permalink
add link
Browse files Browse the repository at this point in the history
  • Loading branch information
EFLFE committed Aug 14, 2022
1 parent 713c33a commit 6663bfb
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Artorio/About.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
xmlns:local="clr-namespace:Artorio"
mc:Ignorable="d"
ResizeMode="NoResize"
Title="About" Height="172.637" Width="415.604">
Title="About" Height="205" Width="415.604">
<Grid>
<Image HorizontalAlignment="Left" Width="32" Height="32" Margin="10,10,0,0" VerticalAlignment="Top" Source="Resources/Icon.ico"/>
<TextBlock HorizontalAlignment="Left" Margin="47,10,0,0" TextWrapping="Wrap" Text="Artorio - convert image to factorio blueprint format. By EFLFE" VerticalAlignment="Top"/>
Expand All @@ -15,6 +15,7 @@
<TextBlock HorizontalAlignment="Left" Margin="10,73,0,0" TextWrapping="Wrap" Text="External libraries:" VerticalAlignment="Top"/>
<TextBlock x:Name="pngcs" HorizontalAlignment="Left" Margin="10,94,0,0" TextWrapping="Wrap" Text="* Pngcs: " VerticalAlignment="Top"/>
<TextBlock x:Name="zlib" HorizontalAlignment="Left" Margin="10,111,0,0" TextWrapping="Wrap" Text="* zlib.net: " VerticalAlignment="Top"/>
<TextBlock x:Name="colorPicker" HorizontalAlignment="Left" Margin="10,128,0,0" TextWrapping="Wrap" Text="* ColorPicker: " VerticalAlignment="Top"/>

</Grid>
</Window>
1 change: 1 addition & 0 deletions Artorio/About.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public About()
InsertLink("https://github.com/EFLFE/Artorio", githubLink);
InsertLink("https://github.com/leonbloy/pngcs", pngcs);
InsertLink("http://www.componentace.com/zlib_.NET.htm", zlib);
InsertLink("https://github.com/PixiEditor/ColorPicker", colorPicker);
}

private void InsertLink(string link, TextBlock target)
Expand Down
54 changes: 54 additions & 0 deletions Artorio/CountTextAnimation.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
using System;
using System.Windows.Controls;
using System.Windows.Threading;

namespace Artorio
{
internal class CountTextAnimation
{
private TextBlock textBlock;
private DispatcherTimer timer;
private float targetValue;
private float currentValue;
private float timeLerp;
private string displayText;

private const float timeSpeed = 0.03f;

public CountTextAnimation(TextBlock textBlock, Dispatcher dispatcher, string displayText)
{
timeLerp = 1f;
this.displayText = displayText;
this.textBlock = textBlock;
timer = new DispatcherTimer(TimeSpan.FromSeconds(0.01), DispatcherPriority.Background, Tick, dispatcher);
}

public void SetTarget(int value, string displayText = null)
{
if (displayText != null)
this.displayText = displayText;

targetValue = value;
timeLerp = 0f;
timer.Start();
}

private void Tick(object s, EventArgs e)
{
if (timeLerp >= 1f)
{
timer.Stop();
return;
}

timeLerp += timeSpeed;

if (timeLerp > 1f)
timeLerp = 1f;

currentValue += timeLerp * (targetValue - currentValue);
textBlock.Text = displayText.Replace("#", Math.Round(currentValue).ToString());
}

}
}
1 change: 0 additions & 1 deletion Artorio/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ private IEnumerable<ColorItemCast> ForeachColorItemCast()

for (int i = 0; i < configStack.Children.Count - 1; i++)
{
// TODO: Optimize
yield return (ColorItemCast)configStack.Children[i];
}
}
Expand Down

0 comments on commit 6663bfb

Please sign in to comment.