Jelajahi Sumber

Working on concepts for login UI.

Daniel Scalzi 8 tahun lalu
induk
melakukan
f8a0805c8c

+ 80 - 5
app/assets/css/styles.css

@@ -38,7 +38,6 @@ html {
 }
 
 #main_content {
-    height: auto;
     height: calc(100% - 90px);
     display: flex;
 }
@@ -180,12 +179,38 @@ button:hover {
     width: 30%;
 }
 
+#welcome_text_container {
+    display: table;
+    margin: 0 auto;
+}
+
 #welcome_text {
     font-family: 'ringbearer';
     font-size: 16px;
-    display: block;
+    display: table-cell;
     text-align: center;
-    padding-top: 10px;
+    vertical-align: middle;
+    height: 35px;
+}
+
+#login_pane {
+    background: linear-gradient(141deg, #000000 -5%, #a02d2a 120%, #000000 150%);
+    padding-top: 5px;
+    border-radius: 5px;
+    box-shadow: 0px 0px 5px 2px rgba(0, 0, 0, 0.28);
+    width: 97%;
+    margin: 0 auto;
+}
+
+#login_pane_header_container {
+    margin-left: 10px;
+}
+
+.login_pane_header {
+    font-size: 14px;
+    font-family: 'Segoe UI';
+    font-weight: 500;
+    color: white;
 }
 
 #login_container {
@@ -219,11 +244,14 @@ button:hover {
     font-size: 12px;
     font-family: 'Segoe UI';
     font-weight: 500;
+    color: white;
+    /* new */
+    display: table;
 }
 
 #button_login {
     float: right;
-    margin-right: 10px;
+    margin-top: 10px;
 }
 
 /*******************************************************************************
@@ -273,4 +301,51 @@ button:hover {
 #launcher-log::-webkit-scrollbar-thumb:window-inactive,
 #launcher-log::-webkit-scrollbar-thumb {
         background:  black
-}
+}
+
+.log_debug {
+    color: blue;
+}
+
+/*******************************************************************************
+ *                                                                             *
+ * Login View                                                                  *
+ *                                                                             *
+ ******************************************************************************/
+
+#login_view {
+    background: rgba(0, 0, 0, 0.76);
+    height: calc(100% - 90px);
+    display: flex;
+    justify-content: center;
+    align-items: center;
+}
+
+#login_content {
+    width: 50%;
+    height: 75%;
+    display: flex;
+    justify-content: center;
+}
+
+#login_view #content_main {
+    display: flex;
+}
+
+#login_view #login_content_image {
+    height: 125px;
+    width: auto;
+}
+
+#login_view #content_main #right {
+    margin-left: 10px;
+}
+
+.login_input {
+    background-color: #a02d2a;
+}
+
+.login_input::-webkit-input-placeholder {
+    color: white;
+}
+

+ 31 - 5
app/assets/js/assetguard.js

@@ -186,7 +186,7 @@ const instance = new AssetGuard()
  * 'net.minecraftforge:forge:1.11.2-13.20.0.2282', '.jar' becomes
  * net\minecraftforge\forge\1.11.2-13.20.0.2282\forge-1.11.2-13.20.0.2282.jar
  * 
- * @param {String} artifact - the artifact id string.
+ * @param {String} artifactid - the artifact id string.
  * @param {String} extension - the extension of the file at the resolved path.
  * @returns {String} - the resolved relative path from the artifact id.
  */
@@ -201,6 +201,26 @@ function _resolvePath(artifactid, extension){
     return path.join.apply(path, cs)
 }
 
