feat: 提交资源

This commit is contained in:
han_han9
2025-10-28 21:55:41 +08:00
parent 591f398085
commit 55c4fcd9ae
2146 changed files with 172747 additions and 456 deletions

View File

@@ -0,0 +1,46 @@
import { _decorator, Component, Enum, Label } from "cc";
import { EventManager } from "@max-studio/core/event/EventManager";
import UIManager from "@max-studio/core/ui/UIManager";
import LogUtils from "@max-studio/core/utils/LogUtils";
import { ShopUI } from "../../uis/ShopUI";
import { CurrencyManager } from "../CurrencyManager";
import { CurrencyEventMessage, CurrencyType } from "../Types";
import { onEvent } from "@max-studio/core/decorators";
const { ccclass, property } = _decorator;
@ccclass("CurrencyItem")
export class CurrencyItem extends Component {
@property({ type: Enum(CurrencyType) })
public type: CurrencyType = CurrencyType.ENERGY;
@property(Label)
public label: Label = null!;
protected onLoad(): void {
this.node.onClick(this.onGotoCurrencyShop, this);
}
private onGotoCurrencyShop() {
LogUtils.log("点击了货币商店:", this.type);
void UIManager.getInstance().openUI(ShopUI, this.type);
}
@onEvent(CurrencyEventMessage.CURRENCY_VALUE_CHANGED)
private onCurrencyValueChanged(type: CurrencyType, value: number) {
if (type !== this.type) {
return;
}
this.label.string = CurrencyManager.getInstance().formatCurrencyDisplay(this.type, value);
}
protected onDestroy(): void {
EventManager.getInstance().off(CurrencyEventMessage.CURRENCY_VALUE_CHANGED, this.onCurrencyValueChanged, this);
}
protected start(): void {
this.label.string = CurrencyManager.getInstance().formatCurrencyDisplay(this.type);
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.24",
"importer": "typescript",
"imported": true,
"uuid": "8840c2d8-d822-482c-b68f-2a88cd9c8e72",
"files": [],
"subMetas": {},
"userData": {}
}