mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
无头模式测试
This commit is contained in:
@@ -7,6 +7,7 @@ import { instantiate } from "cc";
|
||||
import { app } from "../App";
|
||||
import { JNFrameInfo, JNSyncFrameEvent } from "../../../extensions/ngame/assets/ngame/sync/frame/JNSyncFrame";
|
||||
import { CCObject } from "cc";
|
||||
import { Env, EnvCurrent } from "../Env";
|
||||
|
||||
export enum BattleMode{
|
||||
//无尽模式
|
||||
@@ -37,8 +38,10 @@ export default class GBattleModeManager extends Singleton {
|
||||
//当前模式
|
||||
current:BattleMode = null;
|
||||
|
||||
//是否自动退帧
|
||||
//是否自动推帧
|
||||
isAuto:boolean = false;
|
||||
//是否推追帧
|
||||
isAutoMaxFrame:boolean = false;
|
||||
|
||||
//自动推帧间隔
|
||||
autoTime:number = 0;
|
||||
@@ -73,6 +76,8 @@ export default class GBattleModeManager extends Singleton {
|
||||
this.data = data;
|
||||
|
||||
if(!this.current && mode == null){
|
||||
//裁决员不允许默认模式
|
||||
if(EnvCurrent == Env.Server) return;
|
||||
await this.Open(this.default,true,data);
|
||||
return;
|
||||
}else if(mode == null){
|
||||
@@ -98,11 +103,14 @@ export default class GBattleModeManager extends Singleton {
|
||||
}
|
||||
|
||||
//设置自动推帧 ( 帧不由addFrame控制 管理器自动推帧)
|
||||
setAuto(is:boolean){
|
||||
setAuto(is:boolean,isAutoMaxFrame:boolean = false){
|
||||
this.isAuto = is;
|
||||
this.isAutoMaxFrame = isAutoMaxFrame;
|
||||
this.autoTime = 0;
|
||||
}
|
||||
|
||||
//设置自动追帧
|
||||
|
||||
//清除当前模式
|
||||
private clear(){
|
||||
if(!this.isInit) return;
|
||||
@@ -146,15 +154,31 @@ export default class GBattleModeManager extends Singleton {
|
||||
|
||||
if(!this.isAuto) return;
|
||||
|
||||
this.autoTime += dt * 1000;
|
||||
if(this.isAutoMaxFrame){
|
||||
|
||||
//保持超高频率追帧
|
||||
while(app.sync.nFrameQueue.length < (app.sync.nMaxFrameLoopBan * 2)){
|
||||
//速度推帧
|
||||
app.sync.addFrame({
|
||||
index:app.sync.nLocalFrame + 1
|
||||
});
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
//正常追帧
|
||||
|
||||
this.autoTime += dt * 1000;
|
||||
|
||||
//获取当前帧同步的帧数推空帧
|
||||
if(app.sync.nSyncTime < this.autoTime){
|
||||
//如果事件够则推帧
|
||||
this.autoTime -= app.sync.nSyncTime;
|
||||
app.sync.addFrame({
|
||||
index:app.sync.nLocalFrame + 1
|
||||
});
|
||||
}
|
||||
|
||||
//获取当前帧同步的帧数推空帧
|
||||
if(app.sync.nSyncTime < this.autoTime){
|
||||
//如果事件够则推帧
|
||||
this.autoTime -= app.sync.nSyncTime;
|
||||
app.sync.addFrame({
|
||||
index:app.sync.nLocalFrame + 1
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -216,6 +216,7 @@ export default class GPVPMode extends GBaseMode<{},GPVPStart>{
|
||||
this.isEndGame = true;
|
||||
//结束游戏
|
||||
JNFrameTime.getInstance().setTimeout(() => {
|
||||
console.log(this.getOnesRoleAlive(GPVPModePlayerEnum.PLAYER).length,this.getOnesRoleAlive(GPVPModePlayerEnum.ENEMY).length)
|
||||
this.Close();
|
||||
},3000)
|
||||
}
|
||||
|
Reference in New Issue
Block a user