+/**
+ * Resolve an artifact id into a URL. For example,
+ * 'net.minecraftforge:forge:1.11.2-13.20.0.2282', '.jar' becomes
+ * net/minecraftforge/forge/1.11.2-13.20.0.2282/forge-1.11.2-13.20.0.2282.jar
+ * 
+ * @param {String} artifactid - the artifact id string.
+ * @param {String} extension - the extension of the file at the resolved url.
+ * @returns {String} - the resolved relative URL from the artifact id.
+ */
+function _resolveURL(artifactid, extension){
+    let ps = artifactid.split(':')
+    let cs = ps[0].split('.')
+
+    cs.push(ps[1])
+    cs.push(ps[2])
+    cs.push(ps[1].concat('-').concat(ps[2]).concat(extension))
+
+    return cs.join('/')
+}
+
 /**
  * Calculates the hash for a file using the specified algorithm.
  * 
@@ -724,17 +744,19 @@ function _parseDistroModules(modules, basePath, version){
         let obPath = obArtifact.path == null ? _resolvePath(ob.id, obArtifact.extension) : obArtifact.path
         switch(obType){
             case 'forge-hosted':
+            case 'forge':
                 obPath = path.join(basePath, 'libraries', obPath)
-                break;
+                break
             case 'library':
                 obPath = path.join(basePath, 'libraries', obPath)
-                break;
+                break
             case 'forgemod':
                 obPath = path.join(basePath, 'mods', obPath)
-                break;
+                break
             case 'litemod':
                 obPath = path.join(basePath, 'mods', version, obPath)
-                break;
+                break
+            case 'file':
             default: 
                 obPath = path.join(basePath, obPath)
         }
@@ -788,6 +810,10 @@ function loadForgeData(serverpack, basePath){
     })
 }
 
+function _parseForgeLibraries(){
+
+}
+
 /**
  * This function will initiate the download processed for the specified identifiers. If no argument is
  * given, all identifiers will be initiated. Note that in order for files to be processed you need to run

+ 51 - 0
app/assets/js/modlist.js

@@ -0,0 +1,51 @@
+const fs = require('fs')
+
+/**
+ * Class used to configure mod launch args.
+ */
+export class ModList {
+
+    /**
+     * Construct a ModList.
+     * 
+     * @param {String} repositoryRoot - the base path of the mod locations.
+     * @param {Array.<String>} modRef - array containing the mod artifact ids.
+     * @param {String} parentList - parent ModList file path, null if none.
+     */
+    constructor(repositoryRoot, modRef, parentList){
+        if(!arguments.length){
+            this.repositoryRoot = ''
+            this.modRef = []
+        }
+        this.repositoryRoot
+        this.modRef = modRef
+        if(parentList != null) this.parentList = parentList
+    }
+
+    /**
+     * Exports a ModList object to the specified file path.
+     * 
+     * @param {ModList} modList - the ModList object to export.
+     * @param {String} filePath - desired filepath.
+     * @returns {Promise.<String>} - a promise which resolves FML modList argument.
+     */
+    static exportModList(modList, filePath){
+        return new Promise(function(resolve, reject){
+            fs.writeFile(filePath, JSON.stringify(modList), (err) => {
+                if(err){
+                    reject(err.message)
+                }
+                resolve('--modListFile ' + filePath)
+            })
+        })
+    }
+
+    /**
+     * 
+     * @param {Object} distro - the distribution index. 
+     */
+    static generateModList(distro){
+
+    }
+
+}

+ 8 - 5
app/assets/js/script.js

