无头模式测试

This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2023-11-22 03:51:37 +08:00
parent 5ab90ea221
commit 7389f6d716
535 changed files with 991 additions and 162534 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 258 KiB

View File

@@ -47,9 +47,9 @@
"trimX": 0,
"trimY": 0,
"width": 658,
"height": 1425,
"height": 1421,
"rawWidth": 658,
"rawHeight": 1425,
"rawHeight": 1421,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
@@ -62,16 +62,16 @@
"vertices": {
"rawPosition": [
-329,
-712.5,
-710.5,
0,
329,
-712.5,
-710.5,
0,
-329,
712.5,
710.5,
0,
329,
712.5,
710.5,
0
],
"indexes": [
@@ -84,9 +84,9 @@
],
"uv": [
0,
1425,
1421,
658,
1425,
1421,
0,
0,
658,
@@ -104,12 +104,12 @@
],
"minPos": [
-329,
-712.5,
-710.5,
0
],
"maxPos": [
329,
712.5,
710.5,
0
]
},
@@ -127,7 +127,7 @@
},
"userData": {
"type": "sprite-frame",
"hasAlpha": false,
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "76aadab4-10a3-4c8e-b4b9-dce7807050fc@f9941"
}

View File

@@ -426,6 +426,39 @@ export class TbGRoleCStar {
}
export namespace TB {
export class TbSServerInfo {
constructor(_json_: any) {
if (_json_.id === undefined) { throw new Error() }
this.id = _json_.id
if (_json_.args === undefined) { throw new Error() }
this.args = _json_.args
if (_json_.tig === undefined) { throw new Error() }
this.tig = _json_.tig
}
/**
* id
*/
readonly id: number
/**
* 全局表参数
*/
readonly args: string
/**
* 描述
*/
readonly tig: string
resolve(tables:Tables)
{
}
}
}
export class TbGGlobal{
@@ -748,6 +781,38 @@ export class TbGRoleCStar{
export class TbSServerInfo{
private _dataMap: Map<number, TB.TbSServerInfo>
private _dataList: TB.TbSServerInfo[]
constructor(_json_: any) {
this._dataMap = new Map<number, TB.TbSServerInfo>()
this._dataList = []
for(var _json2_ of _json_) {
let _v: TB.TbSServerInfo
_v = new TB.TbSServerInfo(_json2_)
this._dataList.push(_v)
this._dataMap.set(_v.id, _v)
}
}
getDataMap(): Map<number, TB.TbSServerInfo> { return this._dataMap; }
getDataList(): TB.TbSServerInfo[] { return this._dataList; }
get(key: number): TB.TbSServerInfo | undefined { return this._dataMap.get(key); }
resolve(tables:Tables)
{
for(let data of this._dataList)
{
data.resolve(tables)
}
}
}
type JsonLoader = (file: string) => any
export class Tables {
@@ -771,6 +836,8 @@ export class Tables {
get TbGRoleCUp(): TbGRoleCUp { return this._TbGRoleCUp;}
private _TbGRoleCStar: TbGRoleCStar
get TbGRoleCStar(): TbGRoleCStar { return this._TbGRoleCStar;}
private _TbSServerInfo: TbSServerInfo
get TbSServerInfo(): TbSServerInfo { return this._TbSServerInfo;}
constructor(loader: JsonLoader) {
this._TbGGlobal = new TbGGlobal(loader('tbgglobal'))
@@ -783,6 +850,7 @@ export class Tables {
this._TbGResource = new TbGResource(loader('tbgresource'))
this._TbGRoleCUp = new TbGRoleCUp(loader('tbgrolecup'))
this._TbGRoleCStar = new TbGRoleCStar(loader('tbgrolecstar'))
this._TbSServerInfo = new TbSServerInfo(loader('tbsserverinfo'))
this._TbGGlobal.resolve(this)
this._TbGRole.resolve(this)
@@ -794,5 +862,6 @@ export class Tables {
this._TbGResource.resolve(this)
this._TbGRoleCUp.resolve(this)
this._TbGRoleCStar.resolve(this)
this._TbSServerInfo.resolve(this)
}
}

View File

@@ -0,0 +1,7 @@
[
{
"id": 100001,
"args": "[100000]",
"tig": "服务器账号 (用来帧同步裁决)"
}
]

View File

@@ -0,0 +1,11 @@
{
"ver": "2.0.1",
"importer": "json",
"imported": true,
"uuid": "b46ccddd-adbd-446c-88a9-68a0e9f76a32",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

@@ -0,0 +1,455 @@
[
{
"__type__": "cc.Prefab",
"_name": "ServerMainView",
"_objFlags": 0,
"__editorExtras__": {},
"_native": "",
"data": {
"__id__": 1
},
"optimizationPolicy": 0,
"persistent": false
},
{
"__type__": "cc.Node",
"_name": "ServerMainView",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": null,
"_children": [
{
"__id__": 2
},
{
"__id__": 10
}
],
"_active": true,
"_components": [
{
"__id__": 16
},
{
"__id__": 18
}
],
"_prefab": {
"__id__": 20
},
"_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.Node",
"_name": "bg",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 3
},
{
"__id__": 5
},
{
"__id__": 7
}
],
"_prefab": {
"__id__": 9
},
"_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__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 4
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 1280
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8ftYzn1eBL/KI9lfvctDGE"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 6
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_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": "72OG0M5ThEtaIaziixD4R1"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 2
},
"_enabled": true,
"__prefab": {
"__id__": 8
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 720,
"_originalHeight": 720,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "8ejneRsd9FXLr6cGBBG0Rk"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "85bQbPz7FPkaRPL/kSAwAE",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.Node",
"_name": "WorldCamera",
"_objFlags": 0,
"__editorExtras__": {},
"_parent": {
"__id__": 1
},
"_children": [],
"_active": true,
"_components": [
{
"__id__": 11
},
{
"__id__": 13
}
],
"_prefab": {
"__id__": 15
},
"_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__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 12
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 1280
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "49NZnAd2pOrrDsb/1nCBFk"
},
{
"__type__": "cc.Sprite",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 10
},
"_enabled": true,
"__prefab": {
"__id__": 14
},
"_customMaterial": null,
"_srcBlendFactor": 2,
"_dstBlendFactor": 4,
"_color": {
"__type__": "cc.Color",
"r": 255,
"g": 255,
"b": 255,
"a": 255
},
"_spriteFrame": {
"__uuid__": "a0d1e275-5512-493e-8e15-7d2db8beb48e@f9941",
"__expectedType__": "cc.SpriteFrame"
},
"_type": 0,
"_fillType": 0,
"_sizeMode": 1,
"_fillCenter": {
"__type__": "cc.Vec2",
"x": 0,
"y": 0
},
"_fillStart": 0,
"_fillRange": 0,
"_isTrimmedMode": true,
"_useGrayscale": false,
"_atlas": null,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2fROkgxpNGZYBFl1l49gqi"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "dd4WyVQylCIIU7M7ozWEme",
"instance": null,
"targetOverrides": null,
"nestedPrefabInstanceRoots": null
},
{
"__type__": "cc.UITransform",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 17
},
"_contentSize": {
"__type__": "cc.Size",
"width": 720,
"height": 1280
},
"_anchorPoint": {
"__type__": "cc.Vec2",
"x": 0.5,
"y": 0.5
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "1dgJxmIH5HIpXD6y0/xMwI"
},
{
"__type__": "cc.Widget",
"_name": "",
"_objFlags": 0,
"__editorExtras__": {},
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 19
},
"_alignFlags": 45,
"_target": null,
"_left": 0,
"_right": 0,
"_top": 0,
"_bottom": 0,
"_horizontalCenter": 0,
"_verticalCenter": 0,
"_isAbsLeft": true,
"_isAbsRight": true,
"_isAbsTop": true,
"_isAbsBottom": true,
"_isAbsHorizontalCenter": true,
"_isAbsVerticalCenter": true,
"_originalWidth": 100,
"_originalHeight": 100,
"_alignMode": 2,
"_lockFlags": 0,
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "582zBz6m5DKqmkTkiS/LE0"
},
{
"__type__": "cc.PrefabInfo",
"root": {
"__id__": 1
},
"asset": {
"__id__": 0
},
"fileId": "08xLpDDa9NlK3pgR7XiOqb",
"instance": null
}
]

View File

@@ -0,0 +1,13 @@
{
"ver": "1.1.49",
"importer": "prefab",
"imported": true,
"uuid": "3af9002c-bbaa-44b8-a8db-08c5ed37e979",
"files": [
".json"
],
"subMetas": {},
"userData": {
"syncNodeName": "ServerMainView"
}
}

View File

@@ -28,8 +28,10 @@ import AppAction from "./AppAction";
// let APIPath = `http://localhost:8080`
// let WsPath = `ws://localhost:8080/websocket`
let APIPath = `http://192.168.0.174:8080`
let WsPath = `ws://192.168.0.174: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.174:8080`
// let WsPath = `ws://192.168.0.174:8080/websocket`
// let APIPath = `https://api.pet.jisol.cn`
// let WsPath = `wss://api.pet.jisol.cn/websocket`
@@ -229,7 +231,8 @@ export const app = {
}
app.api.addRequestInterceptors((config:JAPIConfig) => {
//设置Token
config.headers["Token"] = StorageData.get(StorageEnum.Token);
// //设置Token
// if(StorageData.get(StorageEnum.Token))
// config.headers["Token"] = StorageData.get(StorageEnum.Token);
return true;
})

View File

@@ -0,0 +1,8 @@
//打包环境
export enum Env{
Server, //服务器模式
H5, //H5模式
}
//当前环境
export const EnvCurrent:Env = Env.Server;

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "6afed554-ecb2-4126-a8b6-16f3b30dfab1",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@@ -3,8 +3,12 @@ import { app } from './App';
import { Env, JNGame } from '../../extensions/ngame/assets/ngame/JNGame';
import { JNSyncAction } from '../../extensions/ngame/assets/ngame/sync/JNSyncAction';
import { GOnHookPets } from '../../extensions/ngame/assets/ngame/message/proto';
import { EnvCurrent } from './Env';
const { ccclass, property } = _decorator;
window['GUser'] = "100000";
window['GPassworld'] = "123456";
@ccclass('Main')
export class Main extends Component {
@@ -16,14 +20,16 @@ export class Main extends Component {
async onLoad(){
console.log("EnvCurrent",EnvCurrent)
// 创建UI
director.getScene().addChild(instantiate(this.UIPrefab));
//加载 APP
await JNGame.Init(app);
//发生帧同步开始
app.socket.Send(JNSyncAction.NSyncFrameStart);
// //发生帧同步开始
// app.socket.Send(JNSyncAction.NSyncFrameStart);
// 创建世界
director.getScene().addChild(instantiate(this.WorldPrefab));

View File

@@ -1,4 +1,6 @@
import { JNSyncFrameEvent } from "../../../extensions/ngame/assets/ngame/sync/frame/JNSyncFrame";
import { app } from "../App";
import { Env, EnvCurrent } from "../Env";
import GBattleModeManager, { BattleMode } from "../battle/GBattleModeManager";
import { GAction } from "../consts/GAction";
import { GActionType } from "../consts/GActionType";
@@ -24,6 +26,10 @@ export default class PVPAction extends BaseAction {
app.socket.on(GAction.C_MODE_PVP_END_WAIT,this.onModePVPEndWait,this);
app.socket.on(GAction.C_MODE_PVP_START,this.onModePVPStart,this,GActionType.GPVPStart);
app.socket.on(GAction.C_MODE_PVP_MESSAGE,this.onModePVPMessage,this,GActionType.GPVPText);
if(EnvCurrent == Env.Server){
app.socket.on(GAction.CR_REFEREE_PVP_MODE,this.onCrReferee,this,GActionType.GPVPStart); //监听PVP裁决
}
}
//PVP开始等待
@@ -44,6 +50,13 @@ export default class PVPAction extends BaseAction {
GBattleModeManager.getIns().Open(BattleMode.PVP,true,info);
}
//裁决运行
onCrReferee(info:GPVPStart){
console.log("开始PVP裁决",info);
GBattleModeManager.getIns().Open(BattleMode.PVP,false,info);
GBattleModeManager.getIns().setAuto(true,true);
}
//提示
onModePVPMessage(info:GPVPText){
console.log("提示PVP",info);

View File

@@ -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
});
}
}

View File

@@ -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)
}

