去掉了item+ 小强化 动画

This commit is contained in:
2025-08-01 23:32:39 +08:00
parent 3c349f4195
commit 9d0fdfc0f8
17 changed files with 3128 additions and 9467 deletions

View File

@@ -16,10 +16,6 @@ export enum UIID {
Netinstable,
/** 角色控制 */
Role_Controller,
/**物品 */
ItemInfo,
/**物品 */
Victory,
// /** 提示窗 */
// Toast,
}
@@ -30,7 +26,5 @@ export var UIConfigData: { [key: number]: UIConfig } = {
[UIID.Netinstable]: { layer: LayerType.PopUp, prefab: "common/prefab/netinstable" },
[UIID.Window]: { layer: LayerType.Dialog, prefab: "common/prefab/window" },
[UIID.Role_Controller]: { layer: LayerType.UI, prefab: "gui/role_controller" },
[UIID.ItemInfo]: { layer: LayerType.Dialog, prefab: "gui/element/item_info" },
[UIID.Victory]: { layer: LayerType.Dialog, prefab: "gui/element/victory" },
// [UIID.Toast]: { layer: LayerType.PopUp, prefab: "common/prefab/toast" },
}

View File

@@ -1,33 +0,0 @@
import { instantiate, Label, Prefab, resources, Sprite, SpriteAtlas, Vec3 } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { ItemComp } from "./ItemComp";
import { Items } from "../common/config/Items";
/** Item 模块 */
@ecs.register(`Item`)
export class Item extends ecs.Entity {
protected init() {
// this.addComponents<ecs.Comp>();
}
load(uuid:number=1001,num:number=0,praent:any=null) {
var path = "game/gui/item";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.parent = praent
let iv = node.getComponent(ItemComp)!;
iv.i_uuid = uuid
iv.num=num
iv.update_data(uuid,num)
this.add(iv)
}
/** 模块资源释放 */
destroy() {
super.destroy();
}
}
/** Item 模块业务逻辑系统组件,如无业务逻辑处理可删除此对象 */

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "6d44969e-0c5d-4ef2-8919-e9c18b012dec",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,48 +0,0 @@
import { _decorator, CCInteger, Label, resources, Sprite, SpriteAtlas } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { Items } from "../common/config/Items";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('ItemComp')
@ecs.register('ItemComp', false)
export class ItemComp extends CCComp {
i_uuid:number = 0;
num:number = 0;
start() {
//todo 设定icon 显示
}
update_data(uuid:number,num:number=0){
this.i_uuid=uuid;
this.num=num;
this.node.getChildByName("num").getComponent(Label).string = num.toString();
if(num==0){
this.node.getChildByName("num").getComponent(Label).string ="";
}
let url = "gui/items";
let pathName= Items[uuid].path;
this.node.getChildByName("lv1").active = Items[uuid].lv==1;
this.node.getChildByName("lv2").active = Items[uuid].lv==2;
this.node.getChildByName("lv3").active = Items[uuid].lv==3;
this.node.getChildByName("lv4").active = Items[uuid].lv==4;
resources.load(url, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("icon").getComponent(Sprite);
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
});
}
show_info(){
if(this.node.parent.name=="item_info") return
oops.gui.open(UIID.ItemInfo, {uuid:this.i_uuid,type:0});
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() {
this.node.destroy();
}
}

View File

