Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[low priority] Add collaboration client to multiplayer, hidden behind collab=1 flag #9948

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion multiplayer/.prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"arrowParens": "avoid",
"semi": true,
"tabWidth": 4
"tabWidth": 4,
"printWidth": 120
}
758 changes: 749 additions & 9 deletions multiplayer/package-lock.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions multiplayer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
"version": "0.1.0",
"private": true,
"dependencies": {
"@ctrl/tinycolor": "^4.0.3",
"@fortawesome/free-regular-svg-icons": "^6.2.0",
"@fortawesome/free-solid-svg-icons": "^6.2.0",
"@fortawesome/react-fontawesome": "^0.2.0",
"@types/node": "^12.20.45",
"engine.io-client": "^6.2.2",
"framer-motion": "^6.5.1",
"jsonpath-plus": "^8.1.0",
"nanoid": "^4.0.0",
"pixi.js": "^7.4.2",
"qrcode.react": "^3.1.0",
"react-scripts": "^5.0.1",
"smart-buffer": "^4.2.0",
Expand Down
21 changes: 5 additions & 16 deletions multiplayer/src/components/AppModal.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { useContext, useState } from "react";
import { Textarea } from "react-common/components/controls/Textarea";
import { SignInModal } from "react-common/components/profile/SignInModal";
import {
signInAsync,
kickPlayer,
leaveGameAsync,
sendAbuseReportAsync,
} from "../epics";
import { signInAsync, kickPlayer, leaveGameAsync, sendAbuseReportAsync } from "../epics";
import { clearModal } from "../state/actions";
import { AppStateContext, dispatch } from "../state/AppStateContext";
import ConfirmModal from "./modals/ConfirmModal";
Expand All @@ -24,10 +19,8 @@ export default function Render() {
onClose={() => dispatch(clearModal())}
onSignIn={async (provider, rememberMe) => {
const params: pxt.Map<string> = {};
if (deepLinks?.shareCode)
params["host"] = deepLinks.shareCode;
if (deepLinks?.joinCode)
params["join"] = deepLinks.joinCode;
if (deepLinks?.shareCode) params["host"] = deepLinks.shareCode;
if (deepLinks?.joinCode) params["join"] = deepLinks.joinCode;
await signInAsync(provider.id, rememberMe, { params });
}}
dialogMessages={state.modalOpts.dialogMessages}
Expand Down Expand Up @@ -63,9 +56,7 @@ export default function Render() {
}}
onCancel={() => dispatch(clearModal())}
>
<div>
{lf("Kick this player? They will be blocked from rejoining the game.")}
</div>
<div>{lf("Kick this player? They will be blocked from rejoining the game.")}</div>
</ConfirmModal>
);
case "leave-game":
Expand All @@ -79,9 +70,7 @@ export default function Render() {
}}
onCancel={() => dispatch(clearModal())}
>
<div>
{lf("End the game? All players will be disconnected.")}
</div>
<div>{lf("End the game? All players will be disconnected.")}</div>
</ConfirmModal>
);
} else {
Expand Down
11 changes: 2 additions & 9 deletions multiplayer/src/components/ArcadeSimulator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ import { SimMultiplayer } from "../types";
import * as gameClient from "../services/gameClient";
// eslint-disable-next-line import/no-unassigned-import
import "./ArcadeSimulator.css";
import {
simDriver,
preloadSim,
simulateAsync,
buildSimJsInfo,
RunOptions,
} from "../services/simHost";
import { simDriver, preloadSim, simulateAsync, buildSimJsInfo, RunOptions } from "../services/simHost";
import { state as currentState } from "../state";

let builtSimJsInfo: Promise<pxtc.BuiltSimJsInfo | undefined> | undefined;
Expand Down Expand Up @@ -75,8 +69,7 @@ export default function Render() {
// Once the simulator is ready, if this player is a guest, pass initial screen to simulator
const { state: simState } = data;
if (simState === "running" && clientRole === "guest") {
const { image, palette } =
gameClient.getCurrentScreen();
const { image, palette } = gameClient.getCurrentScreen();
if (image) {
simDriver()?.postMessage({
type: "multiplayer",
Expand Down
Loading