游戏开始 初始技能功能 继续完善
This commit is contained in:
File diff suppressed because it is too large
Load Diff
BIN
assets/resources/game/map/fight.png
Normal file
BIN
assets/resources/game/map/fight.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.3 MiB |
134
assets/resources/game/map/fight.png.meta
Normal file
134
assets/resources/game/map/fight.png.meta
Normal file
@@ -0,0 +1,134 @@
|
||||
{
|
||||
"ver": "1.0.26",
|
||||
"importer": "image",
|
||||
"imported": true,
|
||||
"uuid": "54219dd5-9c84-44bb-bdb4-600587548f2c",
|
||||
"files": [
|
||||
".json",
|
||||
".png"
|
||||
],
|
||||
"subMetas": {
|
||||
"6c48a": {
|
||||
"importer": "texture",
|
||||
"uuid": "54219dd5-9c84-44bb-bdb4-600587548f2c@6c48a",
|
||||
"displayName": "fight",
|
||||
"id": "6c48a",
|
||||
"name": "texture",
|
||||
"userData": {
|
||||
"wrapModeS": "clamp-to-edge",
|
||||
"wrapModeT": "clamp-to-edge",
|
||||
"minfilter": "linear",
|
||||
"magfilter": "linear",
|
||||
"mipfilter": "none",
|
||||
"anisotropy": 0,
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "54219dd5-9c84-44bb-bdb4-600587548f2c",
|
||||
"visible": false
|
||||
},
|
||||
"ver": "1.0.22",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
},
|
||||
"f9941": {
|
||||
"importer": "sprite-frame",
|
||||
"uuid": "54219dd5-9c84-44bb-bdb4-600587548f2c@f9941",
|
||||
"displayName": "fight",
|
||||
"id": "f9941",
|
||||
"name": "spriteFrame",
|
||||
"userData": {
|
||||
"trimType": "auto",
|
||||
"trimThreshold": 1,
|
||||
"rotated": false,
|
||||
"offsetX": 0,
|
||||
"offsetY": 0,
|
||||
"trimX": 0,
|
||||
"trimY": 0,
|
||||
"width": 736,
|
||||
"height": 1312,
|
||||
"rawWidth": 736,
|
||||
"rawHeight": 1312,
|
||||
"borderTop": 0,
|
||||
"borderBottom": 0,
|
||||
"borderLeft": 0,
|
||||
"borderRight": 0,
|
||||
"packable": true,
|
||||
"pixelsToUnit": 100,
|
||||
"pivotX": 0.5,
|
||||
"pivotY": 0.5,
|
||||
"meshType": 0,
|
||||
"vertices": {
|
||||
"rawPosition": [
|
||||
-368,
|
||||
-656,
|
||||
0,
|
||||
368,
|
||||
-656,
|
||||
0,
|
||||
-368,
|
||||
656,
|
||||
0,
|
||||
368,
|
||||
656,
|
||||
0
|
||||
],
|
||||
"indexes": [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
2,
|
||||
1,
|
||||
3
|
||||
],
|
||||
"uv": [
|
||||
0,
|
||||
1312,
|
||||
736,
|
||||
1312,
|
||||
0,
|
||||
0,
|
||||
736,
|
||||
0
|
||||
],
|
||||
"nuv": [
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"minPos": [
|
||||
-368,
|
||||
-656,
|
||||
0
|
||||
],
|
||||
"maxPos": [
|
||||
368,
|
||||
656,
|
||||
0
|
||||
]
|
||||
},
|
||||
"isUuid": true,
|
||||
"imageUuidOrDatabaseUri": "54219dd5-9c84-44bb-bdb4-600587548f2c@6c48a",
|
||||
"atlasUuid": ""
|
||||
},
|
||||
"ver": "1.0.12",
|
||||
"imported": true,
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {}
|
||||
}
|
||||
},
|
||||
"userData": {
|
||||
"hasAlpha": false,
|
||||
"type": "sprite-frame",
|
||||
"fixAlphaTransparencyArtifacts": false,
|
||||
"redirect": "54219dd5-9c84-44bb-bdb4-600587548f2c@f9941"
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -13,13 +13,13 @@ export enum GameEvent {
|
||||
LoginSuccess = "LoginSuccess",
|
||||
MSSelected = "MSSelected",
|
||||
CastSkill = "CastSkill",
|
||||
CardsClose = "CardsClose",
|
||||
CardRefresh = "CardRefresh",
|
||||
CardRefreshEnd = "CardRefreshEnd",
|
||||
UseCard = "UseCard",
|
||||
UseHeroCard = "UseHeroCard",
|
||||
UseSkillCard = "UseSkillCard",
|
||||
CallHero = "CallHero",
|
||||
MissionSkill = "MissionSkill",
|
||||
MissionLoss = "MissionLoss",
|
||||
MissionWin = "MissionWin",
|
||||
MissionStart = "MissionStart",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
export const MSklist = [6001,6002]
|
||||
|
||||
export enum TargetGroup {
|
||||
Self = 0, // 自身
|
||||
Ally = 1, // 友方单位
|
||||
@@ -77,6 +77,7 @@ hero:召唤物英雄id
|
||||
info:技能描述
|
||||
|
||||
*/
|
||||
export const HeroSkillList = [6001,6002,6003,6004,6005]
|
||||
export const SkillSet = {
|
||||
6001:{uuid:6001,name:"凛冬之触",sp_name:"ball_blue",path:"6001",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:720,sonsk:0,hero:0,info:"向最前方敌人释放寒冰弹,造成100%攻击的伤害"},
|
||||
6002:{uuid:6002,name:"烈焰之怒",sp_name:"ball_red",path:"6002",TargetType:1,TargetGroup:3,act:"atk",CdType:1,AnimType:0,endType:3,fname:"max",flash:false,with:50,debuff:0,depb:0,debtime:0,derate:0,in:0.8,count:1,def:0,apup:0,ap:100,mhp:0,hp:0,cd:5,buff_cd:1,hited:0.3,shield:0,speed:720,sonsk:0,hero:0,info:"向最前方敌人释放火焰弹,造成100%攻击的伤害"},
|
||||
|
||||
@@ -8,6 +8,7 @@ import { oops } from "db://oops-framework/core/Oops";
|
||||
import { HeroModelComp } from "../hero/HeroModelComp";
|
||||
import { HeroViewComp } from "../hero/HeroViewComp";
|
||||
import { smc } from "../common/SingletonModuleComp";
|
||||
import { HeroSkillList, SkillSet } from "../common/config/SkillSet";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@@ -16,35 +17,58 @@ const { ccclass, property } = _decorator;
|
||||
@ecs.register('Card', false)
|
||||
export class CardComp extends CCComp {
|
||||
c_uuid:number=0;
|
||||
c_type:number=0;
|
||||
c_type:number=0; //0英雄,1 技能.2 装备
|
||||
is_used:boolean=false;
|
||||
|
||||
onLoad(){
|
||||
this.on(GameEvent.HeroSelect,this.onCardRefresh,this)
|
||||
this.on(GameEvent.HeroSkillSelect,this.onCardRefresh,this)
|
||||
this.on(GameEvent.HeroSelect,this.onHeroSelect,this)
|
||||
this.on(GameEvent.HeroSkillSelect,this.onHeroSkillSelect,this)
|
||||
this.on(GameEvent.CardRefresh,this.onCardRefresh,this)
|
||||
}
|
||||
|
||||
start() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
init_card(){
|
||||
this.node.getChildByName("Button").active=false
|
||||
this.node.getChildByName("show").active=false
|
||||
}
|
||||
onHeroSelect(event: string, args: any){
|
||||
|
||||
}
|
||||
onHeroSkillSelect(event: string, args: any){
|
||||
|
||||
}
|
||||
onCardRefresh(event: string, args: any){
|
||||
this.c_type=0
|
||||
let hero_list =HeroList
|
||||
let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
|
||||
this.c_uuid=hero_list[x]
|
||||
console.log("onCardRefresh c_uuid:"+this.c_uuid)
|
||||
this.update_card(this.c_uuid)
|
||||
this.show_hero(this.c_uuid)
|
||||
this.node.getChildByName("show").active=false
|
||||
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
|
||||
this.scheduleOnce(() => {
|
||||
this.node.getChildByName("show").active=true
|
||||
this.node.getChildByName("Button").active=true
|
||||
}, 0.1);
|
||||
}
|
||||
onHeroSkillSelect(event: string, args: any){
|
||||
this.c_type=1
|
||||
console.log("card onHeroSkillSelect")
|
||||
let skill_list =HeroSkillList
|
||||
let x=RandomManager.instance.getRandomInt(0,skill_list.length,1)
|
||||
this.c_uuid=skill_list[x]
|
||||
this.node.getChildByName("show").active=false
|
||||
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
|
||||
this.show_skill(this.c_uuid)
|
||||
this.scheduleOnce(() => {
|
||||
this.node.getChildByName("show").active=true
|
||||
this.node.getChildByName("Button").active=true
|
||||
}, 0.1);
|
||||
}
|
||||
onCardRefresh(event: string, args: any){
|
||||
this.c_type=0
|
||||
let hero_list =HeroList
|
||||
let x=RandomManager.instance.getRandomInt(0,hero_list.length,1)
|
||||
this.c_uuid=hero_list[x]
|
||||
// console.log("onCardRefresh c_uuid:"+this.c_uuid)
|
||||
this.show_hero(this.c_uuid)
|
||||
this.node.getChildByName("show").active=false
|
||||
this.node.getChildByName("anim").getChildByName("up").getComponent(Animation).play('carsup')
|
||||
this.scheduleOnce(() => {
|
||||
@@ -53,15 +77,31 @@ export class CardComp extends CCComp {
|
||||
}, 0.1);
|
||||
|
||||
}
|
||||
update_card(uuid:number){
|
||||
show_skill(uuid:number){
|
||||
let show=this.node.getChildByName("show")
|
||||
show.getChildByName("name").getComponent(Label).string=SkillSet[uuid].name
|
||||
show.getChildByName("ap").active=false
|
||||
show.getChildByName("hp").active=false
|
||||
show.getChildByName("mask").getChildByName("skill").active=true
|
||||
var icon_path = "game/skills/skill_icon"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = show.getChildByName("mask").getChildByName("skill").getComponent(Sprite);
|
||||
sprite.spriteFrame = atlas.getSpriteFrame(SkillSet[uuid].path);
|
||||
});
|
||||
this.node.getChildByName("Button").getChildByName("Label").getComponent(Label).string=this.check_heros()
|
||||
}
|
||||
show_hero(uuid:number){
|
||||
let show=this.node.getChildByName("show")
|
||||
show.getChildByName("ap").active=true
|
||||
show.getChildByName("hp").active=true
|
||||
show.getChildByName("mask").getChildByName("skill").active=false
|
||||
show.getChildByName("name").getComponent(Label).string=HeroInfo[uuid].name
|
||||
show.getChildByName("ap").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].ap.toString()
|
||||
show.getChildByName("hp").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].hp.toString()
|
||||
show.getChildByName("type").getChildByName("war").active=HeroInfo[uuid].type==0
|
||||
show.getChildByName("type").getChildByName("bow").active=HeroInfo[uuid].type==1
|
||||
show.getChildByName("type").getChildByName("mag").active=HeroInfo[uuid].type==2
|
||||
show.getChildByName("lv").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].lv.toString()
|
||||
// show.getChildByName("type").getChildByName("war").active=HeroInfo[uuid].type==0
|
||||
// show.getChildByName("type").getChildByName("bow").active=HeroInfo[uuid].type==1
|
||||
// show.getChildByName("type").getChildByName("mag").active=HeroInfo[uuid].type==2
|
||||
// show.getChildByName("lv").getChildByName("num").getComponent(Label).string=HeroInfo[uuid].lv.toString()
|
||||
var icon_path = "game/heros/herois"
|
||||
resources.load(icon_path, SpriteAtlas, (err: any, atlas) => {
|
||||
const sprite = show.getChildByName("mask").getChildByName("icon").getComponent(Sprite);
|
||||
@@ -90,12 +130,16 @@ export class CardComp extends CCComp {
|
||||
}
|
||||
oops.message.dispatchEvent(GameEvent.UseHeroCard,{uuid:this.c_uuid})
|
||||
smc.vmdata.mission_data.gold-=smc.vmdata.mission_data.call_gold
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
case 1:
|
||||
console.log("use_card 技能卡")
|
||||
oops.message.dispatchEvent(GameEvent.UseSkillCard,{uuid:this.c_uuid})
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
case 2:
|
||||
oops.message.dispatchEvent(GameEvent.UseCard,{uuid:this.c_uuid})
|
||||
oops.message.dispatchEvent(GameEvent.CardsClose)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const { ccclass, property } = _decorator;
|
||||
@ecs.register('CardsComp', false)
|
||||
export class CardsCompComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
start() {
|
||||
onLoad() {
|
||||
// var entity = this.ent as ecs.Entity; // ecs.Entity 可转为当前模块的具体实体对象
|
||||
this.on(GameEvent.HeroSkillSelect, this.show, this);
|
||||
this.on(GameEvent.HeroSkillSelectEnd, this.hide, this);
|
||||
@@ -18,14 +18,17 @@ export class CardsCompComp extends CCComp {
|
||||
this.on(GameEvent.HeroSelectEnd, this.hide, this);
|
||||
this.on(GameEvent.CardRefresh, this.show, this);
|
||||
this.on(GameEvent.CardRefreshEnd, this.hide, this);
|
||||
this.on(GameEvent.CardsClose, this.hide, this);
|
||||
}
|
||||
|
||||
show(){
|
||||
show(e:GameEvent,data:any){
|
||||
this.node.setPosition(v3(0,640,0))
|
||||
console.log("cards show",e,this.node.position)
|
||||
}
|
||||
|
||||
hide(){
|
||||
hide(e:GameEvent,data:any){
|
||||
this.node.setPosition(v3(0,-1000,0))
|
||||
console.log("cards hide",e,this.node.position)
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
|
||||
29
assets/script/game/map/EquipsComp.ts
Normal file
29
assets/script/game/map/EquipsComp.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { _decorator } 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 { GameEvent } from "../common/config/GameEvent";
|
||||
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
/** 视图层对象 */
|
||||
@ccclass('EquipsCompComp')
|
||||
@ecs.register('EquipsComp', false)
|
||||
export class EquipsCompComp extends CCComp {
|
||||
/** 视图层逻辑代码分离演示 */
|
||||
onLoad() {
|
||||
this.on(GameEvent.UseSkillCard, this.get_skill, this);
|
||||
}
|
||||
|
||||
update(dt: number): void {
|
||||
|
||||
}
|
||||
|
||||
get_skill(){
|
||||
console.log("get_skill")
|
||||
}
|
||||
|
||||
/** 视图对象通过 ecs.Entity.remove(ModuleViewComp) 删除组件是触发组件处理自定义释放逻辑 */
|
||||
reset() {
|
||||
this.node.destroy();
|
||||
}
|
||||
}
|
||||
9
assets/script/game/map/EquipsComp.ts.meta
Normal file
9
assets/script/game/map/EquipsComp.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b316181b-0323-4100-8d4d-4b68529d3c19",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -61,10 +61,16 @@ export class MissionComp extends CCComp {
|
||||
this.node.active=true
|
||||
this.data_init()
|
||||
this.hart_hero_load()
|
||||
this.to_hero_skill_select()
|
||||
let loading=this.node.parent.getChildByName("loading")
|
||||
loading.active=true
|
||||
this.scheduleOnce(()=>{
|
||||
this.to_hero_skill_select()
|
||||
loading.active=false
|
||||
},0.5)
|
||||
}
|
||||
|
||||
to_hero_skill_select(){
|
||||
console.log("英雄技能选择")
|
||||
oops.message.dispatchEvent(GameEvent.HeroSkillSelect)
|
||||
}
|
||||
|
||||
@@ -94,6 +100,7 @@ export class MissionComp extends CCComp {
|
||||
}
|
||||
data_init(){
|
||||
//局内数据初始化
|
||||
console.log("局内数据初始化")
|
||||
this.GlodAddTimer=new Timer(smc.vmdata.mission_data.refrsh_time)
|
||||
smc.mission.status=1
|
||||
smc.mission.play = true;
|
||||
|
||||
Reference in New Issue
Block a user