mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 11:24:46 +00:00
更新主页内容
This commit is contained in:
parent
93ae85e88b
commit
d1783204ad
Binary file not shown.
9
JisolGameCocos/assets/res/UI/MainView.meta
Normal file
9
JisolGameCocos/assets/res/UI/MainView.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.2.0",
|
||||||
|
"importer": "directory",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "6d20ceb6-cbb6-47af-a9c0-dce5d2126b18",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
BIN
JisolGameCocos/assets/res/UI/MainView/MAP6_3.png
Normal file
BIN
JisolGameCocos/assets/res/UI/MainView/MAP6_3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.0 KiB |
134
JisolGameCocos/assets/res/UI/MainView/MAP6_3.png.meta
Normal file
134
JisolGameCocos/assets/res/UI/MainView/MAP6_3.png.meta
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.0.26",
|
||||||
|
"importer": "image",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "e853b2e8-b538-47a2-aa86-ba4d2cec600d",
|
||||||
|
"files": [
|
||||||
|
".json",
|
||||||
|
".png"
|
||||||
|
],
|
||||||
|
"subMetas": {
|
||||||
|
"6c48a": {
|
||||||
|
"importer": "texture",
|
||||||
|
"uuid": "e853b2e8-b538-47a2-aa86-ba4d2cec600d@6c48a",
|
||||||
|
"displayName": "MAP6_3",
|
||||||
|
"id": "6c48a",
|
||||||
|
"name": "texture",
|
||||||
|
"userData": {
|
||||||
|
"wrapModeS": "repeat",
|
||||||
|
"wrapModeT": "repeat",
|
||||||
|
"minfilter": "linear",
|
||||||
|
"magfilter": "linear",
|
||||||
|
"mipfilter": "none",
|
||||||
|
"anisotropy": 0,
|
||||||
|
"isUuid": true,
|
||||||
|
"imageUuidOrDatabaseUri": "e853b2e8-b538-47a2-aa86-ba4d2cec600d",
|
||||||
|
"visible": false
|
||||||
|
},
|
||||||
|
"ver": "1.0.22",
|
||||||
|
"imported": true,
|
||||||
|
"files": [
|
||||||
|
".json"
|
||||||
|
],
|
||||||
|
"subMetas": {}
|
||||||
|
},
|
||||||
|
"f9941": {
|
||||||
|
"importer": "sprite-frame",
|
||||||
|
"uuid": "e853b2e8-b538-47a2-aa86-ba4d2cec600d@f9941",
|
||||||
|
"displayName": "MAP6_3",
|
||||||
|
"id": "f9941",
|
||||||
|
"name": "spriteFrame",
|
||||||
|
"userData": {
|
||||||
|
"trimType": "auto",
|
||||||
|
"trimThreshold": 1,
|
||||||
|
"rotated": false,
|
||||||
|
"offsetX": 0,
|
||||||
|
"offsetY": 0,
|
||||||
|
"trimX": 0,
|
||||||
|
"trimY": 0,
|
||||||
|
"width": 24,
|
||||||
|
"height": 24,
|
||||||
|
"rawWidth": 24,
|
||||||
|
"rawHeight": 24,
|
||||||
|
"borderTop": 11,
|
||||||
|
"borderBottom": 11,
|
||||||
|
"borderLeft": 0,
|
||||||
|
"borderRight": 0,
|
||||||
|
"packable": true,
|
||||||
|
"pixelsToUnit": 100,
|
||||||
|
"pivotX": 0.5,
|
||||||
|
"pivotY": 0.5,
|
||||||
|
"meshType": 0,
|
||||||
|
"vertices": {
|
||||||
|
"rawPosition": [
|
||||||
|
-12,
|
||||||
|
-12,
|
||||||
|
0,
|
||||||
|
12,
|
||||||
|
-12,
|
||||||
|
0,
|
||||||
|
-12,
|
||||||
|
12,
|
||||||
|
0,
|
||||||
|
12,
|
||||||
|
12,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"indexes": [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
2,
|
||||||
|
1,
|
||||||
|
3
|
||||||
|
],
|
||||||
|
"uv": [
|
||||||
|
0,
|
||||||
|
24,
|
||||||
|
24,
|
||||||
|
24,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
24,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"nuv": [
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"minPos": [
|
||||||
|
-12,
|
||||||
|
-12,
|
||||||
|
0
|
||||||
|
],
|
||||||
|
"maxPos": [
|
||||||
|
12,
|
||||||
|
12,
|
||||||
|
0
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"isUuid": true,
|
||||||
|
"imageUuidOrDatabaseUri": "e853b2e8-b538-47a2-aa86-ba4d2cec600d@6c48a",
|
||||||
|
"atlasUuid": ""
|
||||||
|
},
|
||||||
|
"ver": "1.0.12",
|
||||||
|
"imported": true,
|
||||||
|
"files": [
|
||||||
|
".json"
|
||||||
|
],
|
||||||
|
"subMetas": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"userData": {
|
||||||
|
"fixAlphaTransparencyArtifacts": false,
|
||||||
|
"hasAlpha": false,
|
||||||
|
"type": "sprite-frame",
|
||||||
|
"redirect": "e853b2e8-b538-47a2-aa86-ba4d2cec600d@f9941"
|
||||||
|
}
|
||||||
|
}
|
@ -132,7 +132,7 @@
|
|||||||
"_priority": 0,
|
"_priority": 0,
|
||||||
"_fov": 45,
|
"_fov": 45,
|
||||||
"_fovAxis": 0,
|
"_fovAxis": 0,
|
||||||
"_orthoHeight": 640,
|
"_orthoHeight": 1000,
|
||||||
"_near": 0,
|
"_near": 0,
|
||||||
"_far": 1000,
|
"_far": 1000,
|
||||||
"_color": {
|
"_color": {
|
||||||
@ -340,13 +340,13 @@
|
|||||||
"camera": {
|
"camera": {
|
||||||
"__id__": 3
|
"__id__": 3
|
||||||
},
|
},
|
||||||
"prefabs": [
|
"modes": [
|
||||||
{
|
{
|
||||||
"__uuid__": "b882ecdb-012a-4d85-b799-e4da5991c0dd",
|
"__uuid__": "3520eceb-6d73-4cdc-b333-c80f737fee27",
|
||||||
"__expectedType__": "cc.Prefab"
|
"__expectedType__": "cc.Prefab"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"__uuid__": "3520eceb-6d73-4cdc-b333-c80f737fee27",
|
"__uuid__": "b882ecdb-012a-4d85-b799-e4da5991c0dd",
|
||||||
"__expectedType__": "cc.Prefab"
|
"__expectedType__": "cc.Prefab"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@ -227,6 +227,8 @@ export class TbGMap {
|
|||||||
this.map2OffsetY = _json_.map2OffsetY
|
this.map2OffsetY = _json_.map2OffsetY
|
||||||
if (_json_.map3OffsetY === undefined) { throw new Error() }
|
if (_json_.map3OffsetY === undefined) { throw new Error() }
|
||||||
this.map3OffsetY = _json_.map3OffsetY
|
this.map3OffsetY = _json_.map3OffsetY
|
||||||
|
if (_json_.scale === undefined) { throw new Error() }
|
||||||
|
this.scale = _json_.scale
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -261,6 +263,10 @@ export class TbGMap {
|
|||||||
* 地图2(后) 偏移量Y
|
* 地图2(后) 偏移量Y
|
||||||
*/
|
*/
|
||||||
readonly map3OffsetY: number
|
readonly map3OffsetY: number
|
||||||
|
/**
|
||||||
|
* 地图缩放
|
||||||
|
*/
|
||||||
|
readonly scale: number
|
||||||
|
|
||||||
resolve(tables:Tables)
|
resolve(tables:Tables)
|
||||||
{
|
{
|
||||||
|
@ -5,8 +5,9 @@
|
|||||||
"map1": "map/MAP6/MAP6_1/spriteFrame",
|
"map1": "map/MAP6/MAP6_1/spriteFrame",
|
||||||
"map2": "map/MAP6/MAP6_2/spriteFrame",
|
"map2": "map/MAP6/MAP6_2/spriteFrame",
|
||||||
"map3": "map/MAP6/MAP6_3/spriteFrame",
|
"map3": "map/MAP6/MAP6_3/spriteFrame",
|
||||||
"map1OffsetY": 100,
|
"map1OffsetY": 80,
|
||||||
"map2OffsetY": 400,
|
"map2OffsetY": 520,
|
||||||
"map3OffsetY": 400
|
"map3OffsetY": 520,
|
||||||
|
"scale": 1.5
|
||||||
}
|
}
|
||||||
]
|
]
|
File diff suppressed because it is too large
Load Diff
9
JisolGameCocos/assets/resources/prefab/ui/主页/子组件.meta
Normal file
9
JisolGameCocos/assets/resources/prefab/ui/主页/子组件.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.2.0",
|
||||||
|
"importer": "directory",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "67d033d1-2622-4892-90d0-9f84830803fd",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -2064,7 +2064,7 @@
|
|||||||
},
|
},
|
||||||
"_inputFlag": 5,
|
"_inputFlag": 5,
|
||||||
"_inputMode": 6,
|
"_inputMode": 6,
|
||||||
"_maxLength": 8,
|
"_maxLength": 100,
|
||||||
"_id": ""
|
"_id": ""
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"content": {
|
"content": {
|
||||||
"base": "2,2,0,0,0,0",
|
"base": "2,2,0,0,0,0",
|
||||||
"w": 720,
|
"w": 720,
|
||||||
"h": 720,
|
"h": 1280,
|
||||||
"n": "WorldCamera"
|
"n": "WorldCamera"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@
|
|||||||
"userData": {
|
"userData": {
|
||||||
"imageUuidOrDatabaseUri": "a0d1e275-5512-493e-8e15-7d2db8beb48e",
|
"imageUuidOrDatabaseUri": "a0d1e275-5512-493e-8e15-7d2db8beb48e",
|
||||||
"width": 720,
|
"width": 720,
|
||||||
"height": 720
|
"height": 1280
|
||||||
},
|
},
|
||||||
"ver": "1.0.0",
|
"ver": "1.0.0",
|
||||||
"imported": true,
|
"imported": true,
|
||||||
@ -28,7 +28,7 @@
|
|||||||
},
|
},
|
||||||
"userData": {
|
"userData": {
|
||||||
"width": 720,
|
"width": 720,
|
||||||
"height": 720,
|
"height": 1280,
|
||||||
"anisotropy": 0,
|
"anisotropy": 0,
|
||||||
"minfilter": "linear",
|
"minfilter": "linear",
|
||||||
"magfilter": "linear",
|
"magfilter": "linear",
|
||||||
|
@ -100,33 +100,6 @@ class JNGSyncFrame extends JNSyncFrame{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//重写UI Base
|
|
||||||
export class JNGLayerBase extends JNLayerBase{
|
|
||||||
public close():void {
|
|
||||||
console.log("close");
|
|
||||||
app.layer.CloseNode(this.node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//重写Sync Base
|
|
||||||
export class JNGSyncBase<T> extends JNSyncFrameComponent<T>{
|
|
||||||
onSyncLoad() { }
|
|
||||||
onSyncUpdate(dt: number,frame:JNFrameInfo, input?: T) { }
|
|
||||||
protected getSync(): JNSyncFrame {
|
|
||||||
return app.sync
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
//重写Sync Proto Base
|
|
||||||
export abstract class JNGSyncProtoBase<T> extends JNSyncFrameProtoComponent<T>{
|
|
||||||
|
|
||||||
onSyncLoad() { }
|
|
||||||
onSyncUpdate(dt: number,frame:JNFrameInfo, input?: T) { }
|
|
||||||
protected getSync(): JNSyncFrame {
|
|
||||||
return app.sync
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
export var TD:Tables = null;
|
export var TD:Tables = null;
|
||||||
//读写config
|
//读写config
|
||||||
|
@ -21,11 +21,11 @@ export class Main extends Component {
|
|||||||
//加载 APP
|
//加载 APP
|
||||||
await JNGame.Init(app);
|
await JNGame.Init(app);
|
||||||
|
|
||||||
// //发生帧同步开始
|
//发生帧同步开始
|
||||||
// app.socket.Send(JNSyncAction.NSyncFrameStart);
|
app.socket.Send(JNSyncAction.NSyncFrameStart);
|
||||||
|
|
||||||
// // 创建世界
|
// 创建世界
|
||||||
// director.getScene().addChild(instantiate(this.WorldPrefab));
|
director.getScene().addChild(instantiate(this.WorldPrefab));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,9 +1,6 @@
|
|||||||
import { _decorator, Component, instantiate, Node, Prefab } from 'cc';
|
import { _decorator, Component, Node, Prefab } from 'cc';
|
||||||
import { JNFrameInfo, JNSyncFrameEvent } from '../../extensions/ngame/assets/ngame/sync/frame/JNSyncFrame';
|
|
||||||
import { app } from './App';
|
|
||||||
import { JNSyncAction } from '../../extensions/ngame/assets/ngame/sync/JNSyncAction';
|
|
||||||
import { Camera } from 'cc';
|
import { Camera } from 'cc';
|
||||||
import GBaseMode from './battle/GBaseMode';
|
import GBattleModeManager from './battle/GBattleModeManager';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('WorldCanvas')
|
@ccclass('WorldCanvas')
|
||||||
@ -15,7 +12,7 @@ export class WorldCanvas extends Component {
|
|||||||
camera:Camera = null;
|
camera:Camera = null;
|
||||||
|
|
||||||
@property([Prefab])
|
@property([Prefab])
|
||||||
prefabs:Prefab[] = [];
|
modes:Prefab[] = [];
|
||||||
|
|
||||||
index:number = 1;
|
index:number = 1;
|
||||||
|
|
||||||
@ -24,40 +21,19 @@ export class WorldCanvas extends Component {
|
|||||||
//重置相机位置
|
//重置相机位置
|
||||||
this.camera.node.setWorldPosition(0,0,1000);
|
this.camera.node.setWorldPosition(0,0,1000);
|
||||||
|
|
||||||
//监听帧同步
|
//初始化游戏模式管理器
|
||||||
app.event.on(JNSyncFrameEvent.CLEAR,this.clear,this);
|
GBattleModeManager.getIns().onInit({
|
||||||
app.event.on(JNSyncFrameEvent.CREATE,this.create,this);
|
modes:this.modes, //模式
|
||||||
|
camera:this.camera, //相机
|
||||||
//监听帧回调
|
root:this.root, //场景
|
||||||
app.socket.on(JNSyncAction.NSyncFrameBack,this.onFrameBack,this,"JNFrameInfo");
|
|
||||||
|
|
||||||
app.sync.onReset();
|
|
||||||
app.sync.onStart();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//清除世界
|
|
||||||
clear(){
|
|
||||||
this.root.removeAllChildren();
|
|
||||||
}
|
|
||||||
|
|
||||||
//创建世界
|
|
||||||
create(){
|
|
||||||
let world = instantiate(this.prefabs[this.index]);
|
|
||||||
world.getComponent(GBaseMode).camera = this.camera;
|
|
||||||
this.root.addChild(world)
|
|
||||||
this.scheduleOnce(() => {
|
|
||||||
app.sync.onStart();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
update(deltaTime: number) {
|
update(deltaTime: number) {
|
||||||
app.sync.update(deltaTime);
|
GBattleModeManager.getIns().onUpdate(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
onFrameBack(info:JNFrameInfo){
|
|
||||||
app.sync.addFrame(info,true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,14 +1,137 @@
|
|||||||
|
import { Prefab } from "cc";
|
||||||
import Singleton from "../../../extensions/ngame/assets/ngame/util/Singleton";
|
import Singleton from "../../../extensions/ngame/assets/ngame/util/Singleton";
|
||||||
|
import { Camera } from "cc";
|
||||||
|
import GBaseMode from "./GBaseMode";
|
||||||
|
import { Node } from "cc";
|
||||||
|
import { instantiate } from "cc";
|
||||||
|
import { app } from "../App";
|
||||||
|
import { JNFrameInfo, JNSyncFrameEvent } from "../../../extensions/ngame/assets/ngame/sync/frame/JNSyncFrame";
|
||||||
|
|
||||||
export enum BattleMode{
|
export enum BattleMode{
|
||||||
|
//无尽模式
|
||||||
|
OnHook = 0,
|
||||||
//PVP 模式
|
//PVP 模式
|
||||||
PVP,
|
PVP = 1,
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface GBattleModeInfo{
|
||||||
|
modes:Prefab[], //模式预制体
|
||||||
|
camera:Camera, //场景相机
|
||||||
|
root:Node, //世界场景Root
|
||||||
}
|
}
|
||||||
|
|
||||||
//全局战斗模式管理器
|
//全局战斗模式管理器
|
||||||
export default class GBattleModeManager extends Singleton {
|
export default class GBattleModeManager extends Singleton {
|
||||||
|
|
||||||
|
//模式预制体
|
||||||
|
modes:Prefab[] = [];
|
||||||
|
//场景相机
|
||||||
|
camera:Camera;
|
||||||
|
//世界场景Root
|
||||||
|
root:Node;
|
||||||
|
|
||||||
|
//是否初始化
|
||||||
|
isInit:boolean = false;
|
||||||
|
|
||||||
|
//当前模式
|
||||||
|
current:BattleMode = null;
|
||||||
|
|
||||||
|
//是否自动退帧
|
||||||
|
isAuto:boolean = false;
|
||||||
|
|
||||||
|
//自动推帧间隔
|
||||||
|
autoTime:number = 0;
|
||||||
|
|
||||||
|
//初始化管理器
|
||||||
|
async onInit(info:GBattleModeInfo){
|
||||||
|
|
||||||
|
this.modes = info.modes || [];
|
||||||
|
this.camera = info.camera;
|
||||||
|
this.root = info.root;
|
||||||
|
|
||||||
|
//监听帧同步 世界创建逻辑
|
||||||
|
app.event.on(JNSyncFrameEvent.CLEAR,this.clear,this);
|
||||||
|
app.event.on(JNSyncFrameEvent.CREATE,this.create,this);
|
||||||
|
|
||||||
|
this.isInit = true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//打开指定模式
|
||||||
|
async Open(mode:BattleMode,isAuto:boolean = false){
|
||||||
|
|
||||||
|
await this.Close();
|
||||||
|
|
||||||
|
this.current = mode;
|
||||||
|
this.setAuto(isAuto);
|
||||||
|
|
||||||
|
app.sync.onReset();
|
||||||
|
app.sync.onStart();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//关闭当前模式
|
||||||
|
async Close(){
|
||||||
|
|
||||||
|
//主动调用场景销毁
|
||||||
|
app.sync.onReset();
|
||||||
|
this.clear();
|
||||||
|
this.current = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置自动推帧 ( 帧不由addFrame控制 管理器自动推帧)
|
||||||
|
setAuto(is:boolean){
|
||||||
|
this.isAuto = is;
|
||||||
|
this.autoTime = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//清除当前模式
|
||||||
|
private clear(){
|
||||||
|
if(!this.isInit) return;
|
||||||
|
this.root.destroyAllChildren();
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建当前模式
|
||||||
|
private create(){
|
||||||
|
if(!this.isInit || this.current == null) return;
|
||||||
|
let mode = instantiate(this.modes[this.current]);
|
||||||
|
mode.getComponent(GBaseMode).camera = this.camera;
|
||||||
|
this.root.addChild(mode)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//向场景推帧
|
||||||
|
addFrame(info:JNFrameInfo){
|
||||||
|
if(this.isAuto) return; //如果是自动推帧则返回
|
||||||
|
app.sync.addFrame(info,true);
|
||||||
|
}
|
||||||
|
|
||||||
|
//管理器更新
|
||||||
|
onUpdate(dt:number){
|
||||||
|
//更新帧同步
|
||||||
|
app.sync.update(dt);
|
||||||
|
//自动推帧
|
||||||
|
this.onAutoFrame(dt);
|
||||||
|
}
|
||||||
|
|
||||||
|
//自动推帧
|
||||||
|
private onAutoFrame(dt:number){
|
||||||
|
|
||||||
|
if(!this.isAuto) return;
|
||||||
|
|
||||||
|
this.autoTime += dt * 1000;
|
||||||
|
|
||||||
|
//获取当前帧同步的帧数推空帧
|
||||||
|
if(app.sync.nSyncTime < this.autoTime){
|
||||||
|
//如果事件够则推帧
|
||||||
|
this.autoTime -= app.sync.nSyncTime;
|
||||||
|
app.sync.addFrame({
|
||||||
|
index:app.sync.nLocalFrame + 1
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Vec2 } from "cc";
|
import { Vec2 } from "cc";
|
||||||
import { JNGSyncProtoBase } from "../../App";
|
|
||||||
import GBaseMode from "../GBaseMode";
|
import GBaseMode from "../GBaseMode";
|
||||||
import { v2 } from "cc";
|
import { v2 } from "cc";
|
||||||
|
import { JNGSyncProtoBase } from "../../components/JNComponent";
|
||||||
|
|
||||||
export enum GTowards{
|
export enum GTowards{
|
||||||
RIGHT,LEFT
|
RIGHT,LEFT
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { _decorator, Component, Node } from 'cc';
|
import { _decorator, Component, Node } from 'cc';
|
||||||
import { app, JNGSyncBase } from '../../../../App';
|
|
||||||
import { SpriteFrame } from 'cc';
|
import { SpriteFrame } from 'cc';
|
||||||
import { Sprite } from 'cc';
|
import { Sprite } from 'cc';
|
||||||
import { UITransform } from 'cc';
|
import { UITransform } from 'cc';
|
||||||
import { v3 } from 'cc';
|
import { v3 } from 'cc';
|
||||||
import { size } from 'cc';
|
import { size } from 'cc';
|
||||||
import GNode from '../GNode';
|
import GNode from '../GNode';
|
||||||
|
import { JNGSyncBase } from '../../../../components/JNComponent';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -106,16 +106,19 @@ export default class GOnHookMode extends GBaseMode<{}>{
|
|||||||
|
|
||||||
//调整相机
|
//调整相机
|
||||||
let camreaPos = this.camera.node.worldPosition;
|
let camreaPos = this.camera.node.worldPosition;
|
||||||
this.camera.node.worldPosition = v3(0,100,camreaPos.z)
|
this.camera.node.worldPosition = v3(0,800,camreaPos.z)
|
||||||
|
|
||||||
//初始化状态机
|
//初始化状态机
|
||||||
this.fsm = new GFSMOnHookMode(this);
|
this.fsm = new GFSMOnHookMode(this);
|
||||||
|
|
||||||
//初始化地图
|
//初始化地图
|
||||||
this.mapInfo = TD.TbGMap.get(60001);
|
this.mapInfo = TD.TbGMap.get(60001);
|
||||||
this.map1.init(app.battleRes.maps[60001][0],1);
|
|
||||||
this.map2.init(app.battleRes.maps[60001][1],1);
|
let scale = this.mapInfo.scale;
|
||||||
this.map3.init(app.battleRes.maps[60001][2],1,app.battleRes.maps[60001][1].width,app.battleRes.maps[60001][1].height);
|
|
||||||
|
this.map1.init(app.battleRes.maps[60001][0],1,app.battleRes.maps[60001][0].width * scale,app.battleRes.maps[60001][0].height * scale);
|
||||||
|
this.map2.init(app.battleRes.maps[60001][1],1,app.battleRes.maps[60001][1].width * scale,app.battleRes.maps[60001][1].height * scale);
|
||||||
|
this.map3.init(app.battleRes.maps[60001][2],1,app.battleRes.maps[60001][1].width * scale,1048 * scale);
|
||||||
this.onUpdateMap(0);
|
this.onUpdateMap(0);
|
||||||
|
|
||||||
this.playerInfo = { tactical: GTactical.getTactical().setOffset(this.playerPos), roles: GRoleUtil.getGRoles([10004,10004,10004,10004,10003,10003]) };
|
this.playerInfo = { tactical: GTactical.getTactical().setOffset(this.playerPos), roles: GRoleUtil.getGRoles([10004,10004,10004,10004,10003,10003]) };
|
||||||
|
9
JisolGameCocos/assets/script/components.meta
Normal file
9
JisolGameCocos/assets/script/components.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "1.2.0",
|
||||||
|
"importer": "directory",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "2deea119-e5ca-4136-a47a-7c1e4f58421f",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
33
JisolGameCocos/assets/script/components/JNComponent.ts
Normal file
33
JisolGameCocos/assets/script/components/JNComponent.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import JNSyncFrame, { JNFrameInfo } from "../../../extensions/ngame/assets/ngame/sync/frame/JNSyncFrame";
|
||||||
|
import JNSyncFrameComponent from "../../../extensions/ngame/assets/ngame/sync/frame/game/JNSyncFrameComponent";
|
||||||
|
import JNSyncFrameProtoComponent from "../../../extensions/ngame/assets/ngame/sync/frame/game/JNSyncFrameProtoComponent";
|
||||||
|
import JNLayerBase from "../../../extensions/ngame/assets/ngame/ui/base/JNLayerBase";
|
||||||
|
import { app } from "../App";
|
||||||
|
|
||||||
|
//重写UI Base
|
||||||
|
export class JNGLayerBase extends JNLayerBase{
|
||||||
|
public close():void {
|
||||||
|
console.log("close");
|
||||||
|
app.layer.CloseNode(this.node);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//重写Sync Base
|
||||||
|
export class JNGSyncBase<T> extends JNSyncFrameComponent<T>{
|
||||||
|
onSyncLoad() { }
|
||||||
|
onSyncUpdate(dt: number,frame:JNFrameInfo, input?: T) { }
|
||||||
|
protected getSync(): JNSyncFrame {
|
||||||
|
return app.sync
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//重写Sync Proto Base
|
||||||
|
export abstract class JNGSyncProtoBase<T> extends JNSyncFrameProtoComponent<T>{
|
||||||
|
|
||||||
|
onSyncLoad() { }
|
||||||
|
onSyncUpdate(dt: number,frame:JNFrameInfo, input?: T) { }
|
||||||
|
protected getSync(): JNSyncFrame {
|
||||||
|
return app.sync
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ver": "4.0.23",
|
||||||
|
"importer": "typescript",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "1dcad6c8-dd7e-4d30-ad3d-2d98e1e9f48d",
|
||||||
|
"files": [],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@ -1,5 +1,4 @@
|
|||||||
import { _decorator, Component, Node } from 'cc';
|
import { _decorator, Component, Node } from 'cc';
|
||||||
import { app, JNGLayerBase } from '../../../App';
|
|
||||||
import { Prefab } from 'cc';
|
import { Prefab } from 'cc';
|
||||||
import ChatData from '../../../data/ChatData';
|
import ChatData from '../../../data/ChatData';
|
||||||
import { instantiate } from 'cc';
|
import { instantiate } from 'cc';
|
||||||
@ -9,6 +8,8 @@ import { GUI } from '../../UIConfig';
|
|||||||
import { GUIChatMessage } from '../../../consts/GActionType';
|
import { GUIChatMessage } from '../../../consts/GActionType';
|
||||||
import { Widget } from 'cc';
|
import { Widget } from 'cc';
|
||||||
import JScrollExceedHide from '../../../../../extensions/ngame/assets/ngame/util/components/JScrollExceedHide';
|
import JScrollExceedHide from '../../../../../extensions/ngame/assets/ngame/util/components/JScrollExceedHide';
|
||||||
|
import { JNGLayerBase } from '../../../components/JNComponent';
|
||||||
|
import { app } from '../../../App';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('MainChatView')
|
@ccclass('MainChatView')
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { _decorator, Component, Label, Node } from 'cc';
|
import { _decorator, Component, Label, Node } from 'cc';
|
||||||
import { app, JNGLayerBase } from '../../App';
|
|
||||||
import { Toggle } from 'cc';
|
import { Toggle } from 'cc';
|
||||||
import { JNSyncAction } from '../../../../extensions/ngame/assets/ngame/sync/JNSyncAction';
|
import { JNSyncAction } from '../../../../extensions/ngame/assets/ngame/sync/JNSyncAction';
|
||||||
import { director } from 'cc';
|
import { director } from 'cc';
|
||||||
@ -7,6 +6,8 @@ import { WorldCanvas } from '../../WorldCanvas';
|
|||||||
import { StorageData, StorageEnum } from '../../consts/GData';
|
import { StorageData, StorageEnum } from '../../consts/GData';
|
||||||
import { GUI } from '../UIConfig';
|
import { GUI } from '../UIConfig';
|
||||||
import { API } from '../../consts/API';
|
import { API } from '../../consts/API';
|
||||||
|
import { JNGLayerBase } from '../../components/JNComponent';
|
||||||
|
import { app } from '../../App';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('HomeView')
|
@ccclass('HomeView')
|
||||||
|
@ -1,21 +1,39 @@
|
|||||||
import { _decorator, Component, Label, Node } from 'cc';
|
import { _decorator, Component, Label, Node } from 'cc';
|
||||||
import { app, JNGLayerBase } from '../../App';
|
|
||||||
import { GUI } from '../UIConfig';
|
import { GUI } from '../UIConfig';
|
||||||
import ChatData from '../../data/ChatData';
|
import ChatData from '../../data/ChatData';
|
||||||
import PlayerData from '../../data/PlayerData';
|
import PlayerData from '../../data/PlayerData';
|
||||||
|
import GBattleModeManager, { BattleMode } from '../../battle/GBattleModeManager';
|
||||||
|
import { JNGLayerBase } from '../../components/JNComponent';
|
||||||
|
import { app } from '../../App';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('MainView')
|
@ccclass('MainView')
|
||||||
export class MainView extends JNGLayerBase {
|
export class MainView extends JNGLayerBase {
|
||||||
|
|
||||||
|
@property(Label)
|
||||||
|
playerNameLabel:Label; //玩家名称
|
||||||
|
|
||||||
onJNLoad(data?: any): void {
|
onJNLoad(data?: any): void {
|
||||||
|
|
||||||
|
//默认无限模式
|
||||||
|
GBattleModeManager.getIns().Open(BattleMode.OnHook,true);
|
||||||
|
|
||||||
//发送消息
|
//发送消息
|
||||||
ChatData.getIns().onSend({
|
ChatData.getIns().onSend({
|
||||||
message:`${PlayerData.getIns().data.playerId} 加入游戏`
|
message:`${PlayerData.getIns().data.playerId} 加入游戏`
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.onUpdateView();
|
||||||
|
}
|
||||||
|
|
||||||
|
//更新UI界面
|
||||||
|
onUpdateView(){
|
||||||
|
this.playerNameLabel.string = PlayerData.getIns().getInfo().playerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
//打开Demo页面
|
||||||
|
onOpenDemo(){
|
||||||
|
app.layer.Open(GUI.Home);
|
||||||
}
|
}
|
||||||
|
|
||||||
//打开聊天页面
|
//打开聊天页面
|
||||||
@ -23,6 +41,11 @@ export class MainView extends JNGLayerBase {
|
|||||||
app.layer.Open(GUI.MainChat);
|
app.layer.Open(GUI.MainChat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//点击打开无限模式
|
||||||
|
onOpenOnHook(){
|
||||||
|
GBattleModeManager.getIns().Open(BattleMode.OnHook,true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { ProgressBar } from "cc";
|
import { ProgressBar } from "cc";
|
||||||
import { _decorator } from "cc";
|
import { _decorator } from "cc";
|
||||||
import { JNGLayerBase, app } from "../../App";
|
|
||||||
import { Label } from "cc";
|
import { Label } from "cc";
|
||||||
import { GUI } from "../UIConfig";
|
import { GUI } from "../UIConfig";
|
||||||
import NoviceManager from "../../manager/NoviceManager";
|
import NoviceManager from "../../manager/NoviceManager";
|
||||||
|
import { JNGLayerBase } from "../../components/JNComponent";
|
||||||
|
import { app } from "../../App";
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('LoadingView')
|
@ccclass('LoadingView')
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { _decorator, Component, Node } from 'cc';
|
import { _decorator, Component, Node } from 'cc';
|
||||||
import { app, JNGLayerBase } from '../../App';
|
|
||||||
import { EditBox } from 'cc';
|
import { EditBox } from 'cc';
|
||||||
import { API } from '../../consts/API';
|
import { API } from '../../consts/API';
|
||||||
|
import { JNGLayerBase } from '../../components/JNComponent';
|
||||||
|
import { app } from '../../App';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
@ccclass('NoviceNamingView')
|
@ccclass('NoviceNamingView')
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
import { JNGLayerBase, TD, app } from '../../App';
|
|
||||||
import { TbGGlobalEnum } from '../../../resources/config/TbGGlobalEnum';
|
import { TbGGlobalEnum } from '../../../resources/config/TbGGlobalEnum';
|
||||||
import { _decorator,Node } from 'cc';
|
import { _decorator,Node } from 'cc';
|
||||||
import { sp } from 'cc';
|
import { sp } from 'cc';
|
||||||
import { UIPetAnim } from '../../consts/GData';
|
import { UIPetAnim } from '../../consts/GData';
|
||||||
import { Sprite } from 'cc';
|
import { Sprite } from 'cc';
|
||||||
import { Color } from 'cc';
|
import { Color } from 'cc';
|
||||||
import { API } from '../../consts/API';
|
|
||||||
import { GUI } from '../UIConfig';
|
import { GUI } from '../UIConfig';
|
||||||
import PlayerPetData from '../../data/PlayerPetData';
|
import PlayerPetData from '../../data/PlayerPetData';
|
||||||
|
import { JNGLayerBase } from '../../components/JNComponent';
|
||||||
|
import { app, TD } from '../../App';
|
||||||
const { ccclass, property } = _decorator;
|
const { ccclass, property } = _decorator;
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user