mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交地图
This commit is contained in:
@@ -28,12 +28,12 @@ import AppAction from "./AppAction";
|
||||
import { Asset } from "cc";
|
||||
import { Component } from "cc";
|
||||
|
||||
let APIPath = `http://localhost:8080`
|
||||
let WsPath = `ws://localhost:8080/websocket`
|
||||
// let APIPath = `http://localhost:8080`
|
||||
// let WsPath = `ws://localhost:8080/websocket`
|
||||
// let APIPath = `http://192.168.1.23:8080`
|
||||
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
||||
// let APIPath = `http://192.168.0.122:8080`
|
||||
// let WsPath = `ws://192.168.0.122:8080/websocket`
|
||||
let APIPath = `http://192.168.0.116:8080`
|
||||
let WsPath = `ws://192.168.0.116:8080/websocket`
|
||||
// let APIPath = `https://api.pet.jisol.cn`
|
||||
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||
|
||||
|
@@ -81,7 +81,8 @@ export default class GRoleDefault extends GRoleBase<{}>{
|
||||
//监听攻击
|
||||
this.fsmAnim.addEventListener(GRoleAnimEvent.Attack,this.onAttack.bind(this));
|
||||
//监听死亡击飞
|
||||
this.fsmAnim.addStartListener(GPetAminEnum.Fly,this.onFly.bind(this));
|
||||
// this.fsmAnim.addStartListener(GPetAminEnum.Fly,this.onFly.bind(this));
|
||||
this.killBack.push(this.onFly.bind(this));
|
||||
}
|
||||
|
||||
//初始化
|
||||
@@ -106,7 +107,10 @@ export default class GRoleDefault extends GRoleBase<{}>{
|
||||
//设置血条位置
|
||||
if(this.spine){
|
||||
let runtimeData = this.spine.skeletonData.getRuntimeData();
|
||||
let headY = (runtimeData.height + runtimeData.y + 20) * this.spine.node.scale.x;
|
||||
let height = Math.abs(runtimeData.height);
|
||||
let y = Math.abs(runtimeData.y);
|
||||
let x = Math.abs(this.spine.node.scale.x);
|
||||
let headY = (height + y + 20) * x;
|
||||
this.headInfo.setPosition(v3(this.headInfo.position.x,headY,this.headInfo.position.z))
|
||||
}
|
||||
|
||||
@@ -155,7 +159,7 @@ export default class GRoleDefault extends GRoleBase<{}>{
|
||||
this.JTween(vWorld)
|
||||
.to({x:vEndWorld.x},1200)
|
||||
.onUpdate(pos => {
|
||||
if(this.node.isValid)
|
||||
if(this.node && this.node.isValid)
|
||||
this.node.worldPosition = pos;
|
||||
})
|
||||
.start();
|
||||
@@ -163,7 +167,7 @@ export default class GRoleDefault extends GRoleBase<{}>{
|
||||
.to({y:vEndWorld.y},1200)
|
||||
.easing(JEasing.Circular.Out)
|
||||
.onUpdate(pos => {
|
||||
if(this.node.isValid)
|
||||
if(this.node && this.node.isValid)
|
||||
this.node.worldPosition = vWorld
|
||||
})
|
||||
.start();
|
||||
|
@@ -7,7 +7,7 @@ import GBaseMode from "../GBaseMode";
|
||||
import { Prefab } from "cc";
|
||||
import { instantiate } from "cc";
|
||||
import GRoleCGCrystal from "../base/role/CampGuardian/GRoleCGCrystal";
|
||||
import { TD } from "../../App";
|
||||
import { TD, app } from "../../App";
|
||||
import { GTowards } from "../base/GObject";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
import { GTactical } from "../entity/GTactical";
|
||||
@@ -16,6 +16,8 @@ import { TbGPetId } from "../../config/TbGPet";
|
||||
import GModeTools from "./GModeTools";
|
||||
import GPetAttribute from "../base/values/attribute/role/GPetAttribute";
|
||||
import RandomUtil from "../../../../extensions/ngame/assets/ngame/util/RandomUtil";
|
||||
import { GModeEvent } from "./GMode";
|
||||
import { Camera } from "cc";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//阵营守护 角色
|
||||
@@ -51,6 +53,10 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
|
||||
//敌方宠物
|
||||
enemyRoles: GRoleBase<{}>[] = [];
|
||||
|
||||
//模式相机
|
||||
@property(Camera)
|
||||
modeCamera:Camera;
|
||||
|
||||
onSyncInitSuccess(){
|
||||
|
||||
//生成水晶
|
||||
@@ -127,8 +133,8 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
|
||||
petStar:0,
|
||||
petStarExp:0,
|
||||
}));
|
||||
// //绑定受击回调
|
||||
// entity.addHitCallback(this.onHitBack.bind(this));
|
||||
//绑定受击回调
|
||||
entity.addHitCallback(this.onHitBack.bind(this));
|
||||
|
||||
this.addGObject(entity,pos);
|
||||
this.getOnesRole(type).push(entity);
|
||||
@@ -158,6 +164,22 @@ export default class GCampGuardianMode extends GBaseMode<{},{}>{
|
||||
},3000)
|
||||
|
||||
}
|
||||
|
||||
//角色受击回调
|
||||
onHitBack(role:GRoleDefault,hit:number){
|
||||
|
||||
if(!role.get()) return;
|
||||
|
||||
//添加受击显示
|
||||
app.event.emit(GModeEvent.HIT,{
|
||||
mode:this,
|
||||
role:role,
|
||||
hit:hit,
|
||||
world:role.v2World,
|
||||
camera:this.modeCamera,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
17
JisolGameCocos/assets/script/battle/modes/GMode.ts
Normal file
17
JisolGameCocos/assets/script/battle/modes/GMode.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { Vec2 } from "cc";
|
||||
import GBaseMode from "../GBaseMode";
|
||||
import GRoleBase from "../base/role/GRoleBase";
|
||||
import { Camera } from "cc";
|
||||
|
||||
export interface GModeHitInfo{
|
||||
mode:GBaseMode<{},{}>, //模式
|
||||
role:GRoleBase<{}>, //宠物
|
||||
hit:number, //受击
|
||||
world:Vec2, //世界坐标
|
||||
camera:Camera, //相机
|
||||
}
|
||||
|
||||
export enum GModeEvent{
|
||||
//受击通知
|
||||
HIT = "ModeRenderEvent_HIT"
|
||||
}
|
9
JisolGameCocos/assets/script/battle/modes/GMode.ts.meta
Normal file
9
JisolGameCocos/assets/script/battle/modes/GMode.ts.meta
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "b9fffb62-4b14-48cb-85fe-51ab780f49c0",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@@ -15,7 +15,7 @@ import { TD, app } from "../../App";
|
||||
import { v3 } from "cc";
|
||||
import { v2 } from "cc";
|
||||
import GFSMOnHookMode from "./OnHook/GFSMOnHookMode";
|
||||
import { TB } from "../../config/data/schema";
|
||||
import { TB, TbGEntity } from "../../config/data/schema";
|
||||
import PlayerTacticalData, { PlayerTacticalEvent } from "../../data/PlayerTacticalData";
|
||||
import GRoleOnHookPlayerExpand from "../base/role/expand/OnHook/GRoleOnHookPlayerExpand";
|
||||
import PlayerPetData from "../../data/PlayerPetData";
|
||||
@@ -23,10 +23,10 @@ import { GUI } from "../../ui/UIConfig";
|
||||
import { GOnHookPet, GOnHookPets } from "../../../../extensions/ngame/assets/ngame/message/proto";
|
||||
import GOnHookManager, { GOnHookManagerEvent } from "../../manager/battle/mode/GOnHookManager";
|
||||
import GRoleOnHookCreepsExpand from "../base/role/expand/OnHook/GRoleOnHookCreepsExpand";
|
||||
import { ModeRenderEvent } from "../../ui/Consts/Game/ModeRender";
|
||||
import GPetAttribute from "../base/values/attribute/role/GPetAttribute";
|
||||
import GDefaultMode from "./default/GDefaultMode";
|
||||
import GOnHookData from "../../data/GOnHookData";
|
||||
import { GModeEvent, GModeHitInfo } from "./GMode";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//挂机模式状态
|
||||
@@ -262,7 +262,7 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
petId:0,
|
||||
petPlayerId:0,
|
||||
petTbId:creeps.petTbId,
|
||||
petLevel:0,
|
||||
petLevel:creeps.petLevel,
|
||||
petStar:0,
|
||||
petStarExp:0,
|
||||
}));
|
||||
@@ -357,7 +357,13 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
//获取敌人
|
||||
let creeps = GOnHookManager.getIns().getNextCreeps();
|
||||
if(!creeps) return; //没有获取到野怪则返回
|
||||
this.onGenCreeps(2,creeps);
|
||||
|
||||
let sign = TD.TbGOnHookMaps.get(GOnHookData.getIns().info.onHookMap).sign;
|
||||
let table:{data:TbGEntity.TOnHookLevel} = TD[sign].get(GOnHookData.getIns().info.levelId);
|
||||
|
||||
for (let index = 0; index < table.data.petSize; index++) {
|
||||
this.onGenCreeps(index + 1,creeps);
|
||||
}
|
||||
// this.enemyInfo.roles.forEach((info,index) => this.onGenRole(GOnHookModePlayerEnum.ENEMY,index + 1,info));
|
||||
}
|
||||
|
||||
@@ -385,7 +391,13 @@ export default class GOnHookMode extends GDefaultMode<{},{}>{
|
||||
if(!role.get()) return;
|
||||
|
||||
//添加受击显示
|
||||
app.event.emit(ModeRenderEvent.HIT,role.v2World.clone(),hit);
|
||||
app.event.emit(GModeEvent.HIT,{
|
||||
mode:this,
|
||||
role:role,
|
||||
hit:hit,
|
||||
world:role.v2World,
|
||||
camera:this.camera,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@@ -11,10 +11,10 @@ import { TB } from "../../config/data/schema";
|
||||
import JNFrameTime from "../../../../extensions/ngame/assets/ngame/sync/frame/game/time/JNFrameTime";
|
||||
import GBattleModeManager from "../GBattleModeManager";
|
||||
import { app, TD } from "../../App";
|
||||
import { ModeRenderEvent } from "../../ui/Consts/Game/ModeRender";
|
||||
import { GPVPStart } from "../../action/PVPAction";
|
||||
import { PlayerPetOV } from "../../consts/API";
|
||||
import GPetAttribute from "../base/values/attribute/role/GPetAttribute";
|
||||
import { GModeEvent } from "./GMode";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
//PVP 角色
|
||||
@@ -241,7 +241,13 @@ export default class GPVPMode extends GBaseMode<{},GPVPStart>{
|
||||
if(!role.get()) return;
|
||||
|
||||
//添加受击显示
|
||||
app.event.emit(ModeRenderEvent.HIT,role.v2World.clone(),hit);
|
||||
app.event.emit(GModeEvent.HIT,{
|
||||
mode:this,
|
||||
role:role,
|
||||
hit:hit,
|
||||
world:role.v2World,
|
||||
camera:this.camera,
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
@@ -589,7 +589,7 @@ export class TbGOnHookMaps {
|
||||
|
||||
|
||||
export namespace TB {
|
||||
export class TbGOnHookMap1 {
|
||||
export class TbGOnHookMap120001 {
|
||||
|
||||
constructor(_json_: any) {
|
||||
if (_json_.id === undefined) { throw new Error() }
|
||||
@@ -624,8 +624,12 @@ export class TOnHookLevel {
|
||||
constructor(_json_: any) {
|
||||
if (_json_.level === undefined) { throw new Error() }
|
||||
this.level = _json_.level
|
||||
if (_json_.childLevel === undefined) { throw new Error() }
|
||||
this.childLevel = _json_.childLevel
|
||||
if (_json_.petLevel === undefined) { throw new Error() }
|
||||
this.petLevel = _json_.petLevel
|
||||
if (_json_.petSize === undefined) { throw new Error() }
|
||||
this.petSize = _json_.petSize
|
||||
if (_json_.oddsId === undefined) { throw new Error() }
|
||||
this.oddsId = _json_.oddsId
|
||||
}
|
||||
@@ -634,10 +638,18 @@ export class TOnHookLevel {
|
||||
* 关卡等级
|
||||
*/
|
||||
readonly level: number
|
||||
/**
|
||||
* 子关卡等级
|
||||
*/
|
||||
readonly childLevel: number
|
||||
/**
|
||||
* 宠物等级
|
||||
*/
|
||||
readonly petLevel: number
|
||||
/**
|
||||
* 宠物数量
|
||||
*/
|
||||
readonly petSize: number
|
||||
/**
|
||||
* 概率Id
|
||||
*/
|
||||
@@ -1140,24 +1152,24 @@ export class TbGOnHookMaps{
|
||||
|
||||
|
||||
|
||||
export class TbGOnHookMap1{
|
||||
private _dataMap: Map<number, TB.TbGOnHookMap1>
|
||||
private _dataList: TB.TbGOnHookMap1[]
|
||||
export class TbGOnHookMap120001{
|
||||
private _dataMap: Map<number, TB.TbGOnHookMap120001>
|
||||
private _dataList: TB.TbGOnHookMap120001[]
|
||||
constructor(_json_: any) {
|
||||
this._dataMap = new Map<number, TB.TbGOnHookMap1>()
|
||||
this._dataMap = new Map<number, TB.TbGOnHookMap120001>()
|
||||
this._dataList = []
|
||||
for(var _json2_ of _json_) {
|
||||
let _v: TB.TbGOnHookMap1
|
||||
_v = new TB.TbGOnHookMap1(_json2_)
|
||||
let _v: TB.TbGOnHookMap120001
|
||||
_v = new TB.TbGOnHookMap120001(_json2_)
|
||||
this._dataList.push(_v)
|
||||
this._dataMap.set(_v.id, _v)
|
||||
}
|
||||
}
|
||||
|
||||
getDataMap(): Map<number, TB.TbGOnHookMap1> { return this._dataMap; }
|
||||
getDataList(): TB.TbGOnHookMap1[] { return this._dataList; }
|
||||
getDataMap(): Map<number, TB.TbGOnHookMap120001> { return this._dataMap; }
|
||||
getDataList(): TB.TbGOnHookMap120001[] { return this._dataList; }
|
||||
|
||||
get(key: number): TB.TbGOnHookMap1 | undefined { return this._dataMap.get(key); }
|
||||
get(key: number): TB.TbGOnHookMap120001 | undefined { return this._dataMap.get(key); }
|
||||
|
||||
resolve(tables:Tables)
|
||||
{
|
||||
@@ -1235,8 +1247,8 @@ export class Tables {
|
||||
get TbGRoleBaseAttribute(): TbGRoleBaseAttribute { return this._TbGRoleBaseAttribute;}
|
||||
private _TbGOnHookMaps: TbGOnHookMaps
|
||||
get TbGOnHookMaps(): TbGOnHookMaps { return this._TbGOnHookMaps;}
|
||||
private _TbGOnHookMap1: TbGOnHookMap1
|
||||
get TbGOnHookMap1(): TbGOnHookMap1 { return this._TbGOnHookMap1;}
|
||||
private _TbGOnHookMap120001: TbGOnHookMap120001
|
||||
get TbGOnHookMap120001(): TbGOnHookMap120001 { return this._TbGOnHookMap120001;}
|
||||
private _TbBattleResource: TbBattleResource
|
||||
get TbBattleResource(): TbBattleResource { return this._TbBattleResource;}
|
||||
|
||||
@@ -1255,7 +1267,7 @@ export class Tables {
|
||||
this._TbGAttribute = new TbGAttribute(loader('tbgattribute'))
|
||||
this._TbGRoleBaseAttribute = new TbGRoleBaseAttribute(loader('tbgrolebaseattribute'))
|
||||
this._TbGOnHookMaps = new TbGOnHookMaps(loader('tbgonhookmaps'))
|
||||
this._TbGOnHookMap1 = new TbGOnHookMap1(loader('tbgonhookmap1'))
|
||||
this._TbGOnHookMap120001 = new TbGOnHookMap120001(loader('tbgonhookmap120001'))
|
||||
this._TbBattleResource = new TbBattleResource(loader('tbbattleresource'))
|
||||
|
||||
this._TbGGlobal.resolve(this)
|
||||
@@ -1272,7 +1284,7 @@ export class Tables {
|
||||
this._TbGAttribute.resolve(this)
|
||||
this._TbGRoleBaseAttribute.resolve(this)
|
||||
this._TbGOnHookMaps.resolve(this)
|
||||
this._TbGOnHookMap1.resolve(this)
|
||||
this._TbGOnHookMap120001.resolve(this)
|
||||
this._TbBattleResource.resolve(this)
|
||||
}
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ export interface ModeOnHookOV{
|
||||
|
||||
playerId:number; //玩家Id
|
||||
onHookMap:number; //当前玩家所在的地图(配置表Id)
|
||||
levelId:number; //当前关卡Id
|
||||
|
||||
}
|
||||
|
||||
@@ -23,5 +24,7 @@ export const GAPI = {
|
||||
GOnHookCatchCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onCatchCreeps/${creepId}`)) as PlayerPetOV,
|
||||
//出售野怪
|
||||
GOnHookSellCreeps : async (creepId) => RData(await app.api.post(`/game/mode/onHook/onSellCreeps/${creepId}`)) as boolean,
|
||||
//下一关
|
||||
GOnHookNextLevel : async () => RData(await app.api.post(`/game/mode/onHook/nextLevel`)) as boolean,
|
||||
|
||||
}
|
@@ -8,13 +8,9 @@ import { instantiate } from 'cc';
|
||||
import { v3 } from 'cc';
|
||||
import { ModeRenderHitText } from './ModeRenderHitText';
|
||||
import { Vec2 } from 'cc';
|
||||
import { GModeEvent, GModeHitInfo } from '../../../battle/modes/GMode';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
export enum ModeRenderEvent{
|
||||
//受击
|
||||
HIT = "ModeRenderEvent_HIT"
|
||||
}
|
||||
|
||||
@ccclass('ModeRender')
|
||||
export class ModeRender extends Component {
|
||||
|
||||
@@ -24,27 +20,27 @@ export class ModeRender extends Component {
|
||||
|
||||
onLoad(){
|
||||
|
||||
app.event.on(ModeRenderEvent.HIT,this.onHit,this);
|
||||
app.event.on(GModeEvent.HIT,this.onHit,this);
|
||||
|
||||
}
|
||||
|
||||
protected onDestroy(): void {
|
||||
|
||||
app.event.off(ModeRenderEvent.HIT,this.onHit,this);
|
||||
app.event.off(GModeEvent.HIT,this.onHit,this);
|
||||
|
||||
}
|
||||
|
||||
//受击
|
||||
onHit(pos:Vec2,hit:number){
|
||||
onHit(info:GModeHitInfo){
|
||||
|
||||
let rolePos = GData.WorldCanvas.camera.worldToScreen(v3(pos.x,pos.y));
|
||||
let rolePos = info.camera.worldToScreen(v3(info.world.x,info.world.y));
|
||||
|
||||
let hitNode = instantiate(this.hitPrefab);
|
||||
|
||||
this.node.addChild(hitNode);
|
||||
hitNode.position = rolePos.add(v3(0,100,0));
|
||||
|
||||
hitNode.getComponent(ModeRenderHitText).setText(hit);
|
||||
hitNode.getComponent(ModeRenderHitText).setText(info.hit);
|
||||
|
||||
}
|
||||
|
||||
|
@@ -6,6 +6,7 @@ import GBattleModeManager, { BattleMode } from '../../battle/GBattleModeManager'
|
||||
import { JNGLayerBase } from '../../components/JNComponent';
|
||||
import { app } from '../../App';
|
||||
import { GAction } from '../../consts/GAction';
|
||||
import { GAPI } from '../../consts/GAPI';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('MainView')
|
||||
@@ -60,6 +61,12 @@ export class MainView extends JNGLayerBase {
|
||||
app.layer.Open(GUI.MapSelectView);
|
||||
}
|
||||
|
||||
//点击下一关
|
||||
async onClickNextLevel(){
|
||||
await GAPI.GOnHookNextLevel();
|
||||
app.layer.Open(GUI.Tips,{text:"下一关"});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user