1
0
mirror of synced 2024-11-23 22:41:01 +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
{
Result = 1,
TokenId = shopTokenId,
TokenId = shopTokenId > 0 ? (uint)shopTokenId : 1,
VerupNo = 2
};

View File

@ -42,31 +42,36 @@ public class GetTokenCountController : BaseController<GetTokenCountController>
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
{
Result = 1
};
response.AryTokenCountDatas.Add(new GetTokenCountResponse.TokenCountData
if (tokenCountDict.Count == 0) tokenCountDict.Add(1, 0);
if (shopTokenId > 0)
{
TokenCount = tokenCountDict[shopTokenId],
TokenId = shopTokenId
});
var castedShopTokenId = (uint)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],
TokenId = kaTokenId
});
var castedKaTokenId = (uint)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);
}

View File

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

View File

@ -39,7 +39,7 @@ public class GameDataService : IGameDataService
private List<uint> lockedSongsList = new();
private Dictionary<string, uint> tokenDataDictionary = new();
private Dictionary<string, int> tokenDataDictionary = new();
private readonly DataSettings settings;
@ -93,7 +93,7 @@ public class GameDataService : IGameDataService
return shopFolderDictionary;
}
public Dictionary<string, uint> GetTokenDataDictionary()
public Dictionary<string, int> GetTokenDataDictionary()
{
return tokenDataDictionary;
}
@ -143,7 +143,7 @@ public class GameDataService : IGameDataService
var movieData = await JsonSerializer.DeserializeAsync<List<MovieData>>(movieDataFile);
var eventFolderData = await JsonSerializer.DeserializeAsync<List<EventFolderData>>(eventFolderDataFile);
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);
InitializeMusicInfoes(infoesData);
@ -242,7 +242,7 @@ public class GameDataService : IGameDataService
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!");
tokenDataDictionary = tokenData;

View File

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

View File

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