mirror of
https://github.com/oshima-studios/OshimaGameModule.git
synced 2026-04-20 05:25:01 +00:00
删除无用异步代码
This commit is contained in:
parent
16a0d48dd5
commit
8438dbf495
@ -53,28 +53,40 @@ namespace Oshima.FunGame.OshimaModules.Regions
|
||||
builder.AppendLine($"温度:{Temperature} ℃");
|
||||
builder.AppendLine($"{Description}");
|
||||
|
||||
if (Areas.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== 区域 ==");
|
||||
builder.AppendLine(string.Join("、", Areas));
|
||||
}
|
||||
|
||||
if (Characters.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== 头目 ==");
|
||||
builder.AppendLine(string.Join(",", Characters.Select(c => c.Name)));
|
||||
builder.AppendLine(string.Join("、", Characters.Select(c => c.Name)));
|
||||
}
|
||||
|
||||
if (Units.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== 生物 ==");
|
||||
builder.AppendLine(string.Join(",", Units.Select(u => u.Name)));
|
||||
builder.AppendLine(string.Join("、", Units.Select(u => u.Name)));
|
||||
}
|
||||
|
||||
if (Crops.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== 作物 ==");
|
||||
builder.AppendLine(string.Join(",", Crops.Select(i => i.Name + ":" + i.Description + "\"" + i.BackgroundStory + "\"")));
|
||||
builder.AppendLine(string.Join("、", Crops.Select(i => i.Name + ":" + i.Description + "\"" + i.BackgroundStory + "\"")));
|
||||
}
|
||||
|
||||
if (NPCs.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== NPC ==");
|
||||
builder.AppendLine(string.Join("、", NPCs));
|
||||
}
|
||||
|
||||
if (Items.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== 掉落 ==");
|
||||
builder.AppendLine(string.Join(",", Items.Select(i =>
|
||||
builder.AppendLine(string.Join("、", Items.Select(i =>
|
||||
{
|
||||
string itemquality = ItemSet.GetQualityTypeName(i.QualityType);
|
||||
string itemtype = ItemSet.GetItemTypeName(i.ItemType) + (i.ItemType == ItemType.Weapon && i.WeaponType != WeaponType.None ? "-" + ItemSet.GetWeaponTypeName(i.WeaponType) : "");
|
||||
@ -83,6 +95,13 @@ namespace Oshima.FunGame.OshimaModules.Regions
|
||||
})));
|
||||
}
|
||||
|
||||
Dictionary<string, QuestExploration> quests = ContinuousQuestList.Union(ImmediateQuestList).Union(ProgressiveQuestList).ToDictionary();
|
||||
if (quests.Count > 0)
|
||||
{
|
||||
builder.AppendLine($"== 任务 ==");
|
||||
builder.AppendLine(string.Join("、", quests.Select(q => $"{q.Key}:{q.Value.Description}")));
|
||||
}
|
||||
|
||||
builder.AppendLine($"探索难度:{CharacterSet.GetRarityTypeName(Difficulty)}");
|
||||
|
||||
return builder.ToString().Trim();
|
||||
|
||||
@ -122,8 +122,8 @@ namespace Oshima.FunGame.OshimaServers.Model
|
||||
// 开始战斗
|
||||
Team team1 = new($"房间{room.Roomid}", characters.Values);
|
||||
Team team2 = new($"{region.Name}", enemys);
|
||||
FunGameActionQueue actionQueue = new();
|
||||
List<string> gameMsgs = await actionQueue.StartTeamGame([team1, team2], showAllRound: true);
|
||||
FunGameActionQueue actionQueue = await FunGameActionQueue.NewAndStartTeamGame([team1, team2], showAllRound: true);
|
||||
List<string> gameMsgs = actionQueue.Result;
|
||||
if (gameMsgs.Count > 15)
|
||||
{
|
||||
gameMsgs = gameMsgs[^15..];
|
||||
|
||||
@ -16,7 +16,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
|
||||
private string _msg = "";
|
||||
|
||||
public async Task<List<string>> StartGame(List<Character> characters, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
public List<string> StartGame(List<Character> characters, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
{
|
||||
Result.Clear();
|
||||
PrintOut = printout;
|
||||
@ -229,7 +229,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<List<string>> StartTeamGame(List<Team> teams, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
public List<string> StartTeamGame(List<Team> teams, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
{
|
||||
Result.Clear();
|
||||
PrintOut = printout;
|
||||
@ -426,14 +426,18 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
if (PrintOut) Console.WriteLine(str);
|
||||
}
|
||||
|
||||
public static async Task<List<string>> NewAndStartGame(List<Character> characters, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
public static async Task<FunGameActionQueue> NewAndStartGame(List<Character> characters, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
{
|
||||
return await new FunGameActionQueue().StartGame(characters, maxRespawnTimes, maxScoreToWin, printout, isWeb, deathMatchRoundDetail, showRoundEndDetail, showAllRound);
|
||||
FunGameActionQueue actionQueue = new();
|
||||
await Task.Run(() => actionQueue.StartGame(characters, maxRespawnTimes, maxScoreToWin, printout, isWeb, deathMatchRoundDetail, showRoundEndDetail, showAllRound));
|
||||
return actionQueue;
|
||||
}
|
||||
|
||||
public static async Task<List<string>> NewAndStartTeamGame(List<Team> teams, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
public static async Task<FunGameActionQueue> NewAndStartTeamGame(List<Team> teams, int maxRespawnTimes = 0, int maxScoreToWin = 0, bool printout = false, bool isWeb = false, bool deathMatchRoundDetail = false, bool showRoundEndDetail = false, bool showAllRound = false)
|
||||
{
|
||||
return await new FunGameActionQueue().StartTeamGame(teams, maxRespawnTimes, maxScoreToWin, printout, isWeb, deathMatchRoundDetail, showRoundEndDetail, showAllRound);
|
||||
FunGameActionQueue actionQueue = new();
|
||||
await Task.Run(() => actionQueue.StartTeamGame(teams, maxRespawnTimes, maxScoreToWin, printout, isWeb, deathMatchRoundDetail, showRoundEndDetail, showAllRound));
|
||||
return actionQueue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1785,7 +1785,7 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
CharacterStatistics[]? teammateStats = null;
|
||||
if (isTeam)
|
||||
{
|
||||
team = teams.Where(t => t.IsOnThisTeam(character)).FirstOrDefault();
|
||||
team = teams.FirstOrDefault(t => t.IsOnThisTeam(character));
|
||||
if (team != null)
|
||||
{
|
||||
teammateStats = [.. statistics.Where(kv => team.Members.Contains(kv.Key)).Select(kv => kv.Value)];
|
||||
@ -2940,8 +2940,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
// 开始战斗
|
||||
Team team1 = new($"{user.Username}的探索小队", squad);
|
||||
Team team2 = new($"{region.Name}", enemys);
|
||||
FunGameActionQueue actionQueue = new();
|
||||
List<string> msgs = await actionQueue.StartTeamGame([team1, team2], showAllRound: true);
|
||||
FunGameActionQueue actionQueue = await FunGameActionQueue.NewAndStartTeamGame([team1, team2], showAllRound: true);
|
||||
List<string> msgs = actionQueue.Result;
|
||||
if (msgs.Count > 2)
|
||||
{
|
||||
msgs = msgs[^2..];
|
||||
@ -3884,8 +3884,8 @@ namespace Oshima.FunGame.OshimaServers.Service
|
||||
_ => ""
|
||||
} + "秘境";
|
||||
Team team2 = new(team2Name, enemys);
|
||||
FunGameActionQueue actionQueue = new();
|
||||
List<string> msgs = await actionQueue.StartTeamGame([team1, team2], showAllRound: true);
|
||||
FunGameActionQueue actionQueue = await FunGameActionQueue.NewAndStartTeamGame([team1, team2], showAllRound: true);
|
||||
List<string> msgs = actionQueue.Result;
|
||||
if (msgs.Count > 2)
|
||||
{
|
||||
msgs = msgs[^2..];
|
||||
|
||||
@ -2095,7 +2095,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
{
|
||||
user1.Inventory.MainCharacter.Recovery(EP: 200);
|
||||
user2.Inventory.MainCharacter.Recovery(EP: 200);
|
||||
return await FunGameActionQueue.NewAndStartGame([user1.Inventory.MainCharacter, user2.Inventory.MainCharacter], 0, 0, false, false, false, false, showAllRound);
|
||||
return (await FunGameActionQueue.NewAndStartGame([user1.Inventory.MainCharacter, user2.Inventory.MainCharacter], 0, 0, false, false, false, false, showAllRound)).Result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2191,7 +2191,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
Team team1 = new($"{user1.Username}的小队", squad1);
|
||||
Team team2 = new($"{user2.Username}的小队" + (userid == enemyid ? "2" : ""), squad2);
|
||||
return await FunGameActionQueue.NewAndStartTeamGame([team1, team2], 0, 0, false, false, false, false, showAllRound);
|
||||
return (await FunGameActionQueue.NewAndStartTeamGame([team1, team2], 0, 0, false, false, false, false, showAllRound)).Result;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4127,7 +4127,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
}
|
||||
|
||||
Character boss2 = CharacterBuilder.Build(boss, false, true, null, FunGameConstant.AllItems, FunGameConstant.AllSkills, false);
|
||||
List<string> msgs = await FunGameActionQueue.NewAndStartGame([user.Inventory.MainCharacter, boss2], 0, 0, false, false, false, false, showAllRound);
|
||||
List<string> msgs = (await FunGameActionQueue.NewAndStartGame([user.Inventory.MainCharacter, boss2], 0, 0, false, false, false, false, showAllRound)).Result;
|
||||
|
||||
if (boss2.HP <= 0)
|
||||
{
|
||||
@ -4397,7 +4397,7 @@ namespace Oshima.FunGame.WebAPI.Controllers
|
||||
Character boss2 = CharacterBuilder.Build(boss, false, true, null, FunGameConstant.AllItems, FunGameConstant.AllSkills, false);
|
||||
Team team1 = new($"{user.Username}的小队", squad);
|
||||
Team team2 = new($"Boss", [boss2]);
|
||||
List<string> msgs = await FunGameActionQueue.NewAndStartTeamGame([team1, team2], showAllRound: showAllRound);
|
||||
List<string> msgs = (await FunGameActionQueue.NewAndStartTeamGame([team1, team2], showAllRound: showAllRound)).Result;
|
||||
|
||||
if (boss2.HP <= 0)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user