Wegame adjustments

This commit is contained in:
tobspr 2021-08-04 13:44:02 +02:00
parent 354bb63b0a
commit eb628526c9
12 changed files with 177 additions and 3 deletions

View File

@ -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 };

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

View File

@ -21,6 +21,7 @@
@import "adinplay";
@import "changelog_skins";
@import "states/wegame_splash";
@import "states/preload";
@import "states/main_menu";
@import "states/ingame";

View File

@ -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;

View File

@ -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);
}
}
}

View File

@ -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<typeof GameState>} */
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");

View File

@ -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",

View File

@ -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() {

View File

@ -111,6 +111,10 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
* @returns {Promise<any>}
*/
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);

View File

@ -130,7 +130,17 @@ export class MainMenuState extends GameState {
${
G_WEGAME_VERSION
? "<div class='footer wegame'></div>"
? `<div class='footer wegameDisclaimer'>
<div class="disclaimer">
健康游戏忠告
<br>
抵制不良游戏,拒绝盗版游戏注意自我保护,谨防受骗上当<br>
适度游戏益脑,沉迷游戏伤身合理安排时间,享受健康生活
</div>
<div class="rating"></div>
</div>
`
: `
<div class="footer ${G_CHINA_VERSION ? "china" : ""} ">
@ -341,6 +351,11 @@ export class MainMenuState extends GameState {
if (puzzleWishlistButton) {
this.trackClicks(puzzleWishlistButton, () => this.onPuzzleWishlistButtonClicked());
}
const wegameRating = qs(".wegameDisclaimer > .rating");
if (wegameRating) {
this.trackClicks(wegameRating, () => this.onWegameRatingClicked());
}
}
renderMainMenu() {
@ -675,6 +690,22 @@ export class MainMenuState extends GameState {
});
}
onWegameRatingClicked() {
this.dialogs.showInfo(
"",
`
1本游戏是一款休闲建造类单机游戏适用于年满8周岁及以上的用户<br>
2本游戏模拟简单的生产流水线剧情简单且积极向上没有基于真实
历史和现实事件的改编内容游戏玩法为摆放简单的部件完成生产目标
游戏为单机作品没有基于文字和语音的陌生人社交系统<br>
3游戏中有用户实名认证系统认证为未成年人的用户将接受以下管理
游戏为买断制不存在后续充值付费内容未成年人用户每日22点到次日
8点不得使用法定节假日每天不得使用超过3小时其它时间每天使用游
戏不得超过1.5小时
`
);
}
onContinueButtonClicked() {
let latestLastUpdate = 0;
let latestInternalId;

View File

@ -0,0 +1,27 @@
import { GameState } from "../core/game_state";
export class WegameSplashState extends GameState {
constructor() {
super("WegameSplashState");
}
getInnerHTML() {
return `
<div class="wrapper">
<strong>健康游戏忠告</strong>
<div>抵制不良游戏,拒绝盗版游戏</div>
<div>注意自我保护,谨防受骗上当</div>
<div>适度游戏益脑,沉迷游戏伤身</div>
<div>适度游戏益脑,沉迷游戏伤身</div>
</div>
`;
}
onEnter() {
setTimeout(
() => {
this.app.stateMgr.moveToState("PreloadState");
},
G_IS_DEV ? 1 : 6000
);
}
}