奖励到账
This commit is contained in:
@@ -101,9 +101,15 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
1004:0,
|
||||
1005:0,
|
||||
1006:0,
|
||||
1013:0,
|
||||
1014:0,
|
||||
1015:0,
|
||||
1007:0,
|
||||
1021:0,
|
||||
1022:0,
|
||||
1023:0,
|
||||
1024:0,
|
||||
1025:0,
|
||||
1026:0,
|
||||
1027:0,
|
||||
1028:0,
|
||||
},
|
||||
heros:{
|
||||
9001:{uuid:9001,lv:1,exp:0,slv:1,stone:0},
|
||||
|
||||
@@ -6,8 +6,8 @@ type:
|
||||
*/
|
||||
|
||||
export const Items={
|
||||
1001:{uuid: 1001,path: "2001",type: 1,r_num:10,name: "训练凭证",info:"通过训练,提升普等级", },
|
||||
1002:{uuid: 1002,path: "2002",type: 1,r_num:10,name: "高级训练凭证",info:"通过高等级训练,提升高50级以上英雄等级", },
|
||||
1001:{uuid: 1001,path: "5017",type: 1,r_num:10,name: "训练凭证",info:"通过训练,提升普等级", },
|
||||
1002:{uuid: 1002,path: "2009",type: 1,r_num:10,name: "高级训练凭证",info:"通过高等级训练,提升高50级以上英雄等级", },
|
||||
1003:{uuid: 1003,path: "1002",type: 1,r_num:10,name: "英雄原石",info:"一星英雄升星", },
|
||||
1004:{uuid: 1004,path: "1005",type: 1,r_num:1,name: "高级英雄原石",info:"二星英雄升星", },
|
||||
1005:{uuid: 1005,path: "1008",type: 1,r_num:1,name: "稀有英雄原石",info:"三星英雄升星", },
|
||||
@@ -21,6 +21,6 @@ export const Items={
|
||||
1026:{uuid: 1026,path: "2307",type: 1,r_num:1,name: "高级生命石",info:"增加装备生命值", },
|
||||
1027:{uuid: 1027,path: "2308",type: 1,r_num:1,name: "稀有生命石",info:"增加装备生命值", },
|
||||
1028:{uuid: 1028,path: "2309",type: 1,r_num:1,name: "传说生命石",info:"增加装备生命值", },
|
||||
9001:{uuid: 1028,path: "2309",type: 1,r_num:1,name: "金币",info:"金币不是万能的,但是没有金币是万万不能的", },
|
||||
9001:{uuid: 9001,path: "9001",type: 1,r_num:1,name: "金币",info:"金币不是万能的,但是没有金币是万万不能的", },
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ export const MissionSet = [
|
||||
|
||||
|
||||
export const MissionReward = {
|
||||
1:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1026,1027,1028],
|
||||
2:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1026,1027,1028],
|
||||
3:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1026,1027,1028],
|
||||
1:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1025,1026,1027,1028],
|
||||
2:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1025,1026,1027,1028],
|
||||
3:[1001,1002,1003,1004,1005,1006,1007,1021,1022,1023,1024,1025,1026,1027,1028],
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
export const HeroInfo = {
|
||||
9001: {
|
||||
uuid:9001,name: "骑士·白",path:"k1",type:1,hp: 50, hp_up:10,def:10,def_up:1,ap:20,ap_up:2,atp:1,vun:0,crit:20,crit_add:0,dodge:0,dis:100,a_cd:1,
|
||||
uuid:9001,name: "骑士·白",path:"k1",type:1,hp: 20, hp_up:10,def:10,def_up:1,ap:20,ap_up:2,atp:1,vun:0,crit:20,crit_add:0,dodge:0,dis:100,a_cd:1,
|
||||
lvexp:2,slvexp:2, speed: 100,aep:1,uaep:1,dep:10,sk1:[9001,9001,9001,9001,9001],sk2: [2002,2002,2002,2002,2002],pw:0,pwm:15,pws:1,
|
||||
akr:[10,20,30,40,50],akc:[1,1,1,1,1],uar:[10,20,30,40,50],uac:[1,1,1,1,1],dgr:[10,20,30,40,50],dgc:[1,1,1,1,1],crr:[10,20,30,40,50],crc:[1,1,1,1,1],
|
||||
abh:0,abc:0,uabh:0,uabc:0,cbh:0,cbc:0,aua:0,auc:0,uaua:0,uauc:0,cua:0,cuc:0,wp:1001,arm:2001,ring:3001,shoes:4001,
|
||||
|
||||
@@ -205,7 +205,7 @@ export class HeroViewComp extends CCComp {
|
||||
onPostSolve (selfCollider: Collider2D, otherCollider: Collider2D) {
|
||||
}
|
||||
update(dt: number){
|
||||
if(!smc.vmdata.mission.play||smc.vmdata.pause) return
|
||||
if(!smc.vmdata.mission.play||smc.vmdata.mission.pause) return
|
||||
if(this.is_dead) {
|
||||
if(!this.in_grave()) this.to_grave()
|
||||
return
|
||||
|
||||
@@ -19,7 +19,7 @@ export class ItemComp extends CCComp {
|
||||
}
|
||||
|
||||
show_info(){
|
||||
oops.gui.open(UIID.ItemInfo, { name:Items[this.i_uuid].name, info:Items[this.i_uuid].info});
|
||||
oops.gui.open(UIID.ItemInfo, Items[this.i_uuid]);
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EventTouch, Label, Node,_decorator } from "cc";
|
||||
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";
|
||||
@@ -12,6 +12,12 @@ export class ItemInfoComp extends CCComp {
|
||||
onAdded(args: any) {
|
||||
this.node.getChildByName("name").getComponent(Label).string=args.name
|
||||
this.node.getChildByName("info").getComponent(Label).string=args.info
|
||||
let url = "gui/items";
|
||||
let pathName= args.path;
|
||||
resources.load(url, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = this.node.getChildByName("item_bg").getChildByName("icon").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(pathName);
|
||||
});
|
||||
}
|
||||
|
||||
private onTouchEnd(event: EventTouch) {
|
||||
|
||||
@@ -60,7 +60,7 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
|
||||
protected update(dt: number): void {
|
||||
if(!smc.vmdata.mission.play||smc.vmdata.pause){
|
||||
if(!smc.vmdata.mission.play||smc.vmdata.mission.pause){
|
||||
return
|
||||
}
|
||||
if(this.fight_start){
|
||||
@@ -99,9 +99,13 @@ export class MissionComp extends CCComp {
|
||||
this.node.getChildByName("mexp").getChildByName("hp").active = true
|
||||
this.mon_refresh()
|
||||
this.heros_call()
|
||||
}
|
||||
do_x10(){
|
||||
|
||||
}
|
||||
mission_end(){
|
||||
smc.vmdata.mission.play=false
|
||||
smc.vmdata.mission.pause=false
|
||||
let heros:any= this.get_heros();;
|
||||
let monsters:any= this.get_mons();
|
||||
let hcards:any= ecs.query(ecs.allOf(HCardComp));
|
||||
@@ -169,10 +173,6 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
}
|
||||
|
||||
do_reward(){
|
||||
console.log("do_reward")
|
||||
|
||||
}
|
||||
check_mon_num(){
|
||||
let mons:any = this.get_mons()
|
||||
let heros:any= this.get_heros()
|
||||
@@ -194,10 +194,12 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
to_end_mission(){
|
||||
if (smc.vmdata.mission.is_victory){
|
||||
this.VictoryComp.do_victiry()
|
||||
this.VictoryComp.do_victiry(true)
|
||||
smc.vmdata.mission.pause=true
|
||||
}
|
||||
if (smc.vmdata.mission.is_defeat){
|
||||
this.VictoryComp.do_defeat()
|
||||
this.VictoryComp.do_victiry(false)
|
||||
smc.vmdata.mission.pause=true
|
||||
}
|
||||
}
|
||||
get_mons(){
|
||||
|
||||
@@ -21,24 +21,18 @@ export class VictoryComp extends CCComp {
|
||||
|
||||
reward_lv:number=1
|
||||
reward_num:number=2
|
||||
rerawd_item:any={}
|
||||
rewards:any=[]
|
||||
if_show:boolean=false
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
this.rewards=[]
|
||||
}
|
||||
private do_victiry() {
|
||||
private do_victiry(is_victory:boolean) {
|
||||
if(this.if_show) return
|
||||
this.getReward(is_victory)
|
||||
this.node.getChildByName("Node").getChildByName("defeat").active = is_victory
|
||||
this.node.getChildByName("Node").getChildByName("victory").active = !is_victory;
|
||||
this.node.setPosition(0,this.node.position.y,0)
|
||||
this.getReward(true)
|
||||
this.node.getChildByName("Node").getChildByName("defeat").active = false
|
||||
this.node.getChildByName("Node").getChildByName("victory").active = true;
|
||||
}
|
||||
private do_defeat() {
|
||||
if(this.if_show) return
|
||||
this.node.setPosition(0,this.node.position.y,0)
|
||||
this.getReward(false)
|
||||
this.node.getChildByName("Node").getChildByName("victory").active = false;
|
||||
this.node.getChildByName("Node").getChildByName("defeat").active = true
|
||||
}
|
||||
getReward(is_victory:boolean){
|
||||
let conut =2
|
||||
@@ -48,19 +42,42 @@ export class VictoryComp extends CCComp {
|
||||
let parent = this.node.getChildByName("Node").getChildByName("items")
|
||||
let reward:any = RandomManager.instance.getRandomByObjectList(MissionReward[this.reward_lv], conut);
|
||||
item1.load(9001,gold,parent)
|
||||
this.rewards = [];
|
||||
this.rewards[0]={uuid:9001,num:gold}
|
||||
for (let i = 0; i < conut; i++) {
|
||||
let item=ecs.getEntity<Item>(Item)
|
||||
let im =Items[reward[i]]
|
||||
|
||||
while (Items[reward[i]]==undefined) {
|
||||
let r = RandomManager.instance.getRandomByObjectList(MissionReward[this.reward_lv], 1);
|
||||
Items[reward[i]]=r[0]
|
||||
console.log("getReward undefined",Items[reward[i]],i)
|
||||
}
|
||||
let im =Items[reward[i]]
|
||||
item.load(im.uuid,im.r_num,parent)
|
||||
this.rewards[i+1]={uuid:9001,num:gold}
|
||||
}
|
||||
this.if_show=true
|
||||
}
|
||||
do_x10(){
|
||||
console.log("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(){
|
||||
console.log("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(){
|
||||
|
||||
@@ -27,7 +27,7 @@ export class MSkillComp extends CCComp {
|
||||
this.cd=this.cdt=this.skill.cd
|
||||
}
|
||||
protected update(dt: number): void {
|
||||
if(!smc.vmdata.mission.play||smc.vmdata.pause||smc.vmdata.mission.is_victory||smc.vmdata.mission.is_defeat){
|
||||
if(!smc.vmdata.mission.play||smc.vmdata.mission.pause){
|
||||
return
|
||||
}
|
||||
this.check_cd(dt)
|
||||
|
||||
Reference in New Issue
Block a user