update
This commit is contained in:
@@ -40,11 +40,11 @@ export default class PlayerDataManager {
|
||||
|
||||
private InitPlayerData() {
|
||||
// this.isShakeOn = PlayerDataManager.getForKey(CommonConfig.StorageConfig.SETTING_SHAKEON, true)
|
||||
// this.isMusicOn = PlayerDataManager.getForKey(CommonConfig.StorageConfig.SETTING_MUSIC, true)
|
||||
// this.isSoundOn = PlayerDataManager.getForKey(CommonConfig.StorageConfig.SETTING_SOUND, true)
|
||||
this.isMusicOn = PlayerDataManager.getForKey(CommonConfig.StorageConfig.SETTING_MUSIC, true)
|
||||
this.isSoundOn = PlayerDataManager.getForKey(CommonConfig.StorageConfig.SETTING_SOUND, true)
|
||||
this.guideMainFinished = PlayerDataManager.getForKey(CommonConfig.StorageConfig.GUIDE_MAIN, false)
|
||||
this.guideTalkFinished = PlayerDataManager.getForKey(CommonConfig.StorageConfig.GUIDE_TALK, false)
|
||||
console.log("InitPlayerData", `guideMain=${this.guideMainFinished}, guideTalk=${this.guideTalkFinished}`)
|
||||
console.log("InitPlayerData", `music=${this.isMusicOn}, sound=${this.isSoundOn}, guideMain=${this.guideMainFinished}, guideTalk=${this.guideTalkFinished}`)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -59,6 +59,8 @@ export class ApiConfig {
|
||||
DataId.Global
|
||||
).getTimeout(), // 30秒
|
||||
};
|
||||
|
||||
//console.warn(this.config.apiKey);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -229,9 +229,6 @@ export class ChatModel {
|
||||
|
||||
roleData.dialogs.push(dialog);
|
||||
this.updateLastActiveTime(targetRoleId);
|
||||
console.log(
|
||||
`ChatModel: Dialog added for role ${targetRoleId} (isPlayer: ${isPlayer}, content length: ${content.length})`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -121,7 +121,7 @@ export class NavigationManager {
|
||||
public switchToPanel(panelType: PanelType, force: boolean = false): void {
|
||||
if (this.currentActivePanelType === panelType && !force) {
|
||||
if (panelType === PanelType.THEME) {
|
||||
this.girlListPanel.hide();
|
||||
this.girlListPanel?.hide();
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -157,9 +157,12 @@ export class NavigationManager {
|
||||
if (this.subPanelDic.has(this.currentActivePanel)) {
|
||||
//如果有子页面,关闭掉
|
||||
let subs = this.subPanelDic.get(this.currentActivePanel);
|
||||
subs.forEach((n) => {
|
||||
n.getComponent(li_BaseView).close();
|
||||
});
|
||||
if (subs) {
|
||||
subs.forEach((n) => {
|
||||
n.getComponent(li_BaseView)?.close();
|
||||
});
|
||||
}
|
||||
|
||||
this.subPanelDic.delete(this.currentActivePanel);
|
||||
}
|
||||
// 更新NavigationPanel按钮状态
|
||||
|
||||
@@ -55,7 +55,7 @@ export class DialogBubble extends Component {
|
||||
this.content.overflow = Overflow.NONE;
|
||||
|
||||
// 如果是加载状态,使用固定的"..."
|
||||
if (isLoading && str === "...") {
|
||||
if (isLoading) {
|
||||
this.content.string = "...";
|
||||
// 设置固定尺寸用于加载显示
|
||||
const contentWidth = 60;
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
tween,
|
||||
UITransform,
|
||||
path,
|
||||
view,
|
||||
} from "cc";
|
||||
import ResManager from "db://assets/Scripts/Main/Manager/ResManager";
|
||||
import Utils from "db://assets/Scripts/Main/Common/Utils";
|
||||
@@ -23,8 +24,10 @@ export class ImagePopup extends Component {
|
||||
@property(Sprite)
|
||||
image: Sprite;
|
||||
|
||||
private isAnimating: boolean = false;
|
||||
|
||||
start() {
|
||||
this.node.setPosition(new Vec3(-1500, 493, 0));
|
||||
this.node.setPosition(this.getOffscreenPosition());
|
||||
GButton.BandClick(this.image.node, this.openImage, this);
|
||||
this.node.active = false;
|
||||
}
|
||||
@@ -36,6 +39,26 @@ export class ImagePopup extends Component {
|
||||
categoryId: string;
|
||||
girlId: number;
|
||||
resId: number;
|
||||
|
||||
/**
|
||||
* 获取屏幕外位置(完全在左侧屏幕外)
|
||||
*/
|
||||
private getOffscreenPosition(): Vec3 {
|
||||
const visibleSize = view.getVisibleSize();
|
||||
const x = -visibleSize.width; // 完全在屏幕左侧外
|
||||
const y = visibleSize.height * 0.33; // 屏幕高度的1/3处
|
||||
return new Vec3(x, y, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取屏幕内位置(左侧边缘内侧)
|
||||
*/
|
||||
private getOnscreenPosition(): Vec3 {
|
||||
const visibleSize = view.getVisibleSize();
|
||||
const x = -visibleSize.width/2 + 100; // 从左边缘向内100像素
|
||||
const y = visibleSize.height * 0.33; // 屏幕高度的1/3处
|
||||
return new Vec3(x, y, 0);
|
||||
}
|
||||
//url: string;
|
||||
refresh(categoryId: string, girlId: number, resId: number, clear = false) {
|
||||
this.node.active = true;
|
||||
@@ -96,16 +119,25 @@ export class ImagePopup extends Component {
|
||||
//
|
||||
}
|
||||
popUp() {
|
||||
if (this.isAnimating) return;
|
||||
|
||||
this.isAnimating = true;
|
||||
|
||||
tween(this.node)
|
||||
.to(0.5, { position: new Vec3(-559.374, 493, 0) }, { easing: "backOut" })
|
||||
.to(0.5, { position: this.getOnscreenPosition() }, { easing: "backOut" })
|
||||
.call(() => {
|
||||
this.scheduleOnce(() => {
|
||||
this.popDown();
|
||||
}, 3);
|
||||
})
|
||||
.start();
|
||||
this.scheduleOnce(() => {
|
||||
this.popDown();
|
||||
}, 5);
|
||||
}
|
||||
popDown() {
|
||||
tween(this.node)
|
||||
.to(0.5, { position: new Vec3(-1500, 493, 0) }, { easing: "backIn" })
|
||||
.to(0.5, { position: this.getOffscreenPosition() }, { easing: "backIn" })
|
||||
.call(() => {
|
||||
this.isAnimating = false;
|
||||
})
|
||||
.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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