This commit is contained in:
2025-09-20 12:22:00 +08:00
parent 8a60992052
commit 4d6f8b5bdd
8 changed files with 1321 additions and 1476 deletions
@@ -1,4 +1,5 @@
import { _decorator, Button, Component, Node, NodeEventType, Sprite } from "cc";
import { GButton } from "../../../Main/Common/GButton";
const { ccclass, property } = _decorator;
@ccclass("SimpleToggle")
@@ -14,21 +15,10 @@ export class SimpleToggle extends Component {
btn: Button;
protected onLoad(): void {
this.node.on(NodeEventType.TOUCH_START, this.onClickThis, this);
GButton.BandClick(this.node,this.onClickThis,this);
this.btn = this.getComponent(Button);
}
init(isSelected: boolean, callBack: () => {}) {
this.selectedSprite.node.active = isSelected;
this.unSelectedSprite.node.active = !isSelected;
if (this.callback) {
this.onDestroy();
}
this.callback = callBack;
this.node.on(NodeEventType.TOUCH_START, this.onClickThis, this);
}
refresh(isSelected: boolean) {
this.selectedSprite.node.active = isSelected;
this.unSelectedSprite.node.active = !isSelected;
@@ -45,7 +35,7 @@ export class SimpleToggle extends Component {
}
protected onDestroy(): void {
this.node.off(NodeEventType.TOUCH_START, this.onClickThis, this);
//this.node.off(NodeEventType.TOUCH_START, this.onClickThis, this);
this.callback = null;
}
@@ -15,6 +15,10 @@ export class SimpleToggleGroup extends Component {
}
}
protected onEnable(): void {
this.toggleSelectedIndex(0);
}
toggleSelected(selectedNode: Node) {
for (let i = 0; i < this.toggles.length; i++) {
const element = this.toggles[i];
@@ -26,4 +30,15 @@ export class SimpleToggleGroup extends Component {
}
}
}
toggleSelectedIndex(selectedIndex: number) {
for (let i = 0; i < this.toggles.length; i++) {
const element = this.toggles[i];
if (i === selectedIndex) {
element.refresh(true);
} else {
element.refresh(false);
element.btn.interactable = true;
}
}
}
}
@@ -131,6 +131,8 @@ export class GirlDetailPanel extends li_BaseView {
console.warn("GirlDetailPanel: videoArea 未设置,使用默认尺寸");
return new Size(600, 800);
}
nameKey: string;
tagKey: string;
descKey: string;
@@ -295,7 +295,7 @@ export class ThemePanel extends li_BaseView {
}
enterShop() {
NavigationManager.Instance.switchToPanel(PanelType.PERSONAL);
NavigationManager.Instance.openSubPanel("PurchasePanel", this.node);
}
chatWithRec() {
@@ -329,7 +329,7 @@ export class ThemePanel extends li_BaseView {
openSetting() {
// 通过NavigationManager切换到个人信息面板,保持动画和状态同步
NavigationManager.Instance.switchToPanel(PanelType.PERSONAL);
NavigationManager.Instance.openSubPanel("SettingPanel", this.node);
}
openMsgBox() {