Merge pull request #103 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2018-04-18 19:32:58 +08:00 committed by GitHub
commit 4bcc12b2d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
56 changed files with 27041 additions and 6196 deletions

View File

@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<MarkdownNavigatorCodeStyleSettings>
<option name="RIGHT_MARGIN" value="72" />
</MarkdownNavigatorCodeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

6
.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>

View File

@ -13,6 +13,7 @@
.CodeMirror-lines { .CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */ padding: 4px 0; /* Vertical padding around content */
} }
.CodeMirror pre { .CodeMirror pre {
padding: 0 4px; /* Horizontal padding of content */ padding: 0 4px; /* Horizontal padding of content */
} }
@ -28,7 +29,10 @@
background-color: #f7f7f7; background-color: #f7f7f7;
white-space: nowrap; white-space: nowrap;
} }
.CodeMirror-linenumbers {}
.CodeMirror-linenumbers {
}
.CodeMirror-linenumber { .CodeMirror-linenumber {
padding: 0 3px 0 5px; padding: 0 3px 0 5px;
min-width: 20px; min-width: 20px;
@ -37,8 +41,13 @@
white-space: nowrap; white-space: nowrap;
} }
.CodeMirror-guttermarker { color: black; } .CodeMirror-guttermarker {
.CodeMirror-guttermarker-subtle { color: #999; } color: black;
}
.CodeMirror-guttermarker-subtle {
color: #999;
}
/* CURSOR */ /* CURSOR */
@ -47,24 +56,29 @@
border-right: none; border-right: none;
width: 0; width: 0;
} }
/* Shown when moving in bi-directional text */ /* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor { .CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver; border-left: 1px solid silver;
} }
.cm-fat-cursor .CodeMirror-cursor { .cm-fat-cursor .CodeMirror-cursor {
width: auto; width: auto;
border: 0 !important; border: 0 !important;
background: #7e7; background: #7e7;
} }
.cm-fat-cursor div.CodeMirror-cursors { .cm-fat-cursor div.CodeMirror-cursors {
z-index: 1; z-index: 1;
} }
.cm-fat-cursor-mark { .cm-fat-cursor-mark {
background-color: rgba(20, 255, 20, 0.5); background-color: rgba(20, 255, 20, 0.5);
-webkit-animation: blink 1.06s steps(1) infinite; -webkit-animation: blink 1.06s steps(1) infinite;
-moz-animation: blink 1.06s steps(1) infinite; -moz-animation: blink 1.06s steps(1) infinite;
animation: blink 1.06s steps(1) infinite; animation: blink 1.06s steps(1) infinite;
} }
.cm-animate-fat-cursor { .cm-animate-fat-cursor {
width: auto; width: auto;
border: 0; border: 0;
@ -73,82 +87,199 @@
animation: blink 1.06s steps(1) infinite; animation: blink 1.06s steps(1) infinite;
background-color: #7e7; background-color: #7e7;
} }
@-moz-keyframes blink { @-moz-keyframes blink {
0% {} 0% {
50% { background-color: transparent; }
100% {}
} }
50% {
background-color: transparent;
}
100% {
}
}
@-webkit-keyframes blink { @-webkit-keyframes blink {
0% {} 0% {
50% { background-color: transparent; }
100% {}
} }
50% {
background-color: transparent;
}
100% {
}
}
@keyframes blink { @keyframes blink {
0% {} 0% {
50% { background-color: transparent; } }
100% {} 50% {
background-color: transparent;
}
100% {
}
} }
/* Can style cursor different in overwrite (non-insert) mode */ /* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror-overwrite .CodeMirror-cursor {} .CodeMirror-overwrite .CodeMirror-cursor {
}
.cm-tab { display: inline-block; text-decoration: inherit; } .cm-tab {
display: inline-block;
text-decoration: inherit;
}
.CodeMirror-rulers { .CodeMirror-rulers {
position: absolute; position: absolute;
left: 0; right: 0; top: -50px; bottom: -20px; left: 0;
right: 0;
top: -50px;
bottom: -20px;
overflow: hidden; overflow: hidden;
} }
.CodeMirror-ruler { .CodeMirror-ruler {
border-left: 1px solid #ccc; border-left: 1px solid #ccc;
top: 0; bottom: 0; top: 0;
bottom: 0;
position: absolute; position: absolute;
} }
/* DEFAULT THEME */ /* DEFAULT THEME */
.cm-s-default .cm-header {color: blue;} .cm-s-default .cm-header {
.cm-s-default .cm-quote {color: #090;} color: blue;
.cm-negative {color: #d44;} }
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;} .cm-s-default .cm-quote {
.cm-em {font-style: italic;} color: #090;
.cm-link {text-decoration: underline;} }
.cm-strikethrough {text-decoration: line-through;}
.cm-negative {
color: #d44;
}
.cm-positive {
color: #292;
}
.cm-header, .cm-strong {
font-weight: bold;
}
.cm-em {
font-style: italic;
}
.cm-link {
text-decoration: underline;
}
.cm-strikethrough {
text-decoration: line-through;
}
.cm-s-default .cm-keyword {
color: #708;
}
.cm-s-default .cm-atom {
color: #219;
}
.cm-s-default .cm-number {
color: #164;
}
.cm-s-default .cm-def {
color: #00f;
}
.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable, .cm-s-default .cm-variable,
.cm-s-default .cm-punctuation, .cm-s-default .cm-punctuation,
.cm-s-default .cm-property, .cm-s-default .cm-property,
.cm-s-default .cm-operator {} .cm-s-default .cm-operator {
.cm-s-default .cm-variable-2 {color: #05a;} }
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}
.cm-s-default .cm-error {color: #f00;} .cm-s-default .cm-variable-2 {
.cm-invalidchar {color: #f00;} color: #05a;
}
.CodeMirror-composing { border-bottom: 2px solid; } .cm-s-default .cm-variable-3, .cm-s-default .cm-type {
color: #085;
}
.cm-s-default .cm-comment {
color: #a50;
}
.cm-s-default .cm-string {
color: #a11;
}
.cm-s-default .cm-string-2 {
color: #f50;
}
.cm-s-default .cm-meta {
color: #555;
}
.cm-s-default .cm-qualifier {
color: #555;
}
.cm-s-default .cm-builtin {
color: #30a;
}
.cm-s-default .cm-bracket {
color: #997;
}
.cm-s-default .cm-tag {
color: #170;
}
.cm-s-default .cm-attribute {
color: #00c;
}
.cm-s-default .cm-hr {
color: #999;
}
.cm-s-default .cm-link {
color: #00c;
}
.cm-s-default .cm-error {
color: #f00;
}
.cm-invalidchar {
color: #f00;
}
.CodeMirror-composing {
border-bottom: 2px solid;
}
/* Default styles for common addons */ /* Default styles for common addons */
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;} div.CodeMirror span.CodeMirror-matchingbracket {
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;} color: #0b0;
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); } }
.CodeMirror-activeline-background {background: #e8f2ff;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {
color: #a22;
}
.CodeMirror-matchingtag {
background: rgba(255, 150, 0, .3);
}
.CodeMirror-activeline-background {
background: #e8f2ff;
}
/* STOP */ /* STOP */
@ -165,12 +296,14 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
overflow: scroll !important; /* Things will break if this is overridden */ overflow: scroll !important; /* Things will break if this is overridden */
/* 30px is the magic margin used to hide the element's real scrollbars */ /* 30px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */ /* See overflow: hidden in .CodeMirror */
margin-bottom: -30px; margin-right: -30px; margin-bottom: -30px;
margin-right: -30px;
padding-bottom: 30px; padding-bottom: 30px;
height: 100%; height: 100%;
outline: none; /* Prevent dragging from highlighting the element */ outline: none; /* Prevent dragging from highlighting the element */
position: relative; position: relative;
} }
.CodeMirror-sizer { .CodeMirror-sizer {
position: relative; position: relative;
border-right: 30px solid transparent; border-right: 30px solid transparent;
@ -184,28 +317,39 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
z-index: 6; z-index: 6;
display: none; display: none;
} }
.CodeMirror-vscrollbar { .CodeMirror-vscrollbar {
right: 0; top: 0; right: 0;
top: 0;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll; overflow-y: scroll;
} }
.CodeMirror-hscrollbar { .CodeMirror-hscrollbar {
bottom: 0; left: 0; bottom: 0;
left: 0;
overflow-y: hidden; overflow-y: hidden;
overflow-x: scroll; overflow-x: scroll;
} }
.CodeMirror-scrollbar-filler { .CodeMirror-scrollbar-filler {
right: 0; bottom: 0; right: 0;
bottom: 0;
} }
.CodeMirror-gutter-filler { .CodeMirror-gutter-filler {
left: 0; bottom: 0; left: 0;
bottom: 0;
} }
.CodeMirror-gutters { .CodeMirror-gutters {
position: absolute; left: 0; top: 0; position: absolute;
left: 0;
top: 0;
min-height: 100%; min-height: 100%;
z-index: 3; z-index: 3;
} }
.CodeMirror-gutter { .CodeMirror-gutter {
white-space: normal; white-space: normal;
height: 100%; height: 100%;
@ -213,32 +357,45 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
vertical-align: top; vertical-align: top;
margin-bottom: -30px; margin-bottom: -30px;
} }
.CodeMirror-gutter-wrapper { .CodeMirror-gutter-wrapper {
position: absolute; position: absolute;
z-index: 4; z-index: 4;
background: none !important; background: none !important;
border: none !important; border: none !important;
} }
.CodeMirror-gutter-background { .CodeMirror-gutter-background {
position: absolute; position: absolute;
top: 0; bottom: 0; top: 0;
bottom: 0;
z-index: 4; z-index: 4;
} }
.CodeMirror-gutter-elt { .CodeMirror-gutter-elt {
position: absolute; position: absolute;
cursor: default; cursor: default;
z-index: 4; z-index: 4;
} }
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent } .CodeMirror-gutter-wrapper ::selection {
background-color: transparent
}
.CodeMirror-gutter-wrapper ::-moz-selection {
background-color: transparent
}
.CodeMirror-lines { .CodeMirror-lines {
cursor: text; cursor: text;
min-height: 1px; /* prevents collapsing before first draw */ min-height: 1px; /* prevents collapsing before first draw */
} }
.CodeMirror pre { .CodeMirror pre {
/* Reset some styles that the rest of the page might have set */ /* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; -moz-border-radius: 0;
-webkit-border-radius: 0;
border-radius: 0;
border-width: 0; border-width: 0;
background: transparent; background: transparent;
font-family: inherit; font-family: inherit;
@ -255,6 +412,7 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
-webkit-font-variant-ligatures: contextual; -webkit-font-variant-ligatures: contextual;
font-variant-ligatures: contextual; font-variant-ligatures: contextual;
} }
.CodeMirror-wrap pre { .CodeMirror-wrap pre {
word-wrap: break-word; word-wrap: break-word;
white-space: pre-wrap; white-space: pre-wrap;
@ -263,7 +421,10 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
.CodeMirror-linebackground { .CodeMirror-linebackground {
position: absolute; position: absolute;
left: 0; right: 0; top: 0; bottom: 0; left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: 0; z-index: 0;
} }
@ -273,9 +434,12 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
padding: 0.1px; /* Force widget margins to stay inside of the container */ padding: 0.1px; /* Force widget margins to stay inside of the container */
} }
.CodeMirror-widget {} .CodeMirror-widget {
}
.CodeMirror-rtl pre { direction: rtl; } .CodeMirror-rtl pre {
direction: rtl;
}
.CodeMirror-code { .CodeMirror-code {
outline: none; outline: none;
@ -303,13 +467,17 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
position: absolute; position: absolute;
pointer-events: none; pointer-events: none;
} }
.CodeMirror-measure pre { position: static; }
.CodeMirror-measure pre {
position: static;
}
div.CodeMirror-cursors { div.CodeMirror-cursors {
visibility: hidden; visibility: hidden;
position: relative; position: relative;
z-index: 3; z-index: 3;
} }
div.CodeMirror-dragcursors { div.CodeMirror-dragcursors {
visibility: visible; visibility: visible;
} }
@ -318,11 +486,25 @@ div.CodeMirror-dragcursors {
visibility: visible; visibility: visible;
} }
.CodeMirror-selected { background: #d9d9d9; } .CodeMirror-selected {
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } background: #d9d9d9;
.CodeMirror-crosshair { cursor: crosshair; } }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } .CodeMirror-focused .CodeMirror-selected {
background: #d7d4f0;
}
.CodeMirror-crosshair {
cursor: crosshair;
}
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection {
background: #d7d4f0;
}
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection {
background: #d7d4f0;
}
.cm-searching { .cm-searching {
background-color: #ffa; background-color: #ffa;
@ -330,7 +512,9 @@ div.CodeMirror-dragcursors {
} }
/* Used to force a border model for a node */ /* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; } .cm-force-border {
padding-right: .1px;
}
@media print { @media print {
/* Hide the cursor when printing */ /* Hide the cursor when printing */
@ -340,7 +524,11 @@ div.CodeMirror-dragcursors {
} }
/* See issue #2901 */ /* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; } .cm-tab-wrap-hack:after {
content: '';
}
/* Help users use markselection to safely style text background */ /* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; } span.CodeMirror-selectedtext {
background: none;
}

View File

@ -36,8 +36,10 @@
// If it's not a 'word-style' token, ignore the token. // If it's not a 'word-style' token, ignore the token.
if (!/^[\w$_]*$/.test(token.string)) { if (!/^[\w$_]*$/.test(token.string)) {
token = {start: cur.ch, end: cur.ch, string: "", state: token.state, token = {
type: token.string == "." ? "property" : null}; start: cur.ch, end: cur.ch, string: "", state: token.state,
type: token.string == "." ? "property" : null
};
} else if (token.end > cur.ch) { } else if (token.end > cur.ch) {
token.end = cur.ch; token.end = cur.ch;
token.string = token.string.slice(0, cur.ch - token.start); token.string = token.string.slice(0, cur.ch - token.start);
@ -52,14 +54,18 @@
if (!context) var context = []; if (!context) var context = [];
context.push(tprop); context.push(tprop);
} }
return {list: getCompletions(token, context, keywords, options), return {
list: getCompletions(token, context, keywords, options),
from: Pos(cur.line, token.start), from: Pos(cur.line, token.start),
to: Pos(cur.line, token.end)}; to: Pos(cur.line, token.end)
};
} }
function javascriptHint(editor, options) { function javascriptHint(editor, options) {
return scriptHint(editor, javascriptKeywords, return scriptHint(editor, javascriptKeywords,
function (e, cur) {return e.getTokenAt(cur);}, function (e, cur) {
return e.getTokenAt(cur);
},
options); options);
}; };
CodeMirror.registerHelper("hint", "javascript", javascriptHint); CodeMirror.registerHelper("hint", "javascript", javascriptHint);
@ -85,6 +91,7 @@
function coffeescriptHint(editor, options) { function coffeescriptHint(editor, options) {
return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options); return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
} }
CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint); CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint);
var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " + var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
@ -108,10 +115,12 @@
function getCompletions(token, context, keywords, options) { function getCompletions(token, context, keywords, options) {
var found = [], start = token.string, global = options && options.globalScope || window; var found = [], start = token.string, global = options && options.globalScope || window;
function maybeAdd(str) { function maybeAdd(str) {
if (str == null || str == undefined) return; if (str == null || str == undefined) return;
if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str); if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
} }
function gatherCompletions(obj) { function gatherCompletions(obj) {
if (typeof obj == "string") forEach(stringProps, maybeAdd); if (typeof obj == "string") forEach(stringProps, maybeAdd);
else if (obj instanceof Array) forEach(arrayProps, maybeAdd); else if (obj instanceof Array) forEach(arrayProps, maybeAdd);

View File

@ -10,6 +10,7 @@
mod(CodeMirror); mod(CodeMirror);
})(function (CodeMirror) { })(function (CodeMirror) {
"use strict"; "use strict";
// declare global: JSHINT // declare global: JSHINT
function validator(text, options) { function validator(text, options) {

View File

@ -31,9 +31,7 @@
} }
.CodeMirror-lint-mark-error { .CodeMirror-lint-mark-error {
background-image: background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==");
url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==")
;
} }
.CodeMirror-lint-mark-warning { .CodeMirror-lint-mark-warning {
@ -69,5 +67,6 @@
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC"); background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: right bottom; background-position: right bottom;
width: 100%; height: 100%; width: 100%;
height: 100%;
} }

View File

@ -23,32 +23,45 @@
tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + "px"; tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + "px";
tt.style.left = (e.clientX + 5) + "px"; tt.style.left = (e.clientX + 5) + "px";
} }
CodeMirror.on(document, "mousemove", position); CodeMirror.on(document, "mousemove", position);
position(e); position(e);
if (tt.style.opacity != null) tt.style.opacity = 1; if (tt.style.opacity != null) tt.style.opacity = 1;
return tt; return tt;
} }
function rm(elt) { function rm(elt) {
if (elt.parentNode) elt.parentNode.removeChild(elt); if (elt.parentNode) elt.parentNode.removeChild(elt);
} }
function hideTooltip(tt) { function hideTooltip(tt) {
if (!tt.parentNode) return; if (!tt.parentNode) return;
if (tt.style.opacity == null) rm(tt); if (tt.style.opacity == null) rm(tt);
tt.style.opacity = 0; tt.style.opacity = 0;
setTimeout(function() { rm(tt); }, 600); setTimeout(function () {
rm(tt);
}, 600);
} }
function showTooltipFor(e, content, node) { function showTooltipFor(e, content, node) {
var tooltip = showTooltip(e, content); var tooltip = showTooltip(e, content);
function hide() { function hide() {
CodeMirror.off(node, "mouseout", hide); CodeMirror.off(node, "mouseout", hide);
if (tooltip) { hideTooltip(tooltip); tooltip = null; } if (tooltip) {
hideTooltip(tooltip);
tooltip = null;
} }
}
var poll = setInterval(function () { var poll = setInterval(function () {
if (tooltip) for (var n = node; ; n = n.parentNode) { if (tooltip) for (var n = node; ; n = n.parentNode) {
if (n && n.nodeType == 11) n = n.host; if (n && n.nodeType == 11) n = n.host;
if (n == document.body) return; if (n == document.body) return;
if (!n) { hide(); break; } if (!n) {
hide();
break;
}
} }
if (!tooltip) return clearInterval(poll); if (!tooltip) return clearInterval(poll);
}, 400); }, 400);
@ -60,7 +73,9 @@
this.options = options; this.options = options;
this.timeout = null; this.timeout = null;
this.hasGutter = hasGutter; this.hasGutter = hasGutter;
this.onMouseOver = function(e) { onMouseOver(cm, e); }; this.onMouseOver = function (e) {
onMouseOver(cm, e);
};
this.waitingFor = 0 this.waitingFor = 0
} }
@ -123,16 +138,20 @@
function lintAsync(cm, getAnnotations, passOptions) { function lintAsync(cm, getAnnotations, passOptions) {
var state = cm.state.lint var state = cm.state.lint
var id = ++state.waitingFor var id = ++state.waitingFor
function abort() { function abort() {
id = -1 id = -1
cm.off("change", abort) cm.off("change", abort)
} }
cm.on("change", abort) cm.on("change", abort)
getAnnotations(cm.getValue(), function (annotations, arg2) { getAnnotations(cm.getValue(), function (annotations, arg2) {
cm.off("change", abort) cm.off("change", abort)
if (state.waitingFor != id) return if (state.waitingFor != id) return
if (arg2 && annotations instanceof CodeMirror) annotations = arg2 if (arg2 && annotations instanceof CodeMirror) annotations = arg2
cm.operation(function() {updateLinting(cm, annotations)}) cm.operation(function () {
updateLinting(cm, annotations)
})
}, passOptions, cm); }, passOptions, cm);
} }
@ -151,9 +170,13 @@
var annotations = getAnnotations(cm.getValue(), passOptions, cm); var annotations = getAnnotations(cm.getValue(), passOptions, cm);
if (!annotations) return; if (!annotations) return;
if (annotations.then) annotations.then(function (issues) { if (annotations.then) annotations.then(function (issues) {
cm.operation(function() {updateLinting(cm, issues)}) cm.operation(function () {
updateLinting(cm, issues)
})
}); });
else cm.operation(function() {updateLinting(cm, annotations)}) else cm.operation(function () {
updateLinting(cm, annotations)
})
} }
} }
@ -196,7 +219,9 @@
var state = cm.state.lint; var state = cm.state.lint;
if (!state) return; if (!state) return;
clearTimeout(state.timeout); clearTimeout(state.timeout);
state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500); state.timeout = setTimeout(function () {
startLinting(cm);
}, state.options.delay || 500);
} }
function popupTooltips(annotations, e) { function popupTooltips(annotations, e) {

View File

@ -56,7 +56,9 @@
this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length; this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
var self = this; var self = this;
cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); }); cm.on("cursorActivity", this.activityFunc = function () {
self.cursorActivity();
});
} }
var requestAnimationFrame = window.requestAnimationFrame || function (fn) { var requestAnimationFrame = window.requestAnimationFrame || function (fn) {
@ -102,7 +104,9 @@
this.close(); this.close();
} else { } else {
var self = this; var self = this;
this.debounce = requestAnimationFrame(function() {self.update();}); this.debounce = requestAnimationFrame(function () {
self.update();
});
if (this.widget) this.widget.disable(); if (this.widget) this.widget.disable();
} }
}, },
@ -153,22 +157,37 @@
function buildKeyMap(completion, handle) { function buildKeyMap(completion, handle) {
var baseMap = { var baseMap = {
Up: function() {handle.moveFocus(-1);}, Up: function () {
Down: function() {handle.moveFocus(1);}, handle.moveFocus(-1);
PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);}, },
PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);}, Down: function () {
Home: function() {handle.setFocus(0);}, handle.moveFocus(1);
End: function() {handle.setFocus(handle.length - 1);}, },
PageUp: function () {
handle.moveFocus(-handle.menuSize() + 1, true);
},
PageDown: function () {
handle.moveFocus(handle.menuSize() - 1, true);
},
Home: function () {
handle.setFocus(0);
},
End: function () {
handle.setFocus(handle.length - 1);
},
Enter: handle.pick, Enter: handle.pick,
Tab: handle.pick, Tab: handle.pick,
Esc: handle.close Esc: handle.close
}; };
var custom = completion.options.customKeys; var custom = completion.options.customKeys;
var ourMap = custom ? {} : baseMap; var ourMap = custom ? {} : baseMap;
function addBinding(key, val) { function addBinding(key, val) {
var bound; var bound;
if (typeof val != "string") if (typeof val != "string")
bound = function(cm) { return val(cm, handle); }; bound = function (cm) {
return val(cm, handle);
};
// This mechanism is deprecated // This mechanism is deprecated
else if (baseMap.hasOwnProperty(val)) else if (baseMap.hasOwnProperty(val))
bound = baseMap[val]; bound = baseMap[val];
@ -176,6 +195,7 @@
bound = val; bound = val;
ourMap[key] = bound; ourMap[key] = bound;
} }
if (custom) if (custom)
for (var key in custom) if (custom.hasOwnProperty(key)) for (var key in custom) if (custom.hasOwnProperty(key))
addBinding(key, custom[key]); addBinding(key, custom[key]);
@ -254,19 +274,35 @@
node.style.paddingRight = cm.display.nativeBarWidth + "px" node.style.paddingRight = cm.display.nativeBarWidth + "px"
cm.addKeyMap(this.keyMap = buildKeyMap(completion, { cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); }, moveFocus: function (n, avoidWrap) {
setFocus: function(n) { widget.changeActive(n); }, widget.changeActive(widget.selectedHint + n, avoidWrap);
menuSize: function() { return widget.screenAmount(); }, },
setFocus: function (n) {
widget.changeActive(n);
},
menuSize: function () {
return widget.screenAmount();
},
length: completions.length, length: completions.length,
close: function() { completion.close(); }, close: function () {
pick: function() { widget.pick(); }, completion.close();
},
pick: function () {
widget.pick();
},
data: data data: data
})); }));
if (completion.options.closeOnUnfocus) { if (completion.options.closeOnUnfocus) {
var closingOnBlur; var closingOnBlur;
cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); }); cm.on("blur", this.onBlur = function () {
cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); }); closingOnBlur = setTimeout(function () {
completion.close();
}, 100);
});
cm.on("focus", this.onFocus = function () {
clearTimeout(closingOnBlur);
});
} }
cm.on("scroll", this.onScroll = function () { cm.on("scroll", this.onScroll = function () {
@ -281,7 +317,10 @@
CodeMirror.on(hints, "dblclick", function (e) { CodeMirror.on(hints, "dblclick", function (e) {
var t = getHintElement(hints, e.target || e.srcElement); var t = getHintElement(hints, e.target || e.srcElement);
if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();} if (t && t.hintId != null) {
widget.changeActive(t.hintId);
widget.pick();
}
}); });
CodeMirror.on(hints, "click", function (e) { CodeMirror.on(hints, "click", function (e) {
@ -293,7 +332,9 @@
}); });
CodeMirror.on(hints, "mousedown", function () { CodeMirror.on(hints, "mousedown", function () {
setTimeout(function(){cm.focus();}, 20); setTimeout(function () {
cm.focus();
}, 20);
}); });
CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]); CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
@ -318,7 +359,11 @@
disable: function () { disable: function () {
this.completion.cm.removeKeyMap(this.keyMap); this.completion.cm.removeKeyMap(this.keyMap);
var widget = this; var widget = this;
this.keyMap = {Enter: function() { widget.picked = true; }}; this.keyMap = {
Enter: function () {
widget.picked = true;
}
};
this.completion.cm.addKeyMap(this.keyMap); this.completion.cm.addKeyMap(this.keyMap);
}, },
@ -371,6 +416,7 @@
if (helpers.length) { if (helpers.length) {
var resolved = function (cm, callback, options) { var resolved = function (cm, callback, options) {
var app = applicableHelpers(cm, helpers); var app = applicableHelpers(cm, helpers);
function run(i) { function run(i) {
if (i == app.length) return callback(null) if (i == app.length) return callback(null)
fetchHints(app[i], cm, options, function (result) { fetchHints(app[i], cm, options, function (result) {
@ -378,17 +424,23 @@
else run(i + 1) else run(i + 1)
}) })
} }
run(0) run(0)
} }
resolved.async = true resolved.async = true
resolved.supportsSelection = true resolved.supportsSelection = true
return resolved return resolved
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) { } else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) } return function (cm) {
return CodeMirror.hint.fromList(cm, {words: words})
}
} else if (CodeMirror.hint.anyword) { } else if (CodeMirror.hint.anyword) {
return function(cm, options) { return CodeMirror.hint.anyword(cm, options) } return function (cm, options) {
return CodeMirror.hint.anyword(cm, options)
}
} else { } else {
return function() {} return function () {
}
} }
} }

View File

@ -177,6 +177,10 @@ action
| animate_s | animate_s
| showImage_0_s | showImage_0_s
| showImage_1_s | showImage_1_s
| animateImage_0_s
| animateImage_1_s
| showGif_0_s
| showGif_1_s
| setFg_0_s | setFg_0_s
| setFg_1_s | setFg_1_s
| setWeather_s | setWeather_s
@ -488,7 +492,7 @@ helpUrl : https://ckcz123.github.io/mota-js/#/event?id=changepos-%e5%bd%93%e5%89
default : [0,0,[['不变',''],['上','up'],['下','down'],['左','left'],['右','right']]] default : [0,0,[['不变',''],['上','up'],['下','down'],['左','left'],['右','right']]]
colour : this.dataColor colour : this.dataColor
DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"'); DirectionEx_List_0 = DirectionEx_List_0 && (', "direction": "'+DirectionEx_List_0+'"');
var code = '{"type": "changePos", "loc": ['+Int_0+','+Int_1+']'+DirectionEx_List_0+'},\n'; var code = '{"type": "changePos", "loc": ['+Number_0+','+Number_1+']'+DirectionEx_List_0+'},\n';
return code; return code;
*/ */
@ -553,7 +557,7 @@ return code;
*/ */
showImage_0_s showImage_0_s
: '显示图片' EvalString '起点像素位置' 'x' Int 'y' Int Newline : '显示图片' EvalString '起点像素位置' 'x' Number 'y' Number Newline
; ;
/* showImage_0_s /* showImage_0_s
@ -561,7 +565,7 @@ tooltip : showImage显示图片
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showimage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showimage%ef%bc%9a%e6%98%be%e7%a4%ba%e5%9b%be%e7%89%87
default : ["bg.jpg",0,0] default : ["bg.jpg",0,0]
colour : this.printColor colour : this.printColor
var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+Int_0+','+Int_1+']},\n'; var code = '{"type": "showImage", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+']},\n';
return code; return code;
*/ */
@ -577,6 +581,57 @@ var code = '{"type": "showImage"},\n';
return code; return code;
*/ */
animateImage_0_s
: '图片淡入' EvalString '起点像素位置' 'x' Number 'y' Number '动画时间' Int Newline
;
/* animateImage_0_s
tooltip : animageImage图片淡入
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=animateimage%ef%bc%9a%e5%9b%be%e7%89%87%e6%b7%a1%e5%85%a5%e6%b7%a1%e5%87%b
default : ["bg.jpg",0,0,500]
colour : this.printColor
var code = '{"type": "animateImage", "action": "show", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+'], "time": '+Int_0+'},\n';
return code;
*/
animateImage_1_s
: '图片淡出' EvalString '起点像素位置' 'x' Number 'y' Number '动画时间' Int Newline
;
/* animateImage_1_s
tooltip : animageImage图片淡出
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=animateimage%ef%bc%9a%e5%9b%be%e7%89%87%e6%b7%a1%e5%85%a5%e6%b7%a1%e5%87%b
default : ["bg.jpg",0,0,500]
colour : this.printColor
var code = '{"type": "animateImage", "action": "hide", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+'], "time": '+Int_0+'},\n';
return code;
*/
showGif_0_s
: '显示动图' EvalString '起点像素位置' 'x' Number 'y' Number Newline
;
/* showGif_0_s
tooltip : showGif显示动图
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showgif%ef%bc%9a%e6%98%be%e7%a4%ba%e5%8a%a8%e5%9b%be
default : ["bg.gif",0,0]
colour : this.printColor
var code = '{"type": "showGif", "name": "'+EvalString_0+'", "loc": ['+Number_0+','+Number_1+']},\n';
return code;
*/
showGif_1_s
: '清除所有动图' Newline
;
/* showGif_1_s
tooltip : showGif清除所有显示的动图
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=showgif%ef%bc%9a%e6%98%be%e7%a4%ba%e5%8a%a8%e5%9b%be
colour : this.printColor
var code = '{"type": "showGif"},\n';
return code;
*/
setFg_0_s setFg_0_s
: '更改画面色调' Number ',' Number ',' Number ',' Number '动画时间' Int? Newline : '更改画面色调' Number ',' Number ',' Number ',' Number '动画时间' Int? Newline
; ;
@ -712,7 +767,7 @@ return code;
*/ */
win_s win_s
: '游戏胜利,原因' ':' EvalString? Newline : '游戏胜利,结局' ':' EvalString? Newline
; ;
/* win_s /* win_s
@ -724,7 +779,7 @@ return code;
*/ */
lose_s lose_s
: '游戏失败,原因' ':' EvalString? Newline : '游戏失败,结局' ':' EvalString? Newline
; ;
/* lose_s /* lose_s
@ -1244,6 +1299,24 @@ ActionParser.prototype.parseAction = function() {
this.next]); this.next]);
} }
break; break;
case "animateImage": // 显示图片
if(data.action == 'show'){
this.next = MotaActionBlocks['animateImage_0_s'].xmlText([
data.name,data.loc[0],data.loc[1],data.time,this.next]);
} else if (data.action == 'hide') {
this.next = MotaActionBlocks['animateImage_1_s'].xmlText([
data.name,data.loc[0],data.loc[1],data.time,this.next]);
}
break;
case "showGif": // 显示动图
if(this.isset(data.name)){
this.next = MotaActionBlocks['showGif_0_s'].xmlText([
data.name,data.loc[0],data.loc[1],this.next]);
} else {
this.next = MotaActionBlocks['showGif_1_s'].xmlText([
this.next]);
}
break;
case "setFg": // 颜色渐变 case "setFg": // 颜色渐变
if(this.isset(data.color)){ if(this.isset(data.color)){
this.next = MotaActionBlocks['setFg_0_s'].xmlText([ this.next = MotaActionBlocks['setFg_0_s'].xmlText([

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,14 @@
html,body,div,img{margin:0;padding:0;} html, body, div, img {
margin: 0;
padding: 0;
}
body { body {
font-family: Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;; font-family: Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;;
background-color: #F5F5F5; background-color: #F5F5F5;
} }
/* ::-webkit-scrollbar { /* ::-webkit-scrollbar {
width: 5px; width: 5px;
} */ } */
@ -12,11 +17,13 @@ body{
min-height: 500px; min-height: 500px;
margin: 0 auto; margin: 0 auto;
} }
#left, #mid, #right { #left, #mid, #right {
border-radius: 2px; border-radius: 2px;
box-sizing: border-box; box-sizing: border-box;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12); box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
} }
#left { #left {
position: absolute; position: absolute;
left: 5px; left: 5px;
@ -34,6 +41,7 @@ body{
/* padding: 10px 5px; */ /* padding: 10px 5px; */
box-sizing: border-box; box-sizing: border-box;
} }
#pout { #pout {
display: block; display: block;
width: 410px; width: 410px;
@ -49,13 +57,15 @@ body{
border-radius: 2px; border-radius: 2px;
overflow: auto; overflow: auto;
} }
#editTip { #editTip {
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 80px; margin-bottom: 120px;
bottom:10px; bottom: 0;
left: 10px; left: 10px;
} }
#editArea p { #editArea p {
margin: 10px; margin: 10px;
display: block; display: block;
@ -64,11 +74,13 @@ body{
text-align: left; text-align: left;
font-size: 14px; font-size: 14px;
} }
#editTip .btn { #editTip .btn {
float: right; float: right;
margin-right: 20px; margin-right: 20px;
margin-top: 5px; margin-top: 5px;
} }
#mid { #mid {
position: absolute; position: absolute;
left: 448px; left: 448px;
@ -76,6 +88,7 @@ body{
width: 440px; width: 440px;
height: 630px; height: 630px;
} }
.map { .map {
position: absolute; position: absolute;
left: 20px; left: 20px;
@ -83,6 +96,7 @@ body{
width: 416px; width: 416px;
height: 416px; height: 416px;
} }
#mid .tools { #mid .tools {
position: absolute; position: absolute;
width: 425px; width: 425px;
@ -94,6 +108,7 @@ body{
margin-left: 8px;; margin-left: 8px;;
box-sizing: border-box; box-sizing: border-box;
} }
#tip { #tip {
float: right; float: right;
width: 50%; width: 50%;
@ -106,12 +121,14 @@ body{
font-size: 15px; font-size: 15px;
line-height: 14px; line-height: 14px;
} }
.files { .files {
width: 50%; width: 50%;
height: 120px; height: 120px;
/* padding: 10px; */ /* padding: 10px; */
margin-top: 15px; margin-top: 15px;
} }
.input { .input {
display: block; display: block;
max-width: 150px; max-width: 150px;
@ -125,21 +142,25 @@ body{
border-radius: 3px; border-radius: 3px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
} }
#bgSelect { #bgSelect {
width: 50%; width: 50%;
height: 100px; height: 100px;
margin-top: 10px; margin-top: 10px;
} }
#bgSelect span { #bgSelect span {
/* display: block; */ /* display: block; */
font-size: 14px; font-size: 14px;
line-height: 30px; line-height: 30px;
} }
#printOut { #printOut {
margin-top: 10px; margin-top: 10px;
height: 20px; height: 20px;
} }
.btn { .btn {
width: 80px; width: 80px;
border-radius: 2px; border-radius: 2px;
@ -164,10 +185,12 @@ body{
color: #fff; color: #fff;
background-color: #26A69A; background-color: #26A69A;
} }
.btn:hover { .btn:hover {
background-color: #009688; background-color: #009688;
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12); box-shadow: 0 2px 2px 0 rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .2), 0 1px 5px 0 rgba(0, 0, 0, .12);
} }
#right { #right {
position: absolute; position: absolute;
left: 900px; left: 900px;
@ -176,6 +199,7 @@ body{
height: 630px; height: 630px;
/* border: 1px solid rgb(238, 13, 13); */ /* border: 1px solid rgb(238, 13, 13); */
} }
#iconLib { #iconLib {
position: absolute; position: absolute;
width: 435px; width: 435px;
@ -184,12 +208,15 @@ body{
top: 5px; top: 5px;
overflow: auto; overflow: auto;
} }
.egameCanvas { .egameCanvas {
position: absolute; position: absolute;
} }
.gameCanvas { .gameCanvas {
position: absolute; position: absolute;
} }
#dataSelection, .appendSelection { #dataSelection, .appendSelection {
position: absolute; position: absolute;
/* top:0; /* top:0;
@ -206,15 +233,18 @@ body{
box-shadow: 0 0 0 2px #fff, box-shadow: 0 0 0 2px #fff,
0 0 0 3px #000; 0 0 0 3px #000;
} }
.warnText { .warnText {
color: #D50000; color: #D50000;
font-weight: 700; font-weight: 700;
font-size: 14px; font-size: 14px;
line-height: 1.2em; line-height: 1.2em;
} }
.infoText { .infoText {
color: #2196F3; color: #2196F3;
} }
.successText { .successText {
color: #00897B; color: #00897B;
line-height: 1.2em; line-height: 1.2em;
@ -225,18 +255,22 @@ table, td {
color: #fff; color: #fff;
cursor: crosshair; cursor: crosshair;
} }
table.col { table.col {
position: relative; position: relative;
text-align: center; text-align: center;
border-collapse: collapse; border-collapse: collapse;
} }
table.col td { table.col td {
background-color: #4DB6AC; background-color: #4DB6AC;
} }
#arrColMark td { #arrColMark td {
width: 16px; width: 16px;
} }
#arrColMark { #arrColMark {
top: 2px; top: 2px;
left: 36px; left: 36px;
@ -244,6 +278,7 @@ table.col td{
height: 16px; height: 16px;
font-size: 13px; font-size: 13px;
} }
#mapColMark { #mapColMark {
top: 2px; top: 2px;
left: 19px; left: 19px;
@ -251,9 +286,11 @@ table.col td{
height: 16px; height: 16px;
font-size: 13px; font-size: 13px;
} }
#mapColMark td { #mapColMark td {
width: 29px; width: 29px;
} }
#mapColMark td:hover .colBlock { #mapColMark td:hover .colBlock {
position: absolute; position: absolute;
top: 19px; top: 19px;
@ -262,15 +299,18 @@ table.col td{
z-index: 100; z-index: 100;
background-color: rgba(38, 166, 154, .5); background-color: rgba(38, 166, 154, .5);
} }
table.row { table.row {
position: relative; position: relative;
text-align: right; text-align: right;
vertical-align: middle; vertical-align: middle;
border-collapse: collapse; border-collapse: collapse;
} }
table.row td { table.row td {
background-color: #4C221B; background-color: #4C221B;
} }
#arrRowMark { #arrRowMark {
top: 5px; top: 5px;
left: 2px; left: 2px;
@ -278,6 +318,7 @@ table.row td{
height: 262px; height: 262px;
font-size: 12px; font-size: 12px;
} }
#mapRowMark { #mapRowMark {
top: 1px; top: 1px;
left: 2px; left: 2px;
@ -285,9 +326,11 @@ table.row td{
height: 416px; height: 416px;
font-size: 12px; font-size: 12px;
} }
#mapRowMark td { #mapRowMark td {
height: 29px; height: 29px;
} }
#mapRowMark td:hover .rowBlock { #mapRowMark td:hover .rowBlock {
position: absolute; position: absolute;
left: 18px; left: 18px;
@ -296,6 +339,7 @@ table.row td{
z-index: 100; z-index: 100;
background-color: rgba(76, 34, 27, .5); background-color: rgba(76, 34, 27, .5);
} }
/* for vue dom */ /* for vue dom */
[v-cloak] { [v-cloak] {
display: none !important; display: none !important;

View File

@ -9,9 +9,18 @@
position: absolute; position: absolute;
height: 630px; height: 630px;
} }
.leftTab > *{margin:2.5px 5px;}
.leftTab > :first-child{margin-top:5px;} .leftTab > * {
.leftTab > :last-child{margin-bottom:5px;} margin: 2.5px 5px;
}
.leftTab > :first-child {
margin-top: 5px;
}
.leftTab > :last-child {
margin-bottom: 5px;
}
.leftTab { .leftTab {
left: 5px; left: 5px;
@ -63,7 +72,12 @@
height: 95%; height: 95%;
width: 35%; width: 35%;
} }
#left6 #codeArea {width: 99.5%; height: 15.4em;overflow:y;/* resize:none; */}
#left6 #codeArea {
width: 99.5%;
height: 15.4em;
overflow: y; /* resize:none; */
}
#left7 { #left7 {
/* height: 440px; width: 375px;float:left; */ /* height: 440px; width: 375px;float:left; */
@ -75,6 +89,7 @@
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
#left7 .CodeMirror { #left7 .CodeMirror {
/* border-top: 1px solid black; /* border-top: 1px solid black;
border-bottom: 1px solid black; */ border-bottom: 1px solid black; */
@ -95,36 +110,54 @@
border-spacing: 0; border-spacing: 0;
border-collapse: collapse; border-collapse: collapse;
} }
.etable table { .etable table {
margin-top: 0; margin-top: 0;
margin-bottom: 16px; margin-bottom: 16px;
} }
.etable table { .etable table {
display: block; display: block;
width: 100%; width: 100%;
overflow: auto; overflow: auto;
} }
.etable table th { .etable table th {
font-weight: 600; font-weight: 600;
} }
.etable table th, .etable table th,
.etable table td { .etable table td {
padding: 6px 13px; padding: 6px 13px;
border: 1px solid #dfe2e5; border: 1px solid #dfe2e5;
} }
.etable table tr { .etable table tr {
background-color: #fff; background-color: #fff;
border-top: 1px solid #c6cbd1; border-top: 1px solid #c6cbd1;
} }
.etable table tr:nth-child(2n) { .etable table tr:nth-child(2n) {
background-color: #f6f8fa; background-color: #f6f8fa;
} }
/* copy end --------------------------------------------- */ /* copy end --------------------------------------------- */
.etable tr {width:100%} .etable tr {
.etable tr > :nth-child(1) {width:20%} width: 100%
.etable tr > :nth-child(2) {width:20%} }
.etable tr > :nth-child(3) {width:60%}
.etable tr > :nth-child(1) {
width: 20%
}
.etable tr > :nth-child(2) {
width: 20%
}
.etable tr > :nth-child(3) {
width: 60%
}
.etable table { .etable table {
overflow: visible; overflow: visible;
@ -188,6 +221,7 @@ div.etableInputDiv {
.etableInputDiv textarea { .etableInputDiv textarea {
resize: none; resize: none;
} }
.etableInputDiv textarea:hover { .etableInputDiv textarea:hover {
margin: -5px; margin: -5px;
} }

View File

@ -12,7 +12,11 @@ editor.prototype.init = function(callback){
editor.reset(function () { editor.reset(function () {
editor.drawMapBg(); editor.drawMapBg();
var mapArray = core.maps.save(core.status.maps, core.status.floorId); var mapArray = core.maps.save(core.status.maps, core.status.floorId);
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[parseInt(v)][0]]]})}); editor.map = mapArray.map(function (v) {
return v.map(function (v) {
return editor.ids[[editor.indexs[parseInt(v)][0]]]
})
});
editor.updateMap(); editor.updateMap();
editor.currentFloorId = core.status.floorId; editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId]; editor.currentFloorData = core.floors[core.status.floorId];
@ -22,9 +26,21 @@ editor.prototype.init = function(callback){
} }
var afterMainInit = function () { var afterMainInit = function () {
core.floors=JSON.parse(JSON.stringify(core.floors,function(k,v){if(v instanceof Function){return v.toString()}else return v})); core.floors = JSON.parse(JSON.stringify(core.floors, function (k, v) {
core.data=JSON.parse(JSON.stringify(core.data,function(k,v){if(v instanceof Function){return v.toString()}else return v})); if (v instanceof Function) {
data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d=JSON.parse(JSON.stringify(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d,function(k,v){if(v instanceof Function){return v.toString()}else return v})); return v.toString()
} else return v
}));
core.data = JSON.parse(JSON.stringify(core.data, function (k, v) {
if (v instanceof Function) {
return v.toString()
} else return v
}));
data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = JSON.parse(JSON.stringify(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d, function (k, v) {
if (v instanceof Function) {
return v.toString()
} else return v
}));
editor.main = main; editor.main = main;
editor.core = core; editor.core = core;
editor.fs = fs; editor.fs = fs;
@ -178,7 +194,11 @@ editor.prototype.drawMapBg = function(img){
} }
editor.prototype.updateMap = function () { editor.prototype.updateMap = function () {
var blocks = main.editor.mapIntoBlocks(editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})}),{'events':{},'changeFloor':{}}); var blocks = main.editor.mapIntoBlocks(editor.map.map(function (v) {
return v.map(function (v) {
return v.idnum || v || 0
})
}), {'events': {}, 'changeFloor': {}});
core.status.thisMap.blocks = blocks; core.status.thisMap.blocks = blocks;
main.editor.updateMap(); main.editor.updateMap();
@ -303,11 +323,19 @@ editor.prototype.updateMap = function(){
} }
editor.prototype.changeFloor = function (floorId, callback) { editor.prototype.changeFloor = function (floorId, callback) {
editor.currentFloorData.map = editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})}); editor.currentFloorData.map = editor.map.map(function (v) {
return v.map(function (v) {
return v.idnum || v || 0
})
});
core.changeFloor(floorId, null, core.firstData.hero.loc, null, function () { core.changeFloor(floorId, null, core.firstData.hero.loc, null, function () {
editor.drawMapBg(); editor.drawMapBg();
var mapArray = core.maps.save(core.status.maps, core.status.floorId); var mapArray = core.maps.save(core.status.maps, core.status.floorId);
editor.map = mapArray.map(function(v){return v.map(function(v){return editor.ids[[editor.indexs[parseInt(v)][0]]]})}); editor.map = mapArray.map(function (v) {
return v.map(function (v) {
return editor.ids[[editor.indexs[parseInt(v)][0]]]
})
});
editor.updateMap(); editor.updateMap();
editor.currentFloorId = core.status.floorId; editor.currentFloorId = core.status.floorId;
editor.currentFloorData = core.floors[core.status.floorId]; editor.currentFloorData = core.floors[core.status.floorId];
@ -324,7 +352,9 @@ editor.prototype.guid = function() {
} }
editor.prototype.HTMLescape = function (str_) { editor.prototype.HTMLescape = function (str_) {
return String(str_).split('').map(function(v){return '&#'+v.charCodeAt(0)+';'}).join(''); return String(str_).split('').map(function (v) {
return '&#' + v.charCodeAt(0) + ';'
}).join('');
} }
editor.prototype.listen = function () { editor.prototype.listen = function () {
@ -344,7 +374,8 @@ editor.prototype.listen = function() {
'y': scrollTop + e.clientY - mid.offsetTop - mapEdit.offsetTop, 'y': scrollTop + e.clientY - mid.offsetTop - mapEdit.offsetTop,
'size': 32 'size': 32
}; };
return editor.loc; }//返回可用的组件内坐标 return editor.loc;
}//返回可用的组件内坐标
function locToPos(loc) { function locToPos(loc) {
editor.pos = {'x': ~~(loc.x / loc.size), 'y': ~~(loc.y / loc.size)} editor.pos = {'x': ~~(loc.x / loc.size), 'y': ~~(loc.y / loc.size)}
@ -355,6 +386,7 @@ editor.prototype.listen = function() {
var stepPostfix = null;//用于存放寻路检测的第一个点之后的后续移动 var stepPostfix = null;//用于存放寻路检测的第一个点之后的后续移动
var mouseOutCheck = 2; var mouseOutCheck = 2;
function clear1() { function clear1() {
if (mouseOutCheck > 1) { if (mouseOutCheck > 1) {
mouseOutCheck--; mouseOutCheck--;
@ -395,7 +427,9 @@ editor.prototype.listen = function() {
return; return;
} }
if (holdingPath == 0) { return; } if (holdingPath == 0) {
return;
}
mouseOutCheck = 2; mouseOutCheck = 2;
e.stopPropagation(); e.stopPropagation();
var loc = eToLoc(e); var loc = eToLoc(e);

View File

@ -62,7 +62,11 @@ initscript=String.raw`
]}), ]}),
MotaActionBlocks['setText_s'].xmlText(), MotaActionBlocks['setText_s'].xmlText(),
MotaActionBlocks['showImage_0_s'].xmlText(), MotaActionBlocks['showImage_0_s'].xmlText(),
MotaActionBlocks['animateImage_0_s'].xmlText(),
MotaActionBlocks['animateImage_1_s'].xmlText(),
MotaActionBlocks['showImage_1_s'].xmlText(), MotaActionBlocks['showImage_1_s'].xmlText(),
MotaActionBlocks['showGif_0_s'].xmlText(),
MotaActionBlocks['showGif_1_s'].xmlText(),
MotaActionBlocks['tip_s'].xmlText(), MotaActionBlocks['tip_s'].xmlText(),
MotaActionBlocks['openShop_s'].xmlText(), MotaActionBlocks['openShop_s'].xmlText(),
MotaActionBlocks['win_s'].xmlText(), MotaActionBlocks['win_s'].xmlText(),
@ -293,7 +297,6 @@ editor_blockly.runOne = function (){
//console.log(converter); //console.log(converter);
var script = document.createElement('script'); var script = document.createElement('script');
//var initscript = document.getElementById('initscript').innerText; //var initscript = document.getElementById('initscript').innerText;
script.innerHTML = converter.mainFile[5] + initscript; script.innerHTML = converter.mainFile[5] + initscript;
@ -346,7 +349,9 @@ editor_blockly.runCode = function () {
editor_blockly.parse = function () { editor_blockly.parse = function () {
MotaActionFunctions.parse( MotaActionFunctions.parse(
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g,function(c){return {'<':'&lt;','>':'&gt;','&':'&amp;'}[c];})), eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g, function (c) {
return {'<': '&lt;', '>': '&gt;', '&': '&amp;'}[c];
})),
document.getElementById('entryType').value document.getElementById('entryType').value
); );
} }
@ -427,7 +432,8 @@ editor_blockly.doubleClickBlock = function (blockId){
var value = b.getFieldValue(f); var value = b.getFieldValue(f);
//多行编辑 //多行编辑
editor_multi.multiLineEdit(value, b, f, {'lint': f === 'RawEvalString_0'}, function (newvalue, b, f) { editor_multi.multiLineEdit(value, b, f, {'lint': f === 'RawEvalString_0'}, function (newvalue, b, f) {
if(textStringDict[b.type]!=='RawEvalString_0'){} if (textStringDict[b.type] !== 'RawEvalString_0') {
}
b.setFieldValue(newvalue.split('\n').join('\\n'), f); b.setFieldValue(newvalue.split('\n').join('\\n'), f);
}); });
} }

View File

@ -20,7 +20,9 @@ editor_file = function(editor, callback){
script.onload = function () { script.onload = function () {
editor_file[value] = eval(key.replace('.', '_') + '_c456ea59_6018_45ef_8bcc_211a24c627dc'); editor_file[value] = eval(key.replace('.', '_') + '_c456ea59_6018_45ef_8bcc_211a24c627dc');
var loaded = Boolean(callback); var loaded = Boolean(callback);
for(var key_ in commentjs){loaded = loaded && editor_file[commentjs[key_]]} for (var key_ in commentjs) {
loaded = loaded && editor_file[commentjs[key_]]
}
if (loaded) callback(); if (loaded) callback();
} }
})(key); })(key);
@ -28,7 +30,11 @@ editor_file = function(editor, callback){
editor_file.getFloorFileList = function (callback) { editor_file.getFloorFileList = function (callback) {
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
/* var fs = editor.fs; /* var fs = editor.fs;
fs.readdir('project/floors',function(err, data){ fs.readdir('project/floors',function(err, data){
callback([data,err]); callback([data,err]);
@ -38,7 +44,11 @@ editor_file = function(editor, callback){
//callback([Array<String>,err:String]) //callback([Array<String>,err:String])
editor_file.loadFloorFile = function (filename, callback) { editor_file.loadFloorFile = function (filename, callback) {
//filename不含'/'不含'.js' //filename不含'/'不含'.js'
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
/* var fs = editor.fs; /* var fs = editor.fs;
fs.readFile('project/floors/'+filename+'.js','utf-8',function(err, data){ fs.readFile('project/floors/'+filename+'.js','utf-8',function(err, data){
if (err!=null){callback(err);return;} if (err!=null){callback(err);return;}
@ -63,13 +73,28 @@ editor_file = function(editor, callback){
} }
//callback(err:String) //callback(err:String)
editor_file.saveFloorFile = function (callback) { editor_file.saveFloorFile = function (callback) {
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
/* if (!isset(editor.currentFloorId) || !isset(editor.currentFloorData)) { /* if (!isset(editor.currentFloorId) || !isset(editor.currentFloorData)) {
callback('未选中文件或无数据'); callback('未选中文件或无数据');
} */ } */
var filename = 'project/floors/' + editor.currentFloorId + '.js'; var filename = 'project/floors/' + editor.currentFloorId + '.js';
var datastr = ['main.floors.', editor.currentFloorId, '=\n{']; var datastr = ['main.floors.', editor.currentFloorId, '=\n{'];
editor.currentFloorData.map = editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})}); if (editor.currentFloorData.map == 'new')
editor.currentFloorData.map = editor.map.map(function (v) {
return v.map(function () {
return 0
})
});
else
editor.currentFloorData.map = editor.map.map(function (v) {
return v.map(function (v) {
return v.idnum || v || 0
})
});
for (var ii in editor.currentFloorData) for (var ii in editor.currentFloorData)
if (editor.currentFloorData.hasOwnProperty(ii)) { if (editor.currentFloorData.hasOwnProperty(ii)) {
if (ii == 'map') if (ii == 'map')
@ -84,16 +109,34 @@ editor_file = function(editor, callback){
}); });
} }
//callback(err:String) //callback(err:String)
editor_file.saveFloorFileAs = function(saveAsFilename,callback){ editor_file.saveNewFile = function (saveFilename, callback) {
//saveAsFilename不含'/'不含'.js' //saveAsFilename不含'/'不含'.js'
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
if (!isset(editor.currentFloorData)) { if (!isset(editor.currentFloorData)) {
callback('无数据'); callback('无数据');
} }
editor.currentFloorData.map = editor.map.map(function(v){return v.map(function(v){return v.idnum||v||0})}); editor.currentFloorData = {
editor.currentFloorData=JSON.parse(JSON.stringify(editor.currentFloorData)); floorId: saveFilename,
editor.currentFloorData.floorId=saveAsFilename; title: "新建楼层",
editor.currentFloorId=saveAsFilename; name: "0",
canFlyTo: true,
canUseQuickShop: true,
images: [],
item_ratio: 1,
firstArrive: [],
events: {},
changeFloor: {},
afterBattle: {},
afterGetItem: {},
afterOpenDoor: {},
cannotMove: {}
};
editor.currentFloorData.map = "new";
editor.currentFloorId = saveFilename;
editor_file.saveFloorFile(callback); editor_file.saveFloorFile(callback);
} }
//callback(err:String) //callback(err:String)
@ -101,7 +144,11 @@ editor_file = function(editor, callback){
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
editor_file.changeIdAndIdnum = function (id, idnum, info, callback) { editor_file.changeIdAndIdnum = function (id, idnum, info, callback) {
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
//检查maps中是否有重复的idnum或id //检查maps中是否有重复的idnum或id
var change = -1; var change = -1;
for (var ii in editor.core.maps.blocksInfo) { for (var ii in editor.core.maps.blocksInfo) {
@ -149,10 +196,20 @@ editor_file = function(editor, callback){
saveSetting('maps', [["add", "['" + idnum + "']", {'cls': info.images, 'id': id}]], tempcallback); saveSetting('maps', [["add", "['" + idnum + "']", {'cls': info.images, 'id': id}]], tempcallback);
saveSetting('icons', [["add", "['" + info.images + "']['" + id + "']", info.y]], tempcallback); saveSetting('icons', [["add", "['" + info.images + "']['" + id + "']", info.y]], tempcallback);
if (info.images === 'items') { if (info.images === 'items') {
saveSetting('items',[["add","['items']['"+id+"']",editor_file.comment._data.items_template]],function(err){if(err){printe(err);throw(err)}}); saveSetting('items', [["add", "['items']['" + id + "']", editor_file.comment._data.items_template]], function (err) {
if (err) {
printe(err);
throw(err)
}
});
} }
if (info.images === 'enemys' || info.images === 'enemy48') { if (info.images === 'enemys' || info.images === 'enemy48') {
saveSetting('enemys',[["add","['"+id+"']",editor_file.comment._data.enemys_template]],function(err){if(err){printe(err);throw(err)}}); saveSetting('enemys', [["add", "['" + id + "']", editor_file.comment._data.enemys_template]], function (err) {
if (err) {
printe(err);
throw(err)
}
});
} }
callback(null); callback(null);
@ -166,7 +223,11 @@ editor_file = function(editor, callback){
] ]
[]时只查询不修改 []时只查询不修改
*/ */
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
if (isset(actionList) && actionList.length > 0) { if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) { actionList.forEach(function (value) {
var tempindex = value[1].indexOf(']') + 1; var tempindex = value[1].indexOf(']') + 1;
@ -229,7 +290,11 @@ editor_file = function(editor, callback){
] ]
[]时只查询不修改 []时只查询不修改
*/ */
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
if (isset(actionList) && actionList.length > 0) { if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) { actionList.forEach(function (value) {
value[1] = "['" + id + "']" + value[1]; value[1] = "['" + id + "']" + value[1];
@ -274,7 +339,11 @@ editor_file = function(editor, callback){
] ]
[]时只查询不修改 []时只查询不修改
*/ */
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
if (isset(actionList) && actionList.length > 0) { if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) { actionList.forEach(function (value) {
value[1] = "['" + idnum + "']" + value[1]; value[1] = "['" + idnum + "']" + value[1];
@ -319,7 +388,11 @@ editor_file = function(editor, callback){
] ]
[]时只查询不修改 []时只查询不修改
*/ */
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
if (isset(actionList) && actionList.length > 0) { if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) { actionList.forEach(function (value) {
value[1] = value[1] + "['" + x + "," + y + "']"; value[1] = value[1] + "['" + x + "," + y + "']";
@ -367,7 +440,11 @@ editor_file = function(editor, callback){
] ]
[]时只查询不修改 []时只查询不修改
*/ */
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
if (isset(actionList) && actionList.length > 0) { if (isset(actionList) && actionList.length > 0) {
saveSetting('floors', actionList, function (err) { saveSetting('floors', actionList, function (err) {
callback([ callback([
@ -420,7 +497,11 @@ editor_file = function(editor, callback){
[]时只查询不修改 []时只查询不修改
*/ */
var data_obj = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d; var data_obj = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d;
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
if (isset(actionList) && actionList.length > 0) { if (isset(actionList) && actionList.length > 0) {
saveSetting('data', actionList, function (err) { saveSetting('data', actionList, function (err) {
callback([ callback([
@ -460,7 +541,13 @@ editor_file = function(editor, callback){
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
var fmap = {}; var fmap = {};
var fjson = JSON.stringify(functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a,function(k,v){if(v instanceof Function){var id_ = editor.guid();fmap[id_]=v.toString();return id_;}else return v},4); var fjson = JSON.stringify(functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a, function (k, v) {
if (v instanceof Function) {
var id_ = editor.guid();
fmap[id_] = v.toString();
return id_;
} else return v
}, 4);
var fobj = JSON.parse(fjson); var fobj = JSON.parse(fjson);
editor_file.functionsMap = fmap; editor_file.functionsMap = fmap;
editor_file.functionsJSON = fjson; editor_file.functionsJSON = fjson;
@ -478,7 +565,11 @@ editor_file = function(editor, callback){
] ]
[]时只查询不修改 []时只查询不修改
*/ */
if (!isset(callback)) {printe('未设置callback');throw('未设置callback')}; if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
;
if (isset(actionList) && actionList.length > 0) { if (isset(actionList) && actionList.length > 0) {
saveSetting('functions', actionList, function (err) { saveSetting('functions', actionList, function (err) {
callback([ callback([
@ -559,7 +650,13 @@ editor_file = function(editor, callback){
//datastr+=JSON.stringify(maps_90f36752_8815_4be8_b32b_d7fad1d0542e,null,4); //datastr+=JSON.stringify(maps_90f36752_8815_4be8_b32b_d7fad1d0542e,null,4);
var emap = {}; var emap = {};
var estr = JSON.stringify(maps_90f36752_8815_4be8_b32b_d7fad1d0542e,function(k,v){if(v.id!=null){var id_ = editor.guid();emap[id_]=JSON.stringify(v);return id_;}else return v},'\t'); var estr = JSON.stringify(maps_90f36752_8815_4be8_b32b_d7fad1d0542e, function (k, v) {
if (v.id != null) {
var id_ = editor.guid();
emap[id_] = JSON.stringify(v);
return id_;
} else return v
}, '\t');
for (var id_ in emap) { for (var id_ in emap) {
estr = estr.replace('"' + id_ + '"', emap[id_]) estr = estr.replace('"' + id_ + '"', emap[id_])
} }
@ -587,7 +684,13 @@ editor_file = function(editor, callback){
}); });
var datastr = 'enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = \n'; var datastr = 'enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = \n';
var emap = {}; var emap = {};
var estr = JSON.stringify(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80,function(k,v){if(v.hp!=null){var id_ = editor.guid();emap[id_]=JSON.stringify(v);return id_;}else return v},'\t'); var estr = JSON.stringify(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80, function (k, v) {
if (v.hp != null) {
var id_ = editor.guid();
emap[id_] = JSON.stringify(v);
return id_;
} else return v
}, '\t');
for (var id_ in emap) { for (var id_ in emap) {
estr = estr.replace('"' + id_ + '"', emap[id_]) estr = estr.replace('"' + id_ + '"', emap[id_])
} }

View File

@ -19,6 +19,7 @@ function editor_mode(){
this.info = {}; this.info = {};
this.appendPic = {}; this.appendPic = {};
} }
editor_mode.prototype.init = function (callback) { editor_mode.prototype.init = function (callback) {
if (Boolean(callback)) callback(); if (Boolean(callback)) callback();
} }
@ -189,29 +190,71 @@ editor_mode.prototype.doActionList = function(mode,actionList){
switch (mode) { switch (mode) {
case 'loc': case 'loc':
editor.file.editLoc(editor_mode.pos.x,editor_mode.pos.y,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editLoc(editor_mode.pos.x, editor_mode.pos.y, actionList, function (objs_) {/*console.log(objs_);*/
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
break; break;
case 'emenyitem': case 'emenyitem':
if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') { if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') {
editor.file.editEnemy(editor_mode.info.id,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editEnemy(editor_mode.info.id, actionList, function (objs_) {/*console.log(objs_);*/
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
} else if (editor_mode.info.images == 'items') { } else if (editor_mode.info.images == 'items') {
editor.file.editItem(editor_mode.info.id,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editItem(editor_mode.info.id, actionList, function (objs_) {/*console.log(objs_);*/
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
} else { } else {
editor.file.editMapBlocksInfo(editor_mode.info.idnum,actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editMapBlocksInfo(editor_mode.info.idnum, actionList, function (objs_) {/*console.log(objs_);*/
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
} }
break; break;
case 'floor': case 'floor':
editor.file.editFloor(actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editFloor(actionList, function (objs_) {/*console.log(objs_);*/
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
break; break;
case 'tower': case 'tower':
editor.file.editTower(actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editTower(actionList, function (objs_) {/*console.log(objs_);*/
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
break; break;
case 'functions': case 'functions':
editor.file.editFunctions(actionList,function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printf('修改成功')}); editor.file.editFunctions(actionList, function (objs_) {/*console.log(objs_);*/
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printf('修改成功')
});
break; break;
default: default:
break; break;
@ -245,7 +288,10 @@ editor_mode.prototype.loc = function(callback){
document.getElementById('pos_a6771a78_a099_417c_828f_0a24851ebfce').innerText = editor_mode.pos.x + ',' + editor_mode.pos.y; document.getElementById('pos_a6771a78_a099_417c_828f_0a24851ebfce').innerText = editor_mode.pos.x + ',' + editor_mode.pos.y;
var objs = []; var objs = [];
editor.file.editLoc(editor_mode.pos.x,editor_mode.pos.y,[],function(objs_){objs=objs_;/*console.log(objs_)*/}); editor.file.editLoc(editor_mode.pos.x, editor_mode.pos.y, [], function (objs_) {
objs = objs_;
/*console.log(objs_)*/
});
//只查询不修改时,内部实现不是异步的,所以可以这么写 //只查询不修改时,内部实现不是异步的,所以可以这么写
var tableinfo = editor_mode.objToTable_(objs[0], objs[1]); var tableinfo = editor_mode.objToTable_(objs[0], objs[1]);
document.getElementById('table_3d846fc4_7644_44d1_aa04_433d266a73df').innerHTML = tableinfo.HTML; document.getElementById('table_3d846fc4_7644_44d1_aa04_433d266a73df').innerHTML = tableinfo.HTML;
@ -269,13 +315,22 @@ editor_mode.prototype.emenyitem = function(callback){
var objs = []; var objs = [];
if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') { if (editor_mode.info.images == 'enemys' || editor_mode.info.images == 'enemy48') {
editor.file.editEnemy(editor_mode.info.id,[],function(objs_){objs=objs_;/*console.log(objs_)*/}); editor.file.editEnemy(editor_mode.info.id, [], function (objs_) {
objs = objs_;
/*console.log(objs_)*/
});
} else if (editor_mode.info.images == 'items') { } else if (editor_mode.info.images == 'items') {
editor.file.editItem(editor_mode.info.id,[],function(objs_){objs=objs_;/*console.log(objs_)*/}); editor.file.editItem(editor_mode.info.id, [], function (objs_) {
objs = objs_;
/*console.log(objs_)*/
});
} else { } else {
/* document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML=''; /* document.getElementById('table_a3f03d4c_55b8_4ef6_b362_b345783acd72').innerHTML='';
return; */ return; */
editor.file.editMapBlocksInfo(editor_mode.info.idnum,[],function(objs_){objs=objs_;/*console.log(objs_)*/}); editor.file.editMapBlocksInfo(editor_mode.info.idnum, [], function (objs_) {
objs = objs_;
/*console.log(objs_)*/
});
} }
//只查询不修改时,内部实现不是异步的,所以可以这么写 //只查询不修改时,内部实现不是异步的,所以可以这么写
var tableinfo = editor_mode.objToTable_(objs[0], objs[1]); var tableinfo = editor_mode.objToTable_(objs[0], objs[1]);
@ -287,7 +342,10 @@ editor_mode.prototype.emenyitem = function(callback){
editor_mode.prototype.floor = function (callback) { editor_mode.prototype.floor = function (callback) {
var objs = []; var objs = [];
editor.file.editFloor([],function(objs_){objs=objs_;/*console.log(objs_)*/}); editor.file.editFloor([], function (objs_) {
objs = objs_;
/*console.log(objs_)*/
});
//只查询不修改时,内部实现不是异步的,所以可以这么写 //只查询不修改时,内部实现不是异步的,所以可以这么写
var tableinfo = editor_mode.objToTable_(objs[0], objs[1]); var tableinfo = editor_mode.objToTable_(objs[0], objs[1]);
document.getElementById('table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74').innerHTML = tableinfo.HTML; document.getElementById('table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74').innerHTML = tableinfo.HTML;
@ -297,7 +355,10 @@ editor_mode.prototype.floor = function(callback){
editor_mode.prototype.tower = function (callback) { editor_mode.prototype.tower = function (callback) {
var objs = []; var objs = [];
editor.file.editTower([],function(objs_){objs=objs_;/*console.log(objs_)*/}); editor.file.editTower([], function (objs_) {
objs = objs_;
/*console.log(objs_)*/
});
//只查询不修改时,内部实现不是异步的,所以可以这么写 //只查询不修改时,内部实现不是异步的,所以可以这么写
var tableinfo = editor_mode.objToTable_(objs[0], objs[1]); var tableinfo = editor_mode.objToTable_(objs[0], objs[1]);
document.getElementById('table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5').innerHTML = tableinfo.HTML; document.getElementById('table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5').innerHTML = tableinfo.HTML;
@ -307,7 +368,10 @@ editor_mode.prototype.tower = function(callback){
editor_mode.prototype.functions = function (callback) { editor_mode.prototype.functions = function (callback) {
var objs = []; var objs = [];
editor.file.editFunctions([],function(objs_){objs=objs_;/*console.log(objs_)*/}); editor.file.editFunctions([], function (objs_) {
objs = objs_;
/*console.log(objs_)*/
});
//只查询不修改时,内部实现不是异步的,所以可以这么写 //只查询不修改时,内部实现不是异步的,所以可以这么写
var tableinfo = editor_mode.objToTable_(objs[0], objs[1]); var tableinfo = editor_mode.objToTable_(objs[0], objs[1]);
document.getElementById('table_e260a2be_5690_476a_b04e_dacddede78b3').innerHTML = tableinfo.HTML; document.getElementById('table_e260a2be_5690_476a_b04e_dacddede78b3').innerHTML = tableinfo.HTML;
@ -329,7 +393,10 @@ editor_mode.prototype.listen = function(callback){
return; return;
} }
editor.file.changeIdAndIdnum(id, idnum, editor_mode.info, function (err) { editor.file.changeIdAndIdnum(id, idnum, editor_mode.info, function (err) {
if(err){printe(err);throw(err)} if (err) {
printe(err);
throw(err)
}
printe('添加id的idnum成功,请F5刷新编辑器'); printe('添加id的idnum成功,请F5刷新编辑器');
}); });
} else { } else {
@ -355,18 +422,33 @@ editor_mode.prototype.listen = function(callback){
var saveFloor = document.getElementById('saveFloor'); var saveFloor = document.getElementById('saveFloor');
saveFloor.onclick = function () { saveFloor.onclick = function () {
editor_mode.onmode(''); editor_mode.onmode('');
editor.file.saveFloorFile(function(err){if(err){printe(err);throw(err)};printf('保存成功');}); editor.file.saveFloorFile(function (err) {
if (err) {
printe(err);
throw(err)
}
;printf('保存成功');
});
} }
var saveFloorAs = document.getElementById('saveFloorAs'); var newMap = document.getElementById('newMap');
var saveAsName = document.getElementById('saveAsName'); var newFileName = document.getElementById('newFileName');
saveFloorAs.onclick = function(){ newMap.onclick = function () {
if (!saveAsName.value)return; if (!newFileName.value) return;
editor_mode.onmode(''); editor_mode.onmode('');
editor.file.saveFloorFileAs(saveAsName.value,function(err){ editor.file.saveNewFile(newFileName.value, function (err) {
if(err){printe(err);throw(err)} if (err) {
core.floorIds.push(saveAsName.value); printe(err);
editor.file.editTower([['change',"['main']['floorIds']",core.floorIds]],function(objs_){/*console.log(objs_);*/if(objs_.slice(-1)[0]!=null){printe(objs_.slice(-1)[0]);throw(objs_.slice(-1)[0])};printe('另存为成功,请F5刷新编辑器生效');}); throw(err)
}
core.floorIds.push(newFileName.value);
editor.file.editTower([['change', "['main']['floorIds']", core.floorIds]], function (objs_) {/*console.log(objs_);*/
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printe('新建成功,请F5刷新编辑器生效');
});
}); });
} }
@ -510,7 +592,10 @@ editor_mode.prototype.listen = function(callback){
} }
var imgbase64 = sprite.toDataURL().split(',')[1]; var imgbase64 = sprite.toDataURL().split(',')[1];
fs.writeFile('./project/images/' + editor_mode.appendPic.imageName + '.png', imgbase64, 'base64', function (err, data) { fs.writeFile('./project/images/' + editor_mode.appendPic.imageName + '.png', imgbase64, 'base64', function (err, data) {
if(err){printe(err);throw(err)} if (err) {
printe(err);
throw(err)
}
printe('追加素材成功,请F5刷新编辑器'); printe('追加素材成功,请F5刷新编辑器');
}); });
} }

View File

@ -22,7 +22,8 @@ codeEditor.on("keyup", function (cm, event) {
if (codeEditor.getOption("autocomplete") && (event.keyCode >= 65 && event.keyCode <= 90) || (event.keyCode >= 49 && event.keyCode <= 57) || event.keyCode == 190) { if (codeEditor.getOption("autocomplete") && (event.keyCode >= 65 && event.keyCode <= 90) || (event.keyCode >= 49 && event.keyCode <= 57) || event.keyCode == 190) {
try { try {
CodeMirror.commands.autocomplete(cm, null, {completeSingle: false}); CodeMirror.commands.autocomplete(cm, null, {completeSingle: false});
} catch (e) {} } catch (e) {
}
} }
}); });
@ -38,7 +39,9 @@ editor_multi.show = function(){
editor_multi.setLint(); editor_multi.setLint();
document.getElementById('left7').style = ''; document.getElementById('left7').style = '';
} }
editor_multi.hide = function(){document.getElementById('left7').style='z-index:-1;opacity: 0;';} editor_multi.hide = function () {
document.getElementById('left7').style = 'z-index:-1;opacity: 0;';
}
editor_multi.setLint = function () { editor_multi.setLint = function () {
codeEditor.setOption("lint", editor_multi.lintAutocomplete); codeEditor.setOption("lint", editor_multi.lintAutocomplete);
codeEditor.setOption("autocomplete", editor_multi.lintAutocomplete); codeEditor.setOption("autocomplete", editor_multi.lintAutocomplete);
@ -73,7 +76,13 @@ editor_multi.import = function(id_,args){
var num = editor_multi.indent(field); var num = editor_multi.indent(field);
eval('var tobj=' + (input.value || 'null')); eval('var tobj=' + (input.value || 'null'));
var tmap = {}; var tmap = {};
var tstr = JSON.stringify(tobj,function(k,v){if(typeof(v)===typeof('') && v.slice(0,8)==='function'){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},num); var tstr = JSON.stringify(tobj, function (k, v) {
if (typeof(v) === typeof('') && v.slice(0, 8) === 'function') {
var id_ = editor.guid();
tmap[id_] = v.toString();
return id_;
} else return v
}, num);
for (var id_ in tmap) { for (var id_ in tmap) {
tstr = tstr.replace('"' + id_ + '"', tmap[id_]) tstr = tstr.replace('"' + id_ + '"', tmap[id_])
} }
@ -108,7 +117,13 @@ editor_multi.confirm = function (){
} else { } else {
eval('var tobj=' + (value || 'null')); eval('var tobj=' + (value || 'null'));
var tmap = {}; var tmap = {};
var tstr = JSON.stringify(tobj,function(k,v){if(v instanceof Function){var id_ = editor.guid();tmap[id_]=v.toString();return id_;}else return v},4); var tstr = JSON.stringify(tobj, function (k, v) {
if (v instanceof Function) {
var id_ = editor.guid();
tmap[id_] = v.toString();
return id_;
} else return v
}, 4);
for (var id_ in tmap) { for (var id_ in tmap) {
tstr = tstr.replace('"' + id_ + '"', JSON.stringify(tmap[id_])) tstr = tstr.replace('"' + id_ + '"', JSON.stringify(tmap[id_]))
} }

View File

@ -95,7 +95,9 @@
throw 'Type Error in fs.readdir'; throw 'Type Error in fs.readdir';
var data = ''; var data = '';
data += 'name=' + path; data += 'name=' + path;
postsomething(data,'/listFile',function(err, data){callback(err,JSON.parse(data))}); postsomething(data, '/listFile', function (err, data) {
callback(err, JSON.parse(data))
});
return; return;
} }
})(); })();

View File

@ -1,21 +1,38 @@
<!doctype html> <!doctype html>
<html> <html>
<head><meta charset="utf-8"></head> <head>
<meta charset="utf-8">
</head>
<body> <body>
<script src="./fs.js"></script> <script src="./fs.js"></script>
<script> <script>
fs.writeFile('_test.txt','123中a文bc','utf-8',function(e,d){console.log(e);console.log(d);}) fs.writeFile('_test.txt', '123中a文bc', 'utf-8', function (e, d) {
console.log(e);
console.log(d);
})
setTimeout(function () { setTimeout(function () {
fs.writeFile('_test_bin.txt','abc=','base64',function(e,d){console.log(e);console.log(d);}) fs.writeFile('_test_bin.txt', 'abc=', 'base64', function (e, d) {
console.log(e);
console.log(d);
})
}, 1000); }, 1000);
setTimeout(function () { setTimeout(function () {
fs.readFile('_test.txt','utf-8',function(e,d){console.log(e);console.log(d);}) fs.readFile('_test.txt', 'utf-8', function (e, d) {
console.log(e);
console.log(d);
})
}, 2000); }, 2000);
setTimeout(function () { setTimeout(function () {
fs.readFile('_test_bin.txt','base64',function(e,d){console.log(e);console.log(d);}) fs.readFile('_test_bin.txt', 'base64', function (e, d) {
console.log(e);
console.log(d);
})
}, 3000); }, 3000);
setTimeout(function () { setTimeout(function () {
fs.readdir('.',function(e,d){console.log(e);console.log(d);}) fs.readdir('.', function (e, d) {
console.log(e);
console.log(d);
})
}, 4000); }, 4000);

View File

@ -13,7 +13,19 @@ document.body.onmousedown = function(e){
}); });
//console.log(eid); //console.log(eid);
if (eid.indexOf('edit') === -1) { if (eid.indexOf('edit') === -1) {
if(eid.indexOf('tip')===-1)selectBox.isSelected = false; if (eid.indexOf('tip') === -1) {
if (selectBox.isSelected) {
editor_mode.onmode('');
editor.file.saveFloorFile(function (err) {
if (err) {
printe(err);
throw(err)
}
;printf('地图保存成功');
});
}
selectBox.isSelected = false;
}
} }
//editor.mode.onmode(''); //editor.mode.onmode('');
editor.info = {}; editor.info = {};
@ -21,8 +33,8 @@ document.body.onmousedown = function(e){
iconLib.onmousedown = function (e) { iconLib.onmousedown = function (e) {
e.stopPropagation(); e.stopPropagation();
} }
var exportM = new Vue({ var exportMap = new Vue({
el: '#exportM', el: '#exportMap',
data: { data: {
isExport: false, isExport: false,
}, },
@ -78,8 +90,8 @@ var editArea = new Vue({
mapArr: function (val, oldval) { mapArr: function (val, oldval) {
var that = this; var that = this;
if (val == '') return; if (val == '') return;
if(exportM.isExport){ if (exportMap.isExport) {
exportM.isExport = false; exportMap.isExport = false;
return; return;
} }
if (that.formatArr()) { if (that.formatArr()) {
@ -152,8 +164,8 @@ var editArea = new Vue({
} }
} }
}); });
var editTip = new Vue({ var copyMap = new Vue({
el: '#editTip', el: '#copyMap',
data: { data: {
err: '' err: ''
}, },
@ -181,12 +193,20 @@ var editTip = new Vue({
} }
}, },
}) })
var clear = new Vue({ var clearMap = new Vue({
el: '#clear', el: '#clearMap',
methods: { methods: {
clearMap: function () { clearMap: function () {
editor.mapInit(); editor.mapInit();
editor_mode.onmode('');
editor.file.saveFloorFile(function (err) {
if (err) {
printe(err);
throw(err)
}
;printf('地图清除成功');
});
editor.updateMap(); editor.updateMap();
clearTimeout(editArea.formatTimer); clearTimeout(editArea.formatTimer);
clearTimeout(tip.timer); clearTimeout(tip.timer);
@ -197,6 +217,26 @@ var clear = new Vue({
} }
} }
}) })
var deleteMap = new Vue({
el: '#deleteMap',
methods: {
deleteMap: function () {
editor_mode.onmode('');
var index = core.floorIds.indexOf(editor.currentFloorId);
if (index>=0) {
core.floorIds.splice(index,1);
editor.file.editTower([['change', "['main']['floorIds']", core.floorIds]], function (objs_) {/*console.log(objs_);*/
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printe('删除成功,请F5刷新编辑器生效');
});
}
else printe('删除成功,请F5刷新编辑器生效');
}
}
})
printf = function (str_, type) { printf = function (str_, type) {
selectBox.isSelected = false; selectBox.isSelected = false;
if (!type) { if (!type) {
@ -214,7 +254,9 @@ printf = function(str_,type) {
} }
}, 1); }, 1);
} }
printe = function(str_){printf(str_,'error')} printe = function (str_) {
printf(str_, 'error')
}
tip_in_showMode = [ tip_in_showMode = [
'涉及图片的更改需要F5刷新浏览器来生效', '涉及图片的更改需要F5刷新浏览器来生效',
'文本域可以通过双击,在文本编辑器或事件编辑器中编辑', '文本域可以通过双击,在文本编辑器或事件编辑器中编辑',

View File

@ -14,14 +14,26 @@
大多数宝物都有默认的效果,屠龙匕首暂未定义,如有自己的需求可参见[自定义道具效果](personalization#自定义道具效果)。 大多数宝物都有默认的效果,屠龙匕首暂未定义,如有自己的需求可参见[自定义道具效果](personalization#自定义道具效果)。
如需让剑盾变成装备,可以直接在`data.js`中设置`'equipment': true`即可。
拿到道具后将触发`afterGetItem`事件,有关事件的详细介绍请参见[事件](event)。 拿到道具后将触发`afterGetItem`事件,有关事件的详细介绍请参见[事件](event)。
如需修改某个道具的效果,在不同区域宝石数据发生变化等问题,请参见[自定义道具效果](personalization#自定义道具效果)的说明。 如需修改某个道具的效果,在不同区域宝石数据发生变化等问题,请参见[自定义道具效果](personalization#自定义道具效果)的说明。
**有关轻按在data.js的系统变量中有定义。如果`enableGentleClick`为true则鼠标触摸屏通过双击勇士键盘通过空格可达到轻按效果即不向前移动而获得前方物品。** **有关轻按在data.js的系统变量中有定义。如果`enableGentleClick`为true则鼠标触摸屏通过双击勇士键盘通过空格可达到轻按效果即不向前移动而获得前方物品。**
## 装备
如果需要让剑盾等变成装备,可以直接在`data.js`中设置`'equipment': true`即可。
值得注意的是,有时候会有一个装备加多种属性的需求,此时需要把剑盾的效果从数值改成一个对象:
``` js
"sword1": {"atk": 10, "def": 0, "mdef": 5}, // 铁剑加10攻和5魔防
"shield1": {"atk": 0, "def": 10, "mdef": 10}, // 铁盾加10防和10魔防
```
将需要的项目按照如上方式修改即可。
## 门 ## 门
本塔支持6种门黄蓝红绿铁花。前五种门需要有对应的钥匙打开花门只能通过调用`openDoor`事件进行打开。 本塔支持6种门黄蓝红绿铁花。前五种门需要有对应的钥匙打开花门只能通过调用`openDoor`事件进行打开。

View File

@ -636,6 +636,50 @@ loc为图片左上角坐标以像素为单位进行计算。
调用show/hide/move/animate等几个事件同样会清除所有显示的图片。 调用show/hide/move/animate等几个事件同样会清除所有显示的图片。
### animateImage图片淡入淡出
我们还可以使用 `{"type": "animateImage"}` 来造成显示图片的淡入淡出效果。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "animateImage", "action": "show", "name": "bg.jpg", "loc": [231,297], "time": 500}, // 在(231,297)淡入bg.jpg动画时间500ms
{"type": "animateImage", "action": "hide", "name": "1.png", "loc": [109,167], "time": 300}, // 在(109,167)淡出1.png动画时间300ms
]
```
action为淡入还是淡出`show`为淡入,`hide`会淡出。
name为图片名。**请确保图片在data.js中的images中被定义过。**
loc为图片左上角坐标以像素为单位进行计算。
time为淡入淡出的时间如果是0则忽略此项。
!> 淡入淡出图片只是会在顶层绘制“淡入”和“淡出”效果动画结束即消失并不会实际对图片的显示造成影响。请与showImage事件合用。
如果多张图片的淡入淡出可以采用以下方式(仅供参考):
假设我现在已经有了`1.jpg`显示在屏幕上:
- 淡入显示`2.png`:调用`animateImage`淡入图片,然后立刻调用`showImage`显示图片。
- 淡出`1.png`:清除所有图片,`showImage`显示`2.png`,然后调用`animateImage`淡出`1.jpg`
### showGif显示动图
我们可以使用 `{"type": "showGif"}` 来显示一张图片。
``` js
"x,y": [ // 实际执行的事件列表
{"type": "showGif", "name": "timg.gif", "loc": [231,297]}, // 在(231,297)显示一张动图
{"type": "showGif"} // 如果不指定name则清除所有动图。
]
```
name为图片名。**请确保图片在data.js中的images中被定义过。**
loc为动图左上角坐标以像素为单位进行计算。
如果不指定name则清除所有显示的动图。
### setFg: 更改画面色调 ### setFg: 更改画面色调
我们可以使用 `{"type": "setFg"}` 来更改画面色调。 我们可以使用 `{"type": "setFg"}` 来更改画面色调。

View File

@ -249,7 +249,7 @@ enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, her
// 如果有神圣盾免疫吸血等可以在这里写 // 如果有神圣盾免疫吸血等可以在这里写
if (core.hasFlag("shield5")) vampireDamage = 0; // 存在神圣盾吸血伤害为0 if (core.hasFlag("shield5")) vampireDamage = 0; // 存在神圣盾吸血伤害为0
vampireDamage = parseInt(vampireDamage); vampireDamage = Math.floor(vampireDamage) || 0;
// 加到自身 // 加到自身
if (monster.add) // 如果加到自身 if (monster.add) // 如果加到自身
mon_hp += vampireDamage; mon_hp += vampireDamage;
@ -286,7 +286,7 @@ control.prototype.checkBlock = function () {
你需自己指定一个special数字修改getSpecialText函数属性名和getSpecialHint函数属性提示文字 你需自己指定一个special数字修改getSpecialText函数属性名和getSpecialHint函数属性提示文字
如果要修改伤害计算公式请修改下面的calDamage函数。请注意如果无法战斗该函数必须返回`999999999`。 如果要修改伤害计算公式请修改下面的calDamage函数。请注意如果无法战斗该函数必须返回`null`。
对于毒衰弱怪物的战斗后结算在`functions.js`中的afterBattle函数中。 对于毒衰弱怪物的战斗后结算在`functions.js`中的afterBattle函数中。

View File

@ -18,15 +18,15 @@
<textarea cols="10" rows="10" id="pout" v-model="mapArr"></textarea> <textarea cols="10" rows="10" id="pout" v-model="mapArr"></textarea>
<p class="warnText" v-if="error">{{ errors[error-1] }}</p> <p class="warnText" v-if="error">{{ errors[error-1] }}</p>
</div> </div>
<div id="editTip" v-cloak> <div id="editTip">
<br> <input type="button" value="新建空白地图" id='newMap'/>
<input type="button" value="当前地图另存为" id='saveFloorAs'/> <input id='newFileName' placeholder="输入新楼层id"/>
<input id='saveAsName' placeholder="输入新楼层id"/>
<input class='btn' type="button" value="复制地图" v-on:click="copyMap"/>
</div> </div>
<div style="position: absolute;right: 10px;bottom:70px;"> <div style="position: absolute;left: 10px;bottom:0; margin-bottom: 90px">
<input class='btn' id='clear' type="button" value="清除地图" v-on:click="clearMap"/> <input type="button" value="导出地图" id="exportMap" v-on:click="exportMap"/>
<input class='btn' type="button" value="导出地图" id="exportM" v-on:click="exportMap"/> <input type="button" value="复制地图" id="copyMap" v-on:click="copyMap"/>
<input type="button" value="清除地图" id='clearMap' v-on:click="clearMap"/>
<input type="button" value="删除地图" id="deleteMap" v-on:click="deleteMap"/>
</div> </div>
</div> </div>
<div id="objDataEditor"> <div id="objDataEditor">
@ -42,7 +42,8 @@
<div class="leftTabContent"> <div class="leftTabContent">
<p> <p>
<input id="selectFileBtn" type="button" value="导入文件到画板"/> <input id="selectFileBtn" type="button" value="导入文件到画板"/>
<select id="selectAppend"></select><!-- ["terrains", "animates", "enemys", "enemy48", "items", "npcs", "npc48"] --> <select id="selectAppend"></select>
<!-- ["terrains", "animates", "enemys", "enemy48", "items", "npcs", "npc48"] -->
<input id="appendConfirm" type="button" value="追加"/> <input id="appendConfirm" type="button" value="追加"/>
</p> </p>
<div id="appendPicCanvas" style="position:relative;overflow: auto;height:470px;"> <div id="appendPicCanvas" style="position:relative;overflow: auto;height:470px;">
@ -57,21 +58,29 @@
<div class="appendSelection"><span style="top: 12px; left: 14px;">4</span></div> <div class="appendSelection"><span style="top: 12px; left: 14px;">4</span></div>
</div> </div>
</div> </div>
</div></div> </div>
</div>
<div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><!-- loc --> <div id="left2" class='leftTab' style="z-index:-1;opacity: 0;"><!-- loc -->
<h3 class="leftTabHeader">地图选点&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3> <h3 class="leftTabHeader">地图选点&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button>
</h3>
<div class="leftTabContent"> <div class="leftTabContent">
<p id='pos_a6771a78_a099_417c_828f_0a24851ebfce' style="margin-left: 15px">0,0</p> <p id='pos_a6771a78_a099_417c_828f_0a24851ebfce' style="margin-left: 15px">0,0</p>
<div class='etable'> <div class='etable'>
<table> <table>
<tbody id='table_3d846fc4_7644_44d1_aa04_433d266a73df'> <tbody id='table_3d846fc4_7644_44d1_aa04_433d266a73df'>
<tr><td>条目</td><td>注释</td><td></td></tr> <tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div></div> </div>
</div>
<div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- emenyitem --> <div id="left3" class='leftTab' style="z-index:-1;opacity: 0;"><!-- emenyitem -->
<h3 class="leftTabHeader">图块属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3> <h3 class="leftTabHeader">图块属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button>
</h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div id='newIdIdnum'><!-- id and idnum --> <div id='newIdIdnum'><!-- id and idnum -->
<input placeholder="输入新id唯一标识符"/> <input placeholder="输入新id唯一标识符"/>
@ -82,39 +91,59 @@
<div class='etable'> <div class='etable'>
<table> <table>
<tbody id='table_a3f03d4c_55b8_4ef6_b362_b345783acd72'> <tbody id='table_a3f03d4c_55b8_4ef6_b362_b345783acd72'>
<tr><td>条目</td><td>注释</td><td></td></tr> <tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div> </div>
</div></div> </div>
</div>
<div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor --> <div id="left4" class='leftTab' style="z-index:-1;opacity: 0;"><!-- floor -->
<h3 class="leftTabHeader">楼层属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3> <h3 class="leftTabHeader">楼层属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button>
</h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div class='etable'> <div class='etable'>
<table> <table>
<tbody id='table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74'> <tbody id='table_4a3b1b09_b2fb_4bdf_b9ab_9f4cdac14c74'>
<tr><td>条目</td><td>注释</td><td></td></tr> <tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div></div> </div>
</div>
<div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower --> <div id="left5" class='leftTab' style="z-index:-1;opacity: 0;"><!-- tower -->
<h3 class="leftTabHeader">全塔属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3> <h3 class="leftTabHeader">全塔属性&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button>
</h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div class='etable'> <div class='etable'>
<table> <table>
<tbody id='table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5'> <tbody id='table_b6a03e4c_5968_4633_ac40_0dfdd2c9cde5'>
<tr><td>条目</td><td>注释</td><td></td></tr> <tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div></div> </div>
<div id="left6" class='leftTab' style="z-index:-1;opacity: 0;"><div style="position: relative; height: 95%"><!-- eventsEditor --> </div>
<div id="left6" class='leftTab' style="z-index:-1;opacity: 0;">
<div style="position: relative; height: 95%"><!-- eventsEditor -->
<h3>事件编辑器 &nbsp;&nbsp; <h3>事件编辑器 &nbsp;&nbsp;
<!--
<button onclick="editor_blockly.showXML()">Show XML</button> <button onclick="editor_blockly.showXML()">Show XML</button>
<button onclick="editor_blockly.runCode()">console.log(obj=code)</button> <button onclick="editor_blockly.runCode()">console.log(obj=code)</button>
<select id="entryType" disabled="disabled"> -->
<select id="entryType" disabled="disabled" style="display: none">
<option value="event">event</option> <option value="event">event</option>
<option value="changeFloor">changeFloor</option> <option value="changeFloor">changeFloor</option>
<option value="point">point</option> <option value="point">point</option>
@ -124,9 +153,9 @@
<option value="afterOpenDoor">afterOpenDoor</option> <option value="afterOpenDoor">afterOpenDoor</option>
<option value="firstArrive">firstArrive</option> <option value="firstArrive">firstArrive</option>
</select> </select>
<button onclick="editor_blockly.parse()">parse</button>
<button onclick="editor_blockly.confirm()">confirm</button> <button onclick="editor_blockly.confirm()">confirm</button>
<button onclick="editor_blockly.cancel()">cancel</button> <button onclick="editor_blockly.cancel()">cancel</button>
<button onclick="editor_blockly.parse()">parse</button>
<xml id="toolbox" style="display:none"> <xml id="toolbox" style="display:none">
<category name="entry"></category> <category name="entry"></category>
<category name="statement"></category> <category name="statement"></category>
@ -135,28 +164,38 @@
</xml> </xml>
</h3> </h3>
<div style="position: relative;height: 100%"> <div style="position: relative;height: 100%">
<div id="blocklyArea"><div id="blocklyDiv"></div></div> <div id="blocklyArea">
<div id="blocklyDiv"></div>
</div>
<textarea id="codeArea" spellcheck="false"></textarea> <textarea id="codeArea" spellcheck="false"></textarea>
</div> </div>
</div></div> </div>
</div>
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 --> <div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
<button onclick="editor_multi.confirm()">confirm</button> <button onclick="editor_multi.confirm()">confirm</button>
<button onclick="editor_multi.cancel()">cancel</button> <button onclick="editor_multi.cancel()">cancel</button>
<input type="checkbox" onclick="editor_multi.toggerLint()" id="lintCheckbox" style="vertical-align: bottom;margin-left:6px" /> <input type="checkbox" onclick="editor_multi.toggerLint()" id="lintCheckbox"
style="vertical-align: bottom;margin-left:6px"/>
<span style="vertical-align: bottom; margin-left: -3px">Lint</span> <span style="vertical-align: bottom; margin-left: -3px">Lint</span>
<textarea id="multiLineCode" name="multiLineCode"></textarea> <textarea id="multiLineCode" name="multiLineCode"></textarea>
</div> </div>
<div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><!-- functions --> <div id="left8" class='leftTab' style="z-index:-1;opacity: 0;"><!-- functions -->
<h3 class="leftTabHeader">脚本编辑&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button></h3> <h3 class="leftTabHeader">脚本编辑&nbsp;&nbsp;<button onclick="editor.mode.onmode('save')">save</button>
</h3>
<div class="leftTabContent"> <div class="leftTabContent">
<div class='etable'> <div class='etable'>
<table> <table>
<tbody id='table_e260a2be_5690_476a_b04e_dacddede78b3'> <tbody id='table_e260a2be_5690_476a_b04e_dacddede78b3'>
<tr><td>条目</td><td>注释</td><td></td></tr> <tr>
<td>条目</td>
<td>注释</td>
<td></td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>
</div></div> </div>
</div>
<div id="mid"> <div id="mid">
<table class="col" id='mapColMark'></table> <table class="col" id='mapColMark'></table>
<table class="row" id='mapRowMark'></table> <table class="row" id='mapRowMark'></table>
@ -174,7 +213,8 @@
<p v-if="hasId">图块编号:<span class="infoText">{{ infos['idnum'] }}</span></p> <p v-if="hasId">图块编号:<span class="infoText">{{ infos['idnum'] }}</span></p>
<p v-if="hasId">图块ID<span class="infoText">{{ infos['id'] }}</span></p> <p v-if="hasId">图块ID<span class="infoText">{{ infos['id'] }}</span></p>
<p v-else class="warnText">该图块无对应的数字或ID存在请先前往icons.js和maps.js中进行定义</p> <p v-else class="warnText">该图块无对应的数字或ID存在请先前往icons.js和maps.js中进行定义</p>
<p>图块所在素材:<span class="infoText">{{ infos['images'] + (isAutotile ? '( '+infos['id']+' )' : '') }}</span></p> <p>图块所在素材:<span class="infoText">{{ infos['images'] + (isAutotile ? '( '+infos['id']+' )' : '') }}</span>
</p>
<p>图块索引:<span class="infoText">{{ infos['y'] }}</span></p> <p>图块索引:<span class="infoText">{{ infos['y'] }}</span></p>
</div> </div>
</div> </div>
@ -310,6 +350,8 @@
<img src="project/images/settings.png" class="tools" id='img-settings'> <img src="project/images/settings.png" class="tools" id='img-settings'>
<p class="statusLabel tools" id="hard"></p> <p class="statusLabel tools" id="hard"></p>
</div> </div>
<div id="gif"></div>
<div id="gif2"></div>
<div id="curtain"></div> <div id="curtain"></div>
<!-- <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas> --> <!-- <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas> -->
<!-- <canvas class='gameCanvas' id='event' width='416' height='416'></canvas> --> <!-- <canvas class='gameCanvas' id='event' width='416' height='416'></canvas> -->
@ -356,10 +398,11 @@
//所有全局量 //所有全局量
__all__ = ['Vue', 'fs', 'editor_file', 'editor_mode', 'main', 'core', 'hasOwnProp', 'printf', 'printe', 'editor', 'converter', 'ActionParser', 'MotaActionFunctions', 'MotaActionBlocks']; __all__ = ['Vue', 'fs', 'editor_file', 'editor_mode', 'main', 'core', 'hasOwnProp', 'printf', 'printe', 'editor', 'converter', 'ActionParser', 'MotaActionFunctions', 'MotaActionBlocks'];
__id__ = ['editArea', 'arrRowMark', 'mapRowMark', 'data', 'bg', 'dataSelection', 'blocklyDiv', 'codeAreaHL', 'entryType']; __id__ = ['editArea', 'arrRowMark', 'mapRowMark', 'data', 'bg', 'dataSelection', 'blocklyDiv', 'codeAreaHL', 'entryType'];
__Vue__=['exportM','editArea','editTip','clear','tip','selectBox']; __Vue__ = ['editArea', 'exportMap', 'copyMap', 'clearMap', 'deleteMap', 'tip', 'selectBox'];
//var event = document.getElementById('event'); //var event = document.getElementById('event');
var hasOwnProperty = Object.prototype.hasOwnProperty; var hasOwnProperty = Object.prototype.hasOwnProperty;
function hasOwnProp(obj, key) { function hasOwnProp(obj, key) {
return hasOwnProperty.call(obj, key) return hasOwnProperty.call(obj, key)
} }
@ -383,7 +426,6 @@ main.init('editor', function() {
}); });
//main.listen(); //main.listen();
</script> </script>

View File

@ -103,6 +103,8 @@
<img src="project/images/settings.png" class="tools" id='img-settings'> <img src="project/images/settings.png" class="tools" id='img-settings'>
<p class="statusLabel tools" id="hard"></p> <p class="statusLabel tools" id="hard"></p>
</div> </div>
<div id="gif"></div>
<div id="gif2"></div>
<div id="curtain"></div> <div id="curtain"></div>
<canvas class='gameCanvas' id='bg' width='416' height='416'></canvas> <canvas class='gameCanvas' id='bg' width='416' height='416'></canvas>
<canvas class='gameCanvas' id='event' width='416' height='416'></canvas> <canvas class='gameCanvas' id='event' width='416' height='416'></canvas>

View File

@ -1245,10 +1245,12 @@ actions.prototype.clickSL = function(x,y) {
// 上一页 // 上一页
if ((x == 3 || x == 4) && y == 12) { if ((x == 3 || x == 4) && y == 12) {
core.ui.drawSLPanel(10*(page-1)+offset); core.ui.drawSLPanel(10*(page-1)+offset);
return;
} }
// 下一页 // 下一页
if ((x == 8 || x == 9) && y == 12) { if ((x == 8 || x == 9) && y == 12) {
core.ui.drawSLPanel(10*(page+1)+offset); core.ui.drawSLPanel(10*(page+1)+offset);
return;
} }
// 返回 // 返回
if (x>=10 && x<=12 && y==12) { if (x>=10 && x<=12 && y==12) {
@ -1258,17 +1260,37 @@ actions.prototype.clickSL = function(x,y) {
} }
return; return;
} }
// 删除
if (x>=0 && x<=2 && y==12) {
core.status.event.selection=!core.status.event.selection;
core.ui.drawSLPanel(index);
return;
}
var index=6*page+1; var id=null;
if (y>=1 && y<=4) { if (y>=1 && y<=4) {
if (x>=1 && x<=3) core.doSL("autoSave", core.status.event.id); if (x>=1 && x<=3) id = "autoSave";
if (x>=5 && x<=7) core.doSL(5*page+1, core.status.event.id); if (x>=5 && x<=7) id = 5*page+1;
if (x>=9 && x<=11) core.doSL(5*page+2, core.status.event.id); if (x>=9 && x<=11) id = 5*page+2;
} }
if (y>=7 && y<=10) { if (y>=7 && y<=10) {
if (x>=1 && x<=3) core.doSL(5*page+3, core.status.event.id); if (x>=1 && x<=3) id = 5*page+3;
if (x>=5 && x<=7) core.doSL(5*page+4, core.status.event.id); if (x>=5 && x<=7) id = 5*page+4;
if (x>=9 && x<=11) core.doSL(5*page+5, core.status.event.id); if (x>=9 && x<=11) id = 5*page+5;
}
if (id!=null) {
if (core.status.event.selection) {
if (id == 'autoSave') {
core.drawTip("无法删除自动存档!");
}
else {
core.removeLocalStorage("save"+id);
core.ui.drawSLPanel(index);
}
}
else {
core.doSL(id, core.status.event.id);
}
} }
} }
@ -1346,6 +1368,15 @@ actions.prototype.keyUpSL = function (keycode) {
} }
return; return;
} }
if (keycode==46) {
if (offset==0) {
core.drawTip("无法删除自动存档!");
}
else {
core.removeLocalStorage("save"+(5*page+offset));
core.ui.drawSLPanel(index);
}
}
} }
////// 系统设置界面时的点击操作 ////// ////// 系统设置界面时的点击操作 //////
@ -1389,15 +1420,21 @@ actions.prototype.clickSwitchs = function (x,y) {
core.ui.drawSwitchs(); core.ui.drawSwitchs();
break; break;
case 4: case 4:
core.flags.displayCritical=!core.flags.displayCritical;
core.updateFg();
core.setLocalStorage('critical', core.flags.displayCritical);
core.ui.drawSwitchs();
break;
case 5:
core.flags.displayExtraDamage=!core.flags.displayExtraDamage; core.flags.displayExtraDamage=!core.flags.displayExtraDamage;
core.updateFg(); core.updateFg();
core.setLocalStorage('extraDamage', core.flags.displayExtraDamage); core.setLocalStorage('extraDamage', core.flags.displayExtraDamage);
core.ui.drawSwitchs(); core.ui.drawSwitchs();
break; break;
case 5: case 6:
window.open(core.firstData.name+".zip", "_blank"); window.open(core.firstData.name+".zip", "_blank");
break; break;
case 6: case 7:
core.status.event.selection=0; core.status.event.selection=0;
core.ui.drawSettings(); core.ui.drawSettings();
break; break;

View File

@ -946,7 +946,7 @@ control.prototype.updateCheckBlock = function() {
core.status.checkBlock.betweenAttack[13*x+y]=true; core.status.checkBlock.betweenAttack[13*x+y]=true;
var leftHp = core.status.hero.hp - core.status.checkBlock.damage[13*x+y]; var leftHp = core.status.hero.hp - core.status.checkBlock.damage[13*x+y];
if (leftHp>1) if (leftHp>1)
core.status.checkBlock.damage[13*x+y] += parseInt((leftHp+(core.flags.betweenAttackCeil?0:1))/2); core.status.checkBlock.damage[13*x+y] += Math.floor((leftHp+(core.flags.betweenAttackCeil?0:1))/2);
} }
} }
} }
@ -1039,21 +1039,28 @@ control.prototype.snipe = function (snipes) {
snipe.blockIcon = core.material.icons[cls][block.event.id]; snipe.blockIcon = core.material.icons[cls][block.event.id];
snipe.blockImage = core.material.images[cls]; snipe.blockImage = core.material.images[cls];
snipe.height = height; snipe.height = height;
var damage = core.enemys.getDamage(block.event.id);
var color = "#000000"; var damage = core.enemys.getDamage(block.event.id);
var color = '#000000';
if (damage == null) {
damage = "???";
color = '#FF0000';
}
else {
if (damage <= 0) color = '#00FF00'; if (damage <= 0) color = '#00FF00';
else if (damage < core.status.hero.hp / 3) color = '#FFFFFF'; else if (damage < hero_hp / 3) color = '#FFFFFF';
else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00'; else if (damage < hero_hp * 2 / 3) color = '#FFFF00';
else if (damage < core.status.hero.hp) color = '#FF7F00'; else if (damage < hero_hp) color = '#FF7F00';
else color = '#FF0000'; else color = '#FF0000';
if (damage >= 999999999) damage = "???"; damage = core.formatBigNumber(damage);
else if (damage > 100000) damage = (damage / 10000).toFixed(1) + "w"; }
snipe.damage = damage; snipe.damage = damage;
snipe.color = color; snipe.color = color;
snipe.block = core.clone(block); snipe.block = core.clone(block);
}) })
var finishSnipe = function () { var finishSnipe = function () {
@ -1245,7 +1252,7 @@ control.prototype.updateFg = function () {
if (!core.hasItem('book')) return; if (!core.hasItem('book')) return;
core.setFont('fg', "bold 11px Arial"); core.setFont('fg', "bold 11px Arial");
var hero_hp = core.status.hero.hp; var hero_hp = core.status.hero.hp;
if (core.flags.displayEnemyDamage) { if (core.flags.displayEnemyDamage || core.flags.displayCritical) {
core.canvas.fg.textAlign = 'left'; core.canvas.fg.textAlign = 'left';
for (var b = 0; b < mapBlocks.length; b++) { for (var b = 0; b < mapBlocks.length; b++) {
var x = mapBlocks[b].x, y = mapBlocks[b].y; var x = mapBlocks[b].x, y = mapBlocks[b].y;
@ -1264,16 +1271,23 @@ control.prototype.updateFg = function () {
var id = mapBlocks[b].event.id; var id = mapBlocks[b].event.id;
if (core.flags.displayEnemyDamage) {
var damage = core.enemys.getDamage(id); var damage = core.enemys.getDamage(id);
var color = "#000000"; var color = '#000000';
if (damage == null) {
damage = "???";
color = '#FF0000';
}
else {
if (damage <= 0) color = '#00FF00'; if (damage <= 0) color = '#00FF00';
else if (damage < hero_hp / 3) color = '#FFFFFF'; else if (damage < hero_hp / 3) color = '#FFFFFF';
else if (damage < hero_hp * 2 / 3) color = '#FFFF00'; else if (damage < hero_hp * 2 / 3) color = '#FFFF00';
else if (damage < hero_hp) color = '#FF7F00'; else if (damage < hero_hp) color = '#FF7F00';
else color = '#FF0000'; else color = '#FF0000';
if (damage >= 999999999) damage = "???"; damage = core.formatBigNumber(damage);
else if (damage > 100000) damage = (damage / 10000).toFixed(1) + "w"; }
core.setFillStyle('fg', '#000000'); core.setFillStyle('fg', '#000000');
core.canvas.fg.fillText(damage, 32 * x + 2, 32 * (y + 1) - 2); core.canvas.fg.fillText(damage, 32 * x + 2, 32 * (y + 1) - 2);
@ -1283,6 +1297,20 @@ control.prototype.updateFg = function () {
core.setFillStyle('fg', color); core.setFillStyle('fg', color);
core.canvas.fg.fillText(damage, 32 * x + 1, 32 * (y + 1) - 1); core.canvas.fg.fillText(damage, 32 * x + 1, 32 * (y + 1) - 1);
}
// 临界显伤
if (core.flags.displayCritical) {
var critical = core.formatBigNumber(core.enemys.getCritical(id));
if (critical == '???') critical = '?';
core.setFillStyle('fg', '#000000');
core.canvas.fg.fillText(critical, 32 * x + 2, 32 * (y + 1) - 2 - 10);
core.canvas.fg.fillText(critical, 32 * x, 32 * (y + 1) - 2 - 10);
core.canvas.fg.fillText(critical, 32 * x + 2, 32 * (y + 1) - 10);
core.canvas.fg.fillText(critical, 32 * x, 32 * (y + 1) - 10);
core.setFillStyle('fg', '#FFFFFF');
core.canvas.fg.fillText(critical, 32 * x + 1, 32 * (y + 1) - 1 - 10);
}
} }
} }
@ -2075,8 +2103,9 @@ control.prototype.updateStatusBar = function () {
var statusList = ['hpmax', 'hp', 'atk', 'def', 'mdef', 'money', 'experience']; var statusList = ['hpmax', 'hp', 'atk', 'def', 'mdef', 'money', 'experience'];
statusList.forEach(function (item) { statusList.forEach(function (item) {
core.statusBar[item].innerHTML = core.getStatus(item); core.statusBar[item].innerHTML = core.formatBigNumber(core.getStatus(item));
}); });
// 进阶 // 进阶
if (core.flags.enableLevelUp && core.status.hero.lv<core.firstData.levelUp.length) { if (core.flags.enableLevelUp && core.status.hero.lv<core.firstData.levelUp.length) {
core.statusBar.up.innerHTML = core.firstData.levelUp[core.status.hero.lv].need || "&nbsp;"; core.statusBar.up.innerHTML = core.firstData.levelUp[core.status.hero.lv].need || "&nbsp;";
@ -2320,6 +2349,24 @@ control.prototype.resize = function(clientWidth, clientHeight) {
border: '3px #fff solid', border: '3px #fff solid',
} }
}, },
{
id: 'gif',
rules: {
width: (canvasWidth - SPACE*2) + unit,
height:(canvasWidth - SPACE*2) + unit,
top: (canvasTop + SPACE) + unit,
right: SPACE + unit,
}
},
{
id: 'gif2',
rules: {
width: (canvasWidth - SPACE*2) + unit,
height:(canvasWidth - SPACE*2) + unit,
top: (canvasTop + SPACE) + unit,
right: SPACE + unit,
}
},
{ {
id: 'curtain', id: 'curtain',
rules: { rules: {

View File

@ -268,6 +268,7 @@ core.prototype.init = function (coreData, callback) {
// switchs // switchs
core.flags.battleAnimate = core.getLocalStorage('battleAnimate', core.flags.battleAnimate); core.flags.battleAnimate = core.getLocalStorage('battleAnimate', core.flags.battleAnimate);
core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage); core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
core.flags.displayCritical = core.getLocalStorage('critical', core.flags.displayCritical);
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage); core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
core.material.ground = new Image(); core.material.ground = new Image();
@ -873,6 +874,11 @@ core.prototype.formatDate2 = function (date) {
return core.utils.formatDate2(date); return core.utils.formatDate2(date);
} }
////// 格式化大数 //////
core.prototype.formatBigNumber = function (x) {
return core.utils.formatBigNumber(x);
}
////// 两位数显示 ////// ////// 两位数显示 //////
core.prototype.setTwoDigits = function (x) { core.prototype.setTwoDigits = function (x) {
return core.utils.setTwoDigits(x); return core.utils.setTwoDigits(x);

View File

@ -84,17 +84,17 @@ enemys.prototype.getSpecialHint = function (enemy, special) {
case 4: return "2连击怪物每回合攻击2次"; case 4: return "2连击怪物每回合攻击2次";
case 5: return "3连击怪物每回合攻击3次"; case 5: return "3连击怪物每回合攻击3次";
case 6: return (enemy.n||4)+"连击: 怪物每回合攻击"+(enemy.n||4)+"次"; case 6: return (enemy.n||4)+"连击: 怪物每回合攻击"+(enemy.n||4)+"次";
case 7: return "破甲:战斗前,怪物附加角色防御的"+parseInt(100*core.values.breakArmor)+"%作为伤害"; case 7: return "破甲:战斗前,怪物附加角色防御的"+Math.floor(100*core.values.breakArmor||0)+"%作为伤害";
case 8: return "反击:战斗时,怪物每回合附加角色攻击的"+parseInt(100*core.values.counterAttack)+"%作为伤害,无视角色防御"; case 8: return "反击:战斗时,怪物每回合附加角色攻击的"+Math.floor(100*core.values.counterAttack||0)+"%作为伤害,无视角色防御";
case 9: return "净化:战斗前,怪物附加勇士魔防的"+core.values.purify+"倍作为伤害"; case 9: return "净化:战斗前,怪物附加勇士魔防的"+core.values.purify+"倍作为伤害";
case 10: return "模仿:怪物的攻防和勇士攻防相等"; case 10: return "模仿:怪物的攻防和勇士攻防相等";
case 11: return "吸血:战斗前,怪物首先吸取角色的"+parseInt(100*enemy.value)+"%生命作为伤害"+(enemy.add?",并把伤害数值加到自身生命上":""); case 11: return "吸血:战斗前,怪物首先吸取角色的"+Math.floor(100*enemy.value||0)+"%生命作为伤害"+(enemy.add?",并把伤害数值加到自身生命上":"");
case 12: return "中毒:战斗后,勇士陷入中毒状态,每一步损失生命"+core.values.poisonDamage+"点"; case 12: return "中毒:战斗后,勇士陷入中毒状态,每一步损失生命"+core.values.poisonDamage+"点";
case 13: return "衰弱:战斗后,勇士陷入衰弱状态,攻防暂时下降"+core.values.weakValue+"点"; case 13: return "衰弱:战斗后,勇士陷入衰弱状态,攻防暂时下降"+core.values.weakValue+"点";
case 14: return "诅咒:战斗后,勇士陷入诅咒状态,战斗无法获得金币和经验"; case 14: return "诅咒:战斗后,勇士陷入诅咒状态,战斗无法获得金币和经验";
case 15: return "领域:经过怪物周围"+(enemy.range||1)+"格时自动减生命"+(enemy.value||0)+"点"; case 15: return "领域:经过怪物周围"+(enemy.range||1)+"格时自动减生命"+(enemy.value||0)+"点";
case 16: return "夹击:经过两只相同的怪物中间,勇士生命值变成一半"; case 16: return "夹击:经过两只相同的怪物中间,勇士生命值变成一半";
case 17: return "仇恨:战斗前,怪物附加之前积累的仇恨值作为伤害"+(core.flags.hatredDecrease?";战斗后,释放一半的仇恨值":"")+"。(每杀死一个怪物获得"+core.values.hatred+"点仇恨值)"; case 17: return "仇恨:战斗前,怪物附加之前积累的仇恨值作为伤害"+(core.flags.hatredDecrease?";战斗后,释放一半的仇恨值":"")+"。(每杀死一个怪物获得"+(core.values.hatred||0)+"点仇恨值)";
case 18: return "阻击:经过怪物的十字领域时自动减生命"+(enemy.value||0)+"点,同时怪物后退一格"; case 18: return "阻击:经过怪物的十字领域时自动减生命"+(enemy.value||0)+"点,同时怪物后退一格";
case 19: return "自爆战斗后勇士的生命值变成1"; case 19: return "自爆战斗后勇士的生命值变成1";
case 20: return "无敌:勇士无法打败怪物,除非拥有十字架"; case 20: return "无敌:勇士无法打败怪物,除非拥有十字架";
@ -106,11 +106,17 @@ enemys.prototype.getSpecialHint = function (enemy, special) {
return ""; return "";
} }
////// 能否获胜 //////
enemys.prototype.canBattle = function (monsterId) {
var damage = this.getDamage(monsterId);
return damage != null && damage < core.status.hero.hp;
}
////// 获得某个怪物的伤害 ////// ////// 获得某个怪物的伤害 //////
enemys.prototype.getDamage = function (monsterId) { enemys.prototype.getDamage = function (monsterId) {
var monster = core.material.enemys[monsterId]; var monster = core.material.enemys[monsterId];
var damage = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef); var damage = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef);
if (damage >= 999999999) return damage; if (damage == null) return null;
return damage + this.getExtraDamage(monster); return damage + this.getExtraDamage(monster);
} }
@ -132,17 +138,43 @@ enemys.prototype.getCritical = function (monsterId) {
// 坚固、模仿怪物没有临界! // 坚固、模仿怪物没有临界!
if (this.hasSpecial(monster.special, 3) || this.hasSpecial(monster.special, 10)) return "???"; if (this.hasSpecial(monster.special, 3) || this.hasSpecial(monster.special, 10)) return "???";
if (monster.def + monster.hp/2 <= 0) {
var last = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef); var last = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef);
if (last == null) return '???';
if (last <= 0) return 0; if (last <= 0) return 0;
for (var i = core.status.hero.atk + 1; i <= monster.hp + monster.def; i++) { for (var i = core.status.hero.atk + 1; i <= monster.hp + monster.def; i++) {
var damage = this.calDamage(monster, core.status.hero.hp, i, core.status.hero.def, core.status.hero.mdef); var damage = this.calDamage(monster, core.status.hero.hp, i, core.status.hero.def, core.status.hero.mdef);
if (damage == null) return '???';
if (damage < last) if (damage < last)
return i - core.status.hero.atk; return core.formatBigNumber(i - core.status.hero.atk);
last = damage; last = damage;
} }
return 0; return 0;
}
else {
var info = this.getDamageInfo(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef);
if (info == null) return '???';
if (info.damage <= 0) return 0;
var mon_hp = info.mon_hp, hero_atk = core.status.hero.atk, mon_def = monster.def, turn = info.turn;
// turn 是勇士攻击次数
if (turn<=1) return 0; // 攻杀
// 每回合最小伤害 = ⎡怪物生命/勇士攻击次数⎤
var nextAtk = Math.ceil(mon_hp/(turn-1)) + mon_def;
if (nextAtk <= hero_atk) return 0;
return nextAtk - hero_atk;
}
} }
////// 临界减伤计算 ////// ////// 临界减伤计算 //////
@ -152,9 +184,9 @@ enemys.prototype.getCriticalDamage = function (monsterId) {
if (c <= 0) return 0; if (c <= 0) return 0;
var monster = core.material.enemys[monsterId]; var monster = core.material.enemys[monsterId];
var last = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef); var last = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef);
if (last >= 999999999) return '???'; var now = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk+c, core.status.hero.def, core.status.hero.mdef);
if (last == null || now==null) return '???';
return last - this.calDamage(monster, core.status.hero.hp, core.status.hero.atk + c, core.status.hero.def, core.status.hero.mdef); return last - now;
} }
////// 1防减伤计算 ////// ////// 1防减伤计算 //////
@ -162,12 +194,12 @@ enemys.prototype.getDefDamage = function (monsterId) {
var monster = core.material.enemys[monsterId]; var monster = core.material.enemys[monsterId];
var nowDamage = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef); var nowDamage = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def, core.status.hero.mdef);
var nextDamage = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def + 1, core.status.hero.mdef); var nextDamage = this.calDamage(monster, core.status.hero.hp, core.status.hero.atk, core.status.hero.def + 1, core.status.hero.mdef);
if (nowDamage >= 999999999 || nextDamage >= 999999999) return "???"; if (nowDamage == null || nextDamage ==null) return "???";
return nowDamage - nextDamage; return nowDamage - nextDamage;
} }
////// 具体的伤害计算公式 ////// ////// 获得战斗伤害信息 //////
enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, hero_mdef) { enemys.prototype.getDamageInfo = function(monster, hero_hp, hero_atk, hero_def, hero_mdef) {
var mon_hp = monster.hp, mon_atk = monster.atk, mon_def = monster.def, mon_special = monster.special; var mon_hp = monster.hp, mon_atk = monster.atk, mon_def = monster.def, mon_special = monster.special;
hero_hp=Math.max(0, hero_hp); hero_hp=Math.max(0, hero_hp);
@ -176,7 +208,7 @@ enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, her
hero_mdef=Math.max(0, hero_mdef); hero_mdef=Math.max(0, hero_mdef);
if (this.hasSpecial(mon_special, 20) && !core.hasItem("cross")) // 如果是无敌属性,且勇士未持有十字架 if (this.hasSpecial(mon_special, 20) && !core.hasItem("cross")) // 如果是无敌属性,且勇士未持有十字架
return 999999999; // 返回无限大 return null; // 返回不可战斗
var initDamage = 0; // 战前伤害 var initDamage = 0; // 战前伤害
@ -186,7 +218,7 @@ enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, her
// 如果有神圣盾免疫吸血等可以在这里写 // 如果有神圣盾免疫吸血等可以在这里写
vampireDamage = parseInt(vampireDamage); vampireDamage = Math.floor(vampireDamage) || 0;
// 加到自身 // 加到自身
if (monster.add) // 如果加到自身 if (monster.add) // 如果加到自身
mon_hp += vampireDamage; mon_hp += vampireDamage;
@ -203,7 +235,7 @@ enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, her
if (this.hasSpecial(mon_special,2)) hero_def = 0; if (this.hasSpecial(mon_special,2)) hero_def = 0;
// 坚固 // 坚固
if (this.hasSpecial(mon_special,3) && mon_def < hero_atk - 1) mon_def = hero_atk - 1; if (this.hasSpecial(mon_special,3) && mon_def < hero_atk - 1) mon_def = hero_atk - 1;
if (hero_atk <= mon_def) return 999999999; // 不可战斗时请直接返回999999999 if (hero_atk <= mon_def) return null; // 不可战斗时请直接返回null
var per_damage = mon_atk - hero_def; var per_damage = mon_atk - hero_def;
if (per_damage < 0) per_damage = 0; if (per_damage < 0) per_damage = 0;
@ -215,7 +247,7 @@ enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, her
var counterDamage = 0; var counterDamage = 0;
// 反击 // 反击
if (this.hasSpecial(mon_special, 8)) counterDamage += parseInt(core.values.counterAttack * hero_atk); if (this.hasSpecial(mon_special, 8)) counterDamage += Math.floor(core.values.counterAttack * hero_atk);
// 先攻 // 先攻
if (this.hasSpecial(mon_special, 1)) if (this.hasSpecial(mon_special, 1))
@ -223,20 +255,41 @@ enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, her
// 破甲 // 破甲
if (this.hasSpecial(mon_special, 7)) if (this.hasSpecial(mon_special, 7))
initDamage += parseInt(core.values.breakArmor * hero_def); initDamage += Math.floor(core.values.breakArmor * hero_def);
// 净化 // 净化
if (this.hasSpecial(mon_special, 9)) if (this.hasSpecial(mon_special, 9))
initDamage += parseInt(core.values.purify * hero_mdef); initDamage += Math.floor(core.values.purify * hero_mdef);
var turn = parseInt((mon_hp - 1) / (hero_atk - mon_def)); // turn: 勇士攻击回合数
var ans = initDamage + turn * per_damage + (turn + 1) * counterDamage; var turn = Math.ceil(mon_hp / (hero_atk - mon_def));
var ans = initDamage + (turn - 1) * per_damage + turn * counterDamage;
ans -= hero_mdef; ans -= hero_mdef;
if (!core.flags.enableNegativeDamage) if (!core.flags.enableNegativeDamage)
ans=Math.max(0, ans); ans=Math.max(0, ans);
return ans; return {
"hero_atk": hero_atk,
"hero_def": hero_def,
"hero_mdef": hero_mdef,
"mon_hp": mon_hp,
"mon_atk": mon_atk,
"mon_def": mon_def,
"per_damage": per_damage,
"initDamage": initDamage,
"turn": turn,
"damage": ans
};
}
////// 具体的伤害计算公式 //////
enemys.prototype.calDamage = function (monster, hero_hp, hero_atk, hero_def, hero_mdef) {
var info = this.getDamageInfo(monster, hero_hp, hero_atk, hero_def, hero_mdef);
if (info == null) return null;
return info.damage;
} }
////// 获得当前楼层的怪物列表 ////// ////// 获得当前楼层的怪物列表 //////

