Implement MainCityBgmConfigTemplate
This commit is contained in:
parent
26fe9551d4
commit
7d7bd76ae8
4 changed files with 51 additions and 2 deletions
32
assets/FileCfg/MainCityBgmConfigTemplateTb.json
Normal file
32
assets/FileCfg/MainCityBgmConfigTemplateTb.json
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"ID": 0,
|
||||||
|
"PlayEventName": "Play_BGM_Maincity",
|
||||||
|
"StateName": "Normal"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 1001,
|
||||||
|
"PlayEventName": "Play_BGM_Maincity",
|
||||||
|
"StateName": "Hack_Maincity"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 1002,
|
||||||
|
"PlayEventName": "Play_BGM_Maincity",
|
||||||
|
"StateName": "WorkShop_OnMission"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 1003,
|
||||||
|
"PlayEventName": "Play_BGM_Maincity",
|
||||||
|
"StateName": "SummerActivity_Ready"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 1004,
|
||||||
|
"PlayEventName": "Play_BGM_Maincity",
|
||||||
|
"StateName": "SummerActivity_Start"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ID": 1005,
|
||||||
|
"PlayEventName": "Play_BGM_Maincity",
|
||||||
|
"StateName": "Mission_Accomplish"
|
||||||
|
}
|
||||||
|
]
|
12
nap_data/src/tables/main_city_bgm_config_template.rs
Normal file
12
nap_data/src/tables/main_city_bgm_config_template.rs
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
use serde::Deserialize;
|
||||||
|
|
||||||
|
template_id!(MainCityBgmConfig u32 id);
|
||||||
|
|
||||||
|
#[derive(Deserialize, Debug)]
|
||||||
|
#[serde(rename_all = "PascalCase")]
|
||||||
|
pub struct MainCityBgmConfigTemplate {
|
||||||
|
#[serde(rename = "ID")]
|
||||||
|
pub id: MainCityBgmConfigID,
|
||||||
|
pub play_event_name: String,
|
||||||
|
pub state_name: String,
|
||||||
|
}
|
|
@ -84,6 +84,7 @@ template_tables! {
|
||||||
WeaponTemplate;
|
WeaponTemplate;
|
||||||
MainCityObjectTemplate;
|
MainCityObjectTemplate;
|
||||||
MainCityDefaultObjectTemplate;
|
MainCityDefaultObjectTemplate;
|
||||||
|
MainCityBgmConfigTemplate;
|
||||||
ArchiveFileQuestTemplate;
|
ArchiveFileQuestTemplate;
|
||||||
ArchiveBattleQuestTemplate;
|
ArchiveBattleQuestTemplate;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
use data::tables::{AvatarBaseID, SectionConfigID};
|
use data::tables::{AvatarBaseID, MainCityBgmConfigID, SectionConfigID};
|
||||||
use proto::*;
|
use proto::*;
|
||||||
use thiserror::Error;
|
use thiserror::Error;
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ use super::NapGameMode;
|
||||||
pub struct FrontendGame {
|
pub struct FrontendGame {
|
||||||
section_id: SectionConfigID,
|
section_id: SectionConfigID,
|
||||||
frontend_avatar_id: AvatarBaseID,
|
frontend_avatar_id: AvatarBaseID,
|
||||||
|
main_city_bgm: MainCityBgmConfigID,
|
||||||
scene_unit_mgr: SceneUnitManager,
|
scene_unit_mgr: SceneUnitManager,
|
||||||
camera_x: u32,
|
camera_x: u32,
|
||||||
camera_y: u32,
|
camera_y: u32,
|
||||||
|
@ -30,6 +31,8 @@ pub enum FrontendGameError {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FrontendGame {
|
impl FrontendGame {
|
||||||
|
const DEFAULT_BGM_ID: u32 = 1005;
|
||||||
|
|
||||||
pub fn new(
|
pub fn new(
|
||||||
section_id: SectionConfigID,
|
section_id: SectionConfigID,
|
||||||
avatar_id: AvatarBaseID,
|
avatar_id: AvatarBaseID,
|
||||||
|
@ -40,6 +43,7 @@ impl FrontendGame {
|
||||||
let instance = Self {
|
let instance = Self {
|
||||||
section_id,
|
section_id,
|
||||||
main_city_time,
|
main_city_time,
|
||||||
|
main_city_bgm: MainCityBgmConfigID::new_unchecked(Self::DEFAULT_BGM_ID),
|
||||||
scene_unit_mgr: SceneUnitManager::new(section_id),
|
scene_unit_mgr: SceneUnitManager::new(section_id),
|
||||||
frontend_avatar_id: avatar_id,
|
frontend_avatar_id: avatar_id,
|
||||||
camera_x: 0xFFFFFFFF,
|
camera_x: 0xFFFFFFFF,
|
||||||
|
@ -63,9 +67,9 @@ impl NapGameMode for FrontendGame {
|
||||||
Some(SceneInfo {
|
Some(SceneInfo {
|
||||||
scene_type: self.scene_type() as u32,
|
scene_type: self.scene_type() as u32,
|
||||||
hall_scene_info: Some(HallSceneInfo {
|
hall_scene_info: Some(HallSceneInfo {
|
||||||
main_city_bgm_id: 1005,
|
|
||||||
section_id: self.section_id.value(),
|
section_id: self.section_id.value(),
|
||||||
frontend_avatar_id: self.frontend_avatar_id.value(),
|
frontend_avatar_id: self.frontend_avatar_id.value(),
|
||||||
|
main_city_bgm_id: self.main_city_bgm.value(),
|
||||||
camera_x: self.camera_x,
|
camera_x: self.camera_x,
|
||||||
camera_y: self.camera_y,
|
camera_y: self.camera_y,
|
||||||
transform: self
|
transform: self
|
||||||
|
|
Loading…
Reference in a new issue