forked from NewEriduPubSec/JaneDoe-ZS
use newtypes for template ids, pros: 1) enforces id validation 2) ease of use (helper method for getting template struct right away)
42 lines
1 KiB
Rust
42 lines
1 KiB
Rust
use data::tables::ProcedureConfigID;
|
|
use proto::{DungeonInfo, FreshSceneInfo, SceneInfo};
|
|
|
|
use crate::logic::{procedure::ProcedureManager, ESceneType};
|
|
|
|
use super::NapGameMode;
|
|
|
|
pub struct FreshGame {
|
|
pub procedure_mgr: ProcedureManager,
|
|
}
|
|
|
|
impl FreshGame {
|
|
pub fn new(start_procedure_id: ProcedureConfigID) -> Self {
|
|
Self {
|
|
procedure_mgr: ProcedureManager::new(start_procedure_id),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl NapGameMode for FreshGame {
|
|
fn scene_type(&self) -> ESceneType {
|
|
ESceneType::Fresh
|
|
}
|
|
|
|
fn scene_info(&self) -> Option<SceneInfo> {
|
|
Some(SceneInfo {
|
|
scene_type: self.scene_type() as u32,
|
|
fresh_scene_info: Some(FreshSceneInfo {
|
|
beginner_procedure_id: self
|
|
.procedure_mgr
|
|
.procedure_id()
|
|
.map(|i| i.value() - 1)
|
|
.unwrap_or(0),
|
|
}),
|
|
..Default::default()
|
|
})
|
|
}
|
|
|
|
fn dungeon_info(&self) -> Option<DungeonInfo> {
|
|
None
|
|
}
|
|
}
|