View File

@ -123,11 +123,32 @@ events.prototype.lose = function (reason) {
////// 游戏结束 ////// ////// 游戏结束 //////
events.prototype.gameOver = function (ending, fromReplay) { events.prototype.gameOver = function (ending, fromReplay) {
// 下载录像
var confirmDownload = function () {
core.ui.closePanel();
setTimeout(function () {
core.ui.drawConfirmBox("你想下载录像吗?", function () {
var obj = {
'name': core.firstData.name,
'version': core.firstData.version,
'hard': core.status.hard,
'route': core.encodeRoute(core.status.route)
}
core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route", JSON.stringify(obj));
core.restart();
}, function () {
core.restart();
})
}, 150);
}
// 上传成绩 // 上传成绩
var confirmUpload = function () { var confirmUpload = function () {
core.ui.closePanel();
if (!core.isset(ending)) { if (!core.isset(ending)) {
core.restart(); confirmDownload();
return; return;
} }
@ -154,8 +175,7 @@ events.prototype.gameOver = function (ending, fromReplay) {
formData.append('route', core.encodeRoute(core.status.route)); formData.append('route', core.encodeRoute(core.status.route));
core.http("POST", "/games/upload.php", formData); core.http("POST", "/games/upload.php", formData);
confirmDownload();
core.restart();
} }
core.ui.drawConfirmBox("你想记录你的ID和成绩吗", function () { core.ui.drawConfirmBox("你想记录你的ID和成绩吗", function () {
@ -167,30 +187,14 @@ events.prototype.gameOver = function (ending, fromReplay) {
return; return;
} }
// 下载录像
var confirmDownload = function () {
core.ui.closePanel();
core.ui.drawConfirmBox("你想下载录像吗?", function () {
var obj = {
'name': core.firstData.name,
'version': core.firstData.version,
'hard': core.status.hard,
'route': core.encodeRoute(core.status.route)
}
core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route", JSON.stringify(obj));
confirmUpload();
}, function () {
confirmUpload();
})
}
if (fromReplay) { if (fromReplay) {
core.drawText("录像回放完毕!", function () { core.drawText("录像回放完毕!", function () {
core.restart(); core.restart();
}); });
} }
else { else {
confirmDownload(); // confirmDownload();
confirmUpload();
} }
} }
@ -386,6 +390,7 @@ events.prototype.doAction = function() {
}); });
break; break;
case "changeFloor": // 楼层转换 case "changeFloor": // 楼层转换
{
var heroLoc = {"x": data.loc[0], "y": data.loc[1]}; var heroLoc = {"x": data.loc[0], "y": data.loc[1]};
if (core.isset(data.direction)) heroLoc.direction=data.direction; if (core.isset(data.direction)) heroLoc.direction=data.direction;
core.changeFloor(data.floorId||core.status.floorId, null, heroLoc, data.time, function() { core.changeFloor(data.floorId||core.status.floorId, null, heroLoc, data.time, function() {
@ -393,6 +398,7 @@ events.prototype.doAction = function() {
core.events.doAction(); core.events.doAction();
}); });
break; break;
}
case "changePos": // 直接更换勇士位置,不切换楼层 case "changePos": // 直接更换勇士位置,不切换楼层
core.clearMap('hero', 0, 0, 416, 416); core.clearMap('hero', 0, 0, 416, 416);
if (core.isset(data.loc)) { if (core.isset(data.loc)) {
@ -410,6 +416,36 @@ events.prototype.doAction = function() {
else core.clearMap('animate', 0, 0, 416, 416); else core.clearMap('animate', 0, 0, 416, 416);
this.doAction(); this.doAction();
break; break;
case "animateImage": // 淡入淡出图片
if (core.status.replay.replaying) { // 正在播放录像
this.doAction();
}
else {
if (core.isset(data.loc) && core.isset(core.material.images.images[data.name]) && (data.action=="show" || data.action=="hide")) {
core.events.animateImage(data.action, core.material.images.images[data.name], data.loc, data.time, function() {
core.events.doAction();
});
}
else {
this.doAction();
}
}
break;
case "showGif": // 显示动图
if (core.isset(data.loc) && core.isset(core.material.images.images[data.name])) {
var gif = new Image();
gif.src = core.material.images.images[data.name].src;
gif.style.position = 'absolute';
gif.style.left = (data.loc[0]*core.domStyle.scale)+"px";
gif.style.top = (data.loc[1]*core.domStyle.scale)+"px";
core.dom.gif2.appendChild(gif);
}
else {
while (core.dom.gif2.firstChild)
core.dom.gif2.removeChild(core.dom.gif2.firstChild);
}
this.doAction();
break;
case "setFg": // 颜色渐变 case "setFg": // 颜色渐变
core.setFg(data.color, data.time, function() { core.setFg(data.color, data.time, function() {
core.events.doAction(); core.events.doAction();
@ -420,6 +456,7 @@ events.prototype.doAction = function() {
this.doAction(); this.doAction();
break; break;
case "openDoor": // 开一个门,包括暗墙 case "openDoor": // 开一个门,包括暗墙
{
var floorId=data.floorId || core.status.floorId; var floorId=data.floorId || core.status.floorId;
var block=core.getBlock(data.loc[0], data.loc[1], floorId); var block=core.getBlock(data.loc[0], data.loc[1], floorId);
if (block!=null) { if (block!=null) {
@ -435,6 +472,7 @@ events.prototype.doAction = function() {
} }
this.doAction(); this.doAction();
break; break;
}
case "openShop": // 打开一个全局商店 case "openShop": // 打开一个全局商店
if (core.status.replay.replaying) { // 正在播放录像简单将visited置为true if (core.status.replay.replaying) { // 正在播放录像简单将visited置为true
core.status.shops[data.id].visited=true; core.status.shops[data.id].visited=true;
@ -454,6 +492,7 @@ events.prototype.doAction = function() {
}) })
break; break;
case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的 case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的
{
var toX=data.loc[0], toY=data.loc[1]; var toX=data.loc[0], toY=data.loc[1];
var block=core.getBlock(toX, toY); var block=core.getBlock(toX, toY);
if (block!=null) { if (block!=null) {
@ -467,7 +506,9 @@ events.prototype.doAction = function() {
} }
this.doAction(); this.doAction();
break; break;
}
case "playSound": case "playSound":
if (!core.status.replay.replaying)
core.playSound(data.name); core.playSound(data.name);
this.doAction(); this.doAction();
break; break;
@ -488,7 +529,7 @@ events.prototype.doAction = function() {
var value=core.calValue(data.value); var value=core.calValue(data.value);
// 属性 // 属性
if (data.name.indexOf("status:")==0) { if (data.name.indexOf("status:")==0) {
value=parseInt(value); value=parseFloat(value);
core.setStatus(data.name.substring(7), value); core.setStatus(data.name.substring(7), value);
} }
// 道具 // 道具
@ -581,6 +622,7 @@ events.prototype.doAction = function() {
}); });
break; break;
case "function": case "function":
{
var func = data["function"]; var func = data["function"];
if (core.isset(func)) { if (core.isset(func)) {
if ((typeof func == "string") && func.indexOf("function")==0) { if ((typeof func == "string") && func.indexOf("function")==0) {
@ -591,16 +633,22 @@ events.prototype.doAction = function() {
} }
this.doAction(); this.doAction();
break; break;
}
case "update": case "update":
core.updateStatusBar(); core.updateStatusBar();
this.doAction(); this.doAction();
break; break;
case "sleep": // 等待多少毫秒 case "sleep": // 等待多少毫秒
if (core.status.replay.replaying)
core.events.doAction();
else {
setTimeout(function () { setTimeout(function () {
core.events.doAction(); core.events.doAction();
}, data.time); }, data.time);
}
break; break;
case "revisit": // 立刻重新执行该事件 case "revisit": // 立刻重新执行该事件
{
var block=core.getBlock(x,y); // 重新获得事件 var block=core.getBlock(x,y); // 重新获得事件
if (block!=null) { if (block!=null) {
block = block.block; block = block.block;
@ -610,6 +658,7 @@ events.prototype.doAction = function() {
} }
this.doAction(); this.doAction();
break; break;
}
case "exit": // 立刻结束事件 case "exit": // 立刻结束事件
core.status.event.data.list = []; core.status.event.data.list = [];
core.events.doAction(); core.events.doAction();
@ -732,9 +781,8 @@ events.prototype.battle = function (id, x, y, force, callback) {
core.stopHero(); core.stopHero();
core.stopAutomaticRoute(); core.stopAutomaticRoute();
var damage = core.enemys.getDamage(id);
// 非强制战斗 // 非强制战斗
if (damage >= core.status.hero.hp && !force) { if (!core.enemys.canBattle(id) && !force) {
core.drawTip("你打不过此怪物!"); core.drawTip("你打不过此怪物!");
core.clearContinueAutomaticRoute(); core.clearContinueAutomaticRoute();
return; return;
@ -885,6 +933,10 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
} }
else core.setWeather(); else core.setWeather();
// 清除gif
while (core.dom.gif.firstChild)
core.dom.gif.removeChild(core.dom.gif.firstChild);
// 检查重生 // 检查重生
if (!core.isset(fromLoad)) { if (!core.isset(fromLoad)) {
core.status.maps[floorId].blocks.forEach(function(block) { core.status.maps[floorId].blocks.forEach(function(block) {
@ -894,7 +946,6 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
} }
}) })
} }
core.drawMap(floorId, function () { core.drawMap(floorId, function () {
setTimeout(function() { setTimeout(function() {
if (core.isset(heroLoc.direction)) if (core.isset(heroLoc.direction))
@ -933,6 +984,37 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback
}, 25); }, 25);
} }
////// 图片淡入/淡出 //////
events.prototype.animateImage = function (type, image, loc, time, callback) {
time = time||0;
if ((type!='show' && type!='hide') || time<=0) {
if (core.isset(callback)) callback();
return;
}
clearInterval(core.interval.tipAnimate);
core.setAlpha('data', 1);
var opacityVal = 0;
if (type == 'hide') opacityVal = 1;
core.setOpacity('data', opacityVal);
core.canvas.data.drawImage(image, loc[0], loc[1]);
core.status.replay.animate=true;
var animate = setInterval(function () {
if (type=='show') opacityVal += 0.1;
else opacityVal -= 0.1;
core.setOpacity('data', opacityVal);
if (opacityVal >=1 || opacityVal<=0) {
clearInterval(animate);
core.clearMap('data', 0, 0, 416, 416);
core.setOpacity('data', 1);
core.status.replay.animate=false;
if (core.isset(callback)) callback();
}
}, time / 10 / core.status.replay.speed);
}
////// 打开一个全局商店 ////// ////// 打开一个全局商店 //////
events.prototype.openShop = function(shopId, needVisited) { events.prototype.openShop = function(shopId, needVisited) {
var shop = core.status.shops[shopId]; var shop = core.status.shops[shopId];

View File

@ -171,8 +171,8 @@ loader.prototype.loadMusic = function () {
} }
else { else {
var music = new Audio(); var music = new Audio();
music.preload = core.musicStatus.startDirectly?'auto':'none'; music.preload = 'none';
if (main.bgmRemote) music.src = 'https://gitee.com/ckcz123/h5music/raw/master/'+core.firstData.name+'/'+t; if (main.bgmRemote) music.src = main.bgmRemoteRoot+core.firstData.name+'/'+t;
else music.src = 'project/sounds/'+t; else music.src = 'project/sounds/'+t;
music.loop = 'loop'; music.loop = 'loop';
core.material.bgms[t] = music; core.material.bgms[t] = music;

View File

@ -328,8 +328,19 @@ maps.prototype.drawMap = function (mapName, callback) {
if (core.isset(dx) && core.isset(dy) && core.isset(core.material.images.images[p])) { if (core.isset(dx) && core.isset(dy) && core.isset(core.material.images.images[p])) {
dx*=32; dy*=32; dx*=32; dy*=32;
var image = core.material.images.images[p]; var image = core.material.images.images[p];
if (!t[3]) if (!t[3]) {
core.canvas.bg.drawImage(image, dx * ratio, dy * ratio, Math.min(size - dx * ratio, ratio * image.width), Math.min(size - dy * ratio, ratio * image.height)); core.canvas.bg.drawImage(image, dx * ratio, dy * ratio, Math.min(size - dx * ratio, ratio * image.width), Math.min(size - dy * ratio, ratio * image.height));
if (/.*\.gif/i.test(p)) {
while (core.dom.gif.firstChild)
core.dom.gif.removeChild(core.dom.gif.firstChild);
var gif = new Image();
gif.src = core.material.images.images[p].src;
gif.style.position = 'absolute';
gif.style.left = (dx*core.domStyle.scale)+"px";
gif.style.top = (dy*core.domStyle.scale)+"px";
core.dom.gif.appendChild(gif);
}
}
else else
core.canvas.event2.drawImage(image, dx*ratio, dy*ratio, Math.min(size-dx*ratio, ratio*image.width), Math.min(size-dy*ratio, ratio*image.height)); core.canvas.event2.drawImage(image, dx*ratio, dy*ratio, Math.min(size-dx*ratio, ratio*image.width), Math.min(size-dy*ratio, ratio*image.height));
} }
@ -669,9 +680,6 @@ maps.prototype.animateBlock = function (loc,type,time,callback) {
if (type=='show') opacityVal += 0.1; if (type=='show') opacityVal += 0.1;
else opacityVal -= 0.1; else opacityVal -= 0.1;
core.setOpacity('animate', opacityVal); core.setOpacity('animate', opacityVal);
core.clearMap('animate',0,0,416,416);
draw();
if (opacityVal >=1 || opacityVal<=0) { if (opacityVal >=1 || opacityVal<=0) {
clearInterval(animate); clearInterval(animate);
core.clearMap('animate', 0, 0, 416, 416); core.clearMap('animate', 0, 0, 416, 416);

View File

@ -734,6 +734,7 @@ ui.prototype.drawSwitchs = function() {
"背景音效:"+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"), "背景音效:"+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
"战斗动画: "+(core.flags.battleAnimate ? "[ON]" : "[OFF]"), "战斗动画: "+(core.flags.battleAnimate ? "[ON]" : "[OFF]"),
"怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"), "怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"), "领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
"下载离线版本", "下载离线版本",
"返回主菜单" "返回主菜单"
@ -787,7 +788,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
// 如果有神圣盾免疫吸血等可以在这里写 // 如果有神圣盾免疫吸血等可以在这里写
vampireDamage = parseInt(vampireDamage); vampireDamage = Math.floor(vampireDamage);
// 加到自身 // 加到自身
if (monster.add) // 如果加到自身 if (monster.add) // 如果加到自身
mon_hp += vampireDamage; mon_hp += vampireDamage;
@ -815,8 +816,8 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
if (core.enemys.hasSpecial(mon_special, 6)) turns=1+(monster.n||4); if (core.enemys.hasSpecial(mon_special, 6)) turns=1+(monster.n||4);
// 初始伤害 // 初始伤害
if (core.enemys.hasSpecial(mon_special, 7)) initDamage+=parseInt(core.values.breakArmor * hero_def); if (core.enemys.hasSpecial(mon_special, 7)) initDamage+=Math.floor(core.values.breakArmor * hero_def);
if (core.enemys.hasSpecial(mon_special, 9)) initDamage+=parseInt(core.values.purify * hero_mdef); if (core.enemys.hasSpecial(mon_special, 9)) initDamage+=Math.floor(core.values.purify * hero_mdef);
hero_mdef-=initDamage; hero_mdef-=initDamage;
if (hero_mdef<0) { if (hero_mdef<0) {
hero_hp+=hero_mdef; hero_hp+=hero_mdef;
@ -1001,7 +1002,7 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) {
// 反击 // 反击
if (core.enemys.hasSpecial(mon_special, 8)) { if (core.enemys.hasSpecial(mon_special, 8)) {
hero_mdef -= parseInt(core.values.counterAttack * hero_atk); hero_mdef -= Math.floor(core.values.counterAttack * hero_atk);
if (hero_mdef<0) { if (hero_mdef<0) {
hero_hp+=hero_mdef; hero_hp+=hero_mdef;
@ -1247,16 +1248,16 @@ ui.prototype.drawBook = function (index) {
} }
core.canvas.ui.textAlign = "left"; core.canvas.ui.textAlign = "left";
core.fillText('ui', '生命', 165, 62 * i + 32, '#DDDDDD', '13px Verdana'); core.fillText('ui', '生命', 165, 62 * i + 32, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.hp, 195, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', core.formatBigNumber(enemy.hp), 195, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '攻击', 255, 62 * i + 32, '#DDDDDD', '13px Verdana'); core.fillText('ui', '攻击', 255, 62 * i + 32, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.atk, 285, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', core.formatBigNumber(enemy.atk), 285, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '防御', 335, 62 * i + 32, '#DDDDDD', '13px Verdana'); core.fillText('ui', '防御', 335, 62 * i + 32, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.def, 365, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', core.formatBigNumber(enemy.def), 365, 62 * i + 32, '#DDDDDD', 'bold 13px Verdana');
var expOffset = 165, line_cnt=0; var expOffset = 165, line_cnt=0;
if (core.flags.enableMoney) { if (core.flags.enableMoney) {
core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px Verdana'); core.fillText('ui', '金币', 165, 62 * i + 50, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.money, 195, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', core.formatBigNumber(enemy.money), 195, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
expOffset = 255; expOffset = 255;
line_cnt++; line_cnt++;
} }
@ -1265,7 +1266,7 @@ ui.prototype.drawBook = function (index) {
if (core.flags.enableAddPoint) { if (core.flags.enableAddPoint) {
core.canvas.ui.textAlign = "left"; core.canvas.ui.textAlign = "left";
core.fillText('ui', '加点', expOffset, 62 * i + 50, '#DDDDDD', '13px Verdana'); core.fillText('ui', '加点', expOffset, 62 * i + 50, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.point, expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', core.formatBigNumber(enemy.point), expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
expOffset = 255; expOffset = 255;
line_cnt++; line_cnt++;
} }
@ -1273,7 +1274,7 @@ ui.prototype.drawBook = function (index) {
if (core.flags.enableExperience && line_cnt<2) { if (core.flags.enableExperience && line_cnt<2) {
core.canvas.ui.textAlign = "left"; core.canvas.ui.textAlign = "left";
core.fillText('ui', '经验', expOffset, 62 * i + 50, '#DDDDDD', '13px Verdana'); core.fillText('ui', '经验', expOffset, 62 * i + 50, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.experience, expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', core.formatBigNumber(enemy.experience), expOffset + 30, 62 * i + 50, '#DDDDDD', 'bold 13px Verdana');
line_cnt++; line_cnt++;
} }
@ -1281,31 +1282,30 @@ ui.prototype.drawBook = function (index) {
if (line_cnt==1) damageOffset=326; if (line_cnt==1) damageOffset=326;
if (line_cnt==2) damageOffset=361; if (line_cnt==2) damageOffset=361;
/*
var damageOffet = 281;
if (core.flags.enableMoney && core.flags.enableExperience)
damageOffet = 361;
else if (core.flags.enableMoney || core.flags.enableExperience)
damageOffet = 326;
*/
core.canvas.ui.textAlign = "center"; core.canvas.ui.textAlign = "center";
var damage = enemy.damage; var damage = enemy.damage;
var color = '#FFFF00'; var color = '#FFFF00';
if (damage == null) {
damage = '无法战斗';
color = '#FF0000';
}
else {
if (damage >= core.status.hero.hp) color = '#FF0000'; if (damage >= core.status.hero.hp) color = '#FF0000';
if (damage<=0) color = '#00FF00'; if (damage<=0) color = '#00FF00';
if (damage >= 999999999) damage = '无法战斗';
damage = core.formatBigNumber(damage);
}
core.fillText('ui', damage, damageOffset, 62 * i + 50, color, 'bold 13px Verdana'); core.fillText('ui', damage, damageOffset, 62 * i + 50, color, 'bold 13px Verdana');
core.canvas.ui.textAlign = "left"; core.canvas.ui.textAlign = "left";
core.fillText('ui', '临界', 165, 62 * i + 68, '#DDDDDD', '13px Verdana'); core.fillText('ui', '临界', 165, 62 * i + 68, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.critical, 195, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', core.formatBigNumber(enemy.critical), 195, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '减伤', 255, 62 * i + 68, '#DDDDDD', '13px Verdana'); core.fillText('ui', '减伤', 255, 62 * i + 68, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.criticalDamage, 285, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', core.formatBigNumber(enemy.criticalDamage), 285, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana');
core.fillText('ui', '1防', 335, 62 * i + 68, '#DDDDDD', '13px Verdana'); core.fillText('ui', '1防', 335, 62 * i + 68, '#DDDDDD', '13px Verdana');
core.fillText('ui', enemy.defDamage, 365, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana'); core.fillText('ui', core.formatBigNumber(enemy.defDamage), 365, 62 * i + 68, '#DDDDDD', 'bold 13px Verdana');
if (index == start+i) { if (index == start+i) {
core.strokeRect('ui', 10, 62 * i + 13, 416-10*2, 62, '#FFD700'); core.strokeRect('ui', 10, 62 * i + 13, 416-10*2, 62, '#FFD700');
@ -1327,10 +1327,9 @@ ui.prototype.drawBookDetail = function (index) {
var enemyId=enemy.id; var enemyId=enemy.id;
var hints=core.enemys.getSpecialHint(core.material.enemys[enemyId]); var hints=core.enemys.getSpecialHint(core.material.enemys[enemyId]);
if (hints.length==0) {
core.drawTip("该怪物无特殊属性!"); if (hints.length==0)
return; hints.push("该怪物无特殊属性。");
}
var content=hints.join("\n"); var content=hints.join("\n");
core.status.event.id = 'book-detail'; core.status.event.id = 'book-detail';
@ -1573,13 +1572,16 @@ ui.prototype.drawSLPanel = function(index) {
var u=416/6, size=118; var u=416/6, size=118;
var strokeColor = '#FFD700';
if (core.status.event.selection) strokeColor = '#FF6A6A';
var name=core.status.event.id=='save'?"存档":"读档"; var name=core.status.event.id=='save'?"存档":"读档";
for (var i=0;i<6;i++) { for (var i=0;i<6;i++) {
var id=5*page+i; var id=5*page+i;
var data=core.getLocalStorage(i==0?"autoSave":"save"+id, null); var data=core.getLocalStorage(i==0?"autoSave":"save"+id, null);
if (i<3) { if (i<3) {
core.fillText('ui', i==0?"自动存档":name+id, (2*i+1)*u, 35, '#FFFFFF', "bold 17px Verdana"); core.fillText('ui', i==0?"自动存档":name+id, (2*i+1)*u, 35, '#FFFFFF', "bold 17px Verdana");
core.strokeRect('ui', (2*i+1)*u-size/2, 50, size, size, i==offset?'#FFD700':'#FFFFFF', i==offset?6:2); core.strokeRect('ui', (2*i+1)*u-size/2, 50, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
if (core.isset(data) && core.isset(data.floorId)) { if (core.isset(data) && core.isset(data.floorId)) {
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc); this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc);
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, '#FFFFFF', '10px Verdana'); core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, '#FFFFFF', '10px Verdana');
@ -1591,7 +1593,7 @@ ui.prototype.drawSLPanel = function(index) {
} }
else { else {
core.fillText('ui', name+id, (2*i-5)*u, 230, '#FFFFFF', "bold 17px Verdana"); core.fillText('ui', name+id, (2*i-5)*u, 230, '#FFFFFF', "bold 17px Verdana");
core.strokeRect('ui', (2*i-5)*u-size/2, 245, size, size, i==offset?'#FFD700':'#FFFFFF', i==offset?6:2); core.strokeRect('ui', (2*i-5)*u-size/2, 245, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2);
if (core.isset(data) && core.isset(data.floorId)) { if (core.isset(data) && core.isset(data.floorId)) {
this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc); this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc);
core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, '#FFFFFF', '10px Verdana'); core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, '#FFFFFF', '10px Verdana');
@ -1603,6 +1605,11 @@ ui.prototype.drawSLPanel = function(index) {
} }
} }
this.drawPagination(page+1, 30); this.drawPagination(page+1, 30);
if (core.status.event.selection)
core.setFillStyle('ui', '#FF6A6A');
core.fillText('ui', '删除模式', 48, 403);
} }
////// 绘制一个缩略图 ////// ////// 绘制一个缩略图 //////

View File

@ -145,6 +145,29 @@ utils.prototype.setTwoDigits = function (x) {
return parseInt(x)<10?"0"+x:x; return parseInt(x)<10?"0"+x:x;
} }
utils.prototype.formatBigNumber = function (x) {
x = parseFloat(x);
if (!core.isset(x)) return '???';
var all = [
{"val": 10e20, "c": "g"},
{"val": 10e16, "c": "j"},
{"val": 10e12, "c": "z"},
{"val": 10e8, "c": "e"},
{"val": 10e4, "c": "w"},
]
for (var i=0;i<all.length;i++) {
var one = all[i];
if (x>=10*one.val) {
var v = x/one.val;
return v.toFixed(Math.max(0, Math.floor(4-Math.log10(v)))) + one.c;
}
}
return x;
}
////// 数组转RGB ////// ////// 数组转RGB //////
utils.prototype.arrayToRGB = function (color) { utils.prototype.arrayToRGB = function (color) {
var nowR = parseInt(color[0])||0, nowG = parseInt(color[1])||0, nowB = parseInt(color[2])||0; var nowR = parseInt(color[0])||0, nowG = parseInt(color[1])||0, nowB = parseInt(color[2])||0;
@ -278,7 +301,7 @@ utils.prototype.readFile = function (success, error, readType) {
if (core.platform.fileInput==null) { if (core.platform.fileInput==null) {
core.platform.fileInput = document.createElement("input"); core.platform.fileInput = document.createElement("input");
core.platform.fileInput.style.display = 'none'; core.platform.fileInput.style.opacity = 0;
core.platform.fileInput.type = 'file'; core.platform.fileInput.type = 'file';
core.platform.fileInput.onchange = function () { core.platform.fileInput.onchange = function () {
var files = core.platform.fileInput.files; var files = core.platform.fileInput.files;
@ -301,6 +324,11 @@ utils.prototype.readFile = function (success, error, readType) {
////// 下载文件到本地 ////// ////// 下载文件到本地 //////
utils.prototype.download = function (filename, content) { utils.prototype.download = function (filename, content) {
if (core.isset(window.jsinterface)) {
window.jsinterface.download(filename, content);
return;
}
// Step 0: 不为http/https直接不支持 // Step 0: 不为http/https直接不支持
if (!core.platform.isOnline) { if (!core.platform.isOnline) {
alert("离线状态下不支持下载操作!"); alert("离线状态下不支持下载操作!");

14
main.js
View File

@ -10,6 +10,7 @@ function main() {
// 如果要进行剧本的修改请务必将其改成false。 // 如果要进行剧本的修改请务必将其改成false。
this.bgmRemote = false; // 是否采用远程BGM this.bgmRemote = false; // 是否采用远程BGM
this.bgmRemoteRoot = "https://gitee.com/ckcz123/h5music/raw/master/"; // 远程BGM的根目录
//------------------------ 用户修改内容 END ------------------------// //------------------------ 用户修改内容 END ------------------------//
@ -35,6 +36,8 @@ function main() {
'toolBar': document.getElementById('toolBar'), 'toolBar': document.getElementById('toolBar'),
'tools': document.getElementsByClassName('tools'), 'tools': document.getElementsByClassName('tools'),
'gameCanvas': document.getElementsByClassName('gameCanvas'), 'gameCanvas': document.getElementsByClassName('gameCanvas'),
'gif': document.getElementById('gif'),
'gif2': document.getElementById('gif2'),
'curtain': document.getElementById('curtain'), 'curtain': document.getElementById('curtain'),
'startButtons': document.getElementById('startButtons'), 'startButtons': document.getElementById('startButtons'),
'playGame': document.getElementById('playGame'), 'playGame': document.getElementById('playGame'),
@ -174,9 +177,17 @@ main.prototype.init = function (mode, callback) {
////// 动态加载所有核心JS文件 ////// ////// 动态加载所有核心JS文件 //////
main.prototype.loaderJs = function (dir, loadList, callback) { main.prototype.loaderJs = function (dir, loadList, callback) {
var instanceNum = 0;
// 加载js // 加载js
main.setMainTipsText('正在加载核心js文件...') main.setMainTipsText('正在加载核心js文件...')
if (this.useCompress) {
main.loadMod(dir, dir, function () {
callback();
})
}
else {
var instanceNum = 0;
for (var i = 0; i < loadList.length; i++) { for (var i = 0; i < loadList.length; i++) {
main.loadMod(dir, loadList[i], function (modName) { main.loadMod(dir, loadList[i], function (modName) {
main.setMainTipsText(modName + '.js 加载完毕'); main.setMainTipsText(modName + '.js 加载完毕');
@ -187,6 +198,7 @@ main.prototype.loaderJs = function (dir, loadList, callback) {
}); });
} }
} }
}
////// 加载某一个JS文件 ////// ////// 加载某一个JS文件 //////
main.prototype.loadMod = function (dir, modName, callback) { main.prototype.loadMod = function (dir, modName, callback) {

View File

@ -488,6 +488,12 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_bool": "bool", "_bool": "bool",
"_data": "是否地图怪物显伤;用户可以手动在菜单栏中开关" "_data": "是否地图怪物显伤;用户可以手动在菜单栏中开关"
}, },
"displayCritical": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否地图显示临界;用户可以手动在菜单栏中开关"
},
"displayExtraDamage": { "displayExtraDamage": {
"_leaf": true, "_leaf": true,
"_type": "checkbox", "_type": "checkbox",

View File

@ -5,13 +5,13 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"sample0", "sample1", "sample2", "MT0" "sample0", "sample1", "sample2", "MT0"
], ],
"images" : [ "images" : [
"bg.jpg", "bg.jpg"
], ],
"animates" : [ "animates" : [
"hand", "sword", "zone", "yongchang", "hand", "sword", "zone",
], ],
"bgms" : [ "bgms" : [
'bgm.mp3', 'qianjin.mid', 'star.mid', 'bgm.mp3'
], ],
"sounds" : [ "sounds" : [
'floor.mp3', 'attack.ogg', 'door.ogg', 'item.ogg', 'zone.ogg' 'floor.mp3', 'attack.ogg', 'door.ogg', 'item.ogg', 'zone.ogg'
@ -142,13 +142,13 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"enableLevelUp": false, "enableLevelUp": false,
"enableDebuff": false, "enableDebuff": false,
"flyNearStair": true, "flyNearStair": true,
"pickaxeFourDirections": true, "pickaxeFourDirections": false,
"bombFourDirections": true, "bombFourDirections": false,
"bigKeyIsBox": false, "bigKeyIsBox": false,
"equipment": true, "equipment": false,
"enableDeleteItem": true, "enableDeleteItem": true,
"enableAddPoint": false, "enableAddPoint": false,
"enableNegativeDamage": true, "enableNegativeDamage": false,
"hatredDecrease": true, "hatredDecrease": true,
"betweenAttackCeil": false, "betweenAttackCeil": false,
"startDirectly": false, "startDirectly": false,
@ -156,6 +156,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"showBattleAnimateConfirm": true, "showBattleAnimateConfirm": true,
"battleAnimate": true, "battleAnimate": true,
"displayEnemyDamage": true, "displayEnemyDamage": true,
"displayCritical": true,
"displayExtraDamage": true, "displayExtraDamage": true,
"enableGentleClick": true, "enableGentleClick": true,
"potionWhileRouting": false, "potionWhileRouting": false,

View File

@ -18,16 +18,16 @@ main.floors.sample0 =
[ 0, 0,220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42], [ 0, 0,220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42],
[ 0,246, 0,246, 0, 20, 0, 3, 58, 59, 60, 61, 41], [ 0,246, 0,246, 0, 20, 0, 3, 58, 59, 60, 61, 41],
[219, 0, 0, 0,219, 20, 0, 3, 57, 26, 62, 63, 40], [219, 0, 0, 0,219, 20, 0, 3, 57, 26, 62, 63, 40],
[20, 20, 125, 20, 20, 20, 0, 3, 53, 54, 55, 56, 39], [ 20, 20,115, 20, 20, 20, 0, 3, 53, 54, 55, 56, 39],
[216,247,263,235,248, 6, 0, 3, 49, 50, 51, 52, 38], [216,247,263,235,248, 6, 0, 3, 49, 50, 51, 52, 38],
[6, 6, 125, 6, 6, 6, 0, 1, 45, 46, 47, 48, 37], [ 6, 6,115, 6, 6, 6, 0, 1, 45, 46, 47, 48, 37],
[224,254,212,262,204, 5, 0, 1, 31, 32, 34, 33, 36], [224,254,212,262,204, 5, 0, 1, 31, 32, 34, 33, 36],
[201,261,217,264,207, 5, 0, 1, 27, 28, 29, 30, 35], [201,261,217,264,207, 5, 0, 1, 27, 28, 29, 30, 35],
[5, 5, 125, 5, 5, 5, 0, 1, 21, 22, 23, 24, 25], [ 5, 5,115, 5, 5, 5, 0, 1, 21, 22, 23, 24, 25],
[0, 0, 237, 0, 0, 0, 45, 1, 1, 1, 121, 1, 1], [ 0, 0,237, 0, 0, 0, 45, 1, 1, 1,111, 1, 1],
[4, 4, 133, 4, 4, 4, 0, 0, 0, 0, 0, 85, 124], [ 4, 4,139, 4, 4, 4, 0, 0, 0, 0, 0, 85,114],
[87, 11, 12, 13, 14, 4, 4, 2, 2, 2, 122, 2, 2], [ 87, 11, 12, 13, 14, 4, 4, 2, 2, 2,112, 2, 2],
[88, 89, 90, 91, 92, 93, 94, 2, 81, 82, 83, 84, 86], [ 88, 89, 90, 91, 92, 93, 94, 2, 81, 82, 83, 84, 86]
], ],
"firstArrive": [ // 第一次到该楼层触发的事件 "firstArrive": [ // 第一次到该楼层触发的事件
"\t[样板提示]首次到达某层可以触发 firstArrive 事件该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型常常用来触发对话例如", "\t[样板提示]首次到达某层可以触发 firstArrive 事件该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型常常用来触发对话例如",

View File

@ -15,19 +15,19 @@ main.floors.sample1 =
// "bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。 // "bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。
"item_ratio": 1, // 该层的宝石/血瓶倍率 "item_ratio": 1, // 该层的宝石/血瓶倍率
"map": [ // 地图数据需要是13x13建议使用地图生成器来生成 "map": [ // 地图数据需要是13x13建议使用地图生成器来生成
[7, 131, 8, 152, 9, 130, 10, 152, 166, 165, 132, 165, 166], [ 7,121, 8,152, 9,120, 10,352,176,175,122,175,176],
[0, 0, 0, 0, 0, 0, 0, 152, 165, 164, 0, 162, 165], [ 0, 0, 0, 0, 0, 0, 0,352,175,174, 0,172,175],
[152, 152, 152, 152, 121, 152, 152, 152, 0, 0, 229, 0, 0], [352,352,352,352,111,352,352,352, 0, 0,229, 0, 0],
[43, 33, 44, 151, 0, 0, 0, 152, 165, 161, 0, 163, 165], [ 43, 33, 44,151, 0, 0, 0,352,175,171, 0,173,175],
[21, 22, 21, 151, 0, 0, 0, 152, 166, 165, 0, 165, 166], [ 21, 22, 21,151, 0, 0, 0,352,176,175, 0,175,176],
[151, 245, 151, 151, 0, 87, 0, 152, 152, 152, 85, 153, 153], [351,245,351,351, 0, 87, 0,352,352,352, 85,353,353],
[0, 246, 0, 151, 0, 0, 0, 152, 152, 221, 0, 221, 153], [ 0,246, 0,351, 0, 0, 0,352,152,221, 0,221,353],
[246, 0, 246, 151, 0, 0, 0, 121, 85, 0, 0, 0, 153], [246, 0,246,351, 0, 0, 0,111, 85, 0, 0, 0,353],
[151, 246, 151, 151, 0, 153, 153, 153, 153, 153, 153, 153, 153], [351,246,351,351, 0,353,353,353,353,353,353,353,353],
[0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 163, 0, 0], [ 0, 0, 0, 0, 0, 0, 0,174, 0, 0,173, 0, 0],
[1, 1, 1, 1, 0, 20, 0, 0, 0, 162, 0, 161, 0], [ 1, 1, 1, 1, 0, 20, 0, 0, 0,172, 0,171, 0],
[1, 0, 123, 1, 0, 20, 124, 0, 121, 0, 122, 0, 126], [ 1, 0,113, 1, 0, 20,114, 0,111, 0,112, 0,116],
[1, 0, 0, 1, 88, 20, 86, 0, 0, 0, 0, 0, 0], [ 1, 0, 0, 1, 88, 20, 86, 0, 0, 0, 0, 0, 0]
], ],
"firstArrive": [ // 第一次到该楼层触发的事件 "firstArrive": [ // 第一次到该楼层触发的事件

View File

@ -12,7 +12,7 @@ main.floors.sample2 =
"images": [], // // 该层默认显示的所有图片;详细用法请查看文档“自定义素材”中的说明。 "images": [], // // 该层默认显示的所有图片;详细用法请查看文档“自定义素材”中的说明。
"color": [255,0,0,0.3], // 该层的默认画面色调。本项可不写代表无色调如果写需要是一个RGBA数组。 "color": [255,0,0,0.3], // 该层的默认画面色调。本项可不写代表无色调如果写需要是一个RGBA数组。
"weather": ["rain",10], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪第二项为1-10之间的数代表强度。 "weather": ["rain",10], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪第二项为1-10之间的数代表强度。
"bgm": "qianjin.mid", // 到达该层后默认播放的BGM。本项可忽略。 "bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。
"item_ratio": 1, // 该层的宝石/血瓶倍率 "item_ratio": 1, // 该层的宝石/血瓶倍率
"map": [ // 地图数据需要是13x13建议使用地图生成器来生成 "map": [ // 地图数据需要是13x13建议使用地图生成器来生成
[ 5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5], [ 5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
@ -21,13 +21,13 @@ main.floors.sample2 =
[ 5, 4, 4, 4,247, 1,247, 1,247, 4, 4, 4, 5], [ 5, 4, 4, 4,247, 1,247, 1,247, 4, 4, 4, 5],
[ 5, 4, 4, 4, 1,247,247,247, 1, 4, 4, 4, 5], [ 5, 4, 4, 4, 1,247,247,247, 1, 4, 4, 4, 5],
[ 5, 4, 4, 4, 1,247, 30,247, 1, 4, 4, 4, 5], [ 5, 4, 4, 4, 1,247, 30,247, 1, 4, 4, 4, 5],
[5, 4, 4, 4, 247, 1, 124, 1, 247, 4, 4, 4, 5], [ 5, 4, 4, 4,247, 1,114, 1,247, 4, 4, 4, 5],
[5, 4, 4, 4, 4, 1, 123, 1, 4, 4, 4, 4, 5], [ 5, 4, 4, 4, 4, 1,113, 1, 4, 4, 4, 4, 5],
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5], [ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5], [ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
[ 5, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, 4, 5], [ 5, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, 4, 5],
[ 5, 4, 4, 4, 4, 4, 85, 4, 4, 4, 4, 4, 5], [ 5, 4, 4, 4, 4, 4, 85, 4, 4, 4, 4, 4, 5],
[5, 5, 5, 5, 5, 5, 88, 5, 5, 5, 5, 5, 5], [ 5, 5, 5, 5, 5, 5, 88, 5, 5, 5, 5, 5, 5]
], ],
"firstArrive": [ // 第一次到该楼层触发的事件 "firstArrive": [ // 第一次到该楼层触发的事件
"\t[实战!]本楼将尝试复刻《宿命的旋律》40F剧情。" "\t[实战!]本楼将尝试复刻《宿命的旋律》40F剧情。"

View File

@ -59,7 +59,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.removeGlobalAnimate(0,0,true); core.removeGlobalAnimate(0,0,true);
core.clearMap('all'); // 清空全地图 core.clearMap('all'); // 清空全地图
core.drawText([ core.drawText([
"\t[恭喜通关]你的分数是${status:hp}。" "\t[" + (reason||"恭喜通关") + "]你的分数是${status:hp}。"
], function () { ], function () {
core.events.gameOver(reason||'', replaying); core.events.gameOver(reason||'', replaying);
}) })
@ -73,7 +73,7 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.stopReplay(); core.stopReplay();
core.waitHeroToStop(function() { core.waitHeroToStop(function() {
core.drawText([ core.drawText([
"\t[结局1]你死了。\n如题。" "\t["+(reason||"结局1")+"]你死了。\n如题。"
], function () { ], function () {
core.events.gameOver(null, replaying); core.events.gameOver(null, replaying);
}); });
@ -116,8 +116,11 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var enemy = core.material.enemys[enemyId]; var enemy = core.material.enemys[enemyId];
var damage = core.enemys.getDamage(enemyId);
if (damage == null) damage = core.status.hero.hp+1;
// 扣减体力值 // 扣减体力值
core.status.hero.hp -= core.enemys.getDamage(enemyId); core.status.hero.hp -= damage;
if (core.status.hero.hp<=0) { if (core.status.hero.hp<=0) {
core.status.hero.hp=0; core.status.hero.hp=0;
core.updateStatusBar(); core.updateStatusBar();
@ -343,18 +346,52 @@ functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
this.useEquipment = function (itemId) { // 使用装备 this.useEquipment = function (itemId) { // 使用装备
if (itemId.indexOf("sword")==0) { if (itemId.indexOf("sword")==0) {
var now=core.getFlag('sword', 'sword0'); // 当前装备剑的ID var now=core.getFlag('sword', 'sword0'); // 当前装备剑的ID
if (typeof core.values[now] == 'number') {
core.status.hero.atk -= core.values[now]; core.status.hero.atk -= core.values[now];
core.setItem(now, 1); }
else {
core.status.hero.atk -= core.values[now].atk || 0;
core.status.hero.def -= core.values[now].def || 0;
core.status.hero.mdef -= core.values[now].mdef || 0;
}
if (typeof core.values[itemId] == 'number') {
core.status.hero.atk += core.values[itemId]; core.status.hero.atk += core.values[itemId];
}
else {
core.status.hero.atk -= core.values[itemId].atk || 0;
core.status.hero.def -= core.values[itemId].def || 0;
core.status.hero.mdef -= core.values[itemId].mdef || 0;
}
core.setItem(now, 1);
core.setItem(itemId, 0); core.setItem(itemId, 0);
core.setFlag('sword', itemId); core.setFlag('sword', itemId);
core.drawTip("已装备"+core.material.items[itemId].name); core.drawTip("已装备"+core.material.items[itemId].name);
} }
if (itemId.indexOf("shield")==0) { if (itemId.indexOf("shield")==0) {
var now=core.getFlag('shield', 'shield0'); var now=core.getFlag('shield', 'shield0');
if (typeof core.values[now] == 'number') {
core.status.hero.def -= core.values[now]; core.status.hero.def -= core.values[now];
core.setItem(now, 1); }
else {
core.status.hero.atk -= core.values[now].atk || 0;
core.status.hero.def -= core.values[now].def || 0;
core.status.hero.mdef -= core.values[now].mdef || 0;
}
if (typeof core.values[itemId] == 'number') {
core.status.hero.def += core.values[itemId]; core.status.hero.def += core.values[itemId];
}
else {
core.status.hero.atk -= core.values[itemId].atk || 0;
core.status.hero.def -= core.values[itemId].def || 0;
core.status.hero.mdef -= core.values[itemId].mdef || 0;
}
core.setItem(now, 1);
core.setItem(itemId, 0); core.setItem(itemId, 0);
core.setFlag('shield', itemId); core.setFlag('shield', itemId);
core.drawTip("已装备"+core.material.items[itemId].name); core.drawTip("已装备"+core.material.items[itemId].name);

View File

@ -99,7 +99,23 @@ icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
'wood': 8, 'wood': 8,
'pinkShop': 9, 'pinkShop': 9,
'blueShop': 10, 'blueShop': 10,
'princess': 11 'princess': 11,
'wlt': 12,
'wt': 13,
'wrt': 14,
'wl': 15,
'wc': 16,
'wr': 17,
'wlb': 18,
'wrb': 19,
'dlt': 20,
'dt': 21,
'drt': 22,
'dl': 23,
'dc': 24,
'dr': 25,
'dlb': 26,
'drb': 27,
}, },
'npc48': { 'npc48': {
'npc0': 0, 'npc0': 0,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -23,10 +23,10 @@ maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
// Autotile // Autotile
'20':{'cls': 'autotile', 'id': 'autotile', 'noPass': true}, // autotile '20':{'cls': 'autotile', 'id': 'autotile', 'noPass': true}, // autotile
// 更多的autotile从151到160等只要不和现有的数字冲突即可 // 更多的autotile只要不和现有的数字冲突即可
'151':{'cls': 'autotile', 'id': 'autotile1', 'noPass': true}, '351':{'cls': 'autotile', 'id': 'autotile1', 'noPass': true},
'152':{'cls': 'autotile', 'id': 'autotile2', 'noPass': true}, '352':{'cls': 'autotile', 'id': 'autotile2', 'noPass': true},
'153':{'cls': 'autotile', 'id': 'autotile3', 'noPass': true}, '353':{'cls': 'autotile', 'id': 'autotile3', 'noPass': true},
////////////////////////// 物品部分 ////////////////////////// ////////////////////////// 物品部分 //////////////////////////
@ -99,40 +99,54 @@ maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
////////////////////////// NPC部分 ////////////////////////// ////////////////////////// NPC部分 //////////////////////////
// 121-150 NPC // 111-150 NPC
'121':{'cls': 'npcs', 'id': 'man'}, '111':{'cls': 'npcs', 'id': 'man'},
'122':{'cls': 'npcs', 'id': 'woman'}, '112':{'cls': 'npcs', 'id': 'woman'},
'123':{'cls': 'npcs', 'id': 'thief'}, '113':{'cls': 'npcs', 'id': 'thief'},
'124':{'cls': 'npcs', 'id': 'fairy'}, '114':{'cls': 'npcs', 'id': 'fairy'},
'125':{'cls': 'npcs', 'id': 'magician'}, '115':{'cls': 'npcs', 'id': 'magician'},
'126':{'cls': 'npcs', 'id': 'womanMagician'}, '116':{'cls': 'npcs', 'id': 'womanMagician'},
'127':{'cls': 'npcs', 'id': 'oldMan'}, '117':{'cls': 'npcs', 'id': 'oldMan'},
'128':{'cls': 'npcs', 'id': 'child'}, '118':{'cls': 'npcs', 'id': 'child'},
'129':{'cls': 'npcs', 'id': 'wood'}, '119':{'cls': 'npcs', 'id': 'wood'},
'130':{'cls': 'npcs', 'id': 'pinkShop'}, '120':{'cls': 'npcs', 'id': 'pinkShop'},
'131':{'cls': 'npcs', 'id': 'blueShop'}, '121':{'cls': 'npcs', 'id': 'blueShop'},
'132':{'cls': 'npcs', 'id': 'princess'}, '122':{'cls': 'npcs', 'id': 'princess'},
'133':{'cls': 'npc48', 'id': 'npc0'}, '123': {'cls': 'npcs', 'id': 'wlt'},
'134':{'cls': 'npc48', 'id': 'npc1'}, '124': {'cls': 'npcs', 'id': 'wt'},
'135':{'cls': 'npc48', 'id': 'npc2'}, '125': {'cls': 'npcs', 'id': 'wrt'},
'136':{'cls': 'npc48', 'id': 'npc3'}, '126': {'cls': 'npcs', 'id': 'wl'},
'137':{'cls': 'npc48', 'id': 'npc4'}, '127': {'cls': 'npcs', 'id': 'wc'},
'128': {'cls': 'npcs', 'id': 'wr'},
'129': {'cls': 'npcs', 'id': 'wlb'},
'130': {'cls': 'npcs', 'id': 'wrb'},
'131': {'cls': 'npcs', 'id': 'dlt'},
'132': {'cls': 'npcs', 'id': 'dt'},
'133': {'cls': 'npcs', 'id': 'drt'},
'134': {'cls': 'npcs', 'id': 'dl'},
'135': {'cls': 'npcs', 'id': 'dc'},
'136': {'cls': 'npcs', 'id': 'dr'},
'137': {'cls': 'npcs', 'id': 'dlb'},
'138': {'cls': 'npcs', 'id': 'drb'},
'139': {'cls': 'npc48', 'id': 'npc0'},
'140': {'cls': 'npc48', 'id': 'npc1'},
'141': {'cls': 'npc48', 'id': 'npc2'},
'142': {'cls': 'npc48', 'id': 'npc3'},
'143': {'cls': 'npc48', 'id': 'npc4'},
////////////////////////// 其他部分 ////////////////////////// ////////////////////////// 其他部分 //////////////////////////
// 161-200 其他(单向箭头、灯、箱子等等) // 171-200 其他(单向箭头、灯、箱子等等)
'161':{'cls': 'terrains', 'id': 'arrowUp', 'noPass': false}, // 单向上箭头 '171':{'cls': 'terrains', 'id': 'arrowUp', 'noPass': false}, // 单向上箭头
'162':{'cls': 'terrains', 'id': 'arrowDown', 'noPass': false}, // 单向下箭头 '172':{'cls': 'terrains', 'id': 'arrowDown', 'noPass': false}, // 单向下箭头
'163':{'cls': 'terrains', 'id': 'arrowLeft', 'noPass': false}, // 单向左箭头 '173':{'cls': 'terrains', 'id': 'arrowLeft', 'noPass': false}, // 单向左箭头
'164':{'cls': 'terrains', 'id': 'arrowRight', 'noPass': false}, // 单向右箭头 '174':{'cls': 'terrains', 'id': 'arrowRight', 'noPass': false}, // 单向右箭头
'165':{'cls': 'terrains', 'id': 'light', 'trigger': 'changeLight', 'noPass': false}, // 灯 '175':{'cls': 'terrains', 'id': 'light', 'trigger': 'changeLight', 'noPass': false}, // 灯
'166':{'cls': 'terrains', 'id': 'darkLight', 'noPass': true}, // 暗灯 '176':{'cls': 'terrains', 'id': 'darkLight', 'noPass': true}, // 暗灯
'167':{'cls': 'terrains', 'id': 'ski', 'trigger': 'ski', 'noPass': false}, // 滑冰 '177':{'cls': 'terrains', 'id': 'ski', 'trigger': 'ski', 'noPass': false}, // 滑冰
'168':{'cls': 'terrains', 'id': 'flower', 'noPass': false}, // 花 '178':{'cls': 'terrains', 'id': 'flower', 'noPass': false}, // 花
'169':{'cls': 'terrains', 'id': 'box', 'trigger': 'pushBox', 'noPass': true}, // 箱子 '179':{'cls': 'terrains', 'id': 'box', 'trigger': 'pushBox', 'noPass': true}, // 箱子
'170':{'cls': 'terrains', 'id': 'boxed', 'trigger': 'pushBox', 'noPass': true}, // 完成的箱子 '180':{'cls': 'terrains', 'id': 'boxed', 'trigger': 'pushBox', 'noPass': true}, // 完成的箱子
////////////////////////// 怪物部分 ////////////////////////// ////////////////////////// 怪物部分 //////////////////////////

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -21,7 +21,7 @@
position: fixed; position: fixed;
top: 10px; top: 10px;
left: 10px; left: 10px;
z-index: 15; z-index: 320;
} }
#startPanel { #startPanel {
@ -32,7 +32,7 @@
left: 0; left: 0;
background-color: #fff; background-color: #fff;
overflow: hidden; overflow: hidden;
z-index: 12; z-index: 250;
} }
#startTop { #startTop {
@ -42,7 +42,7 @@
top: 0; top: 0;
left: 0; left: 0;
background-color: #000; background-color: #000;
z-index: 14; z-index: 300;
} }
#startTopProgressBar { #startTopProgressBar {
@ -77,12 +77,12 @@
height: 100%; height: 100%;
width: auto; width: auto;
transform:translate(-50%,-50%); transform:translate(-50%,-50%);
z-index: 12; z-index: 210;
} }
#startLogo { #startLogo {
position: absolute; position: absolute;
z-index: 12; z-index: 240;
left: 0; left: 0;
right: 0; right: 0;
margin-left: auto; margin-left: auto;
@ -95,7 +95,7 @@
#startTitle { #startTitle {
position: absolute; position: absolute;
z-index: 13; z-index: 230;
} }
#startButtonGroup { #startButtonGroup {
@ -106,7 +106,7 @@
background-color: #000; background-color: #000;
opacity: 0.85; opacity: 0.85;
display: none; display: none;
z-index: 12; z-index: 220;
bottom: 0; bottom: 0;
margin-bottom: 7%; margin-bottom: 7%;
} }
@ -142,7 +142,7 @@
display: none; display: none;
color: #fff; color: #fff;
background-color: #000; background-color: #000;
z-index: 11; z-index: 180;
} }
#logoLabel { #logoLabel {
@ -170,7 +170,7 @@
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
background: url(project/images/ground.png) repeat; background: url(project/images/ground.png) repeat;
z-index: 9; z-index: 160;
display: none; display: none;
} }
#statusBar .status{ #statusBar .status{
@ -199,7 +199,7 @@
#toolBar { #toolBar {
position: absolute; position: absolute;
background: url(project/images/ground.png) repeat; background: url(project/images/ground.png) repeat;
z-index: 8; z-index: 150;
box-sizing: border-box; box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
@ -233,47 +233,59 @@ span#poison, span#weak, span#curse {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
} }
#gif {
z-index: 20;
position: absolute;
overflow: hidden;
}
#gif2 {
z-index: 90;
position: absolute;
overflow: hidden;
}
#curtain { #curtain {
z-index: 8; z-index: 100;
position: absolute; position: absolute;
opacity: 0; opacity: 0;
background: #000000; background: #000000;
} }
#bg { #bg {
z-index: 1; z-index: 10;
} }
#event { #event {
z-index: 2; z-index: 30;
} }
#hero { #hero {
z-index: 3; z-index: 40;
} }
#event2 { #event2 {
z-index: 4; z-index: 50;
} }
#fg { #fg {
z-index: 5; z-index: 60;
} }
#animate { #animate {
z-index: 6; z-index: 70;
} }
#weather { #weather {
z-index: 7; z-index: 80;
} }
#ui { #ui {
z-index: 9; z-index: 110;
} }
#data { #data {
z-index: 10; z-index: 120;
} }
.clearfix:before, .clearfix:before,

View File

@ -1,4 +1,20 @@
HTML5魔塔样板V2.0.1 HTML5魔塔样板V2.0.2
编辑器添加新建和删除按钮;地图自动保存 √
录像支持倒退录像播放中每50步自动存档最多存20个
Gif支持可以作为楼层背景图或者使用显示动图事件 √
图片显示增加淡入淡出效果 √
APP端也能下载录像
地图临界显伤 √
单个存档清理 √
大数据魔塔的支持(临界计算等) √
进一步对JS文件进行压缩 √
修复有时候无法输入ID的问题 √
其他细节优化
-----------------------------------------------------------------------
HTML5魔塔样板V2.0.1
道具使用效果的进一步分离 道具使用效果的进一步分离
支持插件编写,用户可以根据需求来写插件了 支持插件编写,用户可以根据需求来写插件了