mirror of
https://github.com/milimoe/FunGame-Testing.git
synced 2025-04-20 19:29:34 +08:00
测试
This commit is contained in:
parent
a9f01b22bb
commit
ebe8efa8a6
@ -1,14 +1,14 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Milimoe.FunGame.Core.Api.Utility;
|
||||
using Oshima.FunGame.WebAPI.Controllers;
|
||||
using Oshima.FunGame.OshimaModules;
|
||||
using Oshima.FunGame.OshimaServers.Service;
|
||||
using Oshima.FunGame.WebAPI.Controllers;
|
||||
|
||||
_ = new Milimoe.FunGame.Testing.Tests.CheckDLL();
|
||||
//_ = new Milimoe.FunGame.Testing.Tests.CheckDLL();
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
_ = new Milimoe.FunGame.Testing.Tests.WebSocketTest();
|
||||
//_ = new Milimoe.FunGame.Testing.Tests.WebSocketTest();
|
||||
|
||||
CharacterModule cm = new();
|
||||
cm.Load();
|
||||
@ -67,7 +67,7 @@ FunGameController controller = new(new Logger<FunGameController>(new LoggerFacto
|
||||
|
||||
//Console.WriteLine(user.Inventory.Characters.First().GetInfo(showEXP: true));
|
||||
|
||||
Console.WriteLine(string.Join("", controller.FightCustom(1, 2, true)));
|
||||
//Console.WriteLine(string.Join("", controller.FightCustom(1, 2, true)));
|
||||
|
||||
//FunGameActionQueue.StartSimulationGame(true, true, true, true);
|
||||
//foreach (string str in controller.GetTest(false, true))
|
||||
|
@ -3,6 +3,21 @@ using Milimoe.FunGame.Core.Library.Constant;
|
||||
|
||||
namespace Milimoe.FunGame.Testing.Solutions
|
||||
{
|
||||
public enum ActivityState
|
||||
{
|
||||
Future,
|
||||
Upcoming,
|
||||
InProgress,
|
||||
Ended
|
||||
}
|
||||
|
||||
public enum RedeemResult
|
||||
{
|
||||
Success,
|
||||
StockNotEnough,
|
||||
PointsNotEnough
|
||||
}
|
||||
|
||||
public class Activity(long id, string name, DateTime startTime, DateTime endTime)
|
||||
{
|
||||
public long Id { get; set; } = id;
|
||||
@ -14,7 +29,6 @@ namespace Milimoe.FunGame.Testing.Solutions
|
||||
public Store Store { get; set; } = new Store();
|
||||
|
||||
// 事件
|
||||
public event EventHandler<ActivityStateChangedEventArgs>? ActivityStateChanged;
|
||||
public event EventHandler<UserAccessEventArgs>? UserAccessCheck;
|
||||
|
||||
public void UpdateState()
|
||||
@ -42,15 +56,9 @@ namespace Milimoe.FunGame.Testing.Solutions
|
||||
if (State != newState)
|
||||
{
|
||||
State = newState;
|
||||
OnActivityStateChanged(new ActivityStateChangedEventArgs(State));
|
||||
}
|
||||
}
|
||||
|
||||
protected virtual void OnActivityStateChanged(ActivityStateChangedEventArgs e)
|
||||
{
|
||||
ActivityStateChanged?.Invoke(this, e);
|
||||
}
|
||||
|
||||
public bool AllowUserAccess(long userId)
|
||||
{
|
||||
UserAccessEventArgs args = new(userId, State, StartTime, EndTime);
|
||||
@ -74,16 +82,11 @@ namespace Milimoe.FunGame.Testing.Solutions
|
||||
if (quest != null)
|
||||
{
|
||||
quest.Status = newStatus;
|
||||
// 可选:触发任务状态更新事件
|
||||
Console.WriteLine($"活动状态已改变为:{newStatus}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ActivityStateChangedEventArgs(ActivityState newState) : EventArgs
|
||||
{
|
||||
public ActivityState NewState { get; } = newState;
|
||||
}
|
||||
|
||||
public class UserAccessEventArgs(long userId, ActivityState activityState, DateTime startTime, DateTime endTime) : EventArgs
|
||||
{
|
||||
public long UserId { get; } = userId;
|
||||
|
@ -2,6 +2,8 @@
|
||||
using Milimoe.FunGame.Core.Entity;
|
||||
using Milimoe.FunGame.Core.Library.Constant;
|
||||
using Milimoe.FunGame.Testing.Solutions;
|
||||
using ActivityState = Milimoe.FunGame.Testing.Solutions.ActivityState;
|
||||
using RedeemResult = Milimoe.FunGame.Testing.Solutions.RedeemResult;
|
||||
|
||||
namespace Milimoe.FunGame.Testing.Tests
|
||||
{
|
||||
@ -56,12 +58,6 @@ namespace Milimoe.FunGame.Testing.Tests
|
||||
activity.Store.AddItem(item1, 100, 10);
|
||||
activity.Store.AddItem(item2, 200, 10);
|
||||
|
||||
// 订阅活动状态改变事件
|
||||
activity.ActivityStateChanged += (sender, e) =>
|
||||
{
|
||||
Console.WriteLine($"活动状态已改变为:{e.NewState}");
|
||||
};
|
||||
|
||||
// 订阅用户访问检查事件
|
||||
activity.UserAccessCheck += (sender, e) =>
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user