改了很多

This commit is contained in:
2024-12-15 23:13:00 +08:00
parent 8bf3cc2a5d
commit 73ad199bfc
21 changed files with 40518 additions and 18376 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1336,7 +1336,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -68.593, "y": -62.247,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -1385,7 +1385,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -65, "x": -62,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -1426,8 +1426,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 130, "width": 124,
"height": 20 "height": 13
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -1513,7 +1513,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 130, "width": 130,
"height": 20 "height": 17
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -1549,10 +1549,10 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@0e130", "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@9e883",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 1, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
"_fillCenter": { "_fillCenter": {
@@ -1640,7 +1640,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -85.676, "y": -77.471,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -1689,7 +1689,7 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -65, "x": -62,
"y": 0, "y": 0,
"z": 0 "z": 0
}, },
@@ -1730,8 +1730,8 @@
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 0, "width": 124,
"height": 10 "height": 11
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -1817,7 +1817,7 @@
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 130, "width": 130,
"height": 10 "height": 15
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
@@ -1852,8 +1852,11 @@
"b": 255, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": null, "_spriteFrame": {
"_type": 1, "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@9e883",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
"_fillCenter": { "_fillCenter": {
@@ -1889,7 +1892,7 @@
}, },
"_mode": 0, "_mode": 0,
"_totalLength": 130, "_totalLength": 130,
"_progress": 0, "_progress": 1,
"_reverse": false, "_reverse": false,
"_id": "" "_id": ""
}, },
@@ -1934,7 +1937,7 @@
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": 0, "x": 0,
"y": -66.344, "y": 113.398,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@@ -2256,7 +2259,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": null, "_spriteFrame": null,
"_type": 1, "_type": 0,
"_fillType": 0, "_fillType": 0,
"_sizeMode": 0, "_sizeMode": 0,
"_fillCenter": { "_fillCenter": {
@@ -2302,6 +2305,7 @@
"__id__": 0 "__id__": 0
}, },
"fileId": "9eIoeBQ/FAuKISfw/S9q2E", "fileId": "9eIoeBQ/FAuKISfw/S9q2E",
"instance": null "instance": null,
"targetOverrides": null
} }
] ]

View File

@@ -173,7 +173,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "7b0e7263-3b25-4fec-8935-abdd67c4b86d@74323", "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@01ece",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 0,

View File

@@ -173,7 +173,7 @@
"a": 255 "a": 255
}, },
"_spriteFrame": { "_spriteFrame": {
"__uuid__": "45af5702-7585-4d72-85cf-d7b8da02d832@13f7e", "__uuid__": "f87f53f9-2fba-4a5b-968a-79a593311ab2@103fd",
"__expectedType__": "cc.SpriteFrame" "__expectedType__": "cc.SpriteFrame"
}, },
"_type": 0, "_type": 0,

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"ver": "1.1.50", "ver": "1.1.50",
"importer": "prefab", "importer": "prefab",
"imported": true, "imported": true,
"uuid": "9260d2d2-4104-4b8f-beb7-ab74b894b73b", "uuid": "e81a11af-406f-400c-a51e-55af32e17181",
"files": [ "files": [
".json" ".json"
], ],

View File

@@ -4073,10 +4073,10 @@
"height": 130, "height": 130,
"rawWidth": 128, "rawWidth": 128,
"rawHeight": 130, "rawHeight": 130,
"borderTop": 0, "borderTop": 58,
"borderBottom": 0, "borderBottom": 58,
"borderLeft": 0, "borderLeft": 58,
"borderRight": 0, "borderRight": 58,
"packable": true, "packable": true,
"pixelsToUnit": 100, "pixelsToUnit": 100,
"pivotX": 0.5, "pivotX": 0.5,

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 KiB

After