View File

@@ -17,4 +17,8 @@ export enum GAction {
C_MODE_PVP_END_WAIT = 3007, //结束等待PVP开始
C_MODE_PVP_MESSAGE = 3008, //PVP 消息通知
/*************** 裁决 *********************/
CR_REFEREE_PVP_MODE = 4001, //裁决PVP模式
}

View File

@@ -6,6 +6,7 @@ import NoviceManager from "../../manager/NoviceManager";
import { JNGLayerBase } from "../../components/JNComponent";
import { app } from "../../App";
import { lerp } from "cc";
import { Env, EnvCurrent } from "../../Env";
const { ccclass, property } = _decorator;
@ccclass('LoadingView')
@@ -35,7 +36,12 @@ export default class LoadingView extends JNGLayerBase {
await NoviceManager.getIns().onStart();
//关闭加载页
await app.layer.Open(GUI.Main);
if(EnvCurrent == Env.Server){
//打开服务器主页
await app.layer.Open(GUI.ServerMain);
}else{
await app.layer.Open(GUI.Main);
}
app.layer.Close(GUI.Loading);
}

View File

@@ -5,6 +5,7 @@ import { EditBox } from 'cc';
import { app } from '../../App';
import { GUI } from '../UIConfig';
import { StorageData, StorageEnum } from '../../consts/GData';
import { Env, EnvCurrent } from '../../Env';
const { ccclass, property } = _decorator;
@ccclass('LoginView')
@@ -20,6 +21,13 @@ export class LoginView extends JNLayerBase {
onJNLoad(resolve?: (token:string) => void): void {
super.onJNLoad();
this.resolve = resolve;
//如果是服务器则取Windows账号密码
if(EnvCurrent == Env.Server){
this.account.string = window['GUser'];
this.password.string = window['GPassworld'];
this.onClickLogin();
}
}

View File

@@ -26,8 +26,9 @@ export enum GUI{
/**游戏模式页面 */
PVPModeMatchView = "PVPModeMatchView", //PVP模式匹配页面
Home = "Home", //主页面
Main = "Main", //主页面2
Home = "Home", //主页面
Main = "Main", //主页面2
ServerMain = "ServerMain", //服务器主页
}
@@ -132,6 +133,16 @@ export const UIConfig:{ [key: string]: JNLayerInfo; } = {
backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
},
},
[GUI.ServerMain]:{
layer:GLayer.View,
uri: "prefab/ui/主页/ServerMainView",
anims:{
front:JNLayerAnim.Enlarge,
back:JNLayerAnim.Smaller,
frontInfo:{key:"position",start:v3(720,0,0),end:v3(0,0,0)},
backInfo:{key:"position",start:v3(0,0,0),end:v3(-720,0,0)}
},
},
...UISystemConfig, //系统页面
...UINoviceConfig, //新手引导页面
...UIMainConfig, //主页面