开写新Board!!
This commit is contained in:
parent
5b1d474cfd
commit
e0a212af0f
|
@ -6,15 +6,15 @@ 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;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
|
||||||
namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||||
{
|
{
|
||||||
public partial class Board:IBoard
|
public partial class Board:IBoard
|
||||||
{
|
{
|
||||||
private int[,] Bd = { { } };//y,x
|
private int[,] Bd = { { } };//y,x
|
||||||
public Dictionary<int, List<(int, int)>> board_Index { get; } = new Dictionary<int, List<(int, int)>>();
|
private Dictionary<int, List<(int, int)>> board_Index = new Dictionary<int, List<(int, int)>>();
|
||||||
public int[] Vals_per_Image { get; set; } = { };
|
private int[] Vals_per_Image { get; set; } = Array.Empty<int>();
|
||||||
public int total;
|
private int total;
|
||||||
public int Total
|
private int Total
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -23,13 +23,13 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
total = value;
|
total = value;
|
||||||
if (total == 0)
|
if (Total == 0)
|
||||||
Etcs.game_mode_form?.Finished_Handler(this, new Forms.FinishArgs { finish_Type = Forms.FinishArgs.Finish_Type.All_done });
|
Etcs.game_mode_form?.Finished_Handler(this, new Forms.FinishArgs { finish_Type = Forms.FinishArgs.Finish_Type.All_done });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int[,] make_board()
|
private Board_funcs board_Funcs = new Board_funcs();
|
||||||
|
public int[,] make_board()//Size from Etcs.get_length_width()
|
||||||
{
|
{
|
||||||
var rand = new Random();
|
|
||||||
size = Etcs.get_length_width();
|
size = Etcs.get_length_width();
|
||||||
var (width, height) = size;
|
var (width, height) = size;
|
||||||
Bd = new int[height + 2, width + 2];
|
Bd = new int[height + 2, width + 2];
|
||||||
|
@ -41,60 +41,13 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
sum--;
|
sum--;
|
||||||
total = sum;
|
total = sum;
|
||||||
int types = Etcs.Images_size();
|
int types = Etcs.Images_size();
|
||||||
Vals_per_Image = new int[types];
|
Vals_per_Image = board_Funcs.get_vals_per_image(Total, types);
|
||||||
int single = sum / types;
|
int last_val = -1;
|
||||||
for (int k = sum; k > 0; k -= 2)
|
|
||||||
{
|
|
||||||
int t = rand.Next(0, types);
|
|
||||||
if (Vals_per_Image[t] >= 1.5 * single)
|
|
||||||
{
|
|
||||||
k += 2;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
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 = () =>
|
|
||||||
{
|
|
||||||
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 = 0;
|
|
||||||
for(int i=0;i<temp_val_per_Image.Length;i++)
|
|
||||||
if (temp_val_per_Image[i]!=0)
|
|
||||||
{
|
|
||||||
k = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
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 < sum; i++)
|
for (int i = 0; i < sum; i++)
|
||||||
{
|
{
|
||||||
Bd[cur_height, cur_width] = getval();
|
Bd[cur_height, cur_width] = board_Funcs.getval(ref temp_val_per_Image, ref last_val, types);
|
||||||
if (board_Index.TryGetValue(Bd[cur_height, cur_width], out var index))
|
if (board_Index.TryGetValue(Bd[cur_height, cur_width], out var index))
|
||||||
index.Add((cur_width, cur_height));
|
index.Add((cur_width, cur_height));
|
||||||
else
|
else
|
||||||
|
@ -117,41 +70,11 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
int height = Bd.GetLength(0);
|
int height = Bd.GetLength(0);
|
||||||
int width = Bd.GetLength(1);
|
int width = Bd.GetLength(1);
|
||||||
int last_val = -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 i = 0; i < height; i++)
|
||||||
for (int j = 0; j < width; j++)
|
for (int j = 0; j < width; j++)
|
||||||
if (Bd[i, j] != -1)
|
if (Bd[i, j] != -1)
|
||||||
{
|
{
|
||||||
Bd[i, j] = getval();
|
Bd[i, j] = board_Funcs.getval(ref temp_val_per_Image, ref last_val, types);
|
||||||
if (board_Index.TryGetValue(Bd[i, j], out var index))
|
if (board_Index.TryGetValue(Bd[i, j], out var index))
|
||||||
index.Add((j, i));
|
index.Add((j, i));
|
||||||
else
|
else
|
||||||
|
@ -336,10 +259,10 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
if (!board_Index[type].Remove((x, y)))
|
if (!board_Index[type].Remove((x, y)))
|
||||||
throw new Exception("Val not Found in board_Index");
|
throw new Exception("Val not Found in board_Index");
|
||||||
Vals_per_Image[type]--;
|
Vals_per_Image[type]--;
|
||||||
|
Total--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public List<List<(int, int)>> get_tip((int, int) start)
|
||||||
internal List<List<(int, int)>> get_tip((int, int) start)
|
|
||||||
{
|
{
|
||||||
List<List<(int, int)>> ans = new List<List<(int, int)>>();
|
List<List<(int, int)>> ans = new List<List<(int, int)>>();
|
||||||
if (board_Index.TryGetValue(Bd[start.Item2, start.Item1], out var tip))
|
if (board_Index.TryGetValue(Bd[start.Item2, start.Item1], out var tip))
|
||||||
|
@ -352,6 +275,5 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
return ans;
|
return ans;
|
||||||
}
|
}
|
||||||
public (int, int) size { get; set; }//width,height
|
public (int, int) size { get; set; }//width,height
|
||||||
public Etcs.Mode mode { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,65 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||||
|
{
|
||||||
|
internal class Board_funcs
|
||||||
|
{
|
||||||
|
private Random random = new Random();
|
||||||
|
internal int getval(ref int[] temp_val_per_Image,ref int last_val,int types)
|
||||||
|
{
|
||||||
|
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 = 0;
|
||||||
|
for (int i = 0; i < temp_val_per_Image.Length; i++)
|
||||||
|
if (temp_val_per_Image[i] != 0)
|
||||||
|
{
|
||||||
|
k = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
temp_val_per_Image[k]--;
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
int t = random.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;
|
||||||
|
}
|
||||||
|
internal int[] get_vals_per_image(int total,int type_num)
|
||||||
|
{
|
||||||
|
int[] vals_per_Image= new int[type_num];
|
||||||
|
int single = total / type_num;
|
||||||
|
for (int k = total; k > 0; k -= 2)
|
||||||
|
{
|
||||||
|
int t = random.Next(0, type_num);
|
||||||
|
if (vals_per_Image[t] >= 1.5 * single)
|
||||||
|
{
|
||||||
|
k += 2;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
vals_per_Image[t] += 2;
|
||||||
|
}
|
||||||
|
return vals_per_Image;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,133 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||||
|
{
|
||||||
|
internal class Graph_Board : IBoard
|
||||||
|
{
|
||||||
|
class Node
|
||||||
|
{
|
||||||
|
public Node? LNode, RNode, UNode, DNode;
|
||||||
|
public int x, y;
|
||||||
|
public int value;
|
||||||
|
public Node(int x, int y, int value)
|
||||||
|
{
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.value = value;
|
||||||
|
LNode = RNode = UNode = DNode = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Node(Node? lNode, Node? rNode, Node? uNode, Node? dNode, int x, int y, int value)
|
||||||
|
{
|
||||||
|
LNode = lNode;
|
||||||
|
RNode = rNode;
|
||||||
|
UNode = uNode;
|
||||||
|
DNode = dNode;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public (int, int) size { get; set; }//width,height
|
||||||
|
Dictionary<(int,int),Node>Index = new Dictionary<(int,int), Node>();//width,height
|
||||||
|
private Dictionary<int, List<(int, int)>> board_Index = new Dictionary<int, List<(int, int)>>();
|
||||||
|
Board_funcs board_Funcs = new Board_funcs();
|
||||||
|
private int total;
|
||||||
|
private int Total
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
total = value;
|
||||||
|
if (Total == 0)
|
||||||
|
Etcs.game_mode_form?.Finished_Handler(this, new Forms.FinishArgs { finish_Type = Forms.FinishArgs.Finish_Type.All_done });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private int[] Vals_per_Image { get; set; } = Array.Empty<int>();
|
||||||
|
|
||||||
|
public void decrease(params (int, int)[] poss)
|
||||||
|
{
|
||||||
|
foreach (var (x, y) in poss)
|
||||||
|
{
|
||||||
|
int type = Index[(x, y)].value;
|
||||||
|
if (!Index.Remove((x, y)))
|
||||||
|
throw new Exception("Val not Found in Index");
|
||||||
|
if (!board_Index[type].Remove((x, y)))
|
||||||
|
throw new Exception("Val not Found in board_Index");
|
||||||
|
Vals_per_Image[type]--;
|
||||||
|
Total--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<List<(int, int)>> get_tip((int, int) start)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[,] make_board()
|
||||||
|
{
|
||||||
|
size = Etcs.get_length_width();
|
||||||
|
var (width, height) = size;
|
||||||
|
int[,]Bd = new int[height + 2, width + 2];
|
||||||
|
for (int i = 0; i < height + 2; i++)
|
||||||
|
for (int j = 0; j < width + 2; j++)
|
||||||
|
Bd[i, j] = -1;
|
||||||
|
|
||||||
|
int sum = width * height;
|
||||||
|
if (sum % 2 != 0)
|
||||||
|
sum--;
|
||||||
|
total = sum;
|
||||||
|
int types = Etcs.Images_size();
|
||||||
|
Vals_per_Image = board_Funcs.get_vals_per_image(Total, types);
|
||||||
|
int last_val = -1;
|
||||||
|
int cur_width = 1, cur_height = 1;
|
||||||
|
var temp_val_per_Image = (int[])Vals_per_Image.Clone();
|
||||||
|
for (int i = 0; i < sum; i++)
|
||||||
|
{
|
||||||
|
Bd[cur_height, cur_width] = board_Funcs.getval(ref temp_val_per_Image, ref last_val, types);
|
||||||
|
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) });
|
||||||
|
Index.Add((cur_width, cur_height), new Node(cur_width, cur_height, Bd[cur_height, cur_width]));
|
||||||
|
cur_width++;
|
||||||
|
if (cur_width > width)
|
||||||
|
{
|
||||||
|
cur_height++;
|
||||||
|
cur_width = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach(var (index,node)in Index)
|
||||||
|
{
|
||||||
|
if (Index.TryGetValue((node.x - 1, node.y), out var lnode))
|
||||||
|
node.LNode = lnode;
|
||||||
|
if (Index.TryGetValue((node.x + 1, node.y), out var rnode))
|
||||||
|
node.RNode = rnode;
|
||||||
|
if (Index.TryGetValue((node.x, node.y - 1), out var unode))
|
||||||
|
node.UNode = unode;
|
||||||
|
if (Index.TryGetValue((node.x, node.y + 1), out var dnode))
|
||||||
|
node.DNode = dnode;
|
||||||
|
Index[index] = node;
|
||||||
|
}
|
||||||
|
return Bd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int[,] remake_board()
|
||||||
|
{
|
||||||
|
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public (bool, List<(int, int)>?) test((int, int) a, (int, int) b)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
namespace CDSAE3_Lian_Lian_Kan.Boards
|
||||||
{
|
{
|
||||||
internal interface IBoard
|
internal interface IBoard
|
||||||
{
|
{
|
||||||
|
@ -12,8 +12,7 @@ namespace CDSAE3_Lian_Lian_Kan.Board_funcs
|
||||||
public int[,] remake_board();
|
public int[,] remake_board();
|
||||||
public (bool, List<(int, int)>?) test((int, int) a, (int, int) b);
|
public (bool, List<(int, int)>?) test((int, int) a, (int, int) b);
|
||||||
public void decrease(params (int, int)[] poss);
|
public void decrease(params (int, int)[] poss);
|
||||||
|
public List<List<(int, int)>> get_tip((int, int) start);
|
||||||
|
public (int, int) size { get; set; }//width,height
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ using System.Linq;
|
||||||
using System.Resources;
|
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.Boards;
|
||||||
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;
|
using CDSAE3_Lian_Lian_Kan.Sound;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
using CDSAE3_Lian_Lian_Kan.Board_funcs;
|
using CDSAE3_Lian_Lian_Kan.Boards;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
@ -234,7 +234,6 @@ namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
foreach (var control in blocks)
|
foreach (var control in blocks)
|
||||||
control.de_path();
|
control.de_path();
|
||||||
iGameMode?.Score_Add(this, new AddScoreArgs { score = (blocks.Count + 2) * 10 });
|
iGameMode?.Score_Add(this, new AddScoreArgs { score = (blocks.Count + 2) * 10 });
|
||||||
board.Total -= 2;
|
|
||||||
}
|
}
|
||||||
void playPanel_size_change()
|
void playPanel_size_change()
|
||||||
{
|
{
|
||||||
|
|
|
@ -7,7 +7,7 @@ using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using CDSAE3_Lian_Lian_Kan.Board_funcs;
|
using CDSAE3_Lian_Lian_Kan.Boards;
|
||||||
namespace CDSAE3_Lian_Lian_Kan.Forms
|
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
|
{
|
||||||
|
partial class Setting
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
private void InitializeComponent()
|
||||||
|
{
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// Setting
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(11F, 24F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(756, 571);
|
||||||
|
Name = "Setting";
|
||||||
|
Text = "Setting";
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace CDSAE3_Lian_Lian_Kan.Forms
|
||||||
|
{
|
||||||
|
public partial class Setting : Form
|
||||||
|
{
|
||||||
|
public Setting()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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>
|
|
@ -1,5 +1,6 @@
|
||||||
using CDSAE3_Lian_Lian_Kan.Forms;
|
using CDSAE3_Lian_Lian_Kan.Forms;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
@ -115,9 +116,22 @@ namespace CDSAE3_Lian_Lian_Kan
|
||||||
timer?.Stop();
|
timer?.Stop();
|
||||||
Image_change(Etcs.trans_Image);
|
Image_change(Etcs.trans_Image);
|
||||||
}
|
}
|
||||||
|
ConcurrentQueue<Image>images_queue = new ConcurrentQueue<Image>();
|
||||||
|
Thread? Image_setting_thread;
|
||||||
public void Image_change(Image new_image)
|
public void Image_change(Image new_image)
|
||||||
{
|
{
|
||||||
|
images_queue.Enqueue(new_image);
|
||||||
|
if(Image_setting_thread == null || !Image_setting_thread.IsAlive)
|
||||||
|
{
|
||||||
|
Image_setting_thread = new Thread(() =>
|
||||||
|
{
|
||||||
|
while (images_queue.TryDequeue(out Image? image))
|
||||||
|
{
|
||||||
|
Image_set(image);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Image_setting_thread.Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void Image_set(Image image)
|
private void Image_set(Image image)
|
||||||
{
|
{
|
||||||
|
|
Reference in New Issue