update
@ -1996,14 +1996,14 @@
|
||||
"playerContainer": {
|
||||
"__id__": 23
|
||||
},
|
||||
"playerItem": {
|
||||
"playerPrefab": {
|
||||
"__uuid__": "7b0c739f-cf46-48f7-8c15-c97ab34268fe",
|
||||
"__expectedType__": "cc.Prefab"
|
||||
},
|
||||
"roomContainer": {
|
||||
"__id__": 36
|
||||
},
|
||||
"roomItem": {
|
||||
"roomPrefab": {
|
||||
"__uuid__": "b91571d9-7804-4e62-b9d4-eef2f8f0cadd",
|
||||
"__expectedType__": "cc.Prefab"
|
||||
},
|
||||
|
@ -1314,7 +1314,7 @@
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "8ee1b1zWztIraCgWh1qCNp9",
|
||||
"handler": "handleGameStart",
|
||||
"handler": "handleStart",
|
||||
"customEventData": ""
|
||||
},
|
||||
{
|
||||
@ -1688,7 +1688,7 @@
|
||||
"playerContainer": {
|
||||
"__id__": 19
|
||||
},
|
||||
"playerItem": {
|
||||
"playerPrefab": {
|
||||
"__uuid__": "7b0c739f-cf46-48f7-8c15-c97ab34268fe",
|
||||
"__expectedType__": "cc.Prefab"
|
||||
},
|
||||
|
@ -2,7 +2,7 @@
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "5802fd2f-7823-4294-91c8-d71adca41319",
|
||||
"uuid": "b5fb8ade-69bf-469c-9685-0d14804b00ac",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
@ -2,7 +2,7 @@
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "d4aded25-46cd-4911-b695-170d2eb72fd6",
|
||||
"uuid": "b207a15b-0f84-4e83-93de-cb6186e22772",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
@ -1,14 +1,16 @@
|
||||
import { _decorator, instantiate, ProgressBar, Label } from 'cc';
|
||||
import { EntityManager } from '../../Base/EntityManager';
|
||||
import { EntityTypeEnum, EntityStateEnum, InputType } from '../../Enum';
|
||||
import DataManager, { IPlayer, IVec2 } from '../../Global/DataManager';
|
||||
import { ApiMsgEnum, EntityTypeEnum, IActor, InputTypeEnum, IVec2 } from '../../Common';
|
||||
import { EntityStateEnum } from '../../Enum';
|
||||
import DataManager from '../../Global/DataManager';
|
||||
import NetworkManager from '../../Global/NetworkManager';
|
||||
import { rad2Angle } from '../../Utils';
|
||||
import { WeaponManager } from '../Weapon/WeaponManager';
|
||||
import { PlayerStateMachine } from './PlayerStateMachine';
|
||||
import { PlayerStateMachine } from './ActorStateMachine';
|
||||
const { ccclass } = _decorator;
|
||||
|
||||
@ccclass('PlayerManager')
|
||||
export class PlayerManager extends EntityManager {
|
||||
@ccclass('ActorManager')
|
||||
export class ActorManager extends EntityManager implements IActor {
|
||||
//静态数据
|
||||
id: number
|
||||
nickname: string
|
||||
@ -29,7 +31,7 @@ export class PlayerManager extends EntityManager {
|
||||
return DataManager.Instance.myPlayerId === this.id
|
||||
}
|
||||
|
||||
init(data: IPlayer) {
|
||||
init(data: IActor) {
|
||||
const { id, nickname, type, weaponType, bulletType } = data
|
||||
this.id = id
|
||||
this.nickname = nickname
|
||||
@ -58,8 +60,8 @@ export class PlayerManager extends EntityManager {
|
||||
}
|
||||
|
||||
const { x, y } = DataManager.Instance.jm.input
|
||||
DataManager.Instance.applyInput({
|
||||
type: InputType.PlayerMove,
|
||||
NetworkManager.Instance.sendMsg(ApiMsgEnum.MsgClientSync, {
|
||||
type: InputTypeEnum.ActorMove,
|
||||
id: this.id,
|
||||
direction: {
|
||||
x,
|
||||
@ -69,21 +71,21 @@ export class PlayerManager extends EntityManager {
|
||||
})
|
||||
}
|
||||
|
||||
render(data: IPlayer) {
|
||||
render(data: IActor) {
|
||||
this.renderHP(data)
|
||||
this.renderPosition(data)
|
||||
this.renderDirection(data)
|
||||
}
|
||||
|
||||
renderHP(data: IPlayer) {
|
||||
renderHP(data: IActor) {
|
||||
this.hpBar.progress = data.hp / this.hpBar.totalLength
|
||||
}
|
||||
|
||||
renderPosition(data: IPlayer) {
|
||||
renderPosition(data: IActor) {
|
||||
this.node.setPosition(data.position.x, data.position.y)
|
||||
}
|
||||
|
||||
renderDirection(data: IPlayer) {
|
||||
renderDirection(data: IActor) {
|
||||
if (data.direction.x === 0 && data.direction.y === 0) {
|
||||
this.state = EntityStateEnum.Idle
|
||||
return
|
@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "0b36580d-5fc7-40c1-9ac0-0fb78a685fd1",
|
||||
"uuid": "aaa694fa-4476-44b2-9213-4b4978a57d66",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
@ -1,7 +1,8 @@
|
||||
import { _decorator, Animation, AnimationClip } from 'cc'
|
||||
import State from '../../Base/State'
|
||||
import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine'
|
||||
import { EntityTypeEnum, EntityStateEnum, ParamsNameEnum } from '../../Enum'
|
||||
import { EntityTypeEnum } from '../../Common'
|
||||
import { EntityStateEnum, ParamsNameEnum } from '../../Enum'
|
||||
const { ccclass } = _decorator
|
||||
|
||||
@ccclass('PlayerStateMachine')
|
@ -2,7 +2,7 @@
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "26da1a71-eb0d-463d-b2d6-fbc64bf0ab89",
|
||||
"uuid": "67239e69-9cbb-42c8-ae8f-27f8bae24103",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
@ -1,7 +1,8 @@
|
||||
import { _decorator } from 'cc'
|
||||
import { EntityManager } from '../../Base/EntityManager'
|
||||
import { EntityTypeEnum, EntityStateEnum, EventEnum } from '../../Enum'
|
||||
import DataManager, { IBullet, IVec2 } from '../../Global/DataManager'
|
||||
import { EntityTypeEnum, IBullet, IVec2 } from '../../Common'
|
||||
import { EntityStateEnum, EventEnum } from '../../Enum'
|
||||
import DataManager from '../../Global/DataManager'
|
||||
import EventManager from '../../Global/EventManager'
|
||||
import ObjectPoolManager from '../../Global/ObjectPoolManager'
|
||||
import { rad2Angle } from '../../Utils'
|
||||
@ -10,7 +11,7 @@ import { BulletStateMachine } from './BulletStateMachine'
|
||||
const { ccclass } = _decorator
|
||||
|
||||
@ccclass('BulletManager')
|
||||
export class BulletManager extends EntityManager {
|
||||
export class BulletManager extends EntityManager implements IBullet {
|
||||
//静态数据
|
||||
id: number
|
||||
owner: number
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { _decorator, Animation } from 'cc'
|
||||
import State from '../../Base/State'
|
||||
import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine'
|
||||
import { EntityTypeEnum, EntityStateEnum, ParamsNameEnum } from '../../Enum'
|
||||
import { EntityTypeEnum } from '../../Common'
|
||||
import { EntityStateEnum, ParamsNameEnum } from '../../Enum'
|
||||
const { ccclass } = _decorator
|
||||
|
||||
@ccclass('BulletStateMachine')
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { _decorator } from 'cc'
|
||||
import { EntityManager } from '../../Base/EntityManager'
|
||||
import { EntityTypeEnum, EntityStateEnum } from '../../Enum'
|
||||
import { IVec2 } from '../../Global/DataManager'
|
||||
import { EntityTypeEnum, IVec2 } from '../../Common'
|
||||
import { EntityStateEnum } from '../../Enum'
|
||||
import { ExplosionStateMachine } from './ExplosionStateMachine'
|
||||
const { ccclass, property } = _decorator
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { _decorator, Animation } from 'cc'
|
||||
import State from '../../Base/State'
|
||||
import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine'
|
||||
import { EntityTypeEnum, EntityStateEnum, ParamsNameEnum } from '../../Enum'
|
||||
import { EntityTypeEnum } from '../../Common'
|
||||
import { EntityStateEnum, ParamsNameEnum } from '../../Enum'
|
||||
import ObjectPoolManager from '../../Global/ObjectPoolManager'
|
||||
const { ccclass, property } = _decorator
|
||||
|
||||
|
@ -1,8 +1,10 @@
|
||||
import { _decorator, Node, Vec2, UITransform } from 'cc'
|
||||
import { EntityManager } from '../../Base/EntityManager'
|
||||
import { EntityTypeEnum, EntityStateEnum, EventEnum, InputType } from '../../Enum'
|
||||
import DataManager, { IPlayer } from '../../Global/DataManager'
|
||||
import { ApiMsgEnum, EntityTypeEnum, InputTypeEnum } from '../../Common'
|
||||
import { EntityStateEnum, EventEnum } from '../../Enum'
|
||||
import DataManager from '../../Global/DataManager'
|
||||
import EventManager from '../../Global/EventManager'
|
||||
import NetworkManager from '../../Global/NetworkManager'
|
||||
import { WeaponStateMachine } from './WeaponStateMachine'
|
||||
const { ccclass } = _decorator
|
||||
|
||||
@ -19,7 +21,7 @@ export class WeaponManager extends EntityManager {
|
||||
return DataManager.Instance.myPlayerId === this.owner
|
||||
}
|
||||
|
||||
init({ id, weaponType }: IPlayer) {
|
||||
init({ id, weaponType }: { id: number, weaponType: EntityTypeEnum }) {
|
||||
this.owner = id
|
||||
this.type = weaponType
|
||||
|
||||
@ -58,8 +60,8 @@ export class WeaponManager extends EntityManager {
|
||||
const anchorWorldPos = this.anchor.getWorldPosition()
|
||||
const directionVec2 = new Vec2(pointWorldPos.x - anchorWorldPos.x, pointWorldPos.y - anchorWorldPos.y).normalize()
|
||||
|
||||
DataManager.Instance.applyInput({
|
||||
type: InputType.WeaponShoot,
|
||||
NetworkManager.Instance.sendMsg(ApiMsgEnum.MsgClientSync, {
|
||||
type: InputTypeEnum.WeaponShoot,
|
||||
owner: this.owner,
|
||||
position: {
|
||||
x: pointStagePos.x,
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { _decorator, Animation, AnimationClip } from 'cc'
|
||||
import State from '../../Base/State'
|
||||
import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine'
|
||||
import { EntityStateEnum, EntityTypeEnum, ParamsNameEnum } from '../../Enum'
|
||||
import { EntityTypeEnum } from '../../Common'
|
||||
import { EntityStateEnum, ParamsNameEnum } from '../../Enum'
|
||||
import { WeaponManager } from './WeaponManager'
|
||||
const { ccclass } = _decorator
|
||||
|
||||
|
@ -23,23 +23,10 @@ export enum EventEnum {
|
||||
GameStart = 'GameStart',
|
||||
}
|
||||
|
||||
export enum EntityTypeEnum {
|
||||
Map1 = 'Map1',
|
||||
Player1 = 'Player1',
|
||||
Player2 = 'Player2',
|
||||
Weapon1 = 'Weapon1',
|
||||
Weapon2 = 'Weapon2',
|
||||
Bullet1 = 'Bullet1',
|
||||
Bullet2 = 'Bullet2',
|
||||
Explosion = 'Explosion',
|
||||
JoyStick = 'JoyStick',
|
||||
Shoot = 'Shoot',
|
||||
}
|
||||
|
||||
export enum PrefabPathEnum {
|
||||
Map1 = 'prefab/Map1',
|
||||
Player1 = 'prefab/Player',
|
||||
Player2 = 'prefab/Player',
|
||||
Actor1 = 'prefab/Actor',
|
||||
Actor2 = 'prefab/Actor',
|
||||
Weapon1 = 'prefab/Weapon1',
|
||||
Weapon2 = 'prefab/Weapon2',
|
||||
Bullet1 = 'prefab/Bullet',
|
||||
@ -50,10 +37,10 @@ export enum PrefabPathEnum {
|
||||
}
|
||||
|
||||
export enum TexturePathEnum {
|
||||
Player1Idle = 'texture/player/player1/idle',
|
||||
Player1Run = 'texture/player/player1/run',
|
||||
Player2Idle = 'texture/player/player2/idle',
|
||||
Player2Run = 'texture/player/player2/run',
|
||||
Actor1Idle = 'texture/actor/actor1/idle',
|
||||
Actor1Run = 'texture/actor/actor1/run',
|
||||
Actor2Idle = 'texture/actor/actor2/idle',
|
||||
Actor2Run = 'texture/actor/actor2/run',
|
||||
Weapon1Idle = 'texture/weapon/weapon1/idle',
|
||||
Weapon1Attack = 'texture/weapon/weapon1/attack',
|
||||
Weapon2Idle = 'texture/weapon/weapon2/idle',
|
||||
@ -63,12 +50,6 @@ export enum TexturePathEnum {
|
||||
ExplosionIdle = 'texture/explosion',
|
||||
}
|
||||
|
||||
export enum InputType {
|
||||
PlayerMove = 'PlayerMove',
|
||||
WeaponShoot = 'WeaponShoot',
|
||||
TimePast = 'TimePast',
|
||||
}
|
||||
|
||||
export enum SceneEnum {
|
||||
Login = 'Login',
|
||||
Hall = 'Hall',
|
||||
|
@ -1,14 +1,12 @@
|
||||
import { Node, Prefab, SpriteFrame } from 'cc'
|
||||
import Singleton from '../Base/Singleton'
|
||||
import { EntityTypeEnum, IBullet, IClientInput, InputTypeEnum, IRoom, IState } from '../Common'
|
||||
import { ActorManager } from '../Entity/Actor/ActorManager'
|
||||
import { BulletManager } from '../Entity/Bullet/BulletManager'
|
||||
import { PlayerManager } from '../Entity/Player/PlayerManager'
|
||||
import { EntityTypeEnum, EventEnum, InputType } from '../Enum'
|
||||
import { EventEnum } from '../Enum'
|
||||
import { JoyStickManager } from '../UI/JoyStickManager'
|
||||
import EventManager from './EventManager'
|
||||
import { IData } from './NetworkManager'
|
||||
|
||||
export type IPlayer = Pick<PlayerManager, 'id' | 'nickname' | 'hp' | 'position' | 'direction' | 'type' | 'weaponType' | 'bulletType'>
|
||||
export type IBullet = Pick<BulletManager, 'id' | 'owner' | 'position' | 'direction' | 'type'>
|
||||
|
||||
const PLAYER_SPEED = 100
|
||||
const BULLET_SPEED = 600
|
||||
@ -18,36 +16,6 @@ const WEAPON_DAMAGE = 5
|
||||
const PLAYER_RADIUS = 50
|
||||
const BULLET_RADIUS = 10
|
||||
|
||||
export interface IVec2 {
|
||||
x: number;
|
||||
y: number
|
||||
}
|
||||
|
||||
interface IState {
|
||||
players: IPlayer[],
|
||||
bullets: IBullet[],
|
||||
nextBulletId: number
|
||||
}
|
||||
|
||||
interface IPlayerMove {
|
||||
type: InputType.PlayerMove
|
||||
id: number;
|
||||
direction: IVec2;
|
||||
dt: number;
|
||||
}
|
||||
|
||||
interface IWeaponShoot {
|
||||
type: InputType.WeaponShoot
|
||||
owner: number;
|
||||
position: IVec2;
|
||||
direction: IVec2;
|
||||
}
|
||||
|
||||
interface ITimePast {
|
||||
type: InputType.TimePast;
|
||||
dt: number
|
||||
}
|
||||
|
||||
export default class DataManager extends Singleton {
|
||||
static get Instance() {
|
||||
return super.GetInstance<DataManager>()
|
||||
@ -59,11 +27,11 @@ export default class DataManager extends Singleton {
|
||||
prefabMap: Map<string, Prefab> = new Map()
|
||||
textureMap: Map<string, SpriteFrame[]> = new Map()
|
||||
|
||||
playerMap: Map<number, PlayerManager> = new Map()
|
||||
actorMap: Map<number, ActorManager> = new Map()
|
||||
bulletMap: Map<number, BulletManager> = new Map()
|
||||
|
||||
myPlayerId = 1
|
||||
roomInfo: IData
|
||||
roomInfo: IRoom
|
||||
mapSize = {
|
||||
x: 960,
|
||||
y: 640,
|
||||
@ -82,7 +50,7 @@ export default class DataManager extends Singleton {
|
||||
y: 0
|
||||
},
|
||||
hp: 100,
|
||||
type: EntityTypeEnum.Player1,
|
||||
type: EntityTypeEnum.Actor1,
|
||||
weaponType: EntityTypeEnum.Weapon1,
|
||||
bulletType: EntityTypeEnum.Bullet1,
|
||||
}, {
|
||||
@ -97,7 +65,7 @@ export default class DataManager extends Singleton {
|
||||
y: -1
|
||||
},
|
||||
hp: 100,
|
||||
type: EntityTypeEnum.Player2,
|
||||
type: EntityTypeEnum.Actor2,
|
||||
weaponType: EntityTypeEnum.Weapon2,
|
||||
bulletType: EntityTypeEnum.Bullet2,
|
||||
}],
|
||||
@ -105,9 +73,9 @@ export default class DataManager extends Singleton {
|
||||
nextBulletId: 1
|
||||
}
|
||||
|
||||
applyInput(input: IPlayerMove | IWeaponShoot | ITimePast) {
|
||||
applyInput(input: IClientInput) {
|
||||
switch (input.type) {
|
||||
case InputType.PlayerMove: {
|
||||
case InputTypeEnum.ActorMove: {
|
||||
const { direction: { x, y }, dt, id } = input
|
||||
const player = this.state.players.find(e => e.id === id)
|
||||
if (!player) {
|
||||
@ -120,21 +88,21 @@ export default class DataManager extends Singleton {
|
||||
break
|
||||
}
|
||||
|
||||
case InputType.WeaponShoot: {
|
||||
case InputTypeEnum.WeaponShoot: {
|
||||
const { owner, position, direction } = input
|
||||
const bullet: IBullet = {
|
||||
id: this.state.nextBulletId++,
|
||||
owner,
|
||||
position,
|
||||
direction,
|
||||
type: this.playerMap.get(owner).bulletType
|
||||
type: this.actorMap.get(owner).bulletType
|
||||
}
|
||||
this.state.bullets.push(bullet)
|
||||
|
||||
EventManager.Instance.emit(EventEnum.BulletBorn, owner)
|
||||
break
|
||||
}
|
||||
case InputType.TimePast: {
|
||||
case InputTypeEnum.TimePast: {
|
||||
const { dt } = input
|
||||
const { bullets, players } = this.state
|
||||
|
||||
|
@ -1,27 +1,15 @@
|
||||
import Singleton from '../Base/Singleton'
|
||||
import { IModel } from '../Common';
|
||||
|
||||
const TIMEOUT = 5000
|
||||
|
||||
export type IData = Record<string, any>
|
||||
|
||||
export interface ICallApiRet {
|
||||
export interface ICallApiRet<T> {
|
||||
success: boolean;
|
||||
error?: Error;
|
||||
res?: IData
|
||||
}
|
||||
|
||||
export enum ApiMsgEnum {
|
||||
ApiPlayerList = 'ApiPlayerList',
|
||||
ApiPlayerJoin = 'ApiPlayerJoin',
|
||||
ApiRoomList = 'ApiRoomList',
|
||||
ApiRoomCreate = 'ApiRoomCreate',
|
||||
ApiRoomJoin = 'ApiRoomJoin',
|
||||
ApiRoomLeave = 'ApiRoomLeave',
|
||||
MsgPlayerList = 'MsgPlayerList',
|
||||
MsgRoomList = 'MsgRoomList',
|
||||
MsgRoom = 'MsgRoom',
|
||||
res?: T
|
||||
}
|
||||
|
||||
type aaa = keyof IModel
|
||||
export default class NetworkManager extends Singleton {
|
||||
static get Instance() {
|
||||
return super.GetInstance<NetworkManager>()
|
||||
@ -71,11 +59,36 @@ export default class NetworkManager extends Singleton {
|
||||
})
|
||||
}
|
||||
|
||||
sendMsg(name: string, data: IData) {
|
||||
callApi<T extends keyof IModel['api']>(name: T, data: IModel['api'][T]['req']): Promise<ICallApiRet<IModel['api'][T]['res']>> {
|
||||
return new Promise((resolve) => {
|
||||
try {
|
||||
// 超时处理
|
||||
const timer = setTimeout(() => {
|
||||
resolve({ success: false, error: new Error('timeout') })
|
||||
this.unlistenMsg(name, cb)
|
||||
}, TIMEOUT)
|
||||
|
||||
// 回调处理
|
||||
const cb = (res) => {
|
||||
resolve(res)
|
||||
clearTimeout(timer)
|
||||
this.unlistenMsg(name, cb)
|
||||
}
|
||||
this.listenMsg(name as any, cb)
|
||||
|
||||
this.ws.send(JSON.stringify({ name, data }))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
resolve({ success: false, error: error as Error })
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
sendMsg<T extends keyof IModel['msg']>(name: T, data: IModel['msg'][T]) {
|
||||
this.ws.send(JSON.stringify({ name, data }))
|
||||
}
|
||||
|
||||
listenMsg(name: string, cb: Function) {
|
||||
listenMsg<T extends keyof IModel['msg']>(name: T, cb: (args: IModel['msg'][T]) => void) {
|
||||
if (this.cbs.has(name)) {
|
||||
this.cbs.get(name).push(cb)
|
||||
} else {
|
||||
@ -89,29 +102,4 @@ export default class NetworkManager extends Singleton {
|
||||
index > -1 && this.cbs.get(name).splice(index, 1)
|
||||
}
|
||||
}
|
||||
|
||||
callApi(name: string, data: IData) {
|
||||
return new Promise<ICallApiRet>((resolve) => {
|
||||
try {
|
||||
// 超时处理
|
||||
const timer = setTimeout(() => {
|
||||
resolve({ success: false, error: new Error('timeout') })
|
||||
this.unlistenMsg(name, cb)
|
||||
}, TIMEOUT)
|
||||
|
||||
// 回调处理
|
||||
const cb = (res: ICallApiRet) => {
|
||||
resolve(res)
|
||||
clearTimeout(timer)
|
||||
this.unlistenMsg(name, cb)
|
||||
}
|
||||
this.listenMsg(name, cb)
|
||||
|
||||
this.ws.send(JSON.stringify({ name, data }))
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
resolve({ success: false, error: error as Error })
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import Singleton from '../Base/Singleton'
|
||||
import { instantiate, Node } from 'cc'
|
||||
import { EntityTypeEnum } from '../Enum'
|
||||
import DataManager from './DataManager'
|
||||
import { EntityTypeEnum } from '../Common'
|
||||
|
||||
export default class ObjectPoolManager extends Singleton {
|
||||
static get Instance() {
|
||||
|
@ -1,12 +1,13 @@
|
||||
import { _decorator, Component, Node, Prefab, instantiate, SpriteFrame } from 'cc';
|
||||
import { PlayerManager } from '../Entity/Player/PlayerManager';
|
||||
import { ActorManager } from '../Entity/Actor/ActorManager';
|
||||
import DataManager from '../Global/DataManager';
|
||||
import { JoyStickManager } from '../UI/JoyStickManager';
|
||||
import { ResourceManager } from '../Global/ResourceManager';
|
||||
import { EntityTypeEnum, InputType, PrefabPathEnum, TexturePathEnum } from '../Enum';
|
||||
import { PrefabPathEnum, TexturePathEnum } from '../Enum';
|
||||
import NetworkManager from '../Global/NetworkManager';
|
||||
import ObjectPoolManager from '../Global/ObjectPoolManager';
|
||||
import { BulletManager } from '../Entity/Bullet/BulletManager';
|
||||
import { EntityTypeEnum, InputTypeEnum } from '../Common';
|
||||
|
||||
const { ccclass } = _decorator;
|
||||
|
||||
@ -98,7 +99,7 @@ export class BattleManager extends Component {
|
||||
|
||||
tickPlayer(dt: number) {
|
||||
for (const p of DataManager.Instance.state.players) {
|
||||
const playerManager = DataManager.Instance.playerMap.get(p.id)
|
||||
const playerManager = DataManager.Instance.actorMap.get(p.id)
|
||||
if (!playerManager) {
|
||||
return
|
||||
}
|
||||
@ -108,7 +109,7 @@ export class BattleManager extends Component {
|
||||
|
||||
tickGlobal(dt: number) {
|
||||
DataManager.Instance.applyInput({
|
||||
type: InputType.TimePast,
|
||||
type: InputTypeEnum.TimePast,
|
||||
dt
|
||||
})
|
||||
}
|
||||
@ -120,13 +121,13 @@ export class BattleManager extends Component {
|
||||
|
||||
renderPlayer() {
|
||||
for (const p of DataManager.Instance.state.players) {
|
||||
let playerManager = DataManager.Instance.playerMap.get(p.id)
|
||||
let playerManager = DataManager.Instance.actorMap.get(p.id)
|
||||
if (!playerManager) {
|
||||
const playerPrefab = DataManager.Instance.prefabMap.get(p.type)
|
||||
const player = instantiate(playerPrefab)
|
||||
player.setParent(this.stage)
|
||||
playerManager = player.addComponent(PlayerManager)
|
||||
DataManager.Instance.playerMap.set(p.id, playerManager)
|
||||
playerManager = player.addComponent(ActorManager)
|
||||
DataManager.Instance.actorMap.set(p.id, playerManager)
|
||||
playerManager.init(p)
|
||||
} else {
|
||||
playerManager.render(p)
|
||||
|
@ -1,10 +1,11 @@
|
||||
import { _decorator, Component, Node, Prefab, director, instantiate } from 'cc';
|
||||
import { ApiMsgEnum, IApiPlayerListRes, IApiRoomListRes, IMsgPlayerList, IMsgRoomList } from '../Common';
|
||||
import { EventEnum, SceneEnum } from '../Enum';
|
||||
import DataManager from '../Global/DataManager';
|
||||
import EventManager from '../Global/EventManager';
|
||||
import NetworkManager, { ApiMsgEnum, IData } from '../Global/NetworkManager';
|
||||
import { PlayerItemManager } from '../UI/PlayerItemManager';
|
||||
import { RoomItemManager } from '../UI/RoomItemManager';
|
||||
import NetworkManager from '../Global/NetworkManager';
|
||||
import { PlayerManager } from '../UI/PlayerManager';
|
||||
import { RoomManager } from '../UI/RoomManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('HallManager')
|
||||
@ -13,24 +14,24 @@ export class HallManager extends Component {
|
||||
playerContainer: Node = null;
|
||||
|
||||
@property(Prefab)
|
||||
playerItem: Prefab = null;
|
||||
playerPrefab: Prefab = null;
|
||||
|
||||
@property(Node)
|
||||
roomContainer: Node = null;
|
||||
|
||||
@property(Prefab)
|
||||
roomItem: Prefab = null;
|
||||
roomPrefab: Prefab = null;
|
||||
|
||||
onLoad() {
|
||||
director.preloadScene(SceneEnum.Room);
|
||||
EventManager.Instance.on(EventEnum.RoomJoin, this.joinRoom, this)
|
||||
NetworkManager.Instance.listenMsg(ApiMsgEnum.MsgPlayerList, this.renderPlayer);
|
||||
NetworkManager.Instance.listenMsg(ApiMsgEnum.MsgPlayerList, this.renderPlayers);
|
||||
NetworkManager.Instance.listenMsg(ApiMsgEnum.MsgRoomList, this.renderRooms);
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
EventManager.Instance.off(EventEnum.RoomJoin, this.joinRoom, this)
|
||||
NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgPlayerList, this.renderPlayer);
|
||||
NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgPlayerList, this.renderPlayers);
|
||||
NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgRoomList, this.renderRooms);
|
||||
}
|
||||
|
||||
@ -46,15 +47,15 @@ export class HallManager extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
this.renderPlayer(res)
|
||||
this.renderPlayers(res)
|
||||
}
|
||||
|
||||
renderPlayer = ({ list }: IData) => {
|
||||
renderPlayers = ({ list }: IApiPlayerListRes | IMsgPlayerList) => {
|
||||
for (const item of this.playerContainer.children) {
|
||||
item.active = false
|
||||
}
|
||||
while (this.playerContainer.children.length < list.length) {
|
||||
const playerItem = instantiate(this.playerItem);
|
||||
const playerItem = instantiate(this.playerPrefab);
|
||||
playerItem.active = false
|
||||
playerItem.setParent(this.playerContainer)
|
||||
}
|
||||
@ -62,7 +63,7 @@ export class HallManager extends Component {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const data = list[i];
|
||||
const node = this.playerContainer.children[i]
|
||||
const playerItemManager = node.getComponent(PlayerItemManager)
|
||||
const playerItemManager = node.getComponent(PlayerManager)
|
||||
playerItemManager.init(data)
|
||||
}
|
||||
}
|
||||
@ -77,12 +78,12 @@ export class HallManager extends Component {
|
||||
this.renderRooms(res)
|
||||
}
|
||||
|
||||
renderRooms = ({ list }: IData) => {
|
||||
renderRooms = ({ list }: IApiRoomListRes | IMsgRoomList) => {
|
||||
for (const item of this.roomContainer.children) {
|
||||
item.active = false
|
||||
}
|
||||
while (this.roomContainer.children.length < list.length) {
|
||||
const roomItem = instantiate(this.roomItem);
|
||||
const roomItem = instantiate(this.roomPrefab);
|
||||
roomItem.active = false
|
||||
roomItem.setParent(this.roomContainer)
|
||||
}
|
||||
@ -90,7 +91,7 @@ export class HallManager extends Component {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const data = list[i];
|
||||
const node = this.roomContainer.children[i]
|
||||
const roomItemManager = node.getComponent(RoomItemManager)
|
||||
const roomItemManager = node.getComponent(RoomManager)
|
||||
roomItemManager.init(data)
|
||||
}
|
||||
}
|
||||
@ -102,8 +103,7 @@ export class HallManager extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
DataManager.Instance.roomInfo = { ...res }
|
||||
|
||||
DataManager.Instance.roomInfo = res.room
|
||||
director.loadScene(SceneEnum.Room);
|
||||
}
|
||||
|
||||
@ -114,8 +114,7 @@ export class HallManager extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
DataManager.Instance.roomInfo = { ...res }
|
||||
|
||||
DataManager.Instance.roomInfo = res.room
|
||||
director.loadScene(SceneEnum.Room);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
import { _decorator, Component, Node, EditBox, Button, director } from 'cc';
|
||||
import { _decorator, Component, EditBox, director } from 'cc';
|
||||
import { ApiMsgEnum } from '../Common';
|
||||
import { SceneEnum } from '../Enum';
|
||||
import DataManager from '../Global/DataManager';
|
||||
import NetworkManager, { ApiMsgEnum } from '../Global/NetworkManager';
|
||||
import NetworkManager from '../Global/NetworkManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('LoginManager')
|
||||
@ -16,7 +17,6 @@ export class LoginManager extends Component {
|
||||
async start() {
|
||||
await NetworkManager.Instance.connect();
|
||||
console.log("服务连接成功!");
|
||||
|
||||
}
|
||||
|
||||
async handleClick() {
|
||||
@ -38,7 +38,7 @@ export class LoginManager extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
DataManager.Instance.myPlayerId = res.id;
|
||||
DataManager.Instance.myPlayerId = res.player.id;
|
||||
director.loadScene(SceneEnum.Hall);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { _decorator, Component, Node, Prefab, director, instantiate } from 'cc';
|
||||
import { ApiMsgEnum, IMsgGameStart, IMsgRoom } from '../Common';
|
||||
import { EventEnum, SceneEnum } from '../Enum';
|
||||
import DataManager from '../Global/DataManager';
|
||||
import EventManager from '../Global/EventManager';
|
||||
import NetworkManager, { ApiMsgEnum, IData } from '../Global/NetworkManager';
|
||||
import { PlayerItemManager } from '../UI/PlayerItemManager';
|
||||
import NetworkManager from '../Global/NetworkManager';
|
||||
import { PlayerManager } from '../UI/PlayerManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('RoomManager')
|
||||
@ -12,27 +13,31 @@ export class RoomManager extends Component {
|
||||
playerContainer: Node = null;
|
||||
|
||||
@property(Prefab)
|
||||
playerItem: Prefab = null;
|
||||
playerPrefab: Prefab = null;
|
||||
|
||||
onLoad() {
|
||||
director.preloadScene(SceneEnum.Battle);
|
||||
NetworkManager.Instance.listenMsg(ApiMsgEnum.MsgRoom, this.renderPlayer);
|
||||
NetworkManager.Instance.listenMsg(ApiMsgEnum.MsgRoom, this.renderPlayers);
|
||||
NetworkManager.Instance.listenMsg(ApiMsgEnum.MsgGameStart, this.startGame);
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgRoom, this.renderPlayer);
|
||||
NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgRoom, this.renderPlayers);
|
||||
NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgGameStart, this.startGame);
|
||||
}
|
||||
|
||||
async start() {
|
||||
this.renderPlayer(DataManager.Instance.roomInfo)
|
||||
this.renderPlayers({
|
||||
room: DataManager.Instance.roomInfo
|
||||
})
|
||||
}
|
||||
|
||||
renderPlayer = ({ players: list }: any) => {
|
||||
renderPlayers = ({ room: { players: list } }: IMsgRoom) => {
|
||||
for (const item of this.playerContainer.children) {
|
||||
item.active = false
|
||||
}
|
||||
while (this.playerContainer.children.length < list.length) {
|
||||
const playerItem = instantiate(this.playerItem);
|
||||
const playerItem = instantiate(this.playerPrefab);
|
||||
playerItem.active = false
|
||||
playerItem.setParent(this.playerContainer)
|
||||
}
|
||||
@ -40,7 +45,7 @@ export class RoomManager extends Component {
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
const data = list[i];
|
||||
const node = this.playerContainer.children[i]
|
||||
const playerItemManager = node.getComponent(PlayerItemManager)
|
||||
const playerItemManager = node.getComponent(PlayerManager)
|
||||
playerItemManager.init(data)
|
||||
}
|
||||
}
|
||||
@ -56,9 +61,20 @@ export class RoomManager extends Component {
|
||||
director.loadScene(SceneEnum.Hall);
|
||||
}
|
||||
|
||||
handleGameStart() {
|
||||
console.log("handleGameStart");
|
||||
async handleStart() {
|
||||
const { success, res, error } = await NetworkManager.Instance.callApi(ApiMsgEnum.ApiGameStart, { rid: DataManager.Instance.roomInfo.id });
|
||||
if (!success) {
|
||||
console.log(error)
|
||||
return;
|
||||
}
|
||||
|
||||
// director.loadScene(SceneEnum.Battle);
|
||||
}
|
||||
|
||||
startGame = ({ state }: IMsgGameStart) => {
|
||||
DataManager.Instance.state = state
|
||||
|
||||
director.loadScene(SceneEnum.Battle);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@ import DataManager from '../Global/DataManager';
|
||||
import EventManager from '../Global/EventManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('PlayerItemManager')
|
||||
export class PlayerItemManager extends Component {
|
||||
@ccclass('PlayerManager')
|
||||
export class PlayerManager extends Component {
|
||||
init({ id, nickname, rid }: { id: number, nickname: string, rid: number }) {
|
||||
const label = this.getComponent(Label)
|
||||
let str = nickname
|
9
apps/client/assets/Scripts/UI/PlayerManager.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "741a7f88-76ef-4669-95a8-ce39c63a1c41",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
@ -3,8 +3,8 @@ import { EventEnum } from '../Enum';
|
||||
import EventManager from '../Global/EventManager';
|
||||
const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('RoomItemManager')
|
||||
export class RoomItemManager extends Component {
|
||||
@ccclass('RoomManager')
|
||||
export class RoomManager extends Component {
|
||||
id: number
|
||||
init({ id, players }: { id: number, players: Array<{ id: number, nickname: string }> }) {
|
||||
this.id = id
|
9
apps/client/assets/Scripts/UI/RoomManager.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "23e17e0e-7637-4c8c-9af7-91dc0f41301b",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
690
apps/client/assets/resources/prefab/Actor.prefab
Normal file
@ -0,0 +1,690 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "Actor",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"persistent": false,
|
||||
"asyncLoadAssets": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Actor",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 18
|
||||
},
|
||||
{
|
||||
"__id__": 22
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 28
|
||||
},
|
||||
{
|
||||
"__id__": 30
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 32
|
||||
},
|
||||
"_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
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "HP",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 3
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 11
|
||||
},
|
||||
{
|
||||
"__id__": 13
|
||||
},
|
||||
{
|
||||
"__id__": 15
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 17
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 70,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Bar",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 4
|
||||
},
|
||||
{
|
||||
"__id__": 6
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -50,
|
||||
"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
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 15
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "6eSfVOfMxPjb1oQVZ1z5hY"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "24a704da-2867-446d-8d1a-5e920c75e09d@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": "267GXyiYJB6qxCg6pLEfLQ"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"_alignFlags": 8,
|
||||
"_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": 0,
|
||||
"_originalHeight": 0,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "160ZgDPIFBEZ5Msv1mYMvN"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "35OAlXyaBOBpLPAOKsDZHk"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 15
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "ca65l+rt9Iz5il0zQDlfgE"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "9fd900dd-221b-4f89-8f2c-fba34243c835@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": "796J69Ia1LgrmmxsVBavZU"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.ProgressBar",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_barSprite": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_mode": 0,
|
||||
"_totalLength": 100,
|
||||
"_progress": 1,
|
||||
"_reverse": false,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "d2mnLSm7RHF7V3bD57PvC5"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "29DaYGvxpFo5cOAmvhl1Uj"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Nickname",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 19
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 21
|
||||
},
|
||||
"_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
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 18
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 20
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "8blUJZ4nJKpKsLO2YpEChI"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "5adoggTLFPToeEZEIA7Yh3"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Label",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 23
|
||||
},
|
||||
{
|
||||
"__id__": 25
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 27
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 98.845,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 24
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 110.72,
|
||||
"height": 50.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "2a/IDEWZRPcb6AKU5/XAlD"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 26
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "nickname",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 24,
|
||||
"_fontSize": 24,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": true,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "71ZjYMvjBES7FqZGSo1L00"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "03OAmogbVI5qDqTUJvplOC"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 29
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "43sIN2Al5OsJRxFqY+HJTV"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 31
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "f0f5e564-2d98-4de1-bb92-794eeb1acffc@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": "48V6DZW5BPxIbiTPVjSL37"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "60xKi1fHZAl6spWUrSZzlZ"
|
||||
}
|
||||
]
|
@ -2,12 +2,12 @@
|
||||
"ver": "1.1.39",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "7b0c739f-cf46-48f7-8c15-c97ab34268fe",
|
||||
"uuid": "d565d84f-56c4-4aa3-831c-99db0a0d2390",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "PlayerItem"
|
||||
"syncNodeName": "Actor"
|
||||
}
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"importer": "directory",
|
||||
"imported": true,
|
||||
"uuid": "9348a0ae-1f83-44fe-ae79-892e1db86d1a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"compressionType": {},
|
||||
"isRemoteBundle": {}
|
||||
}
|
||||
}
|
@ -1,200 +0,0 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "PlayerItem",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"persistent": false,
|
||||
"asyncLoadAssets": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "PlayerItem",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": null,
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 4
|
||||
},
|
||||
{
|
||||
"__id__": 6
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 10
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -460,
|
||||
"y": -20,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 3
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 240,
|
||||
"height": 50.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 1
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "69g2Ps4UpEQIdkibaU0mB+"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "这是一个昵称",
|
||||
"_horizontalAlign": 0,
|
||||
"_verticalAlign": 0,
|
||||
"_actualFontSize": 40,
|
||||
"_fontSize": 40,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "1fVVQb7LdIUZ7E43CVIsuV"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_alignFlags": 8,
|
||||
"_target": null,
|
||||
"_left": 20,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 0,
|
||||
"_originalHeight": 0,
|
||||
"_alignMode": 2,
|
||||
"_lockFlags": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "1dyUPgippJNLS6AWV5oz7O"
|
||||
},
|
||||
{
|
||||
"__type__": "0b365gNX8dAwZrAD7eKaF/R",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "35yNVdeqZKy6dIzoq3eYwD"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "fcj/6WYKJAnbG8wIajLBQ9"
|
||||
}
|
||||
]
|
@ -17,122 +17,12 @@
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 18
|
||||
},
|
||||
{
|
||||
"__id__": 22
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 28
|
||||
},
|
||||
{
|
||||
"__id__": 30
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 32
|
||||
},
|
||||
"_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
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "HP",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 3
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 11
|
||||
},
|
||||
{
|
||||
"__id__": 13
|
||||
},
|
||||
{
|
||||
"__id__": 15
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 17
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 70,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Bar",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 4
|
||||
},
|
||||
@ -148,8 +38,8 @@
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": -50,
|
||||
"y": 0,
|
||||
"x": -460,
|
||||
"y": -20,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
@ -179,38 +69,38 @@
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 3
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 5
|
||||
"__id__": 3
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 15
|
||||
"width": 240,
|
||||
"height": 50.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0.5
|
||||
"y": 1
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "6eSfVOfMxPjb1oQVZ1z5hY"
|
||||
"fileId": "69g2Ps4UpEQIdkibaU0mB+"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 3
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 7
|
||||
"__id__": 5
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
@ -218,47 +108,47 @@
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "24a704da-2867-446d-8d1a-5e920c75e09d@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,
|
||||
"_string": "这是一个昵称",
|
||||
"_horizontalAlign": 0,
|
||||
"_verticalAlign": 0,
|
||||
"_actualFontSize": 40,
|
||||
"_fontSize": 40,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": false,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "267GXyiYJB6qxCg6pLEfLQ"
|
||||
"fileId": "1fVVQb7LdIUZ7E43CVIsuV"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 3
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 9
|
||||
"__id__": 7
|
||||
},
|
||||
"_alignFlags": 8,
|
||||
"_target": null,
|
||||
"_left": 0,
|
||||
"_left": 20,
|
||||
"_right": 0,
|
||||
"_top": 0,
|
||||
"_bottom": 0,
|
||||
@ -278,7 +168,24 @@
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "160ZgDPIFBEZ5Msv1mYMvN"
|
||||
"fileId": "1dyUPgippJNLS6AWV5oz7O"
|
||||
},
|
||||
{
|
||||
"__type__": "741a7+Idu9GaZWozjnGOhxB",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "3a+8FHvk1IJKQVn3a/W2Mb"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
@ -288,403 +195,6 @@
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "35OAlXyaBOBpLPAOKsDZHk"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 15
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "ca65l+rt9Iz5il0zQDlfgE"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 14
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "9fd900dd-221b-4f89-8f2c-fba34243c835@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": "796J69Ia1LgrmmxsVBavZU"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.ProgressBar",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 16
|
||||
},
|
||||
"_barSprite": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_mode": 0,
|
||||
"_totalLength": 100,
|
||||
"_progress": 1,
|
||||
"_reverse": false,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "d2mnLSm7RHF7V3bD57PvC5"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "29DaYGvxpFo5cOAmvhl1Uj"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Nickname",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 19
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 21
|
||||
},
|
||||
"_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
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 18
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 20
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "8blUJZ4nJKpKsLO2YpEChI"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "5adoggTLFPToeEZEIA7Yh3"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "Label",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 23
|
||||
},
|
||||
{
|
||||
"__id__": 25
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 27
|
||||
},
|
||||
"_lpos": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 98.845,
|
||||
"z": 0
|
||||
},
|
||||
"_lrot": {
|
||||
"__type__": "cc.Quat",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0,
|
||||
"w": 1
|
||||
},
|
||||
"_lscale": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 1,
|
||||
"y": 1,
|
||||
"z": 1
|
||||
},
|
||||
"_layer": 33554432,
|
||||
"_euler": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 24
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 110.72,
|
||||
"height": 50.4
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "2a/IDEWZRPcb6AKU5/XAlD"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 22
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 26
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_string": "nickname",
|
||||
"_horizontalAlign": 1,
|
||||
"_verticalAlign": 1,
|
||||
"_actualFontSize": 24,
|
||||
"_fontSize": 24,
|
||||
"_fontFamily": "Arial",
|
||||
"_lineHeight": 40,
|
||||
"_overflow": 0,
|
||||
"_enableWrapText": true,
|
||||
"_font": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_isItalic": false,
|
||||
"_isBold": true,
|
||||
"_isUnderline": false,
|
||||
"_underlineHeight": 2,
|
||||
"_cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "71ZjYMvjBES7FqZGSo1L00"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "03OAmogbVI5qDqTUJvplOC"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.UITransform",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 29
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 100,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "43sIN2Al5OsJRxFqY+HJTV"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 31
|
||||
},
|
||||
"_customMaterial": null,
|
||||
"_srcBlendFactor": 2,
|
||||
"_dstBlendFactor": 4,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "f0f5e564-2d98-4de1-bb92-794eeb1acffc@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": "48V6DZW5BPxIbiTPVjSL37"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "60xKi1fHZAl6spWUrSZzlZ"
|
||||
"fileId": "fcj/6WYKJAnbG8wIajLBQ9"
|
||||
}
|
||||
]
|
@ -2,7 +2,7 @@
|
||||
"ver": "1.1.39",
|
||||
"importer": "prefab",
|
||||
"imported": true,
|
||||
"uuid": "d565d84f-56c4-4aa3-831c-99db0a0d2390",
|
||||
"uuid": "7b0c739f-cf46-48f7-8c15-c97ab34268fe",
|
||||
"files": [
|
||||
".json"
|
||||
],
|
||||
|
@ -1,7 +1,7 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "RoomItem",
|
||||
"_name": "Room",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
@ -13,7 +13,7 @@
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "RoomItem",
|
||||
"_name": "Room",
|
||||
"_objFlags": 0,
|
||||
"__editorExtras__": {},
|
||||
"_parent": null,
|
||||
@ -33,7 +33,7 @@
|
||||
"__id__": 8
|
||||
},
|
||||
{
|
||||
"__id__": 10
|
||||
"__id__": 11
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
@ -174,7 +174,7 @@
|
||||
"fileId": "04BVJ/YxxGgJB9RdmtoR81"
|
||||
},
|
||||
{
|
||||
"__type__": "26da1px6w1GPbLW+8ZL8KuJ",
|
||||
"__type__": "cc.Button",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
@ -184,26 +184,9 @@
|
||||
"__prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "fcJVJHKllGEpVqSAW4IqSW"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Button",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 11
|
||||
},
|
||||
"clickEvents": [
|
||||
{
|
||||
"__id__": 12
|
||||
"__id__": 10
|
||||
}
|
||||
],
|
||||
"_interactable": true,
|
||||
@ -255,10 +238,27 @@
|
||||
"__id__": 1
|
||||
},
|
||||
"component": "",
|
||||
"_componentId": "26da1px6w1GPbLW+8ZL8KuJ",
|
||||
"_componentId": "23e174OdjdMjJr3kdwPQTAb",
|
||||
"handler": "handleClick",
|
||||
"customEventData": ""
|
||||
},
|
||||
{
|
||||
"__type__": "23e174OdjdMjJr3kdwPQTAb",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"__prefab": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.CompPrefabInfo",
|
||||
"fileId": "2fkxfXB3NCsI8C8viDWANS"
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
@ -8,6 +8,6 @@
|
||||
],
|
||||
"subMetas": {},
|
||||
"userData": {
|
||||
"syncNodeName": "RoomItem"
|
||||
"syncNodeName": "Room"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 311 B After Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 309 B |
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 309 B |
Before Width: | Height: | Size: 322 B After Width: | Height: | Size: 322 B |
Before Width: | Height: | Size: 336 B After Width: | Height: | Size: 336 B |
Before Width: | Height: | Size: 332 B After Width: | Height: | Size: 332 B |
Before Width: | Height: | Size: 312 B After Width: | Height: | Size: 312 B |
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 317 B |
Before Width: | Height: | Size: 333 B After Width: | Height: | Size: 333 B |
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 305 B |
Before Width: | Height: | Size: 307 B After Width: | Height: | Size: 307 B |
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 323 B |
Before Width: | Height: | Size: 323 B After Width: | Height: | Size: 323 B |
Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 306 B |
Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 289 B |
Before Width: | Height: | Size: 290 B After Width: | Height: | Size: 290 B |
Before Width: | Height: | Size: 325 B After Width: | Height: | Size: 325 B |
Before Width: | Height: | Size: 277 B After Width: | Height: | Size: 277 B |
Before Width: | Height: | Size: 309 B After Width: | Height: | Size: 309 B |
49
apps/server/src/Common/Api.ts
Normal file
@ -0,0 +1,49 @@
|
||||
import { IPlayer, IRoom } from "./Model"
|
||||
|
||||
export interface IApiPlayerListReq {
|
||||
}
|
||||
|
||||
export interface IApiPlayerListRes {
|
||||
list: Array<IPlayer>
|
||||
}
|
||||
|
||||
export interface IApiPlayerJoinReq {
|
||||
nickname: string
|
||||
}
|
||||
|
||||
export interface IApiPlayerJoinRes {
|
||||
player: IPlayer
|
||||
}
|
||||
|
||||
export interface IApiRoomListReq {
|
||||
}
|
||||
|
||||
export interface IApiRoomListRes {
|
||||
list: Array<IRoom>
|
||||
}
|
||||
|
||||
export interface IApiRoomCreateReq {
|
||||
}
|
||||
|
||||
export interface IApiRoomCreateRes {
|
||||
room: IRoom
|
||||
}
|
||||
|
||||
export interface IApiRoomJoinReq {
|
||||
rid: number
|
||||
}
|
||||
|
||||
export interface IApiRoomJoinRes {
|
||||
room: IRoom
|
||||
}
|
||||
|
||||
export interface IApiRoomLeaveReq {
|
||||
}
|
||||
|
||||
export interface IApiRoomLeaveRes { }
|
||||
|
||||
export interface IApiGameStartReq {
|
||||
rid: number
|
||||
}
|
||||
|
||||
export interface IApiGameStartRes { }
|
9
apps/server/src/Common/Api.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "7b9c95da-edaa-4c0c-8e41-b135b9802b86",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
34
apps/server/src/Common/Enum.ts
Normal file
@ -0,0 +1,34 @@
|
||||
export enum ApiMsgEnum {
|
||||
ApiPlayerList = 'ApiPlayerList',
|
||||
ApiPlayerJoin = 'ApiPlayerJoin',
|
||||
ApiRoomList = 'ApiRoomList',
|
||||
ApiRoomCreate = 'ApiRoomCreate',
|
||||
ApiRoomJoin = 'ApiRoomJoin',
|
||||
ApiRoomLeave = 'ApiRoomLeave',
|
||||
ApiGameStart = 'ApiGameStart',
|
||||
MsgPlayerList = 'MsgPlayerList',
|
||||
MsgRoomList = 'MsgRoomList',
|
||||
MsgRoom = 'MsgRoom',
|
||||
MsgGameStart = 'MsgGameStart',
|
||||
MsgClientSync = 'MsgClientSync',
|
||||
MsgServerSync = 'MsgServerSync',
|
||||
}
|
||||
|
||||
export enum InputTypeEnum {
|
||||
ActorMove = 'ActorMove',
|
||||
WeaponShoot = 'WeaponShoot',
|
||||
TimePast = 'TimePast',
|
||||
}
|
||||
|
||||
export enum EntityTypeEnum {
|
||||
Map1 = 'Map1',
|
||||
Actor1 = 'Actor1',
|
||||
Actor2 = 'Actor2',
|
||||
Weapon1 = 'Weapon1',
|
||||
Weapon2 = 'Weapon2',
|
||||
Bullet1 = 'Bullet1',
|
||||
Bullet2 = 'Bullet2',
|
||||
Explosion = 'Explosion',
|
||||
JoyStick = 'JoyStick',
|
||||
Shoot = 'Shoot',
|
||||
}
|
9
apps/server/src/Common/Enum.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "2ba2bf1e-f8be-4a48-b759-666d5e757029",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
9
apps/server/src/Common/Model.ts
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
export interface IPlayer {
|
||||
id: number, nickname: string, rid: number
|
||||
}
|
||||
|
||||
export interface IRoom {
|
||||
id: number, players: Array<IPlayer>
|
||||
}
|
||||
|
9
apps/server/src/Common/Model.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "87dc45aa-8878-48f4-9084-b4fd293a6414",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
23
apps/server/src/Common/Msg.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { IPlayer, IRoom } from "./Model"
|
||||
import { IState } from "./State"
|
||||
|
||||
export interface IMsgPlayerList {
|
||||
list: Array<IPlayer>
|
||||
}
|
||||
|
||||
export interface IMsgRoomList {
|
||||
list: Array<IRoom>
|
||||
}
|
||||
|
||||
export interface IMsgRoom {
|
||||
room: IRoom
|
||||
}
|
||||
|
||||
export interface IMsgGameStart {
|
||||
state: IState
|
||||
}
|
||||
|
||||
|
||||
export interface IMsgGameStart {
|
||||
state: IState
|
||||
}
|
9
apps/server/src/Common/Msg.ts.meta
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.23",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "70de0494-112b-4a60-a266-3eadc82c20a4",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
56
apps/server/src/Common/State.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import { EntityTypeEnum, InputTypeEnum } from "./Enum"
|
||||
|
||||
export interface IActor {
|
||||
id: number
|
||||
nickname: string
|
||||
type: EntityTypeEnum
|
||||
weaponType: EntityTypeEnum
|
||||
bulletType: EntityTypeEnum
|
||||
|
||||
//动态数据
|
||||
hp: number
|
||||
position: IVec2
|
||||
direction: IVec2
|
||||
}
|
||||
|
||||
export interface IBullet {
|
||||
id: number
|
||||
owner: number
|
||||
type: EntityTypeEnum
|
||||
|
||||
//动态数据
|
||||
position: IVec2
|
||||
direction: IVec2
|
||||
}
|
||||
|
||||
export interface IVec2 {
|
||||
x: number;
|
||||
y: number
|
||||
}
|
||||
|
||||
export interface IState {
|
||||
players: IActor[],
|
||||
bullets: IBullet[],
|
||||
nextBulletId: number
|
||||
}
|
||||
|
||||
export type IClientInput = IActorMove | IWeaponShoot | ITimePast
|
||||
|
||||
export interface IActorMove {
|
||||
type: InputTypeEnum.ActorMove
|
||||
id: number;
|
||||
direction: IVec2;
|
||||
dt: number;
|
||||
}
|
||||
|
||||
export interface IWeaponShoot {
|
||||
type: InputTypeEnum.WeaponShoot
|
||||
owner: number;
|
||||
position: IVec2;
|
||||
direction: IVec2;
|
||||
}
|
||||
|
||||
export interface ITimePast {
|
||||
type: InputTypeEnum.TimePast;
|
||||
dt: number
|
||||
}
|