Skip to content

Commit bd24a04

Browse files
Merge branch 'master' into Fix/regexValidateAbi
2 parents 3a6679d + 93b8ef2 commit bd24a04

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+8669
-5622
lines changed

.github/workflows/demo-build.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Simple workflow for deploying static content to GitHub Pages
2+
name: Deploy static content to Pages
3+
4+
on:
5+
# Runs on pushes targeting the default branch
6+
push:
7+
branches: ["master"]
8+
9+
# Allows you to run this workflow manually from the Actions tab
10+
workflow_dispatch:
11+
12+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
20+
concurrency:
21+
group: "pages"
22+
cancel-in-progress: false
23+
24+
jobs:
25+
# Single deploy job since we're just deploying
26+
deploy:
27+
environment:
28+
name: github-pages
29+
url: ${{ steps.deployment.outputs.page_url }}
30+
runs-on: ubuntu-latest
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v5
36+
- name: Setup Node.js
37+
uses: actions/setup-node@v3
38+
with:
39+
node-version: '18'
40+
- name: Install dependencies
41+
run: npm ci --prefix ./Demo/
42+
- name: Build the React app
43+
run: npm run build --prefix ./Demo/
44+
- name: Move Build Files
45+
run: ls ./Demo/ && mkdir ./Demo/dist/Build && cp -r ./Demo/Build/* ./Demo/dist/Build
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
# Upload entire repository
50+
path: './Demo/dist/'
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ testchain/artifacts/build-info
116116
testchain/cache/
117117

118118
package-lock.json
119+
!Demo/package-lock.json
119120

120121
# Test config
121122
Assets/SequenceSDK/WaaS/Tests/Resources/

Assets/WebGLTemplates/SequenceReact/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + React + TS</title>
7+
<title>Sequence Unity Demo</title>
88
</head>
99
<body>
1010
<div id="root"></div>

Assets/WebGLTemplates/SequenceReact/src/App.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
.container {
1010
position: relative;
11-
/* The container determains the size. */
12-
width: 800px;
13-
height: 600px;
1411
}
1512

1613
.container > .loading-overlay {
@@ -20,7 +17,7 @@
2017
left: 0;
2118
width: 100%;
2219
height: 100%;
23-
background: grey;
20+
background: #1a1a1a;
2421
/* We'll set the following Flex properties in order to center the text. */
2522
display: flex;
2623
justify-content: center;

Assets/WebGLTemplates/SequenceReact/src/App.tsx

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import {ReactUnityEventParameter} from "react-unity-webgl/distribution/types/react-unity-event-parameters";
12
import { Unity, useUnityContext } from "react-unity-webgl";
23
import { useCallback, useEffect, useState } from "react";
34
import {
@@ -25,11 +26,14 @@ import "./App.css";
2526

2627
const loadingPercentage = Math.round(loadingProgression * 100);
2728

28-
const handleGoogleSignIn = useCallback((googleClientId: string, nonce: string) => {
29-
setGoogleClientId(googleClientId);
30-
setNonce(nonce);
31-
setShowLogin(true);
32-
}, []);
29+
const handleGoogleSignIn = useCallback((...parameters: ReactUnityEventParameter[]): ReactUnityEventParameter => {
30+
const googleClientId = parameters[0] as string;
31+
const nonce = parameters[1] as string;
32+
setGoogleClientId(googleClientId);
33+
setNonce(nonce);
34+
setShowLogin(true);
35+
return '';
36+
}, []);
3337

3438
const [googleClientIdState, setGoogleClientId] = useState("");
3539
const [nonce, setNonce] = useState("");
@@ -52,8 +56,11 @@ import "./App.css";
5256

5357
useEffect(() => {
5458
addEventListener("GoogleSignIn", handleGoogleSignIn);
59+
window.addEventListener("resize", handleResize);
60+
handleResize()
5561
return () => {
5662
removeEventListener("GoogleSignIn", handleGoogleSignIn);
63+
window.removeEventListener("resize", handleResize);
5764
};
5865
}, []);
5966

@@ -68,6 +75,23 @@ import "./App.css";
6875
setShowLogin(false);
6976
};
7077

78+
const handleResize = () => {
79+
const container = document.querySelector('.container') as any;
80+
81+
let w = window.innerWidth * 0.98;
82+
let h = window.innerHeight * 0.98;
83+
84+
const r = 600 / 960;
85+
if (w * r > window.innerHeight) {
86+
w = Math.min(w, Math.ceil(h / r));
87+
}
88+
89+
h = Math.floor(w * r);
90+
91+
container.style.width = w + "px";
92+
container.style.height = h + "px";
93+
}
94+
7195
return (
7296
<div className="outer-container">
7397
<div className="container">

Assets/WebGLTemplates/SequenceReact/src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
color-scheme: light dark;
77
color: rgba(255, 255, 255, 0.87);
8-
background-color: #242424;
8+
background-color: #1a1a1a;
99

1010
font-synthesis: none;
1111
text-rendering: optimizeLegibility;

Assets/WebGLTemplates/SequenceReact/vite.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,9 @@ import react from '@vitejs/plugin-react'
44
// https://vitejs.dev/config/
55
export default defineConfig({
66
plugins: [react()],
7+
base: './',
8+
build: {
9+
assetsDir: '.',
10+
outDir: 'dist',
11+
},
712
})

Demo/Build/Demo.data

14.9 MB
Binary file not shown.

Demo/Build/Demo.framework.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/Build/Demo.loader.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)