Skip to content

Commit

Permalink
Watch replay online
Browse files Browse the repository at this point in the history
  • Loading branch information
UNIDY2002 committed Apr 27, 2022
1 parent 975d4ed commit 02c8b9b
Show file tree
Hide file tree
Showing 42 changed files with 11,918 additions and 30,386 deletions.
43 changes: 43 additions & 0 deletions Assets/Plugins/Saiblo.jslib
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
mergeInto(LibraryManager.library, {
GetReplayLength: function () {
return getReplayLength();
},
GetReplayData: function (index) {
return getReplayData(index);
},
GetMapByte: function (name, index) {
return getMapByte(UTF8ToString(name), index);
},
GetToken: function () {
const token = getToken();
const bufferSize = lengthBytesUTF8(token) + 1;
const buffer = _malloc(bufferSize);
stringToUTF8(token, buffer, bufferSize);
return buffer;
},
ConnectSaiblo: function (tokenDecoded, tokenEncoded) {
const websocket = new WebSocket("wss://" + UTF8ToString(tokenDecoded));
websocket.onopen = function (event) {
console.log("judger connected");
websocket.send(JSON.stringify({
token: UTF8ToString(tokenEncoded),
request: "connect",
}))
};
bindWebsocket(websocket, UTF8ToString(tokenEncoded));
},
SendWsMessage: function (message) {
sendWebsocketMessage(UTF8ToString(message));
},
GetPlayers: function () {
const players = getPlayers();
const playersText = players === undefined ? "" : players[1] + " v.s. " + players[0];
const bufferSize = lengthBytesUTF8(playersText) + 1;
const buffer = _malloc(bufferSize);
stringToUTF8(playersText, buffer, bufferSize);
return buffer;
},
JsAlert: function (message) {
window.alert(UTF8ToString(message));
},
});
32 changes: 32 additions & 0 deletions Assets/Plugins/Saiblo.jslib.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

222 changes: 0 additions & 222 deletions Assets/Prefabs/Item.prefab

This file was deleted.

1 change: 1 addition & 0 deletions Assets/Prefabs/UI/M_Background_03.mat
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,4 @@ Material:
- _Color: {r: 0.1, g: 0.1, b: 0.8, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _node_451: {r: 0, g: 0.75999975, b: 1, a: 1}
m_BuildTextureStacks: []
Loading

0 comments on commit 02c8b9b

Please sign in to comment.