Skip to content

Commit

Permalink
新增字段MaxQuestionCount
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyhhssyy committed Jun 21, 2024
1 parent 6d57cdb commit cca06d2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class Question
}

public int CurrentQuestionIndex { get; set; } = 0;
public int MaxQuestionCount { get; set; } = 10;

public List<Question> QuestionList { get; set; } = new();
public Dictionary<String, double> PlayerScore { get; set; } = new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class CypherChallengeManager(ArknightsMemoryCache memoryCache, GameManage
var game= new CypherChallengeGame();
game.GameType="CypherChallenge";

game.MaxQuestionCount = 10;
while (game.QuestionList.Count<10)
{
var randomIndex = random.Next(0, operatorIdList.Count);
Expand Down
1 change: 1 addition & 0 deletions AmiyaBotPlayerRatingServer/GameLogic/Game.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public interface IScorable
public interface ISequentialQuestionGame<TQuestion>
{
public int CurrentQuestionIndex { get; set; }
public int MaxQuestionCount { get; set; }

public List<TQuestion> QuestionList { get; set; }

Expand Down
6 changes: 2 additions & 4 deletions AmiyaBotPlayerRatingServer/GameLogic/IGameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@ public class RequestHintOrGiveUpResult
}
#pragma warning restore CS8618

public Task<Game?> CreateNewGame(Dictionary<String, object> param);

public Task<object> GetGamePayload(Game rawGame);
public Task<double> GetScore(Game game, string player);

public Task<Game?> CreateNewGame(Dictionary<String, object> param);
public Task<object> GetGameStartPayload(Game game);
public Task<double> GetScore(Game game, string player);

public Task<object> HandleMove(Game game, string playerId, string move);

public Task<RequestHintOrGiveUpResult> GiveUp(Game game, string appUserId);
public Task<RequestHintOrGiveUpResult> RequestHint(Game game, string appUserId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class Question
}

public int CurrentQuestionIndex { get; set; }
public int MaxQuestionCount { get; set; }

public List<Question> QuestionList { get; set; }

Expand Down
14 changes: 12 additions & 2 deletions AmiyaBotPlayerRatingServer/GameLogic/SkinGuess/SkinGuessManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ private SkinGuessGame GenerateRealGame()
var max = operatorIdList.Count;
var random = new Random();

while(game.QuestionList.Count<16)
game.MaxQuestionCount = 20;

while(game.QuestionList.Count< 20)
{
var rand = random.Next(0, max);
var charId = operatorIdList[rand];
Expand All @@ -75,6 +77,13 @@ private SkinGuessGame GenerateRealGame()
}

var charName = charMaps[charId];

if (charName.Contains("阿米娅"))
{
//阿米娅不参与,升变太烦人了
continue;
}

var skinList = (skinUrls[charId] as JObject)?.Properties().Select(p=>p.Value).ToList();

if (skinList==null||skinList.Count <= 1)
Expand Down Expand Up @@ -103,7 +112,7 @@ private SkinGuessGame GenerateRealGame()

private bool IsOperatorName(string name)
{
var charDataJson = arknightsMemoryCache.GetJson("character_names.json")?.ToObject<Dictionary<String,String>>();
var charDataJson = arknightsMemoryCache.GetJson("character_names.json")?.ToObject<Dictionary<String, String>>();
if (charDataJson == null)
{
//ERROR
Expand Down Expand Up @@ -152,6 +161,7 @@ private object FormatGame(SkinGuessGame game)

QuestionList = questionList,
CurrentQuestionIndex = game.CurrentQuestionIndex,
MaxQuestionCount = game.MaxQuestionCount,
};
}

Expand Down

0 comments on commit cca06d2

Please sign in to comment.