Teleport Map & Switching Dynamic Wallpaper Support, Gacha optimization #2

Merged
xeon merged 4 commits from YYHEggEgg/JaneDoe-ZS:master into master 2024-08-06 17:15:05 +00:00
2 changed files with 16 additions and 13 deletions
Showing only changes of commit 436e691245 - Show all commits

View file

@ -2,7 +2,7 @@ use crate::logic::{EOperator, ESystem};
use super::*;
use data::tables::{self, QuickAccessID};
use data::tables::{self, QuickFuncID};
pub async fn on_get_tips_info(
_session: &NetSession,
@ -205,13 +205,13 @@ pub async fn on_mod_quick_menu(
quick_access_data_list.push(
_player
.lock_model
.mod_quick_access(data.quick_access_index, QuickAccessID::new(data.btn_id)),
.mod_quick_access(data.quick_access_index, QuickFuncID::new(data.btn_id)),
);
}
_session
.notify(PlayerSyncScNotify {
client_systems_sync: Some(ClientSystemsSync {
quick_access_data_list,
quick_access_data_list: _player.lock_model.quick_access_to_client(),
..Default::default()
}),
..Default::default()

View file

@ -1,12 +1,12 @@
use std::collections::{BTreeSet, HashMap};
use data::tables::{quick_access_template_tb, QuickAccessID, UnlockConfigID};
use data::tables::{quick_access_template_tb, QuickFuncID, UnlockConfigID};
use proto::{LockModelBin, QuickAccessData, QuickAccessType, UnlockData};
#[derive(Default)]
pub struct LockModel {
unlock_list: BTreeSet<UnlockConfigID>,
quick_access_list: HashMap<u32, QuickAccessID>,
quick_access_list: HashMap<u32, QuickFuncID>,
}
impl LockModel {
@ -20,7 +20,7 @@ impl LockModel {
quick_access_list: bin
.quick_access_list
.into_iter()
.map(|(k, v)| (k, QuickAccessID::new_unchecked(v)))
.map(|(k, v)| (k, QuickFuncID::new_unchecked(v)))
.collect(),
}
}
@ -35,14 +35,13 @@ impl LockModel {
.collect(),
quick_access_list: self
.quick_access_list
.clone()
.into_iter()
.map(|(k, v)| (k, v.value()))
.iter()
.map(|(k, v)| (k.clone(), v.value()))
.collect(),
}
}
pub fn to_client(&self) -> UnlockData {
pub fn quick_access_to_client(&self) -> Vec<QuickAccessData> {
let mut quick_access_data_list: Vec<QuickAccessData> = vec![];
for quick_access in quick_access_template_tb::iter() {
quick_access_data_list.push(QuickAccessData {
@ -51,7 +50,7 @@ impl LockModel {
btn_id: quick_access.quick_func_id.value(),
});
}
for quick_access_index in 1..7 {
for quick_access_index in 1..8 {
let mut btn_id = 0;
if let Some(id) = self.quick_access_list.get(&quick_access_index) {
btn_id = id.value();
@ -62,6 +61,10 @@ impl LockModel {
btn_id,
});
}
quick_access_data_list
}
pub fn to_client(&self) -> UnlockData {
UnlockData {
unlock_id_list: self
@ -70,7 +73,7 @@ impl LockModel {
.into_iter()
.map(|i| i.value())
.collect(),
quick_access_data_list,
quick_access_data_list: self.quick_access_to_client(),
..Default::default()
}
}
@ -83,7 +86,7 @@ impl LockModel {
self.unlock_list.contains(&id)
}
pub fn mod_quick_access(&mut self, index: u32, id: Option<QuickAccessID>) -> QuickAccessData {
pub fn mod_quick_access(&mut self, index: u32, id: Option<QuickFuncID>) -> QuickAccessData {
let btn_id = match id {
Some(quick_access_id) => {
if self.quick_access_list.contains_key(&index) {