Initial commit
This commit is contained in:
commit
51607fcb54
9 changed files with 8511 additions and 0 deletions
218
.gitignore
vendored
Normal file
218
.gitignore
vendored
Normal file
|
@ -0,0 +1,218 @@
|
|||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/yarn,webstorm+all,node
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=yarn,webstorm+all,node
|
||||
|
||||
### Node ###
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
.cache/
|
||||
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
.tern-port
|
||||
|
||||
# Stores VSCode versions used for testing VSCode extensions
|
||||
.vscode-test
|
||||
|
||||
### WebStorm+all ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### WebStorm+all Patch ###
|
||||
# Ignores the whole .idea folder and all .iml files
|
||||
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
|
||||
|
||||
.idea/
|
||||
|
||||
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
|
||||
|
||||
*.iml
|
||||
modules.xml
|
||||
.idea/misc.xml
|
||||
*.ipr
|
||||
|
||||
# Sonarlint plugin
|
||||
.idea/sonarlint
|
||||
|
||||
### yarn ###
|
||||
# https://yarnpkg.com/advanced/qa#which-files-should-be-gitignored
|
||||
|
||||
# .yarn/unplugged and .yarn/build-state.yml should likely always be ignored since
|
||||
# they typically hold machine-specific build artifacts. Ignoring them might however
|
||||
# prevent Zero-Installs from working (to prevent this, set enableScripts to false).
|
||||
.yarn/unplugged
|
||||
.yarn/build-state.yml
|
||||
|
||||
# .yarn/cache and .pnp.* may be safely ignored, but you'll need to run yarn install
|
||||
# to regenerate them between each branch switch.
|
||||
# Uncomment the following lines if you're not using Zero-Installs:
|
||||
# .yarn/cache
|
||||
# .pnp.*
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/yarn,webstorm+all,node
|
21
package.json
Normal file
21
package.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "chatchat",
|
||||
"version": "1.0.0",
|
||||
"description": "ChatChat ported to HTML5",
|
||||
"scripts": {
|
||||
"build": "webpack"
|
||||
},
|
||||
"private": true,
|
||||
"repository": "https://gitdab.com/s/chatchat.git",
|
||||
"author": "Soren",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"ts-loader": "^8.0.4",
|
||||
"typescript": "^4.0.3",
|
||||
"webpack": "^4.44.2",
|
||||
"webpack-cli": "^3.3.12"
|
||||
},
|
||||
"dependencies": {
|
||||
"pixi.js": "^5.3.3"
|
||||
}
|
||||
}
|
24
src/PlayerIOAsync.ts
Normal file
24
src/PlayerIOAsync.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
import './PlayerIOClient.development';
|
||||
|
||||
export const authenticate = function (
|
||||
gameId: string,
|
||||
connectionId: string,
|
||||
authenticationArguments: Record<string, string>,
|
||||
playerInsightSegments: Array<string>,
|
||||
): Promise<PlayerIO.Client> {
|
||||
return new Promise<PlayerIO.Client>((resolve, reject) => {
|
||||
PlayerIO.authenticate(gameId, connectionId, authenticationArguments, playerInsightSegments, resolve, reject);
|
||||
});
|
||||
}
|
||||
|
||||
export const listRooms = function (
|
||||
multiplayer: PlayerIO.Multiplayer,
|
||||
roomType: string,
|
||||
searchCriteria: Record<string, string>,
|
||||
resultLimit: number,
|
||||
resultOffset: number,
|
||||
): Promise<Array<PlayerIO.RoomInfo>> {
|
||||
return new Promise<Array<PlayerIO.RoomInfo>>((resolve, reject) => {
|
||||
multiplayer.listRooms(roomType, searchCriteria, resultLimit, resultOffset, resolve, reject);
|
||||
});
|
||||
}
|
31
src/PlayerIOClient.development.d.ts
vendored
Normal file
31
src/PlayerIOClient.development.d.ts
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
declare enum PlayerIOErrorCode {
|
||||
|
||||
}
|
||||
|
||||
declare class PlayerIOError {
|
||||
code: PlayerIOErrorCode;
|
||||
message: string;
|
||||
stack: any;
|
||||
}
|
||||
|
||||
declare namespace PlayerIO {
|
||||
let useSecureApiRequests: boolean;
|
||||
const authenticate: (gameId: string, connectionId: string, authenticationArguments: Record<string, string>, playerInsightSegments: Array<string>, successCallback: (client: PlayerIO.Client) => void, errorCallback: (error: PlayerIOError) => void) => void;
|
||||
|
||||
class Client {
|
||||
multiplayer: Multiplayer;
|
||||
}
|
||||
|
||||
class Multiplayer {
|
||||
useSecureConnections: boolean;
|
||||
listRooms: (roomType: string, searchCriteria: Record<string, string>, resultLimit: number, resultOffset: number, successCallback: (rooms: Array<RoomInfo>) => void, errorCallback: (error: PlayerIOError) => void) => void
|
||||
}
|
||||
|
||||
class RoomInfo {
|
||||
id: string;
|
||||
onlineUsers: number;
|
||||
roomData: Record<string, string>;
|
||||
roomType: string;
|
||||
}
|
||||
}
|
||||
|
5081
src/PlayerIOClient.development.js
Normal file
5081
src/PlayerIOClient.development.js
Normal file
File diff suppressed because it is too large
Load diff
26
src/index.ts
Normal file
26
src/index.ts
Normal file
|
@ -0,0 +1,26 @@
|
|||
import * as PIXI from 'pixi.js';
|
||||
|
||||
import './PlayerIOClient.development';
|
||||
import * as Pio from "./PlayerIOAsync";
|
||||
|
||||
PlayerIO.useSecureApiRequests = true;
|
||||
|
||||
(async function() {
|
||||
const cli = await Pio.authenticate(
|
||||
"kittygame-48om7qu7teeazkf9gana",
|
||||
"public",
|
||||
{ userId: "soren" },
|
||||
[]
|
||||
);
|
||||
console.log(cli);
|
||||
const multiplayer = cli.multiplayer;
|
||||
console.log(multiplayer);
|
||||
const rooms = await Pio.listRooms(
|
||||
multiplayer,
|
||||
"KittyRpg2",
|
||||
{},
|
||||
50,
|
||||
0
|
||||
)
|
||||
console.log(rooms);
|
||||
})();
|
13
tsconfig.json
Normal file
13
tsconfig.json
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist/",
|
||||
"sourceMap": true,
|
||||
"noImplicitAny": true,
|
||||
"module": "commonjs",
|
||||
"lib": ["dom", "es2020"],
|
||||
"target": "es5",
|
||||
"jsx": "react",
|
||||
"allowJs": true
|
||||
}
|
||||
}
|
||||
|
23
webpack.config.js
Normal file
23
webpack.config.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
entry: './src/index.ts',
|
||||
devtool: 'inline-source-map',
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
use: 'ts-loader',
|
||||
exclude: /node_modules/,
|
||||
},
|
||||
],
|
||||
},
|
||||
resolve: {
|
||||
extensions: [ '.tsx', '.ts', '.js' ],
|
||||
},
|
||||
output: {
|
||||
filename: 'main.js',
|
||||
path: path.resolve(__dirname, 'dist'),
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in a new issue