Compare commits

..

No commits in common. "5ce6dc6d3e5adf46765f239f319b4224a7ef9693" and "98733d1ad524038c4a0e6a6dfd48946acb176d64" have entirely different histories.

View File

@ -17,7 +17,7 @@ var ui_HadHighlight = false;
var ui_status_height = 25;
var ui_StatusText = "";
var ui_HighlightArray = [];
var translator = new Language("en");
var translator = new Language('en');
//The user interface mode. 0=network, 1=network information, 2=puzzle-selection menu
var uiMode=1;
@ -191,8 +191,7 @@ function PrintScreen(WhatPassedIn=-1)
else if(what == 1) //PuzzleDescription/Info
{
//Display the text about the puzzle
console.log("Using language: " + ui_language);
textMenuPrint(eval('puzzle.' + ui_language + '_message'));
textMenuPrint(puzzle.en_message);
}
else if(what == 2) //PuzzleSelect
{
@ -688,22 +687,23 @@ function makeLine(x1, y1, x2, y2, offsetx = 0, offsety = 0) {
}
//Make a structure to hold all our data
class actionStruct {
constructor(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
this.shapeText= shapeText
this.shapePoints= structuredClone(shapePoints)
this.shapePoints.shapeText = shapeText;
this.theObject= theObject
this.funcLeftClick= funcLeftClick
this.funcRightClick= funcRightClick
this.funcMouseover= funcMouseover
function actionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
var struct = {
shapeText: shapeText,
shapePoints: structuredClone(shapePoints),
theObject: theObject,
funcLeftClick: funcLeftClick,
funcRightClick: funcRightClick,
funcMouseover: funcMouseover,
}
//if (shapeText == "line") console.log("Creating a line: " + JSON.stringify(struct));
shapePoints.shapeText = shapeText;
return struct;
}
function registerActionStruct(shapeText, shapePoints, theObject=null, funcLeftClick=null, funcRightClick=null, funcMouseover=null) {
//Make an object with all the data
var what = new actionStruct(shapeText, shapePoints, theObject, funcLeftClick, funcRightClick, funcMouseover);
var what = actionStruct(shapeText, shapePoints, theObject, funcLeftClick, funcRightClick, funcMouseover);
//console.log("Pushing an action: " + shapeText);
//Push it onto the uiActions list
uiActions.unshift(what); //Put it at the beginning of the list
@ -890,18 +890,17 @@ function device_clickOn(point, actionrec) {
}
}
function Language(lang = null) {
function Language(lang) {
var __construct = function () {
if (lang == null) {
if (eval('typeof ' + lang) == 'undefined') {
lang = "en";
}
//console.log("Defining language:" + lang);
ui_language = lang;
ui_language = 'language.' + lang;
return;
}()
this.getStr = function (str, defaultStr) {
var toget = 'language.' + ui_language + "." + str + ".value";
var toget = ui_language + "." + str + ".value";
//console.log("Translating: " + toget);
var retStr = eval(toget);
if (typeof retStr != 'undefined') {