diff --git a/OshimaModes/MainWindow.xaml b/OshimaModes/MainWindow.xaml
new file mode 100644
index 0000000..1ef304f
--- /dev/null
+++ b/OshimaModes/MainWindow.xaml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/OshimaModes/MainWindow.xaml.cs b/OshimaModes/MainWindow.xaml.cs
new file mode 100644
index 0000000..d41a87c
--- /dev/null
+++ b/OshimaModes/MainWindow.xaml.cs
@@ -0,0 +1,37 @@
+using System.Windows;
+using System.Windows.Input;
+
+namespace Oshima.FunGame.OshimaModes
+{
+ ///
+ /// MainWindow.xaml 的交互逻辑
+ ///
+ public partial class MainWindow : Window
+ {
+ private MainWindowViewModel ViewModel;
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ ViewModel = new MainWindowViewModel();
+ DataContext = ViewModel;
+ Show();
+ }
+
+ private void SendButton_Click(object sender, RoutedEventArgs e)
+ {
+ // 发送聊天消息的逻辑
+ string message = ChatInputTextBox.Text;
+ ViewModel.GameInfoText += $"You: {message}\n";
+ ChatInputTextBox.Clear();
+ }
+
+ private void ChatInputTextBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter)
+ {
+ SendButton_Click(sender, null);
+ }
+ }
+ }
+}
diff --git a/OshimaModes/MainWindowViewModel.cs b/OshimaModes/MainWindowViewModel.cs
new file mode 100644
index 0000000..fe803ab
--- /dev/null
+++ b/OshimaModes/MainWindowViewModel.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media.Imaging;
+
+namespace Oshima.FunGame.OshimaModes
+{
+ public class MainWindowViewModel : INotifyPropertyChanged
+ {
+ public ObservableCollection Players { get; set; } = new ObservableCollection();
+
+ private string _gameInfoText;
+ public string GameInfoText
+ {
+ get { return _gameInfoText; }
+ set
+ {
+ _gameInfoText = value;
+ OnPropertyChanged(nameof(GameInfoText));
+ }
+ }
+
+ public MainWindowViewModel()
+ {
+ // 模拟添加玩家
+ for (int i = 1; i <= 12; i++)
+ {
+ Players.Add(new PlayerInfo
+ {
+ PlayerName = $"Player {i}",
+ HP = $"{i * 10}/{i * 100}",
+ MP = $"{i * 5}/{i * 50}",
+ PlayerImage = new BitmapImage(new System.Uri("pack://application:,,,/Oshima.FunGame.WPFUI;component/Images/default_avatar.png")) // 替换为你的默认头像
+ });
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged(string propertyName)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+
+ public class PlayerInfo
+ {
+ public string PlayerName { get; set; }
+ public string HP { get; set; }
+ public string MP { get; set; }
+ public BitmapImage PlayerImage { get; set; }
+ }
+}
diff --git a/OshimaServers/FastAutoServer.cs b/OshimaServers/FastAutoServer.cs
index 47da557..3ff79c2 100644
--- a/OshimaServers/FastAutoServer.cs
+++ b/OshimaServers/FastAutoServer.cs
@@ -104,6 +104,7 @@ namespace Oshima.FunGame.OshimaServers
{
// 因为模组是单例的,需要为这个房间创建一个工作类接收参数,不能直接用本地变量处理
ModuleServerWorker worker = new(obj);
+ Workers[obj.Room.Roomid] = worker;
TaskUtility.NewTask(async () => await StartGame(obj, worker)).OnError(Controller.Error);
return true;
}
diff --git a/OshimaWebAPI/OshimaWebAPI.cs b/OshimaWebAPI/OshimaWebAPI.cs
index d952fc3..6fbd138 100644
--- a/OshimaWebAPI/OshimaWebAPI.cs
+++ b/OshimaWebAPI/OshimaWebAPI.cs
@@ -3,7 +3,9 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Milimoe.FunGame.Core.Api.Transmittal;
using Milimoe.FunGame.Core.Api.Utility;
+using Milimoe.FunGame.Core.Interface;
using Milimoe.FunGame.Core.Library.Common.Addon;
+using Milimoe.FunGame.Core.Library.Common.Event;
using Oshima.Core.Configs;
using Oshima.Core.Constant;
using Oshima.FunGame.OshimaServers.Service;
@@ -14,7 +16,7 @@ using Oshima.FunGame.WebAPI.Services;
namespace Oshima.FunGame.WebAPI
{
- public class OshimaWebAPI : WebAPIPlugin
+ public class OshimaWebAPI : WebAPIPlugin, ILoginEvent
{
public override string Name => OshimaGameModuleConstant.WebAPI;
@@ -64,5 +66,15 @@ namespace Oshima.FunGame.WebAPI
}
return "";
}
+
+ public void BeforeLoginEvent(object sender, LoginEventArgs e)
+ {
+ Controller.WriteLine(e.Password);
+ }
+
+ public void AfterLoginEvent(object sender, LoginEventArgs e)
+ {
+
+ }
}
}