1
0
mirror of synced 2024-11-27 16:10:53 +01:00

Implemented turning off shopToken and kaToken, default token_data.json to both tokens turned off

This commit is contained in:
S-Sebb?? 2023-09-17 01:17:44 +08:00
parent fadbed54ae
commit c7c380fa0a
6 changed files with 32 additions and 28 deletions

View File

@ -24,7 +24,7 @@ public class GetShopFolderController : BaseController<GetShopFolderController>
var response = new GetShopFolderResponse var response = new GetShopFolderResponse
{ {
Result = 1, Result = 1,
TokenId = shopTokenId, TokenId = shopTokenId > 0 ? (uint)shopTokenId : 1,
VerupNo = 2 VerupNo = 2
}; };

View File

@ -41,32 +41,37 @@ public class GetTokenCountController : BaseController<GetTokenCountController>
} }
tokenCountDict.ThrowIfNull("TokenCountDict should never be null"); tokenCountDict.ThrowIfNull("TokenCountDict should never be null");
if (tokenCountDict.Count == 0) tokenCountDict.Add(shopTokenId, 0);
tokenCountDict.TryAdd(shopTokenId, 0);
tokenCountDict.TryAdd(kaTokenId, 0);
user.TokenCountDict = JsonSerializer.Serialize(tokenCountDict);
await userDatumService.UpdateUserDatum(user);
var response = new GetTokenCountResponse var response = new GetTokenCountResponse
{ {
Result = 1 Result = 1
}; };
response.AryTokenCountDatas.Add(new GetTokenCountResponse.TokenCountData if (tokenCountDict.Count == 0) tokenCountDict.Add(1, 0);
if (shopTokenId > 0)
{ {
TokenCount = tokenCountDict[shopTokenId], var castedShopTokenId = (uint)shopTokenId;
TokenId = shopTokenId tokenCountDict.TryAdd(castedShopTokenId, 0);
}); response.AryTokenCountDatas.Add(new GetTokenCountResponse.TokenCountData
{
TokenCount = tokenCountDict[castedShopTokenId],
TokenId = castedShopTokenId
});
}
response.AryTokenCountDatas.Add(new GetTokenCountResponse.TokenCountData if (kaTokenId > 0)
{ {
TokenCount = tokenCountDict[kaTokenId], var castedKaTokenId = (uint)kaTokenId;
TokenId = kaTokenId tokenCountDict.TryAdd(castedKaTokenId, 0);
}); response.AryTokenCountDatas.Add(new GetTokenCountResponse.TokenCountData
{
TokenCount = tokenCountDict[castedKaTokenId],
TokenId = castedKaTokenId
});
}
user.TokenCountDict = JsonSerializer.Serialize(tokenCountDict);
await userDatumService.UpdateUserDatum(user);
return Ok(response); return Ok(response);
} }

View File

@ -125,8 +125,7 @@ public class UserDataController : BaseController<UserDataController>
IsVoiceOn = userData.IsVoiceOn, IsVoiceOn = userData.IsVoiceOn,
IsSkipOn = userData.IsSkipOn, IsSkipOn = userData.IsSkipOn,
IsChallengecompe = false, IsChallengecompe = false,
SongRecentCnt = (uint)recentSongs.Length, SongRecentCnt = (uint)recentSongs.Length
TotalCreditCnt = 0
}; };
return Ok(response); return Ok(response);

View File

@ -39,7 +39,7 @@ public class GameDataService : IGameDataService
private List<uint> lockedSongsList = new(); private List<uint> lockedSongsList = new();
private Dictionary<string, uint> tokenDataDictionary = new(); private Dictionary<string, int> tokenDataDictionary = new();
private readonly DataSettings settings; private readonly DataSettings settings;
@ -93,7 +93,7 @@ public class GameDataService : IGameDataService
return shopFolderDictionary; return shopFolderDictionary;
} }
public Dictionary<string, uint> GetTokenDataDictionary() public Dictionary<string, int> GetTokenDataDictionary()
{ {
return tokenDataDictionary; return tokenDataDictionary;
} }
@ -143,7 +143,7 @@ public class GameDataService : IGameDataService
var movieData = await JsonSerializer.DeserializeAsync<List<MovieData>>(movieDataFile); var movieData = await JsonSerializer.DeserializeAsync<List<MovieData>>(movieDataFile);
var eventFolderData = await JsonSerializer.DeserializeAsync<List<EventFolderData>>(eventFolderDataFile); var eventFolderData = await JsonSerializer.DeserializeAsync<List<EventFolderData>>(eventFolderDataFile);
var shopFolderData = await JsonSerializer.DeserializeAsync<List<ShopFolderData>>(shopFolderDataFile); var shopFolderData = await JsonSerializer.DeserializeAsync<List<ShopFolderData>>(shopFolderDataFile);
var tokenData = await JsonSerializer.DeserializeAsync<Dictionary<string, uint>>(tokenDataFile); var tokenData = await JsonSerializer.DeserializeAsync<Dictionary<string, int>>(tokenDataFile);
var lockedSongsData = await JsonSerializer.DeserializeAsync<Dictionary<string, uint[]>>(lockedSongsDataFile); var lockedSongsData = await JsonSerializer.DeserializeAsync<Dictionary<string, uint[]>>(lockedSongsDataFile);
InitializeMusicInfoes(infoesData); InitializeMusicInfoes(infoesData);
@ -242,7 +242,7 @@ public class GameDataService : IGameDataService
shopFolderDictionary = shopFolderData.ToImmutableDictionary(data => data.SongNo, ToResponseShopFolderData); shopFolderDictionary = shopFolderData.ToImmutableDictionary(data => data.SongNo, ToResponseShopFolderData);
} }
private void InitializeTokenData(Dictionary<string, uint>? tokenData) private void InitializeTokenData(Dictionary<string, int>? tokenData)
{ {
tokenData.ThrowIfNull("Shouldn't happen!"); tokenData.ThrowIfNull("Shouldn't happen!");
tokenDataDictionary = tokenData; tokenDataDictionary = tokenData;

View File

@ -24,7 +24,7 @@ public interface IGameDataService
public ImmutableDictionary<uint, GetShopFolderResponse.ShopFolderData> GetShopFolderDictionary(); public ImmutableDictionary<uint, GetShopFolderResponse.ShopFolderData> GetShopFolderDictionary();
public Dictionary<string, uint> GetTokenDataDictionary(); public Dictionary<string, int> GetTokenDataDictionary();
public List<uint> GetLockedSongsList(); public List<uint> GetLockedSongsList();
} }

View File

@ -1,4 +1,4 @@
{ {
"shopTokenId": 4, "shopTokenId": -1,
"kaTokenId": 1000 "kaTokenId": -1
} }