mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 03:14:47 +00:00
update
This commit is contained in:
parent
7e402432dd
commit
c4e6d02388
@ -156,7 +156,7 @@
|
||||
"_shutter": 7,
|
||||
"_iso": 0,
|
||||
"_screenScale": 1,
|
||||
"_visibility": 1,
|
||||
"_visibility": 1107296257,
|
||||
"_targetTexture": {
|
||||
"__uuid__": "a0d1e275-5512-493e-8e15-7d2db8beb48e",
|
||||
"__expectedType__": "cc.RenderTexture"
|
||||
|
@ -1 +1 @@
|
||||
{"10001":{"roleId":10001,"attackWay":"Normal","attackArgs":[]},"10002":{"roleId":10002,"attackWay":"Normal","attackArgs":[]},"10003":{"roleId":10003,"attackWay":"Remote","attackArgs":["20001"]}}
|
||||
{"10001":{"roleId":10001,"attackWay":"Normal","attackArgs":[]},"10002":{"roleId":10002,"attackWay":"Normal","attackArgs":[]},"10003":{"roleId":10003,"attackWay":"ParabolicRemote","attackArgs":["20001",0.4]}}
|
@ -24,6 +24,7 @@ import { TableGRoleAttack } from "../resources/config/ts/TableGRoleAttack";
|
||||
import { SpriteFrame } from "cc";
|
||||
import { TableGRoleAttackBullet } from "../resources/config/ts/TableGRoleAttackBullet";
|
||||
|
||||
let IP = "localhost";
|
||||
|
||||
//重写UI
|
||||
class JNGLayer extends JNLayer{
|
||||
@ -34,7 +35,7 @@ class JNGLayer extends JNLayer{
|
||||
//重写Socket
|
||||
class JNGSocket extends JNSocket{
|
||||
public url() {
|
||||
return "ws://localhost:8080/websocket";
|
||||
return `ws://${IP}:8080/websocket`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -160,7 +161,7 @@ export const app = {
|
||||
event : EventDispatcher.getIns(), //通知
|
||||
proto : NGameMessage.getIns(), //消息
|
||||
api : axios.create({
|
||||
baseURL: "http://localhost:8080",
|
||||
baseURL: `http://${IP}:8080`,
|
||||
}), //请求
|
||||
battle : GBattleModeManager.getIns(), //战斗
|
||||
config : new JNGConfig(),
|
||||
|
@ -1,10 +1,24 @@
|
||||
import { Node } from "cc";
|
||||
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
|
||||
import GRoleBase from "../role/GRoleBase";
|
||||
import GAttackNormal from "./GAttackNormal";
|
||||
import GAttackRemote from "./GAttackRemote";
|
||||
import GAttackParabolicRemote from "./GAttackParabolicRemote";
|
||||
import { UITransform } from "cc";
|
||||
import GButtleBase from "../bullet/GButtleBase";
|
||||
|
||||
//攻击子弹类
|
||||
export class GAttackBullet{
|
||||
|
||||
//创建子弹
|
||||
static create<T extends GButtleBase<{}>>(GClass:{new():T},data:{}):T{
|
||||
let bulletNode = new Node();
|
||||
bulletNode.addComponent(UITransform);
|
||||
let bullet = bulletNode.addComponent(GClass);
|
||||
bullet.setData(data);
|
||||
return bullet;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//攻击方式基类
|
||||
export class GAttackBase{
|
||||
@ -12,8 +26,8 @@ export class GAttackBase{
|
||||
}
|
||||
|
||||
//攻击方式
|
||||
export const GAttack:{[key:string]:new () => GAttackBase} = {
|
||||
export const GAttack:{[key:string]:(new () => GAttackBase)} = {
|
||||
["Normal"]:GAttackNormal,
|
||||
["Remote"]:GAttackRemote,
|
||||
["ParabolicRemote"]:GAttackParabolicRemote,
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
export default class GAttackBullet {
|
||||
|
||||
//创建子弹
|
||||
static create(){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "565d04ae-ff80-4b3c-ac82-97dfcce552c2",
|
||||
"uuid": "13b542e0-5fa9-4b1d-bfef-8196b3b3ffd6",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
@ -0,0 +1,34 @@
|
||||
import { SpriteFrame } from "cc";
|
||||
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
|
||||
import { app } from "../../../App";
|
||||
import GRoleBase from "../role/GRoleBase";
|
||||
import { GAttackBase, GAttackBullet } from "./GAttack";
|
||||
import GButtleDefault from "../bullet/GButtleDefault";
|
||||
import { size } from "cc";
|
||||
import { Size } from "cc";
|
||||
import { Vec2 } from "cc";
|
||||
import { v2 } from "cc";
|
||||
import { v3 } from "cc";
|
||||
/**
|
||||
* 抛物线普攻
|
||||
*/
|
||||
export default class GAttackParabolicRemote implements GAttackBase{
|
||||
|
||||
attack(role: GRoleBase<{}>, info: TableGRoleAttack): void {
|
||||
//[子弹图片]
|
||||
let image:SpriteFrame = app.role.bullets[info.attackArgs[0]];
|
||||
let scale:number = info.attackArgs[1] as unknown as number;
|
||||
let bone = role.spine.findBone("timo5 007");
|
||||
console.log(role.spine,bone);
|
||||
let bullet = GAttackBullet.create(GButtleDefault,{
|
||||
image:image,
|
||||
scale:scale,
|
||||
});
|
||||
role.mode.addGObject(bullet);
|
||||
let world2 = role.node.worldPosition.clone().add(v3(bone.worldX,bone.worldY,0))
|
||||
bullet.node.setWorldPosition(v3(world2.x,world2.y,world2.z))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "8c684f5a-84b5-4ea1-92d3-c0b70461970c",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAttack";
|
||||
import { app } from "../../../App";
|
||||
import GRoleBase from "../role/GRoleBase";
|
||||
import { GAttackBase } from "./GAttack";
|
||||
|
||||
export default class GAttackRemote implements GAttackBase{
|
||||
|
||||
attack(role: GRoleBase<{}>, info: TableGRoleAttack): void {
|
||||
console.log(app.role.bullets[info.attackArgs[0]]);
|
||||
role.fsm.enemy.onHit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
9
JisolGameCocos/assets/script/battle/base/bullet.meta
Normal file
9
JisolGameCocos/assets/script/battle/base/bullet.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.2.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "c6ed6478-8a11-42b5-ab5a-e302055e39c2",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "f72595ba-a0e4-4ec5-8da8-b7d531e0c3bb",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "894a780e-2f5c-4d98-ba20-b43dbbcff086",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
import GObject from "../GObject";
|
||||
|
||||
//子弹基类
|
||||
export default class GButtleBase<T> extends GObject<T>{
|
||||
setData(data:T){}
|
||||
}
|
||||
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "6656486e-6c7b-42f0-900a-d6af2c05785a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
import { _decorator } from "cc";
|
||||
import GButtleBase from "./GButtleBase";
|
||||
import { SpriteFrame } from "cc";
|
||||
import { Sprite } from "cc";
|
||||
import { UITransform } from "cc";
|
||||
import { size } from "cc";
|
||||
import { Size } from "cc";
|
||||
import { v3 } from "cc";
|
||||
import { Vec2 } from "cc";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
export interface GButtleDefaultInfo{
|
||||
image:SpriteFrame;//子弹图片
|
||||
scale:number; //子弹大小
|
||||
start:Vec2; //子弹初始位置
|
||||
}
|
||||
|
||||
//默认子弹类
|
||||
@ccclass("GButtleDefault")
|
||||
export default class GButtleDefault extends GButtleBase<GButtleDefaultInfo>{
|
||||
|
||||
setData(info:GButtleDefaultInfo){
|
||||
this.node.layer = 1;
|
||||
this.node.addComponent(Sprite).spriteFrame = info.image;
|
||||
this.node.scale = v3(info.scale,info.scale,0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "cf27345b-b08f-4897-8a2e-6be309e9d076",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -80,6 +80,8 @@ export default abstract class GRoleBase<T> extends GObject<T>{
|
||||
return;
|
||||
}
|
||||
|
||||
this.spine.debugBones = true;
|
||||
|
||||
this.bind(this.role);
|
||||
|
||||
//创建角色状态机
|
||||
|
@ -1,15 +1,10 @@
|
||||
import { _decorator } from "cc";
|
||||
import GRoleBase from "../GRoleBase";
|
||||
import GFSMBase from "../../fsm/GFSMBase";
|
||||
import GFSMPVP from "../../fsm/PVP/GFSMPVP";
|
||||
import GPVPMode, { GPVPModePlayerEnum } from "../../../modes/GPVPMode";
|
||||
import { GTactical } from "../../../entity/GTactical";
|
||||
import { GFSMBattleAmin } from "../../fsm/base/GFSMBattle/GFSMBattleAmin";
|
||||
import { JNFrameInfo } from "../../../../../../extensions/ngame/assets/ngame/sync/frame/JNSyncFrame";
|
||||
import { Vec2 } from "cc";
|
||||
import { v2 } from "cc";
|
||||
import { ProgressBar } from "cc";
|
||||
import { GTowards } from "../../GObject";
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
export interface GDemoMessage{
|
||||
@ -40,6 +35,7 @@ export default class GRolePVPEntity extends GRoleBase<GDemoMessage>{
|
||||
getClassName():string{return "GDemoMessage"}
|
||||
onSyncUpdate(dt: number,frame:JNFrameInfo, input?: GDemoMessage) {
|
||||
super.onSyncUpdate(dt,frame,input);
|
||||
|
||||
if(input){
|
||||
if(Object.prototype.hasOwnProperty.call(input,"isAttack")){
|
||||
this.fsmAnim.isAttack = input.isAttack;
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user