From 131338ce80e917d234e07c6d12643a145126f523 Mon Sep 17 00:00:00 2001 From: milimoe Date: Sun, 13 Apr 2025 19:57:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- OshimaModes/App.xaml | 7 + OshimaModes/App.xaml.cs | 6 + OshimaModes/FastAuto.cs | 37 +- OshimaModes/FastAutoUI.Designer.cs | 133 ---- OshimaModes/FastAutoUI.cs | 57 -- OshimaModes/FastAutoUI.resx | 120 --- OshimaModes/MainWindow.xaml | 71 +- OshimaModes/MainWindow.xaml.cs | 61 +- OshimaModes/MainWindowViewModel.cs | 7 +- OshimaModes/OshimaModes.csproj | 5 +- OshimaModes/Program.cs | 17 - OshimaModes/UserControl/CharacterStatus.xaml | 88 ++ .../UserControl/CharacterStatus.xaml.cs | 73 ++ .../UserControl/CustomProgressBar.xaml | 12 + .../UserControl/CustomProgressBar.xaml.cs | 46 ++ .../UserControsl/CharacterStatus.Designer.cs | 216 ----- OshimaModes/UserControsl/CharacterStatus.cs | 10 - OshimaModes/UserControsl/CharacterStatus.resx | 749 ------------------ OshimaModes/UserControsl/CustomProgressBar.cs | 72 -- .../UserControsl/CustomProgressBar.resx | 120 --- .../UserControsl/PlayerStatusControl.cs | 59 -- .../UserControsl/PlayerStatusControl.resx | 120 --- OshimaModules/Items/Accessory/攻击之爪.cs | 2 +- OshimaModules/Items/Weapon/独奏弓.cs | 2 +- OshimaModules/Skills/ColdBlue/累积之压.cs | 2 +- OshimaModules/Skills/MagicalGirl/毁灭之势.cs | 2 +- OshimaModules/Skills/Mayor/致命打击.cs | 2 +- OshimaModules/Skills/NanGanyu/灵能反射.cs | 2 +- OshimaModules/Skills/NiuNan/智慧与力量.cs | 2 +- OshimaModules/Skills/Oshima/META马.cs | 2 +- OshimaModules/Skills/QWQAQW/破釜沉舟.cs | 2 +- OshimaModules/Skills/QingXiang/枯竭打击.cs | 2 +- OshimaModules/Skills/QuDuoduo/弱者猎手.cs | 2 +- OshimaModules/Skills/XinYin/心灵之火.cs | 2 +- OshimaModules/Skills/Yang/魔法震荡.cs | 2 +- OshimaModules/Skills/dddovo/敏捷之刃.cs | 2 +- 36 files changed, 356 insertions(+), 1758 deletions(-) create mode 100644 OshimaModes/App.xaml create mode 100644 OshimaModes/App.xaml.cs delete mode 100644 OshimaModes/FastAutoUI.Designer.cs delete mode 100644 OshimaModes/FastAutoUI.cs delete mode 100644 OshimaModes/FastAutoUI.resx delete mode 100644 OshimaModes/Program.cs create mode 100644 OshimaModes/UserControl/CharacterStatus.xaml create mode 100644 OshimaModes/UserControl/CharacterStatus.xaml.cs create mode 100644 OshimaModes/UserControl/CustomProgressBar.xaml create mode 100644 OshimaModes/UserControl/CustomProgressBar.xaml.cs delete mode 100644 OshimaModes/UserControsl/CharacterStatus.Designer.cs delete mode 100644 OshimaModes/UserControsl/CharacterStatus.cs delete mode 100644 OshimaModes/UserControsl/CharacterStatus.resx delete mode 100644 OshimaModes/UserControsl/CustomProgressBar.cs delete mode 100644 OshimaModes/UserControsl/CustomProgressBar.resx delete mode 100644 OshimaModes/UserControsl/PlayerStatusControl.cs delete mode 100644 OshimaModes/UserControsl/PlayerStatusControl.resx diff --git a/OshimaModes/App.xaml b/OshimaModes/App.xaml new file mode 100644 index 0000000..2b40b54 --- /dev/null +++ b/OshimaModes/App.xaml @@ -0,0 +1,7 @@ + + + + diff --git a/OshimaModes/App.xaml.cs b/OshimaModes/App.xaml.cs new file mode 100644 index 0000000..5f88ee5 --- /dev/null +++ b/OshimaModes/App.xaml.cs @@ -0,0 +1,6 @@ +namespace Oshima.FunGame.OshimaModes +{ + public partial class App : System.Windows.Application + { + } +} diff --git a/OshimaModes/FastAuto.cs b/OshimaModes/FastAuto.cs index cbcbc2f..45dfe8e 100644 --- a/OshimaModes/FastAuto.cs +++ b/OshimaModes/FastAuto.cs @@ -6,6 +6,7 @@ using Milimoe.FunGame.Core.Library.Common.Event; using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Core.Model; using Oshima.Core.Constant; +using Application = System.Windows.Application; namespace Oshima.FunGame.OshimaModes { @@ -37,19 +38,41 @@ namespace Oshima.FunGame.OshimaModes public override void StartUI(params object[] args) { - if (Application.MessageLoop) + try { - FastAutoUI f = new(); - f.Invoke(f.Show); + // 确保在 UI 线程执行 + if (Application.Current != null) + { + Application.Current.Dispatcher.Invoke(() => + { + try + { + MainWindow mainWindow = new(); + mainWindow.Closed += (s, e) => + { + Controller.WriteLine("MainWindow closed"); + }; + mainWindow.Show(); + } + catch (Exception ex) + { + Controller.Error(ex); + throw; + } + }); + } + else + { + throw new InvalidOperationException("WPF Application not initialized."); + } } - else + catch (Exception ex) { - ApplicationConfiguration.Initialize(); - Application.Run(new FastAutoUI()); + Controller.Error(ex); + throw; } } - public void GamingUpdateInfoEvent(object sender, GamingEventArgs e, Dictionary data) { try diff --git a/OshimaModes/FastAutoUI.Designer.cs b/OshimaModes/FastAutoUI.Designer.cs deleted file mode 100644 index a7b7900..0000000 --- a/OshimaModes/FastAutoUI.Designer.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System.Windows.Forms; - -namespace Oshima.FunGame.OshimaModes -{ - partial class FastAutoUI - { - /// - /// 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() - { - mainTableLayoutPanel = new TableLayoutPanel(); - rightTableLayoutPanel = new TableLayoutPanel(); - richTextBox = new RichTextBox(); - leftTableLayoutPanel = new TableLayoutPanel(); - characterStatus1 = new CharacterStatus(); - mainTableLayoutPanel.SuspendLayout(); - leftTableLayoutPanel.SuspendLayout(); - SuspendLayout(); - // - // mainTableLayoutPanel - // - mainTableLayoutPanel.ColumnCount = 3; - mainTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); - mainTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); - mainTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25F)); - mainTableLayoutPanel.Controls.Add(rightTableLayoutPanel, 2, 1); - mainTableLayoutPanel.Controls.Add(richTextBox, 1, 1); - mainTableLayoutPanel.Controls.Add(leftTableLayoutPanel, 0, 1); - mainTableLayoutPanel.Dock = DockStyle.Fill; - mainTableLayoutPanel.Location = new Point(0, 0); - mainTableLayoutPanel.Name = "mainTableLayoutPanel"; - mainTableLayoutPanel.RowCount = 3; - mainTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 10F)); - mainTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 70F)); - mainTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 20F)); - mainTableLayoutPanel.Size = new Size(1688, 943); - mainTableLayoutPanel.TabIndex = 0; - // - // rightTableLayoutPanel - // - rightTableLayoutPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - rightTableLayoutPanel.ColumnCount = 2; - rightTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); - rightTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); - rightTableLayoutPanel.Location = new Point(1269, 97); - rightTableLayoutPanel.Name = "rightTableLayoutPanel"; - rightTableLayoutPanel.RowCount = 3; - rightTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 33.33F)); - rightTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 33.33F)); - rightTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 33.33F)); - rightTableLayoutPanel.Size = new Size(416, 654); - rightTableLayoutPanel.TabIndex = 1; - // - // richTextBox - // - richTextBox.Dock = DockStyle.Fill; - richTextBox.Location = new Point(425, 97); - richTextBox.Name = "richTextBox"; - richTextBox.ReadOnly = true; - richTextBox.Size = new Size(838, 654); - richTextBox.TabIndex = 2; - richTextBox.Text = ""; - // - // leftTableLayoutPanel - // - leftTableLayoutPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - leftTableLayoutPanel.ColumnCount = 2; - leftTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); - leftTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F)); - leftTableLayoutPanel.Controls.Add(characterStatus1, 0, 0); - leftTableLayoutPanel.Location = new Point(3, 97); - leftTableLayoutPanel.Name = "leftTableLayoutPanel"; - leftTableLayoutPanel.RowCount = 3; - leftTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 33.33F)); - leftTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 33.33F)); - leftTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 33.33F)); - leftTableLayoutPanel.Size = new Size(416, 654); - leftTableLayoutPanel.TabIndex = 0; - // - // characterStatus1 - // - characterStatus1.Location = new Point(3, 3); - characterStatus1.Name = "characterStatus1"; - characterStatus1.Size = new Size(202, 211); - characterStatus1.TabIndex = 0; - // - // FastAutoUI - // - AutoScaleDimensions = new SizeF(7F, 17F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1688, 943); - Controls.Add(mainTableLayoutPanel); - FormBorderStyle = FormBorderStyle.FixedSingle; - MaximizeBox = false; - Name = "FastAutoUI"; - Text = "游戏界面"; - mainTableLayoutPanel.ResumeLayout(false); - leftTableLayoutPanel.ResumeLayout(false); - ResumeLayout(false); - } - - private System.Windows.Forms.TableLayoutPanel mainTableLayoutPanel; - private System.Windows.Forms.TableLayoutPanel leftTableLayoutPanel; - private System.Windows.Forms.TableLayoutPanel rightTableLayoutPanel; - private System.Windows.Forms.RichTextBox richTextBox; - - #endregion - - private CharacterStatus characterStatus1; - } -} diff --git a/OshimaModes/FastAutoUI.cs b/OshimaModes/FastAutoUI.cs deleted file mode 100644 index 67b6ee7..0000000 --- a/OshimaModes/FastAutoUI.cs +++ /dev/null @@ -1,57 +0,0 @@ -namespace Oshima.FunGame.OshimaModes -{ - public partial class FastAutoUI : Form - { - public FastAutoUI() - { - InitializeComponent(); - - // Ӹ - AddPlayers(7); - } - - // ̬Ҹ - private void AddPlayers(int playerCount) - { - int leftIndex = 0; // Ҽ - int rightIndex = 0; // ҲżҼ - - for (int i = 1; i <= playerCount; i++) - { - // ÿButtonʾ - CharacterStatus playerSlot = new(); - - if (i % 2 == 1) // ң - { - AddToLeftPanel(playerSlot, leftIndex); - leftIndex++; - } - else // żңҲ - { - AddToRightPanel(playerSlot, rightIndex); - rightIndex++; - } - } - } - - // ҵTableLayoutPanel - private void AddToLeftPanel(Control control, int index) - { - int col = index / 3; // ÿ3 - int row = index % 3; // кŴ02 - leftTableLayoutPanel.Controls.Add(control, col, row); - } - - // żҵҲTableLayoutPanel - private void AddToRightPanel(Control control, int index) - { - // żҵй - // - һ: Player 10, Player 11, Player 12 (index3ʼ) - // - ڶ: Player 2, Player 4, Player 6 (index0ʼ) - - int col = (index >= 3) ? 0 : 1; // 3 λҵżӦڵһУڵڶ - int row = index % 3; // кŴ02 - rightTableLayoutPanel.Controls.Add(control, col, row); - } - } -} diff --git a/OshimaModes/FastAutoUI.resx b/OshimaModes/FastAutoUI.resx deleted file mode 100644 index af32865..0000000 --- a/OshimaModes/FastAutoUI.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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/OshimaModes/MainWindow.xaml b/OshimaModes/MainWindow.xaml index 1ef304f..0857eef 100644 --- a/OshimaModes/MainWindow.xaml +++ b/OshimaModes/MainWindow.xaml @@ -1,52 +1,47 @@  + xmlns:local="clr-namespace:Oshima.FunGame.OshimaModes" + Title="游戏界面" Height="943" Width="1688" ResizeMode="NoResize"> - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - + + + + - - - - + + - - - -