diff --git a/CDSAE3_Lian_Lian_Kan/Boards/Board.cs b/CDSAE3_Lian_Lian_Kan/Boards/Board.cs index 9db1eb3..a43bae5 100644 --- a/CDSAE3_Lian_Lian_Kan/Boards/Board.cs +++ b/CDSAE3_Lian_Lian_Kan/Boards/Board.cs @@ -1,10 +1,10 @@ 锘縰sing CDSAE3_Lian_Lian_Kan.Forms.Interface; namespace CDSAE3_Lian_Lian_Kan.Boards { - public partial class Board:IBoard + public partial class Board : IBoard { private int[,] Bd = { { } };//y,x - private Dictionary> board_Index = new Dictionary>(); + private Dictionary> boardIndex = new Dictionary>(); private int[] Vals_per_Image { get; set; } = Array.Empty(); private int total; private int Total @@ -17,7 +17,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards { total = value; if (Total == 0) - Etcs.gameModeForm?.Finished_Handler(this, new FinishArgs { finish_Type = FinishArgs.Finish_Type.All_done }); + Etcs.gameModeForm?.Finished_Handler(this, new FinishArgs { finishType = FinishArgs.FinishType.All_done }); } } private Board_funcs board_Funcs = new Board_funcs(); @@ -41,10 +41,10 @@ namespace CDSAE3_Lian_Lian_Kan.Boards 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)) + if (boardIndex.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) }); + boardIndex.Add(Bd[cur_height, cur_width], new List<(int, int)> { (cur_width, cur_height) }); cur_width++; if (cur_width > width) { @@ -56,7 +56,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards } public int[,] remake_board() { - board_Index.Clear(); + boardIndex.Clear(); var rand = new Random(); int[] temp_val_per_Image = (int[])Vals_per_Image.Clone(); int types = Vals_per_Image.Length; @@ -68,10 +68,10 @@ namespace CDSAE3_Lian_Lian_Kan.Boards if (Bd[i, j] != -1) { 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 (boardIndex.TryGetValue(Bd[i, j], out var index)) index.Add((j, i)); else - board_Index.Add(Bd[i, j], new List<(int, int)> { (j, i) }); + boardIndex.Add(Bd[i, j], new List<(int, int)> { (j, i) }); } return Bd; } @@ -249,7 +249,9 @@ namespace CDSAE3_Lian_Lian_Kan.Boards { int type = Bd[y, x]; Bd[y, x] = -1; - if (!board_Index[type].Remove((x, y))) + if (type == -1) + return; + if (!boardIndex[type].Remove((x, y))) throw new Exception("Val not Found in board_Index"); Vals_per_Image[type]--; Total--; @@ -258,7 +260,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards public List> get_tip((int, int) start) { List> ans = new List>(); - if (board_Index.TryGetValue(Bd[start.Item2, start.Item1], out var tip)) + if (boardIndex.TryGetValue(Bd[start.Item2, start.Item1], out var tip)) foreach (var pos in tip) { var (result, path) = test(start, pos); @@ -267,6 +269,19 @@ namespace CDSAE3_Lian_Lian_Kan.Boards } return ans; } + + public (int, int) GetRandomBlock() + { + Random random = new(); + int k = random.Next(0, boardIndex.Count); + for (int i = 0; i < boardIndex.Count(); i++) + { + if (boardIndex[k + i].Count != 0) + return boardIndex[k + i][random.Next(0, boardIndex[k + i].Count)]; + } + return (-1, -1); + } + public (int, int) size { get; set; }//width,height } } diff --git a/CDSAE3_Lian_Lian_Kan/Boards/Graph_Board.cs b/CDSAE3_Lian_Lian_Kan/Boards/Graph_Board.cs index c619847..5584a28 100644 --- a/CDSAE3_Lian_Lian_Kan/Boards/Graph_Board.cs +++ b/CDSAE3_Lian_Lian_Kan/Boards/Graph_Board.cs @@ -35,7 +35,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards } public (int, int) size { get; set; }//width,height Dictionary<(int,int),Node>Index = new Dictionary<(int,int), Node>();//width,height - private Dictionary> board_Index = new Dictionary>(); + private Dictionary> boardIndex = new Dictionary>(); Board_funcs board_Funcs = new Board_funcs(); private int total; private int Total @@ -48,7 +48,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards { total = value; if (Total == 0) - Etcs.gameModeForm?.Finished_Handler(this, new FinishArgs { finish_Type = FinishArgs.Finish_Type.All_done }); + Etcs.gameModeForm?.Finished_Handler(this, new FinishArgs { finishType = FinishArgs.FinishType.All_done }); } } private int[] Vals_per_Image { get; set; } = Array.Empty(); @@ -72,7 +72,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards } else throw new Exception("Val not Found in Index"); - if (!board_Index[type].Remove((x, y))) + if (!boardIndex[type].Remove((x, y))) throw new Exception("Val not Found in board_Index"); Vals_per_Image[type]--; Total--; @@ -82,7 +82,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards public List> get_tip((int, int) start) { List> ans = new List>(); - if (board_Index.TryGetValue(Index[start].value, out var tip)) + if (boardIndex.TryGetValue(Index[start].value, out var tip)) foreach (var pos in tip) { var (result, path) = test(start, pos); @@ -120,10 +120,10 @@ namespace CDSAE3_Lian_Lian_Kan.Boards 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)) + if (boardIndex.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) }); + boardIndex.Add(Bd[cur_height, cur_width], new List<(int, int)> { (cur_width, cur_height) }); Index[(cur_width, cur_height)].value = Bd[cur_height, cur_width]; cur_width++; if (cur_width > width) @@ -151,7 +151,7 @@ namespace CDSAE3_Lian_Lian_Kan.Boards public int[,] remake_board() { - board_Index.Clear(); + boardIndex.Clear(); int[] temp_val_per_Image = (int[])Vals_per_Image.Clone(); var (width, height) = size; int[,] Bd = new int[height + 2, width + 2]; @@ -165,10 +165,10 @@ namespace CDSAE3_Lian_Lian_Kan.Boards continue; node.value = board_Funcs.getval(ref temp_val_per_Image, ref last_val, Etcs.Images_size()); Bd[node.y,node.x] = node.value; - if(board_Index.TryGetValue(node.value,out var list)) + if(boardIndex.TryGetValue(node.value,out var list)) list.Add((node.x, node.y)); else - board_Index.Add(node.value, new List<(int, int)> { (node.x, node.y) }); + boardIndex.Add(node.value, new List<(int, int)> { (node.x, node.y) }); } return Bd; } @@ -308,5 +308,17 @@ namespace CDSAE3_Lian_Lian_Kan.Boards } + + public (int, int) GetRandomBlock() + { + Random random = new(); + int k = random.Next(0, boardIndex.Count); + for(int i = 0;i> get_tip((int, int) start); public (int, int) size { get; set; }//width,height + public (int, int) GetRandomBlock(); } } diff --git a/CDSAE3_Lian_Lian_Kan/CDSAE3_Lian_Lian_Kan.csproj b/CDSAE3_Lian_Lian_Kan/CDSAE3_Lian_Lian_Kan.csproj index 2c6700a..f34d782 100644 --- a/CDSAE3_Lian_Lian_Kan/CDSAE3_Lian_Lian_Kan.csproj +++ b/CDSAE3_Lian_Lian_Kan/CDSAE3_Lian_Lian_Kan.csproj @@ -23,7 +23,11 @@ + + + + @@ -41,6 +45,10 @@ + + + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Etcs.cs b/CDSAE3_Lian_Lian_Kan/Etcs.cs index e30fb81..eb5fe15 100644 --- a/CDSAE3_Lian_Lian_Kan/Etcs.cs +++ b/CDSAE3_Lian_Lian_Kan/Etcs.cs @@ -1,4 +1,5 @@ 锘縰sing System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Globalization; using System.Linq; @@ -65,11 +66,18 @@ namespace CDSAE3_Lian_Lian_Kan easy = 0, normal = 1, hard = 2, - custom = 3 + custom = 3, + challenge = 4 + } + public enum Algorithm + { + Array = 0, + Graph = 1 } public enum Theme { - fruit = 0 + fruit = 0, + code = 1 } public enum Direction { @@ -106,26 +114,30 @@ namespace CDSAE3_Lian_Lian_Kan {8,100.0/10 }, {9,100.0/5 }, {10,100.0/3 }}; - + public static string curAlbum = "C418"; public static int cus_height = 1, cus_width = 1; + public static Algorithm curAlgorithm = Algorithm.Array; public static Dictionary themes { get; set; } = JsonSerializer.Deserialize(File.ReadAllText("Resources\\sources.json"), new JsonSerializerOptions() {Encoder = JavaScriptEncoder.Create(UnicodeRanges.All) })!.Themes!.ToDictionary(x => x.Name); public static System.Timers.Timer hunderd_millsecond_timer { get; set; } = new System.Timers.Timer(100) { AutoReset = true, Enabled = true }; public static Difficulty current_difficulty { get; set; } = Difficulty.normal; - public static Theme current_block_theme { get; set; } + public static Theme current_block_theme { get; set; } = Theme.fruit; public static ThemeInfo currentThemeInfo { get; set; } = themes["Fruit"]; 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 List block_Images { get; set; } = new List { Resources.Apple, Resources.Banana, Resources.Beetroot, Resources.Cherry, Resources.Corn, Resources.Eggplant, Resources.Grape, Resources.Pear, Resources.Strawberry, Resources.Watermelon }; - public static List disappear_Images { get; set; } = new List { Resources.Gapple, Resources.Gbanana, Resources.Gbeetroot, Resources.Gcherry, Resources.Gcorn, Resources.Geggplant, Resources.Ggrape, Resources.Gpear, Resources.Gstrawberry, Resources.Gwatermelon }; - public static List direction_Images { get; set; } = new List { 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 tip_direction_Image { get; set; } = new List { 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_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_block_theme switch { Theme.fruit => 10, _ => 0, }; - public static Image get_tip_direction_Image(Direction direction) => tip_direction_Image[(int)direction]; + public static (int, int) get_length_width() => current_difficulty == Difficulty.challenge ? (18, 9) : (current_difficulty != Difficulty.custom ? (7 * (1 + (int)current_difficulty), 4 * (1 + (int)current_difficulty)) : (cus_width, cus_height)); + public static ConcurrentBag fruit_Images { get; set; } = new() { Resources.Apple, Resources.Banana, Resources.Beetroot, Resources.Cherry, Resources.Corn, Resources.Eggplant, Resources.Grape, Resources.Pear, Resources.Strawberry, Resources.Watermelon }; + public static ConcurrentBag disappear_fruit_Images { get; set; } = new () { Resources.Gapple, Resources.Gbanana, Resources.Gbeetroot, Resources.Gcherry, Resources.Gcorn, Resources.Geggplant, Resources.Ggrape, Resources.Gpear, Resources.Gstrawberry, Resources.Gwatermelon }; + public static ConcurrentBag code_Images { get; set; } = new() { Resources.cpp, Resources.cSharp, Resources.go, Resources.java, Resources.kotlin, Resources.python, Resources.ruby, Resources.rust, Resources.vue}; + public static ConcurrentBag disappear_code_Images { get; set; } = new() { Resources.Gcpp, Resources.GcSharp, Resources.Ggo, Resources.Gjava, Resources.Gkotlin, Resources.Gpython, Resources.Gruby, Resources.Grust, Resources.Gvue }; + public static ConcurrentDictionary direction_Images { get; set; } = new ConcurrentDictionary(new List { 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 }.Select((value, index) => new { Index = (Direction)index, Value = value }).ToDictionary(item => item.Index, item => item.Value)); + public static ConcurrentDictionary direction_Images_white_version { get; set; } = new ConcurrentDictionary (new List(){ Resources.trans, Resources.w_u, Resources.w_r, Resources.w_ur, Resources.w_d, Resources.w_ud, Resources.w_dr, Resources.w_udr, Resources.w_l, Resources.w_ul, Resources.w_lr, Resources.w_ulr, Resources.w_dl, Resources.w_udl, Resources.w_dlr, Resources.w_udlr }.Select((value, index) => new { Index = (Direction)index, Value = value }).ToDictionary(item => item.Index, item => item.Value)); + public static ConcurrentDictionary tip_direction_Image { get; set; } = new ConcurrentDictionary(new List{ 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 }.Select((value, index) => new { Index = (Direction)index, Value = value }).ToDictionary(item => item.Index, item => item.Value)); + public static Image get_block_Image(int t) => current_block_theme == Theme.fruit ? fruit_Images.ElementAt(t) : code_Images.ElementAt(t); + public static Image get_disappear_Images(int t) => current_block_theme == Theme.fruit ? disappear_fruit_Images.ElementAt(t) : disappear_code_Images.ElementAt(t); + public static Image get_direction_Image(Direction direction) => current_difficulty != Difficulty.challenge ? direction_Images.GetOrAdd(direction, (dire) => null!) : direction_Images_white_version.GetOrAdd(direction,(dire)=>null!); + public static int Images_size() => current_block_theme switch { Theme.fruit => fruit_Images.Count(), Theme.code => code_Images.Count(), _ => 0 }; + public static Image get_tip_direction_Image(Direction direction) => tip_direction_Image.GetOrAdd(direction, (dire) => null!); public static LianLianKan? form { get; set; } public static IGameControl? gameForm { get; set; }//gameBoard public static IGameMode? gameModeForm { get; set; }//entireGame @@ -135,7 +147,8 @@ namespace CDSAE3_Lian_Lian_Kan public static Color sel_Color { get; set; } = Color.FromArgb(0, 122, 204); public static Color mouse_upper_color { get; set; } = Color.FromArgb(97, 97, 108); public static Dictionary> musics { get; set; } = new Dictionary> { { "C418", new List { "C418 - Beginning 2", "C418 - Floating Trees", "C418 - Moog City 2", "C418 - Mutation" } }, - {"Sea Power",new List{ "Sea Power - Advesperascit", "Sea Power - Burn, Baby, Burn", "Sea Power - Detective Arriving on the Scene", "Sea Power - Disco Elysium, Pt 1", "Sea Power - Disco Elysium, Pt 2", "Sea Power - Ecstatic Vibrations, Totally Transcendent", "Sea Power - Hope in Work and Joy in Leisure", "Sea Power - Ignus Nilsen Waltz", "Sea Power - Instrument of Surrender", "Sea Power - Krenel, Downwell, Somatosensor", "Sea Power - La Revacholiere", "Sea Power - Live With Me", "Sea Power - Martinaise, Terminal B", "Sea Power - Miss Oranje Disco Dancer", "Sea Power - Off We Go Into the Wild Pale Yonder", "Sea Power - Ployhedrons", "Sea Power - Precinct 41 Major Crime Unit", "Sea Power - Rue de Saint-Gislaine", "Sea Power - Saint-Brune 1147", "Sea Power - The Cryptozoologists", "Sea Power - The Doomed Commercial Area", "Sea Power - The Field Autopsy", "Sea Power - The Insulindian Miracle", "Sea Power - Tiger King", "Sea Power - We Are Not Checkmated", "Sea Power - Whirling In Rags 12Pm", "Sea Power - Whirling in Rags 8am", "Sea Power - Whirling in Rags 8pm", "Sea Power - Your Body Betrays Your Degeneracy", "Sea Power - Zaum" } } }; + {"Sea Power",new List{ "Sea Power - Advesperascit", "Sea Power - Burn, Baby, Burn", "Sea Power - Detective Arriving on the Scene", "Sea Power - Disco Elysium, Pt 1", "Sea Power - Disco Elysium, Pt 2", "Sea Power - Ecstatic Vibrations, Totally Transcendent", "Sea Power - Hope in Work and Joy in Leisure", "Sea Power - Ignus Nilsen Waltz", "Sea Power - Instrument of Surrender", "Sea Power - Krenel, Downwell, Somatosensor", "Sea Power - La Revacholiere", "Sea Power - Live With Me", "Sea Power - Martinaise, Terminal B", "Sea Power - Miss Oranje Disco Dancer", "Sea Power - Off We Go Into the Wild Pale Yonder", "Sea Power - Ployhedrons", "Sea Power - Precinct 41 Major Crime Unit", "Sea Power - Rue de Saint-Gislaine", "Sea Power - Saint-Brune 1147", "Sea Power - The Cryptozoologists", "Sea Power - The Doomed Commercial Area", "Sea Power - The Field Autopsy", "Sea Power - The Insulindian Miracle", "Sea Power - Tiger King", "Sea Power - We Are Not Checkmated", "Sea Power - Whirling In Rags 12Pm", "Sea Power - Whirling in Rags 8am", "Sea Power - Whirling in Rags 8pm", "Sea Power - Your Body Betrays Your Degeneracy", "Sea Power - Zaum" } } , + {"Tatsh",new List{ "Tatsh - Xenolith" } } }; public static Audio_res_manager audio_Res_Manager { get; set; } = new Audio_res_manager(); public static Song_Audio_processer song_Audio_Processer { get; set; } = new Song_Audio_processer(); public static Info_Audio_processer info_Audio_Processer { get; set; } = new Info_Audio_processer(); diff --git a/CDSAE3_Lian_Lian_Kan/Extensions/BitmapExtensions.cs b/CDSAE3_Lian_Lian_Kan/Extensions/BitmapExtensions.cs new file mode 100644 index 0000000..c3a90e4 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Extensions/BitmapExtensions.cs @@ -0,0 +1,26 @@ +锘縰sing System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; +using OpenCvSharp; +using OpenCvSharp.Extensions; + +namespace CDSAE3_Lian_Lian_Kan.Extensions +{ + + public static class BitmapExtensions + { + public static Bitmap GaussianBlur(this Bitmap Bmp) + { + Mat src = BitmapConverter.ToMat(Bmp); + Mat dest = new Mat(); + Cv2.Blur(src, dest, new OpenCvSharp.Size(50,50)); + return OpenCvSharp.Extensions.BitmapConverter.ToBitmap(dest); + } + + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/MainWindow.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/MainWindow.Designer.cs new file mode 100644 index 0000000..eb25d98 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/MainWindow.Designer.cs @@ -0,0 +1,77 @@ +锘縩amespace AudioVisualizer +{ + partial class MainWindow + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + dataTimer = new System.Windows.Forms.Timer(components); + drawingPanel = new Panel(); + drawingTimer = new System.Windows.Forms.Timer(components); + SuspendLayout(); + // + // dataTimer + // + dataTimer.Interval = 30; + dataTimer.Tick += DataTimer_Tick; + // + // drawingPanel + // + drawingPanel.Dock = DockStyle.Fill; + drawingPanel.Location = new Point(0, 0); + drawingPanel.Name = "drawingPanel"; + drawingPanel.Size = new Size(880, 432); + drawingPanel.TabIndex = 0; + drawingPanel.MouseDoubleClick += DrawingPanel_MouseDoubleClick; + // + // drawingTimer + // + drawingTimer.Interval = 30; + drawingTimer.Tick += DrawingTimer_Tick; + // + // MainWindow + // + AutoScaleDimensions = new SizeF(11F, 24F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = Color.Black; + ClientSize = new Size(880, 432); + Controls.Add(drawingPanel); + FormBorderStyle = FormBorderStyle.None; + Name = "MainWindow"; + Text = "Music Visualizer"; + FormClosed += MainWindow_FormClosed; + Load += MainWindow_Load; + ResumeLayout(false); + } + + #endregion + + private System.Windows.Forms.Timer dataTimer; + private Panel drawingPanel; + private System.Windows.Forms.Timer drawingTimer; + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/MainWindow.cs b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/MainWindow.cs new file mode 100644 index 0000000..104aece --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/MainWindow.cs @@ -0,0 +1,466 @@ +using LibAudioVisualizer; +using NAudio.CoreAudioApi; +using NAudio.Wave; +using System.Drawing.Drawing2D; +using System.Numerics; + +namespace AudioVisualizer +{ + public partial class MainWindow : Form + { + WasapiCapture capture; // 音频捕获 + Visualizer visualizer; // 可视化 + double[]? spectrumData; // 频谱数据 + + Color[] allColors; // 渐变颜色 + + public MainWindow() + { + capture = new WasapiLoopbackCapture(); // 捕获电脑发出的声音 + visualizer = new Visualizer(256); // 新建一个可视化器, 并使用 256 个采样进行傅里叶变换 + + allColors = GetAllHsvColors(); // 获取所有的渐变颜色 (HSV 颜色) + + capture.WaveFormat = WaveFormat.CreateIeeeFloatWaveFormat(8192, 1); // 指定捕获的格式, 单声道, 32位深度, IeeeFloat 编码, 8192采样率 + capture.DataAvailable += Capture_DataAvailable; // 订阅事件 + + InitializeComponent(); + } + + /// + /// 获取 HSV 中所有的基础颜色 (饱和度和明度均为最大值) + /// + /// 所有的 HSV 基础颜色(共 256 * 6 个, 并且随着索引增加, 颜色也会渐变) + private Color[] GetAllHsvColors() + { + Color[] result = new Color[256 * 6]; + + for (int i = 0; i < 256; i++) + { + result[i] = Color.FromArgb(255, i, 0); + } + + for (int i = 0; i < 256; i++) + { + result[256 + i] = Color.FromArgb(255 - i, 255, 0); + } + + for (int i = 0; i < 256; i++) + { + result[512 + i] = Color.FromArgb(0, 255, i); + } + + for (int i = 0; i < 256; i++) + { + result[768 + i] = Color.FromArgb(0, 255 - i, 255); + } + + for (int i = 0; i < 256; i++) + { + result[1024 + i] = Color.FromArgb(i, 0, 255); + } + + for (int i = 0; i < 256; i++) + { + result[1280 + i] = Color.FromArgb(255, 0, 255 - i); + } + + return result; + } + + /// + /// 当捕获有数据的时候, 就怼到可视化器里面 + /// + /// + /// + private void Capture_DataAvailable(object? sender, WaveInEventArgs e) + { + int length = e.BytesRecorded / 4; // 采样的数量 (每一个采样是 4 字节) + double[] result = new double[length]; // 声明结果 + + for (int i = 0; i < length; i++) + result[i] = BitConverter.ToSingle(e.Buffer, i * 4); // 取出采样值 + + visualizer.PushSampleData(result); // 将新的采样存储到 可视化器 中 + } + + /// + /// 用来刷新频谱数据以及实现频谱数据缓动 + /// + /// + /// + private void DataTimer_Tick(object? sender, EventArgs e) + { + double[] newSpectrumData = visualizer.GetSpectrumData(); // 从可视化器中获取频谱数据 + newSpectrumData = Visualizer.GetBlurry(newSpectrumData, 2); // 平滑频谱数据 + + spectrumData = newSpectrumData; + } + + /// + /// 绘制一个渐变的 波浪 + /// + /// 绘图目标 + /// 下方颜色 + /// 上方颜色 + /// 频谱数据 + /// 波浪中, 点的数量 + /// 波浪的宽度 + /// 波浪的起始X坐标 + /// 波浪的其实Y坐标 + /// 频谱的缩放(使用负值可以翻转波浪) + private void DrawGradient(Graphics g, Color down, Color up, double[] spectrumData, int pointCount, int drawingWidth, float xOffset, float yOffset, double scale) + { + GraphicsPath path = new GraphicsPath(); + + PointF[] points = new PointF[pointCount + 2]; + for (int i = 0; i < pointCount; i++) + { + double x = i * drawingWidth / pointCount + xOffset; + double y = spectrumData[i * spectrumData.Length / pointCount] * scale + yOffset; + points[i + 1] = new PointF((float)x, (float)y); + } + + points[0] = new PointF(xOffset, yOffset); + points[points.Length - 1] = new PointF(xOffset + drawingWidth, yOffset); + + path.AddCurve(points); + + float upP = (float)points.Min(v => v.Y); + + if (Math.Abs(upP - yOffset) < 1) + return; + + using Brush brush = new LinearGradientBrush(new PointF(0, yOffset), new PointF(0, upP), down, up); + g.FillPath(brush, path); + } + + /// + /// 绘制渐变的条形 + /// + /// 绘图目标 + /// 下方颜色 + /// 上方颜色 + /// 频谱数据 + /// 条形的数量 + /// 绘图的宽度 + /// 绘图的起始 X 坐标 + /// 绘图的起始 Y 坐标 + /// 条形与条形之间的间隔(像素) + /// + private void DrawGradientStrips(Graphics g, Color down, Color up, double[] spectrumData, int stripCount, int drawingWidth, float xOffset, float yOffset, float spacing, double scale) + { + float stripWidth = (drawingWidth - spacing * stripCount) / stripCount; + PointF[] points = new PointF[stripCount]; + + for (int i = 0; i < stripCount; i++) + { + double x = stripWidth * i + spacing * i + xOffset; + double y = spectrumData[i * spectrumData.Length / stripCount] * scale; // height + points[i] = new PointF((float)x, (float)y); + } + + float upP = (float)points.Min(v => v.Y < 0 ? yOffset + v.Y : yOffset); + float downP = (float)points.Max(v => v.Y < 0 ? yOffset : yOffset + v.Y); + + if (downP < yOffset) + downP = yOffset; + + if (Math.Abs(upP - downP) < 1) + return; + + using Brush brush = new LinearGradientBrush(new PointF(0, downP), new PointF(0, upP), down, up); + + for (int i = 0; i < stripCount; i++) + { + PointF p = points[i]; + float y = yOffset; + float height = p.Y; + + if (height < 0) + { + y += height; + height = -height; + } + + g.FillRectangle(brush, new RectangleF(p.X, y, stripWidth, height)); + } + } + + /// + /// 画曲线 + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void DrawCurve(Graphics g, Pen pen, double[] spectrumData, int pointCount, int drawingWidth, double xOffset, double yOffset, double scale) + { + PointF[] points = new PointF[pointCount]; + for (int i = 0; i < pointCount; i++) + { + double x = i * drawingWidth / pointCount + xOffset; + double y = spectrumData[i * spectrumData.Length / pointCount] * scale + yOffset; + points[i] = new PointF((float)x, (float)y); + } + + g.DrawCurve(pen, points); + } + + /// + /// 画简单的圆环线条 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void DrawCircleStrips(Graphics g, Brush brush, double[] spectrumData, int stripCount, double xOffset, double yOffset, double radius, double spacing, double rotation, double scale) + { + double rotationAngle = Math.PI / 180 * rotation; + double blockWidth = MathF.PI * 2 / stripCount; // angle + double stripWidth = blockWidth - MathF.PI / 180 * spacing; // angle + PointF[] points = new PointF[stripCount]; + + for (int i = 0; i < stripCount; i++) + { + double x = blockWidth * i + rotationAngle; // angle + double y = spectrumData[i * spectrumData.Length / stripCount] * scale; // height + points[i] = new PointF((float)x, (float)y); + } + + for (int i = 0; i < stripCount; i++) + { + PointF p = points[i]; + double sinStart = Math.Sin(p.X); + double sinEnd = Math.Sin(p.X + stripWidth); + double cosStart = Math.Cos(p.X); + double cosEnd = Math.Cos(p.X + stripWidth); + + PointF[] polygon = new PointF[] + { + new PointF((float)(cosStart * radius + xOffset), (float)(sinStart * radius + yOffset)), + new PointF((float)(cosEnd * radius + xOffset), (float)(sinEnd * radius + yOffset)), + new PointF((float)(cosEnd * (radius + p.Y) + xOffset), (float)(sinEnd * (radius + p.Y) + yOffset)), + new PointF((float)(cosStart * (radius + p.Y) + xOffset), (float)(sinStart * (radius + p.Y) + yOffset)), + }; + + g.FillPolygon(brush, polygon); + } + } + + /// + /// 画圆环渐变条 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void DrawCircleGradientStrips(Graphics g, Color inner, Color outer, double[] spectrumData, int stripCount, double xOffset, double yOffset, double radius, double spacing, double rotation, double scale) + { + double rotationAngle = Math.PI / 180 * rotation; + double blockWidth = Math.PI * 2 / stripCount; // angle + double stripWidth = blockWidth - MathF.PI / 180 * spacing; // angle + PointF[] points = new PointF[stripCount]; + + for (int i = 0; i < stripCount; i++) + { + double x = blockWidth * i + rotationAngle; // angle + double y = spectrumData[i * spectrumData.Length / stripCount] * scale; // height + points[i] = new PointF((float)x, (float)y); + } + + double maxHeight = points.Max(v => v.Y); + double outerRadius = radius + maxHeight; + + PointF[] polygon = new PointF[4]; + for (int i = 0; i < stripCount; i++) + { + PointF p = points[i]; + double sinStart = Math.Sin(p.X); + double sinEnd = Math.Sin(p.X + stripWidth); + double cosStart = Math.Cos(p.X); + double cosEnd = Math.Cos(p.X + stripWidth); + + PointF + p1 = new PointF((float)(cosStart * radius + xOffset),(float)(sinStart * radius + yOffset)), + p2 = new PointF((float)(cosEnd * radius + xOffset),(float)(sinEnd * radius + yOffset)), + p3 = new PointF((float)(cosEnd * (radius + p.Y) + xOffset), (float)(sinEnd * (radius + p.Y) + yOffset)), + p4 = new PointF((float)(cosStart * (radius + p.Y) + xOffset), (float)(sinStart * (radius + p.Y) + yOffset)); + + polygon[0] = p1; + polygon[1] = p2; + polygon[2] = p3; + polygon[3] = p4; + + + PointF innerP = new PointF((p1.X + p2.X) / 2, (p1.Y + p2.Y) / 2); + PointF outerP = new PointF((p3.X + p4.X) / 2, (p3.Y + p4.Y) / 2); + + Vector2 offset = new Vector2(outerP.X - innerP.X, outerP.Y - innerP.Y); + if (MathF.Sqrt(offset.X * offset.X + offset.Y * offset.Y) < 1) // 渐变笔刷两点之间距离不能太小 + continue; + + try + { + using LinearGradientBrush brush = new LinearGradientBrush(innerP, outerP, inner, outer); // 这里有玄学 bug, 这个 线性笔刷会 OutMemoryException + g.FillPolygon(brush, polygon); // 但是实际上不应该有这个异常... + } + catch { } + } + } + + /// + /// 画简单的线条 + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + private void DrawStrips(Graphics g, Brush brush, double[] spectrumData, int stripCount, int drawingWidth, float xOffset, float yOffset, float spacing, double scale) + { + float stripWidth = (drawingWidth - spacing * stripCount) / stripCount; + PointF[] points = new PointF[stripCount]; + + for (int i = 0; i < stripCount; i++) + { + double x = stripWidth * i + spacing * i + xOffset; + double y = spectrumData[i * spectrumData.Length / stripCount] * scale; // height + points[i] = new PointF((float)x, (float)y); + } + + for (int i = 0; i < stripCount; i++) + { + PointF p = points[i]; + float y = yOffset; + float height = p.Y; + + if (height < 0) + { + y += height; + height = -height; + } + + g.FillRectangle(brush, new RectangleF(p.X, y, stripWidth, height)); + } + } + + /// + /// 画渐变的边框 + /// + /// + /// + /// + /// + /// + /// + private void DrawGradientBorder(Graphics g, Color inner, Color outer, Rectangle area, double scale, float width) + { + int thickness = (int)(width * scale); + if (thickness < 1) + return; + + Rectangle rect = new Rectangle(area.X, area.Y, area.Width, area.Height); + + Rectangle up = new Rectangle(rect.Location, new Size(rect.Width, thickness)); + Rectangle down = new Rectangle(new Point(rect.X, (int)(rect.X + rect.Height - scale * width)), new Size(rect.Width, thickness)); + Rectangle left = new Rectangle(rect.Location, new Size(thickness, rect.Height)); + Rectangle right = new Rectangle(new Point((int)(rect.X + rect.Width - scale * width), rect.Y), new Size(thickness, rect.Height)); + + LinearGradientBrush upB = new LinearGradientBrush(up, outer, inner, LinearGradientMode.Vertical); + LinearGradientBrush downB = new LinearGradientBrush(down, inner, outer, LinearGradientMode.Vertical); + LinearGradientBrush leftB = new LinearGradientBrush(left, outer, inner, LinearGradientMode.Horizontal); + LinearGradientBrush rightB = new LinearGradientBrush(right, inner, outer, LinearGradientMode.Horizontal); + + upB.WrapMode = downB.WrapMode = leftB.WrapMode = rightB.WrapMode = WrapMode.TileFlipXY; + + g.FillRectangle(upB, up); + g.FillRectangle(downB, down); + g.FillRectangle(leftB, left); + g.FillRectangle(rightB, right); + } + + int colorIndex = 0; + double rotation = 0; + BufferedGraphics? oldBuffer; + private void DrawingTimer_Tick(object? sender, EventArgs e) + { + if (spectrumData == null) + return; + + rotation += 0.1; + colorIndex++; + + Color color1 = allColors[colorIndex % allColors.Length]; + Color color2 = allColors[(colorIndex + 200) % allColors.Length]; + + double[] bassArea = Visualizer.TakeSpectrumOfFrequency(spectrumData, capture.WaveFormat.SampleRate, 250); // 低频区域 + double bassScale = bassArea.Average() * 100; // 低音导致的缩放 (比例数) + double extraScale = Math.Min(drawingPanel.Width, drawingPanel.Height) / 6; // 低音导致的缩放 (乘上窗口大小) + + Rectangle border = new Rectangle(Point.Empty, drawingPanel.Size); + + BufferedGraphics buffer = BufferedGraphicsManager.Current.Allocate(drawingPanel.CreateGraphics(), drawingPanel.ClientRectangle); + Graphics g = buffer.Graphics; + + if (oldBuffer != null) + { + //oldBuffer.Render(buffer.Graphics); // 如果你想要实现 "留影" 效果, 就取消注释这段代码, 并且将 g.Clear 改为 g.FillRectange(xxx, 半透明的黑色) + oldBuffer.Dispose(); + } + + using Pen pen = new Pen(Color.Pink); // 画音频采样波形用的笔 + + g.SmoothingMode = SmoothingMode.HighQuality; // 嗨嗨害, 那必须得是高质量绘图 + g.Clear(drawingPanel.BackColor); + + //DrawGradientBorder(g, Color.FromArgb(0, color1), color2, border, bassScale, drawingPanel.Width / 10); + DrawGradientStrips(g, color1, color2, spectrumData, spectrumData.Length, drawingPanel.Width, 0, drawingPanel.Height, 3, -drawingPanel.Height * 50); + //DrawCircleGradientStrips(g, color1, color2, spectrumData, spectrumData.Length, drawingPanel.Width / 2, drawingPanel.Height / 2, MathF.Min(drawingPanel.Width, drawingPanel.Height) / 4 + extraScale * bassScale, 1, rotation, drawingPanel.Width / 6 * 10); + + //DrawCurve(g, pen, visualizer.SampleData, visualizer.SampleData.Length, drawingPanel.Width, 0, drawingPanel.Height / 2, MathF.Min(drawingPanel.Height / 10, 100)); + + buffer.Render(); + + oldBuffer = buffer; // 保存一下 buffer (之所以不全局只使用一个 Buffer 是因为,,, 用户可能调整窗口大小, 所以每一帧都必须适应) + } + + private void MainWindow_Load(object sender, EventArgs e) + { + capture.StartRecording(); + dataTimer.Start(); + drawingTimer.Start(); + } + + private void MainWindow_FormClosed(object sender, FormClosedEventArgs e) + { + Environment.Exit(0); + } + + private void DrawingPanel_MouseDoubleClick(object sender, MouseEventArgs e) + { + WindowState = WindowState != FormWindowState.Maximized ? FormWindowState.Maximized : FormWindowState.Normal; + FormBorderStyle = WindowState == FormWindowState.Maximized ? FormBorderStyle.None : FormBorderStyle.Sizable; + } + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/MainWindow.resx b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/MainWindow.resx new file mode 100644 index 0000000..97c0a57 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/MainWindow.resx @@ -0,0 +1,126 @@ +锘 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + 197, 17 + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/SecondOrderDynamics.cs b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/SecondOrderDynamics.cs new file mode 100644 index 0000000..64f4243 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/SecondOrderDynamics.cs @@ -0,0 +1,106 @@ +锘縩amespace LibDynamics +{ + public class SecondOrderDynamics + { + private double xp;// previous input + private double y, yd; // state variables + private double _w, _z, _d, k1, k2, k3; // dynamics constants + private double _r; + private double _f; + + /// + /// 棰戠巼 + /// - 鍗抽熷害, 鍗曚綅鏄但鍏(Hz) + /// - 涓嶄細褰卞搷杈撳嚭缁撴灉鐨勫舰鐘, 浼氬奖鍝 '闇囪崱棰戠巼' + /// + public double F + { + get => _f; set + { + _f = value; + InitMotionValues(_f, _z, _r); + } + } + + /// + /// 闃诲凹
+ /// - 褰撲负 0 鏃, 杈撳嚭灏嗘案杩滈渿鑽′笉琛板噺
+ /// - 褰撳ぇ浜 0 灏忎簬 1 鏃, 杈撳嚭浼氳秴鍑虹粨鏋, 骞堕愭笎瓒嬩簬鐩爣
+ /// - 褰撲负 1 鏃, 杈撳嚭鐨勬洸绾挎槸瓒嬪悜缁撴灉, 骞舵濂藉湪鎸囧畾棰戠巼瀵瑰簲鏃堕棿鍐呮姷杈剧粨鏋
+ /// - 褰撳ぇ浜 1 鏃, 杈撳嚭鍊煎悓鏍锋椂鍙栧悜缁撴灉, 浣嗛熷害浼氭洿鎱, 鏃犳硶鍦ㄦ寚瀹氶鐜囧搴旀椂闂村唴鎶佃揪缁撴灉
+ ///
+ public double Z + { + get => _z; set + { + _z = value; + InitMotionValues(_f, _z, _r); + } + } + + /// + /// 鍒濆鍝嶅簲 + /// - 褰撲负 0 鏃, 鏁版嵁闇瑕佽繘琛 '鍔犻' 鏉ュ紑濮嬭繍鍔
+ /// - 褰撲负 1 鏃, 鏁版嵁浼氱珛鍗冲紑濮嬪搷搴
+ /// - 褰撳ぇ浜 1 鏃, 杈撳嚭浼氬洜涓 '閫熷害杩囧揩' 鑰岃秴鍑虹洰鏍囩粨鏋
+ /// - 褰撳皬浜 0 鏃, 杈撳嚭浼 '棰勬祴杩愬姩', 鍗 '鎶墜鍔ㄤ綔'. 渚嬪鐩爣鏄 '鍔' 鏃, 杈撳嚭浼氬厛杩涜 '鍑', 鍐嶈繘琛 '鍔', + /// - 褰撹繍鍔ㄧ洰鏍囦负鏈烘鏃, 閫氬父鍙栧间负 2 + ///
+ public double R + { + get => _r; set + { + _r = value; + InitMotionValues(_f, _z, _r); + } + } + + public SecondOrderDynamics(double f, double z, double r, double x0) + { + //compute constants + InitMotionValues(f, z, r); + + // initialize variables + xp = x0; + y = x0; + yd = 0; + } + + private void InitMotionValues(double f, double z, double r) + { + _w = 2 * Math.PI * f; + _z = z; + _d = _w * Math.Sqrt(Math.Abs(z * z - 1)); + k1 = z / (Math.PI * f); + k2 = 1 / ((2 * Math.PI * f) * (2 * Math.PI * f)); + k3 = r * z / (2 * Math.PI * f); + } + + public double Update(double deltaTime, double x) + { + double xd = (x - xp) / deltaTime; + double k1_stable, k2_stable; + + if (_w * deltaTime < _z) + { + k1_stable = k1; + k2_stable = Math.Max(Math.Max(k2, deltaTime * deltaTime / 2 + deltaTime * k1 / 2), deltaTime * k1); + } + else + { + double t1 = Math.Exp(-_z * _w * deltaTime); + double alpha = 2 * t1 * (_z <= 1 ? Math.Cos(deltaTime * _d) : Math.Cosh(deltaTime * _d)); + double beta = t1 * t1; + double t2 = deltaTime / (1 + beta - alpha); + k1_stable = (1 - beta) * t2; + k2_stable = deltaTime * t2; + } + + y = y + deltaTime * yd; + yd = yd + deltaTime * (x + k3 * xd - y - k1_stable * yd) / k2_stable; + + xp = x; + return y; + } + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/SecondOrderDynamicsForArray.cs b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/SecondOrderDynamicsForArray.cs new file mode 100644 index 0000000..02a654a --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/SecondOrderDynamicsForArray.cs @@ -0,0 +1,126 @@ +锘縩amespace LibDynamics +{ + public class SecondOrderDynamicsForArray + { + private double[] xps, xds;// previous input + private double[] ys, yds; // state variables + private double _w, _z, _d, k1, k2, k3; // dynamics constants + private double _r; + private double _f; + + /// + /// 棰戠巼 + /// - 鍗抽熷害, 鍗曚綅鏄但鍏(Hz) + /// - 涓嶄細褰卞搷杈撳嚭缁撴灉鐨勫舰鐘, 浼氬奖鍝 '闇囪崱棰戠巼' + /// + public double F + { + get => _f; set + { + _f = value; + InitMotionValues(_f, _z, _r); + } + } + + /// + /// 闃诲凹
+ /// - 褰撲负 0 鏃, 杈撳嚭灏嗘案杩滈渿鑽′笉琛板噺
+ /// - 褰撳ぇ浜 0 灏忎簬 1 鏃, 杈撳嚭浼氳秴鍑虹粨鏋, 骞堕愭笎瓒嬩簬鐩爣
+ /// - 褰撲负 1 鏃, 杈撳嚭鐨勬洸绾挎槸瓒嬪悜缁撴灉, 骞舵濂藉湪鎸囧畾棰戠巼瀵瑰簲鏃堕棿鍐呮姷杈剧粨鏋
+ /// - 褰撳ぇ浜 1 鏃, 杈撳嚭鍊煎悓鏍锋椂鍙栧悜缁撴灉, 浣嗛熷害浼氭洿鎱, 鏃犳硶鍦ㄦ寚瀹氶鐜囧搴旀椂闂村唴鎶佃揪缁撴灉
+ ///
+ public double Z + { + get => _z; set + { + _z = value; + InitMotionValues(_f, _z, _r); + } + } + + /// + /// 鍒濆鍝嶅簲 + /// - 褰撲负 0 鏃, 鏁版嵁闇瑕佽繘琛 '鍔犻' 鏉ュ紑濮嬭繍鍔
+ /// - 褰撲负 1 鏃, 鏁版嵁浼氱珛鍗冲紑濮嬪搷搴
+ /// - 褰撳ぇ浜 1 鏃, 杈撳嚭浼氬洜涓 '閫熷害杩囧揩' 鑰岃秴鍑虹洰鏍囩粨鏋
+ /// - 褰撳皬浜 0 鏃, 杈撳嚭浼 '棰勬祴杩愬姩', 鍗 '鎶墜鍔ㄤ綔'. 渚嬪鐩爣鏄 '鍔' 鏃, 杈撳嚭浼氬厛杩涜 '鍑', 鍐嶈繘琛 '鍔', + /// - 褰撹繍鍔ㄧ洰鏍囦负鏈烘鏃, 閫氬父鍙栧间负 2 + ///
+ public double R + { + get => _r; set + { + _r = value; + InitMotionValues(_f, _z, _r); + } + } + + /// + /// + /// + /// + /// + /// + /// + /// Array size + public SecondOrderDynamicsForArray(double f, double z, double r, double x0, int size) + { + //compute constants + InitMotionValues(f, z, r); + + // initialize variables + xps = new double[size]; + ys = new double[size]; + + xds = new double[size]; + yds = new double[size]; + + Array.Fill(xps, x0); + Array.Fill(ys, x0); + } + + private void InitMotionValues(double f, double z, double r) + { + _w = 2 * Math.PI * f; + _z = z; + _d = _w * Math.Sqrt(Math.Abs(z * z - 1)); + k1 = z / (Math.PI * f); + k2 = 1 / ((2 * Math.PI * f) * (2 * Math.PI * f)); + k3 = r * z / (2 * Math.PI * f); + } + + public double[] Update(double deltaTime, double[] xs)//xps p for past,xds d for delta,xs current val + { + if (xs.Length != xps.Length) + throw new ArgumentException(); + + for (int i = 0; i < xds.Length; i++) + xds[i] = (xs[i] - xps[i]) / deltaTime; + double k1_stable, k2_stable; + if (_w * deltaTime < _z) + { + k1_stable = k1; + k2_stable = Math.Max(Math.Max(k2, deltaTime * deltaTime / 2 + deltaTime * k1 / 2), deltaTime * k1); + } + else + { + double t1 = Math.Exp(-_z * _w * deltaTime); + double alpha = 2 * t1 * (_z <= 1 ? Math.Cos(deltaTime * _d) : Math.Cosh(deltaTime * _d)); + double beta = t1 * t1; + double t2 = deltaTime / (1 + beta - alpha); + k1_stable = (1 - beta) * t2; + k2_stable = deltaTime * t2; + } + + for (int i = 0; i < ys.Length; i++) + { + ys[i] = ys[i] + deltaTime * yds[i]; + yds[i] = yds[i] + deltaTime * (xs[i] + k3 * xds[i] - ys[i] - k1_stable * yds[i]) / k2_stable; + } + + for (int i = 0; i < xps.Length; i++) + xps[i] = xs[i]; + return ys; + } + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/Visualizer.cs b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/Visualizer.cs new file mode 100644 index 0000000..4c52aef --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/AudioVisualizer/Visualizer.cs @@ -0,0 +1,227 @@ +锘縰sing LibDynamics; +using FftComplex = FftSharp.Complex; +using FftTransform = FftSharp.Transform; + +namespace LibAudioVisualizer +{ + public class Visualizer + { + //private int _m; + private double[] _sampleData; + private DateTime _lastTime; + private SecondOrderDynamicsForArray _dynamics; + private int _size; + + /// + /// 閲囨牱鏁版嵁 + /// + public double[] SampleData => _sampleData; + + /// + /// 灏哄 + /// + public int Size + { + get => _size; set + { + if (!(Get2Flag(value))) + throw new ArgumentException("闀垮害蹇呴』鏄 2 鐨 n 娆″箓"); + + _size = value; + _sampleData = new double[value]; + _dynamics = new SecondOrderDynamicsForArray(1, 1, 1, 0, value / 2); + } + } + + public int OutputSize => Size / 2; + + public Visualizer(int size) + { + if (!(Get2Flag(size))) + throw new ArgumentException("澶у皬蹇呴』鏄 2 鐨 n 娆″箓", nameof(size)); + + _lastTime = DateTime.Now; + _sampleData = new double[size]; + _dynamics = new SecondOrderDynamicsForArray(1, 1, 1, 0, size / 2); + } + + /// + /// 鍒ゆ柇鏄惁鏄 2 鐨勬暣鏁版骞 + /// + /// + /// + private bool Get2Flag(int num) + { + if (num < 1) + return false; + return (num & num - 1) == 0; + } + + public void PushSampleData(double[] waveData) + { + if (waveData.Length > _sampleData.Length) + { + Array.Copy(waveData, waveData.Length - _sampleData.Length, _sampleData, 0, _sampleData.Length); + } + else + { + Array.Copy(_sampleData, waveData.Length, _sampleData, 0, _sampleData.Length - waveData.Length); + Array.Copy(waveData, 0, _sampleData, _sampleData.Length - waveData.Length, waveData.Length); + } + } + + public void PushSampleData(double[] waveData, int count) + { + if (count > _sampleData.Length) + { + Array.Copy(waveData, count - _sampleData.Length, _sampleData, 0, _sampleData.Length); + } + else + { + Array.Copy(_sampleData, count, _sampleData, 0, _sampleData.Length - count); + Array.Copy(waveData, 0, _sampleData, _sampleData.Length - count, count); + } + } + + /// + /// 鑾峰彇棰戣氨鏁版嵁 (鏁版嵁宸茬粡鍒犲幓鍏辫江閮ㄥ垎) + /// + /// + public double[] GetSpectrumData() + { + DateTime now = DateTime.Now; + double deltaTime = (now - _lastTime).TotalSeconds; + _lastTime = now; + + int len = _sampleData.Length; + FftComplex[] data = new FftComplex[len]; + + for (int i = 0; i < len; i++) + data[i] = new FftComplex(_sampleData[i], 0); + + FftTransform.FFT(data); + + int halfLen = len / 2; + double[] spectrum = new double[halfLen]; // 鍌呴噷鍙跺彉鎹㈢粨鏋滃乏鍙冲绉, 鍙渶瑕佸彇涓鍗 + for (int i = 0; i < halfLen; i++) + spectrum[i] = data[i].Magnitude / len; + + var window = new FftSharp.Windows.Bartlett(); + window.Create(halfLen); + window.ApplyInPlace(spectrum, false); + + //return spectrum; + return _dynamics.Update(deltaTime, spectrum); + } + + /// + /// 鍙栨寚瀹氶鐜囧唴鐨勯璋辨暟鎹 + /// + /// 婧愰璋辨暟鎹 + /// 閲囨牱鐜 + /// 鐩爣棰戠巼 + /// + public static double[] TakeSpectrumOfFrequency(double[] spectrum, double sampleRate, double frequency) + { + double frequencyPerSampe = sampleRate / spectrum.Length; + + int lengthInNeed = (int)(Math.Min(frequency / frequencyPerSampe, spectrum.Length)); + double[] result = new double[lengthInNeed]; + Array.Copy(spectrum, 0, result, 0, lengthInNeed); + return result; + } + + /// + /// 绠鍗曠殑鏁版嵁妯$硦 + /// + /// 鏁版嵁 + /// 妯$硦鍗婂緞 + /// 缁撴灉 + public static double[] GetBlurry(double[] data, int radius) + { + double[] GetWeights(int radius) + { + double Gaussian(double x) => Math.Pow(Math.E, (-4 * x * x)); // 鎲ㄦ壒楂樻柉鍑芥暟 + + int len = 1 + radius * 2; // 闀垮害 + int end = len - 1; // 鏈鍚庣殑绱㈠紩 + double radiusF = (double)radius; // 鍗婂緞娴偣鏁 + double[] weights = new double[len]; // 鏉冮噸 + + for (int i = 0; i <= radius; i++) // 鍏堟妸鍙宠竟鐨勬潈閲嶇畻鍑烘潵 + weights[radius + i] = Gaussian(i / radiusF); + for (int i = 0; i < radius; i++) // 鎶婂彸杈圭殑鏉冮噸鎷疯礉鍒板乏杈 + weights[i] = weights[end - i]; + + double total = weights.Sum(); + for (int i = 0; i < len; i++) // 浣挎潈閲嶅悎涓 0 + weights[i] = weights[i] / total; + + return weights; + } + + void ApplyWeights(double[] buffer, double[] weights) + { + int len = buffer.Length; + for (int i = 0; i < len; i++) + buffer[i] = buffer[i] * weights[i]; + } + + + double[] weights = GetWeights(radius); + double[] buffer = new double[1 + radius * 2]; + + double[] result = new double[data.Length]; + if (data.Length < radius) + { + Array.Fill(result, data.Average()); + return result; + } + + + for (int i = 0; i < radius; i++) + { + Array.Fill(buffer, data[i], 0, radius + 1); // 濉厖缂虹渷 + for (int j = 0; j < radius; j++) // + { + buffer[radius + 1 + j] = data[i + j]; + } + + ApplyWeights(buffer, weights); + result[i] = buffer.Sum(); + } + + for (int i = radius; i < data.Length - radius; i++) + { + for (int j = 0; j < radius; j++) // + { + buffer[j] = data[i - j]; + } + + buffer[radius] = data[i]; + + for (int j = 0; j < radius; j++) // + { + buffer[radius + j + 1] = data[i + j]; + } + + ApplyWeights(buffer, weights); + result[i] = buffer.Sum(); + } + + for (int i = data.Length - radius; i < data.Length; i++) + { + Array.Fill(buffer, data[i], 0, radius + 1); // 濉厖缂虹渷 + for (int j = 0; j < radius; j++) // + { + buffer[radius + 1 + j] = data[i - j]; + } + + ApplyWeights(buffer, weights); + result[i] = buffer.Sum(); + } + + return result; + } + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/BufferForm.cs b/CDSAE3_Lian_Lian_Kan/Forms/BufferForm.cs index 93511b0..da1bca6 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/BufferForm.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/BufferForm.cs @@ -16,7 +16,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms { InitializeComponent(); } - public void SetEffect(Color begin, Color end, bool havePicture, Image? picture) + public void SetEffect(Color begin, Color end) { BackColor = begin; this.begin = begin; diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode.Designer.cs new file mode 100644 index 0000000..2644698 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode.Designer.cs @@ -0,0 +1,150 @@ +锘縩amespace CDSAE3_Lian_Lian_Kan.Forms +{ + partial class Challenge_Mode + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + AudioVisualizerPanel = new Panel(); + game_Panel = new Panel(); + PausePanel = new Panel(); + 杩斿洖涓昏彍鍗 = new Label(); + 缁х画娓告垙 = new Label(); + 娓告垙鏆傚仠 = new Label(); + timeLine = new TimeLine(); + PausePanel.SuspendLayout(); + SuspendLayout(); + // + // AudioVisualizerPanel + // + AudioVisualizerPanel.Location = new Point(0, 849); + AudioVisualizerPanel.Name = "AudioVisualizerPanel"; + AudioVisualizerPanel.Size = new Size(1440, 109); + AudioVisualizerPanel.TabIndex = 0; + // + // game_Panel + // + game_Panel.BackColor = Color.FromArgb(50, 0, 0, 0); + game_Panel.Location = new Point(30, 52); + game_Panel.Name = "game_Panel"; + game_Panel.Size = new Size(1380, 776); + game_Panel.TabIndex = 1; + // + // PausePanel + // + PausePanel.BackColor = Color.FromArgb(0, 0, 0); + PausePanel.Controls.Add(杩斿洖涓昏彍鍗); + PausePanel.Controls.Add(缁х画娓告垙); + PausePanel.Controls.Add(娓告垙鏆傚仠); + PausePanel.Dock = DockStyle.Fill; + PausePanel.Location = new Point(0, 0); + PausePanel.Name = "PausePanel"; + PausePanel.Size = new Size(1440, 960); + PausePanel.TabIndex = 2; + // + // 杩斿洖涓昏彍鍗 + // + 杩斿洖涓昏彍鍗.AutoSize = true; + 杩斿洖涓昏彍鍗.BackColor = Color.FromArgb(0, 0, 0, 0); + 杩斿洖涓昏彍鍗.Font = new Font("Microsoft YaHei UI", 20F); + 杩斿洖涓昏彍鍗.ForeColor = Color.White; + 杩斿洖涓昏彍鍗.Location = new Point(151, 342); + 杩斿洖涓昏彍鍗.Name = "杩斿洖涓昏彍鍗"; + 杩斿洖涓昏彍鍗.Size = new Size(222, 52); + 杩斿洖涓昏彍鍗.TabIndex = 5; + 杩斿洖涓昏彍鍗.Text = "杩斿洖涓昏彍鍗"; + 杩斿洖涓昏彍鍗.Visible = false; + 杩斿洖涓昏彍鍗.Click += 閫鍑篲Click; + 杩斿洖涓昏彍鍗.MouseEnter += CanClickLabel_MouseEnter; + 杩斿洖涓昏彍鍗.MouseLeave += CanClickLabel_MouseLeave; + // + // 缁х画娓告垙 + // + 缁х画娓告垙.AutoSize = true; + 缁х画娓告垙.BackColor = Color.FromArgb(0, 0, 0, 0); + 缁х画娓告垙.Font = new Font("Microsoft YaHei UI", 20F); + 缁х画娓告垙.ForeColor = Color.White; + 缁х画娓告垙.Location = new Point(151, 253); + 缁х画娓告垙.Name = "缁х画娓告垙"; + 缁х画娓告垙.Size = new Size(182, 52); + 缁х画娓告垙.TabIndex = 4; + 缁х画娓告垙.Text = "缁х画娓告垙"; + 缁х画娓告垙.Visible = false; + 缁х画娓告垙.Click += 缁х画娓告垙_Click; + 缁х画娓告垙.MouseEnter += CanClickLabel_MouseEnter; + 缁х画娓告垙.MouseLeave += CanClickLabel_MouseLeave; + // + // 娓告垙鏆傚仠 + // + 娓告垙鏆傚仠.AutoSize = true; + 娓告垙鏆傚仠.BackColor = Color.FromArgb(0, 0, 0, 0); + 娓告垙鏆傚仠.Font = new Font("Microsoft YaHei UI", 25F); + 娓告垙鏆傚仠.ForeColor = Color.FromArgb(192, 192, 255); + 娓告垙鏆傚仠.Location = new Point(127, 127); + 娓告垙鏆傚仠.Name = "娓告垙鏆傚仠"; + 娓告垙鏆傚仠.Size = new Size(228, 65); + 娓告垙鏆傚仠.TabIndex = 3; + 娓告垙鏆傚仠.Text = "娓告垙鏆傚仠"; + 娓告垙鏆傚仠.Visible = false; + // + // timeLine + // + timeLine.BackColor = Color.FromArgb(0, 0, 0, 0); + timeLine.Location = new Point(0, 0); + timeLine.Name = "timeLine"; + timeLine.Size = new Size(1440, 10); + timeLine.TabIndex = 6; + // + // Challenge_Mode + // + AutoScaleDimensions = new SizeF(11F, 24F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = Color.Black; + ClientSize = new Size(1440, 960); + Controls.Add(timeLine); + Controls.Add(game_Panel); + Controls.Add(AudioVisualizerPanel); + Controls.Add(PausePanel); + FormBorderStyle = FormBorderStyle.None; + KeyPreview = true; + Name = "Challenge_Mode"; + Text = "Challenge_Mode"; + PausePanel.ResumeLayout(false); + PausePanel.PerformLayout(); + ResumeLayout(false); + } + + #endregion + + private Panel AudioVisualizerPanel; + private Panel game_Panel; + private Panel PausePanel; + private Label 娓告垙鏆傚仠; + private Label 杩斿洖涓昏彍鍗; + private Label 缁х画娓告垙; + private TimeLine timeLine; + } +} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode.cs b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode.cs new file mode 100644 index 0000000..40d187d --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode.cs @@ -0,0 +1,291 @@ +锘縰sing CDSAE3_Lian_Lian_Kan.Forms.Interface; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using System.Timers; +using System.Windows.Forms; +using CDSAE3_Lian_Lian_Kan.Extensions; +using Timer = System.Timers.Timer; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; +using CDSAE3_Lian_Lian_Kan.Sound; +using CDSAE3_Lian_Lian_Kan; + +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + public partial class Challenge_Mode : Form, IGameMode + { + GameControl gameControl; + public Challenge_Mode() + { + InitializeComponent(); + timer = new Timer { Interval = 500, AutoReset = true, Enabled = false }; + timer.Elapsed += TimerTick; + Etcs.current_difficulty = Etcs.Difficulty.challenge; + Etcs.loadFinished = false; + gameControl = new GameControl((t) => Challenge_Mode_LoadAsync(this,new EventArgs())); + game_Panel.Controls.Add(gameControl); + gameControl.Dock = DockStyle.Fill; + + } + + //杩欓噷鏄鍔ㄧ殑璧锋簮 + Timer timer; + double curTime = 0; + int score = 0; + private void TimerTick(object? sender, ElapsedEventArgs e) + { + curTime += 0.1; + timeLine.set_progress(curTime / 140); + } + + private async void Challenge_Mode_LoadAsync(object sender, EventArgs e) + { + bool loopStop = false; + PausePanel.BringToFront(); + int oriSongVolume = Etcs.Song_Volume; + { + while (Etcs.Song_Volume != 0) + { + Etcs.Song_Volume = Math.Max(Etcs.Song_Volume - 7, 0); + Etcs.song_Audio_Processer.volume_change(Etcs.Song_Volume); + await Task.Delay(100); + } + } + { + Action loopPlay = null!; + loopPlay = (s, player) => + { + if (!loopStop) + Etcs.song_Audio_Processer.set_song("Ambient", 50, loopPlay); + }; + Etcs.info_Audio_Processer.playMusicClip("Ambient", 50, loopPlay); + Label label = new Label { TextAlign = ContentAlignment.MiddleCenter, Font = new Font("Microsoft YaHei UI", 20F), ForeColor = Color.White, BackColor = Color.FromArgb(0, 0, 0, 0), AutoSize = false, Size = new Size(1220, 55), Location = new Point(110, 330) }; + Controls.Add(label); + label.BringToFront(); + string[] strings = { "浣犱篃璁告剰璇嗗埌浜", "杩炶繛鐪嬬殑瀹炵幇骞朵笉濡傚叾瑙勫垯閭f牱绠鍗", "蹇欑鐨凜LR锛屽鐞嗙潃鏁颁互鍗冭鐨勪簨浠", "濮旀墭锛屽弽灏勶紝绾跨▼鍐茬獊涓嶆柇鍙戠敓鍦ㄥ悇澶", "浠g爜鐨勫爢鍙犲凡缁忓埌杈炬瀬闄", "杩欐槸鏈鍚庣殑杩炶繛鐪嬶紝闆嗕腑绮惧姏锛屼笉瑕佺姱閿欙紝鍦ㄦ瓕鏇茬粨鏉熷墠鍑昏触瀹" }; + //4* 7 28s 18s in game 10s + for (int i = 0; i < 6; i++) + { + label.Text = strings[i]; + Etcs.info_Audio_Processer.playMusicClip("Message", 60); + await Task.Delay(4000); + if (i == 2) + { + loopStop = true; + while (Etcs.Song_Volume != 0) + { + Etcs.Song_Volume = Math.Max(Etcs.Song_Volume - 7, 0); + Etcs.song_Audio_Processer.volume_change(Etcs.Song_Volume); + await Task.Delay(100); + } + Etcs.song_Audio_Processer.pause_song(); + Etcs.song_Audio_Processer.set_albums("Tatsh"); + Etcs.song_Audio_Processer.set_song(Etcs.song_Audio_Processer.get_next_song()); + Thread thread = new Thread(async () => + { + for (int n = 0; n < 8; n++) + { + Etcs.Song_Volume += 7; + Etcs.song_Audio_Processer.volume_change(Etcs.Song_Volume); + await Task.Delay(500); + } + await Task.Delay(9000); + foreach (var item in new Label[] { 杩斿洖涓昏彍鍗, 缁х画娓告垙, 娓告垙鏆傚仠 }) + Invoke(() => item.Visible = true); + + }); + thread.Start(); + } + } + _pauseAllow = true; + label.SendToBack(); + label.Visible = false; + + label.Dispose(); + } + PausePanel.Visible = false; + Etcs.song_Audio_Processer.SongFinished += Song_Audio_Processer_SongFinished; + ShowAudioVisualizer(); + Etcs.hunderd_millsecond_timer.Elapsed += TimerTick; + } + + private async void Song_Audio_Processer_SongFinished(Sound.Song_Audio_processer s, Sound.SongFinishedEventArgs e) + { + foreach (var item in new Label[] { 杩斿洖涓昏彍鍗, 缁х画娓告垙, 娓告垙鏆傚仠 }) + item.Visible = false; + PausePanel.Visible = true; + PausePanel.BackgroundImage = Properties.Resources.trans; + for(int i=0;i<200;i+=10) + { + Color animRed = Color.FromArgb(i, 0, 0); + game_Panel.BackColor = animRed; + PausePanel.BackColor = animRed; + await Task.Delay(10); + } + PausePanel.BringToFront(); + for(int i= 200;i<260;i+=10) + { + Color animRed = Color.FromArgb(i, 0, 0); + PausePanel.BackColor = animRed; + await Task.Delay(10); + } + Etcs.info_Audio_Processer.playMusicClip("failed"); + Finished_Handler(this, new FinishArgs { finishType = FinishArgs.FinishType.Time_out }); + } + int cur_score = 0; + public void Finished_Handler(object sender, FinishArgs e) + { + BeginInvoke(() => + { + switch (e.finishType) + { + case FinishArgs.FinishType.All_done: + DoPause(); + Form form = new FinishedMessageBox(cur_score, (int)curTime); + form.FormClosed += ((sender, args) => + { + Dispose(); + Close(); + Etcs.form?.change_form(Etcs.charts, false, null, null); + }); + form.ShowDialog(); + break; + case FinishArgs.FinishType.Time_out: + 閫鍑篲Click(this, new EventArgs()); + break; + } + }); + } + private bool _pauseState = false; + private bool search_mode; + private int search_left_use_time; + + /// + /// 闇瑕佹祴璇曪紒锛 + /// + private bool _pauseAllow = false; + private void DoPause() + { + if (!_pauseAllow) + return; + timer.Enabled = false; + Etcs.song_Audio_Processer.pause_song(); + _pauseState = true; + Bitmap bit = new Bitmap(Width, Height); + Graphics g = Graphics.FromImage(bit); + g.CompositingQuality = CompositingQuality.HighQuality; + g.CopyFromScreen(Etcs.form!.Left+5, Etcs.form!.Top+43, 0, 0, new Size(Width, Height)); + PausePanel.BringToFront(); + Rectangle rectangle = new Rectangle(0, 0, bit.Width,bit.Height); + PausePanel.BackgroundImage= bit.GaussianBlur(); + PausePanel.Visible = true; + GC.Collect(); + } + private void DePause() + { + Etcs.song_Audio_Processer.resume_song(); + _pauseState = false; + timer.Enabled = true; + PausePanel.Visible = false; + PausePanel.SendToBack(); + } + public void TogglePause() + { + if (_pauseState) + DePause(); + else + DoPause(); + } + + private void ShowAudioVisualizer() + { + Form audioVisualizer = new AudioVisualizer.MainWindow(); + audioVisualizer.TopLevel = false; + audioVisualizer.Dock = DockStyle.Fill; + AudioVisualizerPanel.Controls.Add(audioVisualizer); + audioVisualizer.Show(); + } + + private void 缁х画娓告垙_Click(object sender, EventArgs e) + { + DePause(); + } + + private void 閫鍑篲Click(object sender, EventArgs e) + { + Dispose(); + Close(); + Etcs.hunderd_millsecond_timer.Elapsed -= TimerTick; + Etcs.gameMenuForm!.playFormToMenu(); + } + + private void CanClickLabel_MouseEnter(object sender, EventArgs e) + { + (sender as Label)!.BackColor = Color.FromArgb(100, 100, 100); + } + + private void CanClickLabel_MouseLeave(object sender, EventArgs e) + { + (sender as Label)!.BackColor = Color.FromArgb(0, 0, 0, 0); + } + + public void De_pause(object sender, EventArgs e) { } + + public void Score_Change(object sender, ChangeScoreArgs e) + { + if (e.add) + { + score += e.score; + if(search_mode) + { + search_left_use_time--; + if(search_left_use_time==0) + { + search_mode = false; + gameControl.Search_Handler(this, new SearchEventArgs { set_search = false }); + } + } + } + else + score = Math.Min(0, score - e.score); + } + + public void SetTheme() { + Etcs.current_block_theme = Etcs.Theme.code; + Etcs.gameModeForm = this; + } + + private void DoSearch() + { + gameControl.Search_Handler(this, new SearchEventArgs { set_search = true }); + search_mode = true; + search_left_use_time = 3; + } + private void DoRemake() + { + Task.Run(() => gameControl.Exchange_Handler(this, new EventArgs())); + } + public void GetGift_Handler(object sender, GiftArgs e) + { + Etcs.info_Audio_Processer.playMusicClip("HitSong"); + switch (e.giftType) + { + case GiftArgs.GiftType.Search: + DoSearch(); + break; + case GiftArgs.GiftType.ReMake: + DoRemake(); + break; + + } + } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.resx b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode.resx similarity index 100% rename from CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.resx rename to CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode.resx diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.Designer.cs deleted file mode 100644 index cdf2836..0000000 --- a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -锘縩amespace CDSAE3_Lian_Lian_Kan -{ - partial class Challenge_Mode_MenuForm - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Challenge_Mode_MenuForm"; - } - - #endregion - } -} \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.cs b/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.cs deleted file mode 100644 index 6554bc0..0000000 --- a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.cs +++ /dev/null @@ -1,20 +0,0 @@ -锘縰sing 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 -{ - public partial class Challenge_Mode_MenuForm : Form - { - public Challenge_Mode_MenuForm() - { - InitializeComponent(); - } - } -} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Charts.cs b/CDSAE3_Lian_Lian_Kan/Forms/Charts.cs index 8014739..69f99d5 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Charts.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/Charts.cs @@ -121,7 +121,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms { Thread thread= new Thread(()=>Invoke(()=>tablePanel.Controls.Clear())); _left = _top = 0; - await Etcs.form!.change_form((Etcs.gameMenuForm as Form)!, false, null, null, false, null); + await Etcs.form!.change_form((Etcs.gameMenuForm as Form)!, false, null, null); thread.Start(); } diff --git a/CDSAE3_Lian_Lian_Kan/Forms/GameControl.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.Designer.cs index da9201c..486dec2 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/GameControl.Designer.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.Designer.cs @@ -28,29 +28,14 @@ /// private void InitializeComponent() { - playPanel = new TableLayoutPanel(); initWorker = new System.ComponentModel.BackgroundWorker(); SuspendLayout(); // - // playPanel - // - playPanel.BackColor = Color.FromArgb(0, 0, 0, 0); - playPanel.ColumnCount = 1; - playPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); - playPanel.Dock = DockStyle.Fill; - playPanel.Location = new Point(0, 0); - playPanel.Name = "playPanel"; - playPanel.RowCount = 1; - playPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 50F)); - playPanel.Size = new Size(1400, 800); - playPanel.TabIndex = 1; - // // GameControl // AutoScaleDimensions = new SizeF(11F, 24F); AutoScaleMode = AutoScaleMode.Font; BackColor = Color.FromArgb(0, 0, 0, 0); - Controls.Add(playPanel); Name = "GameControl"; Size = new Size(1400, 800); Load += GameControl_Load; @@ -58,8 +43,6 @@ } #endregion - - private TableLayoutPanel playPanel; private System.ComponentModel.BackgroundWorker initWorker; } } diff --git a/CDSAE3_Lian_Lian_Kan/Forms/GameControl.cs b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.cs index 821f786..0267ca9 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/GameControl.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/GameControl.cs @@ -1,5 +1,6 @@ 锘縰sing CDSAE3_Lian_Lian_Kan.Boards; using CDSAE3_Lian_Lian_Kan.Forms.Interface; +using NAudio.Gui; using System; using System.Collections.Generic; using System.ComponentModel; @@ -11,36 +12,54 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using static CDSAE3_Lian_Lian_Kan.Etcs; using static System.Windows.Forms.VisualStyles.VisualStyleElement.Window; namespace CDSAE3_Lian_Lian_Kan.Forms { public partial class GameControl : UserControl, IGameControl { - IBoard board = new Graph_Board(); + IBoard board = Etcs.curAlgorithm switch + { + Algorithm.Array => new Board(), + Algorithm.Graph => new Graph_Board(), + _ => new Board() + }; IGameMode? iGameMode; Queue<((int, int), Single_Block)> queue = new Queue<((int, int), Single_Block)>();//y,x bool do_search = false; List hint_blocks = new List(); + bool doRandomGift = false; + bool doSubScore = false; + Dictionary<(int, int), (GiftArgs.GiftType, PictureBox)> giftBlock = new(); public GameControl() + { + + } + public GameControl(ActionloadFinished) { InitializeComponent(); DoubleBuffered = true; initWorker.WorkerReportsProgress = true; initWorker.WorkerSupportsCancellation = true; + this.loadFinished = loadFinished; initWorker.DoWork += new DoWorkEventHandler(bgWorker_DoWorker); initWorker.RunWorkerCompleted += InitWorker_RunWorkerCompleted; - Etcs.gameForm = this; - iGameMode = Etcs.gameModeForm; } + Action? loadFinished = null; private void InitWorker_RunWorkerCompleted(object? sender, RunWorkerCompletedEventArgs e) { Etcs.loadFinished = true; + loadFinished?.Invoke(0); } public void GameControl_Load(object sender, EventArgs e) { + if (Etcs.current_difficulty == Etcs.Difficulty.challenge) + doSubScore = doRandomGift = true; + Etcs.gameForm = this; + iGameMode = Etcs.gameModeForm; Console.WriteLine("start"); Etcs.loadFinished = false; initWorker.RunWorkerAsync(); @@ -58,26 +77,35 @@ namespace CDSAE3_Lian_Lian_Kan.Forms void playPanel_set(int[,] bd) { - playPanel.SuspendLayout(); + SuspendLayout(); playPanel_size_change(); - for (int i = 0; i < playPanel.RowCount; i++) - for (int j = 0; j < playPanel.ColumnCount; j++) + for (int i = 0; i < _row; i++) + for (int j = 0; j < _column; j++) { Console.WriteLine(i.ToString() + j.ToString()); if (bd[i, j] == -1) { - var x = new Single_Block(Etcs.trans_Image, (j, i)); - x.Dock = DockStyle.Fill; - Invoke(() => playPanel.Controls.Add(x, j, i)); + var x = new Single_Block((j, i)); + AddItem(x, i, j); + _index.Add((j, i), x); } else { var x = new Single_Block(bd[i, j], Etcs.def_Color, Etcs.sel_Color, (j, i)); - x.Dock = DockStyle.Fill; - Invoke(() => playPanel.Controls.Add(x, j, i)); + AddItem(x, i, j); + _index.Add((j, i), x); } } - Invoke(() => playPanel.ResumeLayout()); + Invoke(() => ResumeLayout()); + } + private void AddItem(Single_Block x, int i, int j) + { + Invoke(() => + { + x.Size = new Size((int)single_width, (int)single_height); + x.Location = new Point((int)(j * single_width), (int)(i * single_height)); + Controls.Add(x); + }); } /// /// 鐢眆orm鍜宼o涓や釜鐐硅幏鍙栨柟鍚 @@ -111,14 +139,14 @@ namespace CDSAE3_Lian_Lian_Kan.Forms 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) + Single_Block? control = _index.ContainsKey((point.Item1, point.Item2)) ? _index[(point.Item1, point.Item2)] : null; + if (control != null) { if (is_hint) - single_Block.hint_path(direction); + control.hint_path(direction); else - single_Block.to_path(direction); - blocks.Add(single_Block); + control.to_path(direction); + blocks.Add(control); } } async Task to_path((int, int) from, (int, int) to, bool include_end, Etcs.Direction extra_Direction, List blocks, int wait_time, bool is_hint) @@ -212,6 +240,22 @@ namespace CDSAE3_Lian_Lian_Kan.Forms _ = Block_ClearAsync(path); while (queue.Count() > 0) queue.Dequeue(); + foreach (var item in new[] { posa, posb }) + { + if (giftBlock.TryGetValue(item, out (GiftArgs.GiftType, PictureBox) result)) + { + iGameMode!.GetGift_Handler(this, new GiftArgs { giftType = result.Item1 }); + DeleteGiftPicture(item, result); + } + } + if (doRandomGift) + { + Random random = new(); + if (random.Next(0, 10) < 1) + { + SetGiftPicture(board.GetRandomBlock(), (GiftArgs.GiftType)(random.Next(1, 3) - 1)); + } + } } else { @@ -220,6 +264,10 @@ namespace CDSAE3_Lian_Lian_Kan.Forms de_set_tip(); set_tip(); } + if (doSubScore) + { + iGameMode!.Score_Change(this, new ChangeScoreArgs { add = false, score = 200 }); + } queue.Enqueue((e.position, sender)); sendera.deselect(); } @@ -244,6 +292,38 @@ namespace CDSAE3_Lian_Lian_Kan.Forms } }); } + + private void DeleteGiftPicture((int, int) item, (GiftArgs.GiftType, PictureBox) result) + { + Invoke(() => + { + result.Item2.Visible = false; + result.Item2.SendToBack(); + result.Item2.Dispose(); + giftBlock.Remove(item); + }); + } + + private void SetGiftPicture((int, int)pos , GiftArgs.GiftType type) + { + var (picWidth, picHeight) = (single_width / 3, single_height / 3); + PictureBox picture = new PictureBox + { + Image = type switch + { + GiftArgs.GiftType.Search => Properties.Resources.w_search, + GiftArgs.GiftType.ReMake => Properties.Resources.w_exchange, + _ => Properties.Resources.trans + }, + Size = new Size((int)picWidth, (int)picHeight), + SizeMode = PictureBoxSizeMode.Zoom, + Location = new Point((int)(((pos.Item1 + 1) * single_width) - picWidth), (int)(pos.Item2 * single_height)) + }; + Invoke(() => Controls.Add(picture)); + Invoke(() => picture.BringToFront()); + giftBlock.TryAdd(pos, (type, picture)); + } + async Task Block_ClearAsync(List<(int, int)>? path) { if (do_search == true) @@ -253,45 +333,54 @@ namespace CDSAE3_Lian_Lian_Kan.Forms if (path == null) return; await path_drawerAsync(path, 20, blocks, false); - Control? controlA = playPanel.GetControlFromPosition(path[0].Item1, path[0].Item2), controlB = playPanel.GetControlFromPosition(path.Last().Item1, path.Last().Item2); + Single_Block? controlA = _index.ContainsKey((path[0].Item1, path[0].Item2)) ? _index[(path[0].Item1, path[0].Item2)] : null; + Single_Block? controlB = _index.ContainsKey((path.Last().Item1, path.Last().Item2)) ? _index[(path.Last().Item1, path.Last().Item2)] : null; Etcs.info_Audio_Processer.play_random_break_soundScape(); - if (controlA != null && controlB != null && controlA is Single_Block single_BlockA && controlB is Single_Block single_BlockB) + if (controlA != null && controlB != null) { - single_BlockA.destroyAsync(); - single_BlockB.destroyAsync(); + controlA.destroyAsync(); + controlB.destroyAsync(); } await Task.Delay(200); foreach (var control in blocks) control.de_path(); - iGameMode?.Score_Add(this, new AddScoreArgs { score = (blocks.Count + 2) * 10 }); + iGameMode?.Score_Change(this, new ChangeScoreArgs { score = (blocks.Count + 2) * 10 }); } + private int _row = 0, _column = 0; + private double single_width = 0, single_height = 0; + private Dictionary<(int, int), Single_Block> _index = new(); void playPanel_size_change() { var (width, height) = board.size; - playPanel.RowCount = height + 2; - playPanel.ColumnCount = width + 2; - playPanel.ColumnStyles[0] = new ColumnStyle(SizeType.Percent, 100F); - playPanel.RowStyles[0] = new RowStyle(SizeType.Percent, 100F); - for (int i = 0; i < width + 1; i++) - playPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100F)); - for (int i = 0; i < height + 1; i++) - playPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100F)); + (_row, _column) = (height + 2, width + 2); + single_width = (double)Width / _column; + single_height = (double)Height / _row; } public void Exchange_Handler(object? sender, EventArgs e) { int[,] bd = board.remake_board(); - playPanel.SuspendLayout(); + SuspendLayout(); 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); + Single_Block? control = _index.ContainsKey((j, i)) ? _index[(j, i)] : null; + if (control != null) + control.Re_create(bd[i, j], null, null, null); } - playPanel.ResumeLayout(); + int length = giftBlock.Count(); + foreach (var item in giftBlock) + { + DeleteGiftPicture(item.Key, item.Value); + } + for (int i = 0; i < length; i++) + { + Random random = new(); + SetGiftPicture(board.GetRandomBlock(), (GiftArgs.GiftType)(random.Next(1, 3) - 1)); + } + ResumeLayout(); } public void Search_Handler(object? sender, SearchEventArgs e) diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Interface/IGameMode.cs b/CDSAE3_Lian_Lian_Kan/Forms/Interface/IGameMode.cs index 73fad37..b2165c3 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Interface/IGameMode.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/Interface/IGameMode.cs @@ -6,23 +6,35 @@ using System.Threading.Tasks; namespace CDSAE3_Lian_Lian_Kan.Forms.Interface { - public class AddScoreArgs : EventArgs + public class ChangeScoreArgs : EventArgs { + public bool add { get; set; } = true; //1 public int score { get; set; } } + public class GiftArgs:EventArgs + { + public enum GiftType + { + Search = 0, + ReMake = 1 + } + public GiftType giftType { get; set; } + } public class FinishArgs : EventArgs { - public enum Finish_Type + public enum FinishType { All_done = 0, Time_out = 1 } - public Finish_Type finish_Type { get; set; } + public FinishType finishType { get; set; } } public interface IGameMode : IThemeChangeable { + public void TogglePause(); public void De_pause(object sender, EventArgs e); - public void Score_Add(object sender, AddScoreArgs e); + public void Score_Change(object sender, ChangeScoreArgs e); public void Finished_Handler(object sender, FinishArgs e); + public void GetGift_Handler(object sender, GiftArgs e); } } diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.Designer.cs index 2750e8b..b4db6cf 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.Designer.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.Designer.cs @@ -39,7 +39,6 @@ exchange = new PictureBox(); upper_search = new Item(); game_Panel = new Panel(); - gameControl = new GameControl(); ((System.ComponentModel.ISupportInitialize)back).BeginInit(); ((System.ComponentModel.ISupportInitialize)sp_button).BeginInit(); ((System.ComponentModel.ISupportInitialize)search).BeginInit(); @@ -159,21 +158,11 @@ // game_Panel // game_Panel.BackColor = Color.FromArgb(50, 0, 0, 0); - game_Panel.Controls.Add(gameControl); game_Panel.Location = new Point(20, 143); game_Panel.Name = "game_Panel"; game_Panel.Size = new Size(1400, 800); game_Panel.TabIndex = 0; // - // gameControl - // - gameControl.BackColor = Color.FromArgb(0, 0, 0, 0); - gameControl.Dock = DockStyle.Fill; - gameControl.Location = new Point(0, 0); - gameControl.Name = "gameControl"; - gameControl.Size = new Size(1400, 800); - gameControl.TabIndex = 13; - // // Leisure_Mode // AutoScaleDimensions = new SizeF(11F, 24F); @@ -215,6 +204,5 @@ private PictureBox exchange; private Item upper_search; private Panel game_Panel; - private GameControl gameControl; } } \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.cs b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.cs index c6ccfa1..b487b96 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode.cs @@ -18,9 +18,11 @@ namespace CDSAE3_Lian_Lian_Kan.Forms public partial class Leisure_Mode : Form, IGameMode { + GameControl gameControl; public Leisure_Mode() { Etcs.gameModeForm = this; + Etcs.current_block_theme = Theme.fruit; InitializeComponent(); upper_search.Item_Init(Resources.search, (70, 70), Color.FromArgb(253, 161, 60)); time.Text = (left_time / 60).ToString().PadLeft(2, '0') + ":" + (left_time % 60).ToString().PadLeft(2, '0'); @@ -28,6 +30,9 @@ namespace CDSAE3_Lian_Lian_Kan.Forms timer = new System.Timers.Timer(1000); timer.Elapsed += Timer_Tick; timer.Enabled = false; + gameControl = new GameControl((t) => t++); + game_Panel.Controls.Add(gameControl); + gameControl.Dock = DockStyle.Fill; } System.Timers.Timer timer; int hundred_up_timer = 0; @@ -80,7 +85,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms if (left_time < 0) { timer.Enabled = false; - Finished_Handler(this, new FinishArgs { finish_Type = FinishArgs.Finish_Type.Time_out }); + Finished_Handler(this, new FinishArgs { finishType = FinishArgs.FinishType.Time_out }); } if (is_pause) { timer.Enabled = false; } } @@ -95,7 +100,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms Sp_button_Click(sender, e); } - public void Score_Add(object sender, AddScoreArgs e) + public void Score_Change(object sender, ChangeScoreArgs e) { cur_score += e.score * factor_val; current_base += e.score; @@ -136,18 +141,18 @@ namespace CDSAE3_Lian_Lian_Kan.Forms BeginInvoke(() => { timer.Close(); - switch (e.finish_Type) + switch (e.finishType) { - case FinishArgs.Finish_Type.All_done: + case FinishArgs.FinishType.All_done: Do_pause(this, new EventArgs()); Form form = new FinishedMessageBox(cur_score, Etcs.left_time - left_time); form.FormClosed += ((sender, args) => { Dispose(); Close(); - Etcs.form?.change_form(charts, false, null, null, false, null); }); + Etcs.form?.change_form(charts, false, null, null); }); form.ShowDialog(); break; - case FinishArgs.Finish_Type.Time_out: + case FinishArgs.FinishType.Time_out: Thread thread = new Thread(() => MessageBox.Show("鏃堕棿鍒帮紒")); thread.Start(); back_Click(this, new EventArgs()); @@ -181,7 +186,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms { Etcs.ThemeInfo themeInfo = Etcs.currentThemeInfo; BackColor = Color.FromArgb(themeInfo.ThemeColor![0], themeInfo.ThemeColor[1], themeInfo.ThemeColor[2]); - gameControl.BackColor = BackColor; + //gameControl.BackColor = BackColor; //gameControl.BackgroundImage = (Image)res_Manager.GetObject(themeInfo.PictureName!, Etcs.res_Culture)!; if (themeInfo.PlayPanelUsePicture) { @@ -191,5 +196,12 @@ namespace CDSAE3_Lian_Lian_Kan.Forms BackgroundImage = (Image)res_Manager.GetObject(themeInfo.PictureName!, Etcs.res_Culture)!; } } + + public void GetGift_Handler(object sender, GiftArgs e){ } + + public void TogglePause() + { + Sp_button_Click(this, new EventArgs()); + } } } diff --git a/CDSAE3_Lian_Lian_Kan/Forms/MainForm.cs b/CDSAE3_Lian_Lian_Kan/Forms/MainForm.cs index 7de3d1f..2e236a8 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/MainForm.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/MainForm.cs @@ -5,6 +5,7 @@ using System.Text.Encodings.Web; using System.Text.Unicode; using System.ComponentModel; using CDSAE3_Lian_Lian_Kan.Forms.Interface; +using System.Runtime.InteropServices; namespace CDSAE3_Lian_Lian_Kan.Forms { @@ -20,14 +21,14 @@ namespace CDSAE3_Lian_Lian_Kan.Forms { Etcs.hunderd_millsecond_timer.Elapsed -= StartFunc; Form? menuForm = null; - Invoke(() => menuForm = new Leisure_Mode_MenuForm()); - Invoke(() => change_form(menuForm!, false, null, null, false, null)); + Invoke(() => menuForm = new MenuForm()); + Invoke(() => change_form(menuForm!, false, null, null)); } - public async Task change_form(Form newForm, bool doAnimation, Color? begin, Color? end, bool haveImage, Image? image) + public async Task change_form(Form newForm, bool doAnimation, Color? begin, Color? end) { if (doAnimation) { - bufferForm.SetEffect(begin!.Value, end!.Value, haveImage, image); + bufferForm.SetEffect(begin!.Value, end!.Value); bufferForm.BringToFront(); bufferForm.Visible = true; } @@ -38,6 +39,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms MainPanel.Controls.Add(newForm); BeginInvoke(() => newForm.Show()); MainPanel.SendToBack(); + ActiveControl = newForm; if (doAnimation) { await bufferForm.EffectAsync(); @@ -45,5 +47,16 @@ namespace CDSAE3_Lian_Lian_Kan.Forms } GC.Collect(); } + protected override bool ProcessCmdKey(ref Message msg, Keys keyData) + { + KeyEventArgs e = new KeyEventArgs(keyData); + + if (keyData == (Keys.Space)) + { + Etcs.gameModeForm?.TogglePause(); + //Console.WriteLine(" TogglePause();"); + } + return true; + } } } diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/MenuForm.Designer.cs similarity index 96% rename from CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.Designer.cs rename to CDSAE3_Lian_Lian_Kan/Forms/MenuForm.Designer.cs index 40539cf..4d1240e 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.Designer.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/MenuForm.Designer.cs @@ -1,6 +1,6 @@ 锘縩amespace CDSAE3_Lian_Lian_Kan.Forms { - partial class Leisure_Mode_MenuForm + partial class MenuForm { /// /// Required designer variable. @@ -81,6 +81,7 @@ to_Challenge_mode.TabIndex = 3; to_Challenge_mode.Text = "鎸戞垬妯″紡"; to_Challenge_mode.UseVisualStyleBackColor = false; + to_Challenge_mode.Click += to_Challenge_mode_Click; // // mainLabel // @@ -93,7 +94,7 @@ mainLabel.TabIndex = 4; mainLabel.Text = "杩炶繛鐪"; // - // Leisure_Mode_MenuForm + // MenuForm // AutoScaleDimensions = new SizeF(11F, 24F); AutoScaleMode = AutoScaleMode.Font; @@ -107,7 +108,7 @@ Controls.Add(to_table_of_scores); DoubleBuffered = true; FormBorderStyle = FormBorderStyle.None; - Name = "Leisure_Mode_MenuForm"; + Name = "MenuForm"; Text = "MenuForm"; ResumeLayout(false); } diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.cs b/CDSAE3_Lian_Lian_Kan/Forms/MenuForm.cs similarity index 87% rename from CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.cs rename to CDSAE3_Lian_Lian_Kan/Forms/MenuForm.cs index 97baba8..abdb854 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Leisure_Mode_MenuForm.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/MenuForm.cs @@ -1,13 +1,11 @@ 锘縩amespace CDSAE3_Lian_Lian_Kan.Forms { - public partial class Leisure_Mode_MenuForm : Form, IMenuForm + public partial class MenuForm : Form, IMenuForm { - public Leisure_Mode_MenuForm() + public MenuForm() { InitializeComponent(); Etcs.gameMenuForm = this; - Etcs.song_Audio_Processer.set_albums("C418"); - Etcs.song_Audio_Processer.set_song(Etcs.song_Audio_Processer.get_next_song()); SetTheme(); } Color menuThemeColor, playThemeColor; @@ -49,25 +47,34 @@ mainLabel.ForeColor = Color.FromArgb(theme.FontColor![0], theme.FontColor[1], theme.FontColor[2]); mainLabel.Location = new Point(theme.FontBlockPos![0], theme.FontBlockPos[1]); mainLabel.Size = new Size(theme.FontBlockSize![0], theme.FontBlockSize[1]); + Etcs.song_Audio_Processer.set_albums(Etcs.curAlbum); + Etcs.song_Audio_Processer.set_song(Etcs.song_Audio_Processer.get_next_song()); } public void playFormToMenu() { - Etcs.form?.change_form(this, true, playThemeColor, menuThemeColor, AnimationUseImage, playPanelImage!); + Etcs.form?.change_form(this, true, playThemeColor, menuThemeColor); } private void start_Game_Click(object sender, EventArgs e) { - Etcs.form?.change_form(new Leisure_Mode(), true, menuThemeColor, playThemeColor, AnimationUseImage, this.BackgroundImage); + Etcs.form?.change_form(new Leisure_Mode(), true, menuThemeColor, playThemeColor); } - private void to_settings_Click(object sender, EventArgs e) + private void to_settings_Click(object sender, EventArgs e) { - Etcs.form?.change_form(Etcs.setting, false, null, null, false, null); + Etcs.form?.change_form(Etcs.setting, false, null, null); } private void to_table_of_scores_Click(object sender, EventArgs e) { - Etcs.form?.change_form(Etcs.charts, false, null, null, false, null); + Etcs.form?.change_form(Etcs.charts, false, null, null); + } + + private void to_Challenge_mode_Click(object sender, EventArgs e) + { + //Etcs.form?.change_form(new Challenge_Mode(), true, menuThemeColor, playThemeColor, AnimationUseImage, this.BackgroundImage); + Etcs.form?.change_form(new Challenge_Mode(), true, menuThemeColor, Color.Black); + } } } diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.resx b/CDSAE3_Lian_Lian_Kan/Forms/MenuForm.resx similarity index 93% rename from CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.resx rename to CDSAE3_Lian_Lian_Kan/Forms/MenuForm.resx index 1af7de1..af32865 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Challenge_Mode_MenuForm.resx +++ b/CDSAE3_Lian_Lian_Kan/Forms/MenuForm.resx @@ -1,17 +1,17 @@ 锘 - diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Setting.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/Setting.Designer.cs index 549d933..58402df 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Setting.Designer.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/Setting.Designer.cs @@ -68,6 +68,9 @@ hard = new RadioButton(); normal = new RadioButton(); easy = new RadioButton(); + groupAlgorithm = new GroupBox(); + ArrayAlgorithm = new RadioButton(); + GraphAlgorithm = new RadioButton(); ((System.ComponentModel.ISupportInitialize)back).BeginInit(); contextPanel.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)psButton).BeginInit(); @@ -76,6 +79,7 @@ ((System.ComponentModel.ISupportInitialize)soundScapeVolume).BeginInit(); ((System.ComponentModel.ISupportInitialize)musicVolume).BeginInit(); groupDifficulty.SuspendLayout(); + groupAlgorithm.SuspendLayout(); SuspendLayout(); // // back @@ -105,6 +109,7 @@ // contextPanel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; contextPanel.BackColor = SystemColors.ScrollBar; + contextPanel.Controls.Add(groupAlgorithm); contextPanel.Controls.Add(button1); contextPanel.Controls.Add(褰撳墠涓婚); contextPanel.Controls.Add(themeSelector); @@ -126,7 +131,7 @@ contextPanel.Controls.Add(groupDifficulty); contextPanel.Location = new Point(71, 103); contextPanel.Name = "contextPanel"; - contextPanel.Size = new Size(1219, 1209); + contextPanel.Size = new Size(1193, 1209); contextPanel.TabIndex = 21; // // button1 @@ -523,6 +528,43 @@ easy.UseVisualStyleBackColor = true; easy.CheckedChanged += Difficulty_CheckedChanged; // + // groupAlgorithm + // + groupAlgorithm.BackColor = Color.FromArgb(0, 0, 0, 0); + groupAlgorithm.Controls.Add(GraphAlgorithm); + groupAlgorithm.Controls.Add(ArrayAlgorithm); + groupAlgorithm.Font = new Font("Microsoft YaHei UI", 15F); + groupAlgorithm.Location = new Point(61, 886); + groupAlgorithm.Name = "groupAlgorithm"; + groupAlgorithm.Size = new Size(327, 208); + groupAlgorithm.TabIndex = 35; + groupAlgorithm.TabStop = false; + groupAlgorithm.Text = " 鍐呴儴绠楁硶"; + // + // ArrayAlgorithm + // + ArrayAlgorithm.AutoSize = true; + ArrayAlgorithm.Checked = true; + ArrayAlgorithm.Location = new Point(25, 45); + ArrayAlgorithm.Name = "ArrayAlgorithm"; + ArrayAlgorithm.Size = new Size(102, 43); + ArrayAlgorithm.TabIndex = 0; + ArrayAlgorithm.TabStop = true; + ArrayAlgorithm.Text = "鏁扮粍"; + ArrayAlgorithm.UseVisualStyleBackColor = true; + ArrayAlgorithm.CheckedChanged += Algorithm_CheckedChanged; + // + // GraphAlgorithm + // + GraphAlgorithm.AutoSize = true; + GraphAlgorithm.Location = new Point(25, 105); + GraphAlgorithm.Name = "GraphAlgorithm"; + GraphAlgorithm.Size = new Size(72, 43); + GraphAlgorithm.TabIndex = 1; + GraphAlgorithm.Text = "鍥"; + GraphAlgorithm.UseVisualStyleBackColor = true; + GraphAlgorithm.CheckedChanged += Algorithm_CheckedChanged; + // // Setting // AutoScaleDimensions = new SizeF(11F, 24F); @@ -547,6 +589,8 @@ ((System.ComponentModel.ISupportInitialize)musicVolume).EndInit(); groupDifficulty.ResumeLayout(false); groupDifficulty.PerformLayout(); + groupAlgorithm.ResumeLayout(false); + groupAlgorithm.PerformLayout(); ResumeLayout(false); PerformLayout(); } @@ -592,5 +636,8 @@ private RadioButton hard; private RadioButton normal; private RadioButton easy; + private GroupBox groupAlgorithm; + private RadioButton GraphAlgorithm; + private RadioButton ArrayAlgorithm; } } \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Setting.cs b/CDSAE3_Lian_Lian_Kan/Forms/Setting.cs index 9332cb1..b903f2d 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Setting.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/Setting.cs @@ -87,12 +87,16 @@ namespace CDSAE3_Lian_Lian_Kan.Forms { var s = albumSelector.SelectedItem?.ToString(); if (s != null) + { Etcs.song_Audio_Processer.set_albums(s); + Etcs.curAlbum = s; + } nextSong_Click(this, new EventArgs()); } private void musicVolume_Scroll(object? sender, EventArgs e) { + Etcs.Song_Volume = musicVolume.Value; Etcs.song_Audio_Processer.volume_change(musicVolume.Value); if (sender != null) songVolumeText.Text = musicVolume.Value.ToString(); @@ -110,7 +114,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms { CusSize_Validated(this, new EventArgs()); if (_canBack) - await Etcs.form!.change_form((Etcs.gameMenuForm as Form)!, false, null, null, false, null); + await Etcs.form!.change_form((Etcs.gameMenuForm as Form)!, false, null, null); } private void SetTimeText(int t) => time.Text = $"{t / 60}:{((t % 60) < 10 ? ("0" + (t % 60).ToString()) : (t % 60).ToString())}"; private int CalcTime(int total) => (int)(Math.Ceiling((double)total / 50)) * 60;//50per minute 鍚戜笂鍙栨暣 @@ -136,7 +140,6 @@ namespace CDSAE3_Lian_Lian_Kan.Forms int ans = CalcTime(a * b); Etcs.left_time = ans; SetTimeText(ans); - } private bool _cusDataChanged = false; private void cusWidth_TextChanged(object sender, EventArgs e) @@ -255,5 +258,18 @@ namespace CDSAE3_Lian_Lian_Kan.Forms Etcs.currentThemeInfo = Etcs.themes[s!]; SetTheme(); } + + private void Algorithm_CheckedChanged(object sender, EventArgs e) + { + switch ((sender as RadioButton)!.Name) + { + case "ArrayAlgorithm": + Etcs.curAlgorithm = Etcs.Algorithm.Array; + break; + case "GraphAlgorithm": + Etcs.curAlgorithm = Etcs.Algorithm.Graph; + break; + } + } } } diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.Designer.cs index 896532a..0bbf736 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.Designer.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.Designer.cs @@ -54,6 +54,7 @@ Name = "Single_Block"; Padding = new Padding(3); Size = new Size(40, 40); + Load += Single_Block_Load; ((System.ComponentModel.ISupportInitialize)picture).EndInit(); ResumeLayout(false); } diff --git a/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.cs b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.cs index 06df7f5..6aeebe5 100644 --- a/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.cs +++ b/CDSAE3_Lian_Lian_Kan/Forms/Single_Block.cs @@ -21,14 +21,14 @@ namespace CDSAE3_Lian_Lian_Kan.Forms if (Etcs.gameForm == null) throw new Exception("game_form is null but try to make a new Single_Block"); Selected += Etcs.gameForm.Selected_Handler; - } + int imageID = -1; public Single_Block(int image, Color default_backColor, Color select_Color, (int, int) pos) { block_id = image; position = pos; + imageID = image; InitializeComponent(); - Image_change(Etcs.get_block_Image(image)); picture.SizeMode = PictureBoxSizeMode.Zoom; nor_color = default_backColor; sel_color = select_Color; @@ -39,7 +39,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms Selected += Etcs.gameForm.Selected_Handler; } - public Single_Block(Image image, (int, int) pos) + public Single_Block((int, int) pos) { position = pos; InitializeComponent(); @@ -87,11 +87,29 @@ namespace CDSAE3_Lian_Lian_Kan.Forms Etcs.Direction direction = Etcs.Direction.none; public void hint_path(Etcs.Direction direction) { + if (picture == null) + { + picture = new PictureBox { Dock = DockStyle.Fill }; + Invoke(() => + { + Controls.Add(picture); + picture.BringToFront(); + }); + } this.direction |= direction; Image_change(Etcs.get_tip_direction_Image(this.direction)); } public void to_path(Etcs.Direction direction) { + if (picture == null) + { + picture = new PictureBox { Dock = DockStyle.Fill }; + Invoke(() => + { + Controls.Add(picture); + picture.BringToFront(); + }); + } Image_change(Etcs.get_direction_Image(direction)); direction = Etcs.Direction.none; } @@ -113,38 +131,65 @@ namespace CDSAE3_Lian_Lian_Kan.Forms int timer_Eplased = 0; public void Image_Clear(object? sender, ElapsedEventArgs e) { - if(timer_Eplased++ > 5) + if (timer_Eplased++ > 5) { - Image_change(Etcs.trans_Image); - Etcs.hunderd_millsecond_timer.Elapsed-= Image_Clear; + Etcs.hunderd_millsecond_timer.Elapsed -= Image_Clear; + try + { + Invoke(() => + { + if (picture == null) + return; + picture.Visible = false; + picture.Dispose(); + Controls.Remove(picture); + picture = null; + }); + } + catch + { } } } - ConcurrentQueueimages_queue = new ConcurrentQueue(); + ConcurrentQueue images_queue = new ConcurrentQueue(); Thread? Image_setting_thread; public void Image_change(Image new_image) { - images_queue.Enqueue(new_image); - if (Image_setting_thread == null || !Image_setting_thread.IsAlive) + try { - Image_setting_thread = new Thread(() => + try + { images_queue.Enqueue(new_image); } + catch (Exception) { - while (images_queue.TryDequeue(out Image? image)) + Console.WriteLine("Unusual Exception"); + throw; + } + if (Image_setting_thread == null || !Image_setting_thread.IsAlive) + { + Image_setting_thread = new Thread(() => { - try + while (images_queue.TryDequeue(out Image? image)) { - lock (image) + try { - Image_set(image); + lock (image) + { + Image_set(image); + } + } + catch (Exception) + { + images_queue.Enqueue(image); } - } - catch (Exception) - { - images_queue.Enqueue(image); - } - } - }); - Image_setting_thread.Start(); + } + }); + Image_setting_thread.Start(); + } + } + catch (Exception) + { + Console.WriteLine("unuasual 2"); + throw; } } private void Image_set(Image image) @@ -153,7 +198,9 @@ namespace CDSAE3_Lian_Lian_Kan.Forms { lock (locker) { - picture.Image = image; + if (picture == null) + picture = new PictureBox { Dock = DockStyle.Fill }; + picture!.Image = image; } } catch (Exception) @@ -177,7 +224,7 @@ namespace CDSAE3_Lian_Lian_Kan.Forms private void picture_MouseEnter(object sender, EventArgs e) { - if(!can_be_selected || selected) + if (!can_be_selected || selected) return; BackColor = mouse_upper_color; } @@ -189,6 +236,11 @@ namespace CDSAE3_Lian_Lian_Kan.Forms BackColor = nor_color; } + private void Single_Block_Load(object sender, EventArgs e) + { + Image_change(imageID == -1 ? Properties.Resources.trans : Etcs.get_block_Image(imageID)); + } + public event SelectedEventHandler Selected; } public class SelectedEventArgs : EventArgs diff --git a/CDSAE3_Lian_Lian_Kan/Forms/TimeLine.Designer.cs b/CDSAE3_Lian_Lian_Kan/Forms/TimeLine.Designer.cs new file mode 100644 index 0000000..9a55a11 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/TimeLine.Designer.cs @@ -0,0 +1,45 @@ +锘縩amespace CDSAE3_Lian_Lian_Kan.Forms +{ + partial class TimeLine + { + /// + /// 蹇呴渶鐨勮璁″櫒鍙橀噺銆 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 娓呯悊鎵鏈夋鍦ㄤ娇鐢ㄧ殑璧勬簮銆 + /// + /// 濡傛灉搴旈噴鏀炬墭绠¤祫婧愶紝涓 true锛涘惁鍒欎负 false銆 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region 缁勪欢璁捐鍣ㄧ敓鎴愮殑浠g爜 + + /// + /// 璁捐鍣ㄦ敮鎸佹墍闇鐨勬柟娉 - 涓嶈淇敼 + /// 浣跨敤浠g爜缂栬緫鍣ㄤ慨鏀规鏂规硶鐨勫唴瀹广 + /// + private void InitializeComponent() + { + SuspendLayout(); + // + // TimeLine + // + AutoScaleDimensions = new SizeF(11F, 24F); + AutoScaleMode = AutoScaleMode.Font; + BackColor = Color.FromArgb(0, 0, 0, 0); + Name = "TimeLine"; + Size = new Size(958, 10); + ResumeLayout(false); + } + + #endregion + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/TimeLine.cs b/CDSAE3_Lian_Lian_Kan/Forms/TimeLine.cs new file mode 100644 index 0000000..14738e1 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/TimeLine.cs @@ -0,0 +1,45 @@ +锘縰sing OpenCvSharp; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Drawing.Drawing2D; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace CDSAE3_Lian_Lian_Kan.Forms +{ + public partial class TimeLine : UserControl + { + public TimeLine() + { + InitializeComponent(); + } + private Color _backColor = Color.FromArgb(0,0,0); + private Color _frontColor = Color.FromArgb(97, 97, 108); + public void set_progress(float progress, Color backColor, Color frontColor) + { + _backColor = backColor; + _frontColor = frontColor; + set_progress(progress); + } + public void set_progress(double progress) + { + SolidBrush upperBrush = new SolidBrush(_backColor); + SolidBrush lowerBrush = new SolidBrush(_frontColor); + SolidBrush pointBrush = new SolidBrush(Color.FromArgb(255, 255, 255)); + Graphics formGraphics = CreateGraphics(); + //formGraphics.SmoothingMode = SmoothingMode.HighQuality; + int wire = (int)(progress * Width); + formGraphics.FillRectangle(lowerBrush, new Rectangle(0, 0, wire, Height)); + formGraphics.FillRectangle(pointBrush, new Rectangle(wire,0 , 4, Height)); + formGraphics.FillRectangle(upperBrush, new Rectangle(wire + 4, 0, Width, Height)); + upperBrush.Dispose(); + lowerBrush.Dispose(); + formGraphics.Dispose(); + } + } +} diff --git a/CDSAE3_Lian_Lian_Kan/Forms/TimeLine.resx b/CDSAE3_Lian_Lian_Kan/Forms/TimeLine.resx new file mode 100644 index 0000000..af32865 --- /dev/null +++ b/CDSAE3_Lian_Lian_Kan/Forms/TimeLine.resx @@ -0,0 +1,120 @@ +锘 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Properties/Resources.Designer.cs b/CDSAE3_Lian_Lian_Kan/Properties/Resources.Designer.cs index 0c69934..6ece0cb 100644 --- a/CDSAE3_Lian_Lian_Kan/Properties/Resources.Designer.cs +++ b/CDSAE3_Lian_Lian_Kan/Properties/Resources.Designer.cs @@ -60,6 +60,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Byte[] 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static byte[] Ambient { + get { + object obj = ResourceManager.GetObject("Ambient", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -230,6 +240,26 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap cpp { + get { + object obj = ResourceManager.GetObject("cpp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap cSharp { + get { + object obj = ResourceManager.GetObject("cSharp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -290,6 +320,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Byte[] 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static byte[] failed { + get { + object obj = ResourceManager.GetObject("failed", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -360,6 +400,26 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap Gcpp { + get { + object obj = ResourceManager.GetObject("Gcpp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap GcSharp { + get { + object obj = ResourceManager.GetObject("GcSharp", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -370,6 +430,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap Ggo { + get { + object obj = ResourceManager.GetObject("Ggo", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -380,6 +450,36 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap Gjava { + get { + object obj = ResourceManager.GetObject("Gjava", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap Gkotlin { + get { + object obj = ResourceManager.GetObject("Gkotlin", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap go { + get { + object obj = ResourceManager.GetObject("go", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -390,6 +490,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap Gpython { + get { + object obj = ResourceManager.GetObject("Gpython", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -400,6 +510,26 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap Gruby { + get { + object obj = ResourceManager.GetObject("Gruby", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap Grust { + get { + object obj = ResourceManager.GetObject("Grust", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -410,6 +540,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap Gvue { + get { + object obj = ResourceManager.GetObject("Gvue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -420,6 +560,36 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Byte[] 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static byte[] HitSong { + get { + object obj = ResourceManager.GetObject("HitSong", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap java { + get { + object obj = ResourceManager.GetObject("java", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap kotlin { + get { + object obj = ResourceManager.GetObject("kotlin", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -460,6 +630,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Byte[] 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static byte[] Message { + get { + object obj = ResourceManager.GetObject("Message", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -500,6 +680,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap python { + get { + object obj = ResourceManager.GetObject("python", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -510,6 +700,26 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap ruby { + get { + object obj = ResourceManager.GetObject("ruby", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap rust { + get { + object obj = ResourceManager.GetObject("rust", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Byte[] 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -820,6 +1030,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Byte[] 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static byte[] songInfoShow { + get { + object obj = ResourceManager.GetObject("songInfoShow", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// 鏌ユ壘 System.Byte[] 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -840,6 +1060,16 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Byte[] 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static byte[] Tatsh___Xenolith { + get { + object obj = ResourceManager.GetObject("Tatsh___Xenolith", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// @@ -1080,6 +1310,186 @@ namespace CDSAE3_Lian_Lian_Kan.Properties { } } + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap vue { + get { + object obj = ResourceManager.GetObject("vue", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_d { + get { + object obj = ResourceManager.GetObject("w_d", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_dl { + get { + object obj = ResourceManager.GetObject("w_dl", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_dlr { + get { + object obj = ResourceManager.GetObject("w_dlr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_dr { + get { + object obj = ResourceManager.GetObject("w_dr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_exchange { + get { + object obj = ResourceManager.GetObject("w_exchange", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_l { + get { + object obj = ResourceManager.GetObject("w_l", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_lr { + get { + object obj = ResourceManager.GetObject("w_lr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_r { + get { + object obj = ResourceManager.GetObject("w_r", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_search { + get { + object obj = ResourceManager.GetObject("w_search", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_u { + get { + object obj = ResourceManager.GetObject("w_u", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_ud { + get { + object obj = ResourceManager.GetObject("w_ud", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_udl { + get { + object obj = ResourceManager.GetObject("w_udl", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_udlr { + get { + object obj = ResourceManager.GetObject("w_udlr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_udr { + get { + object obj = ResourceManager.GetObject("w_udr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_ul { + get { + object obj = ResourceManager.GetObject("w_ul", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_ulr { + get { + object obj = ResourceManager.GetObject("w_ulr", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + + /// + /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 + /// + internal static System.Drawing.Bitmap w_ur { + get { + object obj = ResourceManager.GetObject("w_ur", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// 鏌ユ壘 System.Drawing.Bitmap 绫诲瀷鐨勬湰鍦板寲璧勬簮銆 /// diff --git a/CDSAE3_Lian_Lian_Kan/Properties/Resources.resx b/CDSAE3_Lian_Lian_Kan/Properties/Resources.resx index 1f4d4be..838487e 100644 --- a/CDSAE3_Lian_Lian_Kan/Properties/Resources.resx +++ b/CDSAE3_Lian_Lian_Kan/Properties/Resources.resx @@ -427,4 +427,127 @@ ..\Resources\Sea Power - Zaum.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\Ambient.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\failed.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\HitSong.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Message.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\songInfoShow.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Tatsh - Xenolith.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\w_d.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_dl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_dlr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_dr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_exchange.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_l.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_lr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_r.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_search.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_u.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_ud.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_udl.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_udlr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_udr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_ul.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_ulr.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\w_ur.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\cpp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\cSharp.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gcpp.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\GcSharp.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Ggo.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gjava.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gkotlin.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\go.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gpython.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gruby.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Grust.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\Gvue.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\java.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\kotlin.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\python.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\ruby.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\rust.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + ..\Resources\vue.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Ambient.mp3 b/CDSAE3_Lian_Lian_Kan/Resources/Ambient.mp3 new file mode 100644 index 0000000..0a23071 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Ambient.mp3 differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/GcSharp.gif b/CDSAE3_Lian_Lian_Kan/Resources/GcSharp.gif new file mode 100644 index 0000000..ae474b0 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/GcSharp.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gcpp.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gcpp.gif new file mode 100644 index 0000000..f650c30 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gcpp.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Ggo.gif b/CDSAE3_Lian_Lian_Kan/Resources/Ggo.gif new file mode 100644 index 0000000..20c7062 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Ggo.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gjava.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gjava.gif new file mode 100644 index 0000000..efaae88 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gjava.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gkotlin.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gkotlin.gif new file mode 100644 index 0000000..fb5bbc6 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gkotlin.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gpython.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gpython.gif new file mode 100644 index 0000000..404bfad Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gpython.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gruby.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gruby.gif new file mode 100644 index 0000000..5e78e54 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gruby.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Grust.gif b/CDSAE3_Lian_Lian_Kan/Resources/Grust.gif new file mode 100644 index 0000000..dae9981 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Grust.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Gvue.gif b/CDSAE3_Lian_Lian_Kan/Resources/Gvue.gif new file mode 100644 index 0000000..8508b21 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Gvue.gif differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/HitSong.mp3 b/CDSAE3_Lian_Lian_Kan/Resources/HitSong.mp3 new file mode 100644 index 0000000..49e0900 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/HitSong.mp3 differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Message.mp3 b/CDSAE3_Lian_Lian_Kan/Resources/Message.mp3 new file mode 100644 index 0000000..6635cff Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Message.mp3 differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/Tatsh - Xenolith.mp3 b/CDSAE3_Lian_Lian_Kan/Resources/Tatsh - Xenolith.mp3 new file mode 100644 index 0000000..8627e58 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/Tatsh - Xenolith.mp3 differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/cSharp.png b/CDSAE3_Lian_Lian_Kan/Resources/cSharp.png new file mode 100644 index 0000000..1aaec8c Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/cSharp.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/cpp.png b/CDSAE3_Lian_Lian_Kan/Resources/cpp.png new file mode 100644 index 0000000..258a0fb Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/cpp.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/failed.mp3 b/CDSAE3_Lian_Lian_Kan/Resources/failed.mp3 new file mode 100644 index 0000000..9ec22ee Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/failed.mp3 differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/go.png b/CDSAE3_Lian_Lian_Kan/Resources/go.png new file mode 100644 index 0000000..f292ded Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/go.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/java.png b/CDSAE3_Lian_Lian_Kan/Resources/java.png new file mode 100644 index 0000000..dc5b7fb Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/java.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/kotlin.png b/CDSAE3_Lian_Lian_Kan/Resources/kotlin.png new file mode 100644 index 0000000..0dee9b2 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/kotlin.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/python.png b/CDSAE3_Lian_Lian_Kan/Resources/python.png new file mode 100644 index 0000000..71e2fcd Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/python.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/ruby.png b/CDSAE3_Lian_Lian_Kan/Resources/ruby.png new file mode 100644 index 0000000..b8b5cb8 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/ruby.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/rust.png b/CDSAE3_Lian_Lian_Kan/Resources/rust.png new file mode 100644 index 0000000..0c244ca Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/rust.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/songInfoShow.mp3 b/CDSAE3_Lian_Lian_Kan/Resources/songInfoShow.mp3 new file mode 100644 index 0000000..b19fbf5 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/songInfoShow.mp3 differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/vue.png b/CDSAE3_Lian_Lian_Kan/Resources/vue.png new file mode 100644 index 0000000..77b4080 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/vue.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_d.png b/CDSAE3_Lian_Lian_Kan/Resources/w_d.png new file mode 100644 index 0000000..fdfe405 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_d.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_dl.png b/CDSAE3_Lian_Lian_Kan/Resources/w_dl.png new file mode 100644 index 0000000..265a90d Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_dl.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_dlr.png b/CDSAE3_Lian_Lian_Kan/Resources/w_dlr.png new file mode 100644 index 0000000..e6572a6 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_dlr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_dr.png b/CDSAE3_Lian_Lian_Kan/Resources/w_dr.png new file mode 100644 index 0000000..b68d6f4 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_dr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_exchange.png b/CDSAE3_Lian_Lian_Kan/Resources/w_exchange.png new file mode 100644 index 0000000..39c3b22 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_exchange.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_l.png b/CDSAE3_Lian_Lian_Kan/Resources/w_l.png new file mode 100644 index 0000000..d3d7e77 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_l.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_lr.png b/CDSAE3_Lian_Lian_Kan/Resources/w_lr.png new file mode 100644 index 0000000..50e9598 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_lr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_r.png b/CDSAE3_Lian_Lian_Kan/Resources/w_r.png new file mode 100644 index 0000000..7c400fa Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_r.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_search.png b/CDSAE3_Lian_Lian_Kan/Resources/w_search.png new file mode 100644 index 0000000..c364bbb Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_search.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_u.png b/CDSAE3_Lian_Lian_Kan/Resources/w_u.png new file mode 100644 index 0000000..e1791a3 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_u.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_ud.png b/CDSAE3_Lian_Lian_Kan/Resources/w_ud.png new file mode 100644 index 0000000..f9f14bd Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_ud.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_udl.png b/CDSAE3_Lian_Lian_Kan/Resources/w_udl.png new file mode 100644 index 0000000..9d20404 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_udl.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_udlr.png b/CDSAE3_Lian_Lian_Kan/Resources/w_udlr.png new file mode 100644 index 0000000..ace79dc Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_udlr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_udr.png b/CDSAE3_Lian_Lian_Kan/Resources/w_udr.png new file mode 100644 index 0000000..622c39d Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_udr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_ul.png b/CDSAE3_Lian_Lian_Kan/Resources/w_ul.png new file mode 100644 index 0000000..fcf7cb7 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_ul.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_ulr.png b/CDSAE3_Lian_Lian_Kan/Resources/w_ulr.png new file mode 100644 index 0000000..8a76fea Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_ulr.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Resources/w_ur.png b/CDSAE3_Lian_Lian_Kan/Resources/w_ur.png new file mode 100644 index 0000000..12f4b29 Binary files /dev/null and b/CDSAE3_Lian_Lian_Kan/Resources/w_ur.png differ diff --git a/CDSAE3_Lian_Lian_Kan/Sound/AudioPlayer.cs b/CDSAE3_Lian_Lian_Kan/Sound/AudioPlayer.cs index 5cc741a..709e2c2 100644 --- a/CDSAE3_Lian_Lian_Kan/Sound/AudioPlayer.cs +++ b/CDSAE3_Lian_Lian_Kan/Sound/AudioPlayer.cs @@ -30,8 +30,12 @@ namespace CDSAE3_Lian_Lian_Kan.Sound sound = new MemoryStream(source_obj); ms = new MemoryStream(StreamToBytes(sound)); ws = new Mp3FileReader(ms); + + blockAlignReductionStream = new BlockAlignReductionStream(ws); + wave16ToFloatProvider = new Wave16ToFloatProvider(blockAlignReductionStream); + wave16ToFloatProvider.Volume = volume / 100f; waveOutEvent = new WaveOutEvent(); waveOutEvent.Init(wave16ToFloatProvider); @@ -73,7 +77,11 @@ namespace CDSAE3_Lian_Lian_Kan.Sound waveOutEvent.Stop(); sound.Dispose(); ms.Dispose(); - ws.Dispose(); + try + { + ws.Dispose(); + }catch(Exception) + { } blockAlignReductionStream.Dispose(); waveOutEvent.Dispose(); GC.SuppressFinalize(this); diff --git a/CDSAE3_Lian_Lian_Kan/Sound/Info_Audio_processer.cs b/CDSAE3_Lian_Lian_Kan/Sound/Info_Audio_processer.cs index b75d3d5..b0130f8 100644 --- a/CDSAE3_Lian_Lian_Kan/Sound/Info_Audio_processer.cs +++ b/CDSAE3_Lian_Lian_Kan/Sound/Info_Audio_processer.cs @@ -14,31 +14,31 @@ namespace CDSAE3_Lian_Lian_Kan.Sound string last_break_soundScape = ""; Random random = new Random(); internal void set_SoundScape_version(Etcs.break_music version) => soundScape_version = version; - internal void play_random_break_soundScape() + internal void play_random_break_soundScape(int volume = -1, Action? finished = null) { Task.Run(() => { - void finished(string s,AudioPlayer audioPlayer) - { - audioPlayer.Dispose(); - } - AudioPlayer audioPlayer = new AudioPlayer(get_random_break_soundScape(), Etcs.Info_Volume,finished); + if (volume == -1) + volume = Etcs.Info_Volume; + if (finished == null) + finished = (s, player) => player.Dispose(); + AudioPlayer audioPlayer = new AudioPlayer(get_random_break_soundScape(), volume, finished); audioPlayer.resume_song(); - //object obj = Settings.res_Manager.GetObject(get_random_break_soundScape(), Settings.res_Culture)!; - //var infoOutputDevice = new WaveOutEvent(); - //using (var sound = new MemoryStream((byte[])obj)) - //using (var ms = new MemoryStream(StreamToBytes(sound))) - //using (var ws = new Mp3FileReader(ms)) - //using (var blockAlignReductionStream = new BlockAlignReductionStream(ws)) - //{ - // var wave16ToFloatProvider = new Wave16ToFloatProvider(blockAlignReductionStream); - // wave16ToFloatProvider.Volume = soundScape_volume / 100f; - // infoOutputDevice.Init(wave16ToFloatProvider); - // infoOutputDevice.PlaybackStopped += InfoOutputDevice_PlaybackStopped; - // infoOutputDevice.Play(); - //} }); } + internal void playMusicClip(string s,int volume = -1,Action?finished = null) + { + Task.Run(() => + { + if (volume == -1) + volume = Etcs.Info_Volume; + if (finished == null) + finished = (s, player) => player.Dispose(); + AudioPlayer audioPlayer = new AudioPlayer(s, volume, finished); + audioPlayer.resume_song(); + }); + } + private string get_random_break_soundScape() { diff --git a/CDSAE3_Lian_Lian_Kan/Sound/Song_Audio_processer.cs b/CDSAE3_Lian_Lian_Kan/Sound/Song_Audio_processer.cs index 66bdca3..4b63e26 100644 --- a/CDSAE3_Lian_Lian_Kan/Sound/Song_Audio_processer.cs +++ b/CDSAE3_Lian_Lian_Kan/Sound/Song_Audio_processer.cs @@ -10,13 +10,22 @@ using CDSAE3_Lian_Lian_Kan.Properties; using NAudio.Wave.SampleProviders; namespace CDSAE3_Lian_Lian_Kan.Sound { + public class SongFinishedEventArgs : EventArgs + { + public string SongName { get; set; } + public SongFinishedEventArgs(string songName) => SongName = songName; + } + + public delegate void SongFinishedEventHandler(Song_Audio_processer s, SongFinishedEventArgs e); public class Song_Audio_processer:IDisposable { AudioPlayer? audioPlayer; private List audioFiles = new List(); + public event SongFinishedEventHandler? SongFinished; int next_song = 1; private void OnPlaybackStopped(string s,object? obj) { + SongFinished?.Invoke(this, new SongFinishedEventArgs(s)); set_song(get_next_song()); } public void pause_song()=> audioPlayer?.pause_song(); @@ -44,19 +53,20 @@ namespace CDSAE3_Lian_Lian_Kan.Sound public void volume_change(int val)=> audioPlayer?.volume_change(val); public void set_albums(string s) { + next_song = 0; var result = Etcs.musics.Where(x => x.Key == s).ToList(); if (result.Count == 0) throw new Exception("no such album"); audioFiles = result.First().Value; Etcs.setting.SetAlbum(result.First().Key); } - public void set_song(string s) + internal void set_song(string s,int volume = -1,Action? finished = null) { Etcs.setting.SetSongInfo(s); audioPlayer?.Dispose(); try { - audioPlayer = new AudioPlayer(s, Etcs.Song_Volume, OnPlaybackStopped); + audioPlayer = new AudioPlayer(s, volume == -1 ? Etcs.Song_Volume : volume, finished ?? OnPlaybackStopped); } catch (Exception e) {