summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLawnCable <lawncable.tmw2@simonlaux.de>2018-09-26 19:07:54 +0200
committerLawnCable <lawncable.tmw2@simonlaux.de>2018-09-26 19:07:54 +0200
commit250414f683db01f37194eb04070093b56e2ea67c (patch)
tree5a7e4bb2c9120300b8d9dd84426f5b09ce9f6416
parente8acae284d9c5030522e97319244b8a0941d7c61 (diff)
downloadelectron-250414f683db01f37194eb04070093b56e2ea67c.tar.gz
electron-250414f683db01f37194eb04070093b56e2ea67c.tar.bz2
electron-250414f683db01f37194eb04070093b56e2ea67c.tar.xz
electron-250414f683db01f37194eb04070093b56e2ea67c.zip
added possibility to start manaplus without any server preselected
-rw-r--r--assets/media/server/noServer/LICENCE_NOTICE2
-rw-r--r--assets/media/server/noServer/background1.pngbin0 -> 118889 bytes
-rw-r--r--assets/media/server/noServer/icon.svg89
-rw-r--r--package.json2
-rw-r--r--src/main/manaplus/manaplus.ts4
-rw-r--r--src/renderer/gameserver/data.ts24
-rw-r--r--src/renderer/gameserver/server.ts267
7 files changed, 251 insertions, 137 deletions
diff --git a/assets/media/server/noServer/LICENCE_NOTICE b/assets/media/server/noServer/LICENCE_NOTICE
new file mode 100644
index 0000000..0bf5ae8
--- /dev/null
+++ b/assets/media/server/noServer/LICENCE_NOTICE
@@ -0,0 +1,2 @@
+All things in this folder belong to ManaPlus
+see https://gitlab.com/manaplus/manaplus/#5-licenses \ No newline at end of file
diff --git a/assets/media/server/noServer/background1.png b/assets/media/server/noServer/background1.png
new file mode 100644
index 0000000..05420f9
--- /dev/null
+++ b/assets/media/server/noServer/background1.png
Binary files differ
diff --git a/assets/media/server/noServer/icon.svg b/assets/media/server/noServer/icon.svg
new file mode 100644
index 0000000..ea95640
--- /dev/null
+++ b/assets/media/server/noServer/icon.svg
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="256"
+ height="256"
+ id="svg3012"
+ version="1.1"
+ inkscape:version="0.48.3.1 r9886"
+ sodipodi:docname="manaplus-icon.svg">
+ <defs
+ id="defs3014" />
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.375"
+ inkscape:cx="-6.4966419"
+ inkscape:cy="130.6424"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:document-units="px"
+ inkscape:grid-bbox="true"
+ inkscape:window-width="1680"
+ inkscape:window-height="991"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1" />
+ <metadata
+ id="metadata3017">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ id="layer1"
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ transform="translate(0,192)">
+ <path
+ d="m 114.40989,-116.42156 c 4.88098,1.3e-4 9.6559,0.53069 14.32477,1.59166 4.77492,1.06121 8.86005,3.07728 12.25569,6.04826 l 0.15919,0 c 0.84878,0.74289 1.69767,1.11426 2.54666,1.11414 1.06089,1.2e-4 2.28119,-0.42429 3.66079,-1.2733 1.37928,-0.9549 3.23624,-1.96292 5.57067,-3.02413 2.33433,-1.16709 5.30542,-2.17513 8.91318,-3.02412 3.71382,-0.95487 8.43561,-1.43238 14.16569,-1.43251 6.79086,1.3e-4 12.57386,0.84901 17.34889,2.54668 4.77482,1.69785 8.5948,4.08529 11.45994,7.16239 2.97089,3.07726 5.0931,6.897236 6.36664,11.459856 1.37917,4.456682 2.06887,9.443816 2.06897,14.961461 -1e-4,4.138354 -0.31838,8.594935 -0.95494,13.369806 l -6.36664,45.839401 c -0.10627,0.848895 -0.53071,1.85694 -1.27322,3.024125 -0.74304,1.061105 -1.59192,2.122211 -2.54665,3.183275 -0.95516,1.061127 -1.96323,1.96304 -3.02413,2.705835 -0.95515,0.742764 -1.75101,1.114135 -2.38756,1.114135 l -22.91968,0 c -0.42455,0 -0.63677,-0.212253 -0.63666,-0.636663 l 0,-0.477472 c 0.31817,-2.440543 0.74272,-5.411597 1.27333,-8.913235 0.53039,-3.607718 1.061,-7.427667 1.5916,-11.459837 0.5305,-4.13825 1.11414,-8.329591 1.75091,-12.574025 0.63655,-4.35047 1.16705,-8.48872 1.5916,-12.414822 0.42434,-4.032128 0.79565,-7.745945 1.11414,-11.141526 0.31817,-3.395433 0.47736,-6.207358 0.47747,-8.435722 -1.1e-4,-4.66876 -0.47758,-8.488667 -1.43242,-11.459858 -0.84899,-3.077091 -1.96323,-5.464528 -3.34251,-7.162398 -1.37949,-1.80377 -2.91806,-3.02402 -4.61573,-3.66077 -1.59171,-0.742656 -3.13039,-1.114056 -4.61573,-1.114136 -2.01626,8e-5 -3.76706,0.37148 -5.25239,1.114136 -1.48576,0.63675 -2.38768,1.27341 -2.70585,1.90996 -1.06121,1.91007 -2.01615,4.0853 -2.86493,6.525746 -0.84899,2.440586 -1.64485,5.040311 -2.38746,7.799059 -0.63677,2.758917 -1.22041,5.517792 -1.75091,8.276583 -0.5306,2.758896 -0.95505,5.411629 -1.27322,7.958209 l -6.36663,45.839401 c -0.10627,0.848895 -0.53061,1.85694 -1.27333,3.024125 -0.74283,1.061105 -1.59171,2.122211 -2.54655,3.183275 -0.95515,1.061127 -1.96323,1.96304 -3.02423,2.705835 -0.95505,0.742764 -1.7509,1.114135 -2.38746,1.114135 l -22.91968,0 c -0.42444,0 -0.63666,-0.265377 -0.63666,-0.795845 l 0,-0.31829 c 0.31828,-2.440543 0.74272,-5.411597 1.27333,-8.913235 0.5305,-3.607718 1.0611,-7.427667 1.59171,-11.459837 0.63656,-4.13825 1.22009,-8.329591 1.7508,-12.574025 0.63656,-4.35047 1.16706,-8.48872 1.5916,-12.414822 0.5305,-4.032128 0.90181,-7.745945 1.11414,-11.141526 0.31828,-3.395433 0.47747,-6.207358 0.47747,-8.435722 0,-4.66876 -0.47758,-8.488667 -1.43241,-11.459858 -0.84899,-3.077091 -1.96313,-5.464528 -3.34251,-7.162398 -1.37949,-1.80377 -2.91807,-3.02402 -4.61573,-3.66077 -1.59172,-0.742656 -3.13029,-1.114056 -4.61584,-1.114136 -1.90999,8e-5 -3.60776,0.37148 -5.0932,1.114136 -1.48555,0.63675 -2.4406,1.27341 -2.86494,1.90996 -1.06121,1.91007 -2.06929,4.0853 -3.02412,6.525746 -0.84899,2.440586 -1.64485,5.040311 -2.387466,7.799059 -0.636769,2.758917 -1.220404,5.517792 -1.750904,8.276583 -0.424442,2.758896 -0.795856,5.411629 -1.114134,7.958209 l -6.207337,45.839401 c -0.106375,0.848895 -0.583741,1.85694 -1.43252,3.024125 -0.742826,1.061105 -1.591711,2.122211 -2.546653,3.183275 -0.955048,1.061127 -1.96302,1.96304 -3.024126,2.705835 -0.955048,0.742764 -1.750798,1.114135 -2.387461,1.114135 l -22.760482,0 c -0.530606,0 -0.795856,-0.371371 -0.795856,-1.114135 l 12.573972,-91.678779 c 0.106163,-0.84881 0.5305,-1.85684 1.273327,-3.02416 0.742721,-1.16708 1.591606,-2.2282 2.546654,-3.18328 0.954942,-1.06098 1.909885,-1.9629 2.864933,-2.70579 1.061106,-0.74266 1.90999,-1.11406 2.546654,-1.11414 l 3.183317,0 10.345702,0 c 2.016049,8e-5 3.55452,0.15914 4.615731,0.47746 1.061,0.21225 2.016049,0.31845 2.864933,0.31834 0.636664,1.1e-4 1.167166,-0.10609 1.591716,-0.31834 6.1542,-2.01595 12.78609,-3.02401 19.89555,-3.02414 l 0.15908,0"
+ id="text2395"
+ style="font-size:66.33274078px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-align:start;line-height:125%;writing-mode:lr-tb;text-anchor:start;fill:#ff6600;fill-opacity:1;stroke:none;font-family:Beroga;-inkscape-font-specification:Beroga"
+ sodipodi:nodetypes="ccccscccssccsccsssccccsssssscccscsscsccsssccccsccccscccscccccccsssccccscsccccsccc"
+ inkscape:connector-curvature="0"
+ inkscape:export-filename="/home/dan/evolonline/manaplus-android/project/res/drawable/publisherlogo.png"
+ inkscape:export-xdpi="89"
+ inkscape:export-ydpi="89" />
+ <path
+ style="fill:#ff6600;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:8;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
+ d="m 131.2755,-191.94644 c -2.07583,0.0657 -4.13424,0.17245 -6.13624,0.36097 C 56.070406,-185.08419 -22.330365,-94.238284 14.144843,-12.911642 55.793642,79.950253 171.22442,83.234948 231.35083,26.252226 284.3121,-23.939864 217.7355,-58.353273 184.4265,12.265118 155.45055,73.696743 34.181626,66.476692 27.409986,-32.493581 18.800927,-158.32019 146.26398,-217.64547 223.04885,-156.4824 c -22.0316,-23.72166 -60.63525,-36.45264 -91.77335,-35.46404 z m 99.35352,172.898511 c 4.41323,-0.282965 8.07962,1.068258 10.19686,4.15101 4.83989,7.0462706 -0.32894,20.5961428 -11.55047,30.23017 -11.22173,9.63408 -24.2173,11.738746 -29.05708,4.692454 -4.83978,-7.04626 0.32905,-20.59613226 11.55058,-30.230191 6.31223,-5.41914 13.1857,-8.479476 18.86011,-8.843443 z"
+ id="path2406"
+ inkscape:connector-curvature="0"
+ inkscape:export-filename="/home/dan/evolonline/manaplus-android/project/res/drawable/publisherlogo.png"
+ inkscape:export-xdpi="89"
+ inkscape:export-ydpi="89" />
+ <g
+ id="g3760"
+ transform="matrix(-0.22563454,0.78651078,-0.78651078,-0.22563454,180.07086,-336.7049)"
+ style="stroke:#ff6600;stroke-width:16;stroke-linecap:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none">
+ <path
+ inkscape:connector-curvature="0"
+ id="path2984"
+ d="m 192.91312,-119.95914 56.93945,0"
+ style="fill:none;stroke:#ff6600;stroke-width:16;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
+ <path
+ style="fill:none;stroke:#ff6600;stroke-width:16;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
+ d="m 221.38285,-148.42886 0,56.939445"
+ id="path2986"
+ inkscape:connector-curvature="0" />
+ </g>
+ </g>
+</svg>
diff --git a/package.json b/package.json
index f619a5c..10047a3 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mana-launcher",
- "version": "1.0.0",
+ "version": "1.0.1",
"private": true,
"homepage": "https://tmw2.org",
"description": "A launcher for manaplus.",
diff --git a/src/main/manaplus/manaplus.ts b/src/main/manaplus/manaplus.ts
index 2f028b8..0c56b7d 100644
--- a/src/main/manaplus/manaplus.ts
+++ b/src/main/manaplus/manaplus.ts
@@ -109,7 +109,7 @@ function wasInitilized(){
async function makeParams(server: any,port: any,engine: any,username?: any,password?: any):Promise<string[]>{
let parameters:string[] = [];
- if(server && engine && port){
+ if(server && engine && port && server != 'noServer'){
parameters.push(...[
"-s", server,
"-y", engine,
@@ -134,7 +134,7 @@ async function makeParams(server: any,port: any,engine: any,username?: any,passw
"-L", localDataDir,
"--screenshot-dir", screenshotsDir,
]);
- //console.log(parameters);
+ console.log(parameters);
return parameters;
}
diff --git a/src/renderer/gameserver/data.ts b/src/renderer/gameserver/data.ts
index eb0f74f..e86c95b 100644
--- a/src/renderer/gameserver/data.ts
+++ b/src/renderer/gameserver/data.ts
@@ -75,8 +75,30 @@ const TMW = new GameServer(
{parser:OnlineListParser.TMW, url:"https://server.themanaworld.org/"}
);
+const noServer = new GameServer(
+ new GameServerProfile(
+ 'noServer',
+ 6901,
+ "tmwAthena"
+ ),
+ "Mana Plus",
+ "Open Mana Plus",
+ "Opens the ManaPlus client",
+ 'http://manaplus.org/changelog',
+ undefined,
+ [{isVideo:false,file:"noServer/background1.png"}],
+ "noServer/icon.svg",
+ [
+ new socialLink("fas fa-home","Website","http://manaplus.org/"),
+ new socialLink("fab fa-gitlab","Gitlab","https://gitlab.com/manaplus/manaplus/"),
+ ],
+ undefined,
+ null
+);
+
export const GameServers = [
TMW2,
Evol,
- TMW
+ TMW,
+ noServer,
]
diff --git a/src/renderer/gameserver/server.ts b/src/renderer/gameserver/server.ts
index 4c54235..654eaac 100644
--- a/src/renderer/gameserver/server.ts
+++ b/src/renderer/gameserver/server.ts
@@ -6,20 +6,20 @@ import { makeOnlineCounterList, OnlineListParser } from './onlineCount';
export default class GameServer {
constructor(
- public profile:GameServerProfile,
- public menuName:string,
- public name:string,
- public shortDescription:string,// the server in 1-2 sentences
- public newsPageUrl:string,
- public newsLatestPage:{url:string,type:NewsType},
- public backgrounds:{isVideo:boolean,file:string}[],
- public icon:string,
- public socialLinks:socialLink[],
- public TOSLink:string,
- public OnlineList:{parser:OnlineListParser,url:string},
- ){}
-
- getMenuEntry():HTMLElement{
+ public profile: GameServerProfile,
+ public menuName: string,
+ public name: string,
+ public shortDescription: string,// the server in 1-2 sentences
+ public newsPageUrl: string,
+ public newsLatestPage: { url: string, type: NewsType },
+ public backgrounds: { isVideo: boolean, file: string }[],
+ public icon: string,
+ public socialLinks: socialLink[],
+ public TOSLink: string,
+ public OnlineList: { parser: OnlineListParser, url: string },
+ ) { }
+
+ getMenuEntry(): HTMLElement {
const sidebarItem = document.createElement('div');
sidebarItem.classList.add("sidebarItem");
//Online counter
@@ -42,44 +42,45 @@ export default class GameServer {
title.appendChild(titleText);
- title.addEventListener('click', ()=>{
- switchPage("SERVER",this.name);
+ title.addEventListener('click', () => {
+ switchPage("SERVER", this.name);
});
-
- let onlineBoxActive:boolean = false;
- let onlineBoxSchouldBeActive:boolean = false;
- let updateOnlineContainer = async () => {
- if(onlineBoxSchouldBeActive == onlineBoxActive)return;
- onlineBoxActive = onlineBoxSchouldBeActive;
- while (OnlineCounterContainer.firstChild) {
+ if (this.profile.address != 'noServer') {
+ let onlineBoxActive: boolean = false;
+ let onlineBoxSchouldBeActive: boolean = false;
+ let updateOnlineContainer = async () => {
+ if (onlineBoxSchouldBeActive == onlineBoxActive) return;
+ onlineBoxActive = onlineBoxSchouldBeActive;
+ while (OnlineCounterContainer.firstChild) {
OnlineCounterContainer.removeChild(OnlineCounterContainer.firstChild);
+ }
+ if (onlineBoxSchouldBeActive) {
+ OnlineCounterContainer.appendChild(await makeOnlineCounterList(this));
+ }
+ console.log(onlineBoxSchouldBeActive);
}
- if(onlineBoxSchouldBeActive){
- OnlineCounterContainer.appendChild(await makeOnlineCounterList(this));
- }
- console.log(onlineBoxSchouldBeActive);
- }
- let SetUpdate = (state:boolean)=>{
- onlineBoxSchouldBeActive = state;
- setTimeout(()=>{updateOnlineContainer();},160);
- };
+ let SetUpdate = (state: boolean) => {
+ onlineBoxSchouldBeActive = state;
+ setTimeout(() => { updateOnlineContainer(); }, 160);
+ };
- title.addEventListener("mouseover", ()=>{
- SetUpdate(true);
- });
+ title.addEventListener("mouseover", () => {
+ SetUpdate(true);
+ });
- title.addEventListener("mouseout", ()=>{
- SetUpdate(false);
- });
+ title.addEventListener("mouseout", () => {
+ SetUpdate(false);
+ });
- OnlineCounterContainer.addEventListener("mouseover", ()=>{
- SetUpdate(true);
- });
+ OnlineCounterContainer.addEventListener("mouseover", () => {
+ SetUpdate(true);
+ });
- OnlineCounterContainer.addEventListener("mouseout", ()=>{
- SetUpdate(false);
- });
+ OnlineCounterContainer.addEventListener("mouseout", () => {
+ SetUpdate(false);
+ });
+ }
sidebarItem.appendChild(title);
@@ -91,14 +92,14 @@ export default class GameServer {
info.innerHTML = '<i class="fas fa-info fa-fw"></i>Information';
container.appendChild(info);
- info.addEventListener('click', ()=>{
- switchPage("SERVER",this.name);
+ info.addEventListener('click', () => {
+ switchPage("SERVER", this.name);
});
const news = document.createElement('div');
news.innerHTML = '<i class="far fa-newspaper fa-fw"></i>News <i class="fas fa-external-link-alt" data-fa-transform="shrink-2"></i>';
- if(this.newsPageUrl && this.newsPageUrl!==null){
- news.addEventListener('click', ()=>{
+ if (this.newsPageUrl && this.newsPageUrl !== null) {
+ news.addEventListener('click', () => {
shell.openExternal(this.newsPageUrl);
});
} else {
@@ -111,35 +112,35 @@ export default class GameServer {
screenshots.innerHTML = '<i class="fas fa-camera fa-fw"></i>Screenshots';
container.appendChild(screenshots);
- screenshots.addEventListener('click', ()=>{
+ screenshots.addEventListener('click', () => {
switchPage("SERVER", this.name, "SCREENSHOTS");
- });
-
+ })
const preferences = document.createElement('div');
- preferences.innerHTML = '<i class="fas fa-sliders-h fa-fw"></i>Preferences';
- preferences.addEventListener('click', ()=>{
- switchPage("SERVER",this.name,"PREF");
- });
- container.appendChild(preferences);
-
+ if(this.profile.address != 'noServer'){
+ preferences.innerHTML = '<i class="fas fa-sliders-h fa-fw"></i>Preferences';
+ preferences.addEventListener('click', () => {
+ switchPage("SERVER", this.name, "PREF");
+ });
+ container.appendChild(preferences);
+ }
sidebarItem.appendChild(container);
//event Target / interactivity
const events = document.createElement('span');
events.classList.add("switch-page-event");
- events.addEventListener("site-changed", (event:CustomEvent)=>{
+ events.addEventListener("site-changed", (event: CustomEvent) => {
sidebarItem.classList.remove("selected");
info.classList.remove("selected");
//news.classList.remove("selected");
screenshots.classList.remove("selected");
preferences.classList.remove("selected");
- if(event.detail.sitetype === "SERVER" && event.detail.page === this.name){
+ if (event.detail.sitetype === "SERVER" && event.detail.page === this.name) {
sidebarItem.classList.add("selected");
// if(event.detail.subPage === "NEWS") {
// news.classList.add("selected");
// } else
- if(event.detail.subPage === "PREF") {
+ if (event.detail.subPage === "PREF") {
preferences.classList.add("selected");
- } else if(event.detail.subPage === "SCREENSHOTS") {
+ } else if (event.detail.subPage === "SCREENSHOTS") {
screenshots.classList.add("selected");
} else {
info.classList.add("selected");
@@ -151,13 +152,13 @@ export default class GameServer {
return sidebarItem;
}
- getPage(type:string):HTMLElement{
+ getPage(type: string): HTMLElement {
const page = document.createElement('div');
- if (typeof(type) === undefined || type == null){
+ if (typeof (type) === undefined || type == null) {
page.appendChild(this.getInfoPage());
- } else if (type == "SCREENSHOTS"){
+ } else if (type == "SCREENSHOTS") {
page.appendChild(this.getScreenshotsPage());
- } else if (type == "PREF"){
+ } else if (type == "PREF") {
page.appendChild(this.getPreferencesPage());
} else {
const content = document.createElement('div');
@@ -169,7 +170,7 @@ export default class GameServer {
return page;
}
- private getInfoPage():HTMLElement{
+ private getInfoPage(): HTMLElement {
const content = document.createElement('div');
content.classList.add("infoServerPage");
@@ -180,8 +181,8 @@ export default class GameServer {
const socialContainer = document.createElement('div');
socialContainer.classList.add("socialContainer");
- setTimeout(()=>{
- this.socialLinks.forEach((link)=>{
+ setTimeout(() => {
+ this.socialLinks.forEach((link) => {
socialContainer.appendChild(link.getHTML());
});
}, 5);
@@ -191,17 +192,17 @@ export default class GameServer {
shrtDsrption.classList.add("shortDescription");
shrtDsrption.innerText = this.shortDescription;
content.appendChild(shrtDsrption);
- if(this.newsLatestPage && this.newsLatestPage != null){
+ if (this.newsLatestPage && this.newsLatestPage != null) {
const latestNews = document.createElement('div');
latestNews.classList.add("news");
content.appendChild(latestNews);
- News.get(this.newsLatestPage.url,this.newsLatestPage.type).then((result:string)=>{
+ News.get(this.newsLatestPage.url, this.newsLatestPage.type).then((result: string) => {
latestNews.innerHTML = result;
const aTags = latestNews.getElementsByTagName("a");
for (var i = 0; i < aTags.length; i++) {
const href = aTags[i].href.toString();
- aTags[i].addEventListener('click', ()=>{
- shell.openExternal(href);
+ aTags[i].addEventListener('click', () => {
+ shell.openExternal(href);
});
aTags[i].href = "#";
}
@@ -211,7 +212,7 @@ export default class GameServer {
return content;
}
- private getPreferencesPage():HTMLElement{
+ private getPreferencesPage(): HTMLElement {
const content = document.createElement('div');
content.classList.add("preferencesServerPage");
@@ -226,22 +227,22 @@ export default class GameServer {
const loginUsernameLabel = document.createElement('label');
loginUsernameLabel.innerText = "Username";
const loginUsername = document.createElement('input') as HTMLInputElement;
- loginUsername.value = localStorage.getItem("2_username_"+this.profile.address);
+ loginUsername.value = localStorage.getItem("2_username_" + this.profile.address);
loginUsernameLabel.appendChild(loginUsername);
const loginPinLabel = document.createElement('label');
loginPinLabel.innerText = "Password";
const loginPin = document.createElement('input') as HTMLInputElement;
loginPin.type = "password";
- loginPin.value = localStorage.getItem("2_pin_"+this.profile.address);
+ loginPin.value = localStorage.getItem("2_pin_" + this.profile.address);
loginPinLabel.appendChild(loginPin);
- const saveBtn = document.createElement('button') as HTMLButtonElement;
+ const saveBtn = document.createElement('button') as HTMLButtonElement;
saveBtn.innerText = "save";
- saveBtn.addEventListener('click', ()=>{
- localStorage.setItem("2_username_"+this.profile.address, loginUsername.value);
- localStorage.setItem("2_pin_"+this.profile.address, loginPin.value);
+ saveBtn.addEventListener('click', () => {
+ localStorage.setItem("2_username_" + this.profile.address, loginUsername.value);
+ localStorage.setItem("2_pin_" + this.profile.address, loginPin.value);
this.updateLoginTextElement();
});
@@ -253,94 +254,94 @@ export default class GameServer {
return content;
}
- private getScreenshotsPage():HTMLElement{
+ private getScreenshotsPage(): HTMLElement {
const screenshotContainer = document.createElement('div');
screenshotContainer.classList.add("screenshotsContainer");
- screenshotContainer.id="screenshots";
+ screenshotContainer.id = "screenshots";
ipcRenderer.send('getScreenshots', this.profile.address);
return screenshotContainer;
}
- updateLoginTextElement():void{
- const account = localStorage.getItem("2_username_"+this.profile.address);
- const pin = localStorage.getItem("2_pin_"+this.profile.address);
+ updateLoginTextElement(): void {
+ const account = localStorage.getItem("2_username_" + this.profile.address);
+ const pin = localStorage.getItem("2_pin_" + this.profile.address);
const element = document.getElementById('LoginText');
- if(account && pin){
+ if (account && pin) {
element.innerHTML = `Logged in as <b>${account}</b>`;
- }else{
+ } else {
element.innerHTML = "Automatic login not set up";
}
}
- play(){
- const args:any = JSON.parse(JSON.stringify(this.profile));
- args.username = localStorage.getItem("2_username_"+this.profile.address);
- args.password = localStorage.getItem("2_pin_"+this.profile.address);
+ play() {
+ const args: any = JSON.parse(JSON.stringify(this.profile));
+ args.username = localStorage.getItem("2_username_" + this.profile.address);
+ args.password = localStorage.getItem("2_pin_" + this.profile.address);
ipcRenderer.send('play', args);
}
}
export class socialLink {
constructor(
- public icon:string,// has to be one from font awesome -https://fontawesome.com/icons
- public tooltip:string,
- public url:string
- ){}
+ public icon: string,// has to be one from font awesome -https://fontawesome.com/icons
+ public tooltip: string,
+ public url: string
+ ) { }
- getHTML():HTMLElement{
+ getHTML(): HTMLElement {
//<button onclick="sv.openSocialLink(this)" socialLink="abc"><i class="fa fa-user"></i></button><br>
const element = document.createElement('button');
- element.onclick = ()=>{this.open()};
+ element.onclick = () => { this.open() };
element.innerHTML = `<i class="${this.icon}"></i>`;
element.title = this.tooltip;
return element;
}
- open(){
+ open() {
console.log("A link was clicked!", this.url);
- if(this.url)
- shell.openExternal(this.url.indexOf("://")!==-1?this.url:`https://${this.url}`);
+ if (this.url)
+ shell.openExternal(this.url.indexOf("://") !== -1 ? this.url : `https://${this.url}`);
}
}
-ipcRenderer.on('getScreenshots', (event:any, data:{dir:string, screenshots:string[]}) => {
+ipcRenderer.on('getScreenshots', (event: any, data: { dir: string, screenshots: string[] }) => {
console.log(data)
- const screenshots = document.getElementById('screenshots');
- if(screenshots){
- // Display screenshots if that tab is open
- if(data.screenshots.length!==0){
- data.screenshots.forEach((fileName:string)=>{
- const screenshot = document.createElement("div");
- screenshot.classList.add("screenshot");
- screenshots.appendChild(screenshot);
- const img = document.createElement("img");
- img.src = data.dir+fileName;
- screenshot.appendChild(img);
-
- // const text = document.createElement("span");
- // text.innerText = fileName;
- // screenshot.appendChild(text);
- screenshot.addEventListener('dragstart', (event) => {
- event.preventDefault()
- ipcRenderer.send('dragFileOut', data.dir+fileName)
- })
+ const screenshots = document.getElementById('screenshots');
+ if (screenshots) {
+ // Display screenshots if that tab is open
+ if (data.screenshots.length !== 0) {
+ data.screenshots.forEach((fileName: string) => {
+ const screenshot = document.createElement("div");
+ screenshot.classList.add("screenshot");
+ screenshots.appendChild(screenshot);
+ const img = document.createElement("img");
+ img.src = data.dir + fileName;
+ screenshot.appendChild(img);
+
+ // const text = document.createElement("span");
+ // text.innerText = fileName;
+ // screenshot.appendChild(text);
+ screenshot.addEventListener('dragstart', (event) => {
+ event.preventDefault()
+ ipcRenderer.send('dragFileOut', data.dir + fileName)
+ })
- });
- } else {
- const nothingHere = document.createElement("p");
- nothingHere.classList.add("nothingHere");
- nothingHere.innerText = "There is nothing here, yet. Make some screenshots in Game and come back here. The default key for snaping screenshots is 'P'."
+ });
+ } else {
+ const nothingHere = document.createElement("p");
+ nothingHere.classList.add("nothingHere");
+ nothingHere.innerText = "There is nothing here, yet. Make some screenshots in Game and come back here. The default key for snaping screenshots is 'P'."
- screenshots.appendChild(nothingHere);
- }
+ screenshots.appendChild(nothingHere);
+ }
- const openFolderButton = document.createElement('button');
- openFolderButton.innerText = "Open folder to see all";
- openFolderButton.addEventListener('click', ()=>{
- shell.openItem(data.dir);
- });
- screenshots.appendChild(openFolderButton);
- }
+ const openFolderButton = document.createElement('button');
+ openFolderButton.innerText = "Open folder to see all";
+ openFolderButton.addEventListener('click', () => {
+ shell.openItem(data.dir);
+ });
+ screenshots.appendChild(openFolderButton);
+ }
})