123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- import auto_fallitem from "../../../ui/uidata/map/auto_fallitem";
- import UIBase from "../../../framework/ui/UIBase";
- import UIHelp from "../../../framework/ui/UIHelp";
- import { EVENT_TYPE, FALLITEM_TYPE } from "../../../gameLogic/utrl/gameEnum";
- import buffDtManager from "../../../dataManager/buffDtManager";
- import bundleManager from "../../../manager/bundleManager";
- import itemDtManager from "../../../dataManager/itemDtManager";
- import gameData from "../../../gameLogic/utrl/gameData";
- const { ccclass, menu, property } = cc._decorator;
- @ccclass
- @menu("UI/map/UIFallitem")
- export default class UIFallitem extends UIBase {
- ui: auto_fallitem = null;
- protected static prefabUrl = "map/fallitem";
- protected static className = "UIFallitem";
- private attr_value: number = 0; //属性值
- private attr_type: number = 0; //属性类型1食物,2药品,3子弹,4近战,5远程
- private inited = false;
- @property({ type: cc.Enum(FALLITEM_TYPE), displayName: '物资类型' })
- itemID = FALLITEM_TYPE.caidao;
- onUILoad() {
- this.ui = this.node.addComponent(auto_fallitem);
- }
- onStart() {
- this.initItem(this.itemID);
- }
- initItem(itemID: number) {
- this.itemID = itemID;
- let itemDt = itemDtManager.getDataByID(this.itemID);
- let ResName = itemDtManager.getItemResName(this.itemID);
- bundleManager.setBundleFrame('UI', ResName, this.node);
- this.attr_value = itemDt.value;
- this.attr_type = itemDt.type;
- this.inited = true;
- }
- /**
- *
- * @returns 物资属性值
- */
- getValue() {
- return this.attr_value;
- }
- /**
- *
- * @returns 物资类型
- * 1食物,2药品,3子弹,4近战,5远程
- */
- getType() {
- return this.attr_type;
- }
- /**获取id */
- getID() {
- return this.itemID;
- }
- onClose() {
- UIHelp.CloseUI(UIFallitem);
- }
- }
|