@@ -1,9 +0,0 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "b3d7b41f-5185-4a0a-b690-897800e264ef",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -1,75 +0,0 @@
import { EventTouch, Label, Node,Sprite,SpriteAtlas,_decorator, resources } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
import { UIID } from "../common/config/GameUIConfig";
import { Items } from "../common/config/Items";
import { SkillSet } from "../common/config/SkillSet";
import { HeroInfo } from "../common/config/heroSet";
import { Hero } from "../hero/Hero";
import { HChipComp } from "../hero/HChipComp";
import { ItemComp } from "./ItemComp";
const { ccclass, property } = _decorator;
/** 视图层对象 */
@ccclass('ItemInfoComp')
@ecs.register('ItemInfo', false)
export class ItemInfoComp extends CCComp {
onAdded(args: any) {
this.node.setSiblingIndex(100);
this.node.getChildByName("item").active = false;
this.node.getChildByName("skill").active = false;
this.node.getChildByName("hero").active = false;
if(args.type==0){
this.node.getChildByName("item").active = true;
this.node.getChildByName("name").getComponent(Label).string=Items[args.uuid].name
this.node.getChildByName("info").getComponent(Label).string=Items[args.uuid].info
let itemcom = this.node.getChildByName("item").getComponent(ItemComp);
itemcom.update_data(args.uuid,args.num);
}
if(args.type==1){ //技能碎片
this.node.getChildByName("skill").active = true;
this.node.getChildByName("name").getComponent(Label).string=SkillSet[args.uuid].name+" 碎片"
this.node.getChildByName("info").getComponent(Label).string="「"+SkillSet[args.uuid].name+"」碎片,用于技能升阶"
var icon_path = "game/heros/cards"
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
const sprite = this.node.getChildByName("skill").getChildByName("skill").getChildByName("icon").getComponent(Sprite);
// console.log("update_data",atlas,sprite)
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[args.uuid].path);
});
}
if(args.type==2){ //英雄碎片
this.node.getChildByName("hero").active = true;
this.node.getChildByName("name").getComponent(Label).string=HeroInfo[args.uuid].name+" 碎片"
this.node.getChildByName("info").getComponent(Label).string="「"+HeroInfo[args.uuid].name+"」碎片,用于强化英雄,怪物掉落和开宝箱抽卡获得"
let HChip=this.node.getChildByName("hero").getComponent(HChipComp);
HChip.update_data(args.uuid)
}
}
private onTouchEnd(event: EventTouch) {
switch (event.target.name) {
case "btn":
this.reset();
break;
}
event.propagationStopped = true;
}
reset() {
oops.gui.remove(UIID.ItemInfo, false);
// // 注:模拟二次删除清理缓存
// setTimeout(() => {
// oops.gui.remove(UIID.ItemInfo);
// }, 100);
}
protected onDestroy(): void {
console.log("释放角色信息界面");
}
}

View File

@@ -0,0 +1,32 @@
import { _decorator, Animation, Component, Node, tween, v3 } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('LuckCardComp')
export class LuckCardComp extends Component {
timer:number=3;
start() {
this.timer=2
console.log("[LuckCardComp]:start")
}
update(deltaTime: number) {
this.timer-=deltaTime
if(this.timer<=0){
let anim=this.node.getComponent(Animation)
if(anim) anim.play("luckcardend")
this.do_destroy()
this.timer=2
}
}
do_destroy(){
tween(this.node)
.to(0.2, {
scale: v3(2,2,0),
}, {onComplete:()=>{
this.node.destroy()
}})
.start();
}
}

View File

@@ -2,7 +2,7 @@
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "8a98f43a-eefc-40aa-8ab5-b7f25f01eef3",
"uuid": "598155fc-f31b-4496-b1e4-82219435f425",
"files": [],
"subMetas": {},
"userData": {}

View File

@@ -1,4 +1,4 @@
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources,Sprite,SpriteAtlas,tween,UITransform,v3, Vec3,Animation, UI } from "cc";
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources,Sprite,SpriteAtlas,tween,UITransform,v3, Vec3,Animation, UI, instantiate, Prefab } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp";
@@ -293,15 +293,23 @@ export class MissionComp extends CCComp {
}
call_func_card(){
let mission_data=smc.vmdata.mission_data
if(mission_data.gold < (mission_data.refresh_gold+mission_data.buff_refresh_gold)){
oops.gui.toast("金币不足", false);
return
}
oops.message.dispatchEvent(GameEvent.FuncSelect)
mission_data.gold-=(mission_data.refresh_gold+mission_data.buff_refresh_gold)
this.show_lucky_gold()
}
show_lucky_gold(){
var path = "game/gui/lcard";
var prefab: Prefab = oops.res.get(path, Prefab)!;
var node = instantiate(prefab);
node.setScale(0,0,0)
node.parent = this.node
node.setPosition(v3(this.node.getChildByName("luckybox").position.x,this.node.getChildByName("luckybox").position.y));
tween(node) .to(0.5, {
scale: v3(1,1,1),
position: v3(0,this.node.getChildByName("luckybox").position.y+200),
}, {easing:"backOut"})
.start();
}
private cleanComponents() {
ecs.query(ecs.allOf(HeroViewComp)).forEach(entity => {entity.remove(HeroViewComp);entity.destroy()});
}