@@ -14,7 +14,7 @@ function timestamp(){
     const min = date.getMinutes() < 10 ? '0'.concat(date.getMinutes()) : date.getMinutes();
     const sec = date.getSeconds() < 10 ? '0'.concat(date.getSeconds()) : date.getSeconds();
 
-    return os.EOL + '[' + month + '/' + day + '/' + date.getFullYear() + ' ' + hour  + ':' + min + ':' + sec + ']'
+    return '[' + month + '/' + day + '/' + date.getFullYear() + ' ' + hour  + ':' + min + ':' + sec + ']'
 }
 
 $(document).on('ready', function(){
@@ -26,14 +26,17 @@ $(document).on('ready', function(){
             $(this).parent().toggleClass("success")
         }
     })
-    /*console.log = function(){
-        $('#launcher-log').append(timestamp() + ' [Log] - ' + Array.prototype.slice.call(arguments).join(' '))
+    console.log = function(){
+        $('#launcher-log').append(timestamp() + ' [Log] - ' + Array.prototype.slice.call(arguments).join(' ') + os.EOL)
     }
     console.error = function(){
-        $('#launcher-log').append(timestamp() + ' [Error] - ' + Array.prototype.slice.call(arguments).join(' '))
+        $('#launcher-log').append('<span class="log_debug">' + timestamp() + ' [Debug] - ' + Array.prototype.slice.call(arguments).join(' ') + "</span>" + os.EOL)
+    }
+    console.debug = function(){
+        $('#launcher-log').append('<span class="log_debug">' + timestamp() + ' [Error] - ' + Array.prototype.slice.call(arguments).join(' ') + "</span>" + os.EOL)
     }
     console.log('test')
-    //console.debug('test')*/
+    console.debug('test')
 })
 
 /* Open web links in the user's default browser. */

+ 19 - 8
app/assets/westeroscraft.json

