This commit is contained in:
sli97 2022-12-03 20:06:57 +08:00
parent bdead4a6d1
commit f3dc3ef7ba
110 changed files with 1347 additions and 1028 deletions

View File

@ -1996,14 +1996,14 @@
"playerContainer": { "playerContainer": {
"__id__": 23 "__id__": 23
}, },
"playerItem": { "playerPrefab": {
"__uuid__": "7b0c739f-cf46-48f7-8c15-c97ab34268fe", "__uuid__": "7b0c739f-cf46-48f7-8c15-c97ab34268fe",
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },
"roomContainer": { "roomContainer": {
"__id__": 36 "__id__": 36
}, },
"roomItem": { "roomPrefab": {
"__uuid__": "b91571d9-7804-4e62-b9d4-eef2f8f0cadd", "__uuid__": "b91571d9-7804-4e62-b9d4-eef2f8f0cadd",
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },

View File

@ -1314,7 +1314,7 @@
}, },
"component": "", "component": "",
"_componentId": "8ee1b1zWztIraCgWh1qCNp9", "_componentId": "8ee1b1zWztIraCgWh1qCNp9",
"handler": "handleGameStart", "handler": "handleStart",
"customEventData": "" "customEventData": ""
}, },
{ {
@ -1688,7 +1688,7 @@
"playerContainer": { "playerContainer": {
"__id__": 19 "__id__": 19
}, },
"playerItem": { "playerPrefab": {
"__uuid__": "7b0c739f-cf46-48f7-8c15-c97ab34268fe", "__uuid__": "7b0c739f-cf46-48f7-8c15-c97ab34268fe",
"__expectedType__": "cc.Prefab" "__expectedType__": "cc.Prefab"
}, },

View File

@ -2,7 +2,7 @@
"ver": "1.1.0", "ver": "1.1.0",
"importer": "directory", "importer": "directory",
"imported": true, "imported": true,
"uuid": "5802fd2f-7823-4294-91c8-d71adca41319", "uuid": "b5fb8ade-69bf-469c-9685-0d14804b00ac",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": { "userData": {

View File

@ -2,7 +2,7 @@
"ver": "1.1.0", "ver": "1.1.0",
"importer": "directory", "importer": "directory",
"imported": true, "imported": true,
"uuid": "d4aded25-46cd-4911-b695-170d2eb72fd6", "uuid": "b207a15b-0f84-4e83-93de-cb6186e22772",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": { "userData": {

View File

@ -1,14 +1,16 @@
import { _decorator, instantiate, ProgressBar, Label } from 'cc'; import { _decorator, instantiate, ProgressBar, Label } from 'cc';
import { EntityManager } from '../../Base/EntityManager'; import { EntityManager } from '../../Base/EntityManager';
import { EntityTypeEnum, EntityStateEnum, InputType } from '../../Enum'; import { ApiMsgEnum, EntityTypeEnum, IActor, InputTypeEnum, IVec2 } from '../../Common';
import DataManager, { IPlayer, IVec2 } from '../../Global/DataManager'; import { EntityStateEnum } from '../../Enum';
import DataManager from '../../Global/DataManager';
import NetworkManager from '../../Global/NetworkManager';
import { rad2Angle } from '../../Utils'; import { rad2Angle } from '../../Utils';
import { WeaponManager } from '../Weapon/WeaponManager'; import { WeaponManager } from '../Weapon/WeaponManager';
import { PlayerStateMachine } from './PlayerStateMachine'; import { PlayerStateMachine } from './ActorStateMachine';
const { ccclass } = _decorator; const { ccclass } = _decorator;
@ccclass('PlayerManager') @ccclass('ActorManager')
export class PlayerManager extends EntityManager { export class ActorManager extends EntityManager implements IActor {
//静态数据 //静态数据
id: number id: number
nickname: string nickname: string
@ -29,7 +31,7 @@ export class PlayerManager extends EntityManager {
return DataManager.Instance.myPlayerId === this.id return DataManager.Instance.myPlayerId === this.id
} }
init(data: IPlayer) { init(data: IActor) {
const { id, nickname, type, weaponType, bulletType } = data const { id, nickname, type, weaponType, bulletType } = data
this.id = id this.id = id
this.nickname = nickname this.nickname = nickname
@ -58,8 +60,8 @@ export class PlayerManager extends EntityManager {
} }
const { x, y } = DataManager.Instance.jm.input const { x, y } = DataManager.Instance.jm.input
DataManager.Instance.applyInput({ NetworkManager.Instance.sendMsg(ApiMsgEnum.MsgClientSync, {
type: InputType.PlayerMove, type: InputTypeEnum.ActorMove,
id: this.id, id: this.id,
direction: { direction: {
x, x,
@ -69,21 +71,21 @@ export class PlayerManager extends EntityManager {
}) })
} }
render(data: IPlayer) { render(data: IActor) {
this.renderHP(data) this.renderHP(data)
this.renderPosition(data) this.renderPosition(data)
this.renderDirection(data) this.renderDirection(data)
} }
renderHP(data: IPlayer) { renderHP(data: IActor) {
this.hpBar.progress = data.hp / this.hpBar.totalLength this.hpBar.progress = data.hp / this.hpBar.totalLength
} }
renderPosition(data: IPlayer) { renderPosition(data: IActor) {
this.node.setPosition(data.position.x, data.position.y) this.node.setPosition(data.position.x, data.position.y)
} }
renderDirection(data: IPlayer) { renderDirection(data: IActor) {
if (data.direction.x === 0 && data.direction.y === 0) { if (data.direction.x === 0 && data.direction.y === 0) {
this.state = EntityStateEnum.Idle this.state = EntityStateEnum.Idle
return return

View File

@ -2,7 +2,7 @@
"ver": "4.0.23", "ver": "4.0.23",
"importer": "typescript", "importer": "typescript",
"imported": true, "imported": true,
"uuid": "0b36580d-5fc7-40c1-9ac0-0fb78a685fd1", "uuid": "aaa694fa-4476-44b2-9213-4b4978a57d66",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": {} "userData": {}

View File

@ -1,7 +1,8 @@
import { _decorator, Animation, AnimationClip } from 'cc' import { _decorator, Animation, AnimationClip } from 'cc'
import State from '../../Base/State' import State from '../../Base/State'
import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine' import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine'
import { EntityTypeEnum, EntityStateEnum, ParamsNameEnum } from '../../Enum' import { EntityTypeEnum } from '../../Common'
import { EntityStateEnum, ParamsNameEnum } from '../../Enum'
const { ccclass } = _decorator const { ccclass } = _decorator
@ccclass('PlayerStateMachine') @ccclass('PlayerStateMachine')

View File

@ -2,7 +2,7 @@
"ver": "4.0.23", "ver": "4.0.23",
"importer": "typescript", "importer": "typescript",
"imported": true, "imported": true,
"uuid": "26da1a71-eb0d-463d-b2d6-fbc64bf0ab89", "uuid": "67239e69-9cbb-42c8-ae8f-27f8bae24103",
"files": [], "files": [],
"subMetas": {}, "subMetas": {},
"userData": {} "userData": {}

View File

@ -1,7 +1,8 @@
import { _decorator } from 'cc' import { _decorator } from 'cc'
import { EntityManager } from '../../Base/EntityManager' import { EntityManager } from '../../Base/EntityManager'
import { EntityTypeEnum, EntityStateEnum, EventEnum } from '../../Enum' import { EntityTypeEnum, IBullet, IVec2 } from '../../Common'
import DataManager, { IBullet, IVec2 } from '../../Global/DataManager' import { EntityStateEnum, EventEnum } from '../../Enum'
import DataManager from '../../Global/DataManager'
import EventManager from '../../Global/EventManager' import EventManager from '../../Global/EventManager'
import ObjectPoolManager from '../../Global/ObjectPoolManager' import ObjectPoolManager from '../../Global/ObjectPoolManager'
import { rad2Angle } from '../../Utils' import { rad2Angle } from '../../Utils'
@ -10,7 +11,7 @@ import { BulletStateMachine } from './BulletStateMachine'
const { ccclass } = _decorator const { ccclass } = _decorator
@ccclass('BulletManager') @ccclass('BulletManager')
export class BulletManager extends EntityManager { export class BulletManager extends EntityManager implements IBullet {
//静态数据 //静态数据
id: number id: number
owner: number owner: number

View File

@ -1,7 +1,8 @@
import { _decorator, Animation } from 'cc' import { _decorator, Animation } from 'cc'
import State from '../../Base/State' import State from '../../Base/State'
import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine' import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine'
import { EntityTypeEnum, EntityStateEnum, ParamsNameEnum } from '../../Enum' import { EntityTypeEnum } from '../../Common'
import { EntityStateEnum, ParamsNameEnum } from '../../Enum'
const { ccclass } = _decorator const { ccclass } = _decorator
@ccclass('BulletStateMachine') @ccclass('BulletStateMachine')

View File

@ -1,7 +1,7 @@
import { _decorator } from 'cc' import { _decorator } from 'cc'
import { EntityManager } from '../../Base/EntityManager' import { EntityManager } from '../../Base/EntityManager'
import { EntityTypeEnum, EntityStateEnum } from '../../Enum' import { EntityTypeEnum, IVec2 } from '../../Common'
import { IVec2 } from '../../Global/DataManager' import { EntityStateEnum } from '../../Enum'
import { ExplosionStateMachine } from './ExplosionStateMachine' import { ExplosionStateMachine } from './ExplosionStateMachine'
const { ccclass, property } = _decorator const { ccclass, property } = _decorator

View File

@ -1,7 +1,8 @@
import { _decorator, Animation } from 'cc' import { _decorator, Animation } from 'cc'
import State from '../../Base/State' import State from '../../Base/State'
import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine' 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' import ObjectPoolManager from '../../Global/ObjectPoolManager'
const { ccclass, property } = _decorator const { ccclass, property } = _decorator

View File

@ -1,8 +1,10 @@
import { _decorator, Node, Vec2, UITransform } from 'cc' import { _decorator, Node, Vec2, UITransform } from 'cc'
import { EntityManager } from '../../Base/EntityManager' import { EntityManager } from '../../Base/EntityManager'
import { EntityTypeEnum, EntityStateEnum, EventEnum, InputType } from '../../Enum' import { ApiMsgEnum, EntityTypeEnum, InputTypeEnum } from '../../Common'
import DataManager, { IPlayer } from '../../Global/DataManager' import { EntityStateEnum, EventEnum } from '../../Enum'
import DataManager from '../../Global/DataManager'
import EventManager from '../../Global/EventManager' import EventManager from '../../Global/EventManager'
import NetworkManager from '../../Global/NetworkManager'
import { WeaponStateMachine } from './WeaponStateMachine' import { WeaponStateMachine } from './WeaponStateMachine'
const { ccclass } = _decorator const { ccclass } = _decorator
@ -19,7 +21,7 @@ export class WeaponManager extends EntityManager {
return DataManager.Instance.myPlayerId === this.owner return DataManager.Instance.myPlayerId === this.owner
} }
init({ id, weaponType }: IPlayer) { init({ id, weaponType }: { id: number, weaponType: EntityTypeEnum }) {
this.owner = id this.owner = id
this.type = weaponType this.type = weaponType
@ -58,8 +60,8 @@ export class WeaponManager extends EntityManager {
const anchorWorldPos = this.anchor.getWorldPosition() const anchorWorldPos = this.anchor.getWorldPosition()
const directionVec2 = new Vec2(pointWorldPos.x - anchorWorldPos.x, pointWorldPos.y - anchorWorldPos.y).normalize() const directionVec2 = new Vec2(pointWorldPos.x - anchorWorldPos.x, pointWorldPos.y - anchorWorldPos.y).normalize()
DataManager.Instance.applyInput({ NetworkManager.Instance.sendMsg(ApiMsgEnum.MsgClientSync, {
type: InputType.WeaponShoot, type: InputTypeEnum.WeaponShoot,
owner: this.owner, owner: this.owner,
position: { position: {
x: pointStagePos.x, x: pointStagePos.x,

View File

@ -1,7 +1,8 @@
import { _decorator, Animation, AnimationClip } from 'cc' import { _decorator, Animation, AnimationClip } from 'cc'
import State from '../../Base/State' import State from '../../Base/State'
import StateMachine, { getInitParamsTrigger } from '../../Base/StateMachine' 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' import { WeaponManager } from './WeaponManager'
const { ccclass } = _decorator const { ccclass } = _decorator

View File

@ -23,23 +23,10 @@ export enum EventEnum {
GameStart = 'GameStart', 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 { export enum PrefabPathEnum {
Map1 = 'prefab/Map1', Map1 = 'prefab/Map1',
Player1 = 'prefab/Player', Actor1 = 'prefab/Actor',
Player2 = 'prefab/Player', Actor2 = 'prefab/Actor',
Weapon1 = 'prefab/Weapon1', Weapon1 = 'prefab/Weapon1',
Weapon2 = 'prefab/Weapon2', Weapon2 = 'prefab/Weapon2',
Bullet1 = 'prefab/Bullet', Bullet1 = 'prefab/Bullet',
@ -50,10 +37,10 @@ export enum PrefabPathEnum {
} }
export enum TexturePathEnum { export enum TexturePathEnum {
Player1Idle = 'texture/player/player1/idle', Actor1Idle = 'texture/actor/actor1/idle',
Player1Run = 'texture/player/player1/run', Actor1Run = 'texture/actor/actor1/run',
Player2Idle = 'texture/player/player2/idle', Actor2Idle = 'texture/actor/actor2/idle',
Player2Run = 'texture/player/player2/run', Actor2Run = 'texture/actor/actor2/run',
Weapon1Idle = 'texture/weapon/weapon1/idle', Weapon1Idle = 'texture/weapon/weapon1/idle',
Weapon1Attack = 'texture/weapon/weapon1/attack', Weapon1Attack = 'texture/weapon/weapon1/attack',
Weapon2Idle = 'texture/weapon/weapon2/idle', Weapon2Idle = 'texture/weapon/weapon2/idle',
@ -63,12 +50,6 @@ export enum TexturePathEnum {
ExplosionIdle = 'texture/explosion', ExplosionIdle = 'texture/explosion',
} }
export enum InputType {
PlayerMove = 'PlayerMove',
WeaponShoot = 'WeaponShoot',
TimePast = 'TimePast',
}
export enum SceneEnum { export enum SceneEnum {
Login = 'Login', Login = 'Login',
Hall = 'Hall', Hall = 'Hall',

View File

@ -1,14 +1,12 @@
import { Node, Prefab, SpriteFrame } from 'cc' import { Node, Prefab, SpriteFrame } from 'cc'
import Singleton from '../Base/Singleton' 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 { BulletManager } from '../Entity/Bullet/BulletManager'
import { PlayerManager } from '../Entity/Player/PlayerManager' import { EventEnum } from '../Enum'
import { EntityTypeEnum, EventEnum, InputType } from '../Enum'
import { JoyStickManager } from '../UI/JoyStickManager' import { JoyStickManager } from '../UI/JoyStickManager'
import EventManager from './EventManager' 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 PLAYER_SPEED = 100
const BULLET_SPEED = 600 const BULLET_SPEED = 600
@ -18,36 +16,6 @@ const WEAPON_DAMAGE = 5
const PLAYER_RADIUS = 50 const PLAYER_RADIUS = 50
const BULLET_RADIUS = 10 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 { export default class DataManager extends Singleton {
static get Instance() { static get Instance() {
return super.GetInstance<DataManager>() return super.GetInstance<DataManager>()
@ -59,11 +27,11 @@ export default class DataManager extends Singleton {
prefabMap: Map<string, Prefab> = new Map() prefabMap: Map<string, Prefab> = new Map()
textureMap: Map<string, SpriteFrame[]> = 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() bulletMap: Map<number, BulletManager> = new Map()
myPlayerId = 1 myPlayerId = 1
roomInfo: IData roomInfo: IRoom
mapSize = { mapSize = {
x: 960, x: 960,
y: 640, y: 640,
@ -82,7 +50,7 @@ export default class DataManager extends Singleton {
y: 0 y: 0
}, },
hp: 100, hp: 100,
type: EntityTypeEnum.Player1, type: EntityTypeEnum.Actor1,
weaponType: EntityTypeEnum.Weapon1, weaponType: EntityTypeEnum.Weapon1,
bulletType: EntityTypeEnum.Bullet1, bulletType: EntityTypeEnum.Bullet1,
}, { }, {
@ -97,7 +65,7 @@ export default class DataManager extends Singleton {
y: -1 y: -1
}, },
hp: 100, hp: 100,
type: EntityTypeEnum.Player2, type: EntityTypeEnum.Actor2,
weaponType: EntityTypeEnum.Weapon2, weaponType: EntityTypeEnum.Weapon2,
bulletType: EntityTypeEnum.Bullet2, bulletType: EntityTypeEnum.Bullet2,
}], }],
@ -105,9 +73,9 @@ export default class DataManager extends Singleton {
nextBulletId: 1 nextBulletId: 1
} }
applyInput(input: IPlayerMove | IWeaponShoot | ITimePast) { applyInput(input: IClientInput) {
switch (input.type) { switch (input.type) {
case InputType.PlayerMove: { case InputTypeEnum.ActorMove: {
const { direction: { x, y }, dt, id } = input const { direction: { x, y }, dt, id } = input
const player = this.state.players.find(e => e.id === id) const player = this.state.players.find(e => e.id === id)
if (!player) { if (!player) {
@ -120,21 +88,21 @@ export default class DataManager extends Singleton {
break break
} }
case InputType.WeaponShoot: { case InputTypeEnum.WeaponShoot: {
const { owner, position, direction } = input const { owner, position, direction } = input
const bullet: IBullet = { const bullet: IBullet = {
id: this.state.nextBulletId++, id: this.state.nextBulletId++,
owner, owner,
position, position,
direction, direction,
type: this.playerMap.get(owner).bulletType type: this.actorMap.get(owner).bulletType
} }
this.state.bullets.push(bullet) this.state.bullets.push(bullet)
EventManager.Instance.emit(EventEnum.BulletBorn, owner) EventManager.Instance.emit(EventEnum.BulletBorn, owner)
break break
} }
case InputType.TimePast: { case InputTypeEnum.TimePast: {
const { dt } = input const { dt } = input
const { bullets, players } = this.state const { bullets, players } = this.state

View File

@ -1,27 +1,15 @@
import Singleton from '../Base/Singleton' import Singleton from '../Base/Singleton'
import { IModel } from '../Common';
const TIMEOUT = 5000 const TIMEOUT = 5000
export type IData = Record<string, any> export interface ICallApiRet<T> {
export interface ICallApiRet {
success: boolean; success: boolean;
error?: Error; error?: Error;
res?: IData res?: T
}
export enum ApiMsgEnum {
ApiPlayerList = 'ApiPlayerList',
ApiPlayerJoin = 'ApiPlayerJoin',
ApiRoomList = 'ApiRoomList',
ApiRoomCreate = 'ApiRoomCreate',
ApiRoomJoin = 'ApiRoomJoin',
ApiRoomLeave = 'ApiRoomLeave',
MsgPlayerList = 'MsgPlayerList',
MsgRoomList = 'MsgRoomList',
MsgRoom = 'MsgRoom',
} }
type aaa = keyof IModel
export default class NetworkManager extends Singleton { export default class NetworkManager extends Singleton {
static get Instance() { static get Instance() {
return super.GetInstance<NetworkManager>() 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 })) 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)) { if (this.cbs.has(name)) {
this.cbs.get(name).push(cb) this.cbs.get(name).push(cb)
} else { } else {
@ -89,29 +102,4 @@ export default class NetworkManager extends Singleton {
index > -1 && this.cbs.get(name).splice(index, 1) 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 })
}
})
}
} }

View File

@ -1,7 +1,7 @@
import Singleton from '../Base/Singleton' import Singleton from '../Base/Singleton'
import { instantiate, Node } from 'cc' import { instantiate, Node } from 'cc'
import { EntityTypeEnum } from '../Enum'
import DataManager from './DataManager' import DataManager from './DataManager'
import { EntityTypeEnum } from '../Common'
export default class ObjectPoolManager extends Singleton { export default class ObjectPoolManager extends Singleton {
static get Instance() { static get Instance() {

View File

@ -1,12 +1,13 @@
import { _decorator, Component, Node, Prefab, instantiate, SpriteFrame } from 'cc'; 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 DataManager from '../Global/DataManager';
import { JoyStickManager } from '../UI/JoyStickManager'; import { JoyStickManager } from '../UI/JoyStickManager';
import { ResourceManager } from '../Global/ResourceManager'; import { ResourceManager } from '../Global/ResourceManager';
import { EntityTypeEnum, InputType, PrefabPathEnum, TexturePathEnum } from '../Enum'; import { PrefabPathEnum, TexturePathEnum } from '../Enum';
import NetworkManager from '../Global/NetworkManager'; import NetworkManager from '../Global/NetworkManager';
import ObjectPoolManager from '../Global/ObjectPoolManager'; import ObjectPoolManager from '../Global/ObjectPoolManager';
import { BulletManager } from '../Entity/Bullet/BulletManager'; import { BulletManager } from '../Entity/Bullet/BulletManager';
import { EntityTypeEnum, InputTypeEnum } from '../Common';
const { ccclass } = _decorator; const { ccclass } = _decorator;
@ -98,7 +99,7 @@ export class BattleManager extends Component {
tickPlayer(dt: number) { tickPlayer(dt: number) {
for (const p of DataManager.Instance.state.players) { 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) { if (!playerManager) {
return return
} }
@ -108,7 +109,7 @@ export class BattleManager extends Component {
tickGlobal(dt: number) { tickGlobal(dt: number) {
DataManager.Instance.applyInput({ DataManager.Instance.applyInput({
type: InputType.TimePast, type: InputTypeEnum.TimePast,
dt dt
}) })
} }
@ -120,13 +121,13 @@ export class BattleManager extends Component {
renderPlayer() { renderPlayer() {
for (const p of DataManager.Instance.state.players) { 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) { if (!playerManager) {
const playerPrefab = DataManager.Instance.prefabMap.get(p.type) const playerPrefab = DataManager.Instance.prefabMap.get(p.type)
const player = instantiate(playerPrefab) const player = instantiate(playerPrefab)
player.setParent(this.stage) player.setParent(this.stage)
playerManager = player.addComponent(PlayerManager) playerManager = player.addComponent(ActorManager)
DataManager.Instance.playerMap.set(p.id, playerManager) DataManager.Instance.actorMap.set(p.id, playerManager)
playerManager.init(p) playerManager.init(p)
} else { } else {
playerManager.render(p) playerManager.render(p)

View File

@ -1,10 +1,11 @@
import { _decorator, Component, Node, Prefab, director, instantiate } from 'cc'; import { _decorator, Component, Node, Prefab, director, instantiate } from 'cc';
import { ApiMsgEnum, IApiPlayerListRes, IApiRoomListRes, IMsgPlayerList, IMsgRoomList } from '../Common';
import { EventEnum, SceneEnum } from '../Enum'; import { EventEnum, SceneEnum } from '../Enum';
import DataManager from '../Global/DataManager'; import DataManager from '../Global/DataManager';
import EventManager from '../Global/EventManager'; import EventManager from '../Global/EventManager';
import NetworkManager, { ApiMsgEnum, IData } from '../Global/NetworkManager'; import NetworkManager from '../Global/NetworkManager';
import { PlayerItemManager } from '../UI/PlayerItemManager'; import { PlayerManager } from '../UI/PlayerManager';
import { RoomItemManager } from '../UI/RoomItemManager'; import { RoomManager } from '../UI/RoomManager';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('HallManager') @ccclass('HallManager')
@ -13,24 +14,24 @@ export class HallManager extends Component {
playerContainer: Node = null; playerContainer: Node = null;
@property(Prefab) @property(Prefab)
playerItem: Prefab = null; playerPrefab: Prefab = null;
@property(Node) @property(Node)
roomContainer: Node = null; roomContainer: Node = null;
@property(Prefab) @property(Prefab)
roomItem: Prefab = null; roomPrefab: Prefab = null;
onLoad() { onLoad() {
director.preloadScene(SceneEnum.Room); director.preloadScene(SceneEnum.Room);
EventManager.Instance.on(EventEnum.RoomJoin, this.joinRoom, this) 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); NetworkManager.Instance.listenMsg(ApiMsgEnum.MsgRoomList, this.renderRooms);
} }
onDestroy() { onDestroy() {
EventManager.Instance.off(EventEnum.RoomJoin, this.joinRoom, this) 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); NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgRoomList, this.renderRooms);
} }
@ -46,15 +47,15 @@ export class HallManager extends Component {
return; return;
} }
this.renderPlayer(res) this.renderPlayers(res)
} }
renderPlayer = ({ list }: IData) => { renderPlayers = ({ list }: IApiPlayerListRes | IMsgPlayerList) => {
for (const item of this.playerContainer.children) { for (const item of this.playerContainer.children) {
item.active = false item.active = false
} }
while (this.playerContainer.children.length < list.length) { while (this.playerContainer.children.length < list.length) {
const playerItem = instantiate(this.playerItem); const playerItem = instantiate(this.playerPrefab);
playerItem.active = false playerItem.active = false
playerItem.setParent(this.playerContainer) playerItem.setParent(this.playerContainer)
} }
@ -62,7 +63,7 @@ export class HallManager extends Component {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
const data = list[i]; const data = list[i];
const node = this.playerContainer.children[i] const node = this.playerContainer.children[i]
const playerItemManager = node.getComponent(PlayerItemManager) const playerItemManager = node.getComponent(PlayerManager)
playerItemManager.init(data) playerItemManager.init(data)
} }
} }
@ -77,12 +78,12 @@ export class HallManager extends Component {
this.renderRooms(res) this.renderRooms(res)
} }
renderRooms = ({ list }: IData) => { renderRooms = ({ list }: IApiRoomListRes | IMsgRoomList) => {
for (const item of this.roomContainer.children) { for (const item of this.roomContainer.children) {
item.active = false item.active = false
} }
while (this.roomContainer.children.length < list.length) { while (this.roomContainer.children.length < list.length) {
const roomItem = instantiate(this.roomItem); const roomItem = instantiate(this.roomPrefab);
roomItem.active = false roomItem.active = false
roomItem.setParent(this.roomContainer) roomItem.setParent(this.roomContainer)
} }
@ -90,7 +91,7 @@ export class HallManager extends Component {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
const data = list[i]; const data = list[i];
const node = this.roomContainer.children[i] const node = this.roomContainer.children[i]
const roomItemManager = node.getComponent(RoomItemManager) const roomItemManager = node.getComponent(RoomManager)
roomItemManager.init(data) roomItemManager.init(data)
} }
} }
@ -102,8 +103,7 @@ export class HallManager extends Component {
return; return;
} }
DataManager.Instance.roomInfo = { ...res } DataManager.Instance.roomInfo = res.room
director.loadScene(SceneEnum.Room); director.loadScene(SceneEnum.Room);
} }
@ -114,8 +114,7 @@ export class HallManager extends Component {
return; return;
} }
DataManager.Instance.roomInfo = { ...res } DataManager.Instance.roomInfo = res.room
director.loadScene(SceneEnum.Room); director.loadScene(SceneEnum.Room);
} }
} }

View File

@ -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 { SceneEnum } from '../Enum';
import DataManager from '../Global/DataManager'; import DataManager from '../Global/DataManager';
import NetworkManager, { ApiMsgEnum } from '../Global/NetworkManager'; import NetworkManager from '../Global/NetworkManager';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('LoginManager') @ccclass('LoginManager')
@ -16,7 +17,6 @@ export class LoginManager extends Component {
async start() { async start() {
await NetworkManager.Instance.connect(); await NetworkManager.Instance.connect();
console.log("服务连接成功!"); console.log("服务连接成功!");
} }
async handleClick() { async handleClick() {
@ -38,7 +38,7 @@ export class LoginManager extends Component {
return; return;
} }
DataManager.Instance.myPlayerId = res.id; DataManager.Instance.myPlayerId = res.player.id;
director.loadScene(SceneEnum.Hall); director.loadScene(SceneEnum.Hall);
} }
} }

View File

@ -1,9 +1,10 @@
import { _decorator, Component, Node, Prefab, director, instantiate } from 'cc'; import { _decorator, Component, Node, Prefab, director, instantiate } from 'cc';
import { ApiMsgEnum, IMsgGameStart, IMsgRoom } from '../Common';
import { EventEnum, SceneEnum } from '../Enum'; import { EventEnum, SceneEnum } from '../Enum';
import DataManager from '../Global/DataManager'; import DataManager from '../Global/DataManager';
import EventManager from '../Global/EventManager'; import EventManager from '../Global/EventManager';
import NetworkManager, { ApiMsgEnum, IData } from '../Global/NetworkManager'; import NetworkManager from '../Global/NetworkManager';
import { PlayerItemManager } from '../UI/PlayerItemManager'; import { PlayerManager } from '../UI/PlayerManager';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('RoomManager') @ccclass('RoomManager')
@ -12,27 +13,31 @@ export class RoomManager extends Component {
playerContainer: Node = null; playerContainer: Node = null;
@property(Prefab) @property(Prefab)
playerItem: Prefab = null; playerPrefab: Prefab = null;
onLoad() { onLoad() {
director.preloadScene(SceneEnum.Battle); 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() { onDestroy() {
NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgRoom, this.renderPlayer); NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgRoom, this.renderPlayers);
NetworkManager.Instance.unlistenMsg(ApiMsgEnum.MsgGameStart, this.startGame);
} }
async start() { 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) { for (const item of this.playerContainer.children) {
item.active = false item.active = false
} }
while (this.playerContainer.children.length < list.length) { while (this.playerContainer.children.length < list.length) {
const playerItem = instantiate(this.playerItem); const playerItem = instantiate(this.playerPrefab);
playerItem.active = false playerItem.active = false
playerItem.setParent(this.playerContainer) playerItem.setParent(this.playerContainer)
} }
@ -40,7 +45,7 @@ export class RoomManager extends Component {
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
const data = list[i]; const data = list[i];
const node = this.playerContainer.children[i] const node = this.playerContainer.children[i]
const playerItemManager = node.getComponent(PlayerItemManager) const playerItemManager = node.getComponent(PlayerManager)
playerItemManager.init(data) playerItemManager.init(data)
} }
} }
@ -56,9 +61,20 @@ export class RoomManager extends Component {
director.loadScene(SceneEnum.Hall); director.loadScene(SceneEnum.Hall);
} }
handleGameStart() { async handleStart() {
console.log("handleGameStart"); 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);
} }
} }

View File

@ -4,8 +4,8 @@ import DataManager from '../Global/DataManager';
import EventManager from '../Global/EventManager'; import EventManager from '../Global/EventManager';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('PlayerItemManager') @ccclass('PlayerManager')
export class PlayerItemManager extends Component { export class PlayerManager extends Component {
init({ id, nickname, rid }: { id: number, nickname: string, rid: number }) { init({ id, nickname, rid }: { id: number, nickname: string, rid: number }) {
const label = this.getComponent(Label) const label = this.getComponent(Label)
let str = nickname let str = nickname

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "741a7f88-76ef-4669-95a8-ce39c63a1c41",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -3,8 +3,8 @@ import { EventEnum } from '../Enum';
import EventManager from '../Global/EventManager'; import EventManager from '../Global/EventManager';
const { ccclass, property } = _decorator; const { ccclass, property } = _decorator;
@ccclass('RoomItemManager') @ccclass('RoomManager')
export class RoomItemManager extends Component { export class RoomManager extends Component {
id: number id: number
init({ id, players }: { id: number, players: Array<{ id: number, nickname: string }> }) { init({ id, players }: { id: number, players: Array<{ id: number, nickname: string }> }) {
this.id = id this.id = id

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "23e17e0e-7637-4c8c-9af7-91dc0f41301b",
"files": [],
"subMetas": {},
"userData": {}
}

View 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"
}
]

View File

@ -2,12 +2,12 @@
"ver": "1.1.39", "ver": "1.1.39",
"importer": "prefab", "importer": "prefab",
"imported": true, "imported": true,
"uuid": "7b0c739f-cf46-48f7-8c15-c97ab34268fe", "uuid": "d565d84f-56c4-4aa3-831c-99db0a0d2390",
"files": [ "files": [
".json" ".json"
], ],
"subMetas": {}, "subMetas": {},
"userData": { "userData": {
"syncNodeName": "PlayerItem" "syncNodeName": "Actor"
} }
} }

View File

@ -1,12 +0,0 @@
{
"ver": "1.1.0",
"importer": "directory",
"imported": true,
"uuid": "9348a0ae-1f83-44fe-ae79-892e1db86d1a",
"files": [],
"subMetas": {},
"userData": {
"compressionType": {},
"isRemoteBundle": {}
}
}

View File

@ -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"
}
]

View File

@ -17,122 +17,12 @@
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": null, "_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": [], "_children": [],
"_active": true, "_active": true,
"_components": [ "_components": [
{
"__id__": 2
},
{ {
"__id__": 4 "__id__": 4
}, },
@ -148,8 +38,8 @@
}, },
"_lpos": { "_lpos": {
"__type__": "cc.Vec3", "__type__": "cc.Vec3",
"x": -50, "x": -460,
"y": 0, "y": -20,
"z": 0 "z": 0
}, },
"_lrot": { "_lrot": {
@ -179,38 +69,38 @@
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 3 "__id__": 1
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 5 "__id__": 3
}, },
"_contentSize": { "_contentSize": {
"__type__": "cc.Size", "__type__": "cc.Size",
"width": 100, "width": 240,
"height": 15 "height": 50.4
}, },
"_anchorPoint": { "_anchorPoint": {
"__type__": "cc.Vec2", "__type__": "cc.Vec2",
"x": 0, "x": 0,
"y": 0.5 "y": 1
}, },
"_id": "" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "6eSfVOfMxPjb1oQVZ1z5hY" "fileId": "69g2Ps4UpEQIdkibaU0mB+"
}, },
{ {
"__type__": "cc.Sprite", "__type__": "cc.Label",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 3 "__id__": 1
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 7 "__id__": 5
}, },
"_customMaterial": null, "_customMaterial": null,
"_srcBlendFactor": 2, "_srcBlendFactor": 2,
@ -218,47 +108,47 @@
"_color": { "_color": {
"__type__": "cc.Color", "__type__": "cc.Color",
"r": 255, "r": 255,
"g": 0, "g": 255,
"b": 0, "b": 255,
"a": 255 "a": 255
}, },
"_spriteFrame": { "_string": "这是一个昵称",
"__uuid__": "24a704da-2867-446d-8d1a-5e920c75e09d@f9941", "_horizontalAlign": 0,
"__expectedType__": "cc.SpriteFrame" "_verticalAlign": 0,
}, "_actualFontSize": 40,
"_type": 1, "_fontSize": 40,
"_fillType": 0, "_fontFamily": "Arial",
"_sizeMode": 0, "_lineHeight": 40,
"_fillCenter": { "_overflow": 0,
"__type__": "cc.Vec2", "_enableWrapText": true,
"x": 0, "_font": null,
"y": 0 "_isSystemFontUsed": true,
}, "_spacingX": 0,
"_fillStart": 0, "_isItalic": false,
"_fillRange": 0, "_isBold": false,
"_isTrimmedMode": true, "_isUnderline": false,
"_useGrayscale": false, "_underlineHeight": 2,
"_atlas": null, "_cacheMode": 0,
"_id": "" "_id": ""
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__type__": "cc.CompPrefabInfo",
"fileId": "267GXyiYJB6qxCg6pLEfLQ" "fileId": "1fVVQb7LdIUZ7E43CVIsuV"
}, },
{ {
"__type__": "cc.Widget", "__type__": "cc.Widget",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
"__id__": 3 "__id__": 1
}, },
"_enabled": true, "_enabled": true,
"__prefab": { "__prefab": {
"__id__": 9 "__id__": 7
}, },
"_alignFlags": 8, "_alignFlags": 8,
"_target": null, "_target": null,
"_left": 0, "_left": 20,
"_right": 0, "_right": 0,
"_top": 0, "_top": 0,
"_bottom": 0, "_bottom": 0,
@ -278,7 +168,24 @@
}, },
{ {
"__type__": "cc.CompPrefabInfo", "__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", "__type__": "cc.PrefabInfo",
@ -288,403 +195,6 @@
"asset": { "asset": {
"__id__": 0 "__id__": 0
}, },
"fileId": "35OAlXyaBOBpLPAOKsDZHk" "fileId": "fcj/6WYKJAnbG8wIajLBQ9"
},
{
"__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"
} }
] ]

View File

@ -2,7 +2,7 @@
"ver": "1.1.39", "ver": "1.1.39",
"importer": "prefab", "importer": "prefab",
"imported": true, "imported": true,
"uuid": "d565d84f-56c4-4aa3-831c-99db0a0d2390", "uuid": "7b0c739f-cf46-48f7-8c15-c97ab34268fe",
"files": [ "files": [
".json" ".json"
], ],

View File

@ -1,7 +1,7 @@
[ [
{ {
"__type__": "cc.Prefab", "__type__": "cc.Prefab",
"_name": "RoomItem", "_name": "Room",
"_objFlags": 0, "_objFlags": 0,
"_native": "", "_native": "",
"data": { "data": {
@ -13,7 +13,7 @@
}, },
{ {
"__type__": "cc.Node", "__type__": "cc.Node",
"_name": "RoomItem", "_name": "Room",
"_objFlags": 0, "_objFlags": 0,
"__editorExtras__": {}, "__editorExtras__": {},
"_parent": null, "_parent": null,
@ -33,7 +33,7 @@
"__id__": 8 "__id__": 8
}, },
{ {
"__id__": 10 "__id__": 11
} }
], ],
"_prefab": { "_prefab": {
@ -174,7 +174,7 @@
"fileId": "04BVJ/YxxGgJB9RdmtoR81" "fileId": "04BVJ/YxxGgJB9RdmtoR81"
}, },
{ {
"__type__": "26da1px6w1GPbLW+8ZL8KuJ", "__type__": "cc.Button",
"_name": "", "_name": "",
"_objFlags": 0, "_objFlags": 0,
"node": { "node": {
@ -184,26 +184,9 @@
"__prefab": { "__prefab": {
"__id__": 9 "__id__": 9
}, },
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "fcJVJHKllGEpVqSAW4IqSW"
},
{
"__type__": "cc.Button",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 11
},
"clickEvents": [ "clickEvents": [
{ {
"__id__": 12 "__id__": 10
} }
], ],
"_interactable": true, "_interactable": true,
@ -255,10 +238,27 @@
"__id__": 1 "__id__": 1
}, },
"component": "", "component": "",
"_componentId": "26da1px6w1GPbLW+8ZL8KuJ", "_componentId": "23e174OdjdMjJr3kdwPQTAb",
"handler": "handleClick", "handler": "handleClick",
"customEventData": "" "customEventData": ""
}, },
{
"__type__": "23e174OdjdMjJr3kdwPQTAb",
"_name": "",
"_objFlags": 0,
"node": {
"__id__": 1
},
"_enabled": true,
"__prefab": {
"__id__": 12
},
"_id": ""
},
{
"__type__": "cc.CompPrefabInfo",
"fileId": "2fkxfXB3NCsI8C8viDWANS"
},
{ {
"__type__": "cc.PrefabInfo", "__type__": "cc.PrefabInfo",
"root": { "root": {

View File

@ -8,6 +8,6 @@
], ],
"subMetas": {}, "subMetas": {},
"userData": { "userData": {
"syncNodeName": "RoomItem" "syncNodeName": "Room"
} }
} }

View File

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 322 B

View File

Before

Width:  |  Height:  |  Size: 336 B

After

Width:  |  Height:  |  Size: 336 B

View File

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 332 B

View File

Before

Width:  |  Height:  |  Size: 312 B

After

Width:  |  Height:  |  Size: 312 B

View File

Before

Width:  |  Height:  |  Size: 317 B

After

Width:  |  Height:  |  Size: 317 B

View File

Before

Width:  |  Height:  |  Size: 333 B

After

Width:  |  Height:  |  Size: 333 B

View File

Before

Width:  |  Height:  |  Size: 306 B

After

Width:  |  Height:  |  Size: 306 B

View File

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 289 B

View File

Before

Width:  |  Height:  |  Size: 290 B

After

Width:  |  Height:  |  Size: 290 B

View File

Before

Width:  |  Height:  |  Size: 325 B

After

Width:  |  Height:  |  Size: 325 B

View File

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 277 B

View File

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 309 B

View 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 { }

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "7b9c95da-edaa-4c0c-8e41-b135b9802b86",
"files": [],
"subMetas": {},
"userData": {}
}

View 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',
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "2ba2bf1e-f8be-4a48-b759-666d5e757029",
"files": [],
"subMetas": {},
"userData": {}
}

View File

@ -0,0 +1,9 @@
export interface IPlayer {
id: number, nickname: string, rid: number
}
export interface IRoom {
id: number, players: Array<IPlayer>
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "87dc45aa-8878-48f4-9084-b4fd293a6414",
"files": [],
"subMetas": {},
"userData": {}
}

View 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
}

View File

@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "70de0494-112b-4a60-a266-3eadc82c20a4",
"files": [],
"subMetas": {},
"userData": {}
}

View 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
}

Some files were not shown because too many files have changed in this diff Show More