Gacha Model bugfix: post_configure on creating

This commit is contained in:
YYHEggEgg 2024-07-31 00:37:13 +08:00
parent 55780314d1
commit 157832198c
2 changed files with 15 additions and 1 deletions

View file

@ -7,11 +7,19 @@ use rand::{thread_rng, Rng};
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::hash::{BuildHasher, Hash}; use std::hash::{BuildHasher, Hash};
#[derive(Default)]
pub struct GachaModel { pub struct GachaModel {
pub gacha_bin: GachaModelBin, pub gacha_bin: GachaModelBin,
} }
impl Default for GachaModel {
fn default() -> GachaModel {
let result = GachaModel {
gacha_bin: GachaModelBin::default(),
};
result.post_deserialize()
}
}
impl GachaModel { impl GachaModel {
pub fn from_bin(gacha_bin: GachaModelBin) -> Self { pub fn from_bin(gacha_bin: GachaModelBin) -> Self {
let result = Self { gacha_bin }; let result = Self { gacha_bin };

View file

@ -62,6 +62,12 @@ impl Player {
.add_resource(ItemStatic::FrontendGold as u32, 1_000_000); .add_resource(ItemStatic::FrontendGold as u32, 1_000_000);
self.item_model self.item_model
.add_resource(ItemStatic::GameDiamond as u32, 1_000_000); .add_resource(ItemStatic::GameDiamond as u32, 1_000_000);
self.item_model
.add_resource(ItemStatic::GachaTicketEvent as u32, 30_000);
self.item_model
.add_resource(ItemStatic::GachaTicketStandard as u32, 30_000);
self.item_model
.add_resource(ItemStatic::GachaTicketBangboo as u32, 30_000);
self.item_model.add_resource(ItemStatic::Energy as u32, 240); self.item_model.add_resource(ItemStatic::Energy as u32, 240);
} }