dd
This commit is contained in:
@@ -31,6 +31,7 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
// {uuid:6216,type:2},{uuid:6217,type:2},{uuid:6218,type:2}
|
||||
];
|
||||
items: any = []
|
||||
sitems:any = []
|
||||
player_skills: any = [
|
||||
];
|
||||
player_buffs: any = [
|
||||
@@ -149,6 +150,18 @@ export class SingletonModuleComp extends ecs.Comp {
|
||||
skill3:{uuid:1001,cd:3,cd_max:3,alive:false},
|
||||
skill4:{uuid:1001,cd:3,cd_max:3,alive:false},
|
||||
skill5:{uuid:1001,cd:3,cd_max:3,alive:false},
|
||||
items:{
|
||||
1001:{uuid: 1001,num:0},
|
||||
1002:{uuid: 1002,num:0},
|
||||
1003:{uuid: 1003,num:0},
|
||||
1004:{uuid: 1004,num:0},
|
||||
1005:{uuid: 1005,num:0},
|
||||
1006:{uuid: 1006,num:0},
|
||||
1007:{uuid: 1007,num:0},
|
||||
1008:{uuid: 1008,num:0},
|
||||
1009:{uuid: 1009,num:0},
|
||||
1010:{uuid: 1010,num:0},
|
||||
}
|
||||
},
|
||||
talent:{
|
||||
1001:{uuid:1001,lv:0,},
|
||||
|
||||
@@ -25,8 +25,7 @@ path: 图片地址
|
||||
|
||||
*/
|
||||
|
||||
export const Items={
|
||||
|
||||
export const Sitems={
|
||||
6005:{uuid: 6005,path: "6005",type: 93,level: 3,name: "钢盾",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:0,hp:0,shield:100,sd:30,cd:1,bsd:5,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
@@ -64,7 +63,6 @@ export const Items={
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
6218:{uuid: 6218,path: "6218",type: 94,level: 4,name: "精炼技能石",sp_name:"",info:"",
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
|
||||
dis:1,count:1,in:0,run:0,atk:5,hp:30,shield:0,sd:30,cd:1,bsd:0,bcd:1,sk_uuid:1001,sk_count:0,speed:600, },
|
||||
}
|
||||
|
||||
|
||||
15
assets/script/game/common/config/Items.ts
Normal file
15
assets/script/game/common/config/Items.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
/*
|
||||
type:
|
||||
1 普通消耗品,武器升级或技能升级原材料
|
||||
2 可双击打开,如宝箱,
|
||||
|
||||
*/
|
||||
|
||||
export const Items={
|
||||
1001:{uuid: 1001,path: "1001",type: 1,lv: 1,name: "经验卷轴",info:"提升英雄等级", },
|
||||
1002:{uuid: 1002,path: "1002",type: 1,lv: 1,name: "技能卷轴",info:"提升英雄技能等级", },
|
||||
1003:{uuid: 1003,path: "1003",type: 1,lv: 1,name: "治疗药水",info:"战斗中回复英雄血量", },
|
||||
1004:{uuid: 1004,path: "1004",type: 1,lv: 1,name: "攻击药水",info:"战斗中增加英雄攻击", },
|
||||
1005:{uuid: 1005,path: "1005",type: 1,lv: 1,name: "迅捷药水",info:"战斗中增加英雄速度", },
|
||||
}
|
||||
|
||||
9
assets/script/game/common/config/Items.ts.meta
Normal file
9
assets/script/game/common/config/Items.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "49217bd4-ee11-49f7-b404-e8d40478fa2d",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ export const BossList = {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const MissionSet = {
|
||||
1:{
|
||||
lv1_num:10,
|
||||
@@ -48,5 +49,11 @@ export const MissionSet = {
|
||||
lv4_skill_num:10,
|
||||
lv5_skill_num:10,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export const MissionReward = {
|
||||
1:[1001,1002,1003,1004,1005],
|
||||
2:[1001],
|
||||
3:[1001],
|
||||
}
|
||||
export const MissionReward = []
|
||||
@@ -14,7 +14,7 @@ import { LoadingViewComp } from "./view/LoadingViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { MonSet, HeroSet } from "../common/config/heroSet";
|
||||
import { SkillSet } from "../common/config/SkillSet";
|
||||
import { Items } from "../common/config/ItemSet";
|
||||
import { Sitems } from "../common/config/ItemSet";
|
||||
|
||||
// import {data} from "../data/data";
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ export class Initialize extends ecs.Entity {
|
||||
smc.monsters=MonSet;
|
||||
// console.log("加载完成!",smc.heros);
|
||||
smc.skills=SkillSet;
|
||||
smc.items=Items;
|
||||
smc.sitems=Sitems;
|
||||
var uic: UICallbacks = {
|
||||
onAdded: (node: Node, params: any) => {
|
||||
var comp = node.getComponent(LoadingViewComp) as ecs.Comp;
|
||||
|
||||
@@ -157,18 +157,18 @@ export class CardControllerComp extends CCComp {
|
||||
// console.log("show_info",uuid)
|
||||
let node =this.node.getChildByName("item_box")
|
||||
if(type == 2){
|
||||
smc.vm_data.item_box.info = smc.items[uuid].info
|
||||
smc.vm_data.item_box.name = smc.items[uuid].name
|
||||
smc.vm_data.item_box.skillcd = smc.items[uuid].cd
|
||||
smc.vm_data.item_box.skillsd = smc.items[uuid].sd
|
||||
smc.vm_data.item_box.atk = smc.items[uuid].atk
|
||||
smc.vm_data.item_box.hp = smc.items[uuid].hp
|
||||
smc.vm_data.item_box.shield = smc.items[uuid].shield
|
||||
smc.vm_data.item_box.info = smc.sitems[uuid].info
|
||||
smc.vm_data.item_box.name = smc.sitems[uuid].name
|
||||
smc.vm_data.item_box.skillcd = smc.sitems[uuid].cd
|
||||
smc.vm_data.item_box.skillsd = smc.sitems[uuid].sd
|
||||
smc.vm_data.item_box.atk = smc.sitems[uuid].atk
|
||||
smc.vm_data.item_box.hp = smc.sitems[uuid].hp
|
||||
smc.vm_data.item_box.shield = smc.sitems[uuid].shield
|
||||
node.active=true
|
||||
if(smc.items[uuid].shield > 0){
|
||||
if(smc.sitems[uuid].shield > 0){
|
||||
node.getChildByName("data").getChildByName("shield").active=true
|
||||
}
|
||||
if(smc.items[uuid].hp > 0){
|
||||
if(smc.sitems[uuid].hp > 0){
|
||||
node.getChildByName("data").getChildByName("hp").active=true
|
||||
}
|
||||
}
|
||||
@@ -272,7 +272,7 @@ export class CardControllerComp extends CCComp {
|
||||
// let level: number = 0;
|
||||
// let { uuid, type } = card[0];
|
||||
// url = "game/heros/skill";
|
||||
// ({ path: pathName, name, level } = smc.items[uuid]);
|
||||
// ({ path: pathName, name, level } = smc.sitems[uuid]);
|
||||
// this.cards[index].lv=level
|
||||
// let node=this.node.getChildByName('cards').getChildByName('card'+index)
|
||||
// node.getChildByName('cost').getComponent(Label).string=level.toString()
|
||||
|
||||
@@ -55,18 +55,18 @@ export class CardControllerComp extends CCComp {
|
||||
// console.log("show_info",uuid)
|
||||
let node =this.node.getChildByName("item_box")
|
||||
if(type == 2){
|
||||
smc.vm_data.item_box.info = smc.items[uuid].info
|
||||
smc.vm_data.item_box.name = smc.items[uuid].name
|
||||
smc.vm_data.item_box.skillcd = smc.items[uuid].cd
|
||||
smc.vm_data.item_box.skillsd = smc.items[uuid].sd
|
||||
smc.vm_data.item_box.atk = smc.items[uuid].atk
|
||||
smc.vm_data.item_box.hp = smc.items[uuid].hp
|
||||
smc.vm_data.item_box.shield = smc.items[uuid].shield
|
||||
smc.vm_data.item_box.info = smc.sitems[uuid].info
|
||||
smc.vm_data.item_box.name = smc.sitems[uuid].name
|
||||
smc.vm_data.item_box.skillcd = smc.sitems[uuid].cd
|
||||
smc.vm_data.item_box.skillsd = smc.sitems[uuid].sd
|
||||
smc.vm_data.item_box.atk = smc.sitems[uuid].atk
|
||||
smc.vm_data.item_box.hp = smc.sitems[uuid].hp
|
||||
smc.vm_data.item_box.shield = smc.sitems[uuid].shield
|
||||
node.active=true
|
||||
if(smc.items[uuid].shield > 0){
|
||||
if(smc.sitems[uuid].shield > 0){
|
||||
node.getChildByName("data").getChildByName("shield").active=true
|
||||
}
|
||||
if(smc.items[uuid].hp > 0){
|
||||
if(smc.sitems[uuid].hp > 0){
|
||||
node.getChildByName("data").getChildByName("hp").active=true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,14 +41,14 @@ export class MapSkillComp extends CCComp {
|
||||
}
|
||||
useItem(event: string, args: any){
|
||||
console.log("useItem");
|
||||
if(smc.items[args.uuid].hp > 0){ //buff加血
|
||||
smc.Role.RoleView.add_hp(smc.items[args.uuid].hp)
|
||||
if(smc.sitems[args.uuid].hp > 0){ //buff加血
|
||||
smc.Role.RoleView.add_hp(smc.sitems[args.uuid].hp)
|
||||
}
|
||||
if(smc.items[args.uuid].atk > 0){ //buff加攻击
|
||||
smc.Role.RoleView.add_atk(smc.items[args.uuid].atk,smc.items[args.uuid].sd)
|
||||
if(smc.sitems[args.uuid].atk > 0){ //buff加攻击
|
||||
smc.Role.RoleView.add_atk(smc.sitems[args.uuid].atk,smc.sitems[args.uuid].sd)
|
||||
}
|
||||
if(smc.items[args.uuid].shield > 0){ //buff护盾
|
||||
smc.Role.RoleView.add_shield(smc.items[args.uuid].shield,smc.items[args.uuid].sd)
|
||||
if(smc.sitems[args.uuid].shield > 0){ //buff护盾
|
||||
smc.Role.RoleView.add_shield(smc.sitems[args.uuid].shield,smc.sitems[args.uuid].sd)
|
||||
}
|
||||
}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { _decorator } from "cc";
|
||||
import { _decorator, Label } 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";
|
||||
@@ -7,6 +7,9 @@ import { MonViewComp } from "../mon/MonViewComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { RoleViewComp } from "../Role/RoleViewComp";
|
||||
import { BossViewComp } from "../Boss/BossViewComp";
|
||||
import { RandomManager } from "../../../../extensions/oops-plugin-framework/assets/core/common/random/RandomManager";
|
||||
import { MissionReward } from "../common/config/MissionSet";
|
||||
import { Items } from "../common/config/Items";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -14,6 +17,9 @@ const { ccclass, property } = _decorator;
|
||||
@ccclass('VictoryComp')
|
||||
@ecs.register('Victory', false)
|
||||
export class VictoryComp extends CCComp {
|
||||
reward_lv:number=1
|
||||
reward_num:number=2
|
||||
rerawd_item:any={}
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
// console.log("VictoryComp start")
|
||||
@@ -28,24 +34,34 @@ export class VictoryComp extends CCComp {
|
||||
smc.vm_data.role.mission += 1
|
||||
}
|
||||
this.node.getChildByName("Node").active = true;
|
||||
this.getReward()
|
||||
this.node.getChildByName("Node").getChildByName("defeat").active = false
|
||||
this.node.getChildByName("Node").getChildByName("victory").active = true;
|
||||
}
|
||||
private do_defeat() {
|
||||
smc.vm_data.mission.play=false
|
||||
this.node.getChildByName("Node").active = true;
|
||||
this.getReward()
|
||||
this.node.getChildByName("Node").getChildByName("victory").active = false;
|
||||
this.node.getChildByName("Node").getChildByName("defeat").active = true
|
||||
}
|
||||
getReward(){
|
||||
let reward:any = RandomManager.instance.getRandomByObjectList(MissionReward[this.reward_lv], 1);
|
||||
this.rerawd_item =Items[reward[0]]
|
||||
// console.log("getReward:",this.rerawd_item)
|
||||
this.node.getChildByName("Node").getChildByName("item3").getChildByName("num").getComponent(Label).string=this.reward_num.toString()
|
||||
}
|
||||
end_mission(){
|
||||
this.node.getChildByName("Node").active=false
|
||||
smc.vm_data.role.gold += smc.vm_data.mission.reward_gold
|
||||
smc.vm_data.role.exp += smc.vm_data.mission.reward_exp
|
||||
smc.vm_data.role.items[this.rerawd_item.uuid].num += this.reward_num
|
||||
|
||||
smc.vm_data.mission.reward_gold=0
|
||||
smc.vm_data.mission.reward_exp=0
|
||||
this.empty_mission()
|
||||
oops.message.dispatchEvent("to_mission")
|
||||
console.log("end_mission")
|
||||
console.log("end_mission",smc.vm_data.role.items)
|
||||
}
|
||||
empty_mission(){
|
||||
let monsters:any= ecs.query(ecs.allOf(MonViewComp));
|
||||
|
||||
Reference in New Issue
Block a user