This commit is contained in:
PC-20230316NUNE\Administrator 2023-10-30 18:53:21 +08:00
parent bb4334c0ff
commit 64ab2b0fe5
20 changed files with 544 additions and 48 deletions

2
JNGame

@ -1 +1 @@
Subproject commit e5ae6946c8f1663d3025514e3ec9e3598debdcec
Subproject commit bce1ad3522fb8ed1497eee9e01bba38d53e97279

View File

@ -1 +1 @@
{"40001":{"id":40001,"skillName":"疯狂松鼠","skillController":"GSkillCrazySquirrel","skillArgs":["10","250","250"],"skillText":"疯狂松鼠的技能 丢出巨大炸弹 轰炸全部玩家"}}
{"40001":{"id":40001,"skillName":"疯狂松鼠","skillController":"GSkillCrazySquirrel","skillArgs":["5","250","250"],"skillText":"疯狂松鼠的技能 丢出巨大炸弹 轰炸全部玩家"}}

View File

@ -32,22 +32,25 @@
},
{
"__id__": 60
},
{
"__id__": 75
}
],
"_active": true,
"_components": [
{
"__id__": 75
"__id__": 90
},
{
"__id__": 77
"__id__": 92
},
{
"__id__": 79
"__id__": 94
}
],
"_prefab": {
"__id__": 81
"__id__": 96
},
"_lpos": {
"__type__": "cc.Vec3",
@ -1777,6 +1780,369 @@
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "Button-001",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [
{
"__id__": 76
}
],
"_active": true,
"_components": [
{
"__id__": 82
},
{
"__id__": 84
},
{
"__id__": 86
}
],
"_prefab": {
"__id__": 89
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 108.634,
"y": 414.543,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.Node",
"_name": "Label",
"_objFlags": 512,
"__editorExtras__": {},
"_parent": {
"__id__": 75
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 77
},
{
"__id__": 79
}
],
"_prefab": {
"__id__": 81
},
"_lpos": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_lrot": {
"__type__": "cc.Quat",
"x": 0,
"y": 0,
"z": 0,
"w": 1
},
"_lscale": {
"__type__": "cc.Vec3",
"x": 1,
"y": 1,
"z": 1
},
"_mobility": 0,
"_layer": 33554432,
"_euler": {
"__type__": "cc.Vec3",
"x": 0,
"y": 0,
"z": 0
},
"_id": ""
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 76
},
"_enabled": true,
"__prefab": {
"__id__": 78
},
"_contentSize": {
"__type__": "cc.Size",
"width": 150,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "5fboR6YyBN54l5x0btJQyW"
},
{
"__type__": "cc.Label",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 76
},
"_enabled": true,
"__prefab": {
"__id__": 80
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 0,
"g": 0,
"b": 0,
"a": 255
},
"_string": "重置服务器帧",
"_horizontalAlign": 1,
"_verticalAlign": 1,
"_actualFontSize": 20,
"_fontSize": 20,
"_fontFamily": "Arial",
"_lineHeight": 40,
"_overflow": 1,
"_enableWrapText": false,
"_font": null,
"_isSystemFontUsed": true,
"_spacingX": 0,
"_isItalic": false,
"_isBold": false,
"_isUnderline": false,
"_underlineHeight": 2,
"_cacheMode": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "a6QibMTH5G+7LMHG0qhbVT"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "da36iiJxtJPZLjwyxqfLYI",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 75
},
"_enabled": true,
"__prefab": {
"__id__": 83
},
"_contentSize": {
"__type__": "cc.Size",
"width": 150,
"height": 40
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "11gVfKX15J75lmC5wMXNoV"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 75
},
"_enabled": true,
"__prefab": {
"__id__": 85
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 1,
"_fillType": 0,
"_sizeMode": 0,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "6bzNThqslF4rtzhtv4z/wB"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 75
},
"_enabled": true,
"__prefab": {
"__id__": 87
},
"clickEvents": [
{
"__id__": 88
}
],
"_interactable": true,
"_transition": 2,
"_normalColor": {
"__type__": "cc.Color",
"r": 214,
"g": 214,
"b": 214,
"a": 255
},
"_hoverColor": {
"__type__": "cc.Color",
"r": 211,
"g": 211,
"b": 211,
"a": 255
},
"_pressedColor": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_disabledColor": {
"__type__": "cc.Color",
"r": 124,
"g": 124,
"b": 124,
"a": 255
},
"_normalSprite": {
"__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_hoverSprite": {
"__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_pressedSprite": {
"__uuid__": "544e49d6-3f05-4fa8-9a9e-091f98fc2ce8@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_disabledSprite": {
"__uuid__": "951249e0-9f16-456d-8b85-a6ca954da16b@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_duration": 0.1,
"_zoomScale": 1.2,
"_target": {
"__id__": 75
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "33456IPOpL9oM7x0gq/Oo4"
},
{
"__type__": "cc.ClickEvent",
"target": {
"__id__": 1
},
"component": "",
"_componentId": "15051raQgZN6J5ICgY2OfSS",
"handler": "onClickResetServer",
"customEventData": ""
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "17rzI8RjNOmqCFQhUeM594",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
@ -1787,7 +2153,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 76
"__id__": 91
},
"_contentSize": {
"__type__": "cc.Size",
@ -1815,7 +2181,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 78
"__id__": 93
},
"_alignFlags": 45,
"_target": null,
@ -1851,7 +2217,7 @@
},
"_enabled": true,
"__prefab": {
"__id__": 80
"__id__": 95
},
"frameText": {
"__id__": 11

View File

@ -25,7 +25,7 @@ import { TableGRoleAttackEffect } from "../resources/config/ts/TableGRoleAttackE
import { TableGRoleSkill } from "../resources/config/ts/TableGRoleSkill";
import { TableGRoleSkillEffect } from "../resources/config/ts/TableGRoleSkillEffect";
let IP = "192.168.1.23";
let IP = "localhost";
//重写UI
class JNGLayer extends JNLayer{

View File

@ -41,6 +41,9 @@ export class WorldCanvas extends Component {
//创建世界
create(){
this.root.addChild(instantiate(this.prefab))
this.scheduleOnce(() => {
app.sync.onStart();
});
}
update(deltaTime: number) {

View File

@ -8,16 +8,14 @@ import { v3 } from "cc";
import { bezier } from "cc";
import { v2 } from "cc";
import { Vec2 } from "cc";
import { sp } from "cc";
import GEffectUtil from "../../effect/GEffectUtil";
import { TableGRoleAttackEffect } from "../../../../resources/config/ts/TableGRoleAttackEffect";
import GDetection from "../common/GDetection";
import { rect } from "cc";
import { UITransform } from "cc";
import { BoxCollider2D } from "cc";
/**
* 线
* ,,-,
* ,,-,,,
*/
export default class GAttackParabolicRemote implements GAttackBase{
@ -26,7 +24,6 @@ export default class GAttackParabolicRemote implements GAttackBase{
let enemy = role.fsm.enemy;
if(!enemy) return;
//[子弹图片]
let image:SpriteFrame = app.role.bullets[info.attackArgs[0]];
let bang = {
ske: app.role.effects[info.attackArgs[1]],

View File

@ -149,14 +149,17 @@ export default abstract class GFSMBattle extends GFSMBase{
this.player.fsmAnim.isAttack = true;
//如果有敌人则攻击 没有 则 重置
if(this.enemy){
// if(){
// //如果可以释放大招
// }else{
// //不可以则普攻
//朝向敌人
this.player.onTowardsTarget(this.enemy);
return GFSMProcessEnum.Wait;
// }
//是否可释放技能
if(this.player.isReleaseSkill()){
//则释放技能
return ProcessEnum.ReleaseSkills;
}else{
return GFSMProcessEnum.Wait;
}
}else{
return ProcessEnum.SeekEnemy;
}
@ -165,6 +168,21 @@ export default abstract class GFSMBattle extends GFSMBase{
//释放技能
onReleaseSkillsProcess(){
//如果正在释放则等待
if(this.player.isReleasingSkill()){
return GFSMProcessEnum.Wait;
}
//释放技能
if(this.player.isReleaseSkill()){
//如果可以释放技能则释放
this.player.onReleaseSkill();
return GFSMProcessEnum.Wait;
}else{
//不可以则回到攻击
return ProcessEnum.AttackEnemy;
}
}

View File

@ -1,5 +1,8 @@
import { sp } from "cc";
import GFSMBase, { GFSMProcessEnum, GFSMProcessInfo, GFSMProcessMode } from "../../GFSMBase";
import GRoleBase from "../../../role/GRoleBase";
import GRolePVPEntity from "../../../role/PVP/GRolePVPEntity";
import GObject from "../../../GObject";
//角色动画名称枚举
export enum GFSMBattleAminEnum {
@ -63,7 +66,8 @@ export class GFSMBattleAmin extends GFSMBase{
this.trackIndex = trackIndex || 0;
//设置监听
this.spine.setEventListener(this.onEventListener.bind(this));
this.spine.setStartListener(this.onStartListener.bind(this));
//因为SpineBUG所以不使用Spine监听 采用自己调用
// this.spine.setStartListener(this.onStartListener.bind(this));
}
//添加事件监听
@ -176,8 +180,9 @@ export class GFSMBattleAmin extends GFSMBase{
//播放动画
if(!info.track){
console.log("播放动画",info);
console.log(`播放动画-${this.spine.getComponent(GObject).nId}-`,info);
info.track = this.spine.setAnimation(this.trackIndex,info.animName,info.isLoop);
this.onStartListener(info.track);
}
return to;

View File

@ -13,7 +13,7 @@ import { TableGRoleAttack } from "../../../../resources/config/ts/TableGRoleAtta
import { GAttack, GAttackBase } from "../attack/GAttack";
import { TableGRole } from "../../../../resources/config/ts/TableGRole";
import { TableGRoleSkill } from "../../../../resources/config/ts/TableGRoleSkill";
import { GSkill, GSkillBase } from "../../skill/GSkill";
import { GSkill, GSkillBase, GSkillState } from "../../skill/GSkill";
import JNSkeleton from "../../../../../extensions/ngame/assets/ngame/sync/frame/game/spine/JNFrameSkeleton";
const { ccclass, property } = _decorator;
@ -131,9 +131,8 @@ export default abstract class GRoleBase<T> extends GObject<T>{
this.fsm && this.fsm.onUpdate(dt / 1000);
this.fsmAnim && this.fsmAnim.onUpdate(dt / 1000);
if(frame.index == 100){
this.skills[0] && this.skills[0].release();
}
//更新技能
this.skills.forEach(skill => skill.onUpdate(dt));
}
@ -227,12 +226,13 @@ export default abstract class GRoleBase<T> extends GObject<T>{
//击飞
onFly(){
console.log("onFly");
if(this.nId == 1)
console.log("onFly");
let vWorld = this.node.worldPosition;
let vEndWorld = this.getWorldBackLen(v2(1000,500));
this.JTween(vWorld)
.to({x:vEndWorld.x},800)
.onUpdate(pos => this.node.worldPosition = vWorld)
.onUpdate(pos => this.node.worldPosition = pos)
.start();
this.JTween(vWorld)
.to({y:vEndWorld.y},800)
@ -252,6 +252,37 @@ export default abstract class GRoleBase<T> extends GObject<T>{
return roles.filter(role => role.type != this.type);
}
//判断是否可以释放技能
isReleaseSkill():boolean{
for (const skill of this.skills) {
if(skill.isRelease()){
return true;
}
}
return false;
}
//释放技能
onReleaseSkill():boolean{
for (const skill of this.skills) {
if(skill.isRelease()){
skill.release();
return true;
}
}
return false;
}
//是否正在释放技能
isReleasingSkill():boolean {
for (const skill of this.skills) {
if(skill.state() == GSkillState.Releasing){
return true;
}
}
return false;
}
}

View File

@ -51,6 +51,10 @@ export default class GRolePVPEntity extends GRoleBase<GDemoMessage>{
//更新显示
this.bloodVolume.progress = this.blood / this.fullBlood;
//显示第一个技能进度条
if(this.skills[0]){
this.energyVolume.progress = this.skills[0].getProgress();
}
}

View File

@ -24,6 +24,12 @@ export interface GSkillBase {
//技能状态
state():GSkillState;
//技能更新
onUpdate(dt:number);
//返回进度条
getProgress():number;
}

View File

@ -0,0 +1,29 @@
import { TableGRoleSkill } from "../../../resources/config/ts/TableGRoleSkill";
import GRoleBase from "../base/role/GRoleBase";
import { GSkillBase, GSkillState } from "./GSkill";
//怒气冷却
export default abstract class GSkillAngerBase implements GSkillBase {
bind(role: GRoleBase<{}>, info: TableGRoleSkill): GSkillBase {
throw new Error("Method not implemented.");
}
isRelease(): boolean {
throw new Error("Method not implemented.");
}
release(): boolean {
throw new Error("Method not implemented.");
}
state(): GSkillState {
throw new Error("Method not implemented.");
}
onUpdate(dt: number) {
throw new Error("Method not implemented.");
}
getProgress(): number {
throw new Error("Method not implemented.");
}
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "e648aeed-c49c-4f10-b24f-6aef45fc14f5",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -7,33 +7,61 @@ import { GSkillBase, GSkillState } from "./GSkill";
export default abstract class GSkillCDBase implements GSkillBase {
//冷却总时间
cdTatal:number;
cdTatal:number = 0;
//冷却时间
cdTime:number;
cdTime:number = 0;
bind(role:GRoleBase<{}>,info: TableGRoleSkill):GSkillCDBase {
return this;
}
//是否可以释放技能
isRelease(): boolean {
//冷却时间小于等于0可释放
return this.cdTime <= 0;
return this.cdTime >= this.cdTatal;
}
//释放技能
release():boolean {
// //是否可以释放技能
// if(!this.isRelease()) return false;
//是否可以释放技能
if(!this.isRelease()) return false;
this.cdTime = 0;
return this.onRelease();
}
//子类实现释放
abstract onRelease():boolean;
//查询状态
state(): GSkillState {
if(this.isRelease())
if(this.isReleasing()){
return GSkillState.Releasing
}
if(this.isRelease())
return GSkillState.Releasable
else
return GSkillState.NoRelease
}
//是否正在释放技能
isReleasing(): boolean{
return false;
}
//更新
onUpdate(dt:number){
if(this.state() == GSkillState.NoRelease){
this.cdTime += (dt / 1000);
}
}
//返回进度
getProgress():number{
return this.cdTime / this.cdTatal;
}
}

View File

@ -20,7 +20,6 @@ export default class GSkillCrazySquirrel extends GSkillCDBase{
info: TableGRoleSkill;
bind(role:GRoleBase<{}>,info: TableGRoleSkill):GSkillCrazySquirrel {
//技能冷却
this.cdTatal = parseInt(info.skillArgs[0]);
this.role = role;

View File

@ -3,6 +3,7 @@ import { app, JNGLayerBase } from '../../App';
import { director } from 'cc';
import GRolePVPEntity from '../../battle/base/role/PVP/GRolePVPEntity';
import { Toggle } from 'cc';
import { JNSyncAction } from '../../../../extensions/ngame/assets/ngame/sync/JNSyncAction';
const { ccclass, property } = _decorator;
@ccclass('HomeView')
@ -34,9 +35,11 @@ export class HomeView extends JNGLayerBase {
//重置
onClickReset(){
app.sync.onReset();
this.scheduleOnce(() => {
app.sync.onStart();
});
}
//重置服务器帧
onClickResetServer(){
app.socket.Send(JNSyncAction.NSyncFrameReset);
}
}

@ -1 +1 @@
Subproject commit 4180e907fcd63bbc8769dac502923d0f314dbd76
Subproject commit eee2a6129cee115fa9f03d0f0a98a12da1e63741

View File

@ -7,12 +7,7 @@
<groupId>org.example</groupId>
<artifactId>JisolGameServer</artifactId>
<version>1.0-SNAPSHOT</version>
<parent>
<groupId>cn.jisol</groupId>
<artifactId>JNGame</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
<properties>
<maven.compiler.source>8</maven.compiler.source>
@ -24,7 +19,7 @@
<dependency>
<groupId>cn.jisol</groupId>
<artifactId>JNGame</artifactId>
<version>1.0-SNAPSHOT</version>
<version>2.0-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: cn.jisol.game.JGameApplication