美术更新

- detail页面修改
- ui布局修改
This commit is contained in:
2025-08-25 20:15:42 +08:00
parent 2ae00f5c23
commit d6c3c775b5
183 changed files with 22192 additions and 12914 deletions
@@ -0,0 +1,52 @@
import { _decorator, Button, Component, Node, NodeEventType, Sprite } from "cc";
const { ccclass, property } = _decorator;
@ccclass("SimpleToggle")
export class SimpleToggle extends Component {
@property(Sprite)
selectedSprite: Sprite = null;
@property(Sprite)
unSelectedSprite: Sprite = null;
callback: () => {};
toggleGroupCallBack: Function;
btn: Button;
protected onLoad(): void {
this.node.on(NodeEventType.TOUCH_START, this.onClickThis, this);
this.btn = this.getComponent(Button);
}
init(isSelected: boolean, callBack: () => {}) {
this.selectedSprite.enabled = isSelected;
this.unSelectedSprite.enabled = !isSelected;
if (this.callback) {
this.onDestroy();
}
this.callback = callBack;
this.node.on(NodeEventType.TOUCH_START, this.onClickThis, this);
}
refresh(isSelected: boolean) {
this.selectedSprite.enabled = isSelected;
this.unSelectedSprite.enabled = !isSelected;
}
onClickThis() {
if (this.callback) {
this.callback();
}
if (this.toggleGroupCallBack) {
this.toggleGroupCallBack(this.node);
}
this.btn.interactable = false;
}
protected onDestroy(): void {
this.node.off(NodeEventType.TOUCH_START, this.onClickThis, this);
this.callback = null;
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "74d7e427-0f9b-414a-90a1-e75bef954d99",
"files": [],
"subMetas": {},
"userData": {}
}
@@ -0,0 +1,38 @@
import { _decorator, Component, Node, tween, Vec3 } from "cc";
import { SimpleToggle } from "./SimpleToggle";
const { ccclass, property } = _decorator;
@ccclass("SimpleToggleGroup")
export class SimpleToggleGroup extends Component {
toggles: SimpleToggle[];
@property(Node)
slider: Node;
protected onLoad(): void {
this.toggles = this.getComponentsInChildren(SimpleToggle);
for (let i = 0; i < this.toggles.length; i++) {
const element = this.toggles[i];
element.toggleGroupCallBack = this.toggleSelected.bind(this);
}
}
toggleSelected(selectedNode: Node) {
const pos = this.slider.getWorldPosition();
const targetPos = new Vec3(selectedNode.worldPosition.x, pos.y, pos.z);
tween(this.slider)
.to(0.3, { worldPosition: targetPos }, { easing: "sineInOut" })
.start();
for (let i = 0; i < this.toggles.length; i++) {
const element = this.toggles[i];
if (element.node === selectedNode) {
element.refresh(true);
} else {
element.refresh(false);
element.btn.interactable = true;
}
}
}
}
@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "bf84c159-6fa3-4211-97f6-2c9618bd9bac",
"files": [],
"subMetas": {},
"userData": {}
}