First commit
16
.editorconfig
Normal file
@ -0,0 +1,16 @@
|
||||
# Editor configuration, see https://editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.ts]
|
||||
quote_type = single
|
||||
|
||||
[*.md]
|
||||
max_line_length = off
|
||||
trim_trailing_whitespace = false
|
16
.vscode/settings.json
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
{
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||
"typescript.preferences.importModuleSpecifier": "relative",
|
||||
"typescript.preferences.quoteStyle": "single",
|
||||
"typescript.format.placeOpenBraceOnNewLineForControlBlocks": true,
|
||||
"typescript.format.placeOpenBraceOnNewLineForFunctions": true,
|
||||
"editor.codeActionsOnSave": {
|
||||
"source.fixAll": true,
|
||||
"source.organizeImports": true,
|
||||
},
|
||||
"emmet.showExpandedAbbreviation": "never",
|
||||
"git.ignoreLimitWarning": true,
|
||||
"files.eol": "\n",
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true
|
||||
}
|
2400
package-lock.json
generated
12
package.json
@ -10,13 +10,18 @@
|
||||
"@types/node": "^12.20.7",
|
||||
"@types/react": "^17.0.3",
|
||||
"@types/react-dom": "^17.0.3",
|
||||
"nitro-renderer": "file:../nitro-renderer",
|
||||
"node-sass": "^5.0.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-redux": "^7.2.3",
|
||||
"react-scripts": "4.0.3",
|
||||
"redux": "^4.0.5",
|
||||
"typescript": "^4.2.4",
|
||||
"web-vitals": "^1.1.1"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "node ./webpack-patcher.js",
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
@ -26,7 +31,12 @@
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
],
|
||||
"rules": {
|
||||
"no-switch-case-fall-through": [
|
||||
"off"
|
||||
]
|
||||
}
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
|
438
public/configuration.json
Normal file
@ -39,5 +39,11 @@
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
<script>
|
||||
var NitroConfig = {
|
||||
configurationUrl: '/configuration.json',
|
||||
sso: (new URLSearchParams(window.location.search).get('sso') || null)
|
||||
};
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
38
src/App.css
@ -1,38 +0,0 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
import React from 'react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import App from './App';
|
||||
|
||||
test('renders learn react link', () => {
|
||||
render(<App />);
|
||||
const linkElement = screen.getByText(/learn react/i);
|
||||
expect(linkElement).toBeInTheDocument();
|
||||
});
|
159
src/App.tsx
@ -1,26 +1,137 @@
|
||||
import React from 'react';
|
||||
import logo from './logo.svg';
|
||||
import './App.css';
|
||||
import { ConfigurationEvent, NitroEvent } from 'nitro-renderer';
|
||||
import { NitroCommunicationDemoEvent } from 'nitro-renderer/src/nitro/communication/demo/NitroCommunicationDemoEvent';
|
||||
import { LegacyExternalInterface } from 'nitro-renderer/src/nitro/externalInterface/LegacyExternalInterface';
|
||||
import { NitroLocalizationEvent } from 'nitro-renderer/src/nitro/localization/NitroLocalizationEvent';
|
||||
import { Nitro } from 'nitro-renderer/src/nitro/Nitro';
|
||||
import { RoomEngineEvent } from 'nitro-renderer/src/nitro/room/events/RoomEngineEvent';
|
||||
import { WebGL } from 'nitro-renderer/src/nitro/utils/WebGL';
|
||||
import { useState } from 'react';
|
||||
import { useConfigurationEvent } from './hooks/events/core/configuration/configuration-event';
|
||||
import { useLocalizationEvent } from './hooks/events/nitro/localization/localization-event';
|
||||
import { dispatchMainEvent, useMainEvent } from './hooks/events/nitro/main-event';
|
||||
import { useRoomEngineEvent } from './hooks/events/nitro/room/room-engine-event';
|
||||
import { LoadingView } from './views/loading/LoadingView';
|
||||
import { MainView } from './views/main/MainView';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.tsx</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
export function App(): JSX.Element
|
||||
{
|
||||
const [ isReady, setIsReady ] = useState(false);
|
||||
const [ isError, setIsError ] = useState(false);
|
||||
const [ message, setMessage ] = useState('Getting Ready');
|
||||
|
||||
//@ts-ignore
|
||||
if(!NitroConfig) throw new Error('NitroConfig is not defined!');
|
||||
|
||||
if(!Nitro.instance) Nitro.bootstrap();
|
||||
|
||||
function getPreloadAssetUrls(): string[]
|
||||
{
|
||||
const urls: string[] = [];
|
||||
|
||||
const assetUrls = Nitro.instance.getConfiguration<string[]>('preload.assets.urls');
|
||||
|
||||
if(assetUrls && assetUrls.length)
|
||||
{
|
||||
for(const url of assetUrls)
|
||||
{
|
||||
urls.push(Nitro.instance.core.configuration.interpolate(url));
|
||||
}
|
||||
}
|
||||
|
||||
return urls;
|
||||
}
|
||||
|
||||
const handler = (event: NitroEvent) =>
|
||||
{
|
||||
switch(event.type)
|
||||
{
|
||||
case ConfigurationEvent.LOADED:
|
||||
Nitro.instance.localization.init();
|
||||
return;
|
||||
case ConfigurationEvent.FAILED:
|
||||
setIsError(true);
|
||||
setMessage('Configuration Failed');
|
||||
return;
|
||||
case Nitro.WEBGL_UNAVAILABLE:
|
||||
setIsError(true);
|
||||
setMessage('WebGL Required');
|
||||
return;
|
||||
case Nitro.WEBGL_CONTEXT_LOST:
|
||||
setIsError(true);
|
||||
setMessage('WebGL Context Lost - Reloading');
|
||||
|
||||
setTimeout(() => window.location.reload(), 1500);
|
||||
return;
|
||||
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING:
|
||||
return;
|
||||
case NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED:
|
||||
setIsError(true);
|
||||
setMessage('Handshake Failed');
|
||||
return;
|
||||
case NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED:
|
||||
setMessage('Finishing Up');
|
||||
|
||||
Nitro.instance.init();
|
||||
return;
|
||||
case NitroCommunicationDemoEvent.CONNECTION_ERROR:
|
||||
setIsError(true);
|
||||
setMessage('Connection Error');
|
||||
return;
|
||||
case NitroCommunicationDemoEvent.CONNECTION_CLOSED:
|
||||
if(Nitro.instance.roomEngine) Nitro.instance.roomEngine.dispose();
|
||||
|
||||
setIsError(true);
|
||||
setMessage('Connection Error');
|
||||
|
||||
LegacyExternalInterface.call('disconnect', -1, 'client.init.handshake.fail');
|
||||
return;
|
||||
case RoomEngineEvent.ENGINE_INITIALIZED:
|
||||
setIsReady(true);
|
||||
return;
|
||||
case NitroLocalizationEvent.LOADED:
|
||||
Nitro.instance.core.asset.downloadAssets(getPreloadAssetUrls(), (status: boolean) =>
|
||||
{
|
||||
if(status)
|
||||
{
|
||||
setMessage('Connecting');
|
||||
|
||||
Nitro.instance.communication.init();
|
||||
}
|
||||
else
|
||||
{
|
||||
setIsError(true);
|
||||
setMessage('Assets Failed');
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
useMainEvent(Nitro.WEBGL_UNAVAILABLE, handler);
|
||||
useMainEvent(Nitro.WEBGL_CONTEXT_LOST, handler);
|
||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKING, handler);
|
||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED, handler);
|
||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, handler);
|
||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_ERROR, handler);
|
||||
useMainEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, handler);
|
||||
useRoomEngineEvent(RoomEngineEvent.ENGINE_INITIALIZED, handler);
|
||||
useLocalizationEvent(NitroLocalizationEvent.LOADED, handler);
|
||||
useConfigurationEvent(ConfigurationEvent.LOADED, handler);
|
||||
useConfigurationEvent(ConfigurationEvent.FAILED, handler);
|
||||
|
||||
if(!WebGL.isWebGLAvailable())
|
||||
{
|
||||
dispatchMainEvent(new NitroEvent(Nitro.WEBGL_UNAVAILABLE));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Nitro.instance.core.configuration.init();
|
||||
|
||||
return (
|
||||
<div>
|
||||
{ (!isReady || isError) && <LoadingView isError={ isError } message={ message } /> }
|
||||
{ (isReady && !isError) && <MainView /> }
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
BIN
src/assets/images/avatareditor/arrow-left-icon.png
Normal file
After Width: | Height: | Size: 198 B |
BIN
src/assets/images/avatareditor/arrow-right-icon.png
Normal file
After Width: | Height: | Size: 192 B |
BIN
src/assets/images/avatareditor/ca-icon.png
Normal file
After Width: | Height: | Size: 171 B |
BIN
src/assets/images/avatareditor/ca-selected-icon.png
Normal file
After Width: | Height: | Size: 242 B |
BIN
src/assets/images/avatareditor/cc-icon.png
Normal file
After Width: | Height: | Size: 281 B |
BIN
src/assets/images/avatareditor/cc-selected-icon.png
Normal file
After Width: | Height: | Size: 265 B |
BIN
src/assets/images/avatareditor/ch-icon.png
Normal file
After Width: | Height: | Size: 154 B |
BIN
src/assets/images/avatareditor/ch-selected-icon.png
Normal file
After Width: | Height: | Size: 171 B |
BIN
src/assets/images/avatareditor/clear-icon.png
Normal file
After Width: | Height: | Size: 263 B |
BIN
src/assets/images/avatareditor/cp-icon.png
Normal file
After Width: | Height: | Size: 234 B |
BIN
src/assets/images/avatareditor/cp-selected-icon.png
Normal file
After Width: | Height: | Size: 199 B |
BIN
src/assets/images/avatareditor/ea-icon.png
Normal file
After Width: | Height: | Size: 155 B |
BIN
src/assets/images/avatareditor/ea-selected-icon.png
Normal file
After Width: | Height: | Size: 227 B |
BIN
src/assets/images/avatareditor/fa-icon.png
Normal file
After Width: | Height: | Size: 140 B |
BIN
src/assets/images/avatareditor/fa-selected-icon.png
Normal file
After Width: | Height: | Size: 195 B |
BIN
src/assets/images/avatareditor/female-icon.png
Normal file
After Width: | Height: | Size: 146 B |
BIN
src/assets/images/avatareditor/female-selected-icon.png
Normal file
After Width: | Height: | Size: 196 B |
BIN
src/assets/images/avatareditor/ha-icon.png
Normal file
After Width: | Height: | Size: 156 B |
BIN
src/assets/images/avatareditor/ha-selected-icon.png
Normal file
After Width: | Height: | Size: 220 B |
BIN
src/assets/images/avatareditor/hc-icon.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
src/assets/images/avatareditor/he-icon.png
Normal file
After Width: | Height: | Size: 173 B |
BIN
src/assets/images/avatareditor/he-selected-icon.png
Normal file
After Width: | Height: | Size: 248 B |
BIN
src/assets/images/avatareditor/hr-icon.png
Normal file
After Width: | Height: | Size: 173 B |
BIN
src/assets/images/avatareditor/hr-selected-icon.png
Normal file
After Width: | Height: | Size: 238 B |
BIN
src/assets/images/avatareditor/lg-icon.png
Normal file
After Width: | Height: | Size: 135 B |
BIN
src/assets/images/avatareditor/lg-selected-icon.png
Normal file
After Width: | Height: | Size: 162 B |
BIN
src/assets/images/avatareditor/loading-icon.png
Normal file
After Width: | Height: | Size: 181 B |
BIN
src/assets/images/avatareditor/male-icon.png
Normal file
After Width: | Height: | Size: 137 B |
BIN
src/assets/images/avatareditor/male-selected-icon.png
Normal file
After Width: | Height: | Size: 195 B |
BIN
src/assets/images/avatareditor/sh-icon.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
src/assets/images/avatareditor/sh-selected-icon.png
Normal file
After Width: | Height: | Size: 165 B |
BIN
src/assets/images/avatareditor/spotlight.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
src/assets/images/avatareditor/wa-icon.png
Normal file
After Width: | Height: | Size: 164 B |
BIN
src/assets/images/avatareditor/wa-selected-icon.png
Normal file
After Width: | Height: | Size: 199 B |
BIN
src/assets/images/camera/base.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
src/assets/images/camera/hud.png
Normal file
After Width: | Height: | Size: 959 B |
BIN
src/assets/images/camera/selected.png
Normal file
After Width: | Height: | Size: 183 B |
BIN
src/assets/images/camera/selector.png
Normal file
After Width: | Height: | Size: 154 B |
BIN
src/assets/images/camera/snap.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
src/assets/images/catalog/hc_big.png
Normal file
After Width: | Height: | Size: 2.5 KiB |
BIN
src/assets/images/catalog/hc_small.png
Normal file
After Width: | Height: | Size: 2.2 KiB |
BIN
src/assets/images/catalog/incognito.png
Normal file
After Width: | Height: | Size: 1.0 KiB |
BIN
src/assets/images/catalog/vip.png
Normal file
After Width: | Height: | Size: 521 B |
BIN
src/assets/images/chat/chatbubbles/bubble_0.png
Normal file
After Width: | Height: | Size: 4.9 KiB |
BIN
src/assets/images/chat/chatbubbles/bubble_0_1_33_34_pointer.png
Normal file
After Width: | Height: | Size: 127 B |
BIN
src/assets/images/chat/chatbubbles/bubble_0_transparent.png
Normal file
After Width: | Height: | Size: 256 B |
BIN
src/assets/images/chat/chatbubbles/bubble_1.png
Normal file
After Width: | Height: | Size: 449 B |
BIN
src/assets/images/chat/chatbubbles/bubble_10.png
Normal file
After Width: | Height: | Size: 778 B |
BIN
src/assets/images/chat/chatbubbles/bubble_10_pointer.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
src/assets/images/chat/chatbubbles/bubble_11.png
Normal file
After Width: | Height: | Size: 242 B |
BIN
src/assets/images/chat/chatbubbles/bubble_11_pointer.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
src/assets/images/chat/chatbubbles/bubble_12.png
Normal file
After Width: | Height: | Size: 242 B |
BIN
src/assets/images/chat/chatbubbles/bubble_12_pointer.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
src/assets/images/chat/chatbubbles/bubble_13.png
Normal file
After Width: | Height: | Size: 397 B |
BIN
src/assets/images/chat/chatbubbles/bubble_13_pointer.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
src/assets/images/chat/chatbubbles/bubble_14.png
Normal file
After Width: | Height: | Size: 234 B |
BIN
src/assets/images/chat/chatbubbles/bubble_14_pointer.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
src/assets/images/chat/chatbubbles/bubble_15.png
Normal file
After Width: | Height: | Size: 247 B |
BIN
src/assets/images/chat/chatbubbles/bubble_15_pointer.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
src/assets/images/chat/chatbubbles/bubble_16.png
Normal file
After Width: | Height: | Size: 716 B |
BIN
src/assets/images/chat/chatbubbles/bubble_16_pointer.png
Normal file
After Width: | Height: | Size: 149 B |
BIN
src/assets/images/chat/chatbubbles/bubble_17.png
Normal file
After Width: | Height: | Size: 806 B |
BIN
src/assets/images/chat/chatbubbles/bubble_17_pointer.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
src/assets/images/chat/chatbubbles/bubble_18.png
Normal file
After Width: | Height: | Size: 247 B |
BIN
src/assets/images/chat/chatbubbles/bubble_18_pointer.png
Normal file
After Width: | Height: | Size: 119 B |
BIN
src/assets/images/chat/chatbubbles/bubble_19.png
Normal file
After Width: | Height: | Size: 688 B |
BIN
src/assets/images/chat/chatbubbles/bubble_19_20_pointer.png
Normal file
After Width: | Height: | Size: 110 B |
BIN
src/assets/images/chat/chatbubbles/bubble_2.png
Normal file
After Width: | Height: | Size: 436 B |
BIN
src/assets/images/chat/chatbubbles/bubble_20.png
Normal file
After Width: | Height: | Size: 417 B |
BIN
src/assets/images/chat/chatbubbles/bubble_21.png
Normal file
After Width: | Height: | Size: 584 B |
BIN
src/assets/images/chat/chatbubbles/bubble_21_pointer.png
Normal file
After Width: | Height: | Size: 109 B |
BIN
src/assets/images/chat/chatbubbles/bubble_22.png
Normal file
After Width: | Height: | Size: 650 B |
BIN
src/assets/images/chat/chatbubbles/bubble_22_pointer.png
Normal file
After Width: | Height: | Size: 109 B |
BIN
src/assets/images/chat/chatbubbles/bubble_23.png
Normal file
After Width: | Height: | Size: 332 B |
BIN
src/assets/images/chat/chatbubbles/bubble_23_37_pointer.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
src/assets/images/chat/chatbubbles/bubble_24.png
Normal file
After Width: | Height: | Size: 380 B |
BIN
src/assets/images/chat/chatbubbles/bubble_24_pointer.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
src/assets/images/chat/chatbubbles/bubble_25.png
Normal file
After Width: | Height: | Size: 280 B |
BIN
src/assets/images/chat/chatbubbles/bubble_25_pointer.png
Normal file
After Width: | Height: | Size: 131 B |
BIN
src/assets/images/chat/chatbubbles/bubble_26.png
Normal file
After Width: | Height: | Size: 557 B |
BIN
src/assets/images/chat/chatbubbles/bubble_26_pointer.png
Normal file
After Width: | Height: | Size: 149 B |
BIN
src/assets/images/chat/chatbubbles/bubble_27.png
Normal file
After Width: | Height: | Size: 632 B |
BIN
src/assets/images/chat/chatbubbles/bubble_27_pointer.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
src/assets/images/chat/chatbubbles/bubble_28.png
Normal file
After Width: | Height: | Size: 758 B |
BIN
src/assets/images/chat/chatbubbles/bubble_28_pointer.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
src/assets/images/chat/chatbubbles/bubble_29.png
Normal file
After Width: | Height: | Size: 476 B |
BIN
src/assets/images/chat/chatbubbles/bubble_29_pointer.png
Normal file
After Width: | Height: | Size: 102 B |
BIN
src/assets/images/chat/chatbubbles/bubble_2_31_pointer.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
src/assets/images/chat/chatbubbles/bubble_3.png
Normal file
After Width: | Height: | Size: 236 B |
BIN
src/assets/images/chat/chatbubbles/bubble_30.png
Normal file
After Width: | Height: | Size: 427 B |
BIN
src/assets/images/chat/chatbubbles/bubble_30_pointer.png
Normal file
After Width: | Height: | Size: 143 B |