-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
144 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,21 @@ | ||
using Nekoyume.Model.Arena; | ||
using Newtonsoft.Json; | ||
using NineChroniclesUtilBackend.Store.Util; | ||
using Nekoyume.TableData; | ||
using Libplanet.Crypto; | ||
|
||
namespace NineChroniclesUtilBackend.Store.Models; | ||
|
||
public class ArenaData | ||
public class ArenaData : BaseData | ||
{ | ||
public ArenaScore Score { get; } | ||
public ArenaInformation Information { get; } | ||
public ArenaSheet.RoundData RoundData { get; } | ||
public Address AvatarAddress { get; } | ||
|
||
public ArenaData(ArenaScore score, ArenaInformation information) | ||
public ArenaData(ArenaScore score, ArenaInformation information, ArenaSheet.RoundData roundData, Address avatarAddress) | ||
{ | ||
Score = score; | ||
Information = information; | ||
} | ||
|
||
public string ToJson() | ||
{ | ||
var settings = new JsonSerializerSettings | ||
{ | ||
Converters = new[] { new BigIntegerToStringConverter() }, | ||
Formatting = Formatting.Indented | ||
}; | ||
|
||
string jsonString = JsonConvert.SerializeObject(this, settings); | ||
return jsonString; | ||
RoundData = roundData; | ||
AvatarAddress = avatarAddress; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Newtonsoft.Json; | ||
using NineChroniclesUtilBackend.Store.Util; | ||
|
||
namespace NineChroniclesUtilBackend.Store.Models; | ||
|
||
public class BaseData | ||
{ | ||
protected static JsonSerializerSettings JsonSerializerSettings => new JsonSerializerSettings | ||
{ | ||
Converters = new[] { new BigIntegerToStringConverter() }, | ||
Formatting = Formatting.Indented, | ||
// ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver(), | ||
NullValueHandling = NullValueHandling.Ignore | ||
}; | ||
|
||
public string ToJson() | ||
{ | ||
return JsonConvert.SerializeObject(this, JsonSerializerSettings); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters