tsrpc creator 2.4.7 demo
This commit is contained in:
parent
62832b00d2
commit
f46acc0833
3
examples/cocos-creator-2.4.7/backend/.gitignore
vendored
Normal file
3
examples/cocos-creator-2.4.7/backend/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
dist
|
||||
.DS_STORE
|
30
examples/cocos-creator-2.4.7/backend/.vscode/launch.json
vendored
Normal file
30
examples/cocos-creator-2.4.7/backend/.vscode/launch.json
vendored
Normal file
@ -0,0 +1,30 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "mocha current file",
|
||||
"program": "${workspaceFolder}/node_modules/mocha/bin/_mocha",
|
||||
"args": [
|
||||
"${file}"
|
||||
],
|
||||
"internalConsoleOptions": "openOnSessionStart",
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "ts-node current file",
|
||||
"protocol": "inspector",
|
||||
"args": [
|
||||
"${relativeFile}"
|
||||
],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"runtimeArgs": [
|
||||
"-r",
|
||||
"ts-node/register"
|
||||
],
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
}
|
||||
]
|
||||
}
|
3
examples/cocos-creator-2.4.7/backend/.vscode/settings.json
vendored
Normal file
3
examples/cocos-creator-2.4.7/backend/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
{
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib"
|
||||
}
|
35
examples/cocos-creator-2.4.7/backend/README.md
Normal file
35
examples/cocos-creator-2.4.7/backend/README.md
Normal file
@ -0,0 +1,35 @@
|
||||
# TSRPC Server
|
||||
|
||||
## Run
|
||||
### Local Dev Server
|
||||
```
|
||||
npm run dev
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Build
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Files
|
||||
### Generate ServiceProto
|
||||
```
|
||||
npm run proto
|
||||
```
|
||||
|
||||
### Generate API templates
|
||||
```
|
||||
npm run api
|
||||
```
|
||||
|
||||
### Sync shared code to client
|
||||
|
||||
```
|
||||
npm run sync
|
||||
```
|
||||
|
||||
> If you chose symlink when using `create-tsrpc-app`, it would re-create the symlink instead of copy files.
|
23
examples/cocos-creator-2.4.7/backend/package.json
Normal file
23
examples/cocos-creator-2.4.7/backend/package.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "chatroom-backend",
|
||||
"version": "0.1.0",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"proto": "tsrpc proto --config tsrpc.config.ts",
|
||||
"sync": "tsrpc sync --config tsrpc.config.ts",
|
||||
"api": "tsrpc api --config tsrpc.config.ts",
|
||||
"dev": "tsrpc dev --config tsrpc.config.ts",
|
||||
"build": "tsrpc build --config tsrpc.config.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^15.14.9",
|
||||
"onchange": "^7.1.0",
|
||||
"ts-node": "^9.1.1",
|
||||
"tsrpc-cli": "^2.2.0",
|
||||
"typescript": "^4.5.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"tsrpc": "^3.1.2"
|
||||
}
|
||||
}
|
23
examples/cocos-creator-2.4.7/backend/src/api/ApiSend.ts
Normal file
23
examples/cocos-creator-2.4.7/backend/src/api/ApiSend.ts
Normal file
@ -0,0 +1,23 @@
|
||||
import { ApiCall } from "tsrpc";
|
||||
import { server } from "..";
|
||||
import { ReqSend, ResSend } from "../shared/protocols/PtlSend";
|
||||
|
||||
export async function ApiSend(call: ApiCall<ReqSend, ResSend>) {
|
||||
// Error
|
||||
if (call.req.content.length === 0) {
|
||||
call.error('Content is empty')
|
||||
return;
|
||||
}
|
||||
|
||||
// Success
|
||||
let time = new Date();
|
||||
call.succ({
|
||||
time: time
|
||||
});
|
||||
|
||||
// Broadcast
|
||||
server.broadcastMsg('Chat', {
|
||||
content: call.req.content,
|
||||
time: time
|
||||
})
|
||||
}
|
24
examples/cocos-creator-2.4.7/backend/src/index.ts
Normal file
24
examples/cocos-creator-2.4.7/backend/src/index.ts
Normal file
@ -0,0 +1,24 @@
|
||||
import * as path from "path";
|
||||
import { WsServer } from "tsrpc";
|
||||
import { serviceProto } from './shared/protocols/serviceProto';
|
||||
|
||||
// Create the Server
|
||||
export const server = new WsServer(serviceProto, {
|
||||
port: 3000
|
||||
});
|
||||
|
||||
// Entry function
|
||||
async function main() {
|
||||
await server.autoImplementApi(path.resolve(__dirname, 'api'));
|
||||
|
||||
// TODO
|
||||
// Prepare something... (e.g. connect the db)
|
||||
|
||||
await server.start();
|
||||
};
|
||||
|
||||
main().catch(e => {
|
||||
// Exit if any error during the startup
|
||||
server.logger.error(e);
|
||||
process.exit(-1);
|
||||
});
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "40721700-8121-4c1e-be92-c90e93cdc4c8",
|
||||
"importer": "directory",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
export interface MsgChat {
|
||||
content: string,
|
||||
time: Date
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "43723a09-6be4-404b-a21a-22ad675d0e58",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
export interface ReqSend {
|
||||
content: string
|
||||
}
|
||||
|
||||
export interface ResSend {
|
||||
time: Date
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "48e989fd-b5a5-4a5b-ac68-71d7f7f3d8ee",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
import { ServiceProto } from 'tsrpc-proto';
|
||||
import { MsgChat } from './MsgChat';
|
||||
import { ReqSend, ResSend } from './PtlSend';
|
||||
|
||||
export interface ServiceType {
|
||||
api: {
|
||||
"Send": {
|
||||
req: ReqSend,
|
||||
res: ResSend
|
||||
}
|
||||
},
|
||||
msg: {
|
||||
"Chat": MsgChat
|
||||
}
|
||||
}
|
||||
|
||||
export const serviceProto: ServiceProto<ServiceType> = {
|
||||
"services": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Chat",
|
||||
"type": "msg"
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Send",
|
||||
"type": "api"
|
||||
}
|
||||
],
|
||||
"types": {
|
||||
"MsgChat/MsgChat": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "content",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "time",
|
||||
"type": {
|
||||
"type": "Date"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlSend/ReqSend": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "content",
|
||||
"type": {
|
||||
"type": "String"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"PtlSend/ResSend": {
|
||||
"type": "Interface",
|
||||
"properties": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "time",
|
||||
"type": {
|
||||
"type": "Date"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "aeef551d-77fd-412f-be4b-4ea615a24639",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
18
examples/cocos-creator-2.4.7/backend/tsconfig.json
Normal file
18
examples/cocos-creator-2.4.7/backend/tsconfig.json
Normal file
@ -0,0 +1,18 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"es2018"
|
||||
],
|
||||
"module": "commonjs",
|
||||
"target": "es2018",
|
||||
"outDir": "dist",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"moduleResolution": "node"
|
||||
},
|
||||
"include": [
|
||||
"src"
|
||||
]
|
||||
}
|
36
examples/cocos-creator-2.4.7/backend/tsrpc.config.ts
Normal file
36
examples/cocos-creator-2.4.7/backend/tsrpc.config.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { TsrpcConfig } from 'tsrpc-cli';
|
||||
|
||||
const tsrpcConf: TsrpcConfig = {
|
||||
// Generate ServiceProto
|
||||
proto: [
|
||||
{
|
||||
ptlDir: 'src/shared/protocols', // Protocol dir
|
||||
output: 'src/shared/protocols/serviceProto.ts', // Path for generated ServiceProto
|
||||
apiDir: 'src/api' // API dir
|
||||
}
|
||||
],
|
||||
// Sync shared code
|
||||
sync: [
|
||||
{
|
||||
from: 'src/shared',
|
||||
to: '../frontend/assets/scripts/shared',
|
||||
type: 'symlink' // Change this to 'copy' if your environment not support symlink
|
||||
}
|
||||
],
|
||||
// Dev server
|
||||
dev: {
|
||||
autoProto: true, // Auto regenerate proto
|
||||
autoSync: true, // Auto sync when file changed
|
||||
autoApi: true, // Auto create API when ServiceProto updated
|
||||
watch: 'src', // Restart dev server when these files changed
|
||||
entry: 'src/index.ts', // Dev server command: node -r ts-node/register {entry}
|
||||
},
|
||||
// Build config
|
||||
build: {
|
||||
autoProto: true, // Auto generate proto before build
|
||||
autoSync: true, // Auto sync before build
|
||||
autoApi: true, // Auto generate API before build
|
||||
outDir: 'dist', // Clean this dir before build
|
||||
}
|
||||
}
|
||||
export default tsrpcConf;
|
53
examples/cocos-creator-2.4.7/frontend/.gitignore
vendored
Normal file
53
examples/cocos-creator-2.4.7/frontend/.gitignore
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Fireball Projects
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/library/
|
||||
/temp/
|
||||
/local/
|
||||
/build/
|
||||
native
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# npm files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
npm-debug.log
|
||||
node_modules/
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# Logs and databases
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.log
|
||||
*.sql
|
||||
*.sqlite
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# files for debugger
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
*.sln
|
||||
*.csproj
|
||||
*.pidb
|
||||
*.unityproj
|
||||
*.suo
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# OS generated files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.DS_Store
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
# WebStorm files
|
||||
#/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
.idea/
|
||||
|
||||
#//////////////////////////
|
||||
# VS Code files
|
||||
#//////////////////////////
|
||||
|
||||
.vscode/
|
4377
examples/cocos-creator-2.4.7/frontend/assets/Lobby.fire
Normal file
4377
examples/cocos-creator-2.4.7/frontend/assets/Lobby.fire
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,8 @@
|
||||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "afd1e858-cfd0-487d-9bb2-08a676dc214e",
|
||||
"importer": "scene",
|
||||
"asyncLoadAssets": false,
|
||||
"autoReleaseAssets": false,
|
||||
"subMetas": {}
|
||||
}
|
13
examples/cocos-creator-2.4.7/frontend/assets/prefabs.meta
Normal file
13
examples/cocos-creator-2.4.7/frontend/assets/prefabs.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "c7b20543-c770-4080-b07d-a2e073bcc0a0",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "35dbc052-8b38-4ebc-a2d2-51bb5a939c87",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
|
||||
import { BaseWsClient } from 'tsrpc-base-client';
|
||||
import { WsClient as WsClientBrowser } from 'tsrpc-browser';
|
||||
import { MsgChat } from '../../scripts/shared/protocols/MsgChat';
|
||||
import { serviceProto, ServiceType } from '../../scripts/shared/protocols/serviceProto';
|
||||
import { ChatBoxMsgItem } from './ChatBox_MsgItem/ChatBoxMsgItem';
|
||||
const {ccclass, property} = cc._decorator;
|
||||
|
||||
|
||||
@ccclass('ChatBox')
|
||||
export class ChatBox extends cc.Component {
|
||||
|
||||
@property
|
||||
roomName = '';
|
||||
|
||||
// Prefabs
|
||||
@property(cc.Prefab)
|
||||
prefabMsgItem!: cc.Prefab;
|
||||
|
||||
// Nodes
|
||||
@property(cc.Label)
|
||||
labelTitle!: cc.Label;
|
||||
@property(cc.ScrollView)
|
||||
msgScroll!: cc.ScrollView;
|
||||
@property(cc.EditBox)
|
||||
inputSend!: cc.EditBox;
|
||||
|
||||
client!: BaseWsClient<ServiceType>;
|
||||
|
||||
onLoad() {
|
||||
// Create client by platform
|
||||
|
||||
this.client = new WsClientBrowser(serviceProto, {
|
||||
server: 'ws://127.0.0.1:3000',
|
||||
logger: console
|
||||
})
|
||||
|
||||
|
||||
// Connect at startup
|
||||
this.connect();
|
||||
|
||||
// Listen Msg
|
||||
this.client.listenMsg('Chat', v => { this.onChatMsg(v) })
|
||||
|
||||
// When disconnected
|
||||
this.client.flows.postDisconnectFlow.push(v => {
|
||||
// Retry after 2 seconds
|
||||
this.labelTitle.string = `🔴 Disconnected`;
|
||||
setTimeout(() => {
|
||||
this.connect();
|
||||
}, 2000)
|
||||
return v;
|
||||
})
|
||||
}
|
||||
|
||||
async connect(): Promise<void> {
|
||||
this.labelTitle.string = `🟡 Connecting...`;
|
||||
let res = await this.client.connect();
|
||||
if (!res.isSucc) {
|
||||
this.labelTitle.string = `🔴 Disconnected`;
|
||||
|
||||
// Retry after 2 seconds
|
||||
await new Promise(rs => { setTimeout(rs, 2000) });
|
||||
await this.connect();
|
||||
}
|
||||
|
||||
this.labelTitle.string = '🟢 ' + this.roomName;
|
||||
}
|
||||
|
||||
async send() {
|
||||
if (!this.inputSend.string) {
|
||||
return;
|
||||
}
|
||||
|
||||
let ret = await this.client.callApi('Send', {
|
||||
content: this.inputSend.string
|
||||
});
|
||||
|
||||
// Error
|
||||
if (!ret.isSucc) {
|
||||
alert(ret.err.message);
|
||||
return;
|
||||
}
|
||||
|
||||
// Success
|
||||
this.inputSend.string = '';
|
||||
}
|
||||
|
||||
onChatMsg(msg: MsgChat) {
|
||||
let node = cc.instantiate(this.prefabMsgItem);
|
||||
this.msgScroll.content!.addChild(node);
|
||||
node.getComponent(ChatBoxMsgItem)!.options = {
|
||||
msg: msg
|
||||
}
|
||||
this.msgScroll.scrollToBottom(0.2);
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "59518273-f805-4423-bf97-815010a3a3ba",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "6696c433-4f30-4fe7-8b17-0c4b44ab970b",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
import { MsgChat } from "../../../scripts/shared/protocols/MsgChat";
|
||||
|
||||
|
||||
|
||||
const { ccclass, property } = cc._decorator;
|
||||
|
||||
export interface ChatBoxMsgItemOptions {
|
||||
msg: MsgChat
|
||||
}
|
||||
|
||||
@ccclass('ChatBoxMsgItem')
|
||||
export class ChatBoxMsgItem extends cc.Component {
|
||||
|
||||
@property(cc.Label)
|
||||
labelMessage!: cc.Label;
|
||||
@property(cc.Label)
|
||||
labelTime!: cc.Label;
|
||||
|
||||
|
||||
private _options!: ChatBoxMsgItemOptions;
|
||||
public get options(): ChatBoxMsgItemOptions {
|
||||
return this._options;
|
||||
}
|
||||
public set options(v: ChatBoxMsgItemOptions) {
|
||||
this._options = v;
|
||||
|
||||
this.labelMessage.string = v.msg.content;
|
||||
this.labelTime.string = v.msg.time.toLocaleTimeString();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"ver": "1.1.0",
|
||||
"uuid": "78d1aea4-2634-4860-a2c9-782a04d067db",
|
||||
"importer": "typescript",
|
||||
"isPlugin": false,
|
||||
"loadPluginInWeb": true,
|
||||
"loadPluginInNative": true,
|
||||
"loadPluginInEditor": false,
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,421 @@
|
||||
[
|
||||
{
|
||||
"__type__": "cc.Prefab",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"_native": "",
|
||||
"data": {
|
||||
"__id__": 1
|
||||
},
|
||||
"optimizationPolicy": 0,
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "ChatBox_MsgItem",
|
||||
"_objFlags": 0,
|
||||
"_parent": null,
|
||||
"_children": [
|
||||
{
|
||||
"__id__": 2
|
||||
},
|
||||
{
|
||||
"__id__": 6
|
||||
}
|
||||
],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 10
|
||||
},
|
||||
{
|
||||
"__id__": 11
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 12
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 255,
|
||||
"g": 255,
|
||||
"b": 255,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 500,
|
||||
"height": 100
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
0,
|
||||
-60,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "message",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 3
|
||||
},
|
||||
{
|
||||
"__id__": 4
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 5
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 0,
|
||||
"g": 0,
|
||||
"b": 0,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 450,
|
||||
"height": 54.239999999999995
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 1
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
-230,
|
||||
45,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_string": "messageeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffff",
|
||||
"_N$string": "messageeeeeeeeeeeeeeeeeeeffffffffffffffffffffffffffffffffffffffffff",
|
||||
"_fontSize": 24,
|
||||
"_lineHeight": 24,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_styleFlags": 0,
|
||||
"_underlineHeight": 0,
|
||||
"_N$horizontalAlign": 0,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 3,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 2
|
||||
},
|
||||
"_enabled": true,
|
||||
"alignMode": 1,
|
||||
"_target": null,
|
||||
"_alignFlags": 9,
|
||||
"_left": 20,
|
||||
"_right": 0,
|
||||
"_top": 5,
|
||||
"_bottom": 0,
|
||||
"_verticalCenter": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 0,
|
||||
"_originalHeight": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "2eXmKmE9BLPI02lVkytbrL",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Node",
|
||||
"_name": "time",
|
||||
"_objFlags": 0,
|
||||
"_parent": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_children": [],
|
||||
"_active": true,
|
||||
"_components": [
|
||||
{
|
||||
"__id__": 7
|
||||
},
|
||||
{
|
||||
"__id__": 8
|
||||
}
|
||||
],
|
||||
"_prefab": {
|
||||
"__id__": 9
|
||||
},
|
||||
"_opacity": 255,
|
||||
"_color": {
|
||||
"__type__": "cc.Color",
|
||||
"r": 75,
|
||||
"g": 128,
|
||||
"b": 187,
|
||||
"a": 255
|
||||
},
|
||||
"_contentSize": {
|
||||
"__type__": "cc.Size",
|
||||
"width": 450,
|
||||
"height": 30.240000000000002
|
||||
},
|
||||
"_anchorPoint": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 1,
|
||||
"y": 1
|
||||
},
|
||||
"_trs": {
|
||||
"__type__": "TypedArray",
|
||||
"ctor": "Float64Array",
|
||||
"array": [
|
||||
220,
|
||||
-14.759999999999998,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
1,
|
||||
1,
|
||||
1,
|
||||
1
|
||||
]
|
||||
},
|
||||
"_eulerAngles": {
|
||||
"__type__": "cc.Vec3",
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"z": 0
|
||||
},
|
||||
"_skewX": 0,
|
||||
"_skewY": 0,
|
||||
"_is3DNode": false,
|
||||
"_groupIndex": 0,
|
||||
"groupIndex": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Label",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_string": "10.22.22",
|
||||
"_N$string": "10.22.22",
|
||||
"_fontSize": 24,
|
||||
"_lineHeight": 24,
|
||||
"_enableWrapText": true,
|
||||
"_N$file": null,
|
||||
"_isSystemFontUsed": true,
|
||||
"_spacingX": 0,
|
||||
"_batchAsBitmap": false,
|
||||
"_styleFlags": 0,
|
||||
"_underlineHeight": 0,
|
||||
"_N$horizontalAlign": 2,
|
||||
"_N$verticalAlign": 1,
|
||||
"_N$fontFamily": "Arial",
|
||||
"_N$overflow": 3,
|
||||
"_N$cacheMode": 0,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Widget",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 6
|
||||
},
|
||||
"_enabled": true,
|
||||
"alignMode": 1,
|
||||
"_target": null,
|
||||
"_alignFlags": 36,
|
||||
"_left": 20,
|
||||
"_right": 30,
|
||||
"_top": 5,
|
||||
"_bottom": 5,
|
||||
"_verticalCenter": 0,
|
||||
"_horizontalCenter": 0,
|
||||
"_isAbsLeft": true,
|
||||
"_isAbsRight": true,
|
||||
"_isAbsTop": true,
|
||||
"_isAbsBottom": true,
|
||||
"_isAbsHorizontalCenter": true,
|
||||
"_isAbsVerticalCenter": true,
|
||||
"_originalWidth": 450,
|
||||
"_originalHeight": 54.239999999999995,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "c4C1Aq66VNEpCu0sJZFvMD",
|
||||
"sync": false
|
||||
},
|
||||
{
|
||||
"__type__": "cc.Sprite",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"_materials": [
|
||||
{
|
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432"
|
||||
}
|
||||
],
|
||||
"_srcBlendFactor": 770,
|
||||
"_dstBlendFactor": 771,
|
||||
"_spriteFrame": {
|
||||
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91"
|
||||
},
|
||||
"_type": 0,
|
||||
"_sizeMode": 0,
|
||||
"_fillType": 0,
|
||||
"_fillCenter": {
|
||||
"__type__": "cc.Vec2",
|
||||
"x": 0,
|
||||
"y": 0
|
||||
},
|
||||
"_fillStart": 0,
|
||||
"_fillRange": 0,
|
||||
"_isTrimmedMode": true,
|
||||
"_atlas": null,
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "78d1a6kJjRIYKLJeCoE0Gfb",
|
||||
"_name": "",
|
||||
"_objFlags": 0,
|
||||
"node": {
|
||||
"__id__": 1
|
||||
},
|
||||
"_enabled": true,
|
||||
"labelMessage": {
|
||||
"__id__": 3
|
||||
},
|
||||
"labelTime": {
|
||||
"__id__": 7
|
||||
},
|
||||
"_id": ""
|
||||
},
|
||||
{
|
||||
"__type__": "cc.PrefabInfo",
|
||||
"root": {
|
||||
"__id__": 1
|
||||
},
|
||||
"asset": {
|
||||
"__id__": 0
|
||||
},
|
||||
"fileId": "",
|
||||
"sync": false
|
||||
}
|
||||
]
|
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "1aa44a1e-ba27-4984-b173-f385fca2a8b2",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "1.3.2",
|
||||
"uuid": "ba339ce2-edd5-4916-8935-f8550c2e0c42",
|
||||
"importer": "prefab",
|
||||
"optimizationPolicy": "AUTO",
|
||||
"asyncLoadAssets": false,
|
||||
"readonly": false,
|
||||
"subMetas": {}
|
||||
}
|
13
examples/cocos-creator-2.4.7/frontend/assets/scripts.meta
Normal file
13
examples/cocos-creator-2.4.7/frontend/assets/scripts.meta
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "8edf980c-ff26-4b68-aca8-080c936b14dc",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
{
|
||||
"ver": "1.1.3",
|
||||
"uuid": "063ca637-20a7-466e-96c2-4cd414367a1d",
|
||||
"importer": "folder",
|
||||
"isBundle": false,
|
||||
"bundleName": "",
|
||||
"priority": 1,
|
||||
"compressionType": {},
|
||||
"optimizeHotUpdate": {},
|
||||
"inlineSpriteFrames": {},
|
||||
"isRemoteBundle": {},
|
||||
"subMetas": {}
|
||||
}
|
32073
examples/cocos-creator-2.4.7/frontend/creator.d.ts
vendored
Normal file
32073
examples/cocos-creator-2.4.7/frontend/creator.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
15
examples/cocos-creator-2.4.7/frontend/jsconfig.json
Normal file
15
examples/cocos-creator-2.4.7/frontend/jsconfig.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"module": "commonjs",
|
||||
"experimentalDecorators": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
".vscode",
|
||||
"library",
|
||||
"local",
|
||||
"settings",
|
||||
"temp"
|
||||
]
|
||||
}
|
15
examples/cocos-creator-2.4.7/frontend/package.json
Normal file
15
examples/cocos-creator-2.4.7/frontend/package.json
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "tsrpc-cocos-2.4.7",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"tsrpc-browser": "^3.1.2",
|
||||
"tsrpc-miniapp": "^3.1.2"
|
||||
}
|
||||
}
|
8
examples/cocos-creator-2.4.7/frontend/project.json
Normal file
8
examples/cocos-creator-2.4.7/frontend/project.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"engine": "cocos-creator-js",
|
||||
"packages": "packages",
|
||||
"name": "frontend",
|
||||
"id": "c2131e89-6f19-4750-a879-574372ab7d1c",
|
||||
"version": "2.4.7",
|
||||
"isNew": false
|
||||
}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"game": {
|
||||
"name": "未知游戏",
|
||||
"appid": "UNKNOW"
|
||||
}
|
||||
}
|
19
examples/cocos-creator-2.4.7/frontend/tsconfig.json
Normal file
19
examples/cocos-creator-2.4.7/frontend/tsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [ "es2015", "es2017", "dom" ],
|
||||
"target": "es5",
|
||||
"experimentalDecorators": true,
|
||||
"skipLibCheck": true,
|
||||
"outDir": "temp/vscode-dist",
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"library",
|
||||
"local",
|
||||
"temp",
|
||||
"build",
|
||||
"settings"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user