@@ -223,19 +223,30 @@
                     ]
                 },
                 {
-                    "id": "net.optifine:optifine:1.11.2_HD_U_B8",
-                    "name": "Optifine (1.11.2_HD_U_B8)",
+                    "id": "net.optifine:optifine:1.11.2_HD_U_B9",
+                    "name": "Optifine (1.11.2_HD_U_B9)",
                     "type": "forgemod",
                     "artifact": {
-                        "size": 2050500,
-                        "MD5": "cf4da33e1014b1b77fea17d64668aff6",
-                        "path": "OptiFine-1.11.2_HD_U_B8.jar",
-                        "url": "http://optifine.net/download.php?f=OptiFine_1.11.2_HD_U_B8.jar"
+                        "size": 2056699,
+                        "MD5": "38b4c51b9c6ebc09e7a9784accea974e",
+                        "path": "OptiFine-1.11.2_HD_U_B9.jar",
+                        "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.11.2/mods/OptiFine.jar"
                     }
                 },
                 {
-                    "id": "com.westeroscraft:westerosblocks:3.0.0-beta-1",
-                    "name": "WesterosBlocks (3.0.0-beta-1)",
+                    "id": "jei",
+                    "name": "JustEnoughItems (1.11.2-4.3.5.277)",
+                    "type": "forgemod",
+                    "artifact": {
+                        "size": 509450,
+                        "MD5": "ea56276646ce405bb4beeaf9064de611",
+                        "path": "jei.jar",
+                        "url": "http://mc.westeroscraft.com/WesterosCraftLauncher/test-1.11.2/mods/jei.jar"
+                    }
+                },
+                {
+                    "id": "com.westeroscraft:westerosblocks:3.0.0-beta-71",
+                    "name": "WesterosBlocks (3.0.0-beta-71)",
                     "type": "forgemod",
                     "artifact": {
                         "size": 16230253,

+ 57 - 35
app/index.html

@@ -6,14 +6,6 @@
     <title>Westeroscraft Launcher</title>
     <script src="./assets/js/script.js"></script>
     <link type="text/css" rel="stylesheet" href="./assets/css/styles.css">
-
-    <!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
-    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
-    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
-
-    <link rel="stylesheet" type="text/css" href="assets/css/global.css">
-    <link rel="stylesheet" type="text/css" href="assets/css/header.css"> -->
-
 </head>
 <body>
     <div id="header_container">
@@ -36,45 +28,75 @@
         </div>
     </div>
 
-    <div id="main_content">
-        <div id="left_pane">
-            <span id="welcome_text">Welcome to WesterosCraft!</span>
-            <div id="login_container">
-                <div id="login_container_left">
-                    <img src="https://minotar.net/avatar/TheAventine.png" id="login_image" />
+    <div id="login_view">
+        <div id="login_content">
+            <div id="content_main">
+                <div id="left">
+                    <img id="login_content_image" src="./assets/images/WesterosSealSquare.png" />
                 </div>
-                <div id="login_container_right">
+                <div id="right">
                     <label class="login_field">Username</label>
-                    <input type="text" name="username"></input>
+                    <input type="text" name="username" placeholder="Username" class="login_input"></input>
                     <label class="login_field">Password</label>
-                    <input type="password" name="password"></input>
+                    <input type="password" name="password" placeholder="Password" class="login_input"></input>
+                    <div id="login_button_dock">
+                        <button id="button_login">Login</button>
+                    </div>
                 </div>
             </div>
-            <div id="login_button_dock">
-                <button id="button_login">Login</button>
+        </div>
+    </div>
+
+    <div id="main_content" style="display: none;">
+        <div id="left_pane">
+            <div id="welcome_text_container">
+                <span id="welcome_text">Welcome to WesterosCraft!</span>
+            </div>
+            <div id="login_pane">
+                <div id="login_pane_header_container">
+                    <label class="login_pane_header">Login to New Account</label>
+                </div>
+                <div id="login_container">
+                    <div id="login_container_left">
+                        <img src="https://minotar.net/avatar/TheAventine.png" id="login_image" />
+                    </div>
+                    <div id="login_container_right">
+                        <label class="login_field">Username</label>
+                        <input type="text" name="username"></input>
+                        <label class="login_field">Password</label>
+                        <input type="password" name="password"></input>
+                        <div id="login_button_dock">
+                            <button id="button_login">Login</button>
+                        </div>
+                    </div>
+                </div>
             </div>
+            <!-- Experimental 
+            <br>
+            <div id="login_pane">
+                <div id="login_pane_header_container">
+                    <label class="login_pane_header">Logged in as TheKraken7</label>
+                </div>
+                <div id="login_container">
+                    <div id="login_container_left">
+                        <img src="https://minotar.net/avatar/TheKraken7.png" id="login_image" />
+                    </div>
+                    <div id="login_container_right">
+                        <label class="login_field">Switch Account</label>
+                        <select>
+                            <option value="iPepsiHD">iPepsiHD</option>
+                            <option value="$addNew">Add New..</option>
+                        </select>
+                    </div>
+                </div>
+            </div>-->
         </div>
         <div id="right_pane">
             <div class="toggle-btn-grp">
                 <label onclick="" class="toggle-btn success"><input type="radio" name="main_group"/>news</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>map</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>mods</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>faq</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>log</label><label onclick="" class="toggle-btn"><input type="radio" name="main_group"/>settings</label>
             </div>
             <div id="content_container">
-                <textarea id="launcher-log">[05/17/2017 04:59:13] [INFO] - Loading..
-[05/17/2017 04:59:13] [SEVERE] - This is a test exception
-java.lang.Exception: This is a test exception
-	at com.westeroscraft.LauncherExecutor.start(LauncherExecutor.java:40)
-	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$162(LauncherImpl.java:863)
-	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$175(PlatformImpl.java:326)
-	at com.sun.javafx.application.PlatformImpl.lambda$null$173(PlatformImpl.java:295)
-	at java.security.AccessController.doPrivileged(Native Method)
-	at com.sun.javafx.application.PlatformImpl.lambda$runLater$174(PlatformImpl.java:294)
-	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
-	at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
-	at com.sun.glass.ui.win.WinApplication.lambda$null$148(WinApplication.java:191)
-	at java.lang.Thread.run(Unknown Source)
-[05/17/2017 04:59:28] [INFO] - Hastebin result:
-Response code: 200.
-Hastebin URL: https://hastebin.com/kefezabiwa</textarea>
+                <textarea id="launcher-log"></textarea>
             </div>
         </div>
     </div>