update
This commit is contained in:
@@ -4,6 +4,7 @@ import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
import { GButton } from "db://assets/Scripts/Main/Common/GButton";
|
||||
import { NavigationManager, PanelType } from "../../manager/NavigationManager";
|
||||
import { NavigationBtn } from "../items/NavigationBtn";
|
||||
import { ChatHistoryManager } from "../../manager/ChatHistoryManager";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -65,6 +66,14 @@ export class NavigationPanel extends li_BaseView {
|
||||
() => NavigationManager.Instance.switchToPanel(PanelType.PERSONAL),
|
||||
this
|
||||
);
|
||||
|
||||
GButton.BandClick(
|
||||
this._nodeTab.CleanHistoryBtn,
|
||||
() => {
|
||||
ChatHistoryManager.Instance.clearAllHistory();
|
||||
},
|
||||
this
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -73,8 +82,6 @@ export class NavigationPanel extends li_BaseView {
|
||||
*/
|
||||
public updateButtonStates(activePanel: PanelType) {
|
||||
this.currentActivePanel = activePanel;
|
||||
this._nodeTab.CurrentPanel.getComponent(Label).string =
|
||||
this.currentActivePanel;
|
||||
|
||||
this.refreshButtonVisuals();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ export class SettingPanel extends li_BaseView {
|
||||
onEnable() {
|
||||
this.currentSelectedLang = LanguageUtils.CurrentLanguage;
|
||||
this.updateSelection();
|
||||
this.updateAudioButtonStates();
|
||||
|
||||
this.playEnterAnimation();
|
||||
}
|
||||
@@ -89,12 +90,7 @@ export class SettingPanel extends li_BaseView {
|
||||
this.sound_on = this._nodeTab.SoundBtn.getChildByName("On");
|
||||
this.sound_off = this._nodeTab.SoundBtn.getChildByName("Off");
|
||||
|
||||
let currentState = PlayerDataManager.I.IsSoundOn;
|
||||
this.sound_on.active = currentState;
|
||||
this.sound_off.active = !currentState;
|
||||
currentState = PlayerDataManager.I.IsMusicOn;
|
||||
this.music_on.active = currentState;
|
||||
this.music_off.active = !currentState;
|
||||
this.updateAudioButtonStates();
|
||||
}
|
||||
|
||||
private initLanguageButton(
|
||||
@@ -143,6 +139,17 @@ export class SettingPanel extends li_BaseView {
|
||||
language,
|
||||
});
|
||||
}
|
||||
|
||||
private updateAudioButtonStates() {
|
||||
const soundState = PlayerDataManager.I.IsSoundOn;
|
||||
this.sound_on.active = soundState;
|
||||
this.sound_off.active = !soundState;
|
||||
|
||||
const musicState = PlayerDataManager.I.IsMusicOn;
|
||||
this.music_on.active = musicState;
|
||||
this.music_off.active = !musicState;
|
||||
}
|
||||
|
||||
registerListener() {
|
||||
GButton.BandClick(this._nodeTab.MusicBtn, this.switchMusic, this);
|
||||
GButton.BandClick(this._nodeTab.SoundBtn, this.switchSound, this);
|
||||
@@ -171,16 +178,14 @@ export class SettingPanel extends li_BaseView {
|
||||
}
|
||||
switchSound() {
|
||||
const currentState = PlayerDataManager.I.IsSoundOn;
|
||||
this.sound_on.active = currentState;
|
||||
this.sound_off.active = !currentState;
|
||||
PlayerDataManager.I.SetSoundOn(!currentState);
|
||||
this.updateAudioButtonStates();
|
||||
}
|
||||
|
||||
switchMusic() {
|
||||
const currentState = PlayerDataManager.I.IsMusicOn;
|
||||
this.music_on.active = currentState;
|
||||
this.music_off.active = !currentState;
|
||||
PlayerDataManager.I.SetMusicOn(!currentState);
|
||||
this.updateAudioButtonStates();
|
||||
}
|
||||
|
||||
isShow: boolean = false;
|
||||
|
||||
Reference in New Issue
Block a user