Compare commits
7
Commits
master
...
5adb24c8c0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5adb24c8c0 | ||
|
|
a4024587a3 | ||
|
|
28660eca14 | ||
|
|
a4962572a8 | ||
|
|
3159f684c7 | ||
|
|
b0d219b36e | ||
|
|
6fa04d3bad |
No files matched your search
@@ -1,7 +1,28 @@
|
||||
# RU
|
||||
|
||||
Это хранилище МИРА, модульной платформы.
|
||||
МУРОМ:
|
||||
|
||||
* является редактором игр
|
||||
* исполняется в веб-браузере
|
||||
* использует [МОТОР][motor] для отображения 3D
|
||||
* долговечен, доступен, независим
|
||||
* выпущен под лицензией [CC0][cc0] (общественное достояние)
|
||||
|
||||
Подробности на [http://opengamestudio.org/murom][murom-ru].
|
||||
|
||||
# EN
|
||||
|
||||
This is the repository of MIR, a modular platform.
|
||||
MUROM:
|
||||
|
||||
* is a game editor
|
||||
* runs in your web browser
|
||||
* uses [MOTOR][motor] to render 3D
|
||||
* is durable, accessible, independent
|
||||
* is released under [CC0][cc0] license (public domain)
|
||||
|
||||
Read more at [http://opengamestudio.org/murom][murom].
|
||||
|
||||
[murom]: http://opengamestudio.org/murom
|
||||
[murom-ru]: http://opengamestudio.org/murom/ru
|
||||
[motor]: http://bitbucket.com/ogstudio/motor
|
||||
[cc0]: https://creativecommons.org/share-your-work/public-domain/cc0/
|
||||
@@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head>
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,174 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<meta charset="utf-8">
|
||||
<head>
|
||||
<style>
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
/*
|
||||
localForage -- Offline Storage, Improved
|
||||
Version 1.7.3
|
||||
https://localforage.github.io/localForage
|
||||
(c) 2013-2017 Mozilla, Apache License 2.0
|
||||
*/
|
||||
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.localforage=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c||a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){(function(a){"use strict";function c(){k=!0;for(var a,b,c=l.length;c;){for(b=l,l=[],a=-1;++a<c;)b[a]();c=l.length}k=!1}function d(a){1!==l.push(a)||k||e()}var e,f=a.MutationObserver||a.WebKitMutationObserver;if(f){var g=0,h=new f(c),i=a.document.createTextNode("");h.observe(i,{characterData:!0}),e=function(){i.data=g=++g%2}}else if(a.setImmediate||void 0===a.MessageChannel)e="document"in a&&"onreadystatechange"in a.document.createElement("script")?function(){var b=a.document.createElement("script");b.onreadystatechange=function(){c(),b.onreadystatechange=null,b.parentNode.removeChild(b),b=null},a.document.documentElement.appendChild(b)}:function(){setTimeout(c,0)};else{var j=new a.MessageChannel;j.port1.onmessage=c,e=function(){j.port2.postMessage(0)}}var k,l=[];b.exports=d}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(a,b,c){"use strict";function d(){}function e(a){if("function"!=typeof a)throw new TypeError("resolver must be a function");this.state=s,this.queue=[],this.outcome=void 0,a!==d&&i(this,a)}function f(a,b,c){this.promise=a,"function"==typeof b&&(this.onFulfilled=b,this.callFulfilled=this.otherCallFulfilled),"function"==typeof c&&(this.onRejected=c,this.callRejected=this.otherCallRejected)}function g(a,b,c){o(function(){var d;try{d=b(c)}catch(b){return p.reject(a,b)}d===a?p.reject(a,new TypeError("Cannot resolve promise with itself")):p.resolve(a,d)})}function h(a){var b=a&&a.then;if(a&&("object"==typeof a||"function"==typeof a)&&"function"==typeof b)return function(){b.apply(a,arguments)}}function i(a,b){function c(b){f||(f=!0,p.reject(a,b))}function d(b){f||(f=!0,p.resolve(a,b))}function e(){b(d,c)}var f=!1,g=j(e);"error"===g.status&&c(g.value)}function j(a,b){var c={};try{c.value=a(b),c.status="success"}catch(a){c.status="error",c.value=a}return c}function k(a){return a instanceof this?a:p.resolve(new this(d),a)}function l(a){var b=new this(d);return p.reject(b,a)}function m(a){function b(a,b){function d(a){g[b]=a,++h!==e||f||(f=!0,p.resolve(j,g))}c.resolve(a).then(d,function(a){f||(f=!0,p.reject(j,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=new Array(e),h=0,i=-1,j=new this(d);++i<e;)b(a[i],i);return j}function n(a){function b(a){c.resolve(a).then(function(a){f||(f=!0,p.resolve(h,a))},function(a){f||(f=!0,p.reject(h,a))})}var c=this;if("[object Array]"!==Object.prototype.toString.call(a))return this.reject(new TypeError("must be an array"));var e=a.length,f=!1;if(!e)return this.resolve([]);for(var g=-1,h=new this(d);++g<e;)b(a[g]);return h}var o=a(1),p={},q=["REJECTED"],r=["FULFILLED"],s=["PENDING"];b.exports=e,e.prototype.catch=function(a){return this.then(null,a)},e.prototype.then=function(a,b){if("function"!=typeof a&&this.state===r||"function"!=typeof b&&this.state===q)return this;var c=new this.constructor(d);if(this.state!==s){g(c,this.state===r?a:b,this.outcome)}else this.queue.push(new f(c,a,b));return c},f.prototype.callFulfilled=function(a){p.resolve(this.promise,a)},f.prototype.otherCallFulfilled=function(a){g(this.promise,this.onFulfilled,a)},f.prototype.callRejected=function(a){p.reject(this.promise,a)},f.prototype.otherCallRejected=function(a){g(this.promise,this.onRejected,a)},p.resolve=function(a,b){var c=j(h,b);if("error"===c.status)return p.reject(a,c.value);var d=c.value;if(d)i(a,d);else{a.state=r,a.outcome=b;for(var e=-1,f=a.queue.length;++e<f;)a.queue[e].callFulfilled(b)}return a},p.reject=function(a,b){a.state=q,a.outcome=b;for(var c=-1,d=a.queue.length;++c<d;)a.queue[c].callRejected(b);return a},e.resolve=k,e.reject=l,e.all=m,e.race=n},{1:1}],3:[function(a,b,c){(function(b){"use strict";"function"!=typeof b.Promise&&(b.Promise=a(2))}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(a,b,c){"use strict";function d(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function e(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;iLine truncated
|
||||
</script>
|
||||
<script>
|
||||
/*
|
||||
https://github.com/solderjs/TextEncoderLite
|
||||
Apache 2.0
|
||||
*/
|
||||
function TextEncoderLite(){}function TextDecoderLite(){}(function(){"use strict";function utf8ToBytes(string,units){units=units||Infinity;var codePoint;var length=string.length;var leadSurrogate=null;var bytes=[];var i=0;for(;i<length;i++){codePoint=string.charCodeAt(i);if(codePoint>55295&&codePoint<57344){if(leadSurrogate){if(codePoint<56320){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=codePoint;continue}else{codePoint=leadSurrogate-55296<<10|codePoint-56320|65536;leadSurrogate=null}}else{if(codePoint>56319){if((units-=3)>-1)bytes.push(239,191,189);continue}else if(i+1===length){if((units-=3)>-1)bytes.push(239,191,189);continue}else{leadSurrogate=codePoint;continue}}}else if(leadSurrogate){if((units-=3)>-1)bytes.push(239,191,189);leadSurrogate=null}if(codePoint<128){if((units-=1)<0)break;bytes.push(codePoint)}else if(codePoint<2048){if((units-=2)<0)break;bytes.push(codePoint>>6|192,codePoint&63|128)}else if(codePoint<65536){if((units-=3)<0)break;bytes.push(codePoint>>12|224,codePoint>>6&63|128,codePoint&63|128)}else if(codePoint<2097152){if((units-=4)<0)break;bytes.push(codePoint>>18|240,codePoint>>12&63|128,codePoint>>6&63|128,codePoint&63|128)}else{throw new Error("Invalid code point")}}return bytes}function utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end||Infinity);start=start||0;for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}TextEncoderLite.prototype.encode=function(str){var result;if("undefined"===typeof Uint8Array){result=utf8ToBytes(str)}else{result=new Uint8Array(utf8ToBytes(str))}return result};TextDecoderLite.prototype.decode=function(bytes){return utf8Slice(bytes,0,bytes.length)}})();if(typeof module==="object"&&module){module.exports.TextDecoderLite=TextDecoderLite;module.exports.TextEncoderLite=TextEncoderLite}
|
||||
</script>
|
||||
<script>
|
||||
/*
|
||||
https://github.com/beatgammit/base64-js
|
||||
MIT
|
||||
*/
|
||||
(function(r){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=r()}else if(typeof define==="function"&&define.amd){define([],r)}else{var e;if(typeof window!=="undefined"){e=window}else if(typeof global!=="undefined"){e=global}else if(typeof self!=="undefined"){e=self}else{e=this}e.base64js=r()}})(function(){var r,e,n;return function(){function r(e,n,t){function o(f,i){if(!n[f]){if(!e[f]){var u="function"==typeof require&&require;if(!i&&u)return u(f,!0);if(a)return a(f,!0);var v=new Error("Cannot find module '"+f+"'");throw v.code="MODULE_NOT_FOUND",v}var d=n[f]={exports:{}};e[f][0].call(d.exports,function(r){var n=e[f][1][r];return o(n||r)},d,d.exports,r,e,n,t)}return n[f].exports}for(var a="function"==typeof require&&require,f=0;f<t.length;f++)o(t[f]);return o}return r}()({"/":[function(r,e,n){"use strict";n.byteLength=d;n.toByteArray=h;n.fromByteArray=p;var t=[];var o=[];var a=typeof Uint8Array!=="undefined"?Uint8Array:Array;var f="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var i=0,u=f.length;i<u;++i){t[i]=f[i];o[f.charCodeAt(i)]=i}o["-".charCodeAt(0)]=62;o["_".charCodeAt(0)]=63;function v(r){var e=r.length;if(e%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var n=r.indexOf("=");if(n===-1)n=e;var t=n===e?0:4-n%4;return[n,t]}function d(r){var e=v(r);var n=e[0];var t=e[1];return(n+t)*3/4-t}function c(r,e,n){return(e+n)*3/4-n}function h(r){var e;var n=v(r);var t=n[0];var f=n[1];var i=new a(c(r,t,f));var u=0;var d=f>0?t-4:t;for(var h=0;h<d;h+=4){e=o[r.charCodeAt(h)]<<18|o[r.charCodeAt(h+1)]<<12|o[r.charCodeAt(h+2)]<<6|o[r.charCodeAt(h+3)];i[u++]=e>>16&255;i[u++]=e>>8&255;i[u++]=e&255}if(f===2){e=o[r.charCodeAt(h)]<<2|o[r.charCodeAt(h+1)]>>4;i[u++]=e&255}if(f===1){e=o[r.charCodeAt(h)]<<10|o[r.charCodeAt(h+1)]<<4|o[r.charCodeAt(h+2)]>>2;i[u++]=e>>8&255;i[u++]=e&255}return i}function s(r){return t[r>>18&63]+t[r>>12&63]+t[r>>6&63]+t[r&63]}function l(r,e,n){var t;var o=[];for(var a=e;a<n;a+=3){t=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255);o.push(s(t))}return o.join("")}function p(r){var e;var n=r.length;var o=n%3;var a=[];var f=16383;for(var i=0,u=n-o;i<u;i+=f){a.push(l(r,i,i+f>u?u:i+f))}if(o===1){e=r[n-1];a.push(t[e>>2]+t[e<<4&63]+"==")}else if(o===2){e=(r[n-2]<<8)+r[n-1];a.push(t[e>>10]+t[e>>4&63]+t[e<<2&63]+"=")}return a.join("")}},{}]},{},[])("/")});
|
||||
</script>
|
||||
<script>
|
||||
/*
|
||||
https://developer.mozilla.org/ru/docs/Web/API/WindowBase64/Base64_encoding_and_decoding
|
||||
*/
|
||||
function base64Encode(str)
|
||||
{
|
||||
var bytes = new (TextEncoder || TextEncoderLite)("utf-8").encode(str);
|
||||
return base64js.fromByteArray(bytes);
|
||||
}
|
||||
function base64Decode(str)
|
||||
{
|
||||
var bytes = base64js.toByteArray(str);
|
||||
return new (TextDecoder || TextDecoderLite)("utf-8").decode(bytes);
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
// Create GUID / UUID in JavaScript?
|
||||
// https://stackoverflow.com/a/2117523
|
||||
function generateUUID()
|
||||
{
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
|
||||
/[xy]/g,
|
||||
function(c)
|
||||
{
|
||||
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// ReporterSubscription class.
|
||||
function ReporterSubscription(id, callback, reporter)
|
||||
{
|
||||
this.id = id;
|
||||
this.callback = callback;
|
||||
this.reporter = reporter;
|
||||
}
|
||||
|
||||
// Reporter class.
|
||||
function Reporter(name)
|
||||
{
|
||||
this.name =
|
||||
(typeof name !== "undefined") ?
|
||||
name :
|
||||
"";
|
||||
this.subscriptions = [];
|
||||
}
|
||||
Reporter.prototype.report = function()
|
||||
{
|
||||
for (var id in this.subscriptions)
|
||||
{
|
||||
var subscription = this.subscriptions[id];
|
||||
subscription.callback();
|
||||
}
|
||||
}
|
||||
Reporter.prototype.subscribe = function(callback)
|
||||
{
|
||||
var id = generateUUID();
|
||||
var subscription = new ReporterSubscription(id, callback, this);
|
||||
this.subscriptions.push(subscription);
|
||||
return subscription;
|
||||
}
|
||||
Reporter.prototype.subscribeMany = function(funcs)
|
||||
{
|
||||
for (var i = 0; i < funcs.length; ++i)
|
||||
{
|
||||
var func = funcs[i];
|
||||
this.subscribe(func);
|
||||
}
|
||||
}
|
||||
|
||||
var Уведомитель = Reporter;
|
||||
Reporter.prototype.уведомить = function()
|
||||
{
|
||||
this.report();
|
||||
};
|
||||
Reporter.prototype.подписать = function(функция)
|
||||
{
|
||||
this.subscribe(функция);
|
||||
};
|
||||
Reporter.prototype.подписатьМного = function(funcs)
|
||||
{
|
||||
this.subscribeMany(funcs);
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
var муром = {};
|
||||
муром.старт = new Уведомитель();
|
||||
var murom = муром;
|
||||
murom.start = муром.старт;
|
||||
</script>
|
||||
<script>
|
||||
var компоненты = [
|
||||
|
||||
[
|
||||
"пуск",
|
||||
"ZnVuY3Rpb24g0LzRg9GA0L7QvNCh0YLQsNGA0YIoKQp7CiAgICDQvNGD0YDQvtC8LtGB0YLQsNGA0YIuc3Vic2NyaWJlKGZ1bmN0aW9uKCl7CiAgICAgICAgY29uc29sZS5sb2coItCf0KPQodCaINCX0LDQv9GD0YnQtdC9Iik7CiAgICB9KTsKICAgIGNvbnNvbGUubG9nKCLQn9Cj0KHQmiDQl9Cw0LPRgNGD0LbQtdC9Iik7Cn07",
|
||||
],
|
||||
|
||||
[
|
||||
"start",
|
||||
"ZnVuY3Rpb24g0LzRg9GA0L7QvNCh0YLQsNGA0YIoKQp7CiAgICBtdXJvbS5zdGFydC5zdWJzY3JpYmUoZnVuY3Rpb24oKXsKICAgICAgICBjb25zb2xlLmxvZygiU1RBUlQgU3RhcnRlZCIpOwogICAgfSk7CiAgICBjb25zb2xlLmxvZygiU1RBUlQgTG9hZGVkIik7Cn07",
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
// Загрузка переопределений компонент.
|
||||
|
||||
localforage.config({ name: "murom" });
|
||||
var обработанаКомпонента = new Уведомитель();
|
||||
for (var номер in компоненты)
|
||||
{
|
||||
const компонент = компоненты[номер];
|
||||
const имя = компонент[0];
|
||||
localforage.getItem(имя, function(ошибка, значение) {
|
||||
if (значение)
|
||||
{
|
||||
компонент[1] = значение;
|
||||
}
|
||||
var код = base64Decode(компонент[1]);
|
||||
eval(код);
|
||||
муромСтарт();
|
||||
console.log("обработана компонента");
|
||||
обработанаКомпонента.уведомить();
|
||||
});
|
||||
}
|
||||
|
||||
// Уведомление о пуске.
|
||||
|
||||
var обработано = 0;
|
||||
обработанаКомпонента.подписать(function(){
|
||||
if (++обработано == компоненты.length)
|
||||
{
|
||||
console.log("пуск");
|
||||
муром.старт.уведомить();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//localforage.setItem("пуск", "Y29uc29sZS5sb2coItCf0LXRgNC10L7Qv9GA0LXQtNC10LvRkdC90L3Ri9C5INC30LDQv9GD0YHQuiDQvtGB0YPRidC10YHRgtCy0LvRkdC9Iik7");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user