2 Star 1 Fork 0

郑博文 / MinecraftWeb

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
home.html 31.23 KB
一键复制 编辑 原始数据 按行查看 历史
wzh656 提交于 2021-02-02 14:49 . 顶部工具栏
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864
<!DOCTYPE html>
<!-- Copyright © 2020~2021 by wzh -->
<html lang="zh">
<head>
<meta charset="UTF-8" />
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
<title>我的世界</title>
<!--icon-->
<link href="./img/icon.png" rel="icon" type="image/x-icon"/>
<!-- 异步fonts加载 -->
<script src="https://staticfile.qnssl.com/webfont/1.6.16/webfontloader.js"></script>
<script>
if (typeof require != "undefined"){ //electron
console.log("electron")
document.write(`<link href="./css/fonts.css" rel="stylesheet" type="text/css" />`);
window.onload = function(){
console.log("onload")
$("body").addClass("wf-active");
}
}else{
WebFont.load({
google: {
families: ["kt", "st", "xs", "zyyt"],
api: "./css/fonts.css"
}
});
}
</script>
<link href="./css/bootstrap.css" rel="stylesheet" type="text/css" />
<style>
/* 字体加载完成 */
.wf-active *{
font-family: zyyt, serif;
outline: none;
}
.wf-active h1,
.wf-active h2,
.wf-active h3,
.wf-active h4{
font-family: st, serif;
}
.wf-active p,
.wf-active label{
font-family: kt, serif;
}
.wf-active button{
font-family: xs, serif;
font-weight: bold;
}
/* 字体缩放方案 */
@media screen and (max-width:320px){
body {font-size: 0.8rem;}
}
@media screen and (min-width: 321px) and (max-width:481px){
body {font-size: 1rem;}
}
@media screen and (min-width: 481px) and (max-width:640px){
body {font-size: 1.1rem;}
}
@media screen and (min-width: 641px) and (max-width:800px){
body {font-size: 1.15rem;}
}
@media screen and (min-width: 801px) and (max-width:960px){
body {font-size: 1.25rem;}
}
@media screen and (min-width: 960px){
body {font-size: 1.3rem;}
}
/* element */
html{
-moz-user-select: none;
-khtml-user-select: none;
user-select: none;
/* 背景 */
min-height: 100%;
background: #1b2036 url("./img/background.jpg") no-repeat fixed center;
background-size: cover;
max-width: 100%;
margin: auto;
}
body{
position: absolute;
width: 100%;
height: 100%;
margin: 0;
overflow: hidden;
}
p{
font-size: 0.36em;
margin: 0;
}
button,label,summary{
cursor: pointer;
}
dialog{
border-radius: 1vw;
top: 50%;
transform: translateY(-50%);
}
/*INIT*/
.init{
position: absolute;
width: 100%;
height: 100%;
margin: 0;
text-align: center;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.init h1{
color: white;
font-size: 4.6em;
margin: 0;
}
.init > button{
width: 66.6vw;
/* height: 10vw; */
font-size: 3em;
margin: 0 auto;
/*font-family: zyyt, serif;*/
}
/* NEW WORLD */
.new_world{
position: absolute;
width: 100%;
height: 100%;
top: 100%;
left: 0;
margin: 0;
font-size: 1em;
background-color: white;
opacity: 0;
overflow-y: auto;
}
.new_world h2{
font-size: 3.6em;
text-align: center;
}
.new_world label{
font-size: 1.6em;
}
.new_world input{
width: 66%;
font-size: 1.6em;
border: 1px solid #ced4da;
border-radius: 0.3em;
padding: 0.2vmax;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
}
.new_world button{
width: 46vw;
/*height: 6.8%;*/
margin: 3px;
font-size: 2em;
}
/* MORE */
.more{
margin: 3px;
/* display: flex;
flex-direction: column;
justify-content: space-around;
flex-wrap: wrap; */
}
.more[open]{
/*border: 1px solid black;*/
padding-left: 1vw;
/*border-radius: 3px;*/
/* clear:both; */
}
.more > summary{
font-size: 2em;
margin-left: 1%;
outline: none;
}
.more > fieldset{
display: inline-block;
width: 80vw;
margin: 3vw;
}
/* 横屏情况下 */
@media screen and (orientation:landscape) {
.more > fieldset{
width: 42vw;
margin: 1vh 0;
}
}
.more > fieldset > legend{
font-size: 1.8em;
margin: 0;
}
.more > fieldset > fieldset > legend{
font-size: 1.6em;
margin: 0;
}
.more input:not([type="range"]){
width: 6vw;
font-size: 1em;
}
.more input[type="range"]{
width: 16vw;
}
/* .more > div[class]{
float: left;
padding-top: 2vh;
border: 1vmax solid black;
border-radius: 1vmax;
}
.more div{
padding-left: 2vw;
} */
/* ABOUT */
.about{
position: absolute;
width: 100%;
height: 100%;
top: 100%;
left: 0;
font-size: 1em;
margin: 0;
background-color: white;
opacity: 0;
overflow-y: auto;
}
.about h2{
font-size: 3.6em;
text-align: center;
}
.about button{
width: 66vw;
font-size: 2em;
margin: 1vmax;
}
.about > div{
padding: 2vmax;
margin: 3vmax;
}
</style>
<script src="./js/modules/jquery.min.js"></script>
<script>
if (typeof require != "undefined") //electron
window.$ = window.jQuery = require("./js/modules/jquery.min.js");
</script>
<script src="./js/modules/js+.js"></script>
<script src="https://cdn.jsdelivr.net/npm/eruda"></script>
<script src="https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js"></script>
<script>
if ( /ipad|iphone|midp|rv:1.2.3.4|ucweb|android|windows ce|windows mobile/.test( navigator.userAgent.toLowerCase() ) ){
//手机
eruda.init();
new VConsole();
}
</script>
<!-- DaoVoice -->
<script async defer>(function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/cfb04fc0.js","daovoice")</script>
<script async defer>
daovoice('init', {
app_id: "cfb04fc0"
});
daovoice('update');
</script>
<!-- gitter -->
<script defer>
((window.gitter = {}).chat = {}).options = {
room: 'wzh656/Minecraft'
};
</script>
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>
</head>
<body>
<section class="init" style="display: flex;">
<h1>我的世界</h1>
<button class="success">新的世界<p>New World</p></button>
<button class="info">关于<p>About</p></button>
</section>
<section class="new_world" style="display: none;">
<h2>新的世界<p>NEW WORLD</p></h2>
<label for="seed">种子(seed):</label><input name="seed" id="seed" placeholder="不输入则随机生成" autofocus />
<br/>
<details class="more">
<summary>高级设置</summary>
<fieldset class="time-position">
<legend>时空(time&position)</legend>
游戏开始时间:<input type="datetime-local" name="time" style="width: 36vw;" /><br/><br/>
<hr/>
坐标原点纬度:<br/>
-90°(S)<input type="range" min="-90" max="90" value="40" step="0.00001" name="latitude" />90°(N)
<input type="number" min="-90" max="90" step="0.00001" value="40" style="width: 16vw;" />°<br/>
<br/>
坐标原点经度:<br/>
-180°(E)<input type="range" min="-180" max="180" value="116" step="0.00001" name="longitude" />180°(S)
<input type="number" min="-180" max="180" step="0.00001" value="116" style="width: 16vw;" />°<br/>
<button class="success" style="width: 96%; font-size: 2vmax;">重新获取地理位置<p>注意:请先打开GPS开关</p></button>
</fieldset>
<fieldset class="height">
<legend>高度(height)</legend>
最小/m:1m<input type="range" min="1" max="256" step="0.1" value="1" name="min" />256m <input type="number" min="1" max="256" step="0.1" value="1" value="1" />m<br/>
最大/m:1m<input type="range" min="1" max="256" step="0.1" value="256" name="max" />256m <input type="number" min="1" max="256" step="0.1" value="256"/>m<br/>
平滑程度:1<input type="range" min="1" max="1000" step="1" value="166" name="q" />1000 <input type="number" min="1" max="1000" step="1" value="166"/>
<fieldset class="error">
<legend>误差(error)</legend>
最小/m:-5m<input type="range" min="-5" max="5" step="0.1" value="-1" name="min" />5m <input type="number" min="-5" max="5" step="0.1" value="-1"/>m<br/>
最大/m:-5m<input type="range" min="-5" max="5" step="0.1" value="1" name="max" />5m <input type="number" min="-5" max="5" step="0.1" value="1"/>m<br/>
平滑程度:1<input type="range" min="1" max="100" step="1" value="36" name="q" />100 <input type="number" min="1" max="100" step="1" value="36"/>
</fieldset>
</fieldset>
<fieldset class="dirt">
<legend>泥土层百分比(dirt)</legend>
最小:0<input type="range" min="0" max="1" step="0.01" value="0.1" name="min" />1 <input type="number" min="0" max="1" step="0.01" value="0.1"/><br/>
最大:0<input type="range" min="0" max="1" step="0.01" value="0.4" name="max" />1 <input type="number" min="0" max="1" step="0.01" value="0.4"/><br/>
平滑程度:1<input type="range" min="1" max="1000" step="1" value="66" name="q" />1000 <input type="number" min="1" max="1000" step="1" value="66"/>
<fieldset class="error">
<legend>误差(error)</legend>
最小:-0.5<input type="range" min="-0.5" max="0.5" step="0.01" value="-0.1" name="min" />0.5 <input type="number" min="-0.5" max="0.5" step="0.01" value="-0.1"/><br/>
最大:-0.5<input type="range" min="-0.5" max="0.5" step="0.01" value="0.1" name="max" />0.5 <input type="number" min="-0.5" max="0.5" step="0.01" value="0.1"/><br/>
平滑程度:1<input type="range" min="1" max="100" step="1" value="6" name="q" />100 <input type="number" min="1" max="100" step="1" value="6"/>
</fieldset>
</fieldset>
<fieldset class="openStone">
<legend>允许石头露天出现(负值不允许)(openStone)</legend>
最小:-5<input type="range" min="-5" max="5" step="0.01" value="-0.99" name="min" />5 <input type="number" min="-5" max="5" step="0.01" value="-0.99"/><br/>
最大:-5<input type="range" min="-5" max="5" step="0.01" value="0.01" name="max" />5 <input type="number" min="-5" max="5" step="0.01" value="0.01"/><br/>
平滑程度:1<input type="range" min="1" max="1000" step="1" value="1" name="q" />1000 <input type="number" min="1" max="1000" step="1" value="1"/>
</fieldset>
<fieldset class="type">
<legend>区块类型(type)</legend>
生成森林(forest)的概率:0<input type="range" min="0" max="1" step="0.01" value="0.4" name="forest" />1 <input name="forest" min="0" max="1" step="0.01" value="0.4"/><br/>
生成草原(grassland)的概率:0<input type="range" min="0" max="1" step="0.01" value="0.4" name="grassland" />1 <input name="grassland" min="0" max="1" step="0.01" value="0.4"/><br/>
生成沙漠(desert)的概率:0<input type="range" min="0" max="1" step="0.01" value="0.2" name="desert" />1 <input name="desert" min="0" max="1" step="0.01" value="0.2"/><br/>
平滑程度:1<input type="range" min="1" max="1000" step="1" value="666" name="q" />1000 <input type="number" min="1" max="1000" step="1" value="666"/>
</fieldset>
<fieldset class="treeHeight">
<legend>树高(treeHeight)</legend>
<fieldset class="plant">
<legend>允许生成树(plant)</legend>
最小:-1<input type="range" min="-1" max="1" step="0.001" value="0.5" name="min" />1 <input type="number" min="-1" max="1" step="0.001" value="0.5"/><br/>
最大:-1<input type="range" min="-1" max="1" step="0.001" value="0.667" name="max" />1 <input type="number" min="-1" max="1" step="0.001" value="0.667"/><br/>
</fieldset>
最小:1<input type="range" min="1" max="30" step="0.1" value="1" name="min" />10 <input type="number" min="1" max="30" step="0.1" value="1"/><br/>
最大:1<input type="range" min="1" max="30" step="0.1" value="10" name="max" />10 <input type="number" min="1" max="30" step="0.1" value="10"/><br/>
平滑程度:1<input type="range" min="1" max="100" step="1" value="1" name="q" />100 <input type="number" min="1" max="100" step="1" value="1"/>
<fieldset class="error">
<legend>误差(error)</legend>
最小:-5<input type="range" min="-5" max="5" step="0.1" value="-1" name="min" />5 <input type="number" min="-5" max="5" step="0.1" value="-1"/><br/>
最大:-5<input type="range" min="-5" max="5" step="0.1" value="1" name="max" />5 <input type="number" min="-5" max="5" step="0.1" value="1"/><br/>
平滑程度:1<input type="range" min="1" max="100" step="1" value="1" name="q" />100 <input type="number" min="1" max="100" step="1" value="1"/>
</fieldset>
</fieldset>
<fieldset class="leavesScale">
<legend>树叶高度与树高之比(leavesScale)</legend>
最小:0.01<input type="range" min="0.01" max="0.99" step="0.01" value="0.6" name="min" />0.99 <input type="number" min="0.01" max="0.99" step="0.01" value="0.6"/><br/>
最大:0.01<input type="range" min="0.01" max="0.99" step="0.01" value="0.86" name="max" />0.99 <input type="number" min="0.01" max="0.99" step="0.01" value="0.86"/><br/>
平滑程度:1<input type="range" min="1" max="100" step="1" value="16" name="q" />100 <input type="number" min="1" max="100" step="1" value="16"/>
<fieldset class="error">
<legend>误差(error)</legend>
最小:-0.5<input type="range" min="-0.5" max="0.5" step="0.01" value="-0.1" name="min" />0.5 <input type="number" min="-0.5" max="0.5" step="0.01" value="-0.1"/><br/>
最大:-0.5<input type="range" min="-0.5" max="0.5" step="0.01" value="0.1" name="max" />0.5 <input type="number" min="-0.5" max="0.5" step="0.01" value="0.1"/><br/>
平滑程度:1<input type="range" min="1" max="100" step="1" value="6" name="q" />100 <input type="number" min="1" max="100" step="1" value="6"/>
</fieldset>
</fieldset>
<fieldset class="weatherRain">
<legend>降雨概率(负值不下雨)(weatherRain)</legend>
最小:-1<input type="range" min="-1" max="1" step="0.01" value="-0.6" name="min" />1 <input type="number"min="-1" max="1" step="0.01" value="-0.6"/><br/>
最大:-1<input type="range" min="-1" max="1" step="0.01" value="0.3" name="max" />1 <input type="number"min="-1" max="1" step="0.01" value="0.3"/><br/>
平滑程度:1<input type="range" min="1" max="100" step="1" value="16" name="q" />100 <input type="number" min="1" max="100" step="1" value="16"/>
<fieldset class="error">
<legend>误差(error)</legend>
最小:-0.5<input type="range" min="-0.5" max="0.5" step="0.01" value="-0.1" name="min" />0.5 <input type="number" min="-0.5" max="0.5" step="0.01" value="-0.1"/><br/>
最大:-0.5<input type="range" min="-0.5" max="0.5" step="0.01" value="0.1" name="max" />0.5 <input type="number" min="-0.5" max="0.5" step="0.01" value="0.1"/><br/>
平滑程度:1<input type="range" min="1" max="100" step="1" value="6" name="q" />100 <input type="number"min="1" max="100" step="1" value="6"/>
</fieldset>
</fieldset>
<div style="clear:both;">
<button onclick="reset();" class="danger" style="clear:both;">重置</button>
</div>
<br style="clear:both;" />
</details>
<button class="warn">取消<p>Cancel</p></button>
<button class="success">生成世界<p>OK</p></button>
</section>
<section class="about" style="display: none;">
<h2>关于<p>ABOUT</p></h2>
<div style="font-family: kt;">
&nbsp;&nbsp;&nbsp;&nbsp;本游戏是一个依据《我的世界》游戏精神<b>仿制</b>(注:不是复制)的网页版游戏,目前仍处于初级发展阶段。<br/>
&nbsp;&nbsp;&nbsp;&nbsp;本游戏的灵感仅来源于数亿年前宇宙另一侧的一次蝴蝶效应扰动。<br/>
&nbsp;&nbsp;&nbsp;&nbsp;忆往事:去年(2020)5月网课时,偶遇Three.js,顿时灵感大作,码思泉涌,故本游戏终得诞生。<br/>
<font style="font-family: st;">&nbsp;&nbsp;&nbsp;&nbsp;往事不堪回首,前行之路可期。今年2021,愿新的一年里,终能不负所期!</font><br/>
<span style="float: right;">——2020年1月2日</span>
</div>
<div>
<hr/>
开发者:@wzh656<br/>
<a class="newTable" href="https://github.com/wzh656/">Github</a><br/>
<a class="newTable" href="https://gitee.com/wzh656/">Gitee</a><br/>
<a class="newTable" href="https://gitter.im/wzh656/Minecraft?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge">Gitter<img src="https://badges.gitter.im/wzh656/Minecraft.svg" alt="Join the chat at https://gitter.im/wzh656/Minecraft" /></a><br/>
邮箱:<a href="mailto:1826632591@qq.com?subject=关于《我的世界(仿)》">1826632591@qq.com</a><br/>
QQ:1826632591<a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin=1826632591&site=qq&menu=yes"><img border="0" src="http://wpa.qq.com/pa?p=2:1826632591:51" alt="点击这里给我发消息" title="点击这里给我发消息"/></a><br/>
<a href="http://chat.daovoice.io?id=cfb04fc0" onclick="if (typeof plus != undefined) plus.screen.lockOrientation('portrait-primary');">联系作者</a>
</div>
<hr/>
<center><button class="warn">返回<p>Back</p></button></center>
<footer style="display: none;"><center>
<script language="javascript" src="http://count24.51yes.com/click.aspx?id=248466766&logo=1" charset="gb2312"></script>
</center></footer>
</section>
<script>
//input处理
for (const i of $(".more input"))
i["data-init"] = i.value;
//重置
function reset(){
for (const i of $(".more input"))
i.value = i["data-init"];
}
//range <==> number
$(".more input[type='range']").change(function(){
$(this).next().val(this.value);
});
$(".more input[type='number']").change(function(){
if (isNaN(this.value))
this.value = this["data-init"];
$(this).prev().val( Number(this.value) );
this.value=$(this).prev().val();
});
//time
function dateToInputValue(date){
if (typeof date == "number") date = new Date(date);
return (
date.getFullYear() + "-"+
String( date.getMonth()+1 ).padStart(2, "0") + "-"+
String( date.getDate() ).padStart(2,"0") + "T"+
String( date.getHours() ).padStart(2,"0") + ":"+
String( date.getMinutes() ).padStart(2,"0")
);
}
function inputValueToDate(date){
const [, year, mouth, day, hour, minute] = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})/.exec(date);
return new Date(year, mouth-1, day, hour, minute);
}
$(".more > .time-position > input[name='time']")
.val( dateToInputValue( (new Date()).setFullYear(3000) ) )
.change(function(){
if (!this.value)
this.value = dateToInputValue( (new Date()).setFullYear(3000) );
});
//position
function getGeolocationPosition(){
return new Promise((resolve, reject)=>{
const successCallback = (latitude, longitude)=>{
console.log(latitude, longitude)
$(".more > .time-position > input[name='latitude']").val( latitude ).next().val( latitude );
$(".more > .time-position > input[name='longitude']").val( longitude ).next().val( longitude );
resolve(["获取成功!", {latitude, longitude}])
},
errCallback = (err)=>{
switch (err.code){
case 1:
reject(["地理位置服务被拒绝", err]);
break;
case 2:
reject(["暂时获取不到地理位置信息", err]);
break;
case 3:
reject(["获取地理位置信息超时", err]);
break;
default:
reject(["未知错误", err]);
break;
}
};
if ( navigator.userAgent.toLowerCase().indexOf("html5plus") != -1 ){ //html5+
const plusGetPosition = function(){
plus.geolocation.getCurrentPosition(function(position){
console.log("plus", position);
successCallback(position.coords.latitude, position.coords.longitude);
}, errCallback);
};
if (typeof plus == "undefined"){ //未加载完毕
console.log("html5+ hasn't ready")
document.addEventListener("plusready", plusGetPosition);
}else{ //手机版plus
console.log("html5+ ready")
plusGetPosition();
}
}else{ //网页版
console.log("api")
$.get("https://api.vvhan.com/api/getIpInfo",function(data, status, xhr){ //API
if (status == "success" && data.info && data.info.lat && data.info.lng){
console.log("api success", data)
successCallback(data.info.lat, data.info.lng);
}else{ //退用navigator
console.log("api fail")
if (navigator.geolocation){ //支持获取地理位置
console.log("navigator")
navigator.geolocation.getCurrentPosition(function(position){
console.log("navigator", position);
successCallback(position.coords.latitude, position.coords.longitude);
}, errCallback);
}else{ //不支持获取地理位置
reject(["不支持获取地理位置", navigator.geolocation])
}
}
});
}
});
}
$(".more > .time-position > button").click(async function(){
let res = [];
try{
res = await getGeolocationPosition();
if (res && res[0]){
$(".more > .time-position > button > p").html( res[0] );
}
}catch(err){
if (res && res[0]){
console.error( res[1] );
$(".more > .time-position > button > p").html( res[0] )
}
}
});
//type
$(`.more > .type > input[name='forest'],
.more > .type > input[name='grassland'],
.more > .type > input[name='desert']`).on("change", function(){
for (let i=0; i<100; i++){
let sum = +( $(".more > .type > input[name='forest'][type='range']").val() )+
+( $(".more > .type > input[name='grassland'][type='range']").val() )+
+( $(".more > .type > input[name='desert'][type='range']").val() );
sum = Math.round(sum*10e5)/10e5;
$(".more > .type > input[name='forest']").val( $(".more > .type > input[name='forest'][type='range']").val()/sum );
$(".more > .type > input[name='grassland']").val( $(".more > .type > input[name='grassland'][type='range']").val()/sum );
$(".more > .type > input[name='desert']").val( $(".more > .type > input[name='desert'][type='range']").val()/sum );
}
$(".more > .type > input[name='forest']:not([type='range'])").val( $(".more > .type > input[name='forest'][type='range']").val() );
$(".more > .type > input[name='grassland']:not([type='range'])").val( $(".more > .type > input[name='grassland'][type='range']").val() );
$(".more > .type > input[name='desert']:not([type='range'])").val( $(".more > .type > input[name='desert'][type='range']").val() );
});
//浏览器打开
$("a.newTable").click(function(){
if (typeof plus == "undefined"){
window.open( this.href );
}else{
plus.runtime.openURL( this.href );
}
});
//打开页面
function open(url="main.html"){
const msg = $("<dialog>加载中……</dialog>");
$(document.body).append(
msg.attr("open", "true").hide()
);
msg.fadeIn("fast");
console.log(url)
location.href = url;
return false;
}
//已有存档
if (localStorage.getItem("我的世界_seed") !== null){
$(".init > button:eq(0)")[0].innerHTML = "开始游戏<p>START PLAYING</p>"
$(".init > button:eq(0)")[0].onclick = ()=>open();
}else{ //无存档
getGeolocationPosition();
}
//新的世界
$(".init > button:eq(0)")[0].onclick = function(){
console.log("new_world", $(".init").css("display"), $(".new_world").css("display"), $("button").attr("disabled"));
$("button").attr("disabled", "true");
$(".init")
.css("left", "0%")
.css("opacity", "1")
.animate({
left: (Math.random(0,1,0)?"-":"") + "100%", //正负100%
opacity: 0
}, 1000, ()=>{
$(".init").css("display", "none");
$("button").removeAttr("disabled");
console.log("new_world", "animate end", $(".init").css("display"), $(".new_world").css("display"), $("button").attr("disabled"));
});
$(".new_world")
.css("top", (Math.random(0,1,0)?"-":"") + "100%") //正负100%
.css("opacity", "0")
.css("display", "block")
.animate({
top: "0%",
opacity: 1
}, 1000);
$(".more").removeAttr("open");
console.log("new_world", "animate start", $(".init").css("display"), $(".new_world").css("display"), $("button").attr("disabled"));
};
//已有存档
if (localStorage.getItem("我的世界_seed") !== null){
$(".init > button:eq(0)")[0].innerHTML = "开始游戏<p>START PLAYING</p>"
$(".init > button:eq(0)")[0].onclick = ()=>open();
}else{ //无存档
getGeolocationPosition();
}
//新的世界 取消
$(".new_world > button:eq(0)").click(function(){
console.log("init", $(".init").css("display"), $(".new_world").css("display"), $("button").attr("disabled"));
$("button").attr("disabled", "true");
$(".init")
.css("left", (Math.random(0,1,0)?"-":"") + "100%") //正负100%
.css("opacity", "0")
.css("display", "flex")
.animate({
left: "0%",
opacity: 1
}, 1000);
$(".new_world")
.css("top", "0%")
.css("opacity", "1")
.animate({
top: (Math.random(0,1,0)?"-":"") + "100%", //正负100%
opacity: 0
}, 1000, ()=>{
$(".new_world").css("display", "none");
$("button").removeAttr("disabled");
console.log("init", "animate end", $(".init").css("display"), $(".new_world").css("display"), $("button").attr("disabled"));
});
$(".more").removeAttr("open");
console.log("init", "animate start", $(".init").css("display"), $(".new_world").css("display"), $("button").attr("disabled"));
});
//关于
$(".init > button:eq(1)").click(function(){
console.log("about", $(".init").css("display"), $(".about").css("display"), $("button").attr("disabled"));
$("button").attr("disabled", "true");
$(".init")
.css("left", "0%")
.css("opacity", "1")
.animate({
left: (Math.random(0,1,0)?"-":"") + "100%", //正负100%
opacity: 0
}, 1000, ()=>{
$(".init").css("display", "none");
$("button").removeAttr("disabled");
console.log("about", "animate end", $(".init").css("display"), $(".about").css("display"), $("button").attr("disabled"));
});
$(".about")
.css("top", (Math.random(0,1,0)?"-":"") + "100%") //正负100%
.css("opacity", "0")
.css("display", "block")
.animate({
top: "0%",
opacity: 1
}, 1000);
console.log("about", "animate start", $(".init").css("display"), $(".about").css("display"), $("button").attr("disabled"));
/*try{
plus.screen.lockOrientation("portrait-primary");
}catch(err){}
// window.open("https://wzh656.github.io/MinecraftWeb/", "newwin", "height=366, width=666, toolbar=no, menubar=no, location=no");
open("https://wzh656.github.io/MinecraftWeb/")*/
});
//关于 取消
$(".about > center > button:eq(0)").click(function(){
console.log("init", $(".init").css("display"), $(".about").css("display"), $("button").attr("disabled"));
$("button").attr("disabled", "true");
$(".init")
.css("left", (Math.random(0,1,0)?"-":"") + "100%") //正负100%
.css("opacity", "0")
.css("display", "flex")
.animate({
left: "0%",
opacity: 1
}, 1000);
$(".about")
.css("top", "0%")
.css("opacity", "1")
.animate({
top: (Math.random(0,1,0)?"-":"") + "100%", //正负100%
opacity: 0
}, 1000, ()=>{
$(".about").css("display", "none");
$("button").removeAttr("disabled");
console.log("init", "animate end", $(".init").css("display"), $(".about").css("display"), $("button").attr("disabled"));
});
$(".more").removeAttr("open");
console.log("init", "animate start", $(".init").css("display"), $(".about").css("display"), $("button").attr("disabled"));
});
//生成世界
$(".new_world > button:eq(1)").click(function(){
const
time = +inputValueToDate( $(".more > .time-position > input[name='time']").val() )
position = {
latitude: +$(".more > .time-position > input[name='latitude']").val(),
longitude: +$(".more > .time-position > input[name='longitude']").val()
},
height = {
min: +$(".more > .height > [name='min']").val(),
max: +$(".more > .height > [name='max']").val(),
q: +$(".more > .height > [name='q']").val(),
error:{
min: +$(".more > .height > .error > [name='min']").val(),
max: +$(".more > .height > .error > [name='max']").val(),
q: +$(".more > .height > .error > [name='q']").val()
}
},
dirt = {
min: +$(".more > .dirt > [name='min']").val(),
max: +$(".more > .dirt > [name='max']").val(),
q: +$(".more > .dirt > [name='q']").val(),
error:{
min: +$(".more > .dirt > .error > [name='min']").val(),
max: +$(".more > .dirt > .error > [name='max']").val(),
q: +$(".more > .dirt > .error > [name='q']").val()
}
},
type = {
foreset: +$(".more > .type > [name='foreset']").val(),
grassland: +$(".more > .type > [name='grassland']").val(),
desert: +$(".more > .type > [name='desert']").val(),
q: +$(".more > .type > [name='q']").val()
},
treeHeight = {
plant:{
min: +$(".more > .treeHeight > .plant > [name='min']").val(),
max: +$(".more > .treeHeight > .plant > [name='max']").val()
},
min: +$(".more > .treeHeight > [name='min']").val(),
max: +$(".more > .treeHeight > [name='max']").val(),
q: +$(".more > .treeHeight > [name='q']").val(),
error:{
min: +$(".more > .treeHeight > .error > [name='min']").val(),
max: +$(".more > .treeHeight > .error > [name='max']").val(),
q: +$(".more > .treeHeight > .error > [name='q']").val()
}
},
leavesScale = {
min: +$(".more > .leavesScale > [name='min']").val(),
max: +$(".more > .leavesScale > [name='max']").val(),
q: +$(".more > .leavesScale > [name='q']").val(),
error:{
min: +$(".more > .leavesScale > .error > [name='min']").val(),
max: +$(".more > .leavesScale > .error > [name='max']").val(),
q: +$(".more > .leavesScale > .error > [name='q']").val()
}
},
openStone = {
min: +$(".more > .openStone > [name='min']").val(),
max: +$(".more > .openStone > [name='max']").val(),
q: +$(".more > .openStone > [name='q']").val()
},
weatherRain = {
min: +$(".more > .weatherRain > [name='min']").val(),
max: +$(".more > .weatherRain > [name='max']").val(),
q: +$(".more > .weatherRain > [name='q']").val(),
error:{
min: +$(".more > .weatherRain > .error > [name='min']").val(),
max: +$(".more > .weatherRain > .error > [name='max']").val(),
q: +$(".more > .weatherRain > .error > [name='q']").val()
}
};
let seed;
if ($("[name='seed']").val() === ""){ //随机种子
seed = Math.random().toString(36).substring(2);
}else{
seed = $("[name='seed']").val();
}
localStorage.setItem("我的世界_seed", seed);
localStorage.setItem("我的世界_time", time);
localStorage.setItem("我的世界_position", JSON.stringify(position));
localStorage.setItem("我的世界_height", JSON.stringify(height));
localStorage.setItem("我的世界_dirt", JSON.stringify(dirt));
localStorage.setItem("我的世界_type", JSON.stringify(type));
localStorage.setItem("我的世界_treeHeight", JSON.stringify(treeHeight));
localStorage.setItem("我的世界_leavesScale", JSON.stringify(leavesScale));
localStorage.setItem("我的世界_openStone", JSON.stringify(openStone));
localStorage.setItem("我的世界_weatherRain", JSON.stringify(weatherRain));
open();
});
//双击
$("h1").on("dblclick",function(){
for (let i=0; i<36*Math.random()+36; i++){
$(".init").animate({
left: (Math.random()*6-3)+"%",
top: (Math.random()*6-3)+"%",
opacity: 1
},10);
}
$(".init").animate({
left: "0%",
top: "0%",
opacity: 1
},10);
});
$("h2").on("dblclick",function(){
for (let i=0; i<36*Math.random()+36; i++){
$(".new_world").animate({
left: (Math.random()*6-3)+"%",
top: (Math.random()*6-3)+"%",
opacity: 1
},10);
}
$(".new_world").animate({
left: "0%",
top: "0%",
opacity: 1
},10);
});
//防止滑动
/*$("*").attr("tabindex","-1");
setInterval(function(){
window.scrollTo(0, 0);
},0);
document.onkeydown = function(e){
if (e.keyCode == 9){ //Tab
if (e.preventDefault){
e.preventDefault();
}else{
e.returnValue = false;
}
}
}*/
</script>
</body>
</html>
1
https://gitee.com/jason-bowen-zheng/MinecraftWeb.git
git@gitee.com:jason-bowen-zheng/MinecraftWeb.git
jason-bowen-zheng
MinecraftWeb
MinecraftWeb
master

搜索帮助