[feature] 修改隨機點名
This commit is contained in:
parent
0b798cea4f
commit
351bd87791
@ -12,19 +12,19 @@
|
||||
<Border Background="#F0F3F9" CornerRadius="10" BorderThickness="1" BorderBrush="#0066BF" Margin="0" ClipToBounds="True">
|
||||
<Canvas>
|
||||
<Image Source="/Resources/hatsune-miku1.png" Width="300" Canvas.Bottom="-140" Canvas.Left="-48" Canvas.Top="314"></Image>
|
||||
<Grid Canvas.Left="0" Canvas.Right="0" Canvas.Top="0" Canvas.Bottom="0" Width="900" Height="300">
|
||||
<Grid Canvas.Left="0" Canvas.Right="0" Canvas.Top="0" Canvas.Bottom="0" Width="900" Height="309" HorizontalAlignment="Center" VerticalAlignment="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.8*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Viewbox HorizontalAlignment="Center" Margin="20,0">
|
||||
<ui:SimpleStackPanel Orientation="Horizontal" Spacing="50" MinHeight="470">
|
||||
<Label Name="LabelOutput" FontSize="110" Content="" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Label Name="LabelOutput2" FontSize="110" Visibility="Collapsed" Content="" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Label Name="LabelOutput3" FontSize="110" Visibility="Collapsed" Content="" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Label Name="LabelOutput" FontSize="130" Content="" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Label Name="LabelOutput2" FontSize="130" Visibility="Collapsed" Content="" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Label Name="LabelOutput3" FontSize="130" Visibility="Collapsed" Content="" Block.TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</ui:SimpleStackPanel>
|
||||
</Viewbox>
|
||||
<ui:SimpleStackPanel Spacing="50" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center">
|
||||
<ui:SimpleStackPanel Spacing="50" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Center" Opacity="1" Name="PeopleControlPane">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<Border x:Name="BorderBtnMinus" MouseUp="BorderBtnMinus_MouseUp" Background="#FBFBFD" Height="70" Width="70" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
@ -34,7 +34,7 @@
|
||||
<ui:SymbolIcon Symbol="Remove" Foreground="Black"/>
|
||||
</Viewbox>
|
||||
</Border>
|
||||
<Label Name="LabelNumberCount" Content="1" FontFamily="Segeo UI" FontSize="55" Margin="30"/>
|
||||
<TextBlock Name="LabelNumberCount" Text="1" FontFamily="Consolas" FontSize="55" Margin="10" Width="80" TextAlignment="Center"/>
|
||||
<Border x:Name="BorderBtnAdd" MouseUp="BorderBtnAdd_MouseUp" Background="#FBFBFD" Height="70" Width="70" CornerRadius="100">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect Direction="0" ShadowDepth="0" Opacity="0.15" BlurRadius="3"/>
|
||||
|
@ -22,6 +22,8 @@ namespace Ink_Canvas {
|
||||
public RandWindow(bool IsAutoClose) {
|
||||
InitializeComponent();
|
||||
isAutoClose = IsAutoClose;
|
||||
PeopleControlPane.Opacity = 0.4;
|
||||
PeopleControlPane.IsHitTestVisible = false;
|
||||
|
||||
new Thread(new ThreadStart(() => {
|
||||
Thread.Sleep(100);
|
||||
@ -40,21 +42,29 @@ namespace Ink_Canvas {
|
||||
public List<string> Names = new List<string>();
|
||||
|
||||
private void BorderBtnAdd_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (TotalCount >= PeopleCount) return;
|
||||
if (RandMaxPeopleOneTime == -1 && TotalCount >= PeopleCount) return;
|
||||
if (RandMaxPeopleOneTime != -1 && TotalCount >= RandMaxPeopleOneTime) return;
|
||||
TotalCount++;
|
||||
LabelNumberCount.Content = TotalCount.ToString();
|
||||
LabelNumberCount.Text = TotalCount.ToString();
|
||||
SymbolIconStart.Symbol = Symbol.People;
|
||||
BorderBtnAdd.Opacity = 1;
|
||||
BorderBtnMinus.Opacity = 1;
|
||||
}
|
||||
|
||||
private void BorderBtnMinus_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
if (TotalCount < 2) return;
|
||||
TotalCount--;
|
||||
LabelNumberCount.Content = TotalCount.ToString();
|
||||
LabelNumberCount.Text = TotalCount.ToString();
|
||||
if (TotalCount == 1) {
|
||||
SymbolIconStart.Symbol = Symbol.Contact;
|
||||
}
|
||||
}
|
||||
|
||||
public int RandWaitingTimes = 20;
|
||||
public int RandWaitingThreadSleepTime = 50;
|
||||
public int RandMaxPeopleOneTime = 10;
|
||||
public int RandDoneAutoCloseWaitTime = 2500;
|
||||
|
||||
private void BorderBtnRand_MouseUp(object sender, MouseButtonEventArgs e) {
|
||||
Random random = new Random();// randSeed + DateTime.Now.Millisecond / 10 % 10);
|
||||
string outputString = "";
|
||||
@ -66,7 +76,7 @@ namespace Ink_Canvas {
|
||||
BorderBtnRandCover.Visibility = Visibility.Visible;
|
||||
|
||||
new Thread(new ThreadStart(() => {
|
||||
for (int i = 0; i < 5; i++) {
|
||||
for (int i = 0; i < RandWaitingTimes; i++) {
|
||||
int rand = random.Next(1, PeopleCount + 1);
|
||||
while (rands.Contains(rand)) {
|
||||
rand = random.Next(1, PeopleCount + 1);
|
||||
@ -81,7 +91,7 @@ namespace Ink_Canvas {
|
||||
}
|
||||
});
|
||||
|
||||
Thread.Sleep(150);
|
||||
Thread.Sleep(RandWaitingThreadSleepTime);
|
||||
}
|
||||
|
||||
rands = new List<int>();
|
||||
@ -139,8 +149,10 @@ namespace Ink_Canvas {
|
||||
|
||||
if (isAutoClose) {
|
||||
new Thread(new ThreadStart(() => {
|
||||
Thread.Sleep(1500);
|
||||
Thread.Sleep(RandDoneAutoCloseWaitTime);
|
||||
Application.Current.Dispatcher.Invoke(() => {
|
||||
PeopleControlPane.Opacity = 1;
|
||||
PeopleControlPane.IsHitTestVisible = true;
|
||||
Close();
|
||||
});
|
||||
})).Start();
|
||||
|
Loading…
Reference in New Issue
Block a user