diff --git a/electron_wegame/wegame.js b/electron_wegame/wegame.js index 43085be8..17072aa3 100644 --- a/electron_wegame/wegame.js +++ b/electron_wegame/wegame.js @@ -1,5 +1,5 @@ const railsdk = require("./wegame_sdk/railsdk.js"); -const { dialog, remote } = require("electron"); +const { dialog, remote, ipcMain } = require("electron"); function init(isDev) { console.log("Step 1: wegame: init"); @@ -47,6 +47,14 @@ function init(isDev) { function listen() { console.log("wegame: listen"); + ipcMain.handle("profanity-check", async (event, data) => { + const result = railsdk.RailUtils.DirtyWordsFilter(data, true); + if (result.check_result.dirty_type !== 0 /** kRailDirtyWordsTypeNormalAllowWords */) { + return result.check_result; + } + + return data; + }); } module.exports = { init, listen }; diff --git a/res/logo_wegame.png b/res/logo_wegame.png index eb7d35fe..ac9092b3 100644 Binary files a/res/logo_wegame.png and b/res/logo_wegame.png differ diff --git a/res/ui/wegame_isbn_rating.jpg b/res/ui/wegame_isbn_rating.jpg new file mode 100644 index 00000000..581dd744 Binary files /dev/null and b/res/ui/wegame_isbn_rating.jpg differ diff --git a/src/css/main.scss b/src/css/main.scss index 1bd82828..7419a5df 100644 --- a/src/css/main.scss +++ b/src/css/main.scss @@ -21,6 +21,7 @@ @import "adinplay"; @import "changelog_skins"; +@import "states/wegame_splash"; @import "states/preload"; @import "states/main_menu"; @import "states/ingame"; diff --git a/src/css/states/main_menu.scss b/src/css/states/main_menu.scss index 2b44b56e..9a04baf4 100644 --- a/src/css/states/main_menu.scss +++ b/src/css/states/main_menu.scss @@ -565,6 +565,40 @@ grid-template-columns: auto 1fr; } + &.wegameDisclaimer { + @include SuperSmallText; + display: grid; + justify-content: center; + grid-template-columns: 1fr auto 1fr; + + > .disclaimer { + grid-column: 2 / 3; + + @include DarkThemeOverride { + color: #fff; + } + } + + > .rating { + grid-column: 3 / 4; + justify-self: end; + align-self: end; + + @include S(width, 32px); + @include S(height, 40px); + background: green; + cursor: pointer !important; + pointer-events: all; + @include S(border-radius, 4px); + overflow: hidden; + + & { + /* @load-async */ + background: #fff uiResource("wegame_isbn_rating.jpg") center center / contain no-repeat; + } + } + } + .author { flex-grow: 1; text-align: right; diff --git a/src/css/states/wegame_splash.scss b/src/css/states/wegame_splash.scss new file mode 100644 index 00000000..961cfa67 --- /dev/null +++ b/src/css/states/wegame_splash.scss @@ -0,0 +1,38 @@ +#state_WegameSplashState { + background: #000 !important; + display: flex; + align-items: center; + justify-content: center; + + .wrapper { + opacity: 0; + @include InlineAnimation(5.9s ease-in-out) { + 0% { + opacity: 0; + } + 20% { + opacity: 1; + } + 90% { + opacity: 1; + } + 100% { + opacity: 0; + } + } + + text-align: center; + color: #fff; + @include Heading; + + strong { + display: block; + @include SuperHeading; + @include S(margin-bottom, 20px); + } + + div { + @include S(margin-bottom, 10px); + } + } +} diff --git a/src/js/application.js b/src/js/application.js index 4e74b014..c49b7027 100644 --- a/src/js/application.js +++ b/src/js/application.js @@ -34,6 +34,7 @@ import { RestrictionManager } from "./core/restriction_manager"; import { PuzzleMenuState } from "./states/puzzle_menu"; import { ClientAPI } from "./platform/api"; import { LoginState } from "./states/login"; +import { WegameSplashState } from "./states/wegame_splash"; /** * @typedef {import("./platform/achievement_provider").AchievementProviderInterface} AchievementProviderInterface @@ -155,6 +156,7 @@ export class Application { registerStates() { /** @type {Array} */ const states = [ + WegameSplashState, PreloadState, MobileWarningState, MainMenuState, @@ -330,8 +332,12 @@ export class Application { Loader.linkAppAfterBoot(this); + if (G_WEGAME_VERSION) { + this.stateMgr.moveToState("WegameSplashState"); + } + // Check for mobile - if (IS_MOBILE) { + else if (IS_MOBILE) { this.stateMgr.moveToState("MobileWarningState"); } else { this.stateMgr.moveToState("PreloadState"); diff --git a/src/js/changelog.js b/src/js/changelog.js index 9b497ff8..1ea3c2a7 100644 --- a/src/js/changelog.js +++ b/src/js/changelog.js @@ -1,4 +1,15 @@ export const CHANGELOG = [ + { + version: "1.4.3", + date: "unreleased", + entries: [ + "Edit signal dialog now has the previous signal filled (Thanks to EmeraldBlock)", + "Further performance improvements (Thanks to PFedak)", + "Improved puzzle validation (Thanks to Sense101)", + "Input fields in dialogs should now automatically focus", + "Updated translations", + ], + }, { version: "1.4.2", date: "24.06.2021", diff --git a/src/js/core/modal_dialog_forms.js b/src/js/core/modal_dialog_forms.js index 355fad09..ccf9bfb2 100644 --- a/src/js/core/modal_dialog_forms.js +++ b/src/js/core/modal_dialog_forms.js @@ -1,6 +1,7 @@ import { BaseItem } from "../game/base_item"; import { ClickDetector } from "./click_detector"; import { Signal } from "./signal"; +import { getIPCRenderer } from "./utils"; /* * *************************************************** @@ -107,6 +108,19 @@ export class FormElementInput extends FormElement { updateErrorState() { this.element.classList.toggle("errored", !this.isValid()); + + // profanity filter + if (G_WEGAME_VERSION) { + const value = String(this.element.value); + + getIPCRenderer() + .invoke("profanity-check", value) + .then(newValue => { + if (value !== newValue && this.element) { + this.element.value = newValue; + } + }); + } } isValid() { diff --git a/src/js/platform/browser/game_analytics.js b/src/js/platform/browser/game_analytics.js index 80e19c7a..9411b258 100644 --- a/src/js/platform/browser/game_analytics.js +++ b/src/js/platform/browser/game_analytics.js @@ -111,6 +111,10 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface { * @returns {Promise} */ sendToApi(endpoint, data) { + if (G_WEGAME_VERSION) { + return Promise.resolve(); + } + return new Promise((resolve, reject) => { const timeout = setTimeout(() => reject("Request to " + endpoint + " timed out"), 20000); diff --git a/src/js/states/main_menu.js b/src/js/states/main_menu.js index 5885b2ce..279699d2 100644 --- a/src/js/states/main_menu.js +++ b/src/js/states/main_menu.js @@ -130,7 +130,17 @@ export class MainMenuState extends GameState { ${ G_WEGAME_VERSION - ? "" + ? ` + ` : `