├── app ├── xinwei.ttf ├── color.css ├── redirect.js ├── index.css └── index.js ├── package.json ├── index.html ├── main.js └── LICENSE /app/xinwei.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/libccy/noname-app/HEAD/app/xinwei.ttf -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "无名杀", 3 | "version": "1.9.0", 4 | "main": "main.js" 5 | } 6 | -------------------------------------------------------------------------------- /app/color.css: -------------------------------------------------------------------------------- 1 | html,body{ 2 | width: 100%; 3 | height: 100%; 4 | position: absolute; 5 | margin: 0; 6 | padding: 0; 7 | background-color: rgb(60, 60, 60); 8 | overflow: hidden; 9 | } 10 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /main.js: -------------------------------------------------------------------------------- 1 | const electron = require('electron'); 2 | const {app} = electron; 3 | const {BrowserWindow} = electron; 4 | 5 | let win; 6 | 7 | function createWindow() { 8 | win = new BrowserWindow({width: 960, height: 660, title:'无名杀'}); 9 | win.loadURL(`file://${__dirname}/index.html`); 10 | win.on('closed', () => { 11 | win = null; 12 | }); 13 | } 14 | 15 | app.on('ready', createWindow); 16 | app.on('window-all-closed', () => { 17 | app.quit(); 18 | }); 19 | 20 | app.on('activate', () => { 21 | if (win === null) { 22 | createWindow(); 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /app/redirect.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | (function(){ 3 | var url=localStorage.getItem('noname_inited'); 4 | if(url){ 5 | if(url==='nodejs'){ 6 | url=''; 7 | } 8 | var loadFailed=function(){ 9 | localStorage.removeItem('noname_inited'); 10 | window.location.reload(); 11 | } 12 | var load=function(src,onload,onerror){ 13 | var script=document.createElement('script'); 14 | script.src=url+'game/'+src+'.js'; 15 | script.onload=onload; 16 | script.onerror=onerror; 17 | document.head.appendChild(script); 18 | } 19 | load('update',function(){ 20 | load('config',function(){ 21 | load('package',function(){ 22 | load('game',null,loadFailed); 23 | },loadFailed); 24 | },loadFailed); 25 | },loadFailed); 26 | window.cordovaLoadTimeout=setTimeout(loadFailed,5000); 27 | } 28 | }()); 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/index.css: -------------------------------------------------------------------------------- 1 | html{ 2 | color: white; 3 | text-shadow: black 0 0 2px; 4 | text-align: center; 5 | font-size: 40px; 6 | cursor: default; 7 | -webkit-user-select:none; 8 | -webkit-tap-highlight-color:transparent; 9 | } 10 | div{ 11 | position: absolute; 12 | width: 80%; 13 | margin: 0; 14 | padding: 0; 15 | left: 10%; 16 | font-family: 'xinwei'; 17 | } 18 | a{ 19 | color: white; 20 | text-shadow: black 0 0 2px; 21 | cursor: pointer; 22 | } 23 | #button{ 24 | width: 210px; 25 | border-radius: 8px; 26 | display: inline-block; 27 | padding: 5px; 28 | font-size: 40px; 29 | line-height: 40px; 30 | background-image: linear-gradient(rgb(150, 47, 47),rgb(132,43,43)); 31 | box-shadow: rgba(0, 0, 0, 0.2) 0 0 0 1px, rgba(0, 0, 0, 0.3) 0 3px 10px; 32 | left: calc(50% - 110px); 33 | top: calc(50% - 25px); 34 | cursor: pointer; 35 | } 36 | #button.disabled{ 37 | opacity: 0.5; 38 | cursor: default; 39 | } 40 | 41 | #help{ 42 | bottom:17px; 43 | left:auto; 44 | padding: 3px; 45 | right:17px; 46 | text-align:right; 47 | font-size:20px; 48 | cursor: pointer; 49 | width: auto; 50 | } 51 | #version{ 52 | top:calc(50% + 35px); 53 | width:220px; 54 | left:calc(50% - 110px); 55 | font-size:16px; 56 | } 57 | 58 | #changesite{ 59 | bottom:17px; 60 | padding: 3px; 61 | right:auto; 62 | left:17px; 63 | text-align:left; 64 | font-size:20px; 65 | outline: none; 66 | cursor: pointer; 67 | border-radius: 2px; 68 | width: auto; 69 | } 70 | /* #changesite.bluetext{ 71 | text-shadow: black 0 0 1px,rgba(255, 203, 0,1) 0 0 2px,rgba(255, 203, 0,1) 0 0 2px,rgba(255, 203, 0,1) 0 0 2px, 72 | rgba(255, 203, 0,1) 0 0 2px,black 0 0 1px; 73 | } */ 74 | #changesite.editing{ 75 | -webkit-user-select: text; 76 | cursor: auto; 77 | box-shadow: rgba(0, 0, 0, 0.3) 0 0 0 1px, rgba(0, 133, 255, 0.4) 0 0 0 2px, rgba(0, 133, 255, 1) 0 0 8px; 78 | } 79 | 80 | #noname_init_help{ 81 | width: 100%; 82 | height: 100%; 83 | position: absolute; 84 | margin: 0; 85 | padding: 0; 86 | left: 0; 87 | top: 0; 88 | background-color: rgb(60, 60, 60); 89 | overflow: hidden; 90 | } 91 | #noname_init_help>div:not(#back){ 92 | font-size: 20px; 93 | height: 100%; 94 | left: calc(50% - 250px); 95 | width: 500px; 96 | top: 0; 97 | text-align: left; 98 | display: table; 99 | line-height: 25px; 100 | position: absolute; 101 | } 102 | #noname_init_help>div>div{ 103 | position: relative; 104 | display: table-cell; 105 | vertical-align: middle; 106 | left: 0; 107 | } 108 | 109 | #back{ 110 | width:60px; 111 | bottom:20px; 112 | left:auto; 113 | right:20px; 114 | text-align:right; 115 | font-size:20px; 116 | cursor: pointer; 117 | } 118 | 119 | ::-webkit-scrollbar{ 120 | display: none; 121 | } 122 | @font-face { 123 | font-family: 'xinwei'; 124 | src: url('xinwei.ttf'); 125 | } 126 | -------------------------------------------------------------------------------- /app/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | (function(){ 3 | if(localStorage.getItem('noname_inited')) return; 4 | var app = { 5 | initialize: function() { 6 | this.bindEvents(); 7 | }, 8 | bindEvents: function() { 9 | if(window.require&&window.__dirname){ 10 | this.onDeviceReady(); 11 | } 12 | else{ 13 | var script=document.createElement('script'); 14 | script.src='cordova.js'; 15 | document.head.appendChild(script); 16 | document.addEventListener('deviceready', this.onDeviceReady, false); 17 | } 18 | }, 19 | onDeviceReady: function() { 20 | var site_g='https://raw.githubusercontent.com/libccy/noname/'; 21 | var site_c='https://gitlab.com/isgs/noname/raw/'; 22 | var site=site_g; 23 | var button,changesite,help,version,versionnode; 24 | var req=function(url,onload,onerror,target){ 25 | var sScriptURL=url; 26 | var oReq=new XMLHttpRequest(); 27 | if(onload) oReq.addEventListener("load",function(){ 28 | try{ 29 | eval(this.responseText); 30 | if(target&&!window[target]){ 31 | throw('err'); 32 | } 33 | } 34 | catch(e){ 35 | onerror(); 36 | return; 37 | } 38 | onload(); 39 | if(target){ 40 | delete window[target]; 41 | } 42 | }); 43 | if(onerror) oReq.addEventListener("error",onerror); 44 | oReq.open("GET", sScriptURL); 45 | oReq.send(); 46 | } 47 | 48 | var checkConnection=function(){ 49 | button.innerHTML='正在连接'; 50 | button.classList.add('disabled'); 51 | versionnode.innerHTML=''; 52 | req(site+'master/game/update.js',function(){ 53 | button.classList.remove('disabled'); 54 | button.innerHTML='下载无名杀'; 55 | version=window.noname_update.version; 56 | versionnode.innerHTML='v'+version; 57 | },function(){ 58 | button.classList.add('disabled'); 59 | button.innerHTML='连接失败'; 60 | },'noname_update'); 61 | }; 62 | 63 | var dir; 64 | var ua=navigator.userAgent.toLowerCase(); 65 | if(ua.indexOf('android')!=-1){ 66 | dir=cordova.file.externalApplicationStorageDirectory; 67 | } 68 | else if(ua.indexOf('iphone')!=-1||ua.indexOf('ipad')!=-1){ 69 | dir=cordova.file.documentsDirectory; 70 | } 71 | 72 | var update=function(){ 73 | button.innerHTML='正在连接'; 74 | button.classList.add('disabled'); 75 | versionnode.innerHTML=''; 76 | req(site+'v'+version+'/game/source.js',function(){ 77 | button.remove(); 78 | changesite.remove(); 79 | help.remove(); 80 | versionnode.remove(); 81 | 82 | var prompt=document.createElement('div'); 83 | prompt.style.height='40px'; 84 | prompt.style.top='calc(50% - 40px)'; 85 | prompt.style.lineHeight='40px'; 86 | prompt.innerHTML='正在下载游戏文件'; 87 | document.body.appendChild(prompt); 88 | 89 | var progress=document.createElement('div'); 90 | progress.style.top='calc(50% + 20px)'; 91 | progress.style.fontSize='20px'; 92 | progress.innerHTML='0/0'; 93 | document.body.appendChild(progress); 94 | 95 | var updates=window.noname_source_list; 96 | delete window.noname_source_list; 97 | 98 | var n1=0; 99 | var n2=updates.length; 100 | progress.innerHTML=n1+'/'+n2; 101 | var finish=function(){ 102 | prompt.innerHTML='游戏文件下载完毕'; 103 | progress.innerHTML=n1+'/'+n2; 104 | if(window.FileTransfer){ 105 | localStorage.setItem('noname_inited',dir); 106 | } 107 | else{ 108 | localStorage.setItem('noname_inited','nodejs'); 109 | } 110 | setTimeout(function(){ 111 | window.location.reload(); 112 | },1000); 113 | } 114 | var downloadFile; 115 | if(window.FileTransfer){ 116 | downloadFile=function(url,folder,onsuccess,onerror){ 117 | var fileTransfer = new FileTransfer(); 118 | url=site+'v'+version+'/'+url; 119 | folder=dir+folder; 120 | console.log(url); 121 | fileTransfer.download(encodeURI(url),folder,onsuccess,onerror); 122 | }; 123 | } 124 | else{ 125 | var fs=require('fs'); 126 | var http=require('https'); 127 | downloadFile=function(url,folder,onsuccess,onerror){ 128 | url=site+'v'+version+'/'+url; 129 | var dir=folder.split('/'); 130 | var str=''; 131 | var download=function(){ 132 | try{ 133 | var file = fs.createWriteStream(__dirname+'/'+folder); 134 | } 135 | catch(e){ 136 | onerror(); 137 | } 138 | var opts = require('url').parse(encodeURI(url)); 139 | opts.headers={'User-Agent': 'AppleWebkit'}; 140 | var request = http.get(opts, function(response) { 141 | var stream=response.pipe(file); 142 | stream.on('finish',onsuccess); 143 | stream.on('error',onerror); 144 | }); 145 | } 146 | var access=function(){ 147 | if(dir.length<=1){ 148 | download(); 149 | } 150 | else{ 151 | str+='/'+dir.shift(); 152 | fs.access(__dirname+str,function(e){ 153 | if(e){ 154 | try{ 155 | fs.mkdir(__dirname+str,access); 156 | } 157 | catch(e){ 158 | onerror(); 159 | } 160 | } 161 | else{ 162 | access(); 163 | } 164 | }); 165 | } 166 | } 167 | access(); 168 | }; 169 | } 170 | var multiDownload=function(list,onsuccess,onerror,onfinish){ 171 | list=list.slice(0); 172 | var download=function(){ 173 | if(list.length){ 174 | var current=list.shift(); 175 | downloadFile(current,current,function(){ 176 | if(onsuccess) onsuccess(); 177 | download(); 178 | },function(){ 179 | if(onerror) onerror(); 180 | download(); 181 | }); 182 | } 183 | else{ 184 | if(onfinish) onfinish(); 185 | } 186 | } 187 | download(); 188 | }; 189 | multiDownload(updates,function(){ 190 | n1++; 191 | progress.innerHTML=n1+'/'+n2; 192 | },null,function(){ 193 | setTimeout(finish,500); 194 | }); 195 | },function(){ 196 | button.classList.add('disabled'); 197 | button.innerHTML='连接失败'; 198 | },'noname_source_list'); 199 | } 200 | 201 | var link=document.createElement('link'); 202 | link.rel='stylesheet'; 203 | link.href='app/index.css'; 204 | document.head.appendChild(link); 205 | 206 | button=document.createElement('div'); 207 | button.id='button'; 208 | 209 | var touchstart=function(e){ 210 | if(this.classList.contains('disabled')) return; 211 | this.style.transform='scale(0.98)'; 212 | }; 213 | var touchend=function(){ 214 | this.style.transform=''; 215 | }; 216 | button.ontouchstart=touchstart; 217 | button.ontouchend=touchend; 218 | button.onmousedown=touchstart; 219 | button.onmouseup=touchend; 220 | button.onmouseleave=touchend; 221 | button.onclick=function(){ 222 | if(button.classList.contains('disabled')) return; 223 | update(); 224 | }; 225 | document.body.appendChild(button); 226 | document.ontouchmove=function(e){ 227 | e.preventDefault(); 228 | }; 229 | 230 | changesite=document.createElement('div'); 231 | changesite.id='changesite'; 232 | changesite.innerHTML='下载源: GitHub'; 233 | document.body.appendChild(changesite); 234 | 235 | versionnode=document.createElement('div'); 236 | versionnode.id='version'; 237 | help=document.createElement('div'); 238 | help.id='help'; 239 | help.innerHTML='无法在线下载?'; 240 | var helpnode=document.createElement('div'); 241 | helpnode.id='noname_init_help'; 242 | var helpnodetext=document.createElement('div'); 243 | helpnodetext.innerHTML= 244 | '
  1. 访问https://github.com/libccy/noname/releases/latest,下载zip文件'+ 245 | '
  2. 解压后将noname-master目录内的所有文件放入对应文件夹:
    windows/linux:resources/app
    mac:(右键显示包内容)contents/resources/app
    android:android/data/com.widget.noname
    ios:documents(itunes—应用—文件共享)'+ 246 | '
  3. 完成上述步骤后,点击此处
'; 247 | helpnode.appendChild(helpnodetext); 248 | help.onclick=function(){ 249 | document.body.appendChild(helpnode); 250 | } 251 | 252 | var back=document.createElement('div'); 253 | back.id='back'; 254 | back.innerHTML='返回'; 255 | back.onclick=function(){ 256 | helpnode.remove(); 257 | }; 258 | helpnode.appendChild(back); 259 | document.body.appendChild(help); 260 | document.body.appendChild(versionnode); 261 | checkConnection(); 262 | 263 | if(window.FileTransfer){ 264 | window.tempSetNoname=dir; 265 | } 266 | else{ 267 | window.tempSetNoname='nodejs'; 268 | } 269 | changesite.onclick=function(){ 270 | if(this.classList.toggle('bluetext')){ 271 | site=site_c; 272 | this.innerHTML='下载源: GitLab' 273 | } 274 | else{ 275 | site=site_g; 276 | this.innerHTML='下载源: GitHub' 277 | } 278 | checkConnection(); 279 | }; 280 | } 281 | }; 282 | 283 | app.initialize(); 284 | }()) 285 | --------------------------------------------------------------------------------