Skip to content

Commit

Permalink
Merge pull request #5 from Furnyr/version/1.1.1
Browse files Browse the repository at this point in the history
Release version npm(1.1.1) unity(1.1.0)
  • Loading branch information
Furnyr authored Apr 14, 2024
2 parents eed5cff + 6c3265e commit ed73a02
Show file tree
Hide file tree
Showing 18 changed files with 160 additions and 1,802 deletions.
28 changes: 24 additions & 4 deletions bridge/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ import type { MessageData, DiscordSDKEvents, MessageChildCommand } from "../npm/


// SDKBrige, { event: data } Child(JSlib => C#)
// IFrameBrige, ... Child(JSlib) => Parent
// IFrameBridge, ... Child(JSlib) => Parent

declare const unityInstance: { SendMessage: (gameObject: string, method: string, value: any) => void };
declare const _IFrameBrige: (data: MessageData) => void;
declare const _IFrameBridge: (data: MessageData) => void;
declare const UTF8ToString: (str: any) => string;

var BridgeLibrary = {
// Must be called inside Unity
InitializeIFrameBridge: function (): void {
window.addEventListener("message", _IFrameBrige);
window.addEventListener("message", _IFrameBridge);
},

// Must be IMPORTED inside Unity
IFrameBrige: function ({ data: messageData }: MessageEvent<MessageData>) {
IFrameBridge: function ({ data: messageData }: MessageEvent<MessageData>) {

switch (messageData.command as MessageChildCommand) {
case "DISPATCH": {
Expand Down Expand Up @@ -190,6 +190,14 @@ var BridgeLibrary = {
break;
}

case "SET_CONFIG": {

// SDK Bridge
unityInstance.SendMessage("DiscordBridge", "ReceiveSetConfig", JSON.stringify(messageData.data));

break;
}

case "LOADED": {

// SDK Bridge
Expand Down Expand Up @@ -464,6 +472,18 @@ var BridgeLibrary = {
});
},

RequestSetConfig: function (useInteractivePip: string) {

useInteractivePip = UTF8ToString(useInteractivePip);

window.parent.postMessage({
command: "SET_CONFIG",
args: {
use_interactive_pip: (useInteractivePip == "True")
}
});
},

PingLoad: function () {

window.parent.postMessage({
Expand Down
25 changes: 4 additions & 21 deletions examples/node_project/package-lock.json

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

3 changes: 1 addition & 2 deletions examples/node_project/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
"dependencies": {
"@colyseus/schema": "^2.0.30",
"@colyseus/ws-transport": "^0.15.1",
"@discord/embedded-app-sdk": "^1.0.0",
"colyseus": "^0.15.15",
"cross-fetch": "^3.1.5",
"dissonity": "^1.0.0",
"dissonity": "^1.1.1",
"dotenv": "^16.0.3",
"esbuild": "0.17.11",
"express": "^4.18.2"
Expand Down
33 changes: 8 additions & 25 deletions examples/node_project/src/_pnpm/pnpm-lock.yaml

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

11 changes: 0 additions & 11 deletions npm/.changeset/config.json

This file was deleted.

12 changes: 12 additions & 0 deletions npm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.1.1 - 2024-04-14

### Fixed

- Version match check

## 1.1.0 - 2024-04-14

### Added

- Support for setConfig

## 1.0.0 - 2024-04-12 (first release)
3 changes: 1 addition & 2 deletions npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dissonity",
"version": "1.0.0",
"version": "1.1.1",
"description": "Extension of the Discord Embedded App SDK that allows you to create activities alongside the Dissonity Unity package",
"main": "dist/index.js",
"module": "dist/index.mjs",
Expand All @@ -27,7 +27,6 @@
"@discord/embedded-app-sdk": "1.0.0"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@types/node": "^20.12.5",
"tsup": "^8.0.2",
"typescript": "^5.4.4"
Expand Down
Loading

0 comments on commit ed73a02

Please sign in to comment.