Width:  |  Height:  |  Size: 38 KiB

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +0,0 @@
{
"ver": "1.1.50",
"importer": "prefab",
"imported": true,
"uuid": "b033123c-3b97-4d66-a18d-c584460cf02f",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "unlock"
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -69,7 +69,7 @@ export class SingletonModuleComp extends ecs.Comp {
enemy_pos:any =[] enemy_pos:any =[]
vmdata: any = { vmdata: any = {
name : "纸片精灵大乱斗", name : "纸片精灵大乱斗",
gold:9999999, gold:99999999,
game_over:false, game_over:false,
game_pause:false, game_pause:false,
mission:{ mission:{
@@ -103,22 +103,23 @@ export class SingletonModuleComp extends ecs.Comp {
}, },
items:{ items:{
1001:1000, 1001:{num:1000,x1:1,x10:0},
1002:0, 1002:{num:1000,x1:2,x10:0},
1003:0, 1003:{num:1000,x1:3,x10:0},
1004:1000, 1004:{num:1000,x1:0,x10:0},
1005:100, 1005:{num:1000,x1:0,x10:0},
1006:200, 1006:{num:1000,x1:0,x10:0},
1007:333, 1007:{num:1000,x1:0,x10:0},
1008:1000, 1008:{num:1000,x1:0,x10:0},
1021:0, 1009:{num:1000,x1:0,x10:0},
1022:0, 1010:{num:1000,x1:0,x10:0},
1023:0, 1011:{num:1000,x1:0,x10:0},
1024:0, 1012:{num:1000,x1:0,x10:0},
1025:0, 1013:{num:1000,x1:0,x10:0},
1026:0, 1014:{num:1000,x1:0,x10:0},
1027:0, 1015:{num:1000,x1:0,x10:0},
1028:0, 1016:{num:1000,x1:0,x10:0},
9001:{num:854587,x1:9999,x10:0},
}, },
}; };

View File

@@ -17,7 +17,9 @@ export enum UIID {
/** 角色控制 */ /** 角色控制 */
Role_Controller, Role_Controller,
/**物品 */ /**物品 */
ItemInfo ItemInfo,
/**物品 */
Victory,
} }
/** 打开界面方式的配置数据 */ /** 打开界面方式的配置数据 */
@@ -27,4 +29,5 @@ export var UIConfigData: { [key: number]: UIConfig } = {
[UIID.Window]: { layer: LayerType.Dialog, prefab: "common/prefab/window" }, [UIID.Window]: { layer: LayerType.Dialog, prefab: "common/prefab/window" },
[UIID.Role_Controller]: { layer: LayerType.UI, prefab: "gui/role_controller" }, [UIID.Role_Controller]: { layer: LayerType.UI, prefab: "gui/role_controller" },
[UIID.ItemInfo]: { layer: LayerType.Dialog, prefab: "gui/element/item_info" }, [UIID.ItemInfo]: { layer: LayerType.Dialog, prefab: "gui/element/item_info" },
[UIID.Victory]: { layer: LayerType.Dialog, prefab: "gui/element/victory" },
} }

View File

@@ -6,22 +6,22 @@ type:
*/ */
export const Items={ export const Items={
1001:{uuid: 1001,path: "3011",type:1,lv:1,r_num:10,name: "经验卷轴",info:"提升英雄等级", }, 1001:{uuid: 1001,path: "1001",type:1,lv:1,r_num:10,name: "经验叶子",info:"提升英雄等级的神奇叶子", },
1002:{uuid: 1002,path: "3012",type:1,lv:1,r_num:10,name: "远程卷轴",info:"提升远程英雄等级", }, 1002:{uuid: 1002,path: "1002",type:1,lv:2,r_num:10,name: "一星凭证",info:"英雄升级一星需要的凭证", },
1003:{uuid: 1003,path: "3013",type:1,lv:1,r_num:10,name: "辅助卷轴",info:"提升辅助英雄等级", }, 1003:{uuid: 1003,path: "1003",type:1,lv:2,r_num:10,name: "二星凭证",info:"英雄升级二星需要的凭证", },
1004:{uuid: 1004,path: "2011",type:1,lv:2,r_num:10,name: "星凭证",info:"英雄升级星需要的凭证", }, 1004:{uuid: 1004,path: "1004",type:1,lv:2,r_num:10,name: "星凭证",info:"英雄升级星需要的凭证", },
1005:{uuid: 1005,path: "2012",type:1,lv:2,r_num:10,name: "星凭证",info:"英雄升级星需要的凭证", }, 1005:{uuid: 1005,path: "1005",type:1,lv:2,r_num:10,name: "星凭证",info:"英雄升级星需要的凭证", },
1006:{uuid: 1006,path: "2012",type:1,lv:2,r_num:10,name: "星凭证",info:"英雄升级星需要的凭证", }, 1006:{uuid: 1006,path: "1006",type:1,lv:2,r_num:10,name: "星凭证",info:"英雄升级星需要的凭证", },
1007:{uuid: 1007,path: "2013",type:1,lv:2,r_num:10,name: "四星凭证",info:"英雄升级四星需要的凭证", }, 1007:{uuid: 1007,path: "1007",type:1,lv:1,r_num:10,name: "能量石",info:"充满能量的神秘石头,可以提升战场技能等级", },
1008:{uuid: 1008,path: "2013",type:1,lv:2,r_num:10,name: "五星凭证",info:"英雄升级五星需要的凭证", }, 1008:{uuid: 1008,path: "1008",type:1,lv:1,r_num:10,name: "黄色叶子",info:"未知功能", },
1021:{uuid: 1021,path: "1001",type:1,lv:1,r_num:1,name: "普通攻击石",info:"增加装备攻击力10,成功几率20%", }, 1009:{uuid: 1009,path: "1001",type:1,lv:1,r_num:1,name: "普通攻击石",info:"增加装备攻击力10,成功几率20%", },
1022:{uuid: 1022,path: "1004",type:1,lv:2,r_num:1,name: "高级攻击石",info:"增加装备攻击力10,成功几率30%", }, 1010:{uuid: 1010,path: "1010",type:1,lv:2,r_num:1,name: "高级攻击石",info:"增加装备攻击力10,成功几率30%", },
1023:{uuid: 1023,path: "1007",type:1,lv:3,r_num:1,name: "稀有攻击石",info:"增加装备攻击力10,成功几率40%", }, 1011:{uuid: 1011,path: "1011",type:1,lv:3,r_num:1,name: "稀有攻击石",info:"增加装备攻击力10,成功几率40%", },
1024:{uuid: 1024,path: "1010",type:1,lv:4,r_num:1,name: "传说攻击石",info:"增加装备攻击力10,成功几率50%", }, 1012:{uuid: 1012,path: "1012",type:1,lv:4,r_num:1,name: "传说攻击石",info:"增加装备攻击力10,成功几率50%", },
1025:{uuid: 1025,path: "1002",type:1,lv:1,r_num:1,name: "普通生命石",info:"增加装备生命值50,成功几率20%", }, 1013:{uuid: 1013,path: "1013",type:1,lv:1,r_num:1,name: "普通生命石",info:"增加装备生命值50,成功几率20%", },
1026:{uuid: 1026,path: "1005",type:1,lv:2,r_num:1,name: "高级生命石",info:"增加装备生命值50,成功几率30%", }, 1014:{uuid: 1015,path: "1014",type:1,lv:2,r_num:1,name: "高级生命石",info:"增加装备生命值50,成功几率30%", },
1027:{uuid: 1027,path: "1008",type:1,lv:3,r_num:1,name: "稀有生命石",info:"增加装备生命值50,成功几率40%", }, 1015:{uuid: 1015,path: "1015",type:1,lv:3,r_num:1,name: "稀有生命石",info:"增加装备生命值50,成功几率40%", },
1028:{uuid: 1028,path: "1011",type:1,lv:4,r_num:1,name: "传说生命石",info:"增加装备生命值50,成功几率50%", }, 1016:{uuid: 1016,path: "1016",type:1,lv:4,r_num:1,name: "传说生命石",info:"增加装备生命值50,成功几率50%", },
9001:{uuid: 9001,path: "9001",type:1,lv:0,r_num:1,name: "金币",info:"金币不是万能的,但是没有金币是万万不能的", }, 9001:{uuid: 9001,path: "9001",type:1,lv:0,r_num:1,name: "金币",info:"金币不是万能的,但是没有金币是万万不能的", },
} }

View File

@@ -75,8 +75,9 @@ export class CardControllerComp extends CCComp {
this.bbg.setPosition(v3(this.bbg_x[0],this.bbg_y)) this.bbg.setPosition(v3(this.bbg_x[0],this.bbg_y))
break; break;
case "battle": case "battle":
this.node.getChildByName("battle_home").setPosition(v3(0,this.node.getChildByName("battle_home").position.y)) // this.node.getChildByName("battle_home").setPosition(v3(0,this.node.getChildByName("battle_home").position.y))
this.bbg.setPosition(v3(this.bbg_x[4],this.bbg_y)) // this.bbg.setPosition(v3(this.bbg_x[4],this.bbg_y))
oops.gui.toast("暂未开放")
break; break;
case "skill": case "skill":
this.node.getChildByName("skill_home").setPosition(v3(0,this.node.getChildByName("skill_home").position.y)) this.node.getChildByName("skill_home").setPosition(v3(0,this.node.getChildByName("skill_home").position.y))

View File

@@ -156,12 +156,12 @@ export class HeroHomeComp extends CCComp {
lv_up(){ lv_up(){
if(smc.vmdata.items[1001] < ((LvUp[0]+this.hero.lvexp)*this.role.lv)||smc.vmdata.gold < (UpGold.LvUp*this.role.lv)){ if(smc.vmdata.items[1001].num < ((LvUp[0]+this.hero.lvexp)*this.role.lv)||smc.vmdata.items[9001].num < (UpGold.LvUp*this.role.lv)){
oops.gui.toast("资源不足,升级失败"); oops.gui.toast("资源不足,升级失败");
return return
} }
smc.vmdata.items[1001] -= ((LvUp[0]+this.hero.lvexp)*this.role.lv) smc.vmdata.items[1001].num -= ((LvUp[0]+this.hero.lvexp)*this.role.lv)
smc.vmdata.gold -= (UpGold.LvUp*this.role.lv) smc.vmdata.items[9001].num -= (UpGold.LvUp*this.role.lv)
this.role.lv++ this.role.lv++
this.update_data() this.update_data()
@@ -171,30 +171,30 @@ export class HeroHomeComp extends CCComp {
oops.gui.toast("已经满星,升星失败"); oops.gui.toast("已经满星,升星失败");
return return
} }
let need =smc.vmdata.items[1004] let has =1002
switch(this.role.slv){ switch(this.role.slv){
case 1: case 1:
need=smc.vmdata.items[1005] has=1003
break; break;
case 2: case 2:
need=smc.vmdata.items[1006] has=1004
break; break;
case 3: case 3:
need=smc.vmdata.items[1007] has=1005
break; break;
case 4: case 4:
need=smc.vmdata.items[1008] has=1006
break; break;
case 5: case 5:
need=smc.vmdata.items[1008] has=1006
break; break;
} }
if(need < ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv)||smc.vmdata.gold < (UpGold.SlvUp*(this.role.slv+1))){ if(smc.vmdata.items[has].num < ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv)||smc.vmdata.items[9001].num < (UpGold.SlvUp*(this.role.slv+1))){
oops.gui.toast("资源不足,升星失败"); oops.gui.toast("资源不足,升星失败");
return return
} }
need -= ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv) smc.vmdata.items[has].num -= ((SlvUp[this.role.slv]+this.hero.slvexp)*this.role.slv)
smc.vmdata.gold -= (UpGold.SlvUp*(this.role.slv+1)) smc.vmdata.items[9001].num -= (UpGold.SlvUp*(this.role.slv+1))
this.role.slv++ this.role.slv++
this.update_data() this.update_data()

View File

@@ -1,4 +1,4 @@
import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources,Sprite,SpriteAtlas,tween,UITransform,v3, Vec3,Animation } from "cc"; import { _decorator,Button,EventHandler,EventTouch,Label,NodeEventType,resources,Sprite,SpriteAtlas,tween,UITransform,v3, Vec3,Animation, UI } from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { smc } from "../common/SingletonModuleComp"; import { smc } from "../common/SingletonModuleComp";
@@ -26,6 +26,8 @@ import { VictoryComp } from "./VictoryComp";
import { ItemComp } from "./ItemComp"; import { ItemComp } from "./ItemComp";
import { MSkillComp } from "./MSkillComp"; import { MSkillComp } from "./MSkillComp";
import { Monster } from "../hero/Mon"; import { Monster } from "../hero/Mon";
import { UIID } from "../common/config/GameUIConfig";
import { CardControllerComp } from "./CardController";
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
/** 视图层对象 */ /** 视图层对象 */
@@ -55,7 +57,7 @@ export class MissionComp extends CCComp {
this.MMSComp.s_uuid=smc.mission.mmskill this.MMSComp.s_uuid=smc.mission.mmskill
} }
start() { start() {
this.VictoryComp=this.node.getChildByName("victory").getComponent(VictoryComp) // this.VictoryComp=this.node.getChildByName("victory").getComponent(VictoryComp)
console.log("mission_start:",this.MSComp) console.log("mission_start:",this.MSComp)
} }
@@ -89,7 +91,6 @@ export class MissionComp extends CCComp {
mission_end(){ mission_end(){
smc.mission.play=false smc.mission.play=false
smc.mission.pause=false smc.mission.pause=false
let heros:any= this.get_heros();; let heros:any= this.get_heros();;
let monsters:any= this.get_mons(); let monsters:any= this.get_mons();
let hcards:any= ecs.query(ecs.allOf(HCardComp)); let hcards:any= ecs.query(ecs.allOf(HCardComp));
@@ -115,6 +116,9 @@ export class MissionComp extends CCComp {
rewards[i].ItemComp.ent.destroy() rewards[i].ItemComp.ent.destroy()
} }
} }
to_mission_home(){
let home =this.node.parent.getComponent(CardControllerComp);
}
mission_init(){ mission_init(){
//局内数据初始化 //局内数据初始化
this.fight_start=false this.fight_start=false
@@ -136,6 +140,26 @@ export class MissionComp extends CCComp {
smc.vmdata.mission.mcrit=0 smc.vmdata.mission.mcrit=0
smc.vmdata.mission.mdead=0 smc.vmdata.mission.mdead=0
smc.vmdata.mission.mdodge=0 smc.vmdata.mission.mdodge=0
this.clear_x1()
}
clear_x1(){
smc.vmdata.items[9001].x1=smc.vmdata.items[9001].x10=0
smc.vmdata.items[1001].x1=smc.vmdata.items[1001].x10=0
smc.vmdata.items[1002].x1=smc.vmdata.items[1002].x10=0
smc.vmdata.items[1003].x1=smc.vmdata.items[1003].x10=0
smc.vmdata.items[1004].x1=smc.vmdata.items[1004].x10=0
smc.vmdata.items[1005].x1=smc.vmdata.items[1005].x10=0
smc.vmdata.items[1006].x1=smc.vmdata.items[1006].x10=0
smc.vmdata.items[1007].x1=smc.vmdata.items[1007].x10=0
smc.vmdata.items[1008].x1=smc.vmdata.items[1008].x10=0
smc.vmdata.items[1009].x1=smc.vmdata.items[1009].x10=0
smc.vmdata.items[1010].x1=smc.vmdata.items[1010].x10=0
smc.vmdata.items[1011].x1=smc.vmdata.items[1011].x10=0
smc.vmdata.items[1012].x1=smc.vmdata.items[1012].x10=0
smc.vmdata.items[1013].x1=smc.vmdata.items[1013].x10=0
smc.vmdata.items[1014].x1=smc.vmdata.items[1014].x10=0
smc.vmdata.items[1015].x1=smc.vmdata.items[1015].x10=0
smc.vmdata.items[1016].x1=smc.vmdata.items[1016].x10=0
} }
mskill_init(){ mskill_init(){
this.MSComp.group=BoxSet.HERO this.MSComp.group=BoxSet.HERO
@@ -162,20 +186,9 @@ export class MissionComp extends CCComp {
m_alive=true m_alive=true
} }
} }
if (!m_alive) smc.mission.is_victory = true if (!m_alive||!h_alive) this.mission_end()
if (!h_alive) smc.mission.is_defeat = true
this.to_end_mission()
}
to_end_mission(){
if (smc.mission.is_victory){
this.VictoryComp.do_victiry(true)
smc.mission.pause=true
}
if (smc.mission.is_defeat){
this.VictoryComp.do_victiry(false)
smc.mission.pause=true
}
} }
get_mons(){ get_mons(){
return ecs.query(ecs.allOf(MonModelComp)); return ecs.query(ecs.allOf(MonModelComp));
} }

