画线 加声音
|
@ -5,16 +5,18 @@ using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using CDSAE3_Lian_Lian_Kan;
|
using CDSAE3_Lian_Lian_Kan;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
|
||||||
namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
{
|
{
|
||||||
public partial class Board
|
public partial class Board
|
||||||
{
|
{
|
||||||
public Board() {
|
public int[,] Bd { get; set; } = { { } };//y,x
|
||||||
}
|
public Dictionary<int, List<(int, int)>> board_Index { get; } = new Dictionary<int, List<(int, int)>>();
|
||||||
public int[,]? Bd { get; set; } = null;//y,x
|
public int[] Vals_per_Image { get; set; } = { };
|
||||||
public int[]? vals_per_Image = null;
|
|
||||||
public int total;
|
public int total;
|
||||||
public int Total { get
|
public int Total
|
||||||
|
{
|
||||||
|
get
|
||||||
{
|
{
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +25,8 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
total = value;
|
total = value;
|
||||||
if (total == 0)
|
if (total == 0)
|
||||||
Settings.game_mode_form?.Finished_Handler(this, new Forms.FinishArgs { finish_Type = Forms.FinishArgs.Finish_Type.All_done });
|
Settings.game_mode_form?.Finished_Handler(this, new Forms.FinishArgs { finish_Type = Forms.FinishArgs.Finish_Type.All_done });
|
||||||
} }
|
}
|
||||||
|
}
|
||||||
public void make_board()
|
public void make_board()
|
||||||
{
|
{
|
||||||
var rand = new Random();
|
var rand = new Random();
|
||||||
|
@ -38,37 +41,58 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
sum--;
|
sum--;
|
||||||
total = sum;
|
total = sum;
|
||||||
int types = Settings.Images_size();
|
int types = Settings.Images_size();
|
||||||
vals_per_Image = new int[types];
|
Vals_per_Image = new int[types];
|
||||||
int single = sum / types;
|
int single = sum / types;
|
||||||
for (int k = sum; k > 0; k -= 2)
|
for (int k = sum; k > 0; k -= 2)
|
||||||
{
|
{
|
||||||
int t = rand.Next(0, types);
|
int t = rand.Next(0, types);
|
||||||
if (vals_per_Image[t] >= 1.5*single)
|
if (Vals_per_Image[t] >= 1.5 * single)
|
||||||
{
|
{
|
||||||
k += 2;
|
k += 2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
vals_per_Image[t]+=2;
|
Vals_per_Image[t] += 2;
|
||||||
}
|
}
|
||||||
int cur_width = 1, cur_height = 1;
|
int cur_width = 1, cur_height = 1;
|
||||||
var temp_val_per_Image = (int[])vals_per_Image.Clone();
|
var temp_val_per_Image = (int[])Vals_per_Image.Clone();
|
||||||
|
int last_val = -1;
|
||||||
Func<int> getval = () =>
|
Func<int> getval = () =>
|
||||||
{
|
{
|
||||||
|
int not_zero = 0;
|
||||||
|
foreach (int x in temp_val_per_Image)
|
||||||
|
if (x != 0)
|
||||||
|
{
|
||||||
|
not_zero++;
|
||||||
|
if (not_zero > 1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (not_zero <= 1)
|
||||||
|
{
|
||||||
|
int k = temp_val_per_Image.Single(x => x != 0);
|
||||||
|
temp_val_per_Image[k]--;
|
||||||
|
return k;
|
||||||
|
}
|
||||||
int t = rand.Next(0, types);
|
int t = rand.Next(0, types);
|
||||||
if (temp_val_per_Image[t] == 0)
|
if (temp_val_per_Image[t] == 0 || t == last_val)
|
||||||
{
|
{
|
||||||
int i = (t + 1) % types;
|
int i = (t + 1) % types;
|
||||||
for (; temp_val_per_Image[i] == 0; i %= types)
|
for (; temp_val_per_Image[i] == 0 || i == last_val; i %= types)
|
||||||
i++;
|
i++;
|
||||||
temp_val_per_Image[i]--;
|
temp_val_per_Image[i]--;
|
||||||
|
last_val = i;
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
temp_val_per_Image[t]--;
|
temp_val_per_Image[t]--;
|
||||||
|
last_val = t;
|
||||||
return t;
|
return t;
|
||||||
};
|
};
|
||||||
for (int i = 0; i < sum; i++)
|
for (int i = 0; i < sum; i++)
|
||||||
{
|
{
|
||||||
Bd[cur_height, cur_width] = getval();
|
Bd[cur_height, cur_width] = getval();
|
||||||
|
if (board_Index.TryGetValue(Bd[cur_height, cur_width], out var index))
|
||||||
|
index.Add((cur_width, cur_height));
|
||||||
|
else
|
||||||
|
board_Index.Add(Bd[cur_height, cur_width], new List<(int, int)> { (cur_width, cur_height) });
|
||||||
cur_width++;
|
cur_width++;
|
||||||
if (cur_width > width)
|
if (cur_width > width)
|
||||||
{
|
{
|
||||||
|
@ -78,12 +102,62 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
public void remake_board()
|
||||||
|
{
|
||||||
|
board_Index.Clear();
|
||||||
|
var rand = new Random();
|
||||||
|
int[] temp_val_per_Image = (int[])Vals_per_Image.Clone();
|
||||||
|
int types = Vals_per_Image.Length;
|
||||||
|
int height = Bd.GetLength(0);
|
||||||
|
int width = Bd.GetLength(1);
|
||||||
|
int last_val = -1;
|
||||||
|
Func<int> getval = () =>
|
||||||
|
{
|
||||||
|
int not_zero = 0;
|
||||||
|
foreach (int x in temp_val_per_Image)
|
||||||
|
if (x != 0)
|
||||||
|
{
|
||||||
|
not_zero++;
|
||||||
|
if (not_zero > 1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (not_zero <= 1)
|
||||||
|
{
|
||||||
|
int k = temp_val_per_Image.Single(x => x != 0);
|
||||||
|
temp_val_per_Image[k]--;
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
int t = rand.Next(0, types);
|
||||||
|
if (temp_val_per_Image[t] == 0 || t == last_val)
|
||||||
|
{
|
||||||
|
int i = (t + 1) % types;
|
||||||
|
for (; temp_val_per_Image[i] == 0 || i == last_val; i %= types)
|
||||||
|
i++;
|
||||||
|
temp_val_per_Image[i]--;
|
||||||
|
last_val = i;
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
temp_val_per_Image[t]--;
|
||||||
|
last_val = t;
|
||||||
|
return t;
|
||||||
|
};
|
||||||
|
for (int i = 0; i < height; i++)
|
||||||
|
for (int j = 0; j < width; j++)
|
||||||
|
if (Bd[i, j] != -1)
|
||||||
|
{
|
||||||
|
Bd[i, j] = getval();
|
||||||
|
if (board_Index.TryGetValue(Bd[i, j], out var index))
|
||||||
|
index.Add((j, i));
|
||||||
|
else
|
||||||
|
board_Index.Add(Bd[i, j], new List<(int, int)> { (j, i) });
|
||||||
|
}
|
||||||
|
}
|
||||||
public (bool, List<(int, int)>?) test((int, int) a, (int, int) b)//x,y
|
public (bool, List<(int, int)>?) test((int, int) a, (int, int) b)//x,y
|
||||||
{
|
{
|
||||||
bool reverse = false;
|
bool reverse = false;
|
||||||
if (a == b)
|
if (a == b)
|
||||||
return (false, null);
|
return (false, null);
|
||||||
if (Bd?[a.Item2, a.Item1] != Bd?[b.Item2, b.Item1])
|
if (Bd[a.Item2, a.Item1] != Bd[b.Item2, b.Item1])
|
||||||
return (false, null);
|
return (false, null);
|
||||||
var (xa, ya) = a;
|
var (xa, ya) = a;
|
||||||
var (xb, yb) = b;
|
var (xb, yb) = b;
|
||||||
|
@ -94,12 +168,12 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
if (x)
|
if (x)
|
||||||
{
|
{
|
||||||
for (int i = from + 1; i < to; i++)
|
for (int i = from + 1; i < to; i++)
|
||||||
if (Bd?[ct, i] != -1)
|
if (Bd[ct, i] != -1)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
for (int i = from + 1; i < to; i++)
|
for (int i = from + 1; i < to; i++)
|
||||||
if (Bd?[i, ct] != -1)
|
if (Bd[i, ct] != -1)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
@ -115,9 +189,9 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
HashSet<(int, int)> reachableA = new HashSet<(int, int)>(), reachableB = new HashSet<(int, int)>();
|
HashSet<(int, int)> reachableA = new HashSet<(int, int)>(), reachableB = new HashSet<(int, int)>();
|
||||||
Func<(int, int), HashSet<(int, int)>, bool> check_insert = ((int, int) pos, HashSet<(int, int)> insert) =>//x,y
|
Func<(int, int), HashSet<(int, int)>, bool> check_insert = ((int, int) pos, HashSet<(int, int)> insert) =>//x,y
|
||||||
{
|
{
|
||||||
if (pos.Item1 < 0 || pos.Item2 < 0 || pos.Item1 >= Bd?.GetLength(1) || pos.Item2 >= Bd?.GetLength(0))
|
if (pos.Item1 < 0 || pos.Item2 < 0 || pos.Item1 >= Bd.GetLength(1) || pos.Item2 >= Bd.GetLength(0))
|
||||||
return false;
|
return false;
|
||||||
if (Bd?[pos.Item2, pos.Item1] == -1)
|
if (Bd[pos.Item2, pos.Item1] == -1)
|
||||||
{
|
{
|
||||||
insert.Add(pos);
|
insert.Add(pos);
|
||||||
return true;
|
return true;
|
||||||
|
@ -188,7 +262,7 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{//three line test
|
{//three line test
|
||||||
Func<(int, int), (int, int), (bool, (int, int))> intersection = ((int, int) a, (int, int) b) =>
|
Func<(int, int), (int, int), (bool, (int, int))> intersection = ((int, int) a, (int, int) b) =>//first small last big
|
||||||
{
|
{
|
||||||
if (a.Item1 > b.Item1)
|
if (a.Item1 > b.Item1)
|
||||||
(a, b) = (b, a);
|
(a, b) = (b, a);
|
||||||
|
@ -200,15 +274,39 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
};
|
};
|
||||||
var (throughx, xrange) = intersection((squareA[3].Item1, squareA[1].Item1), (squareB[3].Item1, squareB[1].Item1));
|
var (throughx, xrange) = intersection((squareA[3].Item1, squareA[1].Item1), (squareB[3].Item1, squareB[1].Item1));
|
||||||
var (throughy, yrange) = intersection((squareA[0].Item2, squareA[2].Item2), (squareB[0].Item2, squareB[2].Item2));
|
var (throughy, yrange) = intersection((squareA[0].Item2, squareA[2].Item2), (squareB[0].Item2, squareB[2].Item2));
|
||||||
|
Func<(int, int), List<int>> swing_check = ((int, int) range) =>
|
||||||
|
{
|
||||||
|
int mid = (range.Item2 - range.Item1) / 2 + range.Item1;
|
||||||
|
bool swing = true;//up true
|
||||||
|
List<int> ans = new List<int> { mid };
|
||||||
|
for (int i = 1; ;)
|
||||||
|
{
|
||||||
|
int t;
|
||||||
|
if (swing)
|
||||||
|
t = mid + i;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
t = mid - i;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
swing = !swing;
|
||||||
|
if (t >= range.Item1 && t <= range.Item2)
|
||||||
|
ans.Add(t);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return ans;
|
||||||
|
};
|
||||||
if (throughx)
|
if (throughx)
|
||||||
for (int i = xrange.Item1; i <= xrange.Item2; i++)
|
foreach (int i in swing_check(xrange))
|
||||||
if (line_test(false, i, a.Item2, b.Item2))
|
if (line_test(false, i, a.Item2, b.Item2))
|
||||||
if (reverse)
|
if (reverse)
|
||||||
return (true, new List<(int, int)> { b, (i, b.Item2), (i, a.Item2), a });
|
return (true, new List<(int, int)> { b, (i, b.Item2), (i, a.Item2), a });
|
||||||
else
|
else
|
||||||
return (true, new List<(int, int)> { a, (i, a.Item2), (i, b.Item2), b });
|
return (true, new List<(int, int)> { a, (i, a.Item2), (i, b.Item2), b });
|
||||||
|
|
||||||
if (throughy)
|
if (throughy)
|
||||||
for (int i = yrange.Item1; i <= yrange.Item2; i++)
|
foreach (int i in swing_check(yrange))
|
||||||
if (line_test(true, i, a.Item1, b.Item1))
|
if (line_test(true, i, a.Item1, b.Item1))
|
||||||
if (reverse)
|
if (reverse)
|
||||||
return (true, new List<(int, int)> { b, (b.Item1, i), (a.Item1, i), a });
|
return (true, new List<(int, int)> { b, (b.Item1, i), (a.Item1, i), a });
|
||||||
|
@ -217,6 +315,33 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
}
|
}
|
||||||
return (false, null);
|
return (false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
internal void decrease(params (int, int)[] poss)
|
||||||
|
{
|
||||||
|
foreach (var (x, y) in poss)
|
||||||
|
{
|
||||||
|
int type = Bd[y, x];
|
||||||
|
Bd[y, x] = -1;
|
||||||
|
if (!board_Index[type].Remove((x, y)))
|
||||||
|
throw new Exception("Val not Found in board_Index");
|
||||||
|
Vals_per_Image[type]--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal List<List<(int,int)>> get_tip((int, int) start)
|
||||||
|
{
|
||||||
|
List<List<(int, int)>> ans = new List<List<(int, int)>>();
|
||||||
|
if(board_Index.TryGetValue( Bd[start.Item2, start.Item1], out var tip))
|
||||||
|
foreach (var pos in tip)
|
||||||
|
{
|
||||||
|
var (result, path) = test(start, pos);
|
||||||
|
if(result&&path!=null)
|
||||||
|
ans.Add(path);
|
||||||
|
}
|
||||||
|
return ans;
|
||||||
|
}
|
||||||
|
|
||||||
public (int, int) size { get; set; }//width,height
|
public (int, int) size { get; set; }//width,height
|
||||||
public Settings.Mode mode { get; set; }
|
public Settings.Mode mode { get; set; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="NAudio" Version="2.2.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="Properties\Resources.Designer.cs">
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
|
|
@ -0,0 +1,94 @@
|
||||||
|
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
|
{
|
||||||
|
partial class Audio_player
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 必需的设计器变量。
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 清理所有正在使用的资源。
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 组件设计器生成的代码
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 设计器支持所需的方法 - 不要修改
|
||||||
|
/// 使用代码编辑器修改此方法的内容。
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
sp_Button = new PictureBox();
|
||||||
|
last = new PictureBox();
|
||||||
|
next = new PictureBox();
|
||||||
|
((System.ComponentModel.ISupportInitialize)sp_Button).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)last).BeginInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)next).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// sp_Button
|
||||||
|
//
|
||||||
|
sp_Button.Image = Properties.Resources.pause;
|
||||||
|
sp_Button.Location = new Point(368, 114);
|
||||||
|
sp_Button.Name = "sp_Button";
|
||||||
|
sp_Button.Size = new Size(70, 70);
|
||||||
|
sp_Button.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
|
sp_Button.TabIndex = 0;
|
||||||
|
sp_Button.TabStop = false;
|
||||||
|
sp_Button.Click += sp_Button_Click;
|
||||||
|
//
|
||||||
|
// last
|
||||||
|
//
|
||||||
|
last.Image = Properties.Resources.last;
|
||||||
|
last.Location = new Point(199, 114);
|
||||||
|
last.Name = "last";
|
||||||
|
last.Size = new Size(70, 70);
|
||||||
|
last.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
|
last.TabIndex = 1;
|
||||||
|
last.TabStop = false;
|
||||||
|
last.Click += last_Click;
|
||||||
|
//
|
||||||
|
// next
|
||||||
|
//
|
||||||
|
next.Image = Properties.Resources.next;
|
||||||
|
next.Location = new Point(536, 114);
|
||||||
|
next.Name = "next";
|
||||||
|
next.Size = new Size(70, 70);
|
||||||
|
next.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
|
next.TabIndex = 2;
|
||||||
|
next.TabStop = false;
|
||||||
|
next.Click += next_Click;
|
||||||
|
//
|
||||||
|
// Audio_player
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
BackColor = Color.White;
|
||||||
|
Controls.Add(next);
|
||||||
|
Controls.Add(last);
|
||||||
|
Controls.Add(sp_Button);
|
||||||
|
Name = "Audio_player";
|
||||||
|
Size = new Size(873, 323);
|
||||||
|
((System.ComponentModel.ISupportInitialize)sp_Button).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)last).EndInit();
|
||||||
|
((System.ComponentModel.ISupportInitialize)next).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private PictureBox sp_Button;
|
||||||
|
private PictureBox last;
|
||||||
|
private PictureBox next;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
using CDSAE3_Lian_Lian_Kan;
|
||||||
|
using CDSAE3_Lian_Lian_Kan.Properties;
|
||||||
|
using NAudio.Wave;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Data;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||||
|
|
||||||
|
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
|
{
|
||||||
|
public partial class Audio_player : UserControl
|
||||||
|
{
|
||||||
|
public Audio_player()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
bool play_state = false;
|
||||||
|
private void sp_Button_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (!play_state)
|
||||||
|
play();
|
||||||
|
else
|
||||||
|
pause();
|
||||||
|
play_state = !play_state;
|
||||||
|
}
|
||||||
|
private void play()
|
||||||
|
{
|
||||||
|
Settings.audio_Processer.resume_song();
|
||||||
|
sp_Button.Image = Resources.pause;
|
||||||
|
}
|
||||||
|
private void pause()
|
||||||
|
{
|
||||||
|
Settings.audio_Processer.pause_song();
|
||||||
|
sp_Button.Image = Resources.play_buttton;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void last_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Settings.audio_Processer.last_song();
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void next_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Settings.audio_Processer.next_song();
|
||||||
|
play();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,120 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
|
@ -5,6 +5,7 @@ using System.ComponentModel;
|
||||||
using System.ComponentModel.Design;
|
using System.ComponentModel.Design;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
@ -13,10 +14,13 @@ using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window;
|
||||||
|
|
||||||
namespace CDSAE3_Lian_Lian_Kan.Forms
|
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
{
|
{
|
||||||
public partial class GameControl : UserControl, IBeSelected
|
public partial class GameControl : UserControl, IGameControl
|
||||||
{
|
{
|
||||||
Board board = new Board();
|
Board board = new Board();
|
||||||
IGameMode iGameMode;
|
IGameMode? iGameMode;
|
||||||
|
Queue<((int, int), Single_Block)> queue = new Queue<((int, int), Single_Block)>();//y,x
|
||||||
|
bool do_search = false;
|
||||||
|
List<Single_Block> hint_blocks = new List<Single_Block>();
|
||||||
public GameControl()
|
public GameControl()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@ -27,16 +31,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
}
|
}
|
||||||
void playPanel_set()
|
void playPanel_set()
|
||||||
{
|
{
|
||||||
int[,] bd;
|
int[,] bd = board.Bd;
|
||||||
if (board.Bd == null)
|
|
||||||
{
|
|
||||||
board.make_board();
|
|
||||||
bd = board.Bd ?? new int[0, 0];
|
|
||||||
if (bd.Length == 0)
|
|
||||||
throw new Exception("bd is null");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
bd = board.Bd;
|
|
||||||
playPanel_size_change();
|
playPanel_size_change();
|
||||||
for (int i = 0; i < playPanel.RowCount; i++)
|
for (int i = 0; i < playPanel.RowCount; i++)
|
||||||
for (int j = 0; j < playPanel.ColumnCount; j++)
|
for (int j = 0; j < playPanel.ColumnCount; j++)
|
||||||
|
@ -55,18 +50,128 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Queue<((int, int), Single_Block)> queue = new Queue<((int, int), Single_Block)>();//y,x
|
/// <summary>
|
||||||
|
/// 由form和to两个点获取方向
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="from">起始点</param>
|
||||||
|
/// <param name="to">终点</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Settings.Direction get_Direction((int, int) from, (int, int) to) //x,y
|
||||||
|
{
|
||||||
|
if (from.Item1 == to.Item1)
|
||||||
|
if (from.Item2 > to.Item2)
|
||||||
|
return Settings.Direction.up;
|
||||||
|
else
|
||||||
|
return Settings.Direction.down;
|
||||||
|
else
|
||||||
|
if (from.Item1 > to.Item1)
|
||||||
|
return Settings.Direction.left;
|
||||||
|
else
|
||||||
|
return Settings.Direction.right;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 设置单个点方向
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="point"></param>
|
||||||
|
/// <param name="direction"></param>
|
||||||
|
/// <param name="blocks"></param>
|
||||||
|
/// <param name="decrease"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
async Task set_PathAsync((int, int) point, Settings.Direction direction, List<Single_Block> blocks, int wait_time,bool is_hint)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (wait_time != 0)
|
||||||
|
await Task.Delay(wait_time);
|
||||||
|
Control? control = playPanel.GetControlFromPosition(point.Item1, point.Item2);
|
||||||
|
if (control != null && control is Single_Block single_Block)
|
||||||
|
{
|
||||||
|
if (is_hint)
|
||||||
|
single_Block.hint_path(direction);
|
||||||
|
else
|
||||||
|
single_Block.to_path(direction);
|
||||||
|
blocks.Add(single_Block);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async Task to_path((int, int) from, (int, int) to, bool include_end, Settings.Direction extra_Direction, List<Single_Block> blocks, int wait_time, bool is_hint)
|
||||||
|
{
|
||||||
|
var direction = get_Direction(from, to);
|
||||||
|
switch (direction)
|
||||||
|
{
|
||||||
|
case Settings.Direction.up:
|
||||||
|
for (int i = from.Item2 - 1; i != to.Item2; i--)
|
||||||
|
await set_PathAsync((from.Item1, i), Settings.Direction.up_down, blocks, wait_time,is_hint);
|
||||||
|
break;
|
||||||
|
case Settings.Direction.down:
|
||||||
|
for (int i = from.Item2 + 1; i != to.Item2; i++)
|
||||||
|
await set_PathAsync((from.Item1, i), Settings.Direction.up_down, blocks, wait_time,is_hint);
|
||||||
|
break;
|
||||||
|
case Settings.Direction.right:
|
||||||
|
for (int i = from.Item1 + 1; i != to.Item1; i++)
|
||||||
|
await set_PathAsync((i, from.Item2), Settings.Direction.left_right, blocks, wait_time,is_hint);
|
||||||
|
break;
|
||||||
|
case Settings.Direction.left:
|
||||||
|
for (int i = from.Item1 - 1; i != to.Item1; i--)
|
||||||
|
await set_PathAsync((i, from.Item2), Settings.Direction.left_right, blocks, wait_time,is_hint);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (include_end)
|
||||||
|
{
|
||||||
|
direction = ((int)direction & 3) > 0 ? (Settings.Direction)((int)direction << 2) : (Settings.Direction)((int)direction >> 2);
|
||||||
|
direction = direction | extra_Direction;
|
||||||
|
await set_PathAsync(to, direction, blocks, wait_time,is_hint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
async Task path_drawerAsync(List<(int, int)> path, int wait_time, List<Single_Block> blocks, bool is_hint)
|
||||||
|
{
|
||||||
|
switch (path.Count)
|
||||||
|
{
|
||||||
|
case 2:
|
||||||
|
await to_path(path[0], path[1], false, Settings.Direction.none, blocks, wait_time,is_hint);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
var extra_direction = get_Direction(path[1], path[2]);
|
||||||
|
await to_path(path[0], path[1], true, extra_direction, blocks, wait_time,is_hint);
|
||||||
|
await to_path(path[1], path[2], false, Settings.Direction.none, blocks, wait_time,is_hint);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
Settings.Direction extra_directionA = get_Direction(path[1], path[2]), extra_directionB = get_Direction(path[2], path[3]);
|
||||||
|
await to_path(path[0], path[1], true, extra_directionA, blocks, wait_time,is_hint);
|
||||||
|
await to_path(path[1], path[2], true, extra_directionB, blocks, wait_time,is_hint);
|
||||||
|
await to_path(path[2], path[3], false, Settings.Direction.none, blocks, wait_time,is_hint);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
internal void set_tip()
|
||||||
|
{
|
||||||
|
if (queue.Count != 1)
|
||||||
|
return;
|
||||||
|
List<List<(int, int)>> paths = board.get_tip(queue.Peek().Item1);
|
||||||
|
foreach (var path in paths)
|
||||||
|
_ = path_drawerAsync(path, 0, hint_blocks,true);
|
||||||
|
}
|
||||||
|
internal void de_set_tip()
|
||||||
|
{
|
||||||
|
foreach (var control in hint_blocks)
|
||||||
|
control.de_path();
|
||||||
|
hint_blocks.Clear();
|
||||||
|
}
|
||||||
public void Selected_Handler(Single_Block sender, SelectedEventArgs e)
|
public void Selected_Handler(Single_Block sender, SelectedEventArgs e)
|
||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
iGameMode.De_pause(this, e);
|
iGameMode?.De_pause(this, e);
|
||||||
if (e.be_selected)
|
if (e.be_selected)
|
||||||
{
|
{
|
||||||
switch (queue.Count)
|
switch (queue.Count)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
queue.Enqueue((e.position, sender));
|
queue.Enqueue((e.position, sender));
|
||||||
|
if (do_search)
|
||||||
|
{
|
||||||
|
de_set_tip();
|
||||||
|
set_tip();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
var (posa, sendera) = queue.Dequeue();
|
var (posa, sendera) = queue.Dequeue();
|
||||||
|
@ -74,15 +179,18 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
var (could, path) = board.test(posa, posb);
|
var (could, path) = board.test(posa, posb);
|
||||||
if (could)
|
if (could)
|
||||||
{
|
{
|
||||||
|
board.decrease(posa, posb);
|
||||||
_ = Block_ClearAsync(path);
|
_ = Block_ClearAsync(path);
|
||||||
while (queue.Count() > 0)
|
while (queue.Count() > 0)
|
||||||
queue.Dequeue();
|
queue.Dequeue();
|
||||||
if (board.Bd is null) throw new Exception("No usable board. How come?");
|
|
||||||
board.Bd[posa.Item2, posa.Item1] = -1;
|
|
||||||
board.Bd[posb.Item2, posb.Item1] = -1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (do_search)
|
||||||
|
{
|
||||||
|
de_set_tip();
|
||||||
|
set_tip();
|
||||||
|
}
|
||||||
queue.Enqueue((e.position, sender));
|
queue.Enqueue((e.position, sender));
|
||||||
sendera.deselect();
|
sendera.deselect();
|
||||||
}
|
}
|
||||||
|
@ -97,86 +205,25 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (queue.Peek().Item1 == e.position)
|
if (queue.Peek().Item1 == e.position)
|
||||||
|
{
|
||||||
queue.Dequeue();
|
queue.Dequeue();
|
||||||
|
if (do_search)
|
||||||
|
de_set_tip();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async Task Block_ClearAsync(List<(int, int)>? path)
|
async Task Block_ClearAsync(List<(int, int)>? path)
|
||||||
{
|
{
|
||||||
List<Single_Block> paths = new List<Single_Block>();
|
if (do_search == true)
|
||||||
|
foreach (Single_Block single_Block in hint_blocks)
|
||||||
|
single_Block.de_path();
|
||||||
|
List<Single_Block> blocks = new List<Single_Block>();
|
||||||
if (path == null)
|
if (path == null)
|
||||||
return;
|
return;
|
||||||
Func<(int, int), (int, int), Settings.Direction> get_Direction = ((int, int) from, (int, int) to) =>//x,y
|
await path_drawerAsync(path, 20, blocks, false);
|
||||||
{
|
|
||||||
if (from.Item1 == to.Item1)
|
|
||||||
if (from.Item2 > to.Item2)
|
|
||||||
return Settings.Direction.up;
|
|
||||||
else
|
|
||||||
return Settings.Direction.down;
|
|
||||||
else
|
|
||||||
if (from.Item1 > to.Item1)
|
|
||||||
return Settings.Direction.left;
|
|
||||||
else
|
|
||||||
return Settings.Direction.right;
|
|
||||||
};
|
|
||||||
Func<(int, int), Settings.Direction, Task> set_Path = async ((int, int) point, Settings.Direction direction) =>
|
|
||||||
{
|
|
||||||
await Task.Delay(20);
|
|
||||||
Control? control = playPanel.GetControlFromPosition(point.Item1, point.Item2);
|
|
||||||
if (control != null && control is Single_Block single_Block)
|
|
||||||
{
|
|
||||||
single_Block.to_path(direction);
|
|
||||||
paths.Add(single_Block);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Func<(int, int), (int, int), bool, Settings.Direction, Task> to_path = async ((int, int) from, (int, int) to, bool include_end, Settings.Direction extra_Direction) =>
|
|
||||||
{
|
|
||||||
var direction = get_Direction(from, to);
|
|
||||||
switch (direction)
|
|
||||||
{
|
|
||||||
case Settings.Direction.up:
|
|
||||||
for (int i = from.Item2 - 1; i != to.Item2; i--)
|
|
||||||
await set_Path((from.Item1, i), Settings.Direction.up_down);
|
|
||||||
break;
|
|
||||||
case Settings.Direction.down:
|
|
||||||
for (int i = from.Item2 + 1; i != to.Item2; i++)
|
|
||||||
await set_Path((from.Item1, i), Settings.Direction.up_down);
|
|
||||||
break;
|
|
||||||
case Settings.Direction.right:
|
|
||||||
for (int i = from.Item1 + 1; i != to.Item1; i++)
|
|
||||||
await set_Path((i, from.Item2), Settings.Direction.left_right);
|
|
||||||
break;
|
|
||||||
case Settings.Direction.left:
|
|
||||||
for (int i = from.Item1 - 1; i != to.Item1; i--)
|
|
||||||
await set_Path((i, from.Item2), Settings.Direction.left_right);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (include_end)
|
|
||||||
{
|
|
||||||
direction = direction | extra_Direction;
|
|
||||||
await set_Path(to, direction);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
switch (path.Count)
|
|
||||||
{
|
|
||||||
case 2:
|
|
||||||
await to_path(path[0], path[1], false, 0);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
var extra_direction = get_Direction(path[1], path[2]);
|
|
||||||
await to_path(path[0], path[1], true, extra_direction);
|
|
||||||
await to_path(path[1], path[2], false, Settings.Direction.none);
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
Settings.Direction extra_directionA = get_Direction(path[1], path[2]), extra_directionB = get_Direction(path[2], path[3]);
|
|
||||||
await to_path(path[0], path[1], true, extra_directionA);
|
|
||||||
await to_path(path[1], path[2], true, extra_directionB);
|
|
||||||
await to_path(path[2], path[3], false, Settings.Direction.none);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
Control? controlA = playPanel.GetControlFromPosition(path[0].Item1, path[0].Item2), controlB = playPanel.GetControlFromPosition(path.Last().Item1, path.Last().Item2);
|
Control? controlA = playPanel.GetControlFromPosition(path[0].Item1, path[0].Item2), controlB = playPanel.GetControlFromPosition(path.Last().Item1, path.Last().Item2);
|
||||||
if (controlA != null && controlB != null && controlA is Single_Block single_BlockA && controlB is Single_Block single_BlockB)
|
if (controlA != null && controlB != null && controlA is Single_Block single_BlockA && controlB is Single_Block single_BlockB)
|
||||||
{
|
{
|
||||||
|
@ -184,12 +231,11 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
single_BlockB.destroyAsync();
|
single_BlockB.destroyAsync();
|
||||||
}
|
}
|
||||||
await Task.Delay(200);
|
await Task.Delay(200);
|
||||||
foreach (var control in paths)
|
foreach (var control in blocks)
|
||||||
control.de_path();
|
control.de_path();
|
||||||
iGameMode.Score_Add(this, new AddScoreArgs { score = (paths.Count + 2)*10 });
|
iGameMode?.Score_Add(this, new AddScoreArgs { score = (blocks.Count + 2) * 10 });
|
||||||
board.Total -= 2;
|
board.Total -= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void playPanel_size_change()
|
void playPanel_size_change()
|
||||||
{
|
{
|
||||||
var (width, height) = board.size;
|
var (width, height) = board.size;
|
||||||
|
@ -202,5 +248,34 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
for (int i = 0; i < height + 1; i++)
|
for (int i = 0; i < height + 1; i++)
|
||||||
playPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
playPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F));
|
||||||
}
|
}
|
||||||
|
public void Exchange_Handler(object? sender, EventArgs e)
|
||||||
|
{
|
||||||
|
board.remake_board();
|
||||||
|
int[,] bd = board.Bd;
|
||||||
|
for (int i = 0; i < bd.GetLength(0); i++)
|
||||||
|
for (int j = 0; j < bd.GetLength(1); j++)
|
||||||
|
if (bd[i, j] == -1)
|
||||||
|
continue;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Control? control = playPanel.GetControlFromPosition(j, i);
|
||||||
|
if (control != null && control is Single_Block single_Block)
|
||||||
|
single_Block.Re_create(bd[i, j], null, null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Search_Handler(object? sender, SearchEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.set_search)
|
||||||
|
{
|
||||||
|
do_search = true;
|
||||||
|
set_tip();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
do_search = false;
|
||||||
|
de_set_tip();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,14 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CDSAE3_Lian_Lian_Kan.Forms
|
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
{
|
{
|
||||||
public interface IBeSelected
|
public interface IGameControl
|
||||||
{
|
{
|
||||||
public void Selected_Handler(Single_Block sender, SelectedEventArgs e);
|
public void Selected_Handler(Single_Block sender, SelectedEventArgs e);
|
||||||
|
public void Exchange_Handler(object? sender, EventArgs e);
|
||||||
|
public void Search_Handler(object? sender, SearchEventArgs e);
|
||||||
|
}
|
||||||
|
public class SearchEventArgs:EventArgs
|
||||||
|
{
|
||||||
|
public bool set_search { get; set; } = false;//true : search
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,7 @@
|
||||||
search.SizeMode = PictureBoxSizeMode.Zoom;
|
search.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
search.TabIndex = 9;
|
search.TabIndex = 9;
|
||||||
search.TabStop = false;
|
search.TabStop = false;
|
||||||
|
search.Click += search_Click;
|
||||||
//
|
//
|
||||||
// exchange
|
// exchange
|
||||||
//
|
//
|
||||||
|
@ -161,6 +162,7 @@
|
||||||
exchange.SizeMode = PictureBoxSizeMode.Zoom;
|
exchange.SizeMode = PictureBoxSizeMode.Zoom;
|
||||||
exchange.TabIndex = 10;
|
exchange.TabIndex = 10;
|
||||||
exchange.TabStop = false;
|
exchange.TabStop = false;
|
||||||
|
exchange.Click += exchange_Click;
|
||||||
//
|
//
|
||||||
// Leisure_Mode
|
// Leisure_Mode
|
||||||
//
|
//
|
||||||
|
|
|
@ -29,12 +29,23 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
int cur_score = 0;
|
int cur_score = 0;
|
||||||
int factor_val = 1;
|
int factor_val = 1;
|
||||||
int current_base = 0;
|
int current_base = 0;
|
||||||
|
int search_left_time = 0;
|
||||||
|
bool search_mode = false;
|
||||||
Dictionary<int, double> decrease_per_level = Settings.decrease_per_level;
|
Dictionary<int, double> decrease_per_level = Settings.decrease_per_level;
|
||||||
|
|
||||||
private void Timer_Tick(object? sender, EventArgs e)
|
private void Timer_Tick(object? sender, EventArgs e)
|
||||||
{
|
{
|
||||||
left_time--;
|
left_time--;
|
||||||
BeginInvoke(() => time.Text = (left_time / 60).ToString().PadLeft(2, '0') + ":" + (left_time % 60).ToString().PadLeft(2, '0'));
|
BeginInvoke(() => time.Text = (left_time / 60).ToString().PadLeft(2, '0') + ":" + (left_time % 60).ToString().PadLeft(2, '0'));
|
||||||
|
if(search_mode)
|
||||||
|
{
|
||||||
|
search_left_time--;
|
||||||
|
if (search_left_time < 0)
|
||||||
|
{
|
||||||
|
search_mode = false;
|
||||||
|
gameControl.Search_Handler(this, new SearchEventArgs { set_search = false });
|
||||||
|
}
|
||||||
|
}
|
||||||
if (current_base <= 0)
|
if (current_base <= 0)
|
||||||
{
|
{
|
||||||
if (factor_val > 1)
|
if (factor_val > 1)
|
||||||
|
@ -123,5 +134,17 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
timer.Close();
|
timer.Close();
|
||||||
Settings.form?.change_form(new Leisure_Mode_MenuForm());
|
Settings.form?.change_form(new Leisure_Mode_MenuForm());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void exchange_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Task.Run(() => gameControl.Exchange_Handler(this, new EventArgs()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void search_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
gameControl.Search_Handler(this, new SearchEventArgs { set_search = true});
|
||||||
|
search_mode = true;
|
||||||
|
search_left_time = Settings.search_left_time;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,8 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
public Leisure_Mode_MenuForm()
|
public Leisure_Mode_MenuForm()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
Settings.audio_Processer.next_song();
|
||||||
|
Settings.audio_Processer.resume_song();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void start_Game_Click(object sender, EventArgs e)
|
private void start_Game_Click(object sender, EventArgs e)
|
||||||
|
|
|
@ -79,13 +79,21 @@ namespace CDSAE3_Lian_Lian_Kan
|
||||||
selected = false;
|
selected = false;
|
||||||
BackColor = nor_color;
|
BackColor = nor_color;
|
||||||
}
|
}
|
||||||
|
Settings.Direction direction = Settings.Direction.none;
|
||||||
|
public void hint_path(Settings.Direction direction)
|
||||||
|
{
|
||||||
|
this.direction |= direction;
|
||||||
|
Image_change(Settings.get_tip_direction_Image(this.direction));
|
||||||
|
}
|
||||||
public void to_path(Settings.Direction direction)
|
public void to_path(Settings.Direction direction)
|
||||||
{//TODO tube Image
|
{
|
||||||
Image_change(Settings.get_block_Image(0));
|
Image_change(Settings.get_direction_Image(direction));
|
||||||
|
direction = Settings.Direction.none;
|
||||||
}
|
}
|
||||||
public void de_path()
|
public void de_path()
|
||||||
{
|
{
|
||||||
Image_change(Settings.trans_Image);
|
Image_change(Settings.trans_Image);
|
||||||
|
direction = Settings.Direction.none;
|
||||||
}
|
}
|
||||||
System.Timers.Timer? timer = null;
|
System.Timers.Timer? timer = null;
|
||||||
public void destroyAsync()
|
public void destroyAsync()
|
||||||
|
@ -98,7 +106,7 @@ namespace CDSAE3_Lian_Lian_Kan
|
||||||
timer.Elapsed += Image_Clear;
|
timer.Elapsed += Image_Clear;
|
||||||
timer.Enabled = true;
|
timer.Enabled = true;
|
||||||
}
|
}
|
||||||
Object locker = new object();
|
object locker = new object();
|
||||||
public void Image_Clear(object? sender, ElapsedEventArgs e)
|
public void Image_Clear(object? sender, ElapsedEventArgs e)
|
||||||
{
|
{
|
||||||
timer?.Stop();
|
timer?.Stop();
|
||||||
|
@ -116,9 +124,21 @@ namespace CDSAE3_Lian_Lian_Kan
|
||||||
catch(Exception)
|
catch(Exception)
|
||||||
{
|
{
|
||||||
Image_change(new_image);
|
Image_change(new_image);
|
||||||
//Console.WriteLine("test");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void Re_create(int image, Color? default_backColor, Color? select_Color, (int, int)? pos)
|
||||||
|
{
|
||||||
|
if (block_id == image)
|
||||||
|
return;
|
||||||
|
block_id = image;
|
||||||
|
Image_change(Settings.get_block_Image(image));
|
||||||
|
if (default_backColor != null)
|
||||||
|
nor_color = (Color)default_backColor;
|
||||||
|
if(select_Color != null)
|
||||||
|
sel_color = (Color)select_Color;
|
||||||
|
if (pos != null)
|
||||||
|
position = ((int, int))pos;
|
||||||
|
}
|
||||||
public event SelectedEventHandler Selected;
|
public event SelectedEventHandler Selected;
|
||||||
}
|
}
|
||||||
public class SelectedEventArgs : EventArgs
|
public class SelectedEventArgs : EventArgs
|
||||||
|
|
|
@ -90,6 +90,46 @@ namespace CDSAE3_Lian_Lian_Kan.Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static byte[] C418___Beginning_2 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("C418___Beginning_2", resourceCulture);
|
||||||
|
return ((byte[])(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static byte[] C418___Floating_Trees {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("C418___Floating_Trees", resourceCulture);
|
||||||
|
return ((byte[])(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static byte[] C418___Moog_City_2 {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("C418___Moog_City_2", resourceCulture);
|
||||||
|
return ((byte[])(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Byte[] 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static byte[] C418___Mutation {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("C418___Mutation", resourceCulture);
|
||||||
|
return ((byte[])(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -290,6 +330,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap last {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("last", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -310,6 +360,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap next {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("next", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -370,6 +430,156 @@ namespace CDSAE3_Lian_Lian_Kan.Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_d {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_d", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_dl {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_dl", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_dlr {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_dlr", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_dr {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_dr", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_l {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_l", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_lr {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_lr", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_r {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_r", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_u {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_u", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_ud {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_ud", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_udl {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_udl", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_udlr {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_udlr", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_udr {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_udr", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_ul {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_ul", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_ulr {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_ulr", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap tip_ur {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("tip_ur", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -410,6 +620,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap udlr {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("udlr", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -450,16 +670,6 @@ namespace CDSAE3_Lian_Lian_Kan.Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
|
||||||
/// </summary>
|
|
||||||
internal static System.Drawing.Bitmap urdl {
|
|
||||||
get {
|
|
||||||
object obj = ResourceManager.GetObject("urdl", resourceCulture);
|
|
||||||
return ((System.Drawing.Bitmap)(obj));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -229,6 +229,9 @@
|
||||||
<data name="udl" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="udl" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\udl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\udl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="udlr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\udlr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="udr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="udr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\udr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\udr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -241,7 +244,67 @@
|
||||||
<data name="ur" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="ur" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\ur.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\ur.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="urdl" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="tip_d" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\urdl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\tip_d.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_dl" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_dl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_dlr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_dlr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_dr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_dr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_l" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_l.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_lr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_lr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_r" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_r.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_u" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_u.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_ud" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_ud.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_udl" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_udl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_udlr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_udlr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_udr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_udr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_ul" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_ul.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_ulr" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_ulr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="tip_ur" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\tip_ur.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="C418___Beginning_2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\C418 - Beginning 2.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name="C418___Floating_Trees" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\C418 - Floating Trees.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name="C418___Moog_City_2" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\C418 - Moog City 2.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name="C418___Mutation" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\C418 - Mutation.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</data>
|
||||||
|
<data name="last" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\last.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
|
<data name="next" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\next.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 5.2 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
@ -1,16 +1,21 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Resources;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using CDSAE3_Lian_Lian_Kan.Board_funcs;
|
using CDSAE3_Lian_Lian_Kan.Board_funcs;
|
||||||
using CDSAE3_Lian_Lian_Kan.Forms;
|
using CDSAE3_Lian_Lian_Kan.Forms;
|
||||||
using CDSAE3_Lian_Lian_Kan.Properties;
|
using CDSAE3_Lian_Lian_Kan.Properties;
|
||||||
|
using CDSAE3_Lian_Lian_Kan.Sound;
|
||||||
namespace CDSAE3_Lian_Lian_Kan
|
namespace CDSAE3_Lian_Lian_Kan
|
||||||
{
|
{
|
||||||
public class Settings
|
public static class Settings
|
||||||
{
|
{
|
||||||
public static int left_time { get; set; } = 180;
|
public static int left_time { get; set; } = 180;
|
||||||
|
public static int search_left_time { get; set; } = 20;
|
||||||
|
|
||||||
public enum Difficulty
|
public enum Difficulty
|
||||||
{
|
{
|
||||||
easy = 0,
|
easy = 0,
|
||||||
|
@ -34,7 +39,12 @@ namespace CDSAE3_Lian_Lian_Kan
|
||||||
up_right = 3,
|
up_right = 3,
|
||||||
up_left = 9,
|
up_left = 9,
|
||||||
down_right = 6,
|
down_right = 6,
|
||||||
down_left = 12
|
down_left = 12,
|
||||||
|
up_down_right = 7,
|
||||||
|
up_down_left = 13,
|
||||||
|
up_left_right = 11,
|
||||||
|
down_left_right = 14,
|
||||||
|
up_down_left_right = 15
|
||||||
}
|
}
|
||||||
public static Dictionary<int, double> decrease_per_level = new Dictionary<int, double> {
|
public static Dictionary<int, double> decrease_per_level = new Dictionary<int, double> {
|
||||||
{1,100.0/60 },
|
{1,100.0/60 },
|
||||||
|
@ -49,20 +59,28 @@ namespace CDSAE3_Lian_Lian_Kan
|
||||||
{10,100.0/3 }};
|
{10,100.0/3 }};
|
||||||
|
|
||||||
static int cus_height = 1, cus_width = 1;
|
static int cus_height = 1, cus_width = 1;
|
||||||
public static Difficulty current_difficulty { get; set; } = Difficulty.easy;
|
public static Difficulty current_difficulty { get; set; } = Difficulty.normal;
|
||||||
public static Mode current_mode { get; set; }
|
public static Mode current_mode { get; set; }
|
||||||
public static Image trans_Image { get; set; } = Resources.trans;
|
public static Image trans_Image { get; set; } = Resources.trans;
|
||||||
public static (int, int) get_length_width() => current_difficulty != Difficulty.custom ? (7 * (1 + (int)current_difficulty), 4 * (1 + (int)current_difficulty)) : (cus_width,cus_height);
|
public static (int, int) get_length_width() => current_difficulty != Difficulty.custom ? (7 * (1 + (int)current_difficulty), 4 * (1 + (int)current_difficulty)) : (cus_width,cus_height);
|
||||||
public static List<Image> block_Images { get; set; } = new List<Image> { Resources.Apple, Resources.Banana, Resources.Beetroot, Resources.Cherry, Resources.Corn, Resources.Eggplant, Resources.Grape, Resources.Pear, Resources.Strawberry, Resources.Watermelon };
|
public static List<Image> block_Images { get; set; } = new List<Image> { Resources.Apple, Resources.Banana, Resources.Beetroot, Resources.Cherry, Resources.Corn, Resources.Eggplant, Resources.Grape, Resources.Pear, Resources.Strawberry, Resources.Watermelon };
|
||||||
public static List<Image> disappear_Images { get; set; } = new List<Image> { Resources.Gapple, Resources.Gbanana, Resources.Gbeetroot, Resources.Gcherry, Resources.Gcorn, Resources.Geggplant, Resources.Ggrape, Resources.Gpear, Resources.Gstrawberry, Resources.Gwatermelon };
|
public static List<Image> disappear_Images { get; set; } = new List<Image> { Resources.Gapple, Resources.Gbanana, Resources.Gbeetroot, Resources.Gcherry, Resources.Gcorn, Resources.Geggplant, Resources.Ggrape, Resources.Gpear, Resources.Gstrawberry, Resources.Gwatermelon };
|
||||||
|
public static List<Image> direction_Images { get; set; } = new List<Image> { Resources.trans, Resources.u, Resources.r , Resources.ur, Resources.d, Resources.ud, Resources.dr, Resources.udr, Resources.l, Resources.ul, Resources.lr, Resources.ulr, Resources.dl, Resources.udl, Resources.dlr, Resources.udlr};
|
||||||
|
public static List<Image> tip_direction_Image { get; set; } = new List<Image> { Resources.trans, Resources.tip_u, Resources.tip_r, Resources.tip_ur, Resources.tip_d, Resources.tip_ud, Resources.tip_dr, Resources.tip_udr, Resources.tip_l, Resources.tip_ul, Resources.tip_lr, Resources.tip_ulr, Resources.tip_dl, Resources.tip_udl, Resources.tip_dlr, Resources.tip_udlr };
|
||||||
public static Image get_block_Image(int t) => block_Images[t];
|
public static Image get_block_Image(int t) => block_Images[t];
|
||||||
public static Image get_disappear_Images(int t) => disappear_Images[t];
|
public static Image get_disappear_Images(int t) => disappear_Images[t];
|
||||||
|
public static Image get_direction_Image(Direction direction) => direction_Images[(int)direction];
|
||||||
public static int Images_size() => current_mode switch { Mode.fruit => 10, _ => 0, };
|
public static int Images_size() => current_mode switch { Mode.fruit => 10, _ => 0, };
|
||||||
|
internal static Image get_tip_direction_Image(Direction direction) => tip_direction_Image[(int)direction];
|
||||||
public static LianLianKan? form { get; set; }
|
public static LianLianKan? form { get; set; }
|
||||||
public static IBeSelected? game_form{ get; set; }//gameBoard
|
public static IGameControl? game_form{ get; set; }//gameBoard
|
||||||
public static IGameMode? game_mode_form { get; set; }//entireGame
|
public static IGameMode? game_mode_form { get; set; }//entireGame
|
||||||
public static Board board { get; set; } = new Board();
|
public static Board board { get; set; } = new Board();
|
||||||
public static Color def_Color { get; set; } = Color.FromArgb(0, 0, 0, 0);
|
public static Color def_Color { get; set; } = Color.FromArgb(0, 0, 0, 0);
|
||||||
public static Color sel_Color { get; set; } = Color.FromArgb(0, 122, 204);
|
public static Color sel_Color { get; set; } = Color.FromArgb(0, 122, 204);
|
||||||
|
public static Dictionary<string, List<string>> musics { get; set; } = new Dictionary<string, List<string>> { { "C418", new List<string> { "C418 - Beginning 2", "C418 - Floating Trees", "C418 - Moog City 2", "C418 - Mutation" } } };
|
||||||
|
public static Audio_processer audio_Processer { get; set; } = new Audio_processer();
|
||||||
|
public static ResourceManager res_Manager { get; set; } = new ResourceManager("CDSAE3_Lian_Lian_Kan.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
public static CultureInfo res_Culture { get; set; } = new CultureInfo("en-US");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,164 @@
|
||||||
|
using NAudio.Wave;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Resources;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using CDSAE3_Lian_Lian_Kan.Properties;
|
||||||
|
using NAudio.Wave.SampleProviders;
|
||||||
|
namespace CDSAE3_Lian_Lian_Kan.Sound
|
||||||
|
{
|
||||||
|
public class Audio_processer
|
||||||
|
{
|
||||||
|
class Audio_File_Processor
|
||||||
|
{
|
||||||
|
private WaveChannel32? volumeStream;
|
||||||
|
private List<string> audioFiles = new List<string>();
|
||||||
|
string base_path;
|
||||||
|
int next_song = 0;
|
||||||
|
int volume = 90;
|
||||||
|
public Audio_File_Processor()
|
||||||
|
{
|
||||||
|
base_path = AppDomain.CurrentDomain.BaseDirectory;
|
||||||
|
}
|
||||||
|
internal void set_Albums(string s)=>audioFiles = Settings.musics.TryGetValue(s, out List<string>? val) ? val : new List<string>();
|
||||||
|
internal Wave16ToFloatProvider get_next_song()
|
||||||
|
{
|
||||||
|
volumeStream?.Close();
|
||||||
|
string name = audioFiles[next_song];
|
||||||
|
next_song++;
|
||||||
|
next_song %= audioFiles.Count;
|
||||||
|
name = name.Split('.').First().Replace(" ","_").Replace("-","_");
|
||||||
|
object obj = Settings.res_Manager.GetObject(name, Settings.res_Culture)!;
|
||||||
|
MemoryStream sound = new MemoryStream((byte[])obj);
|
||||||
|
MemoryStream ms = new MemoryStream(StreamToBytes(sound));
|
||||||
|
var ws = new Mp3FileReader(ms);
|
||||||
|
BlockAlignReductionStream blockAlignReductionStream = new BlockAlignReductionStream(ws);
|
||||||
|
Wave16ToFloatProvider wave16ToFloatProvider = new Wave16ToFloatProvider(blockAlignReductionStream);
|
||||||
|
wave16ToFloatProvider.Volume = volume / 100f;
|
||||||
|
return wave16ToFloatProvider;
|
||||||
|
}
|
||||||
|
internal Wave16ToFloatProvider get_last_song()
|
||||||
|
{
|
||||||
|
next_song = (next_song - 2 + audioFiles.Count) % audioFiles.Count;
|
||||||
|
return get_next_song();
|
||||||
|
}
|
||||||
|
internal void volume_change(int val)
|
||||||
|
{
|
||||||
|
volume = val;
|
||||||
|
if(volumeStream != null)
|
||||||
|
volumeStream.Volume = volume / 100f;
|
||||||
|
}
|
||||||
|
internal static byte[] StreamToBytes(Stream stream)
|
||||||
|
{
|
||||||
|
long originalPosition = 0;
|
||||||
|
|
||||||
|
if (stream.CanSeek)
|
||||||
|
{
|
||||||
|
originalPosition = stream.Position;
|
||||||
|
stream.Position = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
byte[] readBuffer = new byte[4096];
|
||||||
|
|
||||||
|
int totalBytesRead = 0;
|
||||||
|
int bytesRead;
|
||||||
|
|
||||||
|
while ((bytesRead = stream.Read(readBuffer, totalBytesRead, readBuffer.Length - totalBytesRead)) > 0)
|
||||||
|
{
|
||||||
|
totalBytesRead += bytesRead;
|
||||||
|
|
||||||
|
if (totalBytesRead == readBuffer.Length)
|
||||||
|
{
|
||||||
|
int nextByte = stream.ReadByte();
|
||||||
|
if (nextByte != -1)
|
||||||
|
{
|
||||||
|
byte[] temp = new byte[readBuffer.Length * 2];
|
||||||
|
Buffer.BlockCopy(readBuffer, 0, temp, 0, readBuffer.Length);
|
||||||
|
Buffer.SetByte(temp, totalBytesRead, (byte)nextByte);
|
||||||
|
readBuffer = temp;
|
||||||
|
totalBytesRead++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
byte[] buffer = readBuffer;
|
||||||
|
if (readBuffer.Length != totalBytesRead)
|
||||||
|
{
|
||||||
|
buffer = new byte[totalBytesRead];
|
||||||
|
Buffer.BlockCopy(readBuffer, 0, buffer, 0, totalBytesRead);
|
||||||
|
}
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (stream.CanSeek)
|
||||||
|
{
|
||||||
|
stream.Position = originalPosition;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
~Audio_File_Processor()
|
||||||
|
{
|
||||||
|
volumeStream?.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
private WaveOutEvent songOutputDevice;
|
||||||
|
private WaveOutEvent infoOutputDevice;
|
||||||
|
Audio_File_Processor audio_File_Processor = new Audio_File_Processor();
|
||||||
|
public Audio_processer()
|
||||||
|
{
|
||||||
|
songOutputDevice = new WaveOutEvent();
|
||||||
|
infoOutputDevice = new WaveOutEvent();
|
||||||
|
set_albums(get_albums().First());
|
||||||
|
}
|
||||||
|
private void OnPlaybackStopped(object? sender, StoppedEventArgs e)
|
||||||
|
{
|
||||||
|
next_song();
|
||||||
|
resume_song();
|
||||||
|
}
|
||||||
|
public void pause_song()=>songOutputDevice.Pause();
|
||||||
|
public void resume_song()=>songOutputDevice.Play();
|
||||||
|
public void last_song()
|
||||||
|
{
|
||||||
|
waveOutEvent_Provider(audio_File_Processor.get_last_song());
|
||||||
|
}
|
||||||
|
public void next_song()
|
||||||
|
{
|
||||||
|
waveOutEvent_Provider(audio_File_Processor.get_next_song());
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 切换音乐
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="waveChannel32"></param>
|
||||||
|
private void waveOutEvent_Provider(Wave16ToFloatProvider wave16ToFloatProvider)
|
||||||
|
{
|
||||||
|
|
||||||
|
songOutputDevice.Stop();
|
||||||
|
songOutputDevice.Dispose();
|
||||||
|
songOutputDevice = new WaveOutEvent();
|
||||||
|
songOutputDevice.Init(wave16ToFloatProvider);
|
||||||
|
songOutputDevice.PlaybackStopped += OnPlaybackStopped;
|
||||||
|
}
|
||||||
|
/// <summary>
|
||||||
|
/// 调整音乐音量
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="val">音量大小 1-100</param>
|
||||||
|
public void volume_change(int val)=> audio_File_Processor.volume_change(val);
|
||||||
|
public List<string> get_albums() => Settings.musics.Select(x => x.Key).ToList();
|
||||||
|
public void set_albums(string s)
|
||||||
|
{
|
||||||
|
audio_File_Processor.set_Albums(s);
|
||||||
|
}
|
||||||
|
~Audio_processer()
|
||||||
|
{
|
||||||
|
songOutputDevice.Dispose();
|
||||||
|
infoOutputDevice.Dispose();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|