View File

@@ -1,4 +1,4 @@
import { _decorator, Label } from "cc"; import { _decorator, Label ,v3} from "cc";
import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS"; import { ecs } from "../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp"; import { CCComp } from "../../../../extensions/oops-plugin-framework/assets/module/common/CCComp";
import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops"; import { oops } from "../../../../extensions/oops-plugin-framework/assets/core/Oops";
@@ -21,69 +21,92 @@ export class VictoryComp extends CCComp {
reward_lv:number=1 reward_lv:number=1
reward_num:number=2 reward_num:number=2
rewards:any=[]
if_show:boolean=false
/** 视图层逻辑代码分离演示 */ /** 视图层逻辑代码分离演示 */
start() { start() {
this.rewards=[]
} }
private do_victiry(is_victory:boolean) { onAdded(args: any) {
if(this.if_show) return console.log("VictoryComp onAdded",args)
this.getReward(is_victory) let items=smc.vmdata.items
this.node.getChildByName("Node").getChildByName("victory").active = is_victory; if(items[9001].x1 > 0) this.node.getChildByName("items").getChildByName("9001").active=true
this.node.getChildByName("Node").getChildByName("defeat").active = !is_victory if(items[1001].x1 > 0) this.node.getChildByName("items").getChildByName("1001").active=true
this.node.setPosition(0,this.node.position.y,0) if(items[1002].x1 > 0) this.node.getChildByName("items").getChildByName("1002").active=true
} if(items[1003].x1 > 0) this.node.getChildByName("items").getChildByName("1003").active=true
getReward(is_victory:boolean){ if(items[1004].x1 > 0) this.node.getChildByName("items").getChildByName("1004").active=true
let conut =3 if(items[1005].x1 > 0) this.node.getChildByName("items").getChildByName("1005").active=true
if(!is_victory) conut=conut-1 if(items[1006].x1 > 0) this.node.getChildByName("items").getChildByName("1006").active=true
let item1=ecs.getEntity<Item>(Item) if(items[1007].x1 > 0) this.node.getChildByName("items").getChildByName("1007").active=true
let gold: number = Math.floor(RandomManager.instance.getRandomInt((3000 + smc.mission.lv * 100) / 3 * 2, 3000 + smc.mission.lv * 100)); if(items[1008].x1 > 0) this.node.getChildByName("items").getChildByName("1008").active=true
let parent = this.node.getChildByName("Node").getChildByName("items") if(items[1009].x1 > 0) this.node.getChildByName("items").getChildByName("1009").active=true
item1.load(9001,gold,parent) if(items[1010].x1 > 0) this.node.getChildByName("items").getChildByName("1010").active=true
this.rewards = []; if(items[1011].x1 > 0) this.node.getChildByName("items").getChildByName("1011").active=true
this.rewards[0]={uuid:9001,num:gold} if(items[1012].x1 > 0) this.node.getChildByName("items").getChildByName("1012").active=true
for (let x = 1; x <= conut; x++) { if(items[1013].x1 > 0) this.node.getChildByName("items").getChildByName("1013").active=true
let item=ecs.getEntity<Item>(Item) if(items[1014].x1 > 0) this.node.getChildByName("items").getChildByName("1014").active=true
let r_i:any = RandomManager.instance.getRandomInt(0,MissionReward[this.reward_lv].length-1); if(items[1015].x1 > 0) this.node.getChildByName("items").getChildByName("1015").active=true
let ii = MissionReward[this.reward_lv][r_i]; if(items[1016].x1 > 0) this.node.getChildByName("items").getChildByName("1016").active=true
let im = Items[ii];
console.log("reward",r_i,ii,im)
item.load(im.uuid,im.r_num,parent)
this.rewards[x]={uuid:im.uuid,num:im.r_num}
}
this.if_show=true
}
do_x10(){
for (let i = 0; i < this.rewards.length; i++) {
if(this.rewards[i].uuid==9001){
smc.vmdata.role.gold+=this.rewards[i].num*10
}else{
smc.vmdata.items[this.rewards[i].uuid]+=this.rewards[i].num*10
}
}
console.log("do_x10",smc.vmdata)
this.end_mission()
}
do_x1(){
for (let i = 0; i < this.rewards.length; i++) {
if(this.rewards[i].uuid==9001){
smc.vmdata.role.gold+=this.rewards[i].num
}else{
smc.vmdata.items[this.rewards[i].uuid]+=this.rewards[i].num
}
}
console.log("x1",smc.vmdata)
this.end_mission()
}
end_mission(){
this.node.setPosition(2000,this.node.position.y,0)
this.if_show=false
} }
do_x10(){
console.log("do_x10",smc.vmdata)
smc.vmdata.items[9001].num+=smc.vmdata.items[9001].x10
smc.vmdata.items[1001].num+=smc.vmdata.items[1001].x10
smc.vmdata.items[1002].num+=smc.vmdata.items[1002].x10
smc.vmdata.items[1003].num+=smc.vmdata.items[1003].x10
smc.vmdata.items[1004].num+=smc.vmdata.items[1004].x10
smc.vmdata.items[1005].num+=smc.vmdata.items[1005].x10
smc.vmdata.items[1006].num+=smc.vmdata.items[1006].x10
smc.vmdata.items[1007].num+=smc.vmdata.items[1007].x10
smc.vmdata.items[1008].num+=smc.vmdata.items[1008].x10
smc.vmdata.items[1009].num+=smc.vmdata.items[1009].x10
smc.vmdata.items[1010].num+=smc.vmdata.items[1010].x10
smc.vmdata.items[1011].num+=smc.vmdata.items[1011].x10
smc.vmdata.items[1012].num+=smc.vmdata.items[1012].x10
smc.vmdata.items[1013].num+=smc.vmdata.items[1013].x10
smc.vmdata.items[1014].num+=smc.vmdata.items[1014].x10
smc.vmdata.items[1015].num+=smc.vmdata.items[1015].x10
smc.vmdata.items[1016].num+=smc.vmdata.items[1016].x10
this.clear_x1()
this.reset();
}
do_x1(){
console.log("x1",smc.vmdata)
this.clear_x1()
this.reset();
}
clear_x1(){
smc.vmdata.items[9001].x1=smc.vmdata.items[9001].x10=0
smc.vmdata.items[1001].x1=smc.vmdata.items[1001].x10=0
smc.vmdata.items[1002].x1=smc.vmdata.items[1002].x10=0
smc.vmdata.items[1003].x1=smc.vmdata.items[1003].x10=0
smc.vmdata.items[1004].x1=smc.vmdata.items[1004].x10=0
smc.vmdata.items[1005].x1=smc.vmdata.items[1005].x10=0
smc.vmdata.items[1006].x1=smc.vmdata.items[1006].x10=0
smc.vmdata.items[1007].x1=smc.vmdata.items[1007].x10=0
smc.vmdata.items[1008].x1=smc.vmdata.items[1008].x10=0
smc.vmdata.items[1009].x1=smc.vmdata.items[1009].x10=0
smc.vmdata.items[1010].x1=smc.vmdata.items[1010].x10=0
smc.vmdata.items[1011].x1=smc.vmdata.items[1011].x10=0
smc.vmdata.items[1012].x1=smc.vmdata.items[1012].x10=0
smc.vmdata.items[1013].x1=smc.vmdata.items[1013].x10=0
smc.vmdata.items[1014].x1=smc.vmdata.items[1014].x10=0
smc.vmdata.items[1015].x1=smc.vmdata.items[1015].x10=0
smc.vmdata.items[1016].x1=smc.vmdata.items[1016].x10=0
}
end_mission(){
}
item_show(e:any,val:any){
console.log("item_show",val)
oops.gui.open(UIID.ItemInfo, Items[val]);
}
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */ /** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
reset() { reset() {
this.node.destroy(); oops.gui.remove(UIID.Victory, false);
} }
} }