Format Files
This commit is contained in:
parent
14dcb94635
commit
8519a0daa2
77 changed files with 391363 additions and 372469 deletions
|
|
@ -1,9 +1,141 @@
|
|||
[
|
||||
null,
|
||||
{"id":1,"battlerName":"","characterIndex":0,"characterName":"男主人公","classId":5,"equips":[1,1,2,3,0],"faceIndex":0,"faceName":"","traits":[],"initialLevel":1,"maxLevel":99,"name":"コリウス","nickname":"","note":"<Set Sts Data>\nTreeType: 5,0,6,0,7\n</Set Sts Data>","profile":""},
|
||||
{"id":2,"battlerName":"","characterIndex":0,"characterName":"主人公","classId":1,"equips":[0,0,0,0,0],"faceIndex":0,"faceName":"","traits":[],"initialLevel":1,"maxLevel":99,"name":"アーテル・パーロット","nickname":"","note":"","profile":""},
|
||||
{"id":3,"battlerName":"","characterIndex":0,"characterName":"","classId":1,"equips":[0,0,0,0,0],"faceIndex":0,"faceName":"","traits":[],"initialLevel":1,"maxLevel":99,"name":"ギア","nickname":"","note":"","profile":""},
|
||||
{"id":4,"battlerName":"","characterIndex":0,"characterName":"","classId":1,"equips":[0,0,0,0,0],"faceIndex":0,"faceName":"","traits":[],"initialLevel":1,"maxLevel":99,"name":"ロック","nickname":"","note":"","profile":""},
|
||||
{"id":5,"battlerName":"","characterIndex":0,"characterName":"","classId":1,"equips":[0,0,0,0,0],"faceIndex":0,"faceName":"","traits":[],"initialLevel":1,"maxLevel":99,"name":"テア","nickname":"","note":"","profile":""},
|
||||
{"id":6,"battlerName":"","characterIndex":0,"characterName":"","classId":1,"equips":[0,0,0,0,0],"faceIndex":0,"faceName":"","traits":[],"initialLevel":1,"maxLevel":99,"name":"ベッカー","nickname":"","note":"","profile":""}
|
||||
null,
|
||||
{
|
||||
"id": 1,
|
||||
"battlerName": "",
|
||||
"characterIndex": 0,
|
||||
"characterName": "男主人公",
|
||||
"classId": 5,
|
||||
"equips": [
|
||||
1,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
0
|
||||
],
|
||||
"faceIndex": 0,
|
||||
"faceName": "",
|
||||
"traits": [],
|
||||
"initialLevel": 1,
|
||||
"maxLevel": 99,
|
||||
"name": "コリウス",
|
||||
"nickname": "",
|
||||
"note": "<Set Sts Data>\nTreeType: 5,0,6,0,7\n</Set Sts Data>",
|
||||
"profile": ""
|
||||
},
|
||||
{
|
||||
"id": 2,
|
||||
"battlerName": "",
|
||||
"characterIndex": 0,
|
||||
"characterName": "主人公",
|
||||
"classId": 1,
|
||||
"equips": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"faceIndex": 0,
|
||||
"faceName": "",
|
||||
"traits": [],
|
||||
"initialLevel": 1,
|
||||
"maxLevel": 99,
|
||||
"name": "アーテル・パーロット",
|
||||
"nickname": "",
|
||||
"note": "",
|
||||
"profile": ""
|
||||
},
|
||||
{
|
||||
"id": 3,
|
||||
"battlerName": "",
|
||||
"characterIndex": 0,
|
||||
"characterName": "",
|
||||
"classId": 1,
|
||||
"equips": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"faceIndex": 0,
|
||||
"faceName": "",
|
||||
"traits": [],
|
||||
"initialLevel": 1,
|
||||
"maxLevel": 99,
|
||||
"name": "ギア",
|
||||
"nickname": "",
|
||||
"note": "",
|
||||
"profile": ""
|
||||
},
|
||||
{
|
||||
"id": 4,
|
||||
"battlerName": "",
|
||||
"characterIndex": 0,
|
||||
"characterName": "",
|
||||
"classId": 1,
|
||||
"equips": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"faceIndex": 0,
|
||||
"faceName": "",
|
||||
"traits": [],
|
||||
"initialLevel": 1,
|
||||
"maxLevel": 99,
|
||||
"name": "ロック",
|
||||
"nickname": "",
|
||||
"note": "",
|
||||
"profile": ""
|
||||
},
|
||||
{
|
||||
"id": 5,
|
||||
"battlerName": "",
|
||||
"characterIndex": 0,
|
||||
"characterName": "",
|
||||
"classId": 1,
|
||||
"equips": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"faceIndex": 0,
|
||||
"faceName": "",
|
||||
"traits": [],
|
||||
"initialLevel": 1,
|
||||
"maxLevel": 99,
|
||||
"name": "テア",
|
||||
"nickname": "",
|
||||
"note": "",
|
||||
"profile": ""
|
||||
},
|
||||
{
|
||||
"id": 6,
|
||||
"battlerName": "",
|
||||
"characterIndex": 0,
|
||||
"characterName": "",
|
||||
"classId": 1,
|
||||
"equips": [
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
],
|
||||
"faceIndex": 0,
|
||||
"faceName": "",
|
||||
"traits": [],
|
||||
"initialLevel": 1,
|
||||
"maxLevel": 99,
|
||||
"name": "ベッカー",
|
||||
"nickname": "",
|
||||
"note": "",
|
||||
"profile": ""
|
||||
}
|
||||
]
|
||||
572186
www/data/CommonEvents.json
572186
www/data/CommonEvents.json
File diff suppressed because it is too large
Load diff
|
|
@ -1,53 +1,445 @@
|
|||
/*! FPSMeter 0.3.1 - 9th May 2013 | https://github.com/Darsain/fpsmeter */
|
||||
(function (m, j) {
|
||||
function s(a, e) { for (var g in e) try { a.style[g] = e[g] } catch (j) { } return a } function H(a) { return null == a ? String(a) : "object" === typeof a || "function" === typeof a ? Object.prototype.toString.call(a).match(/\s([a-z]+)/i)[1].toLowerCase() || "object" : typeof a } function R(a, e) { if ("array" !== H(e)) return -1; if (e.indexOf) return e.indexOf(a); for (var g = 0, j = e.length; g < j; g++)if (e[g] === a) return g; return -1 } function I() {
|
||||
var a = arguments, e; for (e in a[1]) if (a[1].hasOwnProperty(e)) switch (H(a[1][e])) {
|
||||
case "object": a[0][e] =
|
||||
I({}, a[0][e], a[1][e]); break; case "array": a[0][e] = a[1][e].slice(0); break; default: a[0][e] = a[1][e]
|
||||
}return 2 < a.length ? I.apply(null, [a[0]].concat(Array.prototype.slice.call(a, 2))) : a[0]
|
||||
} function N(a) { a = Math.round(255 * a).toString(16); return 1 === a.length ? "0" + a : a } function S(a, e, g, j) { if (a.addEventListener) a[j ? "removeEventListener" : "addEventListener"](e, g, !1); else if (a.attachEvent) a[j ? "detachEvent" : "attachEvent"]("on" + e, g) } function D(a, e) {
|
||||
function g(a, b, d, c) { return y[0 | a][Math.round(Math.min((b - d) / (c - d) * J, J))] }
|
||||
function r() { f.legend.fps !== q && (f.legend.fps = q, f.legend[T] = q ? "FPS" : "ms"); K = q ? b.fps : b.duration; f.count[T] = 999 < K ? "999+" : K.toFixed(99 < K ? 0 : d.decimals) } function m() {
|
||||
z = A(); L < z - d.threshold && (b.fps -= b.fps / Math.max(1, 60 * d.smoothing / d.interval), b.duration = 1E3 / b.fps); for (c = d.history; c--;)E[c] = 0 === c ? b.fps : E[c - 1], F[c] = 0 === c ? b.duration : F[c - 1]; r(); if (d.heat) {
|
||||
if (w.length) for (c = w.length; c--;)w[c].el.style[h[w[c].name].heatOn] = q ? g(h[w[c].name].heatmap, b.fps, 0, d.maxFps) : g(h[w[c].name].heatmap, b.duration, d.threshold,
|
||||
0); if (f.graph && h.column.heatOn) for (c = u.length; c--;)u[c].style[h.column.heatOn] = q ? g(h.column.heatmap, E[c], 0, d.maxFps) : g(h.column.heatmap, F[c], d.threshold, 0)
|
||||
} if (f.graph) for (p = 0; p < d.history; p++)u[p].style.height = (q ? E[p] ? Math.round(O / d.maxFps * Math.min(E[p], d.maxFps)) : 0 : F[p] ? Math.round(O / d.threshold * Math.min(F[p], d.threshold)) : 0) + "px"
|
||||
} function k() { 20 > d.interval ? (x = M(k), m()) : (x = setTimeout(k, d.interval), P = M(m)) } function G(a) {
|
||||
a = a || window.event; a.preventDefault ? (a.preventDefault(), a.stopPropagation()) : (a.returnValue =
|
||||
!1, a.cancelBubble = !0); b.toggle()
|
||||
} function U() { d.toggleOn && S(f.container, d.toggleOn, G, 1); a.removeChild(f.container) } function V() {
|
||||
f.container && U(); h = D.theme[d.theme]; y = h.compiledHeatmaps || []; if (!y.length && h.heatmaps.length) {
|
||||
for (p = 0; p < h.heatmaps.length; p++) {
|
||||
y[p] = []; for (c = 0; c <= J; c++) {
|
||||
var b = y[p], e = c, g; g = 0.33 / J * c; var j = h.heatmaps[p].saturation, m = h.heatmaps[p].lightness, n = void 0, k = void 0, l = void 0, t = l = void 0, v = n = k = void 0, v = void 0, l = 0.5 >= m ? m * (1 + j) : m + j - m * j; 0 === l ? g = "#000" : (t = 2 * m - l, k = (l - t) / l, g *= 6, n = Math.floor(g),
|
||||
v = g - n, v *= l * k, 0 === n || 6 === n ? (n = l, k = t + v, l = t) : 1 === n ? (n = l - v, k = l, l = t) : 2 === n ? (n = t, k = l, l = t + v) : 3 === n ? (n = t, k = l - v) : 4 === n ? (n = t + v, k = t) : (n = l, k = t, l -= v), g = "#" + N(n) + N(k) + N(l)); b[e] = g
|
||||
}
|
||||
} h.compiledHeatmaps = y
|
||||
} f.container = s(document.createElement("div"), h.container); f.count = f.container.appendChild(s(document.createElement("div"), h.count)); f.legend = f.container.appendChild(s(document.createElement("div"), h.legend)); f.graph = d.graph ? f.container.appendChild(s(document.createElement("div"), h.graph)) : 0; w.length = 0; for (var q in f) f[q] &&
|
||||
h[q].heatOn && w.push({ name: q, el: f[q] }); u.length = 0; if (f.graph) { f.graph.style.width = d.history * h.column.width + (d.history - 1) * h.column.spacing + "px"; for (c = 0; c < d.history; c++)u[c] = f.graph.appendChild(s(document.createElement("div"), h.column)), u[c].style.position = "absolute", u[c].style.bottom = 0, u[c].style.right = c * h.column.width + c * h.column.spacing + "px", u[c].style.width = h.column.width + "px", u[c].style.height = "0px" } s(f.container, d); r(); a.appendChild(f.container); f.graph && (O = f.graph.clientHeight); d.toggleOn && ("click" ===
|
||||
d.toggleOn && (f.container.style.cursor = "pointer"), S(f.container, d.toggleOn, G))
|
||||
} "object" === H(a) && a.nodeType === j && (e = a, a = document.body); a || (a = document.body); var b = this, d = I({}, D.defaults, e || {}), f = {}, u = [], h, y, J = 100, w = [], W = 0, B = d.threshold, Q = 0, L = A() - B, z, E = [], F = [], x, P, q = "fps" === d.show, O, K, c, p; b.options = d; b.fps = 0; b.duration = 0; b.isPaused = 0; b.tickStart = function () { Q = A() }; b.tick = function () { z = A(); W = z - L; B += (W - B) / d.smoothing; b.fps = 1E3 / B; b.duration = Q < L ? B : z - Q; L = z }; b.pause = function () {
|
||||
x && (b.isPaused = 1, clearTimeout(x),
|
||||
C(x), C(P), x = P = 0); return b
|
||||
}; b.resume = function () { x || (b.isPaused = 0, k()); return b }; b.set = function (a, c) { d[a] = c; q = "fps" === d.show; -1 !== R(a, X) && V(); -1 !== R(a, Y) && s(f.container, d); return b }; b.showDuration = function () { b.set("show", "ms"); return b }; b.showFps = function () { b.set("show", "fps"); return b }; b.toggle = function () { b.set("show", q ? "ms" : "fps"); return b }; b.hide = function () { b.pause(); f.container.style.display = "none"; return b }; b.show = function () { b.resume(); f.container.style.display = "block"; return b }; b.destroy = function () {
|
||||
b.pause();
|
||||
U(); b.tick = b.tickStart = function () { }
|
||||
}; V(); k()
|
||||
} var A, r = m.performance; A = r && (r.now || r.webkitNow) ? r[r.now ? "now" : "webkitNow"].bind(r) : function () { return +new Date }; for (var C = m.cancelAnimationFrame || m.cancelRequestAnimationFrame, M = m.requestAnimationFrame, r = ["moz", "webkit", "o"], G = 0, k = 0, Z = r.length; k < Z && !C; ++k)M = (C = m[r[k] + "CancelAnimationFrame"] || m[r[k] + "CancelRequestAnimationFrame"]) && m[r[k] + "RequestAnimationFrame"]; C || (M = function (a) {
|
||||
var e = A(), g = Math.max(0, 16 - (e - G)); G = e + g; return m.setTimeout(function () {
|
||||
a(e +
|
||||
g)
|
||||
}, g)
|
||||
}, C = function (a) { clearTimeout(a) }); var T = "string" === H(document.createElement("div").textContent) ? "textContent" : "innerText"; D.extend = I; window.FPSMeter = D; D.defaults = { interval: 100, smoothing: 10, show: "fps", toggleOn: "click", decimals: 1, maxFps: 60, threshold: 100, position: "absolute", zIndex: 10, left: "5px", top: "5px", right: "auto", bottom: "auto", margin: "0 0 0 0", theme: "dark", heat: 0, graph: 0, history: 20 }; var X = ["toggleOn", "theme", "heat", "graph", "history"], Y = "position zIndex left top right bottom margin".split(" ")
|
||||
})(window); (function (m, j) {
|
||||
j.theme = {}; var s = j.theme.base = {
|
||||
heatmaps: [], container: { heatOn: null, heatmap: null, padding: "5px", minWidth: "95px", height: "30px", lineHeight: "30px", textAlign: "right", textShadow: "none" }, count: { heatOn: null, heatmap: null, position: "absolute", top: 0, right: 0, padding: "5px 10px", height: "30px", fontSize: "24px", fontFamily: "Consolas, Andale Mono, monospace", zIndex: 2 }, legend: {
|
||||
heatOn: null, heatmap: null, position: "absolute", top: 0, left: 0, padding: "5px 10px", height: "30px", fontSize: "12px", lineHeight: "32px", fontFamily: "sans-serif",
|
||||
textAlign: "left", zIndex: 2
|
||||
}, graph: { heatOn: null, heatmap: null, position: "relative", boxSizing: "padding-box", MozBoxSizing: "padding-box", height: "100%", zIndex: 1 }, column: { width: 4, spacing: 1, heatOn: null, heatmap: null }
|
||||
}; j.theme.dark = j.extend({}, s, { heatmaps: [{ saturation: 0.8, lightness: 0.8 }], container: { background: "#222", color: "#fff", border: "1px solid #1a1a1a", textShadow: "1px 1px 0 #222" }, count: { heatOn: "color" }, column: { background: "#3f3f3f" } }); j.theme.light = j.extend({}, s, {
|
||||
heatmaps: [{ saturation: 0.5, lightness: 0.5 }],
|
||||
container: { color: "#666", background: "#fff", textShadow: "1px 1px 0 rgba(255,255,255,.5), -1px -1px 0 rgba(255,255,255,.5)", boxShadow: "0 0 0 1px rgba(0,0,0,.1)" }, count: { heatOn: "color" }, column: { background: "#eaeaea" }
|
||||
}); j.theme.colorful = j.extend({}, s, { heatmaps: [{ saturation: 0.5, lightness: 0.6 }], container: { heatOn: "backgroundColor", background: "#888", color: "#fff", textShadow: "1px 1px 0 rgba(0,0,0,.2)", boxShadow: "0 0 0 1px rgba(0,0,0,.1)" }, column: { background: "#777", backgroundColor: "rgba(0,0,0,.2)" } }); j.theme.transparent =
|
||||
j.extend({}, s, { heatmaps: [{ saturation: 0.8, lightness: 0.5 }], container: { padding: 0, color: "#fff", textShadow: "1px 1px 0 rgba(0,0,0,.5)" }, count: { padding: "0 5px", height: "40px", lineHeight: "40px" }, legend: { padding: "0 5px", height: "40px", lineHeight: "42px" }, graph: { height: "40px" }, column: { width: 5, background: "#999", heatOn: "backgroundColor", opacity: 0.5 } })
|
||||
function s(a, e) {
|
||||
for (var g in e)
|
||||
try {
|
||||
a.style[g] = e[g];
|
||||
} catch (j) {}
|
||||
return a;
|
||||
}
|
||||
function H(a) {
|
||||
return null == a
|
||||
? String(a)
|
||||
: "object" === typeof a || "function" === typeof a
|
||||
? Object.prototype.toString
|
||||
.call(a)
|
||||
.match(/\s([a-z]+)/i)[1]
|
||||
.toLowerCase() || "object"
|
||||
: typeof a;
|
||||
}
|
||||
function R(a, e) {
|
||||
if ("array" !== H(e)) return -1;
|
||||
if (e.indexOf) return e.indexOf(a);
|
||||
for (var g = 0, j = e.length; g < j; g++) if (e[g] === a) return g;
|
||||
return -1;
|
||||
}
|
||||
function I() {
|
||||
var a = arguments,
|
||||
e;
|
||||
for (e in a[1])
|
||||
if (a[1].hasOwnProperty(e))
|
||||
switch (H(a[1][e])) {
|
||||
case "object":
|
||||
a[0][e] = I({}, a[0][e], a[1][e]);
|
||||
break;
|
||||
case "array":
|
||||
a[0][e] = a[1][e].slice(0);
|
||||
break;
|
||||
default:
|
||||
a[0][e] = a[1][e];
|
||||
}
|
||||
return 2 < a.length
|
||||
? I.apply(null, [a[0]].concat(Array.prototype.slice.call(a, 2)))
|
||||
: a[0];
|
||||
}
|
||||
function N(a) {
|
||||
a = Math.round(255 * a).toString(16);
|
||||
return 1 === a.length ? "0" + a : a;
|
||||
}
|
||||
function S(a, e, g, j) {
|
||||
if (a.addEventListener)
|
||||
a[j ? "removeEventListener" : "addEventListener"](e, g, !1);
|
||||
else if (a.attachEvent) a[j ? "detachEvent" : "attachEvent"]("on" + e, g);
|
||||
}
|
||||
function D(a, e) {
|
||||
function g(a, b, d, c) {
|
||||
return y[0 | a][Math.round(Math.min(((b - d) / (c - d)) * J, J))];
|
||||
}
|
||||
function r() {
|
||||
f.legend.fps !== q &&
|
||||
((f.legend.fps = q), (f.legend[T] = q ? "FPS" : "ms"));
|
||||
K = q ? b.fps : b.duration;
|
||||
f.count[T] = 999 < K ? "999+" : K.toFixed(99 < K ? 0 : d.decimals);
|
||||
}
|
||||
function m() {
|
||||
z = A();
|
||||
L < z - d.threshold &&
|
||||
((b.fps -= b.fps / Math.max(1, (60 * d.smoothing) / d.interval)),
|
||||
(b.duration = 1e3 / b.fps));
|
||||
for (c = d.history; c--; )
|
||||
(E[c] = 0 === c ? b.fps : E[c - 1]),
|
||||
(F[c] = 0 === c ? b.duration : F[c - 1]);
|
||||
r();
|
||||
if (d.heat) {
|
||||
if (w.length)
|
||||
for (c = w.length; c--; )
|
||||
w[c].el.style[h[w[c].name].heatOn] = q
|
||||
? g(h[w[c].name].heatmap, b.fps, 0, d.maxFps)
|
||||
: g(h[w[c].name].heatmap, b.duration, d.threshold, 0);
|
||||
if (f.graph && h.column.heatOn)
|
||||
for (c = u.length; c--; )
|
||||
u[c].style[h.column.heatOn] = q
|
||||
? g(h.column.heatmap, E[c], 0, d.maxFps)
|
||||
: g(h.column.heatmap, F[c], d.threshold, 0);
|
||||
}
|
||||
if (f.graph)
|
||||
for (p = 0; p < d.history; p++)
|
||||
u[p].style.height =
|
||||
(q
|
||||
? E[p]
|
||||
? Math.round((O / d.maxFps) * Math.min(E[p], d.maxFps))
|
||||
: 0
|
||||
: F[p]
|
||||
? Math.round((O / d.threshold) * Math.min(F[p], d.threshold))
|
||||
: 0) + "px";
|
||||
}
|
||||
function k() {
|
||||
20 > d.interval
|
||||
? ((x = M(k)), m())
|
||||
: ((x = setTimeout(k, d.interval)), (P = M(m)));
|
||||
}
|
||||
function G(a) {
|
||||
a = a || window.event;
|
||||
a.preventDefault
|
||||
? (a.preventDefault(), a.stopPropagation())
|
||||
: ((a.returnValue = !1), (a.cancelBubble = !0));
|
||||
b.toggle();
|
||||
}
|
||||
function U() {
|
||||
d.toggleOn && S(f.container, d.toggleOn, G, 1);
|
||||
a.removeChild(f.container);
|
||||
}
|
||||
function V() {
|
||||
f.container && U();
|
||||
h = D.theme[d.theme];
|
||||
y = h.compiledHeatmaps || [];
|
||||
if (!y.length && h.heatmaps.length) {
|
||||
for (p = 0; p < h.heatmaps.length; p++) {
|
||||
y[p] = [];
|
||||
for (c = 0; c <= J; c++) {
|
||||
var b = y[p],
|
||||
e = c,
|
||||
g;
|
||||
g = (0.33 / J) * c;
|
||||
var j = h.heatmaps[p].saturation,
|
||||
m = h.heatmaps[p].lightness,
|
||||
n = void 0,
|
||||
k = void 0,
|
||||
l = void 0,
|
||||
t = (l = void 0),
|
||||
v = (n = k = void 0),
|
||||
v = void 0,
|
||||
l = 0.5 >= m ? m * (1 + j) : m + j - m * j;
|
||||
0 === l
|
||||
? (g = "#000")
|
||||
: ((t = 2 * m - l),
|
||||
(k = (l - t) / l),
|
||||
(g *= 6),
|
||||
(n = Math.floor(g)),
|
||||
(v = g - n),
|
||||
(v *= l * k),
|
||||
0 === n || 6 === n
|
||||
? ((n = l), (k = t + v), (l = t))
|
||||
: 1 === n
|
||||
? ((n = l - v), (k = l), (l = t))
|
||||
: 2 === n
|
||||
? ((n = t), (k = l), (l = t + v))
|
||||
: 3 === n
|
||||
? ((n = t), (k = l - v))
|
||||
: 4 === n
|
||||
? ((n = t + v), (k = t))
|
||||
: ((n = l), (k = t), (l -= v)),
|
||||
(g = "#" + N(n) + N(k) + N(l)));
|
||||
b[e] = g;
|
||||
}
|
||||
}
|
||||
h.compiledHeatmaps = y;
|
||||
}
|
||||
f.container = s(document.createElement("div"), h.container);
|
||||
f.count = f.container.appendChild(
|
||||
s(document.createElement("div"), h.count)
|
||||
);
|
||||
f.legend = f.container.appendChild(
|
||||
s(document.createElement("div"), h.legend)
|
||||
);
|
||||
f.graph = d.graph
|
||||
? f.container.appendChild(s(document.createElement("div"), h.graph))
|
||||
: 0;
|
||||
w.length = 0;
|
||||
for (var q in f) f[q] && h[q].heatOn && w.push({ name: q, el: f[q] });
|
||||
u.length = 0;
|
||||
if (f.graph) {
|
||||
f.graph.style.width =
|
||||
d.history * h.column.width +
|
||||
(d.history - 1) * h.column.spacing +
|
||||
"px";
|
||||
for (c = 0; c < d.history; c++)
|
||||
(u[c] = f.graph.appendChild(
|
||||
s(document.createElement("div"), h.column)
|
||||
)),
|
||||
(u[c].style.position = "absolute"),
|
||||
(u[c].style.bottom = 0),
|
||||
(u[c].style.right =
|
||||
c * h.column.width + c * h.column.spacing + "px"),
|
||||
(u[c].style.width = h.column.width + "px"),
|
||||
(u[c].style.height = "0px");
|
||||
}
|
||||
s(f.container, d);
|
||||
r();
|
||||
a.appendChild(f.container);
|
||||
f.graph && (O = f.graph.clientHeight);
|
||||
d.toggleOn &&
|
||||
("click" === d.toggleOn && (f.container.style.cursor = "pointer"),
|
||||
S(f.container, d.toggleOn, G));
|
||||
}
|
||||
"object" === H(a) && a.nodeType === j && ((e = a), (a = document.body));
|
||||
a || (a = document.body);
|
||||
var b = this,
|
||||
d = I({}, D.defaults, e || {}),
|
||||
f = {},
|
||||
u = [],
|
||||
h,
|
||||
y,
|
||||
J = 100,
|
||||
w = [],
|
||||
W = 0,
|
||||
B = d.threshold,
|
||||
Q = 0,
|
||||
L = A() - B,
|
||||
z,
|
||||
E = [],
|
||||
F = [],
|
||||
x,
|
||||
P,
|
||||
q = "fps" === d.show,
|
||||
O,
|
||||
K,
|
||||
c,
|
||||
p;
|
||||
b.options = d;
|
||||
b.fps = 0;
|
||||
b.duration = 0;
|
||||
b.isPaused = 0;
|
||||
b.tickStart = function () {
|
||||
Q = A();
|
||||
};
|
||||
b.tick = function () {
|
||||
z = A();
|
||||
W = z - L;
|
||||
B += (W - B) / d.smoothing;
|
||||
b.fps = 1e3 / B;
|
||||
b.duration = Q < L ? B : z - Q;
|
||||
L = z;
|
||||
};
|
||||
b.pause = function () {
|
||||
x && ((b.isPaused = 1), clearTimeout(x), C(x), C(P), (x = P = 0));
|
||||
return b;
|
||||
};
|
||||
b.resume = function () {
|
||||
x || ((b.isPaused = 0), k());
|
||||
return b;
|
||||
};
|
||||
b.set = function (a, c) {
|
||||
d[a] = c;
|
||||
q = "fps" === d.show;
|
||||
-1 !== R(a, X) && V();
|
||||
-1 !== R(a, Y) && s(f.container, d);
|
||||
return b;
|
||||
};
|
||||
b.showDuration = function () {
|
||||
b.set("show", "ms");
|
||||
return b;
|
||||
};
|
||||
b.showFps = function () {
|
||||
b.set("show", "fps");
|
||||
return b;
|
||||
};
|
||||
b.toggle = function () {
|
||||
b.set("show", q ? "ms" : "fps");
|
||||
return b;
|
||||
};
|
||||
b.hide = function () {
|
||||
b.pause();
|
||||
f.container.style.display = "none";
|
||||
return b;
|
||||
};
|
||||
b.show = function () {
|
||||
b.resume();
|
||||
f.container.style.display = "block";
|
||||
return b;
|
||||
};
|
||||
b.destroy = function () {
|
||||
b.pause();
|
||||
U();
|
||||
b.tick = b.tickStart = function () {};
|
||||
};
|
||||
V();
|
||||
k();
|
||||
}
|
||||
var A,
|
||||
r = m.performance;
|
||||
A =
|
||||
r && (r.now || r.webkitNow)
|
||||
? r[r.now ? "now" : "webkitNow"].bind(r)
|
||||
: function () {
|
||||
return +new Date();
|
||||
};
|
||||
for (
|
||||
var C = m.cancelAnimationFrame || m.cancelRequestAnimationFrame,
|
||||
M = m.requestAnimationFrame,
|
||||
r = ["moz", "webkit", "o"],
|
||||
G = 0,
|
||||
k = 0,
|
||||
Z = r.length;
|
||||
k < Z && !C;
|
||||
++k
|
||||
)
|
||||
M =
|
||||
(C =
|
||||
m[r[k] + "CancelAnimationFrame"] ||
|
||||
m[r[k] + "CancelRequestAnimationFrame"]) &&
|
||||
m[r[k] + "RequestAnimationFrame"];
|
||||
C ||
|
||||
((M = function (a) {
|
||||
var e = A(),
|
||||
g = Math.max(0, 16 - (e - G));
|
||||
G = e + g;
|
||||
return m.setTimeout(function () {
|
||||
a(e + g);
|
||||
}, g);
|
||||
}),
|
||||
(C = function (a) {
|
||||
clearTimeout(a);
|
||||
}));
|
||||
var T =
|
||||
"string" === H(document.createElement("div").textContent)
|
||||
? "textContent"
|
||||
: "innerText";
|
||||
D.extend = I;
|
||||
window.FPSMeter = D;
|
||||
D.defaults = {
|
||||
interval: 100,
|
||||
smoothing: 10,
|
||||
show: "fps",
|
||||
toggleOn: "click",
|
||||
decimals: 1,
|
||||
maxFps: 60,
|
||||
threshold: 100,
|
||||
position: "absolute",
|
||||
zIndex: 10,
|
||||
left: "5px",
|
||||
top: "5px",
|
||||
right: "auto",
|
||||
bottom: "auto",
|
||||
margin: "0 0 0 0",
|
||||
theme: "dark",
|
||||
heat: 0,
|
||||
graph: 0,
|
||||
history: 20,
|
||||
};
|
||||
var X = ["toggleOn", "theme", "heat", "graph", "history"],
|
||||
Y = "position zIndex left top right bottom margin".split(" ");
|
||||
})(window);
|
||||
(function (m, j) {
|
||||
j.theme = {};
|
||||
var s = (j.theme.base = {
|
||||
heatmaps: [],
|
||||
container: {
|
||||
heatOn: null,
|
||||
heatmap: null,
|
||||
padding: "5px",
|
||||
minWidth: "95px",
|
||||
height: "30px",
|
||||
lineHeight: "30px",
|
||||
textAlign: "right",
|
||||
textShadow: "none",
|
||||
},
|
||||
count: {
|
||||
heatOn: null,
|
||||
heatmap: null,
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
right: 0,
|
||||
padding: "5px 10px",
|
||||
height: "30px",
|
||||
fontSize: "24px",
|
||||
fontFamily: "Consolas, Andale Mono, monospace",
|
||||
zIndex: 2,
|
||||
},
|
||||
legend: {
|
||||
heatOn: null,
|
||||
heatmap: null,
|
||||
position: "absolute",
|
||||
top: 0,
|
||||
left: 0,
|
||||
padding: "5px 10px",
|
||||
height: "30px",
|
||||
fontSize: "12px",
|
||||
lineHeight: "32px",
|
||||
fontFamily: "sans-serif",
|
||||
textAlign: "left",
|
||||
zIndex: 2,
|
||||
},
|
||||
graph: {
|
||||
heatOn: null,
|
||||
heatmap: null,
|
||||
position: "relative",
|
||||
boxSizing: "padding-box",
|
||||
MozBoxSizing: "padding-box",
|
||||
height: "100%",
|
||||
zIndex: 1,
|
||||
},
|
||||
column: { width: 4, spacing: 1, heatOn: null, heatmap: null },
|
||||
});
|
||||
j.theme.dark = j.extend({}, s, {
|
||||
heatmaps: [{ saturation: 0.8, lightness: 0.8 }],
|
||||
container: {
|
||||
background: "#222",
|
||||
color: "#fff",
|
||||
border: "1px solid #1a1a1a",
|
||||
textShadow: "1px 1px 0 #222",
|
||||
},
|
||||
count: { heatOn: "color" },
|
||||
column: { background: "#3f3f3f" },
|
||||
});
|
||||
j.theme.light = j.extend({}, s, {
|
||||
heatmaps: [{ saturation: 0.5, lightness: 0.5 }],
|
||||
container: {
|
||||
color: "#666",
|
||||
background: "#fff",
|
||||
textShadow:
|
||||
"1px 1px 0 rgba(255,255,255,.5), -1px -1px 0 rgba(255,255,255,.5)",
|
||||
boxShadow: "0 0 0 1px rgba(0,0,0,.1)",
|
||||
},
|
||||
count: { heatOn: "color" },
|
||||
column: { background: "#eaeaea" },
|
||||
});
|
||||
j.theme.colorful = j.extend({}, s, {
|
||||
heatmaps: [{ saturation: 0.5, lightness: 0.6 }],
|
||||
container: {
|
||||
heatOn: "backgroundColor",
|
||||
background: "#888",
|
||||
color: "#fff",
|
||||
textShadow: "1px 1px 0 rgba(0,0,0,.2)",
|
||||
boxShadow: "0 0 0 1px rgba(0,0,0,.1)",
|
||||
},
|
||||
column: { background: "#777", backgroundColor: "rgba(0,0,0,.2)" },
|
||||
});
|
||||
j.theme.transparent = j.extend({}, s, {
|
||||
heatmaps: [{ saturation: 0.8, lightness: 0.5 }],
|
||||
container: {
|
||||
padding: 0,
|
||||
color: "#fff",
|
||||
textShadow: "1px 1px 0 rgba(0,0,0,.5)",
|
||||
},
|
||||
count: { padding: "0 5px", height: "40px", lineHeight: "40px" },
|
||||
legend: { padding: "0 5px", height: "40px", lineHeight: "42px" },
|
||||
graph: { height: "40px" },
|
||||
column: {
|
||||
width: 5,
|
||||
background: "#999",
|
||||
heatOn: "backgroundColor",
|
||||
opacity: 0.5,
|
||||
},
|
||||
});
|
||||
})(window, FPSMeter);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,207 @@
|
|||
/*! npm.im/iphone-inline-video */
|
||||
var makeVideoPlayableInline = function () {
|
||||
"use strict";/*! npm.im/intervalometer */
|
||||
function e(e, n, r, i) { function t(r) { d = n(t, i), e(r - (a || r)), a = r } var d, a; return { start: function () { d || t(0) }, stop: function () { r(d), d = null, a = 0 } } } function n(n) { return e(n, requestAnimationFrame, cancelAnimationFrame) } function r(e, n, r, i) { function t(n) { Boolean(e[r]) === Boolean(i) && n.stopImmediatePropagation(), delete e[r] } return e.addEventListener(n, t, !1), t } function i(e, n, r, i) { function t() { return r[n] } function d(e) { r[n] = e } i && d(e[n]), Object.defineProperty(e, n, { get: t, set: d }) } function t(e, n, r) { r.addEventListener(n, function () { return e.dispatchEvent(new Event(n)) }) } function d(e, n) { Promise.resolve().then(function () { e.dispatchEvent(new Event(n)) }) } function a(e) { var n = new Audio; return t(e, "play", n), t(e, "playing", n), t(e, "pause", n), n.crossOrigin = e.crossOrigin, n.src = e.src || e.currentSrc || "data:", n } function o(e, n, r) { (m || 0) + 200 < Date.now() && (e[g] = !0, m = Date.now()), r || (e.currentTime = n), A[++k % 3] = 100 * n | 0 } function u(e) { return e.driver.currentTime >= e.video.duration } function s(e) { var n = this; n.video.readyState >= n.video.HAVE_FUTURE_DATA ? (n.hasAudio || (n.driver.currentTime = n.video.currentTime + e * n.video.playbackRate / 1e3, n.video.loop && u(n) && (n.driver.currentTime = 0)), o(n.video, n.driver.currentTime)) : n.video.networkState !== n.video.NETWORK_IDLE || n.video.buffered.length || n.video.load(), n.video.ended && (delete n.video[g], n.video.pause(!0)) } function c() { var e = this, n = e[b]; return e.webkitDisplayingFullscreen ? void e[E]() : ("data:" !== n.driver.src && n.driver.src !== e.src && (o(e, 0, !0), n.driver.src = e.src), void (e.paused && (n.paused = !1, e.buffered.length || e.load(), n.driver.play(), n.updater.start(), n.hasAudio || (d(e, "play"), n.video.readyState >= n.video.HAVE_ENOUGH_DATA && d(e, "playing"))))) } function v(e) { var n = this, r = n[b]; r.driver.pause(), r.updater.stop(), n.webkitDisplayingFullscreen && n[T](), r.paused && !e || (r.paused = !0, r.hasAudio || d(n, "pause"), n.ended && (n[g] = !0, d(n, "ended"))) } function p(e, r) { var i = e[b] = {}; i.paused = !0, i.hasAudio = r, i.video = e, i.updater = n(s.bind(i)), r ? i.driver = a(e) : (e.addEventListener("canplay", function () { e.paused || d(e, "playing") }), i.driver = { src: e.src || e.currentSrc || "data:", muted: !0, paused: !0, pause: function () { i.driver.paused = !0 }, play: function () { i.driver.paused = !1, u(i) && o(e, 0) }, get ended() { return u(i) } }), e.addEventListener("emptied", function () { var n = !i.driver.src || "data:" === i.driver.src; i.driver.src && i.driver.src !== e.src && (o(e, 0, !0), i.driver.src = e.src, n ? i.driver.play() : i.updater.stop()) }, !1), e.addEventListener("webkitbeginfullscreen", function () { e.paused ? r && !i.driver.buffered.length && i.driver.load() : (e.pause(), e[E]()) }), r && (e.addEventListener("webkitendfullscreen", function () { i.driver.currentTime = e.currentTime }), e.addEventListener("seeking", function () { A.indexOf(100 * e.currentTime | 0) < 0 && (i.driver.currentTime = e.currentTime) })) } function l(e) { var n = e[b]; e[E] = e.play, e[T] = e.pause, e.play = c, e.pause = v, i(e, "paused", n.driver), i(e, "muted", n.driver, !0), i(e, "playbackRate", n.driver, !0), i(e, "ended", n.driver), i(e, "loop", n.driver, !0), r(e, "seeking"), r(e, "seeked"), r(e, "timeupdate", g, !1), r(e, "ended", g, !1) } function f(e, n, r) { void 0 === n && (n = !0), void 0 === r && (r = !0), r && !h || e[b] || (p(e, n), l(e), e.classList.add("IIV"), !n && e.autoplay && e.play(), /iPhone|iPod|iPad/.test(navigator.platform) || console.warn("iphone-inline-video is not guaranteed to work in emulated environments")) } var m, y = "undefined" == typeof Symbol ? function (e) { return "@" + (e || "@") + Math.random() } : Symbol, h = "object-fit" in document.head.style && /iPhone|iPod/i.test(navigator.userAgent) && !matchMedia("(-webkit-video-playable-inline)").matches, b = y(), g = y(), E = y("nativeplay"), T = y("nativepause"), A = [], k = 0; return f.isWhitelisted = h, f
|
||||
}();
|
||||
var makeVideoPlayableInline = (function () {
|
||||
"use strict"; /*! npm.im/intervalometer */
|
||||
function e(e, n, r, i) {
|
||||
function t(r) {
|
||||
(d = n(t, i)), e(r - (a || r)), (a = r);
|
||||
}
|
||||
var d, a;
|
||||
return {
|
||||
start: function () {
|
||||
d || t(0);
|
||||
},
|
||||
stop: function () {
|
||||
r(d), (d = null), (a = 0);
|
||||
},
|
||||
};
|
||||
}
|
||||
function n(n) {
|
||||
return e(n, requestAnimationFrame, cancelAnimationFrame);
|
||||
}
|
||||
function r(e, n, r, i) {
|
||||
function t(n) {
|
||||
Boolean(e[r]) === Boolean(i) && n.stopImmediatePropagation(), delete e[r];
|
||||
}
|
||||
return e.addEventListener(n, t, !1), t;
|
||||
}
|
||||
function i(e, n, r, i) {
|
||||
function t() {
|
||||
return r[n];
|
||||
}
|
||||
function d(e) {
|
||||
r[n] = e;
|
||||
}
|
||||
i && d(e[n]), Object.defineProperty(e, n, { get: t, set: d });
|
||||
}
|
||||
function t(e, n, r) {
|
||||
r.addEventListener(n, function () {
|
||||
return e.dispatchEvent(new Event(n));
|
||||
});
|
||||
}
|
||||
function d(e, n) {
|
||||
Promise.resolve().then(function () {
|
||||
e.dispatchEvent(new Event(n));
|
||||
});
|
||||
}
|
||||
function a(e) {
|
||||
var n = new Audio();
|
||||
return (
|
||||
t(e, "play", n),
|
||||
t(e, "playing", n),
|
||||
t(e, "pause", n),
|
||||
(n.crossOrigin = e.crossOrigin),
|
||||
(n.src = e.src || e.currentSrc || "data:"),
|
||||
n
|
||||
);
|
||||
}
|
||||
function o(e, n, r) {
|
||||
(m || 0) + 200 < Date.now() && ((e[g] = !0), (m = Date.now())),
|
||||
r || (e.currentTime = n),
|
||||
(A[++k % 3] = (100 * n) | 0);
|
||||
}
|
||||
function u(e) {
|
||||
return e.driver.currentTime >= e.video.duration;
|
||||
}
|
||||
function s(e) {
|
||||
var n = this;
|
||||
n.video.readyState >= n.video.HAVE_FUTURE_DATA
|
||||
? (n.hasAudio ||
|
||||
((n.driver.currentTime =
|
||||
n.video.currentTime + (e * n.video.playbackRate) / 1e3),
|
||||
n.video.loop && u(n) && (n.driver.currentTime = 0)),
|
||||
o(n.video, n.driver.currentTime))
|
||||
: n.video.networkState !== n.video.NETWORK_IDLE ||
|
||||
n.video.buffered.length ||
|
||||
n.video.load(),
|
||||
n.video.ended && (delete n.video[g], n.video.pause(!0));
|
||||
}
|
||||
function c() {
|
||||
var e = this,
|
||||
n = e[b];
|
||||
return e.webkitDisplayingFullscreen
|
||||
? void e[E]()
|
||||
: ("data:" !== n.driver.src &&
|
||||
n.driver.src !== e.src &&
|
||||
(o(e, 0, !0), (n.driver.src = e.src)),
|
||||
void (
|
||||
e.paused &&
|
||||
((n.paused = !1),
|
||||
e.buffered.length || e.load(),
|
||||
n.driver.play(),
|
||||
n.updater.start(),
|
||||
n.hasAudio ||
|
||||
(d(e, "play"),
|
||||
n.video.readyState >= n.video.HAVE_ENOUGH_DATA && d(e, "playing")))
|
||||
));
|
||||
}
|
||||
function v(e) {
|
||||
var n = this,
|
||||
r = n[b];
|
||||
r.driver.pause(),
|
||||
r.updater.stop(),
|
||||
n.webkitDisplayingFullscreen && n[T](),
|
||||
(r.paused && !e) ||
|
||||
((r.paused = !0),
|
||||
r.hasAudio || d(n, "pause"),
|
||||
n.ended && ((n[g] = !0), d(n, "ended")));
|
||||
}
|
||||
function p(e, r) {
|
||||
var i = (e[b] = {});
|
||||
(i.paused = !0),
|
||||
(i.hasAudio = r),
|
||||
(i.video = e),
|
||||
(i.updater = n(s.bind(i))),
|
||||
r
|
||||
? (i.driver = a(e))
|
||||
: (e.addEventListener("canplay", function () {
|
||||
e.paused || d(e, "playing");
|
||||
}),
|
||||
(i.driver = {
|
||||
src: e.src || e.currentSrc || "data:",
|
||||
muted: !0,
|
||||
paused: !0,
|
||||
pause: function () {
|
||||
i.driver.paused = !0;
|
||||
},
|
||||
play: function () {
|
||||
(i.driver.paused = !1), u(i) && o(e, 0);
|
||||
},
|
||||
get ended() {
|
||||
return u(i);
|
||||
},
|
||||
})),
|
||||
e.addEventListener(
|
||||
"emptied",
|
||||
function () {
|
||||
var n = !i.driver.src || "data:" === i.driver.src;
|
||||
i.driver.src &&
|
||||
i.driver.src !== e.src &&
|
||||
(o(e, 0, !0),
|
||||
(i.driver.src = e.src),
|
||||
n ? i.driver.play() : i.updater.stop());
|
||||
},
|
||||
!1
|
||||
),
|
||||
e.addEventListener("webkitbeginfullscreen", function () {
|
||||
e.paused
|
||||
? r && !i.driver.buffered.length && i.driver.load()
|
||||
: (e.pause(), e[E]());
|
||||
}),
|
||||
r &&
|
||||
(e.addEventListener("webkitendfullscreen", function () {
|
||||
i.driver.currentTime = e.currentTime;
|
||||
}),
|
||||
e.addEventListener("seeking", function () {
|
||||
A.indexOf((100 * e.currentTime) | 0) < 0 &&
|
||||
(i.driver.currentTime = e.currentTime);
|
||||
}));
|
||||
}
|
||||
function l(e) {
|
||||
var n = e[b];
|
||||
(e[E] = e.play),
|
||||
(e[T] = e.pause),
|
||||
(e.play = c),
|
||||
(e.pause = v),
|
||||
i(e, "paused", n.driver),
|
||||
i(e, "muted", n.driver, !0),
|
||||
i(e, "playbackRate", n.driver, !0),
|
||||
i(e, "ended", n.driver),
|
||||
i(e, "loop", n.driver, !0),
|
||||
r(e, "seeking"),
|
||||
r(e, "seeked"),
|
||||
r(e, "timeupdate", g, !1),
|
||||
r(e, "ended", g, !1);
|
||||
}
|
||||
function f(e, n, r) {
|
||||
void 0 === n && (n = !0),
|
||||
void 0 === r && (r = !0),
|
||||
(r && !h) ||
|
||||
e[b] ||
|
||||
(p(e, n),
|
||||
l(e),
|
||||
e.classList.add("IIV"),
|
||||
!n && e.autoplay && e.play(),
|
||||
/iPhone|iPod|iPad/.test(navigator.platform) ||
|
||||
console.warn(
|
||||
"iphone-inline-video is not guaranteed to work in emulated environments"
|
||||
));
|
||||
}
|
||||
var m,
|
||||
y =
|
||||
"undefined" == typeof Symbol
|
||||
? function (e) {
|
||||
return "@" + (e || "@") + Math.random();
|
||||
}
|
||||
: Symbol,
|
||||
h =
|
||||
"object-fit" in document.head.style &&
|
||||
/iPhone|iPod/i.test(navigator.userAgent) &&
|
||||
!matchMedia("(-webkit-video-playable-inline)").matches,
|
||||
b = y(),
|
||||
g = y(),
|
||||
E = y("nativeplay"),
|
||||
T = y("nativepause"),
|
||||
A = [],
|
||||
k = 0;
|
||||
return (f.isWhitelisted = h), f;
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,428 +1,524 @@
|
|||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
var __extends =
|
||||
(this && this.__extends) ||
|
||||
function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
function __() {
|
||||
this.constructor = d;
|
||||
}
|
||||
d.prototype =
|
||||
b === null ? Object.create(b) : ((__.prototype = b.prototype), new __());
|
||||
};
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var shaderLib = [
|
||||
{
|
||||
vertUniforms: "",
|
||||
vertCode: "vTextureCoord = aTextureCoord;",
|
||||
fragUniforms: "uniform vec4 uTextureClamp;",
|
||||
fragCode: "vec2 textureCoord = clamp(vTextureCoord, uTextureClamp.xy, uTextureClamp.zw);"
|
||||
},
|
||||
{
|
||||
vertUniforms: "uniform mat3 uTransform;",
|
||||
vertCode: "vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;",
|
||||
fragUniforms: "",
|
||||
fragCode: "vec2 textureCoord = vTextureCoord;"
|
||||
},
|
||||
{
|
||||
vertUniforms: "uniform mat3 uTransform;",
|
||||
vertCode: "vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;",
|
||||
fragUniforms: "uniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;",
|
||||
fragCode: "vec2 textureCoord = mod(vTextureCoord - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;" +
|
||||
"\ntextureCoord = (uMapCoord * vec3(textureCoord, 1.0)).xy;" +
|
||||
"\ntextureCoord = clamp(textureCoord, uClampFrame.xy, uClampFrame.zw);"
|
||||
}
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var shaderLib = [
|
||||
{
|
||||
vertUniforms: "",
|
||||
vertCode: "vTextureCoord = aTextureCoord;",
|
||||
fragUniforms: "uniform vec4 uTextureClamp;",
|
||||
fragCode:
|
||||
"vec2 textureCoord = clamp(vTextureCoord, uTextureClamp.xy, uTextureClamp.zw);",
|
||||
},
|
||||
{
|
||||
vertUniforms: "uniform mat3 uTransform;",
|
||||
vertCode: "vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;",
|
||||
fragUniforms: "",
|
||||
fragCode: "vec2 textureCoord = vTextureCoord;",
|
||||
},
|
||||
{
|
||||
vertUniforms: "uniform mat3 uTransform;",
|
||||
vertCode: "vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;",
|
||||
fragUniforms:
|
||||
"uniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;",
|
||||
fragCode:
|
||||
"vec2 textureCoord = mod(vTextureCoord - uClampOffset, vec2(1.0, 1.0)) + uClampOffset;" +
|
||||
"\ntextureCoord = (uMapCoord * vec3(textureCoord, 1.0)).xy;" +
|
||||
"\ntextureCoord = clamp(textureCoord, uClampFrame.xy, uClampFrame.zw);",
|
||||
},
|
||||
];
|
||||
var PictureShader = (function (_super) {
|
||||
__extends(PictureShader, _super);
|
||||
function PictureShader(gl, vert, frag, tilingMode) {
|
||||
var lib = shaderLib[tilingMode];
|
||||
_super.call(
|
||||
this,
|
||||
gl,
|
||||
vert
|
||||
.replace(/%SPRITE_UNIFORMS%/gi, lib.vertUniforms)
|
||||
.replace(/%SPRITE_CODE%/gi, lib.vertCode),
|
||||
frag
|
||||
.replace(/%SPRITE_UNIFORMS%/gi, lib.fragUniforms)
|
||||
.replace(/%SPRITE_CODE%/gi, lib.fragCode)
|
||||
);
|
||||
this.bind();
|
||||
this.tilingMode = tilingMode;
|
||||
this.tempQuad = new PIXI.Quad(gl);
|
||||
this.tempQuad.initVao(this);
|
||||
this.uniforms.uColor = new Float32Array([1, 1, 1, 1]);
|
||||
this.uniforms.uSampler = [0, 1];
|
||||
}
|
||||
PictureShader.blendVert =
|
||||
"\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 mapMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n vMapCoord = (mapMatrix * vec3(aVertexPosition, 1.0)).xy;\n}\n";
|
||||
return PictureShader;
|
||||
})(PIXI.Shader);
|
||||
extras.PictureShader = PictureShader;
|
||||
})((extras = PIXI.extras || (PIXI.extras = {})));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var overlayFrag =
|
||||
"\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cs2 = Cs * 2.0 - 1.0;\n vec3 screen = Cb + Cs2 - Cb * Cs2;\n vec3 B;\n if (Cb.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cb.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cb.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n";
|
||||
var HardLightShader = (function (_super) {
|
||||
__extends(HardLightShader, _super);
|
||||
function HardLightShader(gl, tilingMode) {
|
||||
_super.call(
|
||||
this,
|
||||
gl,
|
||||
extras.PictureShader.blendVert,
|
||||
overlayFrag,
|
||||
tilingMode
|
||||
);
|
||||
}
|
||||
return HardLightShader;
|
||||
})(extras.PictureShader);
|
||||
extras.HardLightShader = HardLightShader;
|
||||
})((extras = PIXI.extras || (PIXI.extras = {})));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
function mapFilterBlendModesToPixi(gl, array) {
|
||||
if (array === void 0) {
|
||||
array = [];
|
||||
}
|
||||
array[PIXI.BLEND_MODES.OVERLAY] = [
|
||||
new extras.OverlayShader(gl, 0),
|
||||
new extras.OverlayShader(gl, 1),
|
||||
new extras.OverlayShader(gl, 2),
|
||||
];
|
||||
array[PIXI.BLEND_MODES.HARD_LIGHT] = [
|
||||
new extras.HardLightShader(gl, 0),
|
||||
new extras.HardLightShader(gl, 1),
|
||||
new extras.HardLightShader(gl, 2),
|
||||
];
|
||||
return array;
|
||||
}
|
||||
extras.mapFilterBlendModesToPixi = mapFilterBlendModesToPixi;
|
||||
})((extras = PIXI.extras || (PIXI.extras = {})));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var normalFrag =
|
||||
"\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n\n vec4 sample = texture2D(uSampler[0], textureCoord);\n gl_FragColor = sample * uColor;\n}\n";
|
||||
var normalVert =
|
||||
"\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n}\n";
|
||||
var NormalShader = (function (_super) {
|
||||
__extends(NormalShader, _super);
|
||||
function NormalShader(gl, tilingMode) {
|
||||
_super.call(this, gl, normalVert, normalFrag, tilingMode);
|
||||
}
|
||||
return NormalShader;
|
||||
})(extras.PictureShader);
|
||||
extras.NormalShader = NormalShader;
|
||||
})((extras = PIXI.extras || (PIXI.extras = {})));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var overlayFrag =
|
||||
"\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cb2 = Cb * 2.0 - 1.0;\n vec3 screen = Cb2 + Cs - Cb2 * Cs;\n vec3 B;\n if (Cs.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cs.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cs.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n";
|
||||
var OverlayShader = (function (_super) {
|
||||
__extends(OverlayShader, _super);
|
||||
function OverlayShader(gl, tilingMode) {
|
||||
_super.call(
|
||||
this,
|
||||
gl,
|
||||
extras.PictureShader.blendVert,
|
||||
overlayFrag,
|
||||
tilingMode
|
||||
);
|
||||
}
|
||||
return OverlayShader;
|
||||
})(extras.PictureShader);
|
||||
extras.OverlayShader = OverlayShader;
|
||||
})((extras = PIXI.extras || (PIXI.extras = {})));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
function nextPow2(v) {
|
||||
v += v === 0 ? 1 : 0;
|
||||
--v;
|
||||
v |= v >>> 1;
|
||||
v |= v >>> 2;
|
||||
v |= v >>> 4;
|
||||
v |= v >>> 8;
|
||||
v |= v >>> 16;
|
||||
return v + 1;
|
||||
}
|
||||
var PictureRenderer = (function (_super) {
|
||||
__extends(PictureRenderer, _super);
|
||||
function PictureRenderer(renderer) {
|
||||
_super.call(this, renderer);
|
||||
}
|
||||
PictureRenderer.prototype.onContextChange = function () {
|
||||
var gl = this.renderer.gl;
|
||||
this.drawModes = extras.mapFilterBlendModesToPixi(gl);
|
||||
this.normalShader = [
|
||||
new extras.NormalShader(gl, 0),
|
||||
new extras.NormalShader(gl, 1),
|
||||
new extras.NormalShader(gl, 2),
|
||||
];
|
||||
var PictureShader = (function (_super) {
|
||||
__extends(PictureShader, _super);
|
||||
function PictureShader(gl, vert, frag, tilingMode) {
|
||||
var lib = shaderLib[tilingMode];
|
||||
_super.call(this, gl, vert.replace(/%SPRITE_UNIFORMS%/gi, lib.vertUniforms)
|
||||
.replace(/%SPRITE_CODE%/gi, lib.vertCode), frag.replace(/%SPRITE_UNIFORMS%/gi, lib.fragUniforms)
|
||||
.replace(/%SPRITE_CODE%/gi, lib.fragCode));
|
||||
this.bind();
|
||||
this.tilingMode = tilingMode;
|
||||
this.tempQuad = new PIXI.Quad(gl);
|
||||
this.tempQuad.initVao(this);
|
||||
this.uniforms.uColor = new Float32Array([1, 1, 1, 1]);
|
||||
this.uniforms.uSampler = [0, 1];
|
||||
}
|
||||
PictureShader.blendVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\nuniform mat3 mapMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n vMapCoord = (mapMatrix * vec3(aVertexPosition, 1.0)).xy;\n}\n";
|
||||
return PictureShader;
|
||||
}(PIXI.Shader));
|
||||
extras.PictureShader = PictureShader;
|
||||
})(extras = PIXI.extras || (PIXI.extras = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var overlayFrag = "\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cs2 = Cs * 2.0 - 1.0;\n vec3 screen = Cb + Cs2 - Cb * Cs2;\n vec3 B;\n if (Cb.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cb.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cb.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n";
|
||||
var HardLightShader = (function (_super) {
|
||||
__extends(HardLightShader, _super);
|
||||
function HardLightShader(gl, tilingMode) {
|
||||
_super.call(this, gl, extras.PictureShader.blendVert, overlayFrag, tilingMode);
|
||||
}
|
||||
return HardLightShader;
|
||||
}(extras.PictureShader));
|
||||
extras.HardLightShader = HardLightShader;
|
||||
})(extras = PIXI.extras || (PIXI.extras = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
function mapFilterBlendModesToPixi(gl, array) {
|
||||
if (array === void 0) { array = []; }
|
||||
array[PIXI.BLEND_MODES.OVERLAY] = [new extras.OverlayShader(gl, 0), new extras.OverlayShader(gl, 1), new extras.OverlayShader(gl, 2)];
|
||||
array[PIXI.BLEND_MODES.HARD_LIGHT] = [new extras.HardLightShader(gl, 0), new extras.HardLightShader(gl, 1), new extras.HardLightShader(gl, 2)];
|
||||
return array;
|
||||
this._tempClamp = new Float32Array(4);
|
||||
this._tempColor = new Float32Array(4);
|
||||
this._tempRect = new PIXI.Rectangle();
|
||||
this._tempRect2 = new PIXI.Rectangle();
|
||||
this._tempRect3 = new PIXI.Rectangle();
|
||||
this._tempMatrix = new PIXI.Matrix();
|
||||
this._tempMatrix2 = new PIXI.Matrix();
|
||||
this._bigBuf = new Uint8Array(1 << 20);
|
||||
this._renderTexture = new PIXI.BaseRenderTexture(1024, 1024);
|
||||
};
|
||||
PictureRenderer.prototype.start = function () {};
|
||||
PictureRenderer.prototype.flush = function () {};
|
||||
PictureRenderer.prototype._getRenderTexture = function (
|
||||
minWidth,
|
||||
minHeight
|
||||
) {
|
||||
if (
|
||||
this._renderTexture.width < minWidth ||
|
||||
this._renderTexture.height < minHeight
|
||||
) {
|
||||
minHeight = nextPow2(minWidth);
|
||||
minHeight = nextPow2(minHeight);
|
||||
this._renderTexture.resize(minWidth, minHeight);
|
||||
}
|
||||
extras.mapFilterBlendModesToPixi = mapFilterBlendModesToPixi;
|
||||
})(extras = PIXI.extras || (PIXI.extras = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var normalFrag = "\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n\n vec4 sample = texture2D(uSampler[0], textureCoord);\n gl_FragColor = sample * uColor;\n}\n";
|
||||
var normalVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aColor;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n %SPRITE_CODE%\n}\n";
|
||||
var NormalShader = (function (_super) {
|
||||
__extends(NormalShader, _super);
|
||||
function NormalShader(gl, tilingMode) {
|
||||
_super.call(this, gl, normalVert, normalFrag, tilingMode);
|
||||
}
|
||||
return NormalShader;
|
||||
}(extras.PictureShader));
|
||||
extras.NormalShader = NormalShader;
|
||||
})(extras = PIXI.extras || (PIXI.extras = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var overlayFrag = "\nvarying vec2 vTextureCoord;\nvarying vec2 vMapCoord;\nvarying vec4 vColor;\n\nuniform sampler2D uSampler[2];\nuniform vec4 uColor;\n%SPRITE_UNIFORMS%\n\nvoid main(void)\n{\n %SPRITE_CODE%\n vec4 source = texture2D(uSampler[0], textureCoord) * uColor;\n vec4 target = texture2D(uSampler[1], vMapCoord);\n\n //reverse hardlight\n if (source.a == 0.0) {\n gl_FragColor = vec4(0, 0, 0, 0);\n return;\n }\n //yeah, premultiplied\n vec3 Cb = source.rgb/source.a, Cs;\n if (target.a > 0.0) {\n Cs = target.rgb / target.a;\n }\n vec3 multiply = Cb * Cs * 2.0;\n vec3 Cb2 = Cb * 2.0 - 1.0;\n vec3 screen = Cb2 + Cs - Cb2 * Cs;\n vec3 B;\n if (Cs.r <= 0.5) {\n B.r = multiply.r;\n } else {\n B.r = screen.r;\n }\n if (Cs.g <= 0.5) {\n B.g = multiply.g;\n } else {\n B.g = screen.g;\n }\n if (Cs.b <= 0.5) {\n B.b = multiply.b;\n } else {\n B.b = screen.b;\n }\n vec4 res;\n res.xyz = (1.0 - source.a) * Cs + source.a * B;\n res.a = source.a + target.a * (1.0-source.a);\n gl_FragColor = vec4(res.xyz * res.a, res.a);\n}\n";
|
||||
var OverlayShader = (function (_super) {
|
||||
__extends(OverlayShader, _super);
|
||||
function OverlayShader(gl, tilingMode) {
|
||||
_super.call(this, gl, extras.PictureShader.blendVert, overlayFrag, tilingMode);
|
||||
}
|
||||
return OverlayShader;
|
||||
}(extras.PictureShader));
|
||||
extras.OverlayShader = OverlayShader;
|
||||
})(extras = PIXI.extras || (PIXI.extras = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
function nextPow2(v) {
|
||||
v += (v === 0) ? 1 : 0;
|
||||
--v;
|
||||
v |= v >>> 1;
|
||||
v |= v >>> 2;
|
||||
v |= v >>> 4;
|
||||
v |= v >>> 8;
|
||||
v |= v >>> 16;
|
||||
return v + 1;
|
||||
return this._renderTexture;
|
||||
};
|
||||
PictureRenderer.prototype._getBuf = function (size) {
|
||||
var buf = this._bigBuf;
|
||||
if (buf.length < size) {
|
||||
size = nextPow2(size);
|
||||
buf = new Uint8Array(size);
|
||||
this._bigBuf = buf;
|
||||
}
|
||||
var PictureRenderer = (function (_super) {
|
||||
__extends(PictureRenderer, _super);
|
||||
function PictureRenderer(renderer) {
|
||||
_super.call(this, renderer);
|
||||
return buf;
|
||||
};
|
||||
PictureRenderer.prototype.render = function (sprite) {
|
||||
if (!sprite.texture.valid) {
|
||||
return;
|
||||
}
|
||||
var tilingMode = 0;
|
||||
if (sprite.tileTransform) {
|
||||
tilingMode = this._isSimpleSprite(sprite) ? 1 : 2;
|
||||
}
|
||||
var blendShader = this.drawModes[sprite.blendMode];
|
||||
if (blendShader) {
|
||||
this._renderBlend(sprite, blendShader[tilingMode]);
|
||||
} else {
|
||||
this._renderNormal(sprite, this.normalShader[tilingMode]);
|
||||
}
|
||||
};
|
||||
PictureRenderer.prototype._renderNormal = function (sprite, shader) {
|
||||
var renderer = this.renderer;
|
||||
renderer.bindShader(shader);
|
||||
renderer.state.setBlendMode(sprite.blendMode);
|
||||
this._renderInner(sprite, shader);
|
||||
};
|
||||
PictureRenderer.prototype._renderBlend = function (sprite, shader) {
|
||||
var renderer = this.renderer;
|
||||
var spriteBounds = sprite.getBounds();
|
||||
var renderTarget = renderer._activeRenderTarget;
|
||||
var matrix = renderTarget.projectionMatrix;
|
||||
var flipX = matrix.a < 0;
|
||||
var flipY = matrix.d < 0;
|
||||
var resolution = renderTarget.resolution;
|
||||
var screen = this._tempRect;
|
||||
var fr = renderTarget.sourceFrame || renderTarget.destinationFrame;
|
||||
screen.x = 0;
|
||||
screen.y = 0;
|
||||
screen.width = fr.width;
|
||||
screen.height = fr.height;
|
||||
var bounds = this._tempRect2;
|
||||
var fbw = fr.width * resolution,
|
||||
fbh = fr.height * resolution;
|
||||
bounds.x =
|
||||
(spriteBounds.x + matrix.tx / matrix.a) * resolution + fbw / 2;
|
||||
bounds.y =
|
||||
(spriteBounds.y + matrix.ty / matrix.d) * resolution + fbh / 2;
|
||||
bounds.width = spriteBounds.width * resolution;
|
||||
bounds.height = spriteBounds.height * resolution;
|
||||
if (flipX) {
|
||||
bounds.y = fbw - bounds.width - bounds.x;
|
||||
}
|
||||
if (flipY) {
|
||||
bounds.y = fbh - bounds.height - bounds.y;
|
||||
}
|
||||
var screenBounds = this._tempRect3;
|
||||
var x_1 = Math.floor(Math.max(screen.x, bounds.x));
|
||||
var x_2 = Math.ceil(
|
||||
Math.min(screen.x + screen.width, bounds.x + bounds.width)
|
||||
);
|
||||
var y_1 = Math.floor(Math.max(screen.y, bounds.y));
|
||||
var y_2 = Math.ceil(
|
||||
Math.min(screen.y + screen.height, bounds.y + bounds.height)
|
||||
);
|
||||
var pixelsWidth = x_2 - x_1;
|
||||
var pixelsHeight = y_2 - y_1;
|
||||
if (pixelsWidth <= 0 || pixelsHeight <= 0) {
|
||||
return;
|
||||
}
|
||||
var rt = this._getRenderTexture(pixelsWidth, pixelsHeight);
|
||||
renderer.bindTexture(rt, 1, true);
|
||||
var gl = renderer.gl;
|
||||
if (renderer.renderingToScreen && renderTarget.root) {
|
||||
var buf = this._getBuf(pixelsWidth * pixelsHeight * 4);
|
||||
gl.readPixels(
|
||||
x_1,
|
||||
y_1,
|
||||
pixelsWidth,
|
||||
pixelsHeight,
|
||||
gl.RGBA,
|
||||
gl.UNSIGNED_BYTE,
|
||||
this._bigBuf
|
||||
);
|
||||
gl.texSubImage2D(
|
||||
gl.TEXTURE_2D,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
pixelsWidth,
|
||||
pixelsHeight,
|
||||
gl.RGBA,
|
||||
gl.UNSIGNED_BYTE,
|
||||
this._bigBuf
|
||||
);
|
||||
} else {
|
||||
gl.copyTexSubImage2D(
|
||||
gl.TEXTURE_2D,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
x_1,
|
||||
y_1,
|
||||
pixelsWidth,
|
||||
pixelsHeight
|
||||
);
|
||||
}
|
||||
renderer.bindShader(shader);
|
||||
renderer.state.setBlendMode(PIXI.BLEND_MODES.NORMAL);
|
||||
if (shader.uniforms.mapMatrix) {
|
||||
var mapMatrix = this._tempMatrix;
|
||||
mapMatrix.a = bounds.width / rt.width / spriteBounds.width;
|
||||
if (flipX) {
|
||||
mapMatrix.a = -mapMatrix.a;
|
||||
mapMatrix.tx =
|
||||
(bounds.x - x_1) / rt.width -
|
||||
(spriteBounds.x + spriteBounds.width) * mapMatrix.a;
|
||||
} else {
|
||||
mapMatrix.tx =
|
||||
(bounds.x - x_1) / rt.width - spriteBounds.x * mapMatrix.a;
|
||||
}
|
||||
mapMatrix.d = bounds.height / rt.height / spriteBounds.height;
|
||||
if (flipY) {
|
||||
mapMatrix.d = -mapMatrix.d;
|
||||
mapMatrix.ty =
|
||||
(bounds.y - y_1) / rt.height -
|
||||
(spriteBounds.y + spriteBounds.height) * mapMatrix.d;
|
||||
} else {
|
||||
mapMatrix.ty =
|
||||
(bounds.y - y_1) / rt.height - spriteBounds.y * mapMatrix.d;
|
||||
}
|
||||
shader.uniforms.mapMatrix = mapMatrix.toArray(true);
|
||||
}
|
||||
this._renderInner(sprite, shader);
|
||||
};
|
||||
PictureRenderer.prototype._renderInner = function (sprite, shader) {
|
||||
var renderer = this.renderer;
|
||||
if (shader.tilingMode > 0) {
|
||||
this._renderWithShader(sprite, shader.tilingMode === 1, shader);
|
||||
} else {
|
||||
this._renderSprite(sprite, shader);
|
||||
}
|
||||
};
|
||||
PictureRenderer.prototype._renderWithShader = function (
|
||||
ts,
|
||||
isSimple,
|
||||
shader
|
||||
) {
|
||||
var quad = shader.tempQuad;
|
||||
var renderer = this.renderer;
|
||||
renderer.bindVao(quad.vao);
|
||||
var vertices = quad.vertices;
|
||||
var _width = ts._width;
|
||||
var _height = ts._height;
|
||||
var _anchorX = ts._anchor._x;
|
||||
var _anchorY = ts._anchor._y;
|
||||
var w0 = _width * (1 - _anchorX);
|
||||
var w1 = _width * -_anchorX;
|
||||
var h0 = _height * (1 - _anchorY);
|
||||
var h1 = _height * -_anchorY;
|
||||
var wt = ts.transform.worldTransform;
|
||||
var a = wt.a;
|
||||
var b = wt.b;
|
||||
var c = wt.c;
|
||||
var d = wt.d;
|
||||
var tx = wt.tx;
|
||||
var ty = wt.ty;
|
||||
vertices[0] = a * w1 + c * h1 + tx;
|
||||
vertices[1] = d * h1 + b * w1 + ty;
|
||||
vertices[2] = a * w0 + c * h1 + tx;
|
||||
vertices[3] = d * h1 + b * w0 + ty;
|
||||
vertices[4] = a * w0 + c * h0 + tx;
|
||||
vertices[5] = d * h0 + b * w0 + ty;
|
||||
vertices[6] = a * w1 + c * h0 + tx;
|
||||
vertices[7] = d * h0 + b * w1 + ty;
|
||||
vertices = quad.uvs;
|
||||
vertices[0] = vertices[6] = -ts.anchor.x;
|
||||
vertices[1] = vertices[3] = -ts.anchor.y;
|
||||
vertices[2] = vertices[4] = 1.0 - ts.anchor.x;
|
||||
vertices[5] = vertices[7] = 1.0 - ts.anchor.y;
|
||||
quad.upload();
|
||||
var tex = ts._texture;
|
||||
var lt = ts.tileTransform.localTransform;
|
||||
var uv = ts.uvTransform;
|
||||
var mapCoord = uv.mapCoord;
|
||||
var uClampFrame = uv.uClampFrame;
|
||||
var uClampOffset = uv.uClampOffset;
|
||||
var w = tex.width;
|
||||
var h = tex.height;
|
||||
var W = _width;
|
||||
var H = _height;
|
||||
var tempMat = this._tempMatrix2;
|
||||
tempMat.set(
|
||||
(lt.a * w) / W,
|
||||
(lt.b * w) / H,
|
||||
(lt.c * h) / W,
|
||||
(lt.d * h) / H,
|
||||
lt.tx / W,
|
||||
lt.ty / H
|
||||
);
|
||||
tempMat.invert();
|
||||
if (isSimple) {
|
||||
tempMat.append(mapCoord);
|
||||
} else {
|
||||
shader.uniforms.uMapCoord = mapCoord.toArray(true);
|
||||
shader.uniforms.uClampFrame = uClampFrame;
|
||||
shader.uniforms.uClampOffset = uClampOffset;
|
||||
}
|
||||
shader.uniforms.uTransform = tempMat.toArray(true);
|
||||
var color = this._tempColor;
|
||||
var alpha = ts.worldAlpha;
|
||||
PIXI.utils.hex2rgb(ts.tint, color);
|
||||
color[0] *= alpha;
|
||||
color[1] *= alpha;
|
||||
color[2] *= alpha;
|
||||
color[3] = alpha;
|
||||
shader.uniforms.uColor = color;
|
||||
renderer.bindTexture(tex, 0, true);
|
||||
quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0);
|
||||
};
|
||||
PictureRenderer.prototype._renderSprite = function (sprite, shader) {
|
||||
var renderer = this.renderer;
|
||||
var quad = shader.tempQuad;
|
||||
renderer.bindVao(quad.vao);
|
||||
var uvs = sprite.texture._uvs;
|
||||
var vertices = quad.vertices;
|
||||
var vd = sprite.vertexData;
|
||||
for (var i = 0; i < 8; i++) {
|
||||
quad.vertices[i] = vd[i];
|
||||
}
|
||||
quad.uvs[0] = uvs.x0;
|
||||
quad.uvs[1] = uvs.y0;
|
||||
quad.uvs[2] = uvs.x1;
|
||||
quad.uvs[3] = uvs.y1;
|
||||
quad.uvs[4] = uvs.x2;
|
||||
quad.uvs[5] = uvs.y2;
|
||||
quad.uvs[6] = uvs.x3;
|
||||
quad.uvs[7] = uvs.y3;
|
||||
quad.upload();
|
||||
var frame = sprite.texture.frame;
|
||||
var base = sprite.texture.baseTexture;
|
||||
var clamp = this._tempClamp;
|
||||
var eps = 0.5 / base.resolution;
|
||||
clamp[0] = (frame.x + eps) / base.width;
|
||||
clamp[1] = (frame.y + eps) / base.height;
|
||||
clamp[2] = (frame.x + frame.width - eps) / base.width;
|
||||
clamp[3] = (frame.y + frame.height - eps) / base.height;
|
||||
shader.uniforms.uTextureClamp = clamp;
|
||||
var color = this._tempColor;
|
||||
PIXI.utils.hex2rgb(sprite.tint, color);
|
||||
var alpha = sprite.worldAlpha;
|
||||
color[0] *= alpha;
|
||||
color[1] *= alpha;
|
||||
color[2] *= alpha;
|
||||
color[3] = alpha;
|
||||
shader.uniforms.uColor = color;
|
||||
renderer.bindTexture(base, 0, true);
|
||||
quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0);
|
||||
};
|
||||
PictureRenderer.prototype._isSimpleSprite = function (ts) {
|
||||
var renderer = this.renderer;
|
||||
var tex = ts._texture;
|
||||
var baseTex = tex.baseTexture;
|
||||
var isSimple =
|
||||
baseTex.isPowerOfTwo &&
|
||||
tex.frame.width === baseTex.width &&
|
||||
tex.frame.height === baseTex.height;
|
||||
if (isSimple) {
|
||||
if (!baseTex._glTextures[renderer.CONTEXT_UID]) {
|
||||
if (baseTex.wrapMode === PIXI.WRAP_MODES.CLAMP) {
|
||||
baseTex.wrapMode = PIXI.WRAP_MODES.REPEAT;
|
||||
}
|
||||
PictureRenderer.prototype.onContextChange = function () {
|
||||
var gl = this.renderer.gl;
|
||||
this.drawModes = extras.mapFilterBlendModesToPixi(gl);
|
||||
this.normalShader = [new extras.NormalShader(gl, 0), new extras.NormalShader(gl, 1), new extras.NormalShader(gl, 2)];
|
||||
this._tempClamp = new Float32Array(4);
|
||||
this._tempColor = new Float32Array(4);
|
||||
this._tempRect = new PIXI.Rectangle();
|
||||
this._tempRect2 = new PIXI.Rectangle();
|
||||
this._tempRect3 = new PIXI.Rectangle();
|
||||
this._tempMatrix = new PIXI.Matrix();
|
||||
this._tempMatrix2 = new PIXI.Matrix();
|
||||
this._bigBuf = new Uint8Array(1 << 20);
|
||||
this._renderTexture = new PIXI.BaseRenderTexture(1024, 1024);
|
||||
};
|
||||
PictureRenderer.prototype.start = function () {
|
||||
};
|
||||
PictureRenderer.prototype.flush = function () {
|
||||
};
|
||||
PictureRenderer.prototype._getRenderTexture = function (minWidth, minHeight) {
|
||||
if (this._renderTexture.width < minWidth ||
|
||||
this._renderTexture.height < minHeight) {
|
||||
minHeight = nextPow2(minWidth);
|
||||
minHeight = nextPow2(minHeight);
|
||||
this._renderTexture.resize(minWidth, minHeight);
|
||||
}
|
||||
return this._renderTexture;
|
||||
};
|
||||
PictureRenderer.prototype._getBuf = function (size) {
|
||||
var buf = this._bigBuf;
|
||||
if (buf.length < size) {
|
||||
size = nextPow2(size);
|
||||
buf = new Uint8Array(size);
|
||||
this._bigBuf = buf;
|
||||
}
|
||||
return buf;
|
||||
};
|
||||
PictureRenderer.prototype.render = function (sprite) {
|
||||
if (!sprite.texture.valid) {
|
||||
return;
|
||||
}
|
||||
var tilingMode = 0;
|
||||
if (sprite.tileTransform) {
|
||||
tilingMode = this._isSimpleSprite(sprite) ? 1 : 2;
|
||||
}
|
||||
var blendShader = this.drawModes[sprite.blendMode];
|
||||
if (blendShader) {
|
||||
this._renderBlend(sprite, blendShader[tilingMode]);
|
||||
}
|
||||
else {
|
||||
this._renderNormal(sprite, this.normalShader[tilingMode]);
|
||||
}
|
||||
};
|
||||
PictureRenderer.prototype._renderNormal = function (sprite, shader) {
|
||||
var renderer = this.renderer;
|
||||
renderer.bindShader(shader);
|
||||
renderer.state.setBlendMode(sprite.blendMode);
|
||||
this._renderInner(sprite, shader);
|
||||
};
|
||||
PictureRenderer.prototype._renderBlend = function (sprite, shader) {
|
||||
var renderer = this.renderer;
|
||||
var spriteBounds = sprite.getBounds();
|
||||
var renderTarget = renderer._activeRenderTarget;
|
||||
var matrix = renderTarget.projectionMatrix;
|
||||
var flipX = matrix.a < 0;
|
||||
var flipY = matrix.d < 0;
|
||||
var resolution = renderTarget.resolution;
|
||||
var screen = this._tempRect;
|
||||
var fr = renderTarget.sourceFrame || renderTarget.destinationFrame;
|
||||
screen.x = 0;
|
||||
screen.y = 0;
|
||||
screen.width = fr.width;
|
||||
screen.height = fr.height;
|
||||
var bounds = this._tempRect2;
|
||||
var fbw = fr.width * resolution, fbh = fr.height * resolution;
|
||||
bounds.x = (spriteBounds.x + matrix.tx / matrix.a) * resolution + fbw / 2;
|
||||
bounds.y = (spriteBounds.y + matrix.ty / matrix.d) * resolution + fbh / 2;
|
||||
bounds.width = spriteBounds.width * resolution;
|
||||
bounds.height = spriteBounds.height * resolution;
|
||||
if (flipX) {
|
||||
bounds.y = fbw - bounds.width - bounds.x;
|
||||
}
|
||||
if (flipY) {
|
||||
bounds.y = fbh - bounds.height - bounds.y;
|
||||
}
|
||||
var screenBounds = this._tempRect3;
|
||||
var x_1 = Math.floor(Math.max(screen.x, bounds.x));
|
||||
var x_2 = Math.ceil(Math.min(screen.x + screen.width, bounds.x + bounds.width));
|
||||
var y_1 = Math.floor(Math.max(screen.y, bounds.y));
|
||||
var y_2 = Math.ceil(Math.min(screen.y + screen.height, bounds.y + bounds.height));
|
||||
var pixelsWidth = x_2 - x_1;
|
||||
var pixelsHeight = y_2 - y_1;
|
||||
if (pixelsWidth <= 0 || pixelsHeight <= 0) {
|
||||
return;
|
||||
}
|
||||
var rt = this._getRenderTexture(pixelsWidth, pixelsHeight);
|
||||
renderer.bindTexture(rt, 1, true);
|
||||
var gl = renderer.gl;
|
||||
if (renderer.renderingToScreen && renderTarget.root) {
|
||||
var buf = this._getBuf(pixelsWidth * pixelsHeight * 4);
|
||||
gl.readPixels(x_1, y_1, pixelsWidth, pixelsHeight, gl.RGBA, gl.UNSIGNED_BYTE, this._bigBuf);
|
||||
gl.texSubImage2D(gl.TEXTURE_2D, 0, 0, 0, pixelsWidth, pixelsHeight, gl.RGBA, gl.UNSIGNED_BYTE, this._bigBuf);
|
||||
}
|
||||
else {
|
||||
gl.copyTexSubImage2D(gl.TEXTURE_2D, 0, 0, 0, x_1, y_1, pixelsWidth, pixelsHeight);
|
||||
}
|
||||
renderer.bindShader(shader);
|
||||
renderer.state.setBlendMode(PIXI.BLEND_MODES.NORMAL);
|
||||
if (shader.uniforms.mapMatrix) {
|
||||
var mapMatrix = this._tempMatrix;
|
||||
mapMatrix.a = bounds.width / rt.width / spriteBounds.width;
|
||||
if (flipX) {
|
||||
mapMatrix.a = -mapMatrix.a;
|
||||
mapMatrix.tx = (bounds.x - x_1) / rt.width - (spriteBounds.x + spriteBounds.width) * mapMatrix.a;
|
||||
}
|
||||
else {
|
||||
mapMatrix.tx = (bounds.x - x_1) / rt.width - spriteBounds.x * mapMatrix.a;
|
||||
}
|
||||
mapMatrix.d = bounds.height / rt.height / spriteBounds.height;
|
||||
if (flipY) {
|
||||
mapMatrix.d = -mapMatrix.d;
|
||||
mapMatrix.ty = (bounds.y - y_1) / rt.height - (spriteBounds.y + spriteBounds.height) * mapMatrix.d;
|
||||
}
|
||||
else {
|
||||
mapMatrix.ty = (bounds.y - y_1) / rt.height - spriteBounds.y * mapMatrix.d;
|
||||
}
|
||||
shader.uniforms.mapMatrix = mapMatrix.toArray(true);
|
||||
}
|
||||
this._renderInner(sprite, shader);
|
||||
};
|
||||
PictureRenderer.prototype._renderInner = function (sprite, shader) {
|
||||
var renderer = this.renderer;
|
||||
if (shader.tilingMode > 0) {
|
||||
this._renderWithShader(sprite, shader.tilingMode === 1, shader);
|
||||
}
|
||||
else {
|
||||
this._renderSprite(sprite, shader);
|
||||
}
|
||||
};
|
||||
PictureRenderer.prototype._renderWithShader = function (ts, isSimple, shader) {
|
||||
var quad = shader.tempQuad;
|
||||
var renderer = this.renderer;
|
||||
renderer.bindVao(quad.vao);
|
||||
var vertices = quad.vertices;
|
||||
var _width = ts._width;
|
||||
var _height = ts._height;
|
||||
var _anchorX = ts._anchor._x;
|
||||
var _anchorY = ts._anchor._y;
|
||||
var w0 = _width * (1 - _anchorX);
|
||||
var w1 = _width * -_anchorX;
|
||||
var h0 = _height * (1 - _anchorY);
|
||||
var h1 = _height * -_anchorY;
|
||||
var wt = ts.transform.worldTransform;
|
||||
var a = wt.a;
|
||||
var b = wt.b;
|
||||
var c = wt.c;
|
||||
var d = wt.d;
|
||||
var tx = wt.tx;
|
||||
var ty = wt.ty;
|
||||
vertices[0] = (a * w1) + (c * h1) + tx;
|
||||
vertices[1] = (d * h1) + (b * w1) + ty;
|
||||
vertices[2] = (a * w0) + (c * h1) + tx;
|
||||
vertices[3] = (d * h1) + (b * w0) + ty;
|
||||
vertices[4] = (a * w0) + (c * h0) + tx;
|
||||
vertices[5] = (d * h0) + (b * w0) + ty;
|
||||
vertices[6] = (a * w1) + (c * h0) + tx;
|
||||
vertices[7] = (d * h0) + (b * w1) + ty;
|
||||
vertices = quad.uvs;
|
||||
vertices[0] = vertices[6] = -ts.anchor.x;
|
||||
vertices[1] = vertices[3] = -ts.anchor.y;
|
||||
vertices[2] = vertices[4] = 1.0 - ts.anchor.x;
|
||||
vertices[5] = vertices[7] = 1.0 - ts.anchor.y;
|
||||
quad.upload();
|
||||
var tex = ts._texture;
|
||||
var lt = ts.tileTransform.localTransform;
|
||||
var uv = ts.uvTransform;
|
||||
var mapCoord = uv.mapCoord;
|
||||
var uClampFrame = uv.uClampFrame;
|
||||
var uClampOffset = uv.uClampOffset;
|
||||
var w = tex.width;
|
||||
var h = tex.height;
|
||||
var W = _width;
|
||||
var H = _height;
|
||||
var tempMat = this._tempMatrix2;
|
||||
tempMat.set(lt.a * w / W, lt.b * w / H, lt.c * h / W, lt.d * h / H, lt.tx / W, lt.ty / H);
|
||||
tempMat.invert();
|
||||
if (isSimple) {
|
||||
tempMat.append(mapCoord);
|
||||
}
|
||||
else {
|
||||
shader.uniforms.uMapCoord = mapCoord.toArray(true);
|
||||
shader.uniforms.uClampFrame = uClampFrame;
|
||||
shader.uniforms.uClampOffset = uClampOffset;
|
||||
}
|
||||
shader.uniforms.uTransform = tempMat.toArray(true);
|
||||
var color = this._tempColor;
|
||||
var alpha = ts.worldAlpha;
|
||||
PIXI.utils.hex2rgb(ts.tint, color);
|
||||
color[0] *= alpha;
|
||||
color[1] *= alpha;
|
||||
color[2] *= alpha;
|
||||
color[3] = alpha;
|
||||
shader.uniforms.uColor = color;
|
||||
renderer.bindTexture(tex, 0, true);
|
||||
quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0);
|
||||
};
|
||||
PictureRenderer.prototype._renderSprite = function (sprite, shader) {
|
||||
var renderer = this.renderer;
|
||||
var quad = shader.tempQuad;
|
||||
renderer.bindVao(quad.vao);
|
||||
var uvs = sprite.texture._uvs;
|
||||
var vertices = quad.vertices;
|
||||
var vd = sprite.vertexData;
|
||||
for (var i = 0; i < 8; i++) {
|
||||
quad.vertices[i] = vd[i];
|
||||
}
|
||||
quad.uvs[0] = uvs.x0;
|
||||
quad.uvs[1] = uvs.y0;
|
||||
quad.uvs[2] = uvs.x1;
|
||||
quad.uvs[3] = uvs.y1;
|
||||
quad.uvs[4] = uvs.x2;
|
||||
quad.uvs[5] = uvs.y2;
|
||||
quad.uvs[6] = uvs.x3;
|
||||
quad.uvs[7] = uvs.y3;
|
||||
quad.upload();
|
||||
var frame = sprite.texture.frame;
|
||||
var base = sprite.texture.baseTexture;
|
||||
var clamp = this._tempClamp;
|
||||
var eps = 0.5 / base.resolution;
|
||||
clamp[0] = (frame.x + eps) / base.width;
|
||||
clamp[1] = (frame.y + eps) / base.height;
|
||||
clamp[2] = (frame.x + frame.width - eps) / base.width;
|
||||
clamp[3] = (frame.y + frame.height - eps) / base.height;
|
||||
shader.uniforms.uTextureClamp = clamp;
|
||||
var color = this._tempColor;
|
||||
PIXI.utils.hex2rgb(sprite.tint, color);
|
||||
var alpha = sprite.worldAlpha;
|
||||
color[0] *= alpha;
|
||||
color[1] *= alpha;
|
||||
color[2] *= alpha;
|
||||
color[3] = alpha;
|
||||
shader.uniforms.uColor = color;
|
||||
renderer.bindTexture(base, 0, true);
|
||||
quad.vao.draw(this.renderer.gl.TRIANGLES, 6, 0);
|
||||
};
|
||||
PictureRenderer.prototype._isSimpleSprite = function (ts) {
|
||||
var renderer = this.renderer;
|
||||
var tex = ts._texture;
|
||||
var baseTex = tex.baseTexture;
|
||||
var isSimple = baseTex.isPowerOfTwo && tex.frame.width === baseTex.width && tex.frame.height === baseTex.height;
|
||||
if (isSimple) {
|
||||
if (!baseTex._glTextures[renderer.CONTEXT_UID]) {
|
||||
if (baseTex.wrapMode === PIXI.WRAP_MODES.CLAMP) {
|
||||
baseTex.wrapMode = PIXI.WRAP_MODES.REPEAT;
|
||||
}
|
||||
}
|
||||
else {
|
||||
isSimple = baseTex.wrapMode !== PIXI.WRAP_MODES.CLAMP;
|
||||
}
|
||||
}
|
||||
return isSimple;
|
||||
};
|
||||
return PictureRenderer;
|
||||
}(PIXI.ObjectRenderer));
|
||||
extras.PictureRenderer = PictureRenderer;
|
||||
PIXI.WebGLRenderer.registerPlugin('picture', PictureRenderer);
|
||||
PIXI.CanvasRenderer.registerPlugin('picture', PIXI.CanvasSpriteRenderer);
|
||||
})(extras = PIXI.extras || (PIXI.extras = {}));
|
||||
} else {
|
||||
isSimple = baseTex.wrapMode !== PIXI.WRAP_MODES.CLAMP;
|
||||
}
|
||||
}
|
||||
return isSimple;
|
||||
};
|
||||
return PictureRenderer;
|
||||
})(PIXI.ObjectRenderer);
|
||||
extras.PictureRenderer = PictureRenderer;
|
||||
PIXI.WebGLRenderer.registerPlugin("picture", PictureRenderer);
|
||||
PIXI.CanvasRenderer.registerPlugin("picture", PIXI.CanvasSpriteRenderer);
|
||||
})((extras = PIXI.extras || (PIXI.extras = {})));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var PictureSprite = (function (_super) {
|
||||
__extends(PictureSprite, _super);
|
||||
function PictureSprite(texture) {
|
||||
_super.call(this, texture);
|
||||
this.pluginName = 'picture';
|
||||
}
|
||||
return PictureSprite;
|
||||
}(PIXI.Sprite));
|
||||
extras.PictureSprite = PictureSprite;
|
||||
})(extras = PIXI.extras || (PIXI.extras = {}));
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var PictureSprite = (function (_super) {
|
||||
__extends(PictureSprite, _super);
|
||||
function PictureSprite(texture) {
|
||||
_super.call(this, texture);
|
||||
this.pluginName = "picture";
|
||||
}
|
||||
return PictureSprite;
|
||||
})(PIXI.Sprite);
|
||||
extras.PictureSprite = PictureSprite;
|
||||
})((extras = PIXI.extras || (PIXI.extras = {})));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var PictureTilingSprite = (function (_super) {
|
||||
__extends(PictureTilingSprite, _super);
|
||||
function PictureTilingSprite(texture) {
|
||||
_super.call(this, texture);
|
||||
this.pluginName = 'picture';
|
||||
}
|
||||
return PictureTilingSprite;
|
||||
}(extras.TilingSprite));
|
||||
extras.PictureTilingSprite = PictureTilingSprite;
|
||||
})(extras = PIXI.extras || (PIXI.extras = {}));
|
||||
var extras;
|
||||
(function (extras) {
|
||||
var PictureTilingSprite = (function (_super) {
|
||||
__extends(PictureTilingSprite, _super);
|
||||
function PictureTilingSprite(texture) {
|
||||
_super.call(this, texture);
|
||||
this.pluginName = "picture";
|
||||
}
|
||||
return PictureTilingSprite;
|
||||
})(extras.TilingSprite);
|
||||
extras.PictureTilingSprite = PictureTilingSprite;
|
||||
})((extras = PIXI.extras || (PIXI.extras = {})));
|
||||
})(PIXI || (PIXI = {}));
|
||||
//# sourceMappingURL=pixi-picture.js.map
|
||||
//# sourceMappingURL=pixi-picture.js.map
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
86206
www/js/libs/pixi.js
86206
www/js/libs/pixi.js
File diff suppressed because it is too large
Load diff
|
|
@ -4,6 +4,6 @@
|
|||
|
||||
PluginManager.setup($plugins);
|
||||
|
||||
window.onload = function() {
|
||||
SceneManager.run(Scene_Boot);
|
||||
window.onload = function () {
|
||||
SceneManager.run(Scene_Boot);
|
||||
};
|
||||
|
|
|
|||
3271
www/js/plugins.js
3271
www/js/plugins.js
File diff suppressed because one or more lines are too long
|
|
@ -17,76 +17,74 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
var _Scene_Menu_create = Scene_Menu.prototype.create;
|
||||
Scene_Menu.prototype.create = function () {
|
||||
_Scene_Menu_create.call(this);
|
||||
this._statusWindow.x = 0;
|
||||
this._statusWindow.y = this._commandWindow.height;
|
||||
this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width;
|
||||
};
|
||||
|
||||
var _Scene_Menu_create = Scene_Menu.prototype.create;
|
||||
Scene_Menu.prototype.create = function () {
|
||||
_Scene_Menu_create.call(this);
|
||||
this._statusWindow.x = 0;
|
||||
this._statusWindow.y = this._commandWindow.height;
|
||||
this._goldWindow.x = Graphics.boxWidth - this._goldWindow.width;
|
||||
};
|
||||
Window_MenuCommand.prototype.windowWidth = function () {
|
||||
return Graphics.boxWidth;
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.windowWidth = function () {
|
||||
return Graphics.boxWidth;
|
||||
};
|
||||
Window_MenuCommand.prototype.maxCols = function () {
|
||||
return 4;
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.maxCols = function () {
|
||||
return 4;
|
||||
};
|
||||
Window_MenuCommand.prototype.numVisibleRows = function () {
|
||||
return 2;
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.numVisibleRows = function () {
|
||||
return 2;
|
||||
};
|
||||
Window_MenuStatus.prototype.windowWidth = function () {
|
||||
return Graphics.boxWidth;
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.windowWidth = function () {
|
||||
return Graphics.boxWidth;
|
||||
};
|
||||
Window_MenuStatus.prototype.windowHeight = function () {
|
||||
var h1 = this.fittingHeight(1);
|
||||
var h2 = this.fittingHeight(2);
|
||||
return Graphics.boxHeight - h1 - h2;
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.windowHeight = function () {
|
||||
var h1 = this.fittingHeight(1);
|
||||
var h2 = this.fittingHeight(2);
|
||||
return Graphics.boxHeight - h1 - h2;
|
||||
};
|
||||
Window_MenuStatus.prototype.maxCols = function () {
|
||||
return 4;
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.maxCols = function () {
|
||||
return 4;
|
||||
};
|
||||
Window_MenuStatus.prototype.numVisibleRows = function () {
|
||||
return 1;
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.numVisibleRows = function () {
|
||||
return 1;
|
||||
};
|
||||
Window_MenuStatus.prototype.drawItemImage = function (index) {
|
||||
var actor = $gameParty.members()[index];
|
||||
var rect = this.itemRectForText(index);
|
||||
var w = Math.min(rect.width, 144);
|
||||
var h = Math.min(rect.height, 144);
|
||||
var lineHeight = this.lineHeight();
|
||||
this.changePaintOpacity(actor.isBattleMember());
|
||||
this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2.5, w, h);
|
||||
this.changePaintOpacity(true);
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.drawItemImage = function (index) {
|
||||
var actor = $gameParty.members()[index];
|
||||
var rect = this.itemRectForText(index);
|
||||
var w = Math.min(rect.width, 144);
|
||||
var h = Math.min(rect.height, 144);
|
||||
var lineHeight = this.lineHeight();
|
||||
this.changePaintOpacity(actor.isBattleMember());
|
||||
this.drawActorFace(actor, rect.x, rect.y + lineHeight * 2.5, w, h);
|
||||
this.changePaintOpacity(true);
|
||||
};
|
||||
|
||||
Window_MenuStatus.prototype.drawItemStatus = function (index) {
|
||||
var actor = $gameParty.members()[index];
|
||||
var rect = this.itemRectForText(index);
|
||||
var x = rect.x;
|
||||
var y = rect.y;
|
||||
var width = rect.width;
|
||||
var bottom = y + rect.height;
|
||||
var lineHeight = this.lineHeight();
|
||||
this.drawActorName(actor, x, y + lineHeight * 0, width);
|
||||
this.drawActorLevel(actor, x, y + lineHeight * 1, width);
|
||||
this.drawActorClass(actor, x, bottom - lineHeight * 4, width);
|
||||
this.drawActorHp(actor, x, bottom - lineHeight * 3, width);
|
||||
this.drawActorMp(actor, x, bottom - lineHeight * 2, width);
|
||||
this.drawActorIcons(actor, x, bottom - lineHeight * 1, width);
|
||||
};
|
||||
|
||||
var _Window_MenuActor_initialize = Window_MenuActor.prototype.initialize;
|
||||
Window_MenuActor.prototype.initialize = function () {
|
||||
_Window_MenuActor_initialize.call(this);
|
||||
this.y = this.fittingHeight(2);
|
||||
};
|
||||
Window_MenuStatus.prototype.drawItemStatus = function (index) {
|
||||
var actor = $gameParty.members()[index];
|
||||
var rect = this.itemRectForText(index);
|
||||
var x = rect.x;
|
||||
var y = rect.y;
|
||||
var width = rect.width;
|
||||
var bottom = y + rect.height;
|
||||
var lineHeight = this.lineHeight();
|
||||
this.drawActorName(actor, x, y + lineHeight * 0, width);
|
||||
this.drawActorLevel(actor, x, y + lineHeight * 1, width);
|
||||
this.drawActorClass(actor, x, bottom - lineHeight * 4, width);
|
||||
this.drawActorHp(actor, x, bottom - lineHeight * 3, width);
|
||||
this.drawActorMp(actor, x, bottom - lineHeight * 2, width);
|
||||
this.drawActorIcons(actor, x, bottom - lineHeight * 1, width);
|
||||
};
|
||||
|
||||
var _Window_MenuActor_initialize = Window_MenuActor.prototype.initialize;
|
||||
Window_MenuActor.prototype.initialize = function () {
|
||||
_Window_MenuActor_initialize.call(this);
|
||||
this.y = this.fittingHeight(2);
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -17,118 +17,116 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
var _Scene_File_create = Scene_File.prototype.create;
|
||||
Scene_File.prototype.create = function () {
|
||||
_Scene_File_create.call(this);
|
||||
this._listWindow.height = this._listWindow.fittingHeight(8);
|
||||
var x = 0;
|
||||
var y = this._listWindow.y + this._listWindow.height;
|
||||
var width = Graphics.boxWidth;
|
||||
var height = Graphics.boxHeight - y;
|
||||
this._statusWindow = new Window_SavefileStatus(x, y, width, height);
|
||||
this._statusWindow.setMode(this.mode());
|
||||
this._listWindow.statusWindow = this._statusWindow;
|
||||
this._listWindow.callUpdateHelp();
|
||||
this.addWindow(this._statusWindow);
|
||||
};
|
||||
|
||||
var _Scene_File_create = Scene_File.prototype.create;
|
||||
Scene_File.prototype.create = function () {
|
||||
_Scene_File_create.call(this);
|
||||
this._listWindow.height = this._listWindow.fittingHeight(8);
|
||||
var x = 0;
|
||||
var y = this._listWindow.y + this._listWindow.height;
|
||||
var width = Graphics.boxWidth;
|
||||
var height = Graphics.boxHeight - y;
|
||||
this._statusWindow = new Window_SavefileStatus(x, y, width, height);
|
||||
this._statusWindow.setMode(this.mode());
|
||||
this._listWindow.statusWindow = this._statusWindow;
|
||||
this._listWindow.callUpdateHelp();
|
||||
this.addWindow(this._statusWindow);
|
||||
};
|
||||
var _Scene_File_start = Scene_File.prototype.start;
|
||||
Scene_File.prototype.start = function () {
|
||||
_Scene_File_start.call(this);
|
||||
this._listWindow.ensureCursorVisible();
|
||||
this._listWindow.callUpdateHelp();
|
||||
};
|
||||
|
||||
var _Scene_File_start = Scene_File.prototype.start;
|
||||
Scene_File.prototype.start = function () {
|
||||
_Scene_File_start.call(this);
|
||||
this._listWindow.ensureCursorVisible();
|
||||
this._listWindow.callUpdateHelp();
|
||||
};
|
||||
Window_SavefileList.prototype.windowWidth = function () {
|
||||
return Graphics.boxWidth;
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.windowWidth = function () {
|
||||
return Graphics.boxWidth;
|
||||
};
|
||||
Window_SavefileList.prototype.maxCols = function () {
|
||||
return 4;
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.maxCols = function () {
|
||||
return 4;
|
||||
};
|
||||
Window_SavefileList.prototype.numVisibleRows = function () {
|
||||
return 5;
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.numVisibleRows = function () {
|
||||
return 5;
|
||||
};
|
||||
Window_SavefileList.prototype.spacing = function () {
|
||||
return 8;
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.spacing = function () {
|
||||
return 8;
|
||||
};
|
||||
Window_SavefileList.prototype.itemHeight = function () {
|
||||
return this.lineHeight() * 2;
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.itemHeight = function () {
|
||||
return this.lineHeight() * 2;
|
||||
};
|
||||
|
||||
var _Window_SavefileList_callUpdateHelp =
|
||||
Window_SavefileList.prototype.callUpdateHelp;
|
||||
Window_SavefileList.prototype.callUpdateHelp = function () {
|
||||
_Window_SavefileList_callUpdateHelp.call(this);
|
||||
if (this.active && this.statusWindow) {
|
||||
this.statusWindow.setId(this.index() + 1);
|
||||
}
|
||||
};
|
||||
|
||||
function Window_SavefileStatus() {
|
||||
this.initialize.apply(this, arguments);
|
||||
var _Window_SavefileList_callUpdateHelp =
|
||||
Window_SavefileList.prototype.callUpdateHelp;
|
||||
Window_SavefileList.prototype.callUpdateHelp = function () {
|
||||
_Window_SavefileList_callUpdateHelp.call(this);
|
||||
if (this.active && this.statusWindow) {
|
||||
this.statusWindow.setId(this.index() + 1);
|
||||
}
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype = Object.create(Window_Base.prototype);
|
||||
Window_SavefileStatus.prototype.constructor = Window_SavefileStatus;
|
||||
function Window_SavefileStatus() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_SavefileStatus.prototype.initialize = function (x, y, width, height) {
|
||||
Window_Base.prototype.initialize.call(this, x, y, width, height);
|
||||
this._id = 1;
|
||||
};
|
||||
Window_SavefileStatus.prototype = Object.create(Window_Base.prototype);
|
||||
Window_SavefileStatus.prototype.constructor = Window_SavefileStatus;
|
||||
|
||||
Window_SavefileStatus.prototype.setMode = function (mode) {
|
||||
this._mode = mode;
|
||||
};
|
||||
Window_SavefileStatus.prototype.initialize = function (x, y, width, height) {
|
||||
Window_Base.prototype.initialize.call(this, x, y, width, height);
|
||||
this._id = 1;
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.setId = function (id) {
|
||||
this._id = id;
|
||||
this.refresh();
|
||||
};
|
||||
Window_SavefileStatus.prototype.setMode = function (mode) {
|
||||
this._mode = mode;
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.refresh = function () {
|
||||
this.contents.clear();
|
||||
var id = this._id;
|
||||
var valid = DataManager.isThisGameFile(id);
|
||||
var info = DataManager.loadSavefileInfo(id);
|
||||
var rect = this.contents.rect;
|
||||
this.resetTextColor();
|
||||
if (this._mode === 'load') {
|
||||
this.changePaintOpacity(valid);
|
||||
}
|
||||
this.drawFileId(id, rect.x, rect.y);
|
||||
if (info) {
|
||||
this.changePaintOpacity(valid);
|
||||
this.drawContents(info, rect, valid);
|
||||
this.changePaintOpacity(true);
|
||||
}
|
||||
};
|
||||
Window_SavefileStatus.prototype.setId = function (id) {
|
||||
this._id = id;
|
||||
this.refresh();
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.drawFileId = function (id, x, y) {
|
||||
this.drawText(TextManager.file + ' ' + id, x, y, 180);
|
||||
};
|
||||
Window_SavefileStatus.prototype.refresh = function () {
|
||||
this.contents.clear();
|
||||
var id = this._id;
|
||||
var valid = DataManager.isThisGameFile(id);
|
||||
var info = DataManager.loadSavefileInfo(id);
|
||||
var rect = this.contents.rect;
|
||||
this.resetTextColor();
|
||||
if (this._mode === "load") {
|
||||
this.changePaintOpacity(valid);
|
||||
}
|
||||
this.drawFileId(id, rect.x, rect.y);
|
||||
if (info) {
|
||||
this.changePaintOpacity(valid);
|
||||
this.drawContents(info, rect, valid);
|
||||
this.changePaintOpacity(true);
|
||||
}
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.drawContents = function (info, rect, valid) {
|
||||
var bottom = rect.y + rect.height;
|
||||
var playtimeY = bottom - this.lineHeight();
|
||||
this.drawText(info.title, rect.x + 192, rect.y, rect.width - 192);
|
||||
if (valid) {
|
||||
this.drawPartyfaces(info, rect.x, bottom - 144);
|
||||
}
|
||||
this.drawText(info.playtime, rect.x, playtimeY, rect.width, 'right');
|
||||
};
|
||||
Window_SavefileStatus.prototype.drawFileId = function (id, x, y) {
|
||||
this.drawText(TextManager.file + " " + id, x, y, 180);
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.drawPartyfaces = function (info, x, y) {
|
||||
if (info && info.faces) {
|
||||
for (var i = 0; i < info.faces.length; i++) {
|
||||
var data = info.faces[i];
|
||||
this.drawFace(data[0], data[1], x + i * 150, y);
|
||||
}
|
||||
}
|
||||
};
|
||||
Window_SavefileStatus.prototype.drawContents = function (info, rect, valid) {
|
||||
var bottom = rect.y + rect.height;
|
||||
var playtimeY = bottom - this.lineHeight();
|
||||
this.drawText(info.title, rect.x + 192, rect.y, rect.width - 192);
|
||||
if (valid) {
|
||||
this.drawPartyfaces(info, rect.x, bottom - 144);
|
||||
}
|
||||
this.drawText(info.playtime, rect.x, playtimeY, rect.width, "right");
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.drawPartyfaces = function (info, x, y) {
|
||||
if (info && info.faces) {
|
||||
for (var i = 0; i < info.faces.length; i++) {
|
||||
var data = info.faces[i];
|
||||
this.drawFace(data[0], data[1], x + i * 150, y);
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
//
|
||||
|
||||
var Imported = Imported || {};
|
||||
Imported['AnimationMapName'] = 1.04;
|
||||
Imported["AnimationMapName"] = 1.04;
|
||||
|
||||
/*:
|
||||
* @plugindesc ver1.04/マップ名表示をアニメーションさせます。
|
||||
|
|
@ -20,8 +20,8 @@ Imported['AnimationMapName'] = 1.04;
|
|||
* @param Pattern Variable ID
|
||||
* @desc パターンの変更に使う変数のIDです。
|
||||
* 0または、空欄で変数を使用しません。
|
||||
* @default
|
||||
*
|
||||
* @default
|
||||
*
|
||||
* @param Anime Font Size
|
||||
* @desc 表示マップ名のフォントサイズです。
|
||||
* @default 28
|
||||
|
|
@ -34,19 +34,19 @@ Imported['AnimationMapName'] = 1.04;
|
|||
* @param Anime Count
|
||||
* @desc マップ名の表示時間です。
|
||||
* @default 300
|
||||
*
|
||||
*
|
||||
* @param Anime OriginalX
|
||||
* @desc 移動前の座標Xです。
|
||||
* @default 0
|
||||
*
|
||||
*
|
||||
* @param Anime OriginalY
|
||||
* @desc 移動前の座標Yです。
|
||||
* @default -60
|
||||
*
|
||||
*
|
||||
* @param Anime MoveX
|
||||
* @desc X座標の移動距離です。
|
||||
* @default 0
|
||||
*
|
||||
*
|
||||
* @param Anime MoveY
|
||||
* @desc Y座標の移動距離です。
|
||||
* @default 60
|
||||
|
|
@ -112,18 +112,18 @@ Imported['AnimationMapName'] = 1.04;
|
|||
* マップのメモ欄に以下のように記述してください。
|
||||
*
|
||||
* <アニメーションマップネーム設定>
|
||||
*
|
||||
*
|
||||
* 設定項目
|
||||
*
|
||||
* </アニメーションマップネーム設定>
|
||||
*
|
||||
*
|
||||
* 設定項目は、プラグインコマンドの設定の変更の項目で記述されているものが
|
||||
* 使用可能です。
|
||||
*
|
||||
* ---各設定項目の優先度---
|
||||
* プラグインコマンドによる設定は、基本設定を書き換えると同時に、パターンが
|
||||
* 設定されている場合は、指定した変数の数値も書き換えます。
|
||||
*
|
||||
*
|
||||
* マップのメモによる設定は、基本的に優先されます。
|
||||
* プラグインコマンドで呼び出した場合も、マップに設定がある場合は、その設定を
|
||||
* ベースとして使用します。
|
||||
|
|
@ -183,379 +183,474 @@ Imported['AnimationMapName'] = 1.04;
|
|||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
(function () {
|
||||
var parameters = PluginManager.parameters('AnimationMapName');
|
||||
var patternVariableId = Number(parameters['Pattern Variable ID']) || 0;
|
||||
var animeFontSize = Number(parameters['Anime Font Size'] || 28);
|
||||
var animeCount = Number(parameters['Anime Count'] || 300);
|
||||
var animeOriginalX = Number(parameters['Anime OriginalX'] || 0);
|
||||
var animeOriginalY = Number(parameters['Anime OriginalY'] || 0);
|
||||
var animeMoveX = Number(parameters['Anime MoveX'] || 0);
|
||||
var animeMoveY = Number(parameters['Anime MoveY'] || 0);
|
||||
var animePattern = parameters['Anime Pattern'] || 'Normal';
|
||||
var fillRectColor = parameters['Fill Rect Color'] || 'rgba(0,0,0,0.5)';
|
||||
var backPicture = parameters['Back Picture'];
|
||||
var parameters = PluginManager.parameters("AnimationMapName");
|
||||
var patternVariableId = Number(parameters["Pattern Variable ID"]) || 0;
|
||||
var animeFontSize = Number(parameters["Anime Font Size"] || 28);
|
||||
var animeCount = Number(parameters["Anime Count"] || 300);
|
||||
var animeOriginalX = Number(parameters["Anime OriginalX"] || 0);
|
||||
var animeOriginalY = Number(parameters["Anime OriginalY"] || 0);
|
||||
var animeMoveX = Number(parameters["Anime MoveX"] || 0);
|
||||
var animeMoveY = Number(parameters["Anime MoveY"] || 0);
|
||||
var animePattern = parameters["Anime Pattern"] || "Normal";
|
||||
var fillRectColor = parameters["Fill Rect Color"] || "rgba(0,0,0,0.5)";
|
||||
var backPicture = parameters["Back Picture"];
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var __GInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
__GInterpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'AnimationMapName' || command === 'アニメーションマップネーム') {
|
||||
var code = args.shift();
|
||||
if (code === 'Setting' || code === '設定') this.setAmsSetting(args);
|
||||
if (code === 'Add' || code === '表示') this.showAmn(args);
|
||||
}
|
||||
};
|
||||
var __GInterpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
__GInterpreter_pluginCommand.call(this, command, args);
|
||||
if (
|
||||
command === "AnimationMapName" ||
|
||||
command === "アニメーションマップネーム"
|
||||
) {
|
||||
var code = args.shift();
|
||||
if (code === "Setting" || code === "設定") this.setAmsSetting(args);
|
||||
if (code === "Add" || code === "表示") this.showAmn(args);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.setAmsSetting = function (args) {
|
||||
var params = $gameSystem.amnParameters();
|
||||
var amnParams = DataManager.makeAmnParams(params, args);
|
||||
if (patternVariableId) {
|
||||
if (amnParams.pattern === 'Normal' || amnParams.pattern == 0) {
|
||||
$gameVariables._data[patternVariableId] = 0;
|
||||
} else if (amnParams.pattern === 'Stretch' || amnParams.pattern == -1) {
|
||||
$gameVariables._data[patternVariableId] = -1;
|
||||
} else if (amnParams.pattern === 'GrowUp' || amnParams.pattern == -2) {
|
||||
$gameVariables._data[patternVariableId] = -2;
|
||||
} else {
|
||||
$gameVariables._data[patternVariableId] = Number(amnParams.pattern);
|
||||
Game_Interpreter.prototype.setAmsSetting = function (args) {
|
||||
var params = $gameSystem.amnParameters();
|
||||
var amnParams = DataManager.makeAmnParams(params, args);
|
||||
if (patternVariableId) {
|
||||
if (amnParams.pattern === "Normal" || amnParams.pattern == 0) {
|
||||
$gameVariables._data[patternVariableId] = 0;
|
||||
} else if (amnParams.pattern === "Stretch" || amnParams.pattern == -1) {
|
||||
$gameVariables._data[patternVariableId] = -1;
|
||||
} else if (amnParams.pattern === "GrowUp" || amnParams.pattern == -2) {
|
||||
$gameVariables._data[patternVariableId] = -2;
|
||||
} else {
|
||||
$gameVariables._data[patternVariableId] = Number(amnParams.pattern);
|
||||
}
|
||||
}
|
||||
$gameSystem.setAmnParameters(amnParams);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DataManager.amnMapParams = function (map) {
|
||||
if (!map) return false;
|
||||
if (map.note === undefined) return false;
|
||||
if (map._amsParams) {
|
||||
return map._amsParams;
|
||||
}
|
||||
var texts = map.note.split("\n");
|
||||
var params = {};
|
||||
for (var i = 0, max = texts.length; i < max; i++) {
|
||||
if (
|
||||
/^<(?:AnimationMapNameSetting|アニメーションマップネーム設定)>/.exec(
|
||||
texts[i]
|
||||
)
|
||||
) {
|
||||
for (var j = i; j < max; j++) {
|
||||
if (
|
||||
/^<\/(?:AnimationMapNameSetting|アニメーションマップネーム設定)>/.exec(
|
||||
texts[j]
|
||||
)
|
||||
) {
|
||||
i = j;
|
||||
break;
|
||||
} else {
|
||||
if (/(.+?):(.+)?/.exec(texts[j])) {
|
||||
var code = RegExp.$1;
|
||||
var value = RegExp.$2;
|
||||
switch (code) {
|
||||
case "size":
|
||||
params.size = Number(value);
|
||||
break;
|
||||
case "count":
|
||||
params.count = Number(value);
|
||||
break;
|
||||
case "ox":
|
||||
params.ox = Number(value);
|
||||
break;
|
||||
case "oy":
|
||||
params.oy = Number(value);
|
||||
break;
|
||||
case "mx":
|
||||
params.mx = Number(value);
|
||||
break;
|
||||
case "my":
|
||||
params.my = Number(value);
|
||||
break;
|
||||
case "pattern":
|
||||
params.pattern = value;
|
||||
break;
|
||||
case "color":
|
||||
params.color = value;
|
||||
break;
|
||||
case "picture":
|
||||
params.picture = value;
|
||||
break;
|
||||
case "text":
|
||||
params.text = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$gameSystem.setAmnParameters(amnParams);
|
||||
}
|
||||
}
|
||||
map._amsParams = params;
|
||||
return map._amsParams;
|
||||
};
|
||||
|
||||
DataManager.makeAmnParams = function (params, args) {
|
||||
var amnParams = {
|
||||
size: params.size,
|
||||
count: params.count,
|
||||
ox: params.ox,
|
||||
oy: params.oy,
|
||||
mx: params.mx,
|
||||
my: params.my,
|
||||
pattern: params.pattern,
|
||||
color: params.color,
|
||||
picture: params.picture,
|
||||
text: params.text,
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DataManager.amnMapParams = function (map) {
|
||||
if (!map) return false;
|
||||
if (map.note === undefined) return false;
|
||||
if (map._amsParams) { return map._amsParams }
|
||||
var texts = map.note.split('\n');
|
||||
var params = {};
|
||||
for (var i = 0, max = texts.length; i < max; i++) {
|
||||
if (/^<(?:AnimationMapNameSetting|アニメーションマップネーム設定)>/.exec(texts[i])) {
|
||||
for (var j = i; j < max; j++) {
|
||||
if (/^<\/(?:AnimationMapNameSetting|アニメーションマップネーム設定)>/.exec(texts[j])) {
|
||||
i = j;
|
||||
break;
|
||||
} else {
|
||||
if (/(.+?):(.+)?/.exec(texts[j])) {
|
||||
var code = RegExp.$1;
|
||||
var value = RegExp.$2;
|
||||
switch (code) {
|
||||
case 'size': params.size = Number(value); break;
|
||||
case 'count': params.count = Number(value); break;
|
||||
case 'ox': params.ox = Number(value); break;
|
||||
case 'oy': params.oy = Number(value); break;
|
||||
case 'mx': params.mx = Number(value); break;
|
||||
case 'my': params.my = Number(value); break;
|
||||
case 'pattern': params.pattern = value; break;
|
||||
case 'color': params.color = value; break;
|
||||
case 'picture': params.picture = value; break;
|
||||
case 'text': params.text = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
args.forEach(
|
||||
function (a) {
|
||||
if (/(.+?):(.+)?/.exec(a)) {
|
||||
var code = RegExp.$1;
|
||||
var value = RegExp.$2;
|
||||
switch (code) {
|
||||
case "size":
|
||||
amnParams.size = Number(value);
|
||||
break;
|
||||
case "count":
|
||||
amnParams.count = Number(value);
|
||||
break;
|
||||
case "ox":
|
||||
amnParams.ox = Number(value);
|
||||
break;
|
||||
case "oy":
|
||||
amnParams.oy = Number(value);
|
||||
break;
|
||||
case "mx":
|
||||
amnParams.mx = Number(value);
|
||||
break;
|
||||
case "my":
|
||||
amnParams.my = Number(value);
|
||||
break;
|
||||
case "pattern":
|
||||
amnParams.pattern = value;
|
||||
break;
|
||||
case "color":
|
||||
amnParams.color = value;
|
||||
break;
|
||||
case "picture":
|
||||
amnParams.picture = value;
|
||||
break;
|
||||
case "text":
|
||||
amnParams.text = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
map._amsParams = params;
|
||||
return map._amsParams;
|
||||
}.bind(this)
|
||||
);
|
||||
return amnParams;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Game_System.prototype.amnParameters = function () {
|
||||
if (!this._amnParameters) this.initAmnParameters();
|
||||
if (patternVariableId) {
|
||||
this._amnParameters.pattern = $gameVariables.value(patternVariableId);
|
||||
}
|
||||
var params = DataManager.amnMapParams($dataMap);
|
||||
var amnParams = {
|
||||
size: this._amnParameters.size,
|
||||
count: this._amnParameters.count,
|
||||
ox: this._amnParameters.ox,
|
||||
oy: this._amnParameters.oy,
|
||||
mx: this._amnParameters.mx,
|
||||
my: this._amnParameters.my,
|
||||
pattern: this._amnParameters.pattern,
|
||||
color: this._amnParameters.color,
|
||||
picture: this._amnParameters.picture,
|
||||
};
|
||||
for (var key in params) {
|
||||
amnParams[key] = params[key];
|
||||
}
|
||||
return amnParams;
|
||||
};
|
||||
|
||||
DataManager.makeAmnParams = function (params, args) {
|
||||
var amnParams = {
|
||||
size: params.size, count: params.count,
|
||||
ox: params.ox, oy: params.oy, mx: params.mx, my: params.my,
|
||||
pattern: params.pattern, color: params.color, picture: params.picture,
|
||||
text: params.text
|
||||
};
|
||||
args.forEach(function (a) {
|
||||
if (/(.+?):(.+)?/.exec(a)) {
|
||||
var code = RegExp.$1;
|
||||
var value = RegExp.$2;
|
||||
switch (code) {
|
||||
case 'size': amnParams.size = Number(value); break;
|
||||
case 'count': amnParams.count = Number(value); break;
|
||||
case 'ox': amnParams.ox = Number(value); break;
|
||||
case 'oy': amnParams.oy = Number(value); break;
|
||||
case 'mx': amnParams.mx = Number(value); break;
|
||||
case 'my': amnParams.my = Number(value); break;
|
||||
case 'pattern': amnParams.pattern = value; break;
|
||||
case 'color': amnParams.color = value; break;
|
||||
case 'picture': amnParams.picture = value; break;
|
||||
case 'text': amnParams.text = value; break;
|
||||
}
|
||||
}
|
||||
}.bind(this));
|
||||
return amnParams;
|
||||
Game_System.prototype.initAmnParameters = function () {
|
||||
this._amnParameters = {
|
||||
size: animeFontSize,
|
||||
count: animeCount,
|
||||
ox: animeOriginalX,
|
||||
oy: animeOriginalY,
|
||||
mx: animeMoveX,
|
||||
my: animeMoveY,
|
||||
pattern: animePattern,
|
||||
color: fillRectColor,
|
||||
picture: backPicture,
|
||||
text: "",
|
||||
};
|
||||
if (patternVariableId) {
|
||||
var pattern = this._amnParameters.pattern;
|
||||
if (pattern === "Normal" || pattern === 0)
|
||||
$gameVariables._data[patternVariableId] = 0;
|
||||
if (pattern === "Stretch" || pattern === -1)
|
||||
$gameVariables._data[patternVariableId] = -1;
|
||||
if (pattern === "GrowUp" || pattern === -2)
|
||||
$gameVariables._data[patternVariableId] = -2;
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
Game_System.prototype.setAmnParameters = function (params) {
|
||||
this._amnParameters = params;
|
||||
};
|
||||
|
||||
Game_System.prototype.amnParameters = function () {
|
||||
if (!this._amnParameters) this.initAmnParameters();
|
||||
if (patternVariableId) {
|
||||
this._amnParameters.pattern = $gameVariables.value(patternVariableId);
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var __GInterpreter_update = Game_Interpreter.prototype.update;
|
||||
Game_Interpreter.prototype.update = function () {
|
||||
__GInterpreter_update.call(this);
|
||||
if (this._refreshAmn) {
|
||||
if (ImageManager.isReady()) {
|
||||
this.refreshMapName(this._amnParams);
|
||||
this._refreshAmn = false;
|
||||
this._amnParams = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.animationMapName = function (params) {
|
||||
if (params.picture) {
|
||||
ImageManager.loadPicture(params.picture);
|
||||
this._refreshAmn = true;
|
||||
this._amnParams = params;
|
||||
} else {
|
||||
this.refreshMapName(params);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.refreshMapName = function (params) {
|
||||
console.log(params);
|
||||
var text = (params.text ? params.text : $gameMap.displayName()) || "";
|
||||
var array = CommonPopupManager.window()
|
||||
.convertEscapeCharacters(text)
|
||||
.split("");
|
||||
var a2 = [];
|
||||
var flag = false;
|
||||
var cflag = false;
|
||||
var setIndex = -1;
|
||||
var count = 0;
|
||||
var s1 = "";
|
||||
var aX = 0;
|
||||
var aY = 0;
|
||||
if (params.pattern === "GrowUp" || params.pattern == -2) aY = 1.0;
|
||||
var pattern = params.pattern;
|
||||
var afs = params.size + 8;
|
||||
var supY = 0;
|
||||
if (params.pattern === "GrowUp" || params.pattern == -2) supY = afs;
|
||||
for (var i = 0, max = array.length; i < max; i++) {
|
||||
if (array[i] === "\x1b") {
|
||||
var cnt = a2.length;
|
||||
a2[cnt] = array[i];
|
||||
for (var j = i; j < max; j++) {
|
||||
if (array[j] === "]") {
|
||||
a2[cnt] += "]";
|
||||
//a2[i] = a2[i].replace(/\x1b/,'\\');
|
||||
if (a2[cnt].match(/\x1bI\[\d+\]/i)) count++;
|
||||
i = j;
|
||||
break;
|
||||
} else {
|
||||
a2[cnt] += array[j];
|
||||
}
|
||||
}
|
||||
var params = DataManager.amnMapParams($dataMap);
|
||||
var amnParams = {
|
||||
size: this._amnParameters.size, count: this._amnParameters.count,
|
||||
ox: this._amnParameters.ox, oy: this._amnParameters.oy,
|
||||
mx: this._amnParameters.mx, my: this._amnParameters.my,
|
||||
pattern: this._amnParameters.pattern, color: this._amnParameters.color,
|
||||
picture: this._amnParameters.picture
|
||||
};
|
||||
for (var key in params) { amnParams[key] = params[key] }
|
||||
return amnParams;
|
||||
};
|
||||
} else {
|
||||
a2.push(array[i]);
|
||||
s1 += array[i];
|
||||
}
|
||||
}
|
||||
|
||||
Game_System.prototype.initAmnParameters = function () {
|
||||
this._amnParameters = {
|
||||
size: animeFontSize, count: animeCount, ox: animeOriginalX,
|
||||
oy: animeOriginalY, mx: animeMoveX, my: animeMoveY,
|
||||
pattern: animePattern, color: fillRectColor, picture: backPicture,
|
||||
text: ''
|
||||
};
|
||||
if (patternVariableId) {
|
||||
var pattern = this._amnParameters.pattern;
|
||||
if (pattern === 'Normal' || pattern === 0) $gameVariables._data[patternVariableId] = 0;
|
||||
if (pattern === 'Stretch' || pattern === -1) $gameVariables._data[patternVariableId] = -1;
|
||||
if (pattern === 'GrowUp' || pattern === -2) $gameVariables._data[patternVariableId] = -2;
|
||||
}
|
||||
};
|
||||
CommonPopupManager.window().resetFontSettings();
|
||||
var fs = params.size;
|
||||
var fontStr = "\\FS[" + fs + "]";
|
||||
CommonPopupManager.window().drawTextEx(fontStr, 0, 0);
|
||||
var textSize = CommonPopupManager.window().textWidth(s1) + params.size;
|
||||
textSize += params.size * 1.14 * count;
|
||||
var bitmap = null;
|
||||
var bw = textSize;
|
||||
var bh = fs;
|
||||
if (params.picture) {
|
||||
bitmap = ImageManager.loadPicture(params.picture);
|
||||
var arg = CommonPopupManager.setPopup("");
|
||||
bw = bitmap.width;
|
||||
bh = bitmap.height;
|
||||
arg.x = params.ox; // + textSize / 2 - bitmap.width / 2;
|
||||
arg.y = params.oy + bitmap.height * aY;
|
||||
arg.moveX = params.mx;
|
||||
arg.moveY = params.my;
|
||||
arg.bitmap = bitmap;
|
||||
arg.count = params.count;
|
||||
arg.extend = [0, arg.count]; //[arg.count * 0.2, arg.count * 0.8];
|
||||
arg.fixed = false;
|
||||
arg.anchorX = aX;
|
||||
arg.anchorY = aY;
|
||||
arg.pattern = pattern;
|
||||
arg.tag = "AnimationMapName";
|
||||
supY += bitmap.height / 2 - afs / 2;
|
||||
} else {
|
||||
bitmap = new Bitmap(textSize, params.size + 8);
|
||||
|
||||
Game_System.prototype.setAmnParameters = function (params) {
|
||||
this._amnParameters = params;
|
||||
};
|
||||
var xx = 0;
|
||||
bitmap.gradientFillRect(
|
||||
xx,
|
||||
0,
|
||||
bitmap.width / 3,
|
||||
bitmap.height,
|
||||
"rgba(0,0,0,0)",
|
||||
params.color
|
||||
);
|
||||
xx += bitmap.width / 3;
|
||||
bitmap.fillRect(xx, 0, bitmap.width / 3, bitmap.height, params.color);
|
||||
xx += bitmap.width / 3;
|
||||
bitmap.gradientFillRect(
|
||||
xx,
|
||||
0,
|
||||
bitmap.width / 3,
|
||||
bitmap.height,
|
||||
params.color,
|
||||
"rgba(0,0,0,0)"
|
||||
);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
var arg = CommonPopupManager.setPopup("");
|
||||
arg.x = params.ox;
|
||||
arg.y = params.oy + supY;
|
||||
arg.moveX = params.mx;
|
||||
arg.moveY = params.my;
|
||||
arg.bitmap = bitmap;
|
||||
arg.count = params.count;
|
||||
arg.extend = [0, arg.count]; //[arg.count * 0.2, arg.count * 0.8];
|
||||
arg.fixed = false;
|
||||
arg.anchorX = aX;
|
||||
arg.anchorY = aY;
|
||||
arg.pattern = pattern;
|
||||
arg.tag = "AnimationMapName";
|
||||
}
|
||||
if (arg) CommonPopupManager._tempCommonSprites.setNullPos(arg);
|
||||
|
||||
var __GInterpreter_update = Game_Interpreter.prototype.update;
|
||||
Game_Interpreter.prototype.update = function () {
|
||||
__GInterpreter_update.call(this);
|
||||
if (this._refreshAmn) {
|
||||
if (ImageManager.isReady()) {
|
||||
this.refreshMapName(this._amnParams);
|
||||
this._refreshAmn = false;
|
||||
this._amnParams = null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.animationMapName = function (params) {
|
||||
if (params.picture) {
|
||||
ImageManager.loadPicture(params.picture);
|
||||
this._refreshAmn = true;
|
||||
this._amnParams = params;
|
||||
} else {
|
||||
this.refreshMapName(params);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.refreshMapName = function (params) {
|
||||
console.log(params)
|
||||
var text = (params.text ? params.text : $gameMap.displayName()) || '';
|
||||
var array = CommonPopupManager.window().convertEscapeCharacters(text).split("");
|
||||
var a2 = [];
|
||||
var flag = false;
|
||||
var cflag = false;
|
||||
var setIndex = -1;
|
||||
var count = 0;
|
||||
var s1 = '';
|
||||
var aX = 0;
|
||||
var aY = 0;
|
||||
if (params.pattern === 'GrowUp' || params.pattern == -2) aY = 1.0;
|
||||
var pattern = params.pattern;
|
||||
var afs = params.size + 8;
|
||||
var supY = 0;
|
||||
if (params.pattern === 'GrowUp' || params.pattern == -2) supY = afs;
|
||||
for (var i = 0, max = array.length; i < max; i++) {
|
||||
if (array[i] === '\x1b') {
|
||||
var cnt = a2.length;
|
||||
a2[cnt] = array[i];
|
||||
for (var j = i; j < max; j++) {
|
||||
if (array[j] === ']') {
|
||||
a2[cnt] += ']';
|
||||
//a2[i] = a2[i].replace(/\x1b/,'\\');
|
||||
if (a2[cnt].match(/\x1bI\[\d+\]/i)) count++;
|
||||
i = j;
|
||||
break;
|
||||
} else {
|
||||
a2[cnt] += array[j];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
a2.push(array[i]);
|
||||
s1 += array[i];
|
||||
}
|
||||
}
|
||||
|
||||
CommonPopupManager.window().resetFontSettings();
|
||||
var fs = params.size;
|
||||
var fontStr = '\\FS[' + fs + ']';
|
||||
CommonPopupManager.window().drawTextEx(fontStr, 0, 0);
|
||||
var textSize = CommonPopupManager.window().textWidth(s1) + params.size;
|
||||
textSize += (params.size * 1.14) * count;
|
||||
var bitmap = null;
|
||||
var bw = textSize;
|
||||
var bh = fs;
|
||||
if (params.picture) {
|
||||
bitmap = ImageManager.loadPicture(params.picture);
|
||||
var arg = CommonPopupManager.setPopup('');
|
||||
bw = bitmap.width;
|
||||
bh = bitmap.height;
|
||||
arg.x = params.ox// + textSize / 2 - bitmap.width / 2;
|
||||
arg.y = params.oy + bitmap.height * aY;
|
||||
arg.moveX = params.mx;
|
||||
arg.moveY = params.my;
|
||||
arg.bitmap = bitmap;
|
||||
arg.count = params.count;
|
||||
arg.extend = [0, arg.count]//[arg.count * 0.2, arg.count * 0.8];
|
||||
arg.fixed = false;
|
||||
arg.anchorX = aX;
|
||||
arg.anchorY = aY;
|
||||
arg.pattern = pattern;
|
||||
arg.tag = 'AnimationMapName';
|
||||
supY += bitmap.height / 2 - afs / 2;
|
||||
} else {
|
||||
bitmap = new Bitmap(textSize, params.size + 8);
|
||||
|
||||
var xx = 0;
|
||||
bitmap.gradientFillRect(xx, 0, bitmap.width / 3, bitmap.height, 'rgba(0,0,0,0)', params.color);
|
||||
xx += bitmap.width / 3;
|
||||
bitmap.fillRect(xx, 0, bitmap.width / 3, bitmap.height, params.color);
|
||||
xx += bitmap.width / 3;
|
||||
bitmap.gradientFillRect(xx, 0, bitmap.width / 3, bitmap.height, params.color, 'rgba(0,0,0,0)');
|
||||
|
||||
var arg = CommonPopupManager.setPopup('');
|
||||
arg.x = params.ox;
|
||||
arg.y = params.oy + supY;
|
||||
arg.moveX = params.mx;
|
||||
arg.moveY = params.my;
|
||||
arg.bitmap = bitmap;
|
||||
arg.count = params.count;
|
||||
arg.extend = [0, arg.count]//[arg.count * 0.2, arg.count * 0.8];
|
||||
arg.fixed = false;
|
||||
arg.anchorX = aX;
|
||||
arg.anchorY = aY;
|
||||
arg.pattern = pattern;
|
||||
arg.tag = 'AnimationMapName';
|
||||
}
|
||||
if (arg) CommonPopupManager._tempCommonSprites.setNullPos(arg);
|
||||
|
||||
var s = Math.floor((params.count * 0.4) / s1.length);
|
||||
var n = 0;
|
||||
var setColor = '';
|
||||
var ssupY = (pattern == -2 || pattern === 'GrowUp') ? 4 : 0;
|
||||
var bfs = fs;
|
||||
var cnt = 0;
|
||||
var s = Math.floor((params.count * 0.4) / s1.length);
|
||||
var n = 0;
|
||||
var setColor = "";
|
||||
var ssupY = pattern == -2 || pattern === "GrowUp" ? 4 : 0;
|
||||
var bfs = fs;
|
||||
var cnt = 0;
|
||||
CommonPopupManager.window().contents.fontSize = fs;
|
||||
for (var i = 0; i < a2.length; i++) {
|
||||
if (a2[i].match(/\x1bI\[(\d+)\]/i)) a2[i] = "\\I[" + RegExp.$1 + "]";
|
||||
if (a2[i].match(/\x1bC\[(\d+)\]/i)) {
|
||||
setColor = "\\C[" + RegExp.$1 + "]";
|
||||
} else if (a2[i].match(/\x1bFS\[(\d+)\]/i)) {
|
||||
fs = Number(RegExp.$1);
|
||||
fontStr = "\\FS[" + fs + "]";
|
||||
} else {
|
||||
var fsy = (bfs - fs) / 2;
|
||||
if (fsy > 0 && ssupY > 0) fsy -= 8;
|
||||
var arg = CommonPopupManager.setPopup("");
|
||||
var bitmap = new Bitmap(fs + 12, fs + 12);
|
||||
var tx = fontStr + setColor + a2[i];
|
||||
CommonPopupManager.window().contents.fontSize = fs;
|
||||
for (var i = 0; i < a2.length; i++) {
|
||||
if (a2[i].match(/\x1bI\[(\d+)\]/i)) a2[i] = '\\I[' + RegExp.$1 + ']';
|
||||
if (a2[i].match(/\x1bC\[(\d+)\]/i)) {
|
||||
setColor = '\\C[' + RegExp.$1 + ']';
|
||||
} else if (a2[i].match(/\x1bFS\[(\d+)\]/i)) {
|
||||
fs = Number(RegExp.$1);
|
||||
fontStr = '\\FS[' + fs + ']';
|
||||
} else {
|
||||
var fsy = (bfs - fs) / 2;
|
||||
if (fsy > 0 && ssupY > 0) fsy -= 8;
|
||||
var arg = CommonPopupManager.setPopup('');
|
||||
var bitmap = new Bitmap(fs + 12, fs + 12);
|
||||
var tx = fontStr + setColor + a2[i];
|
||||
CommonPopupManager.window().contents.fontSize = fs;
|
||||
var tw = CommonPopupManager.window().textWidth(a2[i]);
|
||||
CommonPopupManager.window().contents = bitmap;
|
||||
CommonPopupManager.window().drawTextEx(tx, 4, 0);
|
||||
arg.bitmap = bitmap;
|
||||
arg.x = params.ox + n + (bw - textSize) / 2 + 10;
|
||||
arg.y = params.oy + supY + ssupY + fsy;
|
||||
arg.moveX = params.mx;
|
||||
arg.moveY = params.my;
|
||||
arg.anchorX = aX;
|
||||
arg.anchorY = aY;
|
||||
arg.delay = s * (cnt + 1);
|
||||
arg.count = Math.floor((params.count - 20) - (cnt * s));
|
||||
arg.extend = [0, arg.count]//[arg.count*0.2,arg.count*0.8];
|
||||
arg.fixed = false;
|
||||
arg.pattern = pattern;
|
||||
arg.tag = 'AnimationMapName';
|
||||
if (a2[i].match(/\\I\[\d+\]/i)) {
|
||||
n += 34;
|
||||
} else {
|
||||
n += tw;
|
||||
}
|
||||
CommonPopupManager._tempCommonSprites.setNullPos(arg);
|
||||
cnt++;
|
||||
}
|
||||
var tw = CommonPopupManager.window().textWidth(a2[i]);
|
||||
CommonPopupManager.window().contents = bitmap;
|
||||
CommonPopupManager.window().drawTextEx(tx, 4, 0);
|
||||
arg.bitmap = bitmap;
|
||||
arg.x = params.ox + n + (bw - textSize) / 2 + 10;
|
||||
arg.y = params.oy + supY + ssupY + fsy;
|
||||
arg.moveX = params.mx;
|
||||
arg.moveY = params.my;
|
||||
arg.anchorX = aX;
|
||||
arg.anchorY = aY;
|
||||
arg.delay = s * (cnt + 1);
|
||||
arg.count = Math.floor(params.count - 20 - cnt * s);
|
||||
arg.extend = [0, arg.count]; //[arg.count*0.2,arg.count*0.8];
|
||||
arg.fixed = false;
|
||||
arg.pattern = pattern;
|
||||
arg.tag = "AnimationMapName";
|
||||
if (a2[i].match(/\\I\[\d+\]/i)) {
|
||||
n += 34;
|
||||
} else {
|
||||
n += tw;
|
||||
}
|
||||
};
|
||||
CommonPopupManager._tempCommonSprites.setNullPos(arg);
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.showAmn = function (args) {
|
||||
CommonPopupManager.clearPopup('AnimationMapName');
|
||||
var amnParams = DataManager.makeAmnParams($gameSystem.amnParameters(), args);
|
||||
this.animationMapName(amnParams);
|
||||
};
|
||||
Game_Interpreter.prototype.showAmn = function (args) {
|
||||
CommonPopupManager.clearPopup("AnimationMapName");
|
||||
var amnParams = DataManager.makeAmnParams(
|
||||
$gameSystem.amnParameters(),
|
||||
args
|
||||
);
|
||||
this.animationMapName(amnParams);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Game_Map.prototype.showMapName = function () {
|
||||
if (this.displayName() !== '') {
|
||||
this._interpreter.animationMapName($gameSystem.amnParameters());
|
||||
}
|
||||
};
|
||||
Game_Map.prototype.showMapName = function () {
|
||||
if (this.displayName() !== "") {
|
||||
this._interpreter.animationMapName($gameSystem.amnParameters());
|
||||
}
|
||||
};
|
||||
|
||||
Game_Map.prototype.displayRegionAmn = function (params) {
|
||||
if (!this.isNameDisplayEnabled()) return;
|
||||
var args = params.split(' ');
|
||||
args[0] = 'text:' + args[0];
|
||||
this._interpreter.showAmn(args);
|
||||
};
|
||||
Game_Map.prototype.displayRegionAmn = function (params) {
|
||||
if (!this.isNameDisplayEnabled()) return;
|
||||
var args = params.split(" ");
|
||||
args[0] = "text:" + args[0];
|
||||
this._interpreter.showAmn(args);
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
var _animeMN_GPlayer_performTransfer = Game_Player.prototype.performTransfer;
|
||||
Game_Player.prototype.performTransfer = function () {
|
||||
_animeMN_GPlayer_performTransfer.call(this);
|
||||
if ($gameMap.isNameDisplayEnabled()) $gameMap.showMapName();
|
||||
$gameTemp._regionAmnArray = null;
|
||||
$gameTemp._lastRegionId = null;
|
||||
};
|
||||
var _animeMN_GPlayer_performTransfer = Game_Player.prototype.performTransfer;
|
||||
Game_Player.prototype.performTransfer = function () {
|
||||
_animeMN_GPlayer_performTransfer.call(this);
|
||||
if ($gameMap.isNameDisplayEnabled()) $gameMap.showMapName();
|
||||
$gameTemp._regionAmnArray = null;
|
||||
$gameTemp._lastRegionId = null;
|
||||
};
|
||||
|
||||
var __GPlayer_update = Game_Player.prototype.update;
|
||||
Game_Player.prototype.update = function (sceneActive) {
|
||||
__GPlayer_update.call(this, sceneActive);
|
||||
var ri = this.regionId();
|
||||
if (this.regionAmnArray(ri) && ri !== $gameTemp._lastRegionId) {
|
||||
$gameTemp._lastRegionId = ri;
|
||||
if ($dataMap.meta['RegionName' + ri]) {
|
||||
$gameMap.displayRegionAmn($dataMap.meta['RegionName' + ri]);
|
||||
} else if ($dataMap.meta['リージョンネーム' + ri]) {
|
||||
$gameMap.displayRegionAmn($dataMap.meta['リージョンネーム' + ri]);
|
||||
}
|
||||
}
|
||||
};
|
||||
var __GPlayer_update = Game_Player.prototype.update;
|
||||
Game_Player.prototype.update = function (sceneActive) {
|
||||
__GPlayer_update.call(this, sceneActive);
|
||||
var ri = this.regionId();
|
||||
if (this.regionAmnArray(ri) && ri !== $gameTemp._lastRegionId) {
|
||||
$gameTemp._lastRegionId = ri;
|
||||
if ($dataMap.meta["RegionName" + ri]) {
|
||||
$gameMap.displayRegionAmn($dataMap.meta["RegionName" + ri]);
|
||||
} else if ($dataMap.meta["リージョンネーム" + ri]) {
|
||||
$gameMap.displayRegionAmn($dataMap.meta["リージョンネーム" + ri]);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Game_Player.prototype.regionAmnArray = function (ri) {
|
||||
if ($gameTemp._regionAmnArray) return $gameTemp._regionAmnArray[ri];
|
||||
$gameTemp._regionAmnArray = [];
|
||||
for (var i = 1, max = 255; i < max; i++) {
|
||||
if (!$dataMap.meta) break;
|
||||
if ($dataMap.meta['RegionName' + i]) $gameTemp._regionAmnArray[i] = true;
|
||||
if ($dataMap.meta['リージョンネーム' + i]) $gameTemp._regionAmnArray[i] = true;
|
||||
}
|
||||
return $gameTemp._regionAmnArray[ri];
|
||||
};
|
||||
Game_Player.prototype.regionAmnArray = function (ri) {
|
||||
if ($gameTemp._regionAmnArray) return $gameTemp._regionAmnArray[ri];
|
||||
$gameTemp._regionAmnArray = [];
|
||||
for (var i = 1, max = 255; i < max; i++) {
|
||||
if (!$dataMap.meta) break;
|
||||
if ($dataMap.meta["RegionName" + i]) $gameTemp._regionAmnArray[i] = true;
|
||||
if ($dataMap.meta["リージョンネーム" + i])
|
||||
$gameTemp._regionAmnArray[i] = true;
|
||||
}
|
||||
return $gameTemp._regionAmnArray[ri];
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// 再定義 何もしなくする
|
||||
Window_MapName.prototype.open = function () {
|
||||
//this.refresh();
|
||||
this._showCount = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// 再定義 何もしなくする
|
||||
Window_MapName.prototype.open = function () {
|
||||
//this.refresh();
|
||||
this._showCount = 0;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -148,303 +148,322 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
var localExtraStageIndex = -1;
|
||||
var localExtraStageIndex = -1;
|
||||
|
||||
var createPluginParameter = function (pluginName) {
|
||||
var paramReplacer = function (key, value) {
|
||||
if (value === 'null') {
|
||||
return value;
|
||||
}
|
||||
if (value[0] === '"' && value[value.length - 1] === '"') {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
var parameter = JSON.parse(JSON.stringify(PluginManager.parameters(pluginName), paramReplacer));
|
||||
PluginManager.setParameters(pluginName, parameter);
|
||||
return parameter;
|
||||
var createPluginParameter = function (pluginName) {
|
||||
var paramReplacer = function (key, value) {
|
||||
if (value === "null") {
|
||||
return value;
|
||||
}
|
||||
if (value[0] === '"' && value[value.length - 1] === '"') {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
var parameters = createPluginParameter('AnotherNewGame');
|
||||
parameters.anotherDataList = parameters.anotherDataList || [];
|
||||
var parameter = JSON.parse(
|
||||
JSON.stringify(PluginManager.parameters(pluginName), paramReplacer)
|
||||
);
|
||||
PluginManager.setParameters(pluginName, parameter);
|
||||
return parameter;
|
||||
};
|
||||
var parameters = createPluginParameter("AnotherNewGame");
|
||||
parameters.anotherDataList = parameters.anotherDataList || [];
|
||||
|
||||
/**
|
||||
* Convert escape characters.(require any window object)
|
||||
* @param text Target text
|
||||
* @returns {String} Converted text
|
||||
*/
|
||||
var convertEscapeCharacters = function (text) {
|
||||
var windowLayer = SceneManager._scene._windowLayer;
|
||||
return windowLayer ? windowLayer.children[0].convertEscapeCharacters(text.toString()) : text;
|
||||
};
|
||||
/**
|
||||
* Convert escape characters.(require any window object)
|
||||
* @param text Target text
|
||||
* @returns {String} Converted text
|
||||
*/
|
||||
var convertEscapeCharacters = function (text) {
|
||||
var windowLayer = SceneManager._scene._windowLayer;
|
||||
return windowLayer
|
||||
? windowLayer.children[0].convertEscapeCharacters(text.toString())
|
||||
: text;
|
||||
};
|
||||
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
var index = args[0] ? parseInt(convertEscapeCharacters(args[0])) - 1 : 0;
|
||||
switch (command.toUpperCase()) {
|
||||
case 'ANG_VISIBLE':
|
||||
ANGSettingManager.setVisible(index, true);
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case 'ANG_ENABLE':
|
||||
ANGSettingManager.setEnable(index, true);
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case 'ANG_HIDDEN':
|
||||
ANGSettingManager.setVisible(index, false);
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case 'ANG_DISABLE':
|
||||
ANGSettingManager.setEnable(index, false);
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case 'ANG_NEWGAME_HIDDEN':
|
||||
ANGSettingManager.newGameHidden = true;
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case 'ANG_NEWGAME_VISIBLE':
|
||||
ANGSettingManager.newGameHidden = false;
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Map
|
||||
// アナザーニューゲームのロード時に実行していたイベントを中断します。
|
||||
//=============================================================================
|
||||
Game_Map.prototype.abortInterpreter = function () {
|
||||
if (this.isEventRunning()) {
|
||||
this._interpreter.command115();
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Title
|
||||
// アナザーニューゲームの選択時の処理を追加定義します。
|
||||
//=============================================================================
|
||||
var _Scene_Title_create = Scene_Title.prototype.create;
|
||||
Scene_Title.prototype.create = function () {
|
||||
ANGSettingManager.loadData();
|
||||
_Scene_Title_create.call(this);
|
||||
};
|
||||
|
||||
var _Scene_Title_commandContinue = Scene_Title.prototype.commandContinue;
|
||||
Scene_Title.prototype.commandContinue = function () {
|
||||
_Scene_Title_commandContinue.call(this);
|
||||
localExtraStageIndex = -1;
|
||||
};
|
||||
|
||||
var _Scene_Title_commandNewGameSecond = Scene_Title.prototype.commandNewGameSecond;
|
||||
Scene_Title.prototype.commandNewGameSecond = function (index) {
|
||||
if (_Scene_Title_commandNewGameSecond) {
|
||||
_Scene_Title_commandNewGameSecond.apply(this, arguments);
|
||||
}
|
||||
var command = parameters.anotherDataList[index];
|
||||
if (command.noFadeout) {
|
||||
this._noFadeout = true;
|
||||
}
|
||||
if (!command.fileLoad) {
|
||||
var preMapId = $dataSystem.startMapId;
|
||||
var preStartX = $dataSystem.startX;
|
||||
var preStartY = $dataSystem.startY;
|
||||
var newMapId = command.mapId;
|
||||
if (newMapId > 0) {
|
||||
$dataSystem.startMapId = newMapId;
|
||||
$dataSystem.startX = command.mapX || 1;
|
||||
$dataSystem.startY = command.mapY || 1;
|
||||
}
|
||||
this.commandNewGame();
|
||||
$dataSystem.startMapId = preMapId;
|
||||
$dataSystem.startX = preStartX;
|
||||
$dataSystem.startY = preStartY;
|
||||
var switchId = command.switchId;
|
||||
if (switchId > 0) {
|
||||
$gameSwitches.setValue(switchId, true);
|
||||
}
|
||||
} else {
|
||||
this.commandContinue();
|
||||
localExtraStageIndex = index;
|
||||
}
|
||||
};
|
||||
|
||||
var _Scene_Title_createCommandWindow = Scene_Title.prototype.createCommandWindow;
|
||||
Scene_Title.prototype.createCommandWindow = function () {
|
||||
_Scene_Title_createCommandWindow.call(this);
|
||||
parameters.anotherDataList.forEach(function (command, index) {
|
||||
if (ANGSettingManager.isVisible(index)) {
|
||||
this._commandWindow.setHandler('nameGame2_' + index, this.commandNewGameSecond.bind(this, index));
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
|
||||
Scene_Title.prototype.fadeOutAll = function () {
|
||||
if (!this._noFadeout) {
|
||||
Scene_Base.prototype.fadeOutAll.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Load
|
||||
// ロード成功時にアナザーポイントに移動します。
|
||||
//=============================================================================
|
||||
var _Scene_Load_onLoadSuccess = Scene_Load.prototype.onLoadSuccess;
|
||||
Scene_Load.prototype.onLoadSuccess = function () {
|
||||
_Scene_Load_onLoadSuccess.call(this);
|
||||
if (localExtraStageIndex >= 0) {
|
||||
var command = parameters.anotherDataList[localExtraStageIndex];
|
||||
var mapId = command.mapId;
|
||||
if (mapId > 0) {
|
||||
var x = command.mapX || 1;
|
||||
var y = command.mapY || 1;
|
||||
$gamePlayer.reserveTransfer(mapId, x, y);
|
||||
}
|
||||
$gameMap.abortInterpreter();
|
||||
DataManager.selectSavefileForNewGame();
|
||||
var switchId = command.switchId;
|
||||
if (switchId > 0) {
|
||||
$gameSwitches.setValue(switchId, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_TitleCommand
|
||||
// アナザーニューゲームの選択肢を追加定義します。
|
||||
//=============================================================================
|
||||
var _Window_TitleCommand_makeCommandList = Window_TitleCommand.prototype.makeCommandList;
|
||||
Window_TitleCommand.prototype.makeCommandList = function () {
|
||||
_Window_TitleCommand_makeCommandList.call(this);
|
||||
parameters.anotherDataList.forEach(function (command, index) {
|
||||
if (ANGSettingManager.isVisible(index)) {
|
||||
this.makeAnotherNewGameCommand(command, index);
|
||||
}
|
||||
}, this);
|
||||
if (ANGSettingManager.newGameHidden) {
|
||||
this.eraseCommandNewGame();
|
||||
}
|
||||
};
|
||||
|
||||
Window_TitleCommand.prototype.makeAnotherNewGameCommand = function (command, index) {
|
||||
this.addCommand(command.name, 'nameGame2_' + index, ANGSettingManager.isEnable(index));
|
||||
var addPosition = command.addPosition;
|
||||
if (addPosition > 0) {
|
||||
var anotherCommand = this._list.pop();
|
||||
this._list.splice(addPosition - 1, 0, anotherCommand);
|
||||
}
|
||||
};
|
||||
|
||||
Window_TitleCommand.prototype.eraseCommandNewGame = function () {
|
||||
this._list = this._list.filter(function (command) {
|
||||
return command.symbol !== 'newGame';
|
||||
});
|
||||
};
|
||||
|
||||
var _Window_TitleCommand_updatePlacement = Window_TitleCommand.prototype.updatePlacement;
|
||||
Window_TitleCommand.prototype.updatePlacement = function () {
|
||||
_Window_TitleCommand_updatePlacement.call(this);
|
||||
var addSize = this._list.length - 3;
|
||||
if (addSize > 0) {
|
||||
this.y += addSize * this.itemHeight() / 2;
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// ANGManager
|
||||
// アナザーニューゲームの設定ファイルのセーブとロードを定義します。
|
||||
//=============================================================================
|
||||
function ANGSettingManager() {
|
||||
throw new Error('This is a static class');
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
var index = args[0] ? parseInt(convertEscapeCharacters(args[0])) - 1 : 0;
|
||||
switch (command.toUpperCase()) {
|
||||
case "ANG_VISIBLE":
|
||||
ANGSettingManager.setVisible(index, true);
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case "ANG_ENABLE":
|
||||
ANGSettingManager.setEnable(index, true);
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case "ANG_HIDDEN":
|
||||
ANGSettingManager.setVisible(index, false);
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case "ANG_DISABLE":
|
||||
ANGSettingManager.setEnable(index, false);
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case "ANG_NEWGAME_HIDDEN":
|
||||
ANGSettingManager.newGameHidden = true;
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
case "ANG_NEWGAME_VISIBLE":
|
||||
ANGSettingManager.newGameHidden = false;
|
||||
ANGSettingManager.save();
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager._fileId = -1001;
|
||||
//=============================================================================
|
||||
// Game_Map
|
||||
// アナザーニューゲームのロード時に実行していたイベントを中断します。
|
||||
//=============================================================================
|
||||
Game_Map.prototype.abortInterpreter = function () {
|
||||
if (this.isEventRunning()) {
|
||||
this._interpreter.command115();
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager._visible = [];
|
||||
ANGSettingManager._enable = [];
|
||||
ANGSettingManager.newGameHidden = false;
|
||||
//=============================================================================
|
||||
// Scene_Title
|
||||
// アナザーニューゲームの選択時の処理を追加定義します。
|
||||
//=============================================================================
|
||||
var _Scene_Title_create = Scene_Title.prototype.create;
|
||||
Scene_Title.prototype.create = function () {
|
||||
ANGSettingManager.loadData();
|
||||
_Scene_Title_create.call(this);
|
||||
};
|
||||
|
||||
ANGSettingManager.make = function () {
|
||||
var info = {};
|
||||
info.visible = this._visible;
|
||||
info.enable = this._enable;
|
||||
info.newGameHidden = this.newGameHidden;
|
||||
return info;
|
||||
};
|
||||
var _Scene_Title_commandContinue = Scene_Title.prototype.commandContinue;
|
||||
Scene_Title.prototype.commandContinue = function () {
|
||||
_Scene_Title_commandContinue.call(this);
|
||||
localExtraStageIndex = -1;
|
||||
};
|
||||
|
||||
ANGSettingManager.isVisible = function (index) {
|
||||
if (this._visible[index] !== undefined) {
|
||||
return this._visible[index];
|
||||
} else {
|
||||
return !parameters.anotherDataList[index].hidden;
|
||||
}
|
||||
};
|
||||
var _Scene_Title_commandNewGameSecond =
|
||||
Scene_Title.prototype.commandNewGameSecond;
|
||||
Scene_Title.prototype.commandNewGameSecond = function (index) {
|
||||
if (_Scene_Title_commandNewGameSecond) {
|
||||
_Scene_Title_commandNewGameSecond.apply(this, arguments);
|
||||
}
|
||||
var command = parameters.anotherDataList[index];
|
||||
if (command.noFadeout) {
|
||||
this._noFadeout = true;
|
||||
}
|
||||
if (!command.fileLoad) {
|
||||
var preMapId = $dataSystem.startMapId;
|
||||
var preStartX = $dataSystem.startX;
|
||||
var preStartY = $dataSystem.startY;
|
||||
var newMapId = command.mapId;
|
||||
if (newMapId > 0) {
|
||||
$dataSystem.startMapId = newMapId;
|
||||
$dataSystem.startX = command.mapX || 1;
|
||||
$dataSystem.startY = command.mapY || 1;
|
||||
}
|
||||
this.commandNewGame();
|
||||
$dataSystem.startMapId = preMapId;
|
||||
$dataSystem.startX = preStartX;
|
||||
$dataSystem.startY = preStartY;
|
||||
var switchId = command.switchId;
|
||||
if (switchId > 0) {
|
||||
$gameSwitches.setValue(switchId, true);
|
||||
}
|
||||
} else {
|
||||
this.commandContinue();
|
||||
localExtraStageIndex = index;
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager.setVisible = function (index, value) {
|
||||
this._visible[index] = value;
|
||||
};
|
||||
var _Scene_Title_createCommandWindow =
|
||||
Scene_Title.prototype.createCommandWindow;
|
||||
Scene_Title.prototype.createCommandWindow = function () {
|
||||
_Scene_Title_createCommandWindow.call(this);
|
||||
parameters.anotherDataList.forEach(function (command, index) {
|
||||
if (ANGSettingManager.isVisible(index)) {
|
||||
this._commandWindow.setHandler(
|
||||
"nameGame2_" + index,
|
||||
this.commandNewGameSecond.bind(this, index)
|
||||
);
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
|
||||
ANGSettingManager.isEnable = function (index) {
|
||||
if (this._enable[index] !== undefined) {
|
||||
return this._enable[index];
|
||||
} else {
|
||||
return !parameters.anotherDataList[index].disable;
|
||||
}
|
||||
};
|
||||
Scene_Title.prototype.fadeOutAll = function () {
|
||||
if (!this._noFadeout) {
|
||||
Scene_Base.prototype.fadeOutAll.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager.setEnable = function (index, value) {
|
||||
this._enable[index] = value;
|
||||
};
|
||||
//=============================================================================
|
||||
// Scene_Load
|
||||
// ロード成功時にアナザーポイントに移動します。
|
||||
//=============================================================================
|
||||
var _Scene_Load_onLoadSuccess = Scene_Load.prototype.onLoadSuccess;
|
||||
Scene_Load.prototype.onLoadSuccess = function () {
|
||||
_Scene_Load_onLoadSuccess.call(this);
|
||||
if (localExtraStageIndex >= 0) {
|
||||
var command = parameters.anotherDataList[localExtraStageIndex];
|
||||
var mapId = command.mapId;
|
||||
if (mapId > 0) {
|
||||
var x = command.mapX || 1;
|
||||
var y = command.mapY || 1;
|
||||
$gamePlayer.reserveTransfer(mapId, x, y);
|
||||
}
|
||||
$gameMap.abortInterpreter();
|
||||
DataManager.selectSavefileForNewGame();
|
||||
var switchId = command.switchId;
|
||||
if (switchId > 0) {
|
||||
$gameSwitches.setValue(switchId, true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager.loadData = function () {
|
||||
var info = this.load();
|
||||
this._visible = info.visible || [];
|
||||
this._enable = info.enable || [];
|
||||
this.newGameHidden = !!info.newGameHidden;
|
||||
};
|
||||
//=============================================================================
|
||||
// Window_TitleCommand
|
||||
// アナザーニューゲームの選択肢を追加定義します。
|
||||
//=============================================================================
|
||||
var _Window_TitleCommand_makeCommandList =
|
||||
Window_TitleCommand.prototype.makeCommandList;
|
||||
Window_TitleCommand.prototype.makeCommandList = function () {
|
||||
_Window_TitleCommand_makeCommandList.call(this);
|
||||
parameters.anotherDataList.forEach(function (command, index) {
|
||||
if (ANGSettingManager.isVisible(index)) {
|
||||
this.makeAnotherNewGameCommand(command, index);
|
||||
}
|
||||
}, this);
|
||||
if (ANGSettingManager.newGameHidden) {
|
||||
this.eraseCommandNewGame();
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager.load = function () {
|
||||
var json;
|
||||
try {
|
||||
json = StorageManager.load(this._fileId);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
if (json) {
|
||||
return JSON.parse(json);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
Window_TitleCommand.prototype.makeAnotherNewGameCommand = function (
|
||||
command,
|
||||
index
|
||||
) {
|
||||
this.addCommand(
|
||||
command.name,
|
||||
"nameGame2_" + index,
|
||||
ANGSettingManager.isEnable(index)
|
||||
);
|
||||
var addPosition = command.addPosition;
|
||||
if (addPosition > 0) {
|
||||
var anotherCommand = this._list.pop();
|
||||
this._list.splice(addPosition - 1, 0, anotherCommand);
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager.save = function () {
|
||||
var info = ANGSettingManager.make();
|
||||
StorageManager.save(this._fileId, JSON.stringify(info));
|
||||
};
|
||||
Window_TitleCommand.prototype.eraseCommandNewGame = function () {
|
||||
this._list = this._list.filter(function (command) {
|
||||
return command.symbol !== "newGame";
|
||||
});
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// StorageManager
|
||||
// アナザーニューゲームの設定ファイルのパス取得処理を追加定義します。
|
||||
//=============================================================================
|
||||
var _StorageManager_localFilePath = StorageManager.localFilePath;
|
||||
StorageManager.localFilePath = function (savefileId) {
|
||||
if (savefileId === ANGSettingManager._fileId) {
|
||||
return this.localFileDirectoryPath() + 'AnotherNewGameMk2.rpgsave';
|
||||
} else {
|
||||
return _StorageManager_localFilePath.call(this, savefileId);
|
||||
}
|
||||
};
|
||||
var _Window_TitleCommand_updatePlacement =
|
||||
Window_TitleCommand.prototype.updatePlacement;
|
||||
Window_TitleCommand.prototype.updatePlacement = function () {
|
||||
_Window_TitleCommand_updatePlacement.call(this);
|
||||
var addSize = this._list.length - 3;
|
||||
if (addSize > 0) {
|
||||
this.y += (addSize * this.itemHeight()) / 2;
|
||||
}
|
||||
};
|
||||
|
||||
var _StorageManager_webStorageKey = StorageManager.webStorageKey;
|
||||
StorageManager.webStorageKey = function (savefileId) {
|
||||
if (savefileId === ANGSettingManager._fileId) {
|
||||
return 'RPG AnotherNewGame Mk2' + parameters.manageNumber;
|
||||
} else {
|
||||
return _StorageManager_webStorageKey.call(this, savefileId);
|
||||
}
|
||||
};
|
||||
//=============================================================================
|
||||
// ANGManager
|
||||
// アナザーニューゲームの設定ファイルのセーブとロードを定義します。
|
||||
//=============================================================================
|
||||
function ANGSettingManager() {
|
||||
throw new Error("This is a static class");
|
||||
}
|
||||
|
||||
ANGSettingManager._fileId = -1001;
|
||||
|
||||
ANGSettingManager._visible = [];
|
||||
ANGSettingManager._enable = [];
|
||||
ANGSettingManager.newGameHidden = false;
|
||||
|
||||
ANGSettingManager.make = function () {
|
||||
var info = {};
|
||||
info.visible = this._visible;
|
||||
info.enable = this._enable;
|
||||
info.newGameHidden = this.newGameHidden;
|
||||
return info;
|
||||
};
|
||||
|
||||
ANGSettingManager.isVisible = function (index) {
|
||||
if (this._visible[index] !== undefined) {
|
||||
return this._visible[index];
|
||||
} else {
|
||||
return !parameters.anotherDataList[index].hidden;
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager.setVisible = function (index, value) {
|
||||
this._visible[index] = value;
|
||||
};
|
||||
|
||||
ANGSettingManager.isEnable = function (index) {
|
||||
if (this._enable[index] !== undefined) {
|
||||
return this._enable[index];
|
||||
} else {
|
||||
return !parameters.anotherDataList[index].disable;
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager.setEnable = function (index, value) {
|
||||
this._enable[index] = value;
|
||||
};
|
||||
|
||||
ANGSettingManager.loadData = function () {
|
||||
var info = this.load();
|
||||
this._visible = info.visible || [];
|
||||
this._enable = info.enable || [];
|
||||
this.newGameHidden = !!info.newGameHidden;
|
||||
};
|
||||
|
||||
ANGSettingManager.load = function () {
|
||||
var json;
|
||||
try {
|
||||
json = StorageManager.load(this._fileId);
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
if (json) {
|
||||
return JSON.parse(json);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
ANGSettingManager.save = function () {
|
||||
var info = ANGSettingManager.make();
|
||||
StorageManager.save(this._fileId, JSON.stringify(info));
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// StorageManager
|
||||
// アナザーニューゲームの設定ファイルのパス取得処理を追加定義します。
|
||||
//=============================================================================
|
||||
var _StorageManager_localFilePath = StorageManager.localFilePath;
|
||||
StorageManager.localFilePath = function (savefileId) {
|
||||
if (savefileId === ANGSettingManager._fileId) {
|
||||
return this.localFileDirectoryPath() + "AnotherNewGameMk2.rpgsave";
|
||||
} else {
|
||||
return _StorageManager_localFilePath.call(this, savefileId);
|
||||
}
|
||||
};
|
||||
|
||||
var _StorageManager_webStorageKey = StorageManager.webStorageKey;
|
||||
StorageManager.webStorageKey = function (savefileId) {
|
||||
if (savefileId === ANGSettingManager._fileId) {
|
||||
return "RPG AnotherNewGame Mk2" + parameters.manageNumber;
|
||||
} else {
|
||||
return _StorageManager_webStorageKey.call(this, savefileId);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -54,36 +54,36 @@
|
|||
* 音の聞き手(初期設定では画面の中央)との距離感によって音量などが変化します。
|
||||
* 音源と聞き手の距離が縮まるほど音量が大きくなりますし、
|
||||
* 音源が聞き手よりも右の方にあれば、音が右から聞こえてくる(位相が増える)ようになります。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* ---RPGツクールMZでの使い方---
|
||||
* プラグインコマンドの「音源から音声を演奏」を用いて、
|
||||
* 音声を特定の場所(音源)から聞こえるように演奏することができます。
|
||||
*
|
||||
*
|
||||
* ※BGM,BGSについては、音源から演奏したまま別のマップへ移動すると
|
||||
* 音源が行方不明になるため、聞こえ方がおかしくなります。
|
||||
* 移動前に演奏を止めるか、移動後にプラグインコマンドを再設定しましょう。
|
||||
*
|
||||
*
|
||||
* この他にも、音の聞き手を特定のマップイベントに変更するコマンドや
|
||||
* 「移動ルートの設定」「アニメーションの表示」におけるSEを自動で音源化するコマンドもあります。
|
||||
* 慣れたらそちらも使ってみてください。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* ---RPGツクールMVでの使い方---
|
||||
* マップイベントの「ルート設定」内で効果音を鳴らすと、プラグインの効果が発動します。
|
||||
* ※イベントコマンドの「SEの演奏」では自動調節しません。うまく使い分けましょう。
|
||||
* また、「アニメーションの表示」の効果音も対象の位置から聞こえるようになります。
|
||||
*
|
||||
*
|
||||
* さらに、プラグインコマンドによりBGMやBGSを特定の位置から鳴らすことができます。
|
||||
* トリアコンタンさんのBGS並行演奏プラグインとも連携可能にしてみました。
|
||||
* 詳しくは下の方の「プラグインコマンド」を見てください。
|
||||
*
|
||||
*
|
||||
* なお基準となる音量は効果音(,BGM,BGS)の演奏を指定した時の音量です。
|
||||
* 音源と聞き手が同じかすぐ隣のマスに居る時は基準音量で鳴らされ、
|
||||
* そこから一歩離れるたびに音が小さくなっていきます。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* プラグインパラメータ:
|
||||
* listener : 発信される音の「聞き手」を設定します。
|
||||
* screen 「画面の中央マス」が聞き手になります。
|
||||
|
|
@ -95,48 +95,48 @@
|
|||
* 逆に音源が一歩左へ移動すると位相が-pan変化します。
|
||||
* cutoff : 音を鳴らすことを許可する最小の音量(%)です。
|
||||
* 計算後の音量がこの値を下回ると強制的に音量0%になります。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* プラグインコマンド:
|
||||
* audiosource listener 1
|
||||
* 指定したID(この場合は1)のマップイベントを聞き手にします。
|
||||
* (ちなみに0を指定すると「このイベント」を聞き手にします)
|
||||
* 聞き手は常に一つですので、スクリーンorプレイヤーは聞き手ではなくなります。
|
||||
*
|
||||
*
|
||||
* audiosource listener reset
|
||||
* マップイベントの聞き手化を解除し、スクリーンかプレイヤーに聞き手を戻します。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* audiosource bgm 1
|
||||
* audiosource bgs 1
|
||||
* 現在流れているBGM/BGSの音量と位相を、
|
||||
* 「指定したIDのマップイベントから鳴っている」風に聞こえるように調節します。
|
||||
* (0を指定すると「このイベント」から鳴らします)
|
||||
* 設置されたラジオから曲が流れている演出などにお使いください。
|
||||
*
|
||||
*
|
||||
* また、BGS並行演奏プラグインと連携する場合は、
|
||||
* BGSライン変更→audiosourceの順番で指定すれば
|
||||
* それぞれのBGSに音源を指定できます。
|
||||
* 例
|
||||
* ◆プラグインコマンド:PB_BGSライン変更 2
|
||||
* ◆プラグインコマンド:audiosource bgs 1
|
||||
*
|
||||
*
|
||||
* audiosource bgm reset
|
||||
* audiosource bgs reset
|
||||
* BGM/BGSの音源化を解除し、通常通りの演奏に戻します。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* audiosource se on
|
||||
* audiosource se off
|
||||
* 「ルート設定」や「アニメーションの表示」では自動的に効果音が
|
||||
* 対象キャラの位置から音が鳴っているように調節されますが、
|
||||
* 調節してほしくない時はこのプラグインコマンドでoffにしましょう。
|
||||
* 初期値はonです。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* ライセンス:
|
||||
* このプラグインの利用法に制限はありません。お好きなようにどうぞ。
|
||||
*
|
||||
*
|
||||
* @command play
|
||||
* @text 音源から音声を演奏
|
||||
* @desc 音源(音の発し手)と聞き手の位置関係を計算し、音声を音源から聞こえてくるように演奏します。
|
||||
|
|
@ -145,344 +145,385 @@
|
|||
* @type file
|
||||
* @dir audio
|
||||
* @text 音声ファイル
|
||||
*
|
||||
*
|
||||
* @arg volume
|
||||
* @type number
|
||||
* @default 90
|
||||
* @text 音量(%)
|
||||
*
|
||||
*
|
||||
* @arg pitch
|
||||
* @type number
|
||||
* @default 100
|
||||
* @text ピッチ(%)
|
||||
*
|
||||
*
|
||||
* @arg source
|
||||
* @type number
|
||||
* @default 0
|
||||
* @text 音源イベント
|
||||
* @desc 音源にするマップイベントをIDで指定します。0のときは「このイベント」になります。
|
||||
*
|
||||
*
|
||||
* @command listener
|
||||
* @text 音の聞き手の変更
|
||||
* @desc 音の聞き手にするマップイベントをIDで指定します。0で解除(聞き手が画面の中央/プレイヤーに戻る)します。
|
||||
*
|
||||
*
|
||||
* @arg listener
|
||||
* @type number
|
||||
* @default 0
|
||||
* @text 聞き手イベント
|
||||
*
|
||||
*
|
||||
* @command adjustRouteSe
|
||||
* @text 移動ルートのSEを音源化
|
||||
* @desc 「移動ルートの設定」の内部に「SEの演奏」があるとき、自動的に対象のイベントから音が聞こえるようにします。
|
||||
*
|
||||
*
|
||||
* @arg value
|
||||
* @type boolean
|
||||
*
|
||||
*
|
||||
* @command adjustAnimationSe
|
||||
* @text アニメーションのSEを音源化
|
||||
* @desc 「アニメーションの表示」でアニメにSEが含まれるとき、自動的に対象のイベントから音が聞こえるようにします。
|
||||
*
|
||||
*
|
||||
* @arg value
|
||||
* @type boolean
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
var pluginName = 'AudioSource';
|
||||
var parameters = PluginManager.parameters(pluginName);
|
||||
var listener = parameters['listener'];
|
||||
var decay = toNumber(parameters['decay'], 85).clamp(0, Infinity);
|
||||
var pan = toNumber(parameters['pan'], 10);
|
||||
var cutoff = toNumber(parameters['cutoff'], 1).clamp(0, 100);
|
||||
"use strict";
|
||||
var pluginName = "AudioSource";
|
||||
var parameters = PluginManager.parameters(pluginName);
|
||||
var listener = parameters["listener"];
|
||||
var decay = toNumber(parameters["decay"], 85).clamp(0, Infinity);
|
||||
var pan = toNumber(parameters["pan"], 10);
|
||||
var cutoff = toNumber(parameters["cutoff"], 1).clamp(0, 100);
|
||||
|
||||
//効果音の音量調節(マップイベントのルート設定から鳴らした時のみ)
|
||||
var _Game_Character_processMoveCommand = Game_Character.prototype.processMoveCommand;
|
||||
Game_Character.prototype.processMoveCommand = function (command) {
|
||||
var adjust = typeof $gameSystem._adjustRouteSe === "boolean" ? $gameSystem._adjustRouteSe : !PluginManager.registerCommand;
|
||||
if (adjust && command.code === Game_Character.ROUTE_PLAY_SE) playAdjustSe(command.parameters[0], this);
|
||||
else _Game_Character_processMoveCommand.apply(this, arguments);
|
||||
};
|
||||
//効果音の音量調節(マップイベントのルート設定から鳴らした時のみ)
|
||||
var _Game_Character_processMoveCommand =
|
||||
Game_Character.prototype.processMoveCommand;
|
||||
Game_Character.prototype.processMoveCommand = function (command) {
|
||||
var adjust =
|
||||
typeof $gameSystem._adjustRouteSe === "boolean"
|
||||
? $gameSystem._adjustRouteSe
|
||||
: !PluginManager.registerCommand;
|
||||
if (adjust && command.code === Game_Character.ROUTE_PLAY_SE)
|
||||
playAdjustSe(command.parameters[0], this);
|
||||
else _Game_Character_processMoveCommand.apply(this, arguments);
|
||||
};
|
||||
|
||||
//アニメーション中の効果音を音量調節
|
||||
Sprite_Animation.prototype.processTimingData = function (timing) {
|
||||
var duration = timing.flashDuration * this._rate;
|
||||
switch (timing.flashScope) {
|
||||
case 1:
|
||||
this.startFlash(timing.flashColor, duration);
|
||||
break;
|
||||
case 2:
|
||||
this.startScreenFlash(timing.flashColor, duration);
|
||||
break;
|
||||
case 3:
|
||||
this.startHiding(duration);
|
||||
break;
|
||||
}
|
||||
if (!this._duplicated && timing.se) {
|
||||
var adjust = typeof $gameSystem._adjustAnimationSe === "boolean" ? $gameSystem._adjustAnimationSe : !PluginManager.registerCommand;
|
||||
playAdjustSe(timing.se, adjust && this._target && this._target._character);
|
||||
}
|
||||
};
|
||||
//アニメーション中の効果音を音量調節
|
||||
Sprite_Animation.prototype.processTimingData = function (timing) {
|
||||
var duration = timing.flashDuration * this._rate;
|
||||
switch (timing.flashScope) {
|
||||
case 1:
|
||||
this.startFlash(timing.flashColor, duration);
|
||||
break;
|
||||
case 2:
|
||||
this.startScreenFlash(timing.flashColor, duration);
|
||||
break;
|
||||
case 3:
|
||||
this.startHiding(duration);
|
||||
break;
|
||||
}
|
||||
if (!this._duplicated && timing.se) {
|
||||
var adjust =
|
||||
typeof $gameSystem._adjustAnimationSe === "boolean"
|
||||
? $gameSystem._adjustAnimationSe
|
||||
: !PluginManager.registerCommand;
|
||||
playAdjustSe(
|
||||
timing.se,
|
||||
adjust && this._target && this._target._character
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
//戦闘終了直後、BGMとBGSの音量が初期値に戻っているので再度設定する
|
||||
//fadeInがcancelされてしまいそうだが、実際はfadeInの処理の方が遅延するのでうまくいく
|
||||
var _BattleManager_replayBgmAndBgs = BattleManager.replayBgmAndBgs;
|
||||
BattleManager.replayBgmAndBgs = function () {
|
||||
_BattleManager_replayBgmAndBgs.apply(this, arguments);
|
||||
AudioManager.updateAudioSource();
|
||||
};
|
||||
//戦闘終了直後、BGMとBGSの音量が初期値に戻っているので再度設定する
|
||||
//fadeInがcancelされてしまいそうだが、実際はfadeInの処理の方が遅延するのでうまくいく
|
||||
var _BattleManager_replayBgmAndBgs = BattleManager.replayBgmAndBgs;
|
||||
BattleManager.replayBgmAndBgs = function () {
|
||||
_BattleManager_replayBgmAndBgs.apply(this, arguments);
|
||||
AudioManager.updateAudioSource();
|
||||
};
|
||||
|
||||
//BGM、BGSの音量調節(毎フレーム)
|
||||
AudioManager.updateAudioSource = function () {
|
||||
updateParameters(this._currentBgm, $gameMap.event($gameSystem._bgmSource), true);
|
||||
if ($gameSystem._bgsSources) {
|
||||
if (!this.iterateAllBgs) return delete $gameSystem._bgsSources;
|
||||
this.iterateAllBgs(function () {
|
||||
updateParameters(this._currentBgs, $gameMap.event($gameSystem._bgsSources[this.getBgsLineIndex()]));
|
||||
}.bind(this));
|
||||
}
|
||||
else updateParameters(this._currentBgs, $gameMap.event($gameSystem._bgsSource));
|
||||
};
|
||||
//BGM、BGSの音量調節(毎フレーム)
|
||||
AudioManager.updateAudioSource = function () {
|
||||
updateParameters(
|
||||
this._currentBgm,
|
||||
$gameMap.event($gameSystem._bgmSource),
|
||||
true
|
||||
);
|
||||
if ($gameSystem._bgsSources) {
|
||||
if (!this.iterateAllBgs) return delete $gameSystem._bgsSources;
|
||||
this.iterateAllBgs(
|
||||
function () {
|
||||
updateParameters(
|
||||
this._currentBgs,
|
||||
$gameMap.event($gameSystem._bgsSources[this.getBgsLineIndex()])
|
||||
);
|
||||
}.bind(this)
|
||||
);
|
||||
} else
|
||||
updateParameters(
|
||||
this._currentBgs,
|
||||
$gameMap.event($gameSystem._bgsSource)
|
||||
);
|
||||
};
|
||||
|
||||
//BGM、BGSの音量が自動調節されている場合はイベントコマンドからのAudioBufferの調節を無効にする
|
||||
//(同一フレームに複数回の音量変化が含まれるとノイズが発生するため)
|
||||
var _AudioManager_updateBgmParameters = AudioManager.updateBgmParameters;
|
||||
AudioManager.updateBgmParameters = function (bgm) {
|
||||
if ($gameMap && $gameMap.event($gameSystem._bgmSource)) return;
|
||||
_AudioManager_updateBgmParameters.apply(this, arguments);
|
||||
};
|
||||
//BGM、BGSの音量が自動調節されている場合はイベントコマンドからのAudioBufferの調節を無効にする
|
||||
//(同一フレームに複数回の音量変化が含まれるとノイズが発生するため)
|
||||
var _AudioManager_updateBgmParameters = AudioManager.updateBgmParameters;
|
||||
AudioManager.updateBgmParameters = function (bgm) {
|
||||
if ($gameMap && $gameMap.event($gameSystem._bgmSource)) return;
|
||||
_AudioManager_updateBgmParameters.apply(this, arguments);
|
||||
};
|
||||
|
||||
var _AudioManager_updateBgsParameters = AudioManager.updateBgsParameters;
|
||||
AudioManager.updateBgsParameters = function (bgs) {
|
||||
if ($gameMap && $gameSystem) {
|
||||
if ($gameSystem._bgsSources && this.getBgsLineIndex) {
|
||||
if ($gameMap.event($gameSystem._bgsSources[this.getBgsLineIndex()])) return;
|
||||
} else {
|
||||
if ($gameMap.event($gameSystem._bgsSource)) return;
|
||||
}
|
||||
}
|
||||
_AudioManager_updateBgsParameters.apply(this, arguments);
|
||||
};
|
||||
var _AudioManager_updateBgsParameters = AudioManager.updateBgsParameters;
|
||||
AudioManager.updateBgsParameters = function (bgs) {
|
||||
if ($gameMap && $gameSystem) {
|
||||
if ($gameSystem._bgsSources && this.getBgsLineIndex) {
|
||||
if ($gameMap.event($gameSystem._bgsSources[this.getBgsLineIndex()]))
|
||||
return;
|
||||
} else {
|
||||
if ($gameMap.event($gameSystem._bgsSource)) return;
|
||||
}
|
||||
}
|
||||
_AudioManager_updateBgsParameters.apply(this, arguments);
|
||||
};
|
||||
|
||||
//BGM、BGSのオプション側の音量を変えた時にちゃんと音量調節されるようにする
|
||||
var _AudioManager_bgmVolume = Object.getOwnPropertyDescriptor(AudioManager, 'bgmVolume');
|
||||
Object.defineProperty(AudioManager, 'bgmVolume', {
|
||||
get: function () {
|
||||
return _AudioManager_bgmVolume.get.call(this);
|
||||
},
|
||||
set: function (value) {
|
||||
_AudioManager_bgmVolume.set.call(this, value);
|
||||
if ($gameMap && $gameSystem) this.updateAudioSource();
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
//BGM、BGSのオプション側の音量を変えた時にちゃんと音量調節されるようにする
|
||||
var _AudioManager_bgmVolume = Object.getOwnPropertyDescriptor(
|
||||
AudioManager,
|
||||
"bgmVolume"
|
||||
);
|
||||
Object.defineProperty(AudioManager, "bgmVolume", {
|
||||
get: function () {
|
||||
return _AudioManager_bgmVolume.get.call(this);
|
||||
},
|
||||
set: function (value) {
|
||||
_AudioManager_bgmVolume.set.call(this, value);
|
||||
if ($gameMap && $gameSystem) this.updateAudioSource();
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
var _AudioManager_bgsVolume = Object.getOwnPropertyDescriptor(AudioManager, 'bgsVolume');
|
||||
Object.defineProperty(AudioManager, 'bgsVolume', {
|
||||
get: function () {
|
||||
return _AudioManager_bgsVolume.get.call(this);
|
||||
},
|
||||
set: function (value) {
|
||||
_AudioManager_bgsVolume.set.call(this, value);
|
||||
if ($gameMap && $gameSystem) this.updateAudioSource();
|
||||
},
|
||||
configurable: true
|
||||
});
|
||||
var _AudioManager_bgsVolume = Object.getOwnPropertyDescriptor(
|
||||
AudioManager,
|
||||
"bgsVolume"
|
||||
);
|
||||
Object.defineProperty(AudioManager, "bgsVolume", {
|
||||
get: function () {
|
||||
return _AudioManager_bgsVolume.get.call(this);
|
||||
},
|
||||
set: function (value) {
|
||||
_AudioManager_bgsVolume.set.call(this, value);
|
||||
if ($gameMap && $gameSystem) this.updateAudioSource();
|
||||
},
|
||||
configurable: true,
|
||||
});
|
||||
|
||||
var bgmOnSave = null;
|
||||
var bgsOnSave = null;
|
||||
var bgmOnSave = null;
|
||||
var bgsOnSave = null;
|
||||
|
||||
var _Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded;
|
||||
Scene_Map.prototype.onMapLoaded = function () {
|
||||
_Scene_Map_onMapLoaded.apply(this, arguments);
|
||||
if (bgmOnSave) {
|
||||
AudioManager.playBgm(bgmOnSave);
|
||||
bgmOnSave = null;
|
||||
}
|
||||
if (bgsOnSave) {
|
||||
AudioManager.playBgs(bgsOnSave);
|
||||
bgsOnSave = null;
|
||||
}
|
||||
AudioManager.updateAudioSource();
|
||||
};
|
||||
var _Scene_Map_onMapLoaded = Scene_Map.prototype.onMapLoaded;
|
||||
Scene_Map.prototype.onMapLoaded = function () {
|
||||
_Scene_Map_onMapLoaded.apply(this, arguments);
|
||||
if (bgmOnSave) {
|
||||
AudioManager.playBgm(bgmOnSave);
|
||||
bgmOnSave = null;
|
||||
}
|
||||
if (bgsOnSave) {
|
||||
AudioManager.playBgs(bgsOnSave);
|
||||
bgsOnSave = null;
|
||||
}
|
||||
AudioManager.updateAudioSource();
|
||||
};
|
||||
|
||||
var _Game_System_onAfterLoad = Game_System.prototype.onAfterLoad;
|
||||
Game_System.prototype.onAfterLoad = function () {
|
||||
bgmOnSave = this._bgmOnSave;
|
||||
bgsOnSave = this._bgsOnSave;
|
||||
this._bgmOnSave = this._bgsOnSave = {};
|
||||
_Game_System_onAfterLoad.apply(this, arguments);
|
||||
this._bgmOnSave = bgmOnSave;
|
||||
this._bgsOnSave = bgsOnSave;
|
||||
};
|
||||
var _Game_System_onAfterLoad = Game_System.prototype.onAfterLoad;
|
||||
Game_System.prototype.onAfterLoad = function () {
|
||||
bgmOnSave = this._bgmOnSave;
|
||||
bgsOnSave = this._bgsOnSave;
|
||||
this._bgmOnSave = this._bgsOnSave = {};
|
||||
_Game_System_onAfterLoad.apply(this, arguments);
|
||||
this._bgmOnSave = bgmOnSave;
|
||||
this._bgsOnSave = bgsOnSave;
|
||||
};
|
||||
|
||||
var _Game_Map_update = Game_Map.prototype.update;
|
||||
Game_Map.prototype.update = function (sceneActive) {
|
||||
_Game_Map_update.apply(this, arguments);
|
||||
AudioManager.updateAudioSource();
|
||||
};
|
||||
var _Game_Map_update = Game_Map.prototype.update;
|
||||
Game_Map.prototype.update = function (sceneActive) {
|
||||
_Game_Map_update.apply(this, arguments);
|
||||
AudioManager.updateAudioSource();
|
||||
};
|
||||
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
if (command.toLowerCase() === 'audiosource') {
|
||||
var eventId = +args[1] === 0 ? this._eventId : +args[1];
|
||||
switch (args[0].toLowerCase()) {
|
||||
case 'listener':
|
||||
$gameSystem._listenerEvent = eventId;
|
||||
break;
|
||||
case 'bgm':
|
||||
$gameSystem._bgmSource = eventId;
|
||||
break;
|
||||
case 'bgs':
|
||||
if ($gameSystem.getBgsLine) {
|
||||
$gameSystem._bgsSources = $gameSystem._bgsSources || [];
|
||||
$gameSystem._bgsSources[$gameSystem.getBgsLine()] = eventId;
|
||||
}
|
||||
else $gameSystem._bgsSource = eventId;
|
||||
break;
|
||||
case 'se':
|
||||
$gameSystem._adjustRouteSe = $gameSystem._adjustAnimationSe = args[1].toLowerCase() !== 'off';
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
if (command.toLowerCase() === "audiosource") {
|
||||
var eventId = +args[1] === 0 ? this._eventId : +args[1];
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "listener":
|
||||
$gameSystem._listenerEvent = eventId;
|
||||
break;
|
||||
case "bgm":
|
||||
$gameSystem._bgmSource = eventId;
|
||||
break;
|
||||
case "bgs":
|
||||
if ($gameSystem.getBgsLine) {
|
||||
$gameSystem._bgsSources = $gameSystem._bgsSources || [];
|
||||
$gameSystem._bgsSources[$gameSystem.getBgsLine()] = eventId;
|
||||
} else $gameSystem._bgsSource = eventId;
|
||||
break;
|
||||
case "se":
|
||||
$gameSystem._adjustRouteSe = $gameSystem._adjustAnimationSe =
|
||||
args[1].toLowerCase() !== "off";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (PluginManager.registerCommand) {
|
||||
PluginManager.registerCommand(pluginName, "play", function (args) {
|
||||
var { path, volume, pitch, source } = args;
|
||||
var [dir, name] = path.split("/");
|
||||
var eventId = +source || this._eventId;
|
||||
var pan = 0;
|
||||
switch (dir) {
|
||||
case "bgm": {
|
||||
$gameSystem._bgmSource = eventId;
|
||||
AudioManager.playBgm({ name, volume, pitch, pan });
|
||||
break;
|
||||
}
|
||||
case "bgs": {
|
||||
if ($gameSystem.getBgsLine) {
|
||||
$gameSystem._bgsSources = $gameSystem._bgsSources || [];
|
||||
$gameSystem._bgsSources[$gameSystem.getBgsLine()] = eventId;
|
||||
}
|
||||
else $gameSystem._bgsSource = eventId;
|
||||
AudioManager.playBgs({ name, volume, pitch, pan });
|
||||
break;
|
||||
}
|
||||
case "me": {
|
||||
playAdjustMe({ name, volume, pitch, pan }, $gameMap.event(eventId));
|
||||
break;
|
||||
}
|
||||
case "se": {
|
||||
playAdjustSe({ name, volume, pitch, pan }, $gameMap.event(eventId));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (PluginManager.registerCommand) {
|
||||
PluginManager.registerCommand(pluginName, "play", function (args) {
|
||||
var { path, volume, pitch, source } = args;
|
||||
var [dir, name] = path.split("/");
|
||||
var eventId = +source || this._eventId;
|
||||
var pan = 0;
|
||||
switch (dir) {
|
||||
case "bgm": {
|
||||
$gameSystem._bgmSource = eventId;
|
||||
AudioManager.playBgm({ name, volume, pitch, pan });
|
||||
break;
|
||||
}
|
||||
case "bgs": {
|
||||
if ($gameSystem.getBgsLine) {
|
||||
$gameSystem._bgsSources = $gameSystem._bgsSources || [];
|
||||
$gameSystem._bgsSources[$gameSystem.getBgsLine()] = eventId;
|
||||
} else $gameSystem._bgsSource = eventId;
|
||||
AudioManager.playBgs({ name, volume, pitch, pan });
|
||||
break;
|
||||
}
|
||||
case "me": {
|
||||
playAdjustMe({ name, volume, pitch, pan }, $gameMap.event(eventId));
|
||||
break;
|
||||
}
|
||||
case "se": {
|
||||
playAdjustSe({ name, volume, pitch, pan }, $gameMap.event(eventId));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
PluginManager.registerCommand(pluginName, "listener", function (args) {
|
||||
$gameSystem._listenerEvent = args.listener;
|
||||
});
|
||||
PluginManager.registerCommand(pluginName, "listener", function (args) {
|
||||
$gameSystem._listenerEvent = args.listener;
|
||||
});
|
||||
|
||||
PluginManager.registerCommand(pluginName, "adjustRouteSe", function (args) {
|
||||
$gameSystem._adjustRouteSe = args.value === "true";
|
||||
});
|
||||
PluginManager.registerCommand(pluginName, "adjustRouteSe", function (args) {
|
||||
$gameSystem._adjustRouteSe = args.value === "true";
|
||||
});
|
||||
|
||||
PluginManager.registerCommand(pluginName, "adjustAnimationSe", function (args) {
|
||||
$gameSystem._adjustAnimationSe = args.value === "true";
|
||||
});
|
||||
PluginManager.registerCommand(
|
||||
pluginName,
|
||||
"adjustAnimationSe",
|
||||
function (args) {
|
||||
$gameSystem._adjustAnimationSe = args.value === "true";
|
||||
}
|
||||
);
|
||||
|
||||
var _Game_Intepreter_command241 = Game_Interpreter.prototype.command241;
|
||||
Game_Interpreter.prototype.command241 = function (params) {
|
||||
$gameSystem._bgmSource = NaN;
|
||||
return _Game_Intepreter_command241.apply(this, arguments);
|
||||
};
|
||||
var _Game_Intepreter_command241 = Game_Interpreter.prototype.command241;
|
||||
Game_Interpreter.prototype.command241 = function (params) {
|
||||
$gameSystem._bgmSource = NaN;
|
||||
return _Game_Intepreter_command241.apply(this, arguments);
|
||||
};
|
||||
|
||||
var _Game_Intepreter_command245 = Game_Interpreter.prototype.command245;
|
||||
Game_Interpreter.prototype.command245 = function (params) {
|
||||
if ($gameSystem.getBgsLine) {
|
||||
$gameSystem._bgsSources = $gameSystem._bgsSources || [];
|
||||
$gameSystem._bgsSources[$gameSystem.getBgsLine()] = NaN;
|
||||
}
|
||||
else $gameSystem._bgsSource = NaN;
|
||||
return _Game_Intepreter_command245.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
var _Game_Intepreter_command245 = Game_Interpreter.prototype.command245;
|
||||
Game_Interpreter.prototype.command245 = function (params) {
|
||||
if ($gameSystem.getBgsLine) {
|
||||
$gameSystem._bgsSources = $gameSystem._bgsSources || [];
|
||||
$gameSystem._bgsSources[$gameSystem.getBgsLine()] = NaN;
|
||||
} else $gameSystem._bgsSource = NaN;
|
||||
return _Game_Intepreter_command245.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
|
||||
function toNumber(str, def) {
|
||||
return isNaN(str) ? def : +(str || def);
|
||||
}
|
||||
function toNumber(str, def) {
|
||||
return isNaN(str) ? def : +(str || def);
|
||||
}
|
||||
|
||||
//BGMとBGSの音量と位相を調節する
|
||||
function updateParameters(audio, source, isBgm) {
|
||||
if (audio && source) {
|
||||
var lastVolume = audio.volume;
|
||||
var lastPan = audio.pan;
|
||||
adjust(audio, source);
|
||||
if (audio.volume < cutoff) audio.volume = 0;
|
||||
var buffer = AudioManager[isBgm ? '_bgmBuffer' : '_bgsBuffer'];
|
||||
if (buffer && buffer._gainNode) buffer._gainNode.gain.cancelScheduledValues(0);
|
||||
AudioManager.updateBufferParameters(buffer, AudioManager[isBgm ? '_bgmVolume' : '_bgsVolume'], audio);
|
||||
audio.volume = lastVolume;
|
||||
audio.pan = lastPan;
|
||||
}
|
||||
}
|
||||
//BGMとBGSの音量と位相を調節する
|
||||
function updateParameters(audio, source, isBgm) {
|
||||
if (audio && source) {
|
||||
var lastVolume = audio.volume;
|
||||
var lastPan = audio.pan;
|
||||
adjust(audio, source);
|
||||
if (audio.volume < cutoff) audio.volume = 0;
|
||||
var buffer = AudioManager[isBgm ? "_bgmBuffer" : "_bgsBuffer"];
|
||||
if (buffer && buffer._gainNode)
|
||||
buffer._gainNode.gain.cancelScheduledValues(0);
|
||||
AudioManager.updateBufferParameters(
|
||||
buffer,
|
||||
AudioManager[isBgm ? "_bgmVolume" : "_bgsVolume"],
|
||||
audio
|
||||
);
|
||||
audio.volume = lastVolume;
|
||||
audio.pan = lastPan;
|
||||
}
|
||||
}
|
||||
|
||||
//MEの音量と位相を調節して再生する
|
||||
function playAdjustMe(me, source) {
|
||||
if (source) {
|
||||
var lastVolume = me.volume;
|
||||
var lastPan = me.pan;
|
||||
adjust(me, source);
|
||||
if (me.volume >= cutoff) AudioManager.playMe(me);
|
||||
me.volume = lastVolume;
|
||||
me.pan = lastPan;
|
||||
}
|
||||
else AudioManager.playMe(me);
|
||||
}
|
||||
//MEの音量と位相を調節して再生する
|
||||
function playAdjustMe(me, source) {
|
||||
if (source) {
|
||||
var lastVolume = me.volume;
|
||||
var lastPan = me.pan;
|
||||
adjust(me, source);
|
||||
if (me.volume >= cutoff) AudioManager.playMe(me);
|
||||
me.volume = lastVolume;
|
||||
me.pan = lastPan;
|
||||
} else AudioManager.playMe(me);
|
||||
}
|
||||
|
||||
//SEの音量と位相を調節して再生する
|
||||
function playAdjustSe(se, source) {
|
||||
if (source) {
|
||||
var lastVolume = se.volume;
|
||||
var lastPan = se.pan;
|
||||
adjust(se, source);
|
||||
if (se.volume >= cutoff) AudioManager.playSe(se);
|
||||
se.volume = lastVolume;
|
||||
se.pan = lastPan;
|
||||
}
|
||||
else AudioManager.playSe(se);
|
||||
}
|
||||
//SEの音量と位相を調節して再生する
|
||||
function playAdjustSe(se, source) {
|
||||
if (source) {
|
||||
var lastVolume = se.volume;
|
||||
var lastPan = se.pan;
|
||||
adjust(se, source);
|
||||
if (se.volume >= cutoff) AudioManager.playSe(se);
|
||||
se.volume = lastVolume;
|
||||
se.pan = lastPan;
|
||||
} else AudioManager.playSe(se);
|
||||
}
|
||||
|
||||
//実際に音量調節を担当する関数。第一引数にオーディオデータ、第二引数に音源キャラクターを指定する
|
||||
function adjust(audio, source) {
|
||||
if (!source) throw new Error('audiosourceエラー:音源となるイベントが存在しません');
|
||||
var listenerX, listenerY, listenerEvent = $gameMap.event($gameSystem._listenerEvent);
|
||||
if (listenerEvent) {
|
||||
listenerX = listenerEvent._realX;
|
||||
listenerY = listenerEvent._realY;
|
||||
} else {
|
||||
switch (listener.toLowerCase()) {
|
||||
case 'screen':
|
||||
listenerX = $gameMap.displayX() + $gamePlayer.centerX();
|
||||
listenerY = $gameMap.displayY() + $gamePlayer.centerY();
|
||||
break;
|
||||
case 'player':
|
||||
listenerX = $gamePlayer._realX;
|
||||
listenerY = $gamePlayer._realY;
|
||||
break;
|
||||
default:
|
||||
throw new Error('audiosourceエラー:listenerパラメータはscreenかplayerにしてください');
|
||||
}
|
||||
}
|
||||
var dx = $gameMap.deltaX(source._realX, listenerX);
|
||||
var dy = $gameMap.deltaY(source._realY, listenerY);
|
||||
var d = Math.sqrt(dx * dx + dy * dy);
|
||||
if (d > 1) audio.volume *= Math.pow(decay / 100, d - 1);
|
||||
audio.pan = (dx * pan).clamp(-100, 100);
|
||||
}
|
||||
//実際に音量調節を担当する関数。第一引数にオーディオデータ、第二引数に音源キャラクターを指定する
|
||||
function adjust(audio, source) {
|
||||
if (!source)
|
||||
throw new Error("audiosourceエラー:音源となるイベントが存在しません");
|
||||
var listenerX,
|
||||
listenerY,
|
||||
listenerEvent = $gameMap.event($gameSystem._listenerEvent);
|
||||
if (listenerEvent) {
|
||||
listenerX = listenerEvent._realX;
|
||||
listenerY = listenerEvent._realY;
|
||||
} else {
|
||||
switch (listener.toLowerCase()) {
|
||||
case "screen":
|
||||
listenerX = $gameMap.displayX() + $gamePlayer.centerX();
|
||||
listenerY = $gameMap.displayY() + $gamePlayer.centerY();
|
||||
break;
|
||||
case "player":
|
||||
listenerX = $gamePlayer._realX;
|
||||
listenerY = $gamePlayer._realY;
|
||||
break;
|
||||
default:
|
||||
throw new Error(
|
||||
"audiosourceエラー:listenerパラメータはscreenかplayerにしてください"
|
||||
);
|
||||
}
|
||||
}
|
||||
var dx = $gameMap.deltaX(source._realX, listenerX);
|
||||
var dy = $gameMap.deltaY(source._realY, listenerY);
|
||||
var d = Math.sqrt(dx * dx + dy * dy);
|
||||
if (d > 1) audio.volume *= Math.pow(decay / 100, d - 1);
|
||||
audio.pan = (dx * pan).clamp(-100, 100);
|
||||
}
|
||||
|
||||
//連携用の口
|
||||
AudioManager.playAdjustSe = playAdjustSe;
|
||||
})();
|
||||
//連携用の口
|
||||
AudioManager.playAdjustSe = playAdjustSe;
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -7446,4 +7446,4 @@
|
|||
* @desc テキストを表示するかどうか
|
||||
* on→表示 off→非表示
|
||||
* @default on
|
||||
*/
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -7446,4 +7446,4 @@
|
|||
* @desc テキストを表示するかどうか
|
||||
* on→表示 off→非表示
|
||||
* @default on
|
||||
*/
|
||||
*/
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -42,100 +42,107 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
const _PNAME = 'CommonEventBeforeAfterMenu';
|
||||
const _PARAMETERS = PluginManager.parameters(_PNAME);
|
||||
const _PNAME = "CommonEventBeforeAfterMenu";
|
||||
const _PARAMETERS = PluginManager.parameters(_PNAME);
|
||||
|
||||
const _COMMON_EVENT_ID_BM = +_PARAMETERS['Common Event ID (before Menu)'] || 0;
|
||||
const _COMMON_EVENT_ID_AM = +_PARAMETERS['Common Event ID (after Menu)'] || 0;
|
||||
const _COMMON_EVENT_ID_BM =
|
||||
+_PARAMETERS["Common Event ID (before Menu)"] || 0;
|
||||
const _COMMON_EVENT_ID_AM = +_PARAMETERS["Common Event ID (after Menu)"] || 0;
|
||||
|
||||
function _(f) { return f[_PNAME] = f[_PNAME] || {} }
|
||||
function _(f) {
|
||||
return (f[_PNAME] = f[_PNAME] || {});
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Scene_Map
|
||||
//==============================================================================
|
||||
//==============================================================================
|
||||
// Scene_Map
|
||||
//==============================================================================
|
||||
|
||||
var _Scene_Map_isMenuCalled = Scene_Map.prototype.isMenuCalled;
|
||||
Scene_Map.prototype.isMenuCalled = function () {
|
||||
return _Scene_Map_isMenuCalled.call(this) || _(this).reserveCallMenu;
|
||||
var _Scene_Map_isMenuCalled = Scene_Map.prototype.isMenuCalled;
|
||||
Scene_Map.prototype.isMenuCalled = function () {
|
||||
return _Scene_Map_isMenuCalled.call(this) || _(this).reserveCallMenu;
|
||||
};
|
||||
|
||||
var _Scene_Map_callMenu = Scene_Map.prototype.callMenu;
|
||||
Scene_Map.prototype.callMenu = function () {
|
||||
if (_COMMON_EVENT_ID_BM && !_(this).reserveCallMenu) {
|
||||
_(this).reserveCallMenu = true;
|
||||
$gameTemp.reserveCommonEvent(_COMMON_EVENT_ID_BM);
|
||||
} else {
|
||||
_(this).reserveCallMenu = false;
|
||||
_Scene_Map_callMenu.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
// Scene_Menu
|
||||
//==============================================================================
|
||||
|
||||
var _Scene_Menu_terminate = Scene_Menu.prototype.terminate;
|
||||
Scene_Menu.prototype.terminate = function () {
|
||||
if (
|
||||
_COMMON_EVENT_ID_AM &&
|
||||
!$gameTemp.isCalledMenuFromEvent &&
|
||||
SceneManager.isNextScene(Scene_Map)
|
||||
) {
|
||||
$gameTemp.reserveCommonEvent(_COMMON_EVENT_ID_AM);
|
||||
}
|
||||
$gameTemp.isCalledMenuFromEvent = false;
|
||||
_Scene_Menu_terminate.call(this);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
// Game_Temp
|
||||
//==============================================================================
|
||||
|
||||
((__initialize) => {
|
||||
Game_Temp.prototype.initialize = function () {
|
||||
__initialize.apply(this, arguments);
|
||||
this.isCalledMenuFromEvent = false;
|
||||
};
|
||||
})(Game_Temp.prototype.initialize);
|
||||
|
||||
var _Scene_Map_callMenu = Scene_Map.prototype.callMenu;
|
||||
Scene_Map.prototype.callMenu = function () {
|
||||
if (_COMMON_EVENT_ID_BM && !_(this).reserveCallMenu) {
|
||||
_(this).reserveCallMenu = true;
|
||||
$gameTemp.reserveCommonEvent(_COMMON_EVENT_ID_BM);
|
||||
} else {
|
||||
_(this).reserveCallMenu = false;
|
||||
_Scene_Map_callMenu.call(this);
|
||||
}
|
||||
};
|
||||
//==============================================================================
|
||||
// Game_Interpreter
|
||||
//==============================================================================
|
||||
|
||||
//==============================================================================
|
||||
// Scene_Menu
|
||||
//==============================================================================
|
||||
((__setup) => {
|
||||
let common1 = { code: 117, indent: 0, parameters: [_COMMON_EVENT_ID_BM] };
|
||||
let common2 = { code: 117, indent: 0, parameters: [_COMMON_EVENT_ID_AM] };
|
||||
|
||||
var _Scene_Menu_terminate = Scene_Menu.prototype.terminate;
|
||||
Scene_Menu.prototype.terminate = function () {
|
||||
if (_COMMON_EVENT_ID_AM && !$gameTemp.isCalledMenuFromEvent && SceneManager.isNextScene(Scene_Map)) {
|
||||
$gameTemp.reserveCommonEvent(_COMMON_EVENT_ID_AM);
|
||||
}
|
||||
$gameTemp.isCalledMenuFromEvent = false;
|
||||
_Scene_Menu_terminate.call(this);
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
// Game_Temp
|
||||
//==============================================================================
|
||||
|
||||
(__initialize => {
|
||||
Game_Temp.prototype.initialize = function () {
|
||||
__initialize.apply(this, arguments);
|
||||
this.isCalledMenuFromEvent = false;
|
||||
};
|
||||
})(Game_Temp.prototype.initialize);
|
||||
|
||||
//==============================================================================
|
||||
// Game_Interpreter
|
||||
//==============================================================================
|
||||
|
||||
(__setup => {
|
||||
let common1 = { code: 117, indent: 0, parameters: [_COMMON_EVENT_ID_BM] };
|
||||
let common2 = { code: 117, indent: 0, parameters: [_COMMON_EVENT_ID_AM] };
|
||||
|
||||
Game_Interpreter.prototype.setup = function (list, eventId) {
|
||||
let _list = list;
|
||||
if (_COMMON_EVENT_ID_BM || _COMMON_EVENT_ID_AM) {
|
||||
let hasCallMenu = list.some(event => event.code == 351);
|
||||
if (hasCallMenu) {
|
||||
_list = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].code == 351) {
|
||||
let indent = list[i].indent;
|
||||
if (_COMMON_EVENT_ID_BM) {
|
||||
common1.indent = indent;
|
||||
_list.push({ ...common1 });
|
||||
}
|
||||
_list.push(list[i]);
|
||||
if (_COMMON_EVENT_ID_AM) {
|
||||
common2.indent = indent;
|
||||
_list.push({ ...common2 });
|
||||
}
|
||||
} else {
|
||||
_list.push(list[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Game_Interpreter.prototype.setup = function (list, eventId) {
|
||||
let _list = list;
|
||||
if (_COMMON_EVENT_ID_BM || _COMMON_EVENT_ID_AM) {
|
||||
let hasCallMenu = list.some((event) => event.code == 351);
|
||||
if (hasCallMenu) {
|
||||
_list = [];
|
||||
for (let i = 0; i < list.length; i++) {
|
||||
if (list[i].code == 351) {
|
||||
let indent = list[i].indent;
|
||||
if (_COMMON_EVENT_ID_BM) {
|
||||
common1.indent = indent;
|
||||
_list.push({ ...common1 });
|
||||
}
|
||||
_list.push(list[i]);
|
||||
if (_COMMON_EVENT_ID_AM) {
|
||||
common2.indent = indent;
|
||||
_list.push({ ...common2 });
|
||||
}
|
||||
} else {
|
||||
_list.push(list[i]);
|
||||
}
|
||||
__setup.call(this, _list, eventId);
|
||||
};
|
||||
})(Game_Interpreter.prototype.setup);
|
||||
}
|
||||
}
|
||||
}
|
||||
__setup.call(this, _list, eventId);
|
||||
};
|
||||
})(Game_Interpreter.prototype.setup);
|
||||
|
||||
(__command351 => {
|
||||
Game_Interpreter.prototype.command351 = function () {
|
||||
$gameTemp.isCalledMenuFromEvent = true;
|
||||
return __command351.apply(this, arguments);
|
||||
};
|
||||
})(Game_Interpreter.prototype.command351);
|
||||
}());
|
||||
((__command351) => {
|
||||
Game_Interpreter.prototype.command351 = function () {
|
||||
$gameTemp.isCalledMenuFromEvent = true;
|
||||
return __command351.apply(this, arguments);
|
||||
};
|
||||
})(Game_Interpreter.prototype.command351);
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -4,12 +4,12 @@
|
|||
*
|
||||
* @help This plugin does not provide plugin commands.
|
||||
*
|
||||
* @param cacheLimit
|
||||
* @param cacheLimit
|
||||
* @desc For setting the upper limit of image memory cache. (MPix)
|
||||
* @default 10
|
||||
*
|
||||
* @param screenWidth
|
||||
* @desc For setting the screen width.
|
||||
* @desc For setting the screen width.
|
||||
* @default 816
|
||||
*
|
||||
* @param screenHeight
|
||||
|
|
@ -65,73 +65,71 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
function toNumber(str, def) {
|
||||
return isNaN(str) ? def : +(str || def);
|
||||
function toNumber(str, def) {
|
||||
return isNaN(str) ? def : +(str || def);
|
||||
}
|
||||
|
||||
var parameters = PluginManager.parameters("Community_Basic");
|
||||
var cacheLimit = toNumber(parameters["cacheLimit"], 10);
|
||||
var screenWidth = toNumber(parameters["screenWidth"], 816);
|
||||
var screenHeight = toNumber(parameters["screenHeight"], 624);
|
||||
var renderingMode = parameters["renderingMode"].toLowerCase();
|
||||
var alwaysDash = parameters["alwaysDash"].toLowerCase() === "on";
|
||||
var windowWidthTo = toNumber(parameters["changeWindowWidthTo"], 0);
|
||||
var windowHeightTo = toNumber(parameters["changeWindowHeightTo"], 0);
|
||||
|
||||
var windowWidth;
|
||||
var windowHeight;
|
||||
|
||||
if (windowWidthTo) {
|
||||
windowWidth = windowWidthTo;
|
||||
} else if (screenWidth !== SceneManager._screenWidth) {
|
||||
windowWidth = screenWidth;
|
||||
}
|
||||
|
||||
if (windowHeightTo) {
|
||||
windowHeight = windowHeightTo;
|
||||
} else if (screenHeight !== SceneManager._screenHeight) {
|
||||
windowHeight = screenHeight;
|
||||
}
|
||||
|
||||
ImageCache.limit = cacheLimit * 1000 * 1000;
|
||||
SceneManager._screenWidth = screenWidth;
|
||||
SceneManager._screenHeight = screenHeight;
|
||||
SceneManager._boxWidth = screenWidth;
|
||||
SceneManager._boxHeight = screenHeight;
|
||||
|
||||
SceneManager.preferableRendererType = function () {
|
||||
if (Utils.isOptionValid("canvas")) {
|
||||
return "canvas";
|
||||
} else if (Utils.isOptionValid("webgl")) {
|
||||
return "webgl";
|
||||
} else if (renderingMode === "canvas") {
|
||||
return "canvas";
|
||||
} else if (renderingMode === "webgl") {
|
||||
return "webgl";
|
||||
} else {
|
||||
return "auto";
|
||||
}
|
||||
};
|
||||
|
||||
var parameters = PluginManager.parameters('Community_Basic');
|
||||
var cacheLimit = toNumber(parameters['cacheLimit'], 10);
|
||||
var screenWidth = toNumber(parameters['screenWidth'], 816);
|
||||
var screenHeight = toNumber(parameters['screenHeight'], 624);
|
||||
var renderingMode = parameters['renderingMode'].toLowerCase();
|
||||
var alwaysDash = parameters['alwaysDash'].toLowerCase() === 'on';
|
||||
var windowWidthTo = toNumber(parameters['changeWindowWidthTo'], 0);
|
||||
var windowHeightTo = toNumber(parameters['changeWindowHeightTo'], 0);
|
||||
|
||||
var windowWidth;
|
||||
var windowHeight;
|
||||
|
||||
if (windowWidthTo) {
|
||||
windowWidth = windowWidthTo;
|
||||
} else if (screenWidth !== SceneManager._screenWidth) {
|
||||
windowWidth = screenWidth;
|
||||
var _ConfigManager_applyData = ConfigManager.applyData;
|
||||
ConfigManager.applyData = function (config) {
|
||||
_ConfigManager_applyData.apply(this, arguments);
|
||||
if (config["alwaysDash"] === undefined) {
|
||||
this.alwaysDash = alwaysDash;
|
||||
}
|
||||
};
|
||||
|
||||
if (windowHeightTo) {
|
||||
windowHeight = windowHeightTo;
|
||||
} else if (screenHeight !== SceneManager._screenHeight) {
|
||||
windowHeight = screenHeight;
|
||||
var _SceneManager_initNwjs = SceneManager.initNwjs;
|
||||
SceneManager.initNwjs = function () {
|
||||
_SceneManager_initNwjs.apply(this, arguments);
|
||||
|
||||
if (Utils.isNwjs() && windowWidth && windowHeight) {
|
||||
var dw = windowWidth - window.innerWidth;
|
||||
var dh = windowHeight - window.innerHeight;
|
||||
window.moveBy(-dw / 2, -dh / 2);
|
||||
window.resizeBy(dw, dh);
|
||||
}
|
||||
|
||||
|
||||
ImageCache.limit = cacheLimit * 1000 * 1000;
|
||||
SceneManager._screenWidth = screenWidth;
|
||||
SceneManager._screenHeight = screenHeight;
|
||||
SceneManager._boxWidth = screenWidth;
|
||||
SceneManager._boxHeight = screenHeight;
|
||||
|
||||
SceneManager.preferableRendererType = function () {
|
||||
if (Utils.isOptionValid('canvas')) {
|
||||
return 'canvas';
|
||||
} else if (Utils.isOptionValid('webgl')) {
|
||||
return 'webgl';
|
||||
} else if (renderingMode === 'canvas') {
|
||||
return 'canvas';
|
||||
} else if (renderingMode === 'webgl') {
|
||||
return 'webgl';
|
||||
} else {
|
||||
return 'auto';
|
||||
}
|
||||
};
|
||||
|
||||
var _ConfigManager_applyData = ConfigManager.applyData;
|
||||
ConfigManager.applyData = function (config) {
|
||||
_ConfigManager_applyData.apply(this, arguments);
|
||||
if (config['alwaysDash'] === undefined) {
|
||||
this.alwaysDash = alwaysDash;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var _SceneManager_initNwjs = SceneManager.initNwjs;
|
||||
SceneManager.initNwjs = function () {
|
||||
_SceneManager_initNwjs.apply(this, arguments);
|
||||
|
||||
if (Utils.isNwjs() && windowWidth && windowHeight) {
|
||||
var dw = windowWidth - window.innerWidth;
|
||||
var dh = windowHeight - window.innerHeight;
|
||||
window.moveBy(-dw / 2, -dh / 2);
|
||||
window.resizeBy(dw, dh);
|
||||
}
|
||||
};
|
||||
})();
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -236,351 +236,403 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
var pluginName = 'DestinationWindow';
|
||||
var metaTagPrefix = 'DW_';
|
||||
"use strict";
|
||||
var pluginName = "DestinationWindow";
|
||||
var metaTagPrefix = "DW_";
|
||||
|
||||
//=============================================================================
|
||||
// ローカル関数
|
||||
// プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
|
||||
//=============================================================================
|
||||
var getParamString = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (var i = 0; i < paramNames.length; i++) {
|
||||
var name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return name;
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
var getParamNumber = function (paramNames, min, max) {
|
||||
var value = getParamString(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value) || 0).clamp(min, max);
|
||||
};
|
||||
|
||||
var getParamBoolean = function (paramNames) {
|
||||
var value = getParamString(paramNames);
|
||||
return value.toUpperCase() === 'ON' || value.toUpperCase() === 'TRUE';
|
||||
};
|
||||
|
||||
var getParamNumberArray = function (paramNames) {
|
||||
var value = PluginManager.parameters(pluginName)[paramNames];
|
||||
return JSON.parse(value)
|
||||
.map(function (e) { return Number(JSON.parse(e)); }, this);
|
||||
};
|
||||
|
||||
var getArgNumber = function (arg, min, max) {
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(arg) || 0).clamp(min, max);
|
||||
};
|
||||
|
||||
var concatAllArguments = function (args) {
|
||||
return args.reduce(function (prevValue, arg) {
|
||||
return prevValue + ' ' + arg;
|
||||
}, '').replace(/^ /, '');
|
||||
};
|
||||
|
||||
var setPluginCommand = function (commandName, methodName) {
|
||||
pluginCommandMap.set(metaTagPrefix + commandName, methodName);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
var param = {};
|
||||
param.showingSwitchId = getParamNumber(['ShowingSwitchId', '表示スイッチID'], 0);
|
||||
param.windowX = getParamNumber(['WindowX', 'ウィンドウX座標']);
|
||||
param.windowY = getParamNumber(['WindowY', 'ウィンドウY座標']);
|
||||
param.windowWidth = getParamNumber(['WindowWidth', 'ウィンドウ横幅'], 1);
|
||||
param.windowSkin = getParamString(['WindowSkin', 'ウィンドウスキン名']);
|
||||
param.windowOpacity = getParamNumber(['WindowOpacity', 'ウィンドウ不透明度']);
|
||||
param.fadeFrame = getParamNumber(['FadeFrame', 'フェード時間'], 1);
|
||||
param.fontSize = getParamNumber(['FontSize', 'フォントサイズ'], 12);
|
||||
param.closeEventRunning = getParamBoolean(['CloseEventRunning', 'イベント中は閉じる']);
|
||||
param.showingInMenu = getParamBoolean(['ShowingInMenu', 'メニュー画面に表示']);
|
||||
param.autoAdjust = getParamBoolean(['AutoAdjust', '自働調整']);
|
||||
param.showingFrames = getParamNumber(['ShowingFrames', '表示フレーム数'], 0);
|
||||
param.textAlign = getParamNumber(['TextAlign', '文字列揃え'], 0);
|
||||
param.noDestinationWindowMapIds = getParamNumberArray(['NoDestinationWindowMapIds']);
|
||||
|
||||
var pluginCommandMap = new Map();
|
||||
setPluginCommand('目標設定', 'execSetDestination');
|
||||
setPluginCommand('SET_DESTINATION', 'execSetDestination');
|
||||
setPluginCommand('アイコン付き目標設定', 'execSetDestinationWithIcon');
|
||||
setPluginCommand('SET_DESTINATION_WITH_ICON', 'execSetDestinationWithIcon');
|
||||
|
||||
var _extractMetadata = DataManager.extractMetadata;
|
||||
DataManager.extractMetadata = function (data) {
|
||||
_extractMetadata.call(this, data);
|
||||
if (data === $dataMap) {
|
||||
if (data.meta.noDestinationWindow) {
|
||||
data.noDestinationWindow = true;
|
||||
} else {
|
||||
data.noDestinationWindow = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Interpreter
|
||||
// プラグインコマンドを追加定義します。
|
||||
//=============================================================================
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
var pluginCommandMethod = pluginCommandMap.get(command.toUpperCase());
|
||||
if (pluginCommandMethod) {
|
||||
this[pluginCommandMethod](args);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.execSetDestination = function (args) {
|
||||
$gameSystem.setDestinationIcon(null);
|
||||
$gameSystem.setDestination(concatAllArguments(args));
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.execSetDestinationWithIcon = function (args) {
|
||||
var icon = args.shift();
|
||||
$gameSystem.setDestinationIcon(icon);
|
||||
$gameSystem.setDestination(concatAllArguments(args));
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_System
|
||||
// 目標テキストを追加定義します。
|
||||
//=============================================================================
|
||||
Game_System.prototype.setDestination = function (value) {
|
||||
this._destinationTextList = value.split('\\n');
|
||||
this.resetDestinationFrame();
|
||||
};
|
||||
|
||||
Game_System.prototype.getDestination = function () {
|
||||
return this._destinationTextList || [];
|
||||
};
|
||||
|
||||
Game_System.prototype.setDestinationIcon = function (value) {
|
||||
this._destinationIconIndex = value;
|
||||
};
|
||||
|
||||
Game_System.prototype.getDestinationIcon = function () {
|
||||
return this._destinationIconIndex || '';
|
||||
};
|
||||
|
||||
Game_System.prototype.resetDestinationFrame = function () {
|
||||
this._destinationFrame = 0;
|
||||
};
|
||||
|
||||
Game_System.prototype.isOverDestinationFrame = function () {
|
||||
this._destinationFrame++;
|
||||
return param.showingFrames > 0 ? param.showingFrames <= this._destinationFrame : false;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Map
|
||||
// 行動目標ウィンドウ非表示マップであるかを判定します。
|
||||
//=============================================================================
|
||||
Game_Map.prototype.isNoDestinationWindowMap = function () {
|
||||
return param.noDestinationWindowMapIds.some(function (mapId) {
|
||||
return mapId === this.mapId();
|
||||
}, this) || $dataMap.noDestinationWindow;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Map
|
||||
// 行動目標ウィンドウを生成します。
|
||||
//=============================================================================
|
||||
var _Scene_Map_createMapNameWindow = Scene_Map.prototype.createMapNameWindow;
|
||||
Scene_Map.prototype.createMapNameWindow = function () {
|
||||
this.createDestinationWindow();
|
||||
_Scene_Map_createMapNameWindow.apply(this, arguments);
|
||||
};
|
||||
|
||||
Scene_Map.prototype.createDestinationWindow = function () {
|
||||
this._destinationWindow = new Window_Destination(param.windowX, param.windowY, param.windowWidth);
|
||||
this.addChild(this._destinationWindow);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Menu
|
||||
// メニュー画面にも表示できるようにします。
|
||||
//=============================================================================
|
||||
var _Scene_Menu_create = Scene_Menu.prototype.create;
|
||||
Scene_Menu.prototype.create = function () {
|
||||
_Scene_Menu_create.apply(this, arguments);
|
||||
if (param.showingInMenu) {
|
||||
this.createDestinationWindow();
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Menu.prototype.createDestinationWindow = function () {
|
||||
var y, width, height;
|
||||
if (this._commandWindow.maxCols() === 1) {
|
||||
y = this._commandWindow.y + this._commandWindow.height;
|
||||
width = this._commandWindow.width;
|
||||
height = null;
|
||||
} else {
|
||||
y = this._goldWindow.y;
|
||||
width = param.windowWidth;
|
||||
height = this._goldWindow.height;
|
||||
}
|
||||
this._destinationWindow = new Window_DestinationMenu(0, y, width, height);
|
||||
this.addWindow(this._destinationWindow);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_Destination
|
||||
// 行動目標ウィンドウです。
|
||||
//=============================================================================
|
||||
function Window_Destination() {
|
||||
this.initialize.apply(this, arguments);
|
||||
//=============================================================================
|
||||
// ローカル関数
|
||||
// プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
|
||||
//=============================================================================
|
||||
var getParamString = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (var i = 0; i < paramNames.length; i++) {
|
||||
var name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return name;
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
Window_Destination.prototype = Object.create(Window_Base.prototype);
|
||||
Window_Destination.prototype.constructor = Window_Destination;
|
||||
var getParamNumber = function (paramNames, min, max) {
|
||||
var value = getParamString(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value) || 0).clamp(min, max);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.initialize = function (x, y, width, height) {
|
||||
Window_Base.prototype.initialize.call(this, x, y, width, height || this.fittingHeight(1));
|
||||
this._text = '';
|
||||
this._textList = [];
|
||||
this._iconIndex = 0;
|
||||
this.update();
|
||||
this.opacity = this.isVisible() ? 255 : 0;
|
||||
};
|
||||
var getParamBoolean = function (paramNames) {
|
||||
var value = getParamString(paramNames);
|
||||
return value.toUpperCase() === "ON" || value.toUpperCase() === "TRUE";
|
||||
};
|
||||
|
||||
Window_Destination.prototype.loadWindowskin = function () {
|
||||
if (param.windowSkin) {
|
||||
this.windowskin = ImageManager.loadSystem(param.windowSkin);
|
||||
} else {
|
||||
Window_Base.prototype.loadWindowskin.call(this);
|
||||
}
|
||||
};
|
||||
var getParamNumberArray = function (paramNames) {
|
||||
var value = PluginManager.parameters(pluginName)[paramNames];
|
||||
return JSON.parse(value).map(function (e) {
|
||||
return Number(JSON.parse(e));
|
||||
}, this);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.lineHeight = function () {
|
||||
return Math.max(this.standardFontSize() + 8, Window_Base._iconHeight);
|
||||
};
|
||||
var getArgNumber = function (arg, min, max) {
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(arg) || 0).clamp(min, max);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.standardFontSize = function () {
|
||||
return param.fontSize || Window_Base.prototype.standardFontSize.call(this);
|
||||
};
|
||||
var concatAllArguments = function (args) {
|
||||
return args
|
||||
.reduce(function (prevValue, arg) {
|
||||
return prevValue + " " + arg;
|
||||
}, "")
|
||||
.replace(/^ /, "");
|
||||
};
|
||||
|
||||
Window_Destination.prototype.standardBackOpacity = function () {
|
||||
return param.windowOpacity || Window_Base.prototype.standardBackOpacity.call(this);
|
||||
};
|
||||
var setPluginCommand = function (commandName, methodName) {
|
||||
pluginCommandMap.set(metaTagPrefix + commandName, methodName);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.standardPadding = function () {
|
||||
return 12;
|
||||
};
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
var param = {};
|
||||
param.showingSwitchId = getParamNumber(
|
||||
["ShowingSwitchId", "表示スイッチID"],
|
||||
0
|
||||
);
|
||||
param.windowX = getParamNumber(["WindowX", "ウィンドウX座標"]);
|
||||
param.windowY = getParamNumber(["WindowY", "ウィンドウY座標"]);
|
||||
param.windowWidth = getParamNumber(["WindowWidth", "ウィンドウ横幅"], 1);
|
||||
param.windowSkin = getParamString(["WindowSkin", "ウィンドウスキン名"]);
|
||||
param.windowOpacity = getParamNumber(["WindowOpacity", "ウィンドウ不透明度"]);
|
||||
param.fadeFrame = getParamNumber(["FadeFrame", "フェード時間"], 1);
|
||||
param.fontSize = getParamNumber(["FontSize", "フォントサイズ"], 12);
|
||||
param.closeEventRunning = getParamBoolean([
|
||||
"CloseEventRunning",
|
||||
"イベント中は閉じる",
|
||||
]);
|
||||
param.showingInMenu = getParamBoolean([
|
||||
"ShowingInMenu",
|
||||
"メニュー画面に表示",
|
||||
]);
|
||||
param.autoAdjust = getParamBoolean(["AutoAdjust", "自働調整"]);
|
||||
param.showingFrames = getParamNumber(["ShowingFrames", "表示フレーム数"], 0);
|
||||
param.textAlign = getParamNumber(["TextAlign", "文字列揃え"], 0);
|
||||
param.noDestinationWindowMapIds = getParamNumberArray([
|
||||
"NoDestinationWindowMapIds",
|
||||
]);
|
||||
|
||||
Window_Destination.prototype.update = function () {
|
||||
Window_Base.prototype.update.call(this);
|
||||
if (!this.windowskin.isReady()) return;
|
||||
this.updateText();
|
||||
this.updateOpacity();
|
||||
};
|
||||
var pluginCommandMap = new Map();
|
||||
setPluginCommand("目標設定", "execSetDestination");
|
||||
setPluginCommand("SET_DESTINATION", "execSetDestination");
|
||||
setPluginCommand("アイコン付き目標設定", "execSetDestinationWithIcon");
|
||||
setPluginCommand("SET_DESTINATION_WITH_ICON", "execSetDestinationWithIcon");
|
||||
|
||||
Window_Destination.prototype.updateOpacity = function () {
|
||||
if (this.isVisible()) {
|
||||
this.setOpacity(this.opacity + this.getFadeValue());
|
||||
} else {
|
||||
this.setOpacity(this.opacity - this.getFadeValue());
|
||||
}
|
||||
this.visible = (this.opacity > 0);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.updateText = function () {
|
||||
var textList = $gameSystem.getDestination();
|
||||
var iconIndex = getArgNumber(this.convertEscapeCharacters($gameSystem.getDestinationIcon()), 0);
|
||||
if (textList.length !== this._textList.length) {
|
||||
this.height = this.fittingHeight(textList.length);
|
||||
this.createContents();
|
||||
this._textList = [];
|
||||
}
|
||||
textList.forEach(function (text, index) {
|
||||
text = this.convertEscapeCharacters(text);
|
||||
if (this._textList[index] === text && this._iconIndex === iconIndex) {
|
||||
return;
|
||||
}
|
||||
this._textList[index] = text;
|
||||
this._text = text;
|
||||
this._iconIndex = iconIndex;
|
||||
this.drawDestination(index);
|
||||
}, this);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.drawDestination = function (lineNumber) {
|
||||
this.contents.clearRect(0, lineNumber * this.lineHeight(), this.contentsWidth(), this.lineHeight());
|
||||
var x = this.getContentsX();
|
||||
var y = lineNumber * this.lineHeight() + this.lineHeight() / 2 - this.contents.fontSize / 2 - 4;
|
||||
if (this._iconIndex > 0 && lineNumber === 0) {
|
||||
this.drawIcon(this._iconIndex, x, y);
|
||||
x += Window_Base._iconWidth;
|
||||
}
|
||||
if (param.autoAdjust) {
|
||||
this.resetTextColor();
|
||||
this.drawText(this._text, x, y, this.contentsWidth() - x);
|
||||
} else {
|
||||
this.drawTextEx(this._text, x, y);
|
||||
}
|
||||
};
|
||||
|
||||
Window_Destination.prototype.getContentsX = function () {
|
||||
if (param.textAlign === 0) {
|
||||
return 0;
|
||||
}
|
||||
var width = param.autoAdjust ? this.textWidth(this._text) : this.drawTextEx(this._text, 0, -this.lineHeight());
|
||||
if (this._iconIndex > 0) {
|
||||
width += Window_Base._iconWidth;
|
||||
}
|
||||
var division = (param.textAlign === 1 ? 2 : 1);
|
||||
return this.contentsWidth() / division - width / division;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.setOpacity = function (value) {
|
||||
this.opacity = value;
|
||||
this.contentsOpacity = value;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.getFadeValue = function () {
|
||||
return 255 / param.fadeFrame;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isVisible = function () {
|
||||
return $gameSwitches.value(param.showingSwitchId) && !this.isEventRunning() &&
|
||||
this.isExistText() && !this.isOverFrame() && !this.isNoDestinationWindowMap();
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isOverFrame = function () {
|
||||
return $gameSystem.isOverDestinationFrame();
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isExistText = function () {
|
||||
return this._textList.length > 0 || !!this._iconIndex;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isEventRunning = function () {
|
||||
return $gameMap.isEventRunning() && param.closeEventRunning;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isNoDestinationWindowMap = function () {
|
||||
return $gameMap.isNoDestinationWindowMap();
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_DestinationMenu
|
||||
// メニュー画面の行動目標ウィンドウです。
|
||||
//=============================================================================
|
||||
function Window_DestinationMenu() {
|
||||
this.initialize.apply(this, arguments);
|
||||
var _extractMetadata = DataManager.extractMetadata;
|
||||
DataManager.extractMetadata = function (data) {
|
||||
_extractMetadata.call(this, data);
|
||||
if (data === $dataMap) {
|
||||
if (data.meta.noDestinationWindow) {
|
||||
data.noDestinationWindow = true;
|
||||
} else {
|
||||
data.noDestinationWindow = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Window_DestinationMenu.prototype = Object.create(Window_Destination.prototype);
|
||||
Window_DestinationMenu.prototype.constructor = Window_DestinationMenu;
|
||||
//=============================================================================
|
||||
// Game_Interpreter
|
||||
// プラグインコマンドを追加定義します。
|
||||
//=============================================================================
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
var pluginCommandMethod = pluginCommandMap.get(command.toUpperCase());
|
||||
if (pluginCommandMethod) {
|
||||
this[pluginCommandMethod](args);
|
||||
}
|
||||
};
|
||||
|
||||
Window_DestinationMenu.prototype.isOverFrame = function () {
|
||||
return false;
|
||||
};
|
||||
Game_Interpreter.prototype.execSetDestination = function (args) {
|
||||
$gameSystem.setDestinationIcon(null);
|
||||
$gameSystem.setDestination(concatAllArguments(args));
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.execSetDestinationWithIcon = function (args) {
|
||||
var icon = args.shift();
|
||||
$gameSystem.setDestinationIcon(icon);
|
||||
$gameSystem.setDestination(concatAllArguments(args));
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_System
|
||||
// 目標テキストを追加定義します。
|
||||
//=============================================================================
|
||||
Game_System.prototype.setDestination = function (value) {
|
||||
this._destinationTextList = value.split("\\n");
|
||||
this.resetDestinationFrame();
|
||||
};
|
||||
|
||||
Game_System.prototype.getDestination = function () {
|
||||
return this._destinationTextList || [];
|
||||
};
|
||||
|
||||
Game_System.prototype.setDestinationIcon = function (value) {
|
||||
this._destinationIconIndex = value;
|
||||
};
|
||||
|
||||
Game_System.prototype.getDestinationIcon = function () {
|
||||
return this._destinationIconIndex || "";
|
||||
};
|
||||
|
||||
Game_System.prototype.resetDestinationFrame = function () {
|
||||
this._destinationFrame = 0;
|
||||
};
|
||||
|
||||
Game_System.prototype.isOverDestinationFrame = function () {
|
||||
this._destinationFrame++;
|
||||
return param.showingFrames > 0
|
||||
? param.showingFrames <= this._destinationFrame
|
||||
: false;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Map
|
||||
// 行動目標ウィンドウ非表示マップであるかを判定します。
|
||||
//=============================================================================
|
||||
Game_Map.prototype.isNoDestinationWindowMap = function () {
|
||||
return (
|
||||
param.noDestinationWindowMapIds.some(function (mapId) {
|
||||
return mapId === this.mapId();
|
||||
}, this) || $dataMap.noDestinationWindow
|
||||
);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Map
|
||||
// 行動目標ウィンドウを生成します。
|
||||
//=============================================================================
|
||||
var _Scene_Map_createMapNameWindow = Scene_Map.prototype.createMapNameWindow;
|
||||
Scene_Map.prototype.createMapNameWindow = function () {
|
||||
this.createDestinationWindow();
|
||||
_Scene_Map_createMapNameWindow.apply(this, arguments);
|
||||
};
|
||||
|
||||
Scene_Map.prototype.createDestinationWindow = function () {
|
||||
this._destinationWindow = new Window_Destination(
|
||||
param.windowX,
|
||||
param.windowY,
|
||||
param.windowWidth
|
||||
);
|
||||
this.addChild(this._destinationWindow);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Menu
|
||||
// メニュー画面にも表示できるようにします。
|
||||
//=============================================================================
|
||||
var _Scene_Menu_create = Scene_Menu.prototype.create;
|
||||
Scene_Menu.prototype.create = function () {
|
||||
_Scene_Menu_create.apply(this, arguments);
|
||||
if (param.showingInMenu) {
|
||||
this.createDestinationWindow();
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Menu.prototype.createDestinationWindow = function () {
|
||||
var y, width, height;
|
||||
if (this._commandWindow.maxCols() === 1) {
|
||||
y = this._commandWindow.y + this._commandWindow.height;
|
||||
width = this._commandWindow.width;
|
||||
height = null;
|
||||
} else {
|
||||
y = this._goldWindow.y;
|
||||
width = param.windowWidth;
|
||||
height = this._goldWindow.height;
|
||||
}
|
||||
this._destinationWindow = new Window_DestinationMenu(0, y, width, height);
|
||||
this.addWindow(this._destinationWindow);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_Destination
|
||||
// 行動目標ウィンドウです。
|
||||
//=============================================================================
|
||||
function Window_Destination() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_Destination.prototype = Object.create(Window_Base.prototype);
|
||||
Window_Destination.prototype.constructor = Window_Destination;
|
||||
|
||||
Window_Destination.prototype.initialize = function (x, y, width, height) {
|
||||
Window_Base.prototype.initialize.call(
|
||||
this,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height || this.fittingHeight(1)
|
||||
);
|
||||
this._text = "";
|
||||
this._textList = [];
|
||||
this._iconIndex = 0;
|
||||
this.update();
|
||||
this.opacity = this.isVisible() ? 255 : 0;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.loadWindowskin = function () {
|
||||
if (param.windowSkin) {
|
||||
this.windowskin = ImageManager.loadSystem(param.windowSkin);
|
||||
} else {
|
||||
Window_Base.prototype.loadWindowskin.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
Window_Destination.prototype.lineHeight = function () {
|
||||
return Math.max(this.standardFontSize() + 8, Window_Base._iconHeight);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.standardFontSize = function () {
|
||||
return param.fontSize || Window_Base.prototype.standardFontSize.call(this);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.standardBackOpacity = function () {
|
||||
return (
|
||||
param.windowOpacity ||
|
||||
Window_Base.prototype.standardBackOpacity.call(this)
|
||||
);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.standardPadding = function () {
|
||||
return 12;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.update = function () {
|
||||
Window_Base.prototype.update.call(this);
|
||||
if (!this.windowskin.isReady()) return;
|
||||
this.updateText();
|
||||
this.updateOpacity();
|
||||
};
|
||||
|
||||
Window_Destination.prototype.updateOpacity = function () {
|
||||
if (this.isVisible()) {
|
||||
this.setOpacity(this.opacity + this.getFadeValue());
|
||||
} else {
|
||||
this.setOpacity(this.opacity - this.getFadeValue());
|
||||
}
|
||||
this.visible = this.opacity > 0;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.updateText = function () {
|
||||
var textList = $gameSystem.getDestination();
|
||||
var iconIndex = getArgNumber(
|
||||
this.convertEscapeCharacters($gameSystem.getDestinationIcon()),
|
||||
0
|
||||
);
|
||||
if (textList.length !== this._textList.length) {
|
||||
this.height = this.fittingHeight(textList.length);
|
||||
this.createContents();
|
||||
this._textList = [];
|
||||
}
|
||||
textList.forEach(function (text, index) {
|
||||
text = this.convertEscapeCharacters(text);
|
||||
if (this._textList[index] === text && this._iconIndex === iconIndex) {
|
||||
return;
|
||||
}
|
||||
this._textList[index] = text;
|
||||
this._text = text;
|
||||
this._iconIndex = iconIndex;
|
||||
this.drawDestination(index);
|
||||
}, this);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.drawDestination = function (lineNumber) {
|
||||
this.contents.clearRect(
|
||||
0,
|
||||
lineNumber * this.lineHeight(),
|
||||
this.contentsWidth(),
|
||||
this.lineHeight()
|
||||
);
|
||||
var x = this.getContentsX();
|
||||
var y =
|
||||
lineNumber * this.lineHeight() +
|
||||
this.lineHeight() / 2 -
|
||||
this.contents.fontSize / 2 -
|
||||
4;
|
||||
if (this._iconIndex > 0 && lineNumber === 0) {
|
||||
this.drawIcon(this._iconIndex, x, y);
|
||||
x += Window_Base._iconWidth;
|
||||
}
|
||||
if (param.autoAdjust) {
|
||||
this.resetTextColor();
|
||||
this.drawText(this._text, x, y, this.contentsWidth() - x);
|
||||
} else {
|
||||
this.drawTextEx(this._text, x, y);
|
||||
}
|
||||
};
|
||||
|
||||
Window_Destination.prototype.getContentsX = function () {
|
||||
if (param.textAlign === 0) {
|
||||
return 0;
|
||||
}
|
||||
var width = param.autoAdjust
|
||||
? this.textWidth(this._text)
|
||||
: this.drawTextEx(this._text, 0, -this.lineHeight());
|
||||
if (this._iconIndex > 0) {
|
||||
width += Window_Base._iconWidth;
|
||||
}
|
||||
var division = param.textAlign === 1 ? 2 : 1;
|
||||
return this.contentsWidth() / division - width / division;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.setOpacity = function (value) {
|
||||
this.opacity = value;
|
||||
this.contentsOpacity = value;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.getFadeValue = function () {
|
||||
return 255 / param.fadeFrame;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isVisible = function () {
|
||||
return (
|
||||
$gameSwitches.value(param.showingSwitchId) &&
|
||||
!this.isEventRunning() &&
|
||||
this.isExistText() &&
|
||||
!this.isOverFrame() &&
|
||||
!this.isNoDestinationWindowMap()
|
||||
);
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isOverFrame = function () {
|
||||
return $gameSystem.isOverDestinationFrame();
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isExistText = function () {
|
||||
return this._textList.length > 0 || !!this._iconIndex;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isEventRunning = function () {
|
||||
return $gameMap.isEventRunning() && param.closeEventRunning;
|
||||
};
|
||||
|
||||
Window_Destination.prototype.isNoDestinationWindowMap = function () {
|
||||
return $gameMap.isNoDestinationWindowMap();
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_DestinationMenu
|
||||
// メニュー画面の行動目標ウィンドウです。
|
||||
//=============================================================================
|
||||
function Window_DestinationMenu() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_DestinationMenu.prototype = Object.create(
|
||||
Window_Destination.prototype
|
||||
);
|
||||
Window_DestinationMenu.prototype.constructor = Window_DestinationMenu;
|
||||
|
||||
Window_DestinationMenu.prototype.isOverFrame = function () {
|
||||
return false;
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
|
|||
|
|
@ -49,299 +49,297 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
var parameters = PluginManager.parameters("EnemyBook");
|
||||
var unknownData = String(parameters["Unknown Data"] || "??????");
|
||||
|
||||
var parameters = PluginManager.parameters('EnemyBook');
|
||||
var unknownData = String(parameters['Unknown Data'] || '??????');
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === "EnemyBook") {
|
||||
switch (args[0]) {
|
||||
case "open":
|
||||
SceneManager.push(Scene_EnemyBook);
|
||||
break;
|
||||
case "add":
|
||||
$gameSystem.addToEnemyBook(Number(args[1]));
|
||||
break;
|
||||
case "remove":
|
||||
$gameSystem.removeFromEnemyBook(Number(args[1]));
|
||||
break;
|
||||
case "complete":
|
||||
$gameSystem.completeEnemyBook();
|
||||
break;
|
||||
case "clear":
|
||||
$gameSystem.clearEnemyBook();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'EnemyBook') {
|
||||
switch (args[0]) {
|
||||
case 'open':
|
||||
SceneManager.push(Scene_EnemyBook);
|
||||
break;
|
||||
case 'add':
|
||||
$gameSystem.addToEnemyBook(Number(args[1]));
|
||||
break;
|
||||
case 'remove':
|
||||
$gameSystem.removeFromEnemyBook(Number(args[1]));
|
||||
break;
|
||||
case 'complete':
|
||||
$gameSystem.completeEnemyBook();
|
||||
break;
|
||||
case 'clear':
|
||||
$gameSystem.clearEnemyBook();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
Game_System.prototype.addToEnemyBook = function (enemyId) {
|
||||
if (!this._enemyBookFlags) {
|
||||
this.clearEnemyBook();
|
||||
}
|
||||
this._enemyBookFlags[enemyId] = true;
|
||||
};
|
||||
|
||||
Game_System.prototype.addToEnemyBook = function (enemyId) {
|
||||
if (!this._enemyBookFlags) {
|
||||
this.clearEnemyBook();
|
||||
}
|
||||
this._enemyBookFlags[enemyId] = true;
|
||||
};
|
||||
Game_System.prototype.removeFromEnemyBook = function (enemyId) {
|
||||
if (this._enemyBookFlags) {
|
||||
this._enemyBookFlags[enemyId] = false;
|
||||
}
|
||||
};
|
||||
|
||||
Game_System.prototype.removeFromEnemyBook = function (enemyId) {
|
||||
if (this._enemyBookFlags) {
|
||||
this._enemyBookFlags[enemyId] = false;
|
||||
}
|
||||
};
|
||||
Game_System.prototype.completeEnemyBook = function () {
|
||||
this.clearEnemyBook();
|
||||
for (var i = 1; i < $dataEnemies.length; i++) {
|
||||
this._enemyBookFlags[i] = true;
|
||||
}
|
||||
};
|
||||
|
||||
Game_System.prototype.completeEnemyBook = function () {
|
||||
this.clearEnemyBook();
|
||||
for (var i = 1; i < $dataEnemies.length; i++) {
|
||||
this._enemyBookFlags[i] = true;
|
||||
}
|
||||
};
|
||||
Game_System.prototype.clearEnemyBook = function () {
|
||||
this._enemyBookFlags = [];
|
||||
};
|
||||
|
||||
Game_System.prototype.clearEnemyBook = function () {
|
||||
this._enemyBookFlags = [];
|
||||
};
|
||||
Game_System.prototype.isInEnemyBook = function (enemy) {
|
||||
if (this._enemyBookFlags && enemy) {
|
||||
return !!this._enemyBookFlags[enemy.id];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Game_System.prototype.isInEnemyBook = function (enemy) {
|
||||
if (this._enemyBookFlags && enemy) {
|
||||
return !!this._enemyBookFlags[enemy.id];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var _Game_Troop_setup = Game_Troop.prototype.setup;
|
||||
Game_Troop.prototype.setup = function (troopId) {
|
||||
_Game_Troop_setup.call(this, troopId);
|
||||
this.members().forEach(function (enemy) {
|
||||
if (enemy.isAppeared()) {
|
||||
$gameSystem.addToEnemyBook(enemy.enemyId());
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
|
||||
var _Game_Troop_setup = Game_Troop.prototype.setup;
|
||||
Game_Troop.prototype.setup = function (troopId) {
|
||||
_Game_Troop_setup.call(this, troopId);
|
||||
this.members().forEach(function (enemy) {
|
||||
if (enemy.isAppeared()) {
|
||||
$gameSystem.addToEnemyBook(enemy.enemyId());
|
||||
}
|
||||
}, this);
|
||||
};
|
||||
var _Game_Enemy_appear = Game_Enemy.prototype.appear;
|
||||
Game_Enemy.prototype.appear = function () {
|
||||
_Game_Enemy_appear.call(this);
|
||||
$gameSystem.addToEnemyBook(this._enemyId);
|
||||
};
|
||||
|
||||
var _Game_Enemy_appear = Game_Enemy.prototype.appear;
|
||||
Game_Enemy.prototype.appear = function () {
|
||||
_Game_Enemy_appear.call(this);
|
||||
$gameSystem.addToEnemyBook(this._enemyId);
|
||||
};
|
||||
var _Game_Enemy_transform = Game_Enemy.prototype.transform;
|
||||
Game_Enemy.prototype.transform = function (enemyId) {
|
||||
_Game_Enemy_transform.call(this, enemyId);
|
||||
$gameSystem.addToEnemyBook(enemyId);
|
||||
};
|
||||
|
||||
var _Game_Enemy_transform = Game_Enemy.prototype.transform;
|
||||
Game_Enemy.prototype.transform = function (enemyId) {
|
||||
_Game_Enemy_transform.call(this, enemyId);
|
||||
$gameSystem.addToEnemyBook(enemyId);
|
||||
};
|
||||
function Scene_EnemyBook() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
function Scene_EnemyBook() {
|
||||
this.initialize.apply(this, arguments);
|
||||
Scene_EnemyBook.prototype = Object.create(Scene_MenuBase.prototype);
|
||||
Scene_EnemyBook.prototype.constructor = Scene_EnemyBook;
|
||||
|
||||
Scene_EnemyBook.prototype.initialize = function () {
|
||||
Scene_MenuBase.prototype.initialize.call(this);
|
||||
};
|
||||
|
||||
Scene_EnemyBook.prototype.create = function () {
|
||||
Scene_MenuBase.prototype.create.call(this);
|
||||
this._indexWindow = new Window_EnemyBookIndex(0, 0);
|
||||
this._indexWindow.setHandler("cancel", this.popScene.bind(this));
|
||||
var wy = this._indexWindow.height;
|
||||
var ww = Graphics.boxWidth;
|
||||
var wh = Graphics.boxHeight - wy;
|
||||
this._statusWindow = new Window_EnemyBookStatus(0, wy, ww, wh);
|
||||
this.addWindow(this._indexWindow);
|
||||
this.addWindow(this._statusWindow);
|
||||
this._indexWindow.setStatusWindow(this._statusWindow);
|
||||
};
|
||||
|
||||
function Window_EnemyBookIndex() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_EnemyBookIndex.prototype = Object.create(Window_Selectable.prototype);
|
||||
Window_EnemyBookIndex.prototype.constructor = Window_EnemyBookIndex;
|
||||
|
||||
Window_EnemyBookIndex.lastTopRow = 0;
|
||||
Window_EnemyBookIndex.lastIndex = 0;
|
||||
|
||||
Window_EnemyBookIndex.prototype.initialize = function (x, y) {
|
||||
var width = Graphics.boxWidth;
|
||||
var height = this.fittingHeight(6);
|
||||
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
|
||||
this.refresh();
|
||||
this.setTopRow(Window_EnemyBookIndex.lastTopRow);
|
||||
this.select(Window_EnemyBookIndex.lastIndex);
|
||||
this.activate();
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.maxCols = function () {
|
||||
return 3;
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.maxItems = function () {
|
||||
return this._list ? this._list.length : 0;
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.setStatusWindow = function (statusWindow) {
|
||||
this._statusWindow = statusWindow;
|
||||
this.updateStatus();
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.update = function () {
|
||||
Window_Selectable.prototype.update.call(this);
|
||||
this.updateStatus();
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.updateStatus = function () {
|
||||
if (this._statusWindow) {
|
||||
var enemy = this._list[this.index()];
|
||||
this._statusWindow.setEnemy(enemy);
|
||||
}
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.refresh = function () {
|
||||
this._list = [];
|
||||
for (var i = 1; i < $dataEnemies.length; i++) {
|
||||
var enemy = $dataEnemies[i];
|
||||
if (enemy.name && enemy.meta.book !== "no") {
|
||||
this._list.push(enemy);
|
||||
}
|
||||
}
|
||||
this.createContents();
|
||||
this.drawAllItems();
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.drawItem = function (index) {
|
||||
var enemy = this._list[index];
|
||||
var rect = this.itemRectForText(index);
|
||||
var name;
|
||||
if ($gameSystem.isInEnemyBook(enemy)) {
|
||||
name = enemy.name;
|
||||
} else {
|
||||
name = unknownData;
|
||||
}
|
||||
this.drawText(name, rect.x, rect.y, rect.width);
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.processCancel = function () {
|
||||
Window_Selectable.prototype.processCancel.call(this);
|
||||
Window_EnemyBookIndex.lastTopRow = this.topRow();
|
||||
Window_EnemyBookIndex.lastIndex = this.index();
|
||||
};
|
||||
|
||||
function Window_EnemyBookStatus() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_EnemyBookStatus.prototype = Object.create(Window_Base.prototype);
|
||||
Window_EnemyBookStatus.prototype.constructor = Window_EnemyBookStatus;
|
||||
|
||||
Window_EnemyBookStatus.prototype.initialize = function (x, y, width, height) {
|
||||
Window_Base.prototype.initialize.call(this, x, y, width, height);
|
||||
this._enemy = null;
|
||||
this._enemySprite = new Sprite();
|
||||
this._enemySprite.anchor.x = 0.5;
|
||||
this._enemySprite.anchor.y = 0.5;
|
||||
this._enemySprite.x = width / 2 - 20;
|
||||
this._enemySprite.y = height / 2;
|
||||
this.addChildToBack(this._enemySprite);
|
||||
this.refresh();
|
||||
};
|
||||
|
||||
Window_EnemyBookStatus.prototype.setEnemy = function (enemy) {
|
||||
if (this._enemy !== enemy) {
|
||||
this._enemy = enemy;
|
||||
this.refresh();
|
||||
}
|
||||
};
|
||||
|
||||
Window_EnemyBookStatus.prototype.update = function () {
|
||||
Window_Base.prototype.update.call(this);
|
||||
if (this._enemySprite.bitmap) {
|
||||
var bitmapHeight = this._enemySprite.bitmap.height;
|
||||
var contentsHeight = this.contents.height;
|
||||
var scale = 1;
|
||||
if (bitmapHeight > contentsHeight) {
|
||||
scale = contentsHeight / bitmapHeight;
|
||||
}
|
||||
this._enemySprite.scale.x = scale;
|
||||
this._enemySprite.scale.y = scale;
|
||||
}
|
||||
};
|
||||
|
||||
Window_EnemyBookStatus.prototype.refresh = function () {
|
||||
var enemy = this._enemy;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
var lineHeight = this.lineHeight();
|
||||
|
||||
this.contents.clear();
|
||||
|
||||
if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
|
||||
this._enemySprite.bitmap = null;
|
||||
return;
|
||||
}
|
||||
|
||||
Scene_EnemyBook.prototype = Object.create(Scene_MenuBase.prototype);
|
||||
Scene_EnemyBook.prototype.constructor = Scene_EnemyBook;
|
||||
var name = enemy.battlerName;
|
||||
var hue = enemy.battlerHue;
|
||||
var bitmap;
|
||||
if ($gameSystem.isSideView()) {
|
||||
bitmap = ImageManager.loadSvEnemy(name, hue);
|
||||
} else {
|
||||
bitmap = ImageManager.loadEnemy(name, hue);
|
||||
}
|
||||
this._enemySprite.bitmap = bitmap;
|
||||
|
||||
Scene_EnemyBook.prototype.initialize = function () {
|
||||
Scene_MenuBase.prototype.initialize.call(this);
|
||||
};
|
||||
this.resetTextColor();
|
||||
this.drawText(enemy.name, x, y);
|
||||
|
||||
Scene_EnemyBook.prototype.create = function () {
|
||||
Scene_MenuBase.prototype.create.call(this);
|
||||
this._indexWindow = new Window_EnemyBookIndex(0, 0);
|
||||
this._indexWindow.setHandler('cancel', this.popScene.bind(this));
|
||||
var wy = this._indexWindow.height;
|
||||
var ww = Graphics.boxWidth;
|
||||
var wh = Graphics.boxHeight - wy;
|
||||
this._statusWindow = new Window_EnemyBookStatus(0, wy, ww, wh);
|
||||
this.addWindow(this._indexWindow);
|
||||
this.addWindow(this._statusWindow);
|
||||
this._indexWindow.setStatusWindow(this._statusWindow);
|
||||
};
|
||||
x = this.textPadding();
|
||||
y = lineHeight + this.textPadding();
|
||||
|
||||
function Window_EnemyBookIndex() {
|
||||
this.initialize.apply(this, arguments);
|
||||
for (var i = 0; i < 8; i++) {
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(TextManager.param(i), x, y, 160);
|
||||
this.resetTextColor();
|
||||
this.drawText(enemy.params[i], x + 160, y, 60, "right");
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
Window_EnemyBookIndex.prototype = Object.create(Window_Selectable.prototype);
|
||||
Window_EnemyBookIndex.prototype.constructor = Window_EnemyBookIndex;
|
||||
var rewardsWidth = 280;
|
||||
x = this.contents.width - rewardsWidth;
|
||||
y = lineHeight + this.textPadding();
|
||||
|
||||
Window_EnemyBookIndex.lastTopRow = 0;
|
||||
Window_EnemyBookIndex.lastIndex = 0;
|
||||
this.resetTextColor();
|
||||
this.drawText(enemy.exp, x, y);
|
||||
x += this.textWidth(enemy.exp) + 6;
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(TextManager.expA, x, y);
|
||||
x += this.textWidth(TextManager.expA + " ");
|
||||
|
||||
Window_EnemyBookIndex.prototype.initialize = function (x, y) {
|
||||
var width = Graphics.boxWidth;
|
||||
var height = this.fittingHeight(6);
|
||||
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
|
||||
this.refresh();
|
||||
this.setTopRow(Window_EnemyBookIndex.lastTopRow);
|
||||
this.select(Window_EnemyBookIndex.lastIndex);
|
||||
this.activate();
|
||||
};
|
||||
this.resetTextColor();
|
||||
this.drawText(enemy.gold, x, y);
|
||||
x += this.textWidth(enemy.gold) + 6;
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(TextManager.currencyUnit, x, y);
|
||||
|
||||
Window_EnemyBookIndex.prototype.maxCols = function () {
|
||||
return 3;
|
||||
};
|
||||
x = this.contents.width - rewardsWidth;
|
||||
y += lineHeight;
|
||||
|
||||
Window_EnemyBookIndex.prototype.maxItems = function () {
|
||||
return this._list ? this._list.length : 0;
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.setStatusWindow = function (statusWindow) {
|
||||
this._statusWindow = statusWindow;
|
||||
this.updateStatus();
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.update = function () {
|
||||
Window_Selectable.prototype.update.call(this);
|
||||
this.updateStatus();
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.updateStatus = function () {
|
||||
if (this._statusWindow) {
|
||||
var enemy = this._list[this.index()];
|
||||
this._statusWindow.setEnemy(enemy);
|
||||
}
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.refresh = function () {
|
||||
this._list = [];
|
||||
for (var i = 1; i < $dataEnemies.length; i++) {
|
||||
var enemy = $dataEnemies[i];
|
||||
if (enemy.name && enemy.meta.book !== 'no') {
|
||||
this._list.push(enemy);
|
||||
}
|
||||
}
|
||||
this.createContents();
|
||||
this.drawAllItems();
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.drawItem = function (index) {
|
||||
var enemy = this._list[index];
|
||||
var rect = this.itemRectForText(index);
|
||||
var name;
|
||||
if ($gameSystem.isInEnemyBook(enemy)) {
|
||||
name = enemy.name;
|
||||
} else {
|
||||
name = unknownData;
|
||||
}
|
||||
this.drawText(name, rect.x, rect.y, rect.width);
|
||||
};
|
||||
|
||||
Window_EnemyBookIndex.prototype.processCancel = function () {
|
||||
Window_Selectable.prototype.processCancel.call(this);
|
||||
Window_EnemyBookIndex.lastTopRow = this.topRow();
|
||||
Window_EnemyBookIndex.lastIndex = this.index();
|
||||
};
|
||||
|
||||
function Window_EnemyBookStatus() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_EnemyBookStatus.prototype = Object.create(Window_Base.prototype);
|
||||
Window_EnemyBookStatus.prototype.constructor = Window_EnemyBookStatus;
|
||||
|
||||
Window_EnemyBookStatus.prototype.initialize = function (x, y, width, height) {
|
||||
Window_Base.prototype.initialize.call(this, x, y, width, height);
|
||||
this._enemy = null;
|
||||
this._enemySprite = new Sprite();
|
||||
this._enemySprite.anchor.x = 0.5;
|
||||
this._enemySprite.anchor.y = 0.5;
|
||||
this._enemySprite.x = width / 2 - 20;
|
||||
this._enemySprite.y = height / 2;
|
||||
this.addChildToBack(this._enemySprite);
|
||||
this.refresh();
|
||||
};
|
||||
|
||||
Window_EnemyBookStatus.prototype.setEnemy = function (enemy) {
|
||||
if (this._enemy !== enemy) {
|
||||
this._enemy = enemy;
|
||||
this.refresh();
|
||||
}
|
||||
};
|
||||
|
||||
Window_EnemyBookStatus.prototype.update = function () {
|
||||
Window_Base.prototype.update.call(this);
|
||||
if (this._enemySprite.bitmap) {
|
||||
var bitmapHeight = this._enemySprite.bitmap.height;
|
||||
var contentsHeight = this.contents.height;
|
||||
var scale = 1;
|
||||
if (bitmapHeight > contentsHeight) {
|
||||
scale = contentsHeight / bitmapHeight;
|
||||
}
|
||||
this._enemySprite.scale.x = scale;
|
||||
this._enemySprite.scale.y = scale;
|
||||
}
|
||||
};
|
||||
|
||||
Window_EnemyBookStatus.prototype.refresh = function () {
|
||||
var enemy = this._enemy;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
var lineHeight = this.lineHeight();
|
||||
|
||||
this.contents.clear();
|
||||
|
||||
if (!enemy || !$gameSystem.isInEnemyBook(enemy)) {
|
||||
this._enemySprite.bitmap = null;
|
||||
return;
|
||||
}
|
||||
|
||||
var name = enemy.battlerName;
|
||||
var hue = enemy.battlerHue;
|
||||
var bitmap;
|
||||
if ($gameSystem.isSideView()) {
|
||||
bitmap = ImageManager.loadSvEnemy(name, hue);
|
||||
} else {
|
||||
bitmap = ImageManager.loadEnemy(name, hue);
|
||||
}
|
||||
this._enemySprite.bitmap = bitmap;
|
||||
|
||||
this.resetTextColor();
|
||||
this.drawText(enemy.name, x, y);
|
||||
|
||||
x = this.textPadding();
|
||||
y = lineHeight + this.textPadding();
|
||||
|
||||
for (var i = 0; i < 8; i++) {
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(TextManager.param(i), x, y, 160);
|
||||
this.resetTextColor();
|
||||
this.drawText(enemy.params[i], x + 160, y, 60, 'right');
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
var rewardsWidth = 280;
|
||||
x = this.contents.width - rewardsWidth;
|
||||
y = lineHeight + this.textPadding();
|
||||
|
||||
this.resetTextColor();
|
||||
this.drawText(enemy.exp, x, y);
|
||||
x += this.textWidth(enemy.exp) + 6;
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(TextManager.expA, x, y);
|
||||
x += this.textWidth(TextManager.expA + ' ');
|
||||
|
||||
this.resetTextColor();
|
||||
this.drawText(enemy.gold, x, y);
|
||||
x += this.textWidth(enemy.gold) + 6;
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(TextManager.currencyUnit, x, y);
|
||||
|
||||
x = this.contents.width - rewardsWidth;
|
||||
for (var j = 0; j < enemy.dropItems.length; j++) {
|
||||
var di = enemy.dropItems[j];
|
||||
if (di.kind > 0) {
|
||||
var item = Game_Enemy.prototype.itemObject(di.kind, di.dataId);
|
||||
this.drawItemName(item, x, y, rewardsWidth);
|
||||
y += lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
for (var j = 0; j < enemy.dropItems.length; j++) {
|
||||
var di = enemy.dropItems[j];
|
||||
if (di.kind > 0) {
|
||||
var item = Game_Enemy.prototype.itemObject(di.kind, di.dataId);
|
||||
this.drawItemName(item, x, y, rewardsWidth);
|
||||
y += lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
var descWidth = 480;
|
||||
x = this.contents.width - descWidth;
|
||||
y = this.textPadding() + lineHeight * 7;
|
||||
this.drawTextEx(enemy.meta.desc1, x, y + lineHeight * 0, descWidth);
|
||||
this.drawTextEx(enemy.meta.desc2, x, y + lineHeight * 1, descWidth);
|
||||
};
|
||||
|
||||
var descWidth = 480;
|
||||
x = this.contents.width - descWidth;
|
||||
y = this.textPadding() + lineHeight * 7;
|
||||
this.drawTextEx(enemy.meta.desc1, x, y + lineHeight * 0, descWidth);
|
||||
this.drawTextEx(enemy.meta.desc2, x, y + lineHeight * 1, descWidth);
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -65,100 +65,106 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Get database meta information.
|
||||
* @param object Database item
|
||||
* @param name Meta name
|
||||
* @returns {String} meta value
|
||||
*/
|
||||
var getMetaValue = function (object, name) {
|
||||
var tagName = param.commandPrefix + name;
|
||||
return object.meta.hasOwnProperty(tagName) ? convertEscapeCharacters(object.meta[tagName]) : null;
|
||||
};
|
||||
/**
|
||||
* Get database meta information.
|
||||
* @param object Database item
|
||||
* @param name Meta name
|
||||
* @returns {String} meta value
|
||||
*/
|
||||
var getMetaValue = function (object, name) {
|
||||
var tagName = param.commandPrefix + name;
|
||||
return object.meta.hasOwnProperty(tagName)
|
||||
? convertEscapeCharacters(object.meta[tagName])
|
||||
: null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Get database meta information.(for multi language)
|
||||
* @param object Database item
|
||||
* @param names Meta name array (for multi language)
|
||||
* @returns {String} meta value
|
||||
*/
|
||||
var getMetaValues = function (object, names) {
|
||||
var metaValue;
|
||||
names.some(function (name) {
|
||||
metaValue = getMetaValue(object, name);
|
||||
return metaValue !== null;
|
||||
});
|
||||
return metaValue;
|
||||
};
|
||||
/**
|
||||
* Get database meta information.(for multi language)
|
||||
* @param object Database item
|
||||
* @param names Meta name array (for multi language)
|
||||
* @returns {String} meta value
|
||||
*/
|
||||
var getMetaValues = function (object, names) {
|
||||
var metaValue;
|
||||
names.some(function (name) {
|
||||
metaValue = getMetaValue(object, name);
|
||||
return metaValue !== null;
|
||||
});
|
||||
return metaValue;
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert escape characters.(require any window object)
|
||||
* @param text Target text
|
||||
* @returns {String} Converted text
|
||||
*/
|
||||
var convertEscapeCharacters = function (text) {
|
||||
var windowLayer = SceneManager._scene._windowLayer;
|
||||
return windowLayer ? windowLayer.children[0].convertEscapeCharacters(text.toString()) : text;
|
||||
};
|
||||
/**
|
||||
* Convert escape characters.(require any window object)
|
||||
* @param text Target text
|
||||
* @returns {String} Converted text
|
||||
*/
|
||||
var convertEscapeCharacters = function (text) {
|
||||
var windowLayer = SceneManager._scene._windowLayer;
|
||||
return windowLayer
|
||||
? windowLayer.children[0].convertEscapeCharacters(text.toString())
|
||||
: text;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create plugin parameter. param[paramName] ex. param.commandPrefix
|
||||
* @param pluginName plugin name(EncounterSwitchConditions)
|
||||
* @returns {Object} Created parameter
|
||||
*/
|
||||
var createPluginParameter = function (pluginName) {
|
||||
var paramReplacer = function (key, value) {
|
||||
if (value === 'null') {
|
||||
return value;
|
||||
}
|
||||
if (value[0] === '"' && value[value.length - 1] === '"') {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
var parameter = JSON.parse(JSON.stringify(PluginManager.parameters(pluginName), paramReplacer));
|
||||
PluginManager.setParameters(pluginName, parameter);
|
||||
return parameter;
|
||||
/**
|
||||
* Create plugin parameter. param[paramName] ex. param.commandPrefix
|
||||
* @param pluginName plugin name(EncounterSwitchConditions)
|
||||
* @returns {Object} Created parameter
|
||||
*/
|
||||
var createPluginParameter = function (pluginName) {
|
||||
var paramReplacer = function (key, value) {
|
||||
if (value === "null") {
|
||||
return value;
|
||||
}
|
||||
if (value[0] === '"' && value[value.length - 1] === '"') {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
var param = createPluginParameter('EventMovableLimitation');
|
||||
var parameter = JSON.parse(
|
||||
JSON.stringify(PluginManager.parameters(pluginName), paramReplacer)
|
||||
);
|
||||
PluginManager.setParameters(pluginName, parameter);
|
||||
return parameter;
|
||||
};
|
||||
var param = createPluginParameter("EventMovableLimitation");
|
||||
|
||||
var _Game_Event_initialize = Game_Event.prototype.initialize;
|
||||
Game_Event.prototype.initialize = function (mapId, eventId) {
|
||||
_Game_Event_initialize.apply(this, arguments);
|
||||
var movables = getMetaValues(this.event(), ['移動制限', 'Movable']);
|
||||
if (movables) {
|
||||
this._movables = movables.split(',').map(function (value) {
|
||||
return parseInt(value);
|
||||
});
|
||||
this._initX = this._x;
|
||||
this._initY = this._y;
|
||||
}
|
||||
};
|
||||
var _Game_Event_initialize = Game_Event.prototype.initialize;
|
||||
Game_Event.prototype.initialize = function (mapId, eventId) {
|
||||
_Game_Event_initialize.apply(this, arguments);
|
||||
var movables = getMetaValues(this.event(), ["移動制限", "Movable"]);
|
||||
if (movables) {
|
||||
this._movables = movables.split(",").map(function (value) {
|
||||
return parseInt(value);
|
||||
});
|
||||
this._initX = this._x;
|
||||
this._initY = this._y;
|
||||
}
|
||||
};
|
||||
|
||||
var _Game_Event_canPass = Game_Event.prototype.canPass;
|
||||
Game_Event.prototype.canPass = function (x, y, d) {
|
||||
if (this._movables) {
|
||||
var x2 = $gameMap.roundXWithDirection(x, d);
|
||||
var y2 = $gameMap.roundYWithDirection(y, d);
|
||||
if (this._movables[0] >= 0 && this._initY - y2 > this._movables[0]) {
|
||||
return false;
|
||||
}
|
||||
if (this._movables[1] >= 0 && y2 - this._initY > this._movables[1]) {
|
||||
return false;
|
||||
}
|
||||
if (this._movables[2] >= 0 && this._initX - x2 > this._movables[2]) {
|
||||
return false;
|
||||
}
|
||||
if (this._movables[3] >= 0 && x2 - this._initX > this._movables[3]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return _Game_Event_canPass.apply(this, arguments);
|
||||
};
|
||||
var _Game_Event_canPass = Game_Event.prototype.canPass;
|
||||
Game_Event.prototype.canPass = function (x, y, d) {
|
||||
if (this._movables) {
|
||||
var x2 = $gameMap.roundXWithDirection(x, d);
|
||||
var y2 = $gameMap.roundYWithDirection(y, d);
|
||||
if (this._movables[0] >= 0 && this._initY - y2 > this._movables[0]) {
|
||||
return false;
|
||||
}
|
||||
if (this._movables[1] >= 0 && y2 - this._initY > this._movables[1]) {
|
||||
return false;
|
||||
}
|
||||
if (this._movables[2] >= 0 && this._initX - x2 > this._movables[2]) {
|
||||
return false;
|
||||
}
|
||||
if (this._movables[3] >= 0 && x2 - this._initX > this._movables[3]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return _Game_Event_canPass.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -38,35 +38,34 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
var _Sprite__renderCanvas = Sprite.prototype._renderCanvas;
|
||||
Sprite.prototype._renderCanvas = function (renderer) {
|
||||
_Sprite__renderCanvas.apply(this, arguments);
|
||||
if (this.isExistLoadingBitmap()) {
|
||||
this._renderCanvas_PIXI(renderer);
|
||||
var _Sprite__renderCanvas = Sprite.prototype._renderCanvas;
|
||||
Sprite.prototype._renderCanvas = function (renderer) {
|
||||
_Sprite__renderCanvas.apply(this, arguments);
|
||||
if (this.isExistLoadingBitmap()) {
|
||||
this._renderCanvas_PIXI(renderer);
|
||||
}
|
||||
};
|
||||
|
||||
var _Sprite__renderWebGL = Sprite.prototype._renderWebGL;
|
||||
Sprite.prototype._renderWebGL = function (renderer) {
|
||||
_Sprite__renderWebGL.apply(this, arguments);
|
||||
if (this.isExistLoadingBitmap()) {
|
||||
if (this._isPicture) {
|
||||
this._speedUpCustomBlendModes(renderer);
|
||||
renderer.setObjectRenderer(renderer.plugins.picture);
|
||||
if (!this.isVideoPicture || !this.isVideoPicture()) {
|
||||
renderer.plugins.picture.render(this);
|
||||
}
|
||||
};
|
||||
} else {
|
||||
renderer.setObjectRenderer(renderer.plugins.sprite);
|
||||
renderer.plugins.sprite.render(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var _Sprite__renderWebGL = Sprite.prototype._renderWebGL;
|
||||
Sprite.prototype._renderWebGL = function (renderer) {
|
||||
_Sprite__renderWebGL.apply(this, arguments);
|
||||
if (this.isExistLoadingBitmap()) {
|
||||
if (this._isPicture) {
|
||||
this._speedUpCustomBlendModes(renderer);
|
||||
renderer.setObjectRenderer(renderer.plugins.picture);
|
||||
if (!this.isVideoPicture || !this.isVideoPicture()) {
|
||||
renderer.plugins.picture.render(this);
|
||||
}
|
||||
} else {
|
||||
renderer.setObjectRenderer(renderer.plugins.sprite);
|
||||
renderer.plugins.sprite.render(this);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Sprite.prototype.isExistLoadingBitmap = function () {
|
||||
return this.bitmap && !this.bitmap.isReady();
|
||||
};
|
||||
Sprite.prototype.isExistLoadingBitmap = function () {
|
||||
return this.bitmap && !this.bitmap.isReady();
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
|
|||
|
|
@ -90,41 +90,49 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
var pluginName = 'FloatVariables';
|
||||
"use strict";
|
||||
var pluginName = "FloatVariables";
|
||||
|
||||
var getParamNumber = function (paramNames, min, max) {
|
||||
var value = getParamOther(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value, 10) || 0).clamp(min, max);
|
||||
};
|
||||
var getParamNumber = function (paramNames, min, max) {
|
||||
var value = getParamOther(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value, 10) || 0).clamp(min, max);
|
||||
};
|
||||
|
||||
var getParamOther = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (var i = 0; i < paramNames.length; i++) {
|
||||
var name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return name;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var getParamOther = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (var i = 0; i < paramNames.length; i++) {
|
||||
var name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return name;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
var paramFloatVariableStart = getParamNumber(['FloatVariableStart', '小数変数開始位置']);
|
||||
var paramFloatVariableEnd = getParamNumber(['FloatVariableEnd', '小数変数終了位置']);
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
var paramFloatVariableStart = getParamNumber([
|
||||
"FloatVariableStart",
|
||||
"小数変数開始位置",
|
||||
]);
|
||||
var paramFloatVariableEnd = getParamNumber([
|
||||
"FloatVariableEnd",
|
||||
"小数変数終了位置",
|
||||
]);
|
||||
|
||||
var _Game_Variables_setValue = Game_Variables.prototype.setValue;
|
||||
Game_Variables.prototype.setValue = function (variableId, value) {
|
||||
if (variableId >= paramFloatVariableStart && variableId <= paramFloatVariableEnd) {
|
||||
if (variableId > 0 && variableId < $dataSystem.variables.length) {
|
||||
this._data[variableId] = value;
|
||||
this.onChange();
|
||||
}
|
||||
} else {
|
||||
_Game_Variables_setValue.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
var _Game_Variables_setValue = Game_Variables.prototype.setValue;
|
||||
Game_Variables.prototype.setValue = function (variableId, value) {
|
||||
if (
|
||||
variableId >= paramFloatVariableStart &&
|
||||
variableId <= paramFloatVariableEnd
|
||||
) {
|
||||
if (variableId > 0 && variableId < $dataSystem.variables.length) {
|
||||
this._data[variableId] = value;
|
||||
this.onChange();
|
||||
}
|
||||
} else {
|
||||
_Game_Variables_setValue.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@
|
|||
/*:
|
||||
* @plugindesc display foreground tiling sprite(Ver1.0.1)
|
||||
* @author Sasuke KANNAZUKI (thanks to Yoji Ojima)
|
||||
*
|
||||
*
|
||||
* @noteParam fgName
|
||||
* @noteRequire 1
|
||||
* @noteDir img/parallaxes/
|
||||
* @noteType file
|
||||
* @noteData maps
|
||||
*
|
||||
*
|
||||
* @help This plugin does not provide plugin commands.
|
||||
*
|
||||
* 'foreground' is like a parallax that displays over the map.
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
* Map Note:
|
||||
* write down following 5 settings at map's note.
|
||||
* <fgName:name> name is the string, file name of tiling sprite.
|
||||
* <fgName:name> name is the string, file name of tiling sprite.
|
||||
* if the name starts '!', it is regarded as "foreground zero".
|
||||
* the filename is searched from img/parallaxes.
|
||||
* <fgLoopX:number> number is the flag of loop x. 0:no 1:yes
|
||||
|
|
@ -35,7 +35,7 @@
|
|||
* <fgSy:number> number is y scroll speed.
|
||||
* when it doesn't loop y, this is ignored.
|
||||
* if this is not written on the note, it'll be 0.
|
||||
*
|
||||
*
|
||||
* Ex.
|
||||
* <fgName:sample1><fgLoopX:1><fgLoopY:1>
|
||||
*
|
||||
|
|
@ -49,13 +49,13 @@
|
|||
/*:ja
|
||||
* @plugindesc マップに合わせてスクロールする近景の設定(Ver1.0.1)
|
||||
* @author 神無月サスケ (thanks to Yoji Ojima)
|
||||
*
|
||||
*
|
||||
* @noteParam fgName
|
||||
* @noteRequire 1
|
||||
* @noteDir img/parallaxes/
|
||||
* @noteType file
|
||||
* @noteData maps
|
||||
*
|
||||
*
|
||||
* @help このプラグインにプラグインコマンドはありません。
|
||||
* 近景(foreground)は、マップの上に表示される遠景のようなものです。
|
||||
* 使用する画像ファイルは、img/parallaxes に置いてください。
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
* <fgSy:数字> Y座標のスクロール速度です
|
||||
* Y座標にループしない場合は無視されます。
|
||||
* 省略時は0になります。
|
||||
*
|
||||
*
|
||||
* 例:
|
||||
* <fgName:sample1><fgLoopX:1><fgLoopY:1>
|
||||
* sample1.png が前景になり、斜め上にループします。
|
||||
|
|
@ -94,7 +94,7 @@
|
|||
// check zero foreground or not.
|
||||
//
|
||||
ImageManager.isZeroForeground = function (filename) {
|
||||
return filename.charAt(0) === '!';
|
||||
return filename.charAt(0) === "!";
|
||||
};
|
||||
|
||||
//
|
||||
|
|
@ -108,7 +108,7 @@
|
|||
|
||||
Game_Map.prototype.initForeground = function () {
|
||||
this._foregroundDefined = true;
|
||||
this._foregroundName = '';
|
||||
this._foregroundName = "";
|
||||
this._foregroundZero = false;
|
||||
this._foregroundLoopX = false;
|
||||
this._foregroundLoopY = false;
|
||||
|
|
@ -146,9 +146,10 @@
|
|||
|
||||
Game_Map.prototype.setupForeground = function () {
|
||||
if ($dataMap.meta) {
|
||||
this._foregroundName = $dataMap.meta.fgName || '';
|
||||
this._foregroundName = $dataMap.meta.fgName || "";
|
||||
this._foregroundZero = ImageManager.isZeroForeground(
|
||||
this._foregroundName);
|
||||
this._foregroundName
|
||||
);
|
||||
this._foregroundLoopX = !!$dataMap.meta.fgLoopX;
|
||||
this._foregroundLoopY = !!$dataMap.meta.fgLoopY;
|
||||
this._foregroundSx = Number($dataMap.meta.fgSx) || 0;
|
||||
|
|
@ -182,7 +183,7 @@
|
|||
if (this._foregroundZero) {
|
||||
return this._foregroundX * this.tileWidth();
|
||||
} else if (this._foregroundLoopX) {
|
||||
return this._foregroundX * this.tileWidth() / 2;
|
||||
return (this._foregroundX * this.tileWidth()) / 2;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -193,7 +194,7 @@
|
|||
if (this._foregroundZero) {
|
||||
return this._foregroundY * this.tileHeight();
|
||||
} else if (this._foregroundLoopY) {
|
||||
return this._foregroundY * this.tileHeight() / 2;
|
||||
return (this._foregroundY * this.tileHeight()) / 2;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -212,8 +213,10 @@
|
|||
this._foregroundY += distance;
|
||||
}
|
||||
} else if (this.height() >= this.screenTileY()) {
|
||||
var displayY = Math.min(lastY + distance,
|
||||
this.height() - this.screenTileY());
|
||||
var displayY = Math.min(
|
||||
lastY + distance,
|
||||
this.height() - this.screenTileY()
|
||||
);
|
||||
this._foregroundY += displayY - lastY;
|
||||
}
|
||||
};
|
||||
|
|
@ -243,8 +246,10 @@
|
|||
this._foregroundX += distance;
|
||||
}
|
||||
} else if (this.width() >= this.screenTileX()) {
|
||||
var displayX = Math.min(lastX + distance,
|
||||
this.width() - this.screenTileX());
|
||||
var displayX = Math.min(
|
||||
lastX + distance,
|
||||
this.width() - this.screenTileX()
|
||||
);
|
||||
this._foregroundX += displayX - lastX;
|
||||
}
|
||||
};
|
||||
|
|
@ -318,5 +323,4 @@
|
|||
this._foreground.origin.y = $gameMap.foregroundOy();
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -40,143 +40,147 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
function convertEscape(txt) { return Window_Base.prototype.convertEscapeCharacters(txt) };
|
||||
function convertEscape(txt) {
|
||||
return Window_Base.prototype.convertEscapeCharacters(txt);
|
||||
}
|
||||
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
// スクリプトコマンド「HZRANDOM」
|
||||
if (command.toUpperCase() === 'HZRANDOM') {
|
||||
var type = String(args[0]);
|
||||
if (type.toUpperCase() === 'CREATE') {
|
||||
// 「HZRANDOM CREATE」:ランダムリストの作成
|
||||
var id = Number(convertEscape(args[1]));
|
||||
var min = Number(convertEscape(args[2]));
|
||||
var max = Number(convertEscape(args[3]));
|
||||
var loop = args[4] != null ? Number(convertEscape(args[4])) == 1 : false;
|
||||
$gameSystem.putHzRandomList(id, new HzRandomList(min, max, loop));
|
||||
} else if (type.toUpperCase() === 'NEXT') {
|
||||
// 「HZRANDOM NEXT」:ランダムリストの次の要素を取得
|
||||
var id = Number(convertEscape(args[1]));
|
||||
var varNo = Number(convertEscape(args[2]));
|
||||
var nextValue = $gameSystem.getNextHzRandomList(id);
|
||||
if (nextValue != null) {
|
||||
$gameVariables.setValue(varNo, nextValue);
|
||||
}
|
||||
} else if (type.toUpperCase() === 'SHUFFLE') {
|
||||
// 「HZRANDOM NEXT」:ランダムリストの再シャッフル
|
||||
var id = Number(convertEscape(args[1]));
|
||||
$gameSystem.shuffleHzRandomList(id);
|
||||
}
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
// スクリプトコマンド「HZRANDOM」
|
||||
if (command.toUpperCase() === "HZRANDOM") {
|
||||
var type = String(args[0]);
|
||||
if (type.toUpperCase() === "CREATE") {
|
||||
// 「HZRANDOM CREATE」:ランダムリストの作成
|
||||
var id = Number(convertEscape(args[1]));
|
||||
var min = Number(convertEscape(args[2]));
|
||||
var max = Number(convertEscape(args[3]));
|
||||
var loop =
|
||||
args[4] != null ? Number(convertEscape(args[4])) == 1 : false;
|
||||
$gameSystem.putHzRandomList(id, new HzRandomList(min, max, loop));
|
||||
} else if (type.toUpperCase() === "NEXT") {
|
||||
// 「HZRANDOM NEXT」:ランダムリストの次の要素を取得
|
||||
var id = Number(convertEscape(args[1]));
|
||||
var varNo = Number(convertEscape(args[2]));
|
||||
var nextValue = $gameSystem.getNextHzRandomList(id);
|
||||
if (nextValue != null) {
|
||||
$gameVariables.setValue(varNo, nextValue);
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// ランダムリストはGame_Systemに保管。(セーブファイルに保存するため)
|
||||
//
|
||||
Game_System.prototype.putHzRandomList = function (id, list) {
|
||||
if (!this._hzrandomList) {
|
||||
this._hzrandomList = [];
|
||||
}
|
||||
this._hzrandomList[id] = list;
|
||||
};
|
||||
|
||||
Game_System.prototype.getNextHzRandomList = function (id) {
|
||||
if (!this._hzrandomList) {
|
||||
this._hzrandomList = [];
|
||||
}
|
||||
if (!this._hzrandomList[id]) {
|
||||
return null;
|
||||
}
|
||||
return HzRandomList.next(this._hzrandomList[id]);
|
||||
};
|
||||
|
||||
Game_System.prototype.shuffleHzRandomList = function (id) {
|
||||
if (!this._hzrandomList) {
|
||||
this._hzrandomList = [];
|
||||
}
|
||||
if (!this._hzrandomList[id]) {
|
||||
return;
|
||||
}
|
||||
HzRandomList.shuffle(this._hzrandomList[id]);
|
||||
};
|
||||
|
||||
function HzRandomList() {
|
||||
this.initialize.apply(this, arguments);
|
||||
} else if (type.toUpperCase() === "SHUFFLE") {
|
||||
// 「HZRANDOM NEXT」:ランダムリストの再シャッフル
|
||||
var id = Number(convertEscape(args[1]));
|
||||
$gameSystem.shuffleHzRandomList(id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 初期化処理
|
||||
* @returns {Array|HzRandomList_L1.HzRandomList._list}
|
||||
*/
|
||||
HzRandomList.prototype.initialize = function (min, max, loop) {
|
||||
this._min = min;
|
||||
this._max = max;
|
||||
this._loop = loop;
|
||||
if (this._min > this._max) {
|
||||
var tmp = this._min;
|
||||
this._min = this._max;
|
||||
this._max = tmp;
|
||||
}
|
||||
// min~max(max含む)の配列を作成
|
||||
this._list = new Array(this._max - this._min + 1);
|
||||
for (var i = 0; i < this._max - this._min + 1; i++) {
|
||||
this._list[i] = this._min + i;
|
||||
}
|
||||
// 配列のシャッフル
|
||||
shuffle(this._list);
|
||||
// 次回取得時の配列のINDEX設定
|
||||
this._index = 0;
|
||||
};
|
||||
//
|
||||
// ランダムリストはGame_Systemに保管。(セーブファイルに保存するため)
|
||||
//
|
||||
Game_System.prototype.putHzRandomList = function (id, list) {
|
||||
if (!this._hzrandomList) {
|
||||
this._hzrandomList = [];
|
||||
}
|
||||
this._hzrandomList[id] = list;
|
||||
};
|
||||
|
||||
/**
|
||||
* ランダムリストの次の要素を返す
|
||||
* @returns {Array}
|
||||
*/
|
||||
HzRandomList.next = function (list) {
|
||||
if (list._index >= list._list.length) {
|
||||
if (!list._loop) {
|
||||
// ループ設定OFFの場合、配列を再シャッフル
|
||||
shuffle(list._list);
|
||||
}
|
||||
// INDEXを0に戻す
|
||||
list._index = 0;
|
||||
}
|
||||
// ランダムリストの要素を取得
|
||||
var value = list._list[list._index];
|
||||
// インデックスをカウントアップ
|
||||
list._index++;
|
||||
return value;
|
||||
};
|
||||
Game_System.prototype.getNextHzRandomList = function (id) {
|
||||
if (!this._hzrandomList) {
|
||||
this._hzrandomList = [];
|
||||
}
|
||||
if (!this._hzrandomList[id]) {
|
||||
return null;
|
||||
}
|
||||
return HzRandomList.next(this._hzrandomList[id]);
|
||||
};
|
||||
|
||||
/**
|
||||
* 配列を再度シャッフルする
|
||||
* @returns {undefined}
|
||||
*/
|
||||
HzRandomList.shuffle = function (list) {
|
||||
// 配列を再シャッフル
|
||||
Game_System.prototype.shuffleHzRandomList = function (id) {
|
||||
if (!this._hzrandomList) {
|
||||
this._hzrandomList = [];
|
||||
}
|
||||
if (!this._hzrandomList[id]) {
|
||||
return;
|
||||
}
|
||||
HzRandomList.shuffle(this._hzrandomList[id]);
|
||||
};
|
||||
|
||||
function HzRandomList() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* 初期化処理
|
||||
* @returns {Array|HzRandomList_L1.HzRandomList._list}
|
||||
*/
|
||||
HzRandomList.prototype.initialize = function (min, max, loop) {
|
||||
this._min = min;
|
||||
this._max = max;
|
||||
this._loop = loop;
|
||||
if (this._min > this._max) {
|
||||
var tmp = this._min;
|
||||
this._min = this._max;
|
||||
this._max = tmp;
|
||||
}
|
||||
// min~max(max含む)の配列を作成
|
||||
this._list = new Array(this._max - this._min + 1);
|
||||
for (var i = 0; i < this._max - this._min + 1; i++) {
|
||||
this._list[i] = this._min + i;
|
||||
}
|
||||
// 配列のシャッフル
|
||||
shuffle(this._list);
|
||||
// 次回取得時の配列のINDEX設定
|
||||
this._index = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* ランダムリストの次の要素を返す
|
||||
* @returns {Array}
|
||||
*/
|
||||
HzRandomList.next = function (list) {
|
||||
if (list._index >= list._list.length) {
|
||||
if (!list._loop) {
|
||||
// ループ設定OFFの場合、配列を再シャッフル
|
||||
shuffle(list._list);
|
||||
// INDEXを0に戻す
|
||||
list._index = 0;
|
||||
};
|
||||
}
|
||||
// INDEXを0に戻す
|
||||
list._index = 0;
|
||||
}
|
||||
// ランダムリストの要素を取得
|
||||
var value = list._list[list._index];
|
||||
// インデックスをカウントアップ
|
||||
list._index++;
|
||||
return value;
|
||||
};
|
||||
|
||||
/**
|
||||
* 配列のシャッフル用関数
|
||||
* @param {type} array
|
||||
* @returns {unresolved}
|
||||
*/
|
||||
function shuffle(array) {
|
||||
var n = array.length, t, i;
|
||||
/**
|
||||
* 配列を再度シャッフルする
|
||||
* @returns {undefined}
|
||||
*/
|
||||
HzRandomList.shuffle = function (list) {
|
||||
// 配列を再シャッフル
|
||||
shuffle(list._list);
|
||||
// INDEXを0に戻す
|
||||
list._index = 0;
|
||||
};
|
||||
|
||||
while (n) {
|
||||
i = Math.floor(Math.random() * n--);
|
||||
t = array[n];
|
||||
array[n] = array[i];
|
||||
array[i] = t;
|
||||
}
|
||||
/**
|
||||
* 配列のシャッフル用関数
|
||||
* @param {type} array
|
||||
* @returns {unresolved}
|
||||
*/
|
||||
function shuffle(array) {
|
||||
var n = array.length,
|
||||
t,
|
||||
i;
|
||||
|
||||
return array;
|
||||
while (n) {
|
||||
i = Math.floor(Math.random() * n--);
|
||||
t = array[n];
|
||||
array[n] = array[i];
|
||||
array[i] = t;
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -73,311 +73,309 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
var parameters = PluginManager.parameters("ItemBook");
|
||||
var unknownData = String(parameters["Unknown Data"] || "??????");
|
||||
var priceText = String(parameters["Price Text"] || "Price");
|
||||
var equipText = String(parameters["Equip Text"] || "Equip");
|
||||
var typeText = String(parameters["Type Text"] || "Type");
|
||||
|
||||
var parameters = PluginManager.parameters('ItemBook');
|
||||
var unknownData = String(parameters['Unknown Data'] || '??????');
|
||||
var priceText = String(parameters['Price Text'] || 'Price');
|
||||
var equipText = String(parameters['Equip Text'] || 'Equip');
|
||||
var typeText = String(parameters['Type Text'] || 'Type');
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === "ItemBook") {
|
||||
switch (args[0]) {
|
||||
case "open":
|
||||
SceneManager.push(Scene_ItemBook);
|
||||
break;
|
||||
case "add":
|
||||
$gameSystem.addToItemBook(args[1], Number(args[2]));
|
||||
break;
|
||||
case "remove":
|
||||
$gameSystem.removeFromItemBook(args[1], Number(args[2]));
|
||||
break;
|
||||
case "complete":
|
||||
$gameSystem.completeItemBook();
|
||||
break;
|
||||
case "clear":
|
||||
$gameSystem.clearItemBook();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'ItemBook') {
|
||||
switch (args[0]) {
|
||||
case 'open':
|
||||
SceneManager.push(Scene_ItemBook);
|
||||
break;
|
||||
case 'add':
|
||||
$gameSystem.addToItemBook(args[1], Number(args[2]));
|
||||
break;
|
||||
case 'remove':
|
||||
$gameSystem.removeFromItemBook(args[1], Number(args[2]));
|
||||
break;
|
||||
case 'complete':
|
||||
$gameSystem.completeItemBook();
|
||||
break;
|
||||
case 'clear':
|
||||
$gameSystem.clearItemBook();
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
Game_System.prototype.addToItemBook = function (type, dataId) {
|
||||
if (!this._ItemBookFlags) {
|
||||
this.clearItemBook();
|
||||
}
|
||||
var typeIndex = this.itemBookTypeToIndex(type);
|
||||
if (typeIndex >= 0) {
|
||||
this._ItemBookFlags[typeIndex][dataId] = true;
|
||||
}
|
||||
};
|
||||
|
||||
Game_System.prototype.addToItemBook = function (type, dataId) {
|
||||
if (!this._ItemBookFlags) {
|
||||
this.clearItemBook();
|
||||
}
|
||||
var typeIndex = this.itemBookTypeToIndex(type);
|
||||
if (typeIndex >= 0) {
|
||||
this._ItemBookFlags[typeIndex][dataId] = true;
|
||||
}
|
||||
};
|
||||
Game_System.prototype.removeFromItemBook = function (type, dataId) {
|
||||
if (this._ItemBookFlags) {
|
||||
var typeIndex = this.itemBookTypeToIndex(type);
|
||||
if (typeIndex >= 0) {
|
||||
this._ItemBookFlags[typeIndex][dataId] = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Game_System.prototype.removeFromItemBook = function (type, dataId) {
|
||||
if (this._ItemBookFlags) {
|
||||
var typeIndex = this.itemBookTypeToIndex(type);
|
||||
if (typeIndex >= 0) {
|
||||
this._ItemBookFlags[typeIndex][dataId] = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
Game_System.prototype.itemBookTypeToIndex = function (type) {
|
||||
switch (type) {
|
||||
case "item":
|
||||
return 0;
|
||||
case "weapon":
|
||||
return 1;
|
||||
case "armor":
|
||||
return 2;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
|
||||
Game_System.prototype.itemBookTypeToIndex = function (type) {
|
||||
switch (type) {
|
||||
case 'item':
|
||||
return 0;
|
||||
case 'weapon':
|
||||
return 1;
|
||||
case 'armor':
|
||||
return 2;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
};
|
||||
Game_System.prototype.completeItemBook = function () {
|
||||
var i;
|
||||
this.clearItemBook();
|
||||
for (i = 1; i < $dataItems.length; i++) {
|
||||
this._ItemBookFlags[0][i] = true;
|
||||
}
|
||||
for (i = 1; i < $dataWeapons.length; i++) {
|
||||
this._ItemBookFlags[1][i] = true;
|
||||
}
|
||||
for (i = 1; i < $dataArmors.length; i++) {
|
||||
this._ItemBookFlags[2][i] = true;
|
||||
}
|
||||
};
|
||||
|
||||
Game_System.prototype.completeItemBook = function () {
|
||||
var i;
|
||||
this.clearItemBook();
|
||||
for (i = 1; i < $dataItems.length; i++) {
|
||||
this._ItemBookFlags[0][i] = true;
|
||||
}
|
||||
for (i = 1; i < $dataWeapons.length; i++) {
|
||||
this._ItemBookFlags[1][i] = true;
|
||||
}
|
||||
for (i = 1; i < $dataArmors.length; i++) {
|
||||
this._ItemBookFlags[2][i] = true;
|
||||
}
|
||||
};
|
||||
Game_System.prototype.clearItemBook = function () {
|
||||
this._ItemBookFlags = [[], [], []];
|
||||
};
|
||||
|
||||
Game_System.prototype.clearItemBook = function () {
|
||||
this._ItemBookFlags = [[], [], []];
|
||||
};
|
||||
Game_System.prototype.isInItemBook = function (item) {
|
||||
if (this._ItemBookFlags && item) {
|
||||
var typeIndex = -1;
|
||||
if (DataManager.isItem(item)) {
|
||||
typeIndex = 0;
|
||||
} else if (DataManager.isWeapon(item)) {
|
||||
typeIndex = 1;
|
||||
} else if (DataManager.isArmor(item)) {
|
||||
typeIndex = 2;
|
||||
}
|
||||
if (typeIndex >= 0) {
|
||||
return !!this._ItemBookFlags[typeIndex][item.id];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
Game_System.prototype.isInItemBook = function (item) {
|
||||
if (this._ItemBookFlags && item) {
|
||||
var typeIndex = -1;
|
||||
if (DataManager.isItem(item)) {
|
||||
typeIndex = 0;
|
||||
} else if (DataManager.isWeapon(item)) {
|
||||
typeIndex = 1;
|
||||
} else if (DataManager.isArmor(item)) {
|
||||
typeIndex = 2;
|
||||
}
|
||||
if (typeIndex >= 0) {
|
||||
return !!this._ItemBookFlags[typeIndex][item.id];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
var _Game_Party_gainItem = Game_Party.prototype.gainItem;
|
||||
Game_Party.prototype.gainItem = function (item, amount, includeEquip) {
|
||||
_Game_Party_gainItem.call(this, item, amount, includeEquip);
|
||||
if (item && amount > 0) {
|
||||
var type;
|
||||
if (DataManager.isItem(item)) {
|
||||
type = "item";
|
||||
} else if (DataManager.isWeapon(item)) {
|
||||
type = "weapon";
|
||||
} else if (DataManager.isArmor(item)) {
|
||||
type = "armor";
|
||||
}
|
||||
$gameSystem.addToItemBook(type, item.id);
|
||||
}
|
||||
};
|
||||
|
||||
var _Game_Party_gainItem = Game_Party.prototype.gainItem;
|
||||
Game_Party.prototype.gainItem = function (item, amount, includeEquip) {
|
||||
_Game_Party_gainItem.call(this, item, amount, includeEquip);
|
||||
if (item && amount > 0) {
|
||||
var type;
|
||||
if (DataManager.isItem(item)) {
|
||||
type = 'item';
|
||||
} else if (DataManager.isWeapon(item)) {
|
||||
type = 'weapon';
|
||||
} else if (DataManager.isArmor(item)) {
|
||||
type = 'armor';
|
||||
}
|
||||
$gameSystem.addToItemBook(type, item.id);
|
||||
}
|
||||
};
|
||||
function Scene_ItemBook() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
function Scene_ItemBook() {
|
||||
this.initialize.apply(this, arguments);
|
||||
Scene_ItemBook.prototype = Object.create(Scene_MenuBase.prototype);
|
||||
Scene_ItemBook.prototype.constructor = Scene_ItemBook;
|
||||
|
||||
Scene_ItemBook.prototype.initialize = function () {
|
||||
Scene_MenuBase.prototype.initialize.call(this);
|
||||
};
|
||||
|
||||
Scene_ItemBook.prototype.create = function () {
|
||||
Scene_MenuBase.prototype.create.call(this);
|
||||
this._indexWindow = new Window_ItemBookIndex(0, 0);
|
||||
this._indexWindow.setHandler("cancel", this.popScene.bind(this));
|
||||
var wy = this._indexWindow.height;
|
||||
var ww = Graphics.boxWidth;
|
||||
var wh = Graphics.boxHeight - wy;
|
||||
this._statusWindow = new Window_ItemBookStatus(0, wy, ww, wh);
|
||||
this.addWindow(this._indexWindow);
|
||||
this.addWindow(this._statusWindow);
|
||||
this._indexWindow.setStatusWindow(this._statusWindow);
|
||||
};
|
||||
|
||||
function Window_ItemBookIndex() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_ItemBookIndex.prototype = Object.create(Window_Selectable.prototype);
|
||||
Window_ItemBookIndex.prototype.constructor = Window_ItemBookIndex;
|
||||
|
||||
Window_ItemBookIndex.lastTopRow = 0;
|
||||
Window_ItemBookIndex.lastIndex = 0;
|
||||
|
||||
Window_ItemBookIndex.prototype.initialize = function (x, y) {
|
||||
var width = Graphics.boxWidth;
|
||||
var height = this.fittingHeight(6);
|
||||
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
|
||||
this.refresh();
|
||||
this.setTopRow(Window_ItemBookIndex.lastTopRow);
|
||||
this.select(Window_ItemBookIndex.lastIndex);
|
||||
this.activate();
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.maxCols = function () {
|
||||
return 3;
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.maxItems = function () {
|
||||
return this._list ? this._list.length : 0;
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.setStatusWindow = function (statusWindow) {
|
||||
this._statusWindow = statusWindow;
|
||||
this.updateStatus();
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.update = function () {
|
||||
Window_Selectable.prototype.update.call(this);
|
||||
this.updateStatus();
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.updateStatus = function () {
|
||||
if (this._statusWindow) {
|
||||
var item = this._list[this.index()];
|
||||
this._statusWindow.setItem(item);
|
||||
}
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.refresh = function () {
|
||||
var i, item;
|
||||
this._list = [];
|
||||
for (i = 1; i < $dataItems.length; i++) {
|
||||
item = $dataItems[i];
|
||||
if (item.name && item.itypeId === 1 && item.meta.book !== "no") {
|
||||
this._list.push(item);
|
||||
}
|
||||
}
|
||||
for (i = 1; i < $dataWeapons.length; i++) {
|
||||
item = $dataWeapons[i];
|
||||
if (item.name && item.meta.book !== "no") {
|
||||
this._list.push(item);
|
||||
}
|
||||
}
|
||||
for (i = 1; i < $dataArmors.length; i++) {
|
||||
item = $dataArmors[i];
|
||||
if (item.name && item.meta.book !== "no") {
|
||||
this._list.push(item);
|
||||
}
|
||||
}
|
||||
this.createContents();
|
||||
this.drawAllItems();
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.drawItem = function (index) {
|
||||
var item = this._list[index];
|
||||
var rect = this.itemRect(index);
|
||||
var width = rect.width - this.textPadding();
|
||||
if ($gameSystem.isInItemBook(item)) {
|
||||
this.drawItemName(item, rect.x, rect.y, width);
|
||||
} else {
|
||||
var iw = Window_Base._iconWidth + 4;
|
||||
this.drawText(unknownData, rect.x + iw, rect.y, width - iw);
|
||||
}
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.processCancel = function () {
|
||||
Window_Selectable.prototype.processCancel.call(this);
|
||||
Window_ItemBookIndex.lastTopRow = this.topRow();
|
||||
Window_ItemBookIndex.lastIndex = this.index();
|
||||
};
|
||||
|
||||
function Window_ItemBookStatus() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_ItemBookStatus.prototype = Object.create(Window_Base.prototype);
|
||||
Window_ItemBookStatus.prototype.constructor = Window_ItemBookStatus;
|
||||
|
||||
Window_ItemBookStatus.prototype.initialize = function (x, y, width, height) {
|
||||
Window_Base.prototype.initialize.call(this, x, y, width, height);
|
||||
};
|
||||
|
||||
Window_ItemBookStatus.prototype.setItem = function (item) {
|
||||
if (this._item !== item) {
|
||||
this._item = item;
|
||||
this.refresh();
|
||||
}
|
||||
};
|
||||
|
||||
Window_ItemBookStatus.prototype.refresh = function () {
|
||||
var item = this._item;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
var lineHeight = this.lineHeight();
|
||||
|
||||
this.contents.clear();
|
||||
|
||||
if (!item || !$gameSystem.isInItemBook(item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Scene_ItemBook.prototype = Object.create(Scene_MenuBase.prototype);
|
||||
Scene_ItemBook.prototype.constructor = Scene_ItemBook;
|
||||
this.drawItemName(item, x, y);
|
||||
|
||||
Scene_ItemBook.prototype.initialize = function () {
|
||||
Scene_MenuBase.prototype.initialize.call(this);
|
||||
};
|
||||
x = this.textPadding();
|
||||
y = lineHeight + this.textPadding();
|
||||
|
||||
Scene_ItemBook.prototype.create = function () {
|
||||
Scene_MenuBase.prototype.create.call(this);
|
||||
this._indexWindow = new Window_ItemBookIndex(0, 0);
|
||||
this._indexWindow.setHandler('cancel', this.popScene.bind(this));
|
||||
var wy = this._indexWindow.height;
|
||||
var ww = Graphics.boxWidth;
|
||||
var wh = Graphics.boxHeight - wy;
|
||||
this._statusWindow = new Window_ItemBookStatus(0, wy, ww, wh);
|
||||
this.addWindow(this._indexWindow);
|
||||
this.addWindow(this._statusWindow);
|
||||
this._indexWindow.setStatusWindow(this._statusWindow);
|
||||
};
|
||||
var price = item.price > 0 ? item.price : "-";
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(priceText, x, y, 120);
|
||||
this.resetTextColor();
|
||||
this.drawText(price, x + 120, y, 120, "right");
|
||||
y += lineHeight;
|
||||
|
||||
function Window_ItemBookIndex() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {
|
||||
var etype = $dataSystem.equipTypes[item.etypeId];
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(equipText, x, y, 120);
|
||||
this.resetTextColor();
|
||||
this.drawText(etype, x + 120, y, 120, "right");
|
||||
y += lineHeight;
|
||||
|
||||
Window_ItemBookIndex.prototype = Object.create(Window_Selectable.prototype);
|
||||
Window_ItemBookIndex.prototype.constructor = Window_ItemBookIndex;
|
||||
var type;
|
||||
if (DataManager.isWeapon(item)) {
|
||||
type = $dataSystem.weaponTypes[item.wtypeId];
|
||||
} else {
|
||||
type = $dataSystem.armorTypes[item.atypeId];
|
||||
}
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(typeText, x, y, 120);
|
||||
this.resetTextColor();
|
||||
this.drawText(type, x + 120, y, 120, "right");
|
||||
|
||||
Window_ItemBookIndex.lastTopRow = 0;
|
||||
Window_ItemBookIndex.lastIndex = 0;
|
||||
|
||||
Window_ItemBookIndex.prototype.initialize = function (x, y) {
|
||||
var width = Graphics.boxWidth;
|
||||
var height = this.fittingHeight(6);
|
||||
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
|
||||
this.refresh();
|
||||
this.setTopRow(Window_ItemBookIndex.lastTopRow);
|
||||
this.select(Window_ItemBookIndex.lastIndex);
|
||||
this.activate();
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.maxCols = function () {
|
||||
return 3;
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.maxItems = function () {
|
||||
return this._list ? this._list.length : 0;
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.setStatusWindow = function (statusWindow) {
|
||||
this._statusWindow = statusWindow;
|
||||
this.updateStatus();
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.update = function () {
|
||||
Window_Selectable.prototype.update.call(this);
|
||||
this.updateStatus();
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.updateStatus = function () {
|
||||
if (this._statusWindow) {
|
||||
var item = this._list[this.index()];
|
||||
this._statusWindow.setItem(item);
|
||||
}
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.refresh = function () {
|
||||
var i, item;
|
||||
this._list = [];
|
||||
for (i = 1; i < $dataItems.length; i++) {
|
||||
item = $dataItems[i];
|
||||
if (item.name && item.itypeId === 1 && item.meta.book !== 'no') {
|
||||
this._list.push(item);
|
||||
}
|
||||
}
|
||||
for (i = 1; i < $dataWeapons.length; i++) {
|
||||
item = $dataWeapons[i];
|
||||
if (item.name && item.meta.book !== 'no') {
|
||||
this._list.push(item);
|
||||
}
|
||||
}
|
||||
for (i = 1; i < $dataArmors.length; i++) {
|
||||
item = $dataArmors[i];
|
||||
if (item.name && item.meta.book !== 'no') {
|
||||
this._list.push(item);
|
||||
}
|
||||
}
|
||||
this.createContents();
|
||||
this.drawAllItems();
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.drawItem = function (index) {
|
||||
var item = this._list[index];
|
||||
var rect = this.itemRect(index);
|
||||
var width = rect.width - this.textPadding();
|
||||
if ($gameSystem.isInItemBook(item)) {
|
||||
this.drawItemName(item, rect.x, rect.y, width);
|
||||
} else {
|
||||
var iw = Window_Base._iconWidth + 4;
|
||||
this.drawText(unknownData, rect.x + iw, rect.y, width - iw);
|
||||
}
|
||||
};
|
||||
|
||||
Window_ItemBookIndex.prototype.processCancel = function () {
|
||||
Window_Selectable.prototype.processCancel.call(this);
|
||||
Window_ItemBookIndex.lastTopRow = this.topRow();
|
||||
Window_ItemBookIndex.lastIndex = this.index();
|
||||
};
|
||||
|
||||
function Window_ItemBookStatus() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Window_ItemBookStatus.prototype = Object.create(Window_Base.prototype);
|
||||
Window_ItemBookStatus.prototype.constructor = Window_ItemBookStatus;
|
||||
|
||||
Window_ItemBookStatus.prototype.initialize = function (x, y, width, height) {
|
||||
Window_Base.prototype.initialize.call(this, x, y, width, height);
|
||||
};
|
||||
|
||||
Window_ItemBookStatus.prototype.setItem = function (item) {
|
||||
if (this._item !== item) {
|
||||
this._item = item;
|
||||
this.refresh();
|
||||
}
|
||||
};
|
||||
|
||||
Window_ItemBookStatus.prototype.refresh = function () {
|
||||
var item = this._item;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
var lineHeight = this.lineHeight();
|
||||
|
||||
this.contents.clear();
|
||||
|
||||
if (!item || !$gameSystem.isInItemBook(item)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.drawItemName(item, x, y);
|
||||
|
||||
x = this.textPadding();
|
||||
y = lineHeight + this.textPadding();
|
||||
|
||||
var price = item.price > 0 ? item.price : '-';
|
||||
x = this.textPadding() + 300;
|
||||
y = lineHeight + this.textPadding();
|
||||
for (var i = 2; i < 8; i++) {
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(priceText, x, y, 120);
|
||||
this.drawText(TextManager.param(i), x, y, 160);
|
||||
this.resetTextColor();
|
||||
this.drawText(price, x + 120, y, 120, 'right');
|
||||
this.drawText(item.params[i], x + 160, y, 60, "right");
|
||||
y += lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
if (DataManager.isWeapon(item) || DataManager.isArmor(item)) {
|
||||
var etype = $dataSystem.equipTypes[item.etypeId];
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(equipText, x, y, 120);
|
||||
this.resetTextColor();
|
||||
this.drawText(etype, x + 120, y, 120, 'right');
|
||||
y += lineHeight;
|
||||
|
||||
var type;
|
||||
if (DataManager.isWeapon(item)) {
|
||||
type = $dataSystem.weaponTypes[item.wtypeId];
|
||||
} else {
|
||||
type = $dataSystem.armorTypes[item.atypeId];
|
||||
}
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(typeText, x, y, 120);
|
||||
this.resetTextColor();
|
||||
this.drawText(type, x + 120, y, 120, 'right');
|
||||
|
||||
x = this.textPadding() + 300;
|
||||
y = lineHeight + this.textPadding();
|
||||
for (var i = 2; i < 8; i++) {
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(TextManager.param(i), x, y, 160);
|
||||
this.resetTextColor();
|
||||
this.drawText(item.params[i], x + 160, y, 60, 'right');
|
||||
y += lineHeight;
|
||||
}
|
||||
}
|
||||
|
||||
x = 0;
|
||||
y = this.textPadding() * 2 + lineHeight * 7;
|
||||
this.drawTextEx(item.description, x, y);
|
||||
};
|
||||
|
||||
x = 0;
|
||||
y = this.textPadding() * 2 + lineHeight * 7;
|
||||
this.drawTextEx(item.description, x, y);
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -5,56 +5,58 @@
|
|||
/*:ja
|
||||
* @plugindesc ver1.00 メニューコマンドにロードを追加します。
|
||||
* @author まっつUP
|
||||
*
|
||||
*
|
||||
* @param loadtext
|
||||
* @desc コマンド「ロード」のコマンド名です。
|
||||
* @default ロード
|
||||
*
|
||||
* @help
|
||||
*
|
||||
*
|
||||
* RPGで笑顔を・・・
|
||||
*
|
||||
*
|
||||
* このヘルプとパラメータの説明をよくお読みになってからお使いください。
|
||||
*
|
||||
*
|
||||
* コマンド「ロード」はイベントテスト中またはセーブデータがないときは選択不能になります。
|
||||
*
|
||||
*
|
||||
* このプラグインを利用する場合は
|
||||
* readmeなどに「まっつUP」の名を入れてください。
|
||||
* また、素材のみの販売はダメです。
|
||||
* 上記以外の規約等はございません。
|
||||
* もちろんツクールMVで使用する前提です。
|
||||
* 何か不具合ありましたら気軽にどうぞ。
|
||||
*
|
||||
*
|
||||
* 免責事項:
|
||||
* このプラグインを利用したことによるいかなる損害も制作者は一切の責任を負いません。
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
(function () {
|
||||
var parameters = PluginManager.parameters("LoadComSim");
|
||||
var LCSloadtext = String(parameters["loadtext"] || "ロード");
|
||||
|
||||
var parameters = PluginManager.parameters('LoadComSim');
|
||||
var LCSloadtext = String(parameters['loadtext'] || 'ロード');
|
||||
var _Scene_Menu_createCommandWindow =
|
||||
Scene_Menu.prototype.createCommandWindow;
|
||||
Scene_Menu.prototype.createCommandWindow = function () {
|
||||
_Scene_Menu_createCommandWindow.call(this);
|
||||
this._commandWindow.setHandler("load", this.commandLoad.bind(this));
|
||||
};
|
||||
|
||||
var _Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
|
||||
Scene_Menu.prototype.createCommandWindow = function () {
|
||||
_Scene_Menu_createCommandWindow.call(this);
|
||||
this._commandWindow.setHandler('load', this.commandLoad.bind(this));
|
||||
};
|
||||
Scene_Menu.prototype.commandLoad = function () {
|
||||
//新規
|
||||
SceneManager.push(Scene_Load);
|
||||
};
|
||||
|
||||
Scene_Menu.prototype.commandLoad = function () { //新規
|
||||
SceneManager.push(Scene_Load);
|
||||
};
|
||||
|
||||
var _Window_MenuCommand_addSaveCommand = Window_MenuCommand.prototype.addSaveCommand;
|
||||
Window_MenuCommand.prototype.addSaveCommand = function () {
|
||||
_Window_MenuCommand_addSaveCommand.call(this);
|
||||
var enabled = this.isLoadEnabled();
|
||||
this.addCommand(LCSloadtext, 'load', enabled);
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.isLoadEnabled = function () { //新規
|
||||
if (DataManager.isEventTest()) return false; //この行はイベントテスト中かどうか判定しています。
|
||||
return DataManager.isAnySavefileExists();
|
||||
};
|
||||
var _Window_MenuCommand_addSaveCommand =
|
||||
Window_MenuCommand.prototype.addSaveCommand;
|
||||
Window_MenuCommand.prototype.addSaveCommand = function () {
|
||||
_Window_MenuCommand_addSaveCommand.call(this);
|
||||
var enabled = this.isLoadEnabled();
|
||||
this.addCommand(LCSloadtext, "load", enabled);
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.isLoadEnabled = function () {
|
||||
//新規
|
||||
if (DataManager.isEventTest()) return false; //この行はイベントテスト中かどうか判定しています。
|
||||
return DataManager.isAnySavefileExists();
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -19,12 +19,12 @@
|
|||
* アイテム等のメモ欄に
|
||||
* <MNKR_SwitchSell>
|
||||
* と入れてください。
|
||||
*
|
||||
*
|
||||
* プラグインパラメーターで指定したスイッチがONの時に、
|
||||
* ショップで売却できなくなります。
|
||||
*
|
||||
*
|
||||
* 購入可能で、売却不可のアイテムが作れます。
|
||||
*
|
||||
*
|
||||
*
|
||||
* 利用規約:
|
||||
* MITライセンスです。
|
||||
|
|
@ -44,9 +44,12 @@
|
|||
(() => {
|
||||
"use strict";
|
||||
|
||||
const pluginName = document.currentScript.src.split("/").pop().replace(/\.js$/, "");
|
||||
const pluginName = document.currentScript.src
|
||||
.split("/")
|
||||
.pop()
|
||||
.replace(/\.js$/, "");
|
||||
const parameters = PluginManager.parameters(pluginName);
|
||||
const switchId = Number(parameters['switchId'] || 0);
|
||||
const switchId = Number(parameters["switchId"] || 0);
|
||||
|
||||
const _Window_ShopSell_isEnabled = Window_ShopSell.prototype.isEnabled;
|
||||
Window_ShopSell.prototype.isEnabled = function (item) {
|
||||
|
|
@ -55,7 +58,8 @@
|
|||
if (item && item.meta) {
|
||||
isTag = item.meta.MNKR_SwitchSell;
|
||||
}
|
||||
return (switchSell && isTag) ? false : _Window_ShopSell_isEnabled.call(this, item);
|
||||
return switchSell && isTag
|
||||
? false
|
||||
: _Window_ShopSell_isEnabled.call(this, item);
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -28,8 +28,8 @@
|
|||
*
|
||||
* @param Custom Image
|
||||
* @desc The image to use when showing "Made with MV"
|
||||
* Default:
|
||||
* @default
|
||||
* Default:
|
||||
* @default
|
||||
* @require 1
|
||||
* @dir img/system/
|
||||
* @type file
|
||||
|
|
@ -59,7 +59,7 @@
|
|||
* @help このプラグインにはプラグインコマンドはありません。
|
||||
*
|
||||
* @param Show Made With MV
|
||||
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします。
|
||||
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします。
|
||||
* OFF - false ON - true
|
||||
* デフォルト: ON
|
||||
* @default true
|
||||
|
|
@ -73,15 +73,15 @@
|
|||
* @type file
|
||||
*
|
||||
* @param Show Custom Splash
|
||||
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします。
|
||||
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします。
|
||||
* OFF - false ON - true
|
||||
* デフォルト: OFF
|
||||
* @default false
|
||||
*
|
||||
* @param Custom Image
|
||||
* @desc "Made with MV"を表示する際に使用する画像
|
||||
* デフォルト:
|
||||
* @default
|
||||
* デフォルト:
|
||||
* @default
|
||||
* @require 1
|
||||
* @dir img/system/
|
||||
* @type file
|
||||
|
|
@ -104,16 +104,26 @@
|
|||
*/
|
||||
var Liquidize = Liquidize || {};
|
||||
Liquidize.MadeWithMV = {};
|
||||
Liquidize.MadeWithMV.Parameters = PluginManager.parameters('MadeWithMv');
|
||||
|
||||
Liquidize.MadeWithMV.ShowMV = JSON.parse(Liquidize.MadeWithMV.Parameters["Show Made With MV"]);
|
||||
Liquidize.MadeWithMV.MVImage = String(Liquidize.MadeWithMV.Parameters["Made with MV Image"]);
|
||||
Liquidize.MadeWithMV.ShowCustom = JSON.parse(Liquidize.MadeWithMV.Parameters["Show Custom Splash"]);
|
||||
Liquidize.MadeWithMV.CustomImage = String(Liquidize.MadeWithMV.Parameters["Custom Image"]);
|
||||
Liquidize.MadeWithMV.FadeOutTime = Number(Liquidize.MadeWithMV.Parameters["Fade Out Time"]) || 120;
|
||||
Liquidize.MadeWithMV.FadeInTime = Number(Liquidize.MadeWithMV.Parameters["Fade In Time"]) || 120;
|
||||
Liquidize.MadeWithMV.WaitTime = Number(Liquidize.MadeWithMV.Parameters["Wait Time"]) || 160;
|
||||
Liquidize.MadeWithMV.Parameters = PluginManager.parameters("MadeWithMv");
|
||||
|
||||
Liquidize.MadeWithMV.ShowMV = JSON.parse(
|
||||
Liquidize.MadeWithMV.Parameters["Show Made With MV"]
|
||||
);
|
||||
Liquidize.MadeWithMV.MVImage = String(
|
||||
Liquidize.MadeWithMV.Parameters["Made with MV Image"]
|
||||
);
|
||||
Liquidize.MadeWithMV.ShowCustom = JSON.parse(
|
||||
Liquidize.MadeWithMV.Parameters["Show Custom Splash"]
|
||||
);
|
||||
Liquidize.MadeWithMV.CustomImage = String(
|
||||
Liquidize.MadeWithMV.Parameters["Custom Image"]
|
||||
);
|
||||
Liquidize.MadeWithMV.FadeOutTime =
|
||||
Number(Liquidize.MadeWithMV.Parameters["Fade Out Time"]) || 120;
|
||||
Liquidize.MadeWithMV.FadeInTime =
|
||||
Number(Liquidize.MadeWithMV.Parameters["Fade In Time"]) || 120;
|
||||
Liquidize.MadeWithMV.WaitTime =
|
||||
Number(Liquidize.MadeWithMV.Parameters["Wait Time"]) || 160;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Splash
|
||||
|
|
@ -121,184 +131,194 @@ Liquidize.MadeWithMV.WaitTime = Number(Liquidize.MadeWithMV.Parameters["Wait Tim
|
|||
// This is a constructor, implementation is done in the inner scope.
|
||||
|
||||
function Scene_Splash() {
|
||||
this.initialize.apply(this, arguments);
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
(function () {
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Boot
|
||||
//
|
||||
// The scene class for dealing with the game boot.
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Boot
|
||||
//
|
||||
// The scene class for dealing with the game boot.
|
||||
var _Scene_Boot_loadSystemImages = Scene_Boot.prototype.loadSystemImages;
|
||||
Scene_Boot.prototype.loadSystemImages = function () {
|
||||
_Scene_Boot_loadSystemImages.call(this);
|
||||
if (Liquidize.MadeWithMV.ShowMV) {
|
||||
ImageManager.loadSystem(Liquidize.MadeWithMV.MVImage);
|
||||
}
|
||||
if (Liquidize.MadeWithMV.ShowCustom) {
|
||||
ImageManager.loadSystem(Liquidize.MadeWithMV.CustomImage);
|
||||
}
|
||||
};
|
||||
|
||||
var _Scene_Boot_loadSystemImages = Scene_Boot.prototype.loadSystemImages;
|
||||
Scene_Boot.prototype.loadSystemImages = function () {
|
||||
_Scene_Boot_loadSystemImages.call(this);
|
||||
if (Liquidize.MadeWithMV.ShowMV) {
|
||||
ImageManager.loadSystem(Liquidize.MadeWithMV.MVImage);
|
||||
}
|
||||
if (Liquidize.MadeWithMV.ShowCustom) {
|
||||
ImageManager.loadSystem(Liquidize.MadeWithMV.CustomImage);
|
||||
}
|
||||
};
|
||||
var _Scene_Boot_start = Scene_Boot.prototype.start;
|
||||
Scene_Boot.prototype.start = function () {
|
||||
if (
|
||||
(Liquidize.MadeWithMV.ShowMV || Liquidize.MadeWithMV.ShowCustom) &&
|
||||
!DataManager.isBattleTest() &&
|
||||
!DataManager.isEventTest()
|
||||
) {
|
||||
SceneManager.goto(Scene_Splash);
|
||||
} else {
|
||||
_Scene_Boot_start.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
var _Scene_Boot_start = Scene_Boot.prototype.start;
|
||||
Scene_Boot.prototype.start = function () {
|
||||
if ((Liquidize.MadeWithMV.ShowMV || Liquidize.MadeWithMV.ShowCustom) && !DataManager.isBattleTest() && !DataManager.isEventTest()) {
|
||||
SceneManager.goto(Scene_Splash);
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Splash
|
||||
//
|
||||
// The scene class for dealing with the splash screens.
|
||||
|
||||
Scene_Splash.prototype = Object.create(Scene_Base.prototype);
|
||||
Scene_Splash.prototype.constructor = Scene_Splash;
|
||||
|
||||
Scene_Splash.prototype.initialize = function () {
|
||||
Scene_Base.prototype.initialize.call(this);
|
||||
this._mvSplash = null;
|
||||
this._customSplash = null;
|
||||
this._mvWaitTime = Liquidize.MadeWithMV.WaitTime;
|
||||
this._customWaitTime = Liquidize.MadeWithMV.WaitTime;
|
||||
this._mvFadeOut = false;
|
||||
this._mvFadeIn = false;
|
||||
this._customFadeOut = false;
|
||||
this._customFadeIn = false;
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.create = function () {
|
||||
Scene_Base.prototype.create.call(this);
|
||||
this.createSplashes();
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.start = function () {
|
||||
Scene_Base.prototype.start.call(this);
|
||||
SceneManager.clearStack();
|
||||
if (this._mvSplash != null) {
|
||||
this.centerSprite(this._mvSplash);
|
||||
}
|
||||
if (this._customSplash != null) {
|
||||
this.centerSprite(this._customSplash);
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.update = function () {
|
||||
if (Liquidize.MadeWithMV.ShowMV) {
|
||||
if (!this._mvFadeIn) {
|
||||
this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false);
|
||||
this._mvFadeIn = true;
|
||||
} else {
|
||||
if (this._mvWaitTime > 0 && this._mvFadeOut == false) {
|
||||
this._mvWaitTime--;
|
||||
} else {
|
||||
_Scene_Boot_start.call(this);
|
||||
if (this._mvFadeOut == false) {
|
||||
this._mvFadeOut = true;
|
||||
this.startFadeOut(Liquidize.MadeWithMV.FadeOutTime, false);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Splash
|
||||
//
|
||||
// The scene class for dealing with the splash screens.
|
||||
|
||||
Scene_Splash.prototype = Object.create(Scene_Base.prototype);
|
||||
Scene_Splash.prototype.constructor = Scene_Splash;
|
||||
|
||||
Scene_Splash.prototype.initialize = function () {
|
||||
Scene_Base.prototype.initialize.call(this);
|
||||
this._mvSplash = null;
|
||||
this._customSplash = null;
|
||||
this._mvWaitTime = Liquidize.MadeWithMV.WaitTime;
|
||||
this._customWaitTime = Liquidize.MadeWithMV.WaitTime;
|
||||
this._mvFadeOut = false;
|
||||
this._mvFadeIn = false;
|
||||
this._customFadeOut = false;
|
||||
this._customFadeIn = false;
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.create = function () {
|
||||
Scene_Base.prototype.create.call(this);
|
||||
this.createSplashes();
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.start = function () {
|
||||
Scene_Base.prototype.start.call(this);
|
||||
SceneManager.clearStack();
|
||||
if (this._mvSplash != null) {
|
||||
this.centerSprite(this._mvSplash);
|
||||
}
|
||||
if (this._customSplash != null) {
|
||||
this.centerSprite(this._customSplash);
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.update = function () {
|
||||
if (Liquidize.MadeWithMV.ShowMV) {
|
||||
if (!this._mvFadeIn) {
|
||||
this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false);
|
||||
this._mvFadeIn = true;
|
||||
} else {
|
||||
if (this._mvWaitTime > 0 && this._mvFadeOut == false) {
|
||||
this._mvWaitTime--;
|
||||
} else {
|
||||
if (this._mvFadeOut == false) {
|
||||
this._mvFadeOut = true;
|
||||
this.startFadeOut(Liquidize.MadeWithMV.FadeOutTime, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Liquidize.MadeWithMV.ShowCustom) {
|
||||
if (Liquidize.MadeWithMV.ShowMV && this._mvFadeOut == true) {
|
||||
if (!this._customFadeIn && this._fadeDuration == 0) {
|
||||
this._customSplash.opacity = 255;
|
||||
this._customWaitTime = Liquidize.MadeWithMV.WaitTime;
|
||||
this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false);
|
||||
this._customFadeIn = true;
|
||||
} else {
|
||||
if (this._customWaitTime > 0 && this._customFadeOut == false) {
|
||||
this._customWaitTime--;
|
||||
} else {
|
||||
if (this._customFadeOut == false) {
|
||||
this._customFadeOut = true;
|
||||
this.startFadeOut(Liquidize.MadeWithMV.FadeOutTime, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!Liquidize.MadeWithMV.ShowMV) {
|
||||
if (!this._customFadeIn) {
|
||||
this._customSplash.opacity = 255;
|
||||
this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false);
|
||||
this._customFadeIn = true;
|
||||
} else {
|
||||
if (this._customWaitTime > 0 && this._customFadeOut == false) {
|
||||
this._customWaitTime--;
|
||||
} else {
|
||||
if (this._customFadeOut == false) {
|
||||
this._customFadeOut = true;
|
||||
this.startFadeOut(Liquidize.MadeWithMV.FadeOutTime, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Liquidize.MadeWithMV.ShowCustom) {
|
||||
if (Liquidize.MadeWithMV.ShowMV && this._mvFadeOut == true && this._customFadeOut == true) {
|
||||
this.gotoTitleOrTest();
|
||||
} else if (!Liquidize.MadeWithMV.ShowMV && this._customFadeOut == true) {
|
||||
this.gotoTitleOrTest();
|
||||
}
|
||||
if (Liquidize.MadeWithMV.ShowCustom) {
|
||||
if (Liquidize.MadeWithMV.ShowMV && this._mvFadeOut == true) {
|
||||
if (!this._customFadeIn && this._fadeDuration == 0) {
|
||||
this._customSplash.opacity = 255;
|
||||
this._customWaitTime = Liquidize.MadeWithMV.WaitTime;
|
||||
this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false);
|
||||
this._customFadeIn = true;
|
||||
} else {
|
||||
if (this._mvFadeOut == true) {
|
||||
this.gotoTitleOrTest();
|
||||
if (this._customWaitTime > 0 && this._customFadeOut == false) {
|
||||
this._customWaitTime--;
|
||||
} else {
|
||||
if (this._customFadeOut == false) {
|
||||
this._customFadeOut = true;
|
||||
this.startFadeOut(Liquidize.MadeWithMV.FadeOutTime, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Scene_Base.prototype.update.call(this);
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.createSplashes = function () {
|
||||
if (Liquidize.MadeWithMV.ShowMV) {
|
||||
this._mvSplash = new Sprite(ImageManager.loadSystem(Liquidize.MadeWithMV.MVImage));
|
||||
this.addChild(this._mvSplash);
|
||||
}
|
||||
if (Liquidize.MadeWithMV.ShowCustom) {
|
||||
this._customSplash = new Sprite(ImageManager.loadSystem(Liquidize.MadeWithMV.CustomImage));
|
||||
this._customSplash.opacity = 0;
|
||||
this.addChild(this._customSplash);
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.centerSprite = function (sprite) {
|
||||
sprite.x = Graphics.width / 2;
|
||||
sprite.y = Graphics.height / 2;
|
||||
sprite.anchor.x = 0.5;
|
||||
sprite.anchor.y = 0.5;
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.gotoTitleOrTest = function () {
|
||||
Scene_Base.prototype.start.call(this);
|
||||
SoundManager.preloadImportantSounds();
|
||||
if (DataManager.isBattleTest()) {
|
||||
DataManager.setupBattleTest();
|
||||
SceneManager.goto(Scene_Battle);
|
||||
} else if (DataManager.isEventTest()) {
|
||||
DataManager.setupEventTest();
|
||||
SceneManager.goto(Scene_Map);
|
||||
} else if (!Liquidize.MadeWithMV.ShowMV) {
|
||||
if (!this._customFadeIn) {
|
||||
this._customSplash.opacity = 255;
|
||||
this.startFadeIn(Liquidize.MadeWithMV.FadeInTime, false);
|
||||
this._customFadeIn = true;
|
||||
} else {
|
||||
this.checkPlayerLocation();
|
||||
DataManager.setupNewGame();
|
||||
SceneManager.goto(Scene_Title);
|
||||
Window_TitleCommand.initCommandPosition();
|
||||
if (this._customWaitTime > 0 && this._customFadeOut == false) {
|
||||
this._customWaitTime--;
|
||||
} else {
|
||||
if (this._customFadeOut == false) {
|
||||
this._customFadeOut = true;
|
||||
this.startFadeOut(Liquidize.MadeWithMV.FadeOutTime, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateDocumentTitle();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Scene_Splash.prototype.updateDocumentTitle = function () {
|
||||
document.title = $dataSystem.gameTitle;
|
||||
};
|
||||
if (Liquidize.MadeWithMV.ShowCustom) {
|
||||
if (
|
||||
Liquidize.MadeWithMV.ShowMV &&
|
||||
this._mvFadeOut == true &&
|
||||
this._customFadeOut == true
|
||||
) {
|
||||
this.gotoTitleOrTest();
|
||||
} else if (!Liquidize.MadeWithMV.ShowMV && this._customFadeOut == true) {
|
||||
this.gotoTitleOrTest();
|
||||
}
|
||||
} else {
|
||||
if (this._mvFadeOut == true) {
|
||||
this.gotoTitleOrTest();
|
||||
}
|
||||
}
|
||||
|
||||
Scene_Splash.prototype.checkPlayerLocation = function () {
|
||||
if ($dataSystem.startMapId === 0) {
|
||||
throw new Error('Player\'s starting position is not set');
|
||||
}
|
||||
};
|
||||
Scene_Base.prototype.update.call(this);
|
||||
};
|
||||
|
||||
})();
|
||||
Scene_Splash.prototype.createSplashes = function () {
|
||||
if (Liquidize.MadeWithMV.ShowMV) {
|
||||
this._mvSplash = new Sprite(
|
||||
ImageManager.loadSystem(Liquidize.MadeWithMV.MVImage)
|
||||
);
|
||||
this.addChild(this._mvSplash);
|
||||
}
|
||||
if (Liquidize.MadeWithMV.ShowCustom) {
|
||||
this._customSplash = new Sprite(
|
||||
ImageManager.loadSystem(Liquidize.MadeWithMV.CustomImage)
|
||||
);
|
||||
this._customSplash.opacity = 0;
|
||||
this.addChild(this._customSplash);
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.centerSprite = function (sprite) {
|
||||
sprite.x = Graphics.width / 2;
|
||||
sprite.y = Graphics.height / 2;
|
||||
sprite.anchor.x = 0.5;
|
||||
sprite.anchor.y = 0.5;
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.gotoTitleOrTest = function () {
|
||||
Scene_Base.prototype.start.call(this);
|
||||
SoundManager.preloadImportantSounds();
|
||||
if (DataManager.isBattleTest()) {
|
||||
DataManager.setupBattleTest();
|
||||
SceneManager.goto(Scene_Battle);
|
||||
} else if (DataManager.isEventTest()) {
|
||||
DataManager.setupEventTest();
|
||||
SceneManager.goto(Scene_Map);
|
||||
} else {
|
||||
this.checkPlayerLocation();
|
||||
DataManager.setupNewGame();
|
||||
SceneManager.goto(Scene_Title);
|
||||
Window_TitleCommand.initCommandPosition();
|
||||
}
|
||||
this.updateDocumentTitle();
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.updateDocumentTitle = function () {
|
||||
document.title = $dataSystem.gameTitle;
|
||||
};
|
||||
|
||||
Scene_Splash.prototype.checkPlayerLocation = function () {
|
||||
if ($dataSystem.startMapId === 0) {
|
||||
throw new Error("Player's starting position is not set");
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -404,369 +404,450 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
//=============================================================================
|
||||
// ユーザ書き換え領域 - 開始 -
|
||||
// 高度な設定を記述しています。必要な場合は書き換えてください。
|
||||
//=============================================================================
|
||||
var settings = {
|
||||
/* 署名のフォント情報です。faceはあらかじめフォントをロードしておかなければ使えません */
|
||||
signature: { face: 'GameFont', color: 'rgba(255,255,255,1.0)', align: 'right' },
|
||||
/* 効果音情報です。ファイル名はプラグイン管理画面から取得します */
|
||||
se: { volume: 90, pitch: 100, pan: 0 },
|
||||
/* テストプレー以外での動作を無効にするフラグです */
|
||||
testOnly: true
|
||||
};
|
||||
//=============================================================================
|
||||
// ユーザ書き換え領域 - 終了 -
|
||||
//=============================================================================
|
||||
var pluginName = 'MakeScreenCapture';
|
||||
"use strict";
|
||||
//=============================================================================
|
||||
// ユーザ書き換え領域 - 開始 -
|
||||
// 高度な設定を記述しています。必要な場合は書き換えてください。
|
||||
//=============================================================================
|
||||
var settings = {
|
||||
/* 署名のフォント情報です。faceはあらかじめフォントをロードしておかなければ使えません */
|
||||
signature: {
|
||||
face: "GameFont",
|
||||
color: "rgba(255,255,255,1.0)",
|
||||
align: "right",
|
||||
},
|
||||
/* 効果音情報です。ファイル名はプラグイン管理画面から取得します */
|
||||
se: { volume: 90, pitch: 100, pan: 0 },
|
||||
/* テストプレー以外での動作を無効にするフラグです */
|
||||
testOnly: true,
|
||||
};
|
||||
//=============================================================================
|
||||
// ユーザ書き換え領域 - 終了 -
|
||||
//=============================================================================
|
||||
var pluginName = "MakeScreenCapture";
|
||||
|
||||
var getParamString = function (paramNames) {
|
||||
var value = getParamOther(paramNames);
|
||||
return value == null ? '' : value;
|
||||
};
|
||||
var getParamString = function (paramNames) {
|
||||
var value = getParamOther(paramNames);
|
||||
return value == null ? "" : value;
|
||||
};
|
||||
|
||||
var getParamNumber = function (paramNames, min, max) {
|
||||
var value = getParamOther(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value, 10) || 0).clamp(min, max);
|
||||
};
|
||||
var getParamNumber = function (paramNames, min, max) {
|
||||
var value = getParamOther(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value, 10) || 0).clamp(min, max);
|
||||
};
|
||||
|
||||
var getParamBoolean = function (paramNames) {
|
||||
var value = getParamOther(paramNames);
|
||||
return (value || '').toUpperCase() === 'ON' || (value || '').toUpperCase() === 'TRUE';
|
||||
};
|
||||
var getParamBoolean = function (paramNames) {
|
||||
var value = getParamOther(paramNames);
|
||||
return (
|
||||
(value || "").toUpperCase() === "ON" ||
|
||||
(value || "").toUpperCase() === "TRUE"
|
||||
);
|
||||
};
|
||||
|
||||
var getParamOther = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (var i = 0; i < paramNames.length; i++) {
|
||||
var name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return Utils.isNwjs() ? convertEnvironmentVariable(name) : name;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
var getParamOther = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (var i = 0; i < paramNames.length; i++) {
|
||||
var name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return Utils.isNwjs() ? convertEnvironmentVariable(name) : name;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
var getCommandName = function (command) {
|
||||
return (command || '').toUpperCase();
|
||||
};
|
||||
var getCommandName = function (command) {
|
||||
return (command || "").toUpperCase();
|
||||
};
|
||||
|
||||
var getArgString = function (arg, upperFlg) {
|
||||
arg = convertEscapeCharacters(arg);
|
||||
return upperFlg ? arg.toUpperCase() : arg;
|
||||
};
|
||||
var getArgString = function (arg, upperFlg) {
|
||||
arg = convertEscapeCharacters(arg);
|
||||
return upperFlg ? arg.toUpperCase() : arg;
|
||||
};
|
||||
|
||||
var convertEnvironmentVariable = function (text) {
|
||||
if (text == null) text = '';
|
||||
text = text.replace(/%(\w+)%/gi, function () {
|
||||
return process.env[arguments[1]] || '';
|
||||
}.bind(this));
|
||||
return text;
|
||||
};
|
||||
var convertEnvironmentVariable = function (text) {
|
||||
if (text == null) text = "";
|
||||
text = text.replace(
|
||||
/%(\w+)%/gi,
|
||||
function () {
|
||||
return process.env[arguments[1]] || "";
|
||||
}.bind(this)
|
||||
);
|
||||
return text;
|
||||
};
|
||||
|
||||
var convertEscapeCharacters = function (text) {
|
||||
if (text == null) text = '';
|
||||
var window = SceneManager._scene._windowLayer.children[0];
|
||||
return window ? window.convertEscapeCharacters(text) : text;
|
||||
};
|
||||
var convertEscapeCharacters = function (text) {
|
||||
if (text == null) text = "";
|
||||
var window = SceneManager._scene._windowLayer.children[0];
|
||||
return window ? window.convertEscapeCharacters(text) : text;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
var paramFuncKeyPngCapture = getParamString(['FuncKeyPngCapture', 'PNGキャプチャキー']);
|
||||
var paramFuncKeyJpegCapture = getParamString(['FuncKeyJpegCapture', 'JPEGキャプチャキー']);
|
||||
var paramFuncKeyWebpCapture = getParamString(['FuncKeyWebpCapture', 'WEBPキャプチャキー']);
|
||||
var paramFileName = getParamString(['FileName', 'ファイル名']);
|
||||
var paramLocation = getParamString(['Location', '出力場所']);
|
||||
var paramFileFormat = getParamString(['FileFormat', '保存形式']).toLowerCase();
|
||||
var paramSignature = getParamString(['Signature', '署名']);
|
||||
var paramSignatureImage = getParamString(['SignatureImage', '署名画像']);
|
||||
var paramSignatureSize = getParamNumber(['SignatureSize', '署名サイズ']);
|
||||
var paramNumberDigit = getParamNumber(['NumberDigit', '連番桁数']);
|
||||
var paramInterval = getParamNumber(['Interval', '実行間隔']);
|
||||
var paramSeName = getParamString(['SeName', '効果音']);
|
||||
var paramTimeStamp = getParamBoolean(['TimeStamp', 'タイムスタンプ']);
|
||||
var paramJpegQuality = getParamNumber(['JpegQuality', 'JPEG品質']);
|
||||
var paramSimultaneousCtrl = getParamBoolean(['SimultaneousCtrl', 'Ctrl同時押し']);
|
||||
var paramSimultaneousAlt = getParamBoolean(['SimultaneousAlt', 'Alt同時押し']);
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
var paramFuncKeyPngCapture = getParamString([
|
||||
"FuncKeyPngCapture",
|
||||
"PNGキャプチャキー",
|
||||
]);
|
||||
var paramFuncKeyJpegCapture = getParamString([
|
||||
"FuncKeyJpegCapture",
|
||||
"JPEGキャプチャキー",
|
||||
]);
|
||||
var paramFuncKeyWebpCapture = getParamString([
|
||||
"FuncKeyWebpCapture",
|
||||
"WEBPキャプチャキー",
|
||||
]);
|
||||
var paramFileName = getParamString(["FileName", "ファイル名"]);
|
||||
var paramLocation = getParamString(["Location", "出力場所"]);
|
||||
var paramFileFormat = getParamString([
|
||||
"FileFormat",
|
||||
"保存形式",
|
||||
]).toLowerCase();
|
||||
var paramSignature = getParamString(["Signature", "署名"]);
|
||||
var paramSignatureImage = getParamString(["SignatureImage", "署名画像"]);
|
||||
var paramSignatureSize = getParamNumber(["SignatureSize", "署名サイズ"]);
|
||||
var paramNumberDigit = getParamNumber(["NumberDigit", "連番桁数"]);
|
||||
var paramInterval = getParamNumber(["Interval", "実行間隔"]);
|
||||
var paramSeName = getParamString(["SeName", "効果音"]);
|
||||
var paramTimeStamp = getParamBoolean(["TimeStamp", "タイムスタンプ"]);
|
||||
var paramJpegQuality = getParamNumber(["JpegQuality", "JPEG品質"]);
|
||||
var paramSimultaneousCtrl = getParamBoolean([
|
||||
"SimultaneousCtrl",
|
||||
"Ctrl同時押し",
|
||||
]);
|
||||
var paramSimultaneousAlt = getParamBoolean([
|
||||
"SimultaneousAlt",
|
||||
"Alt同時押し",
|
||||
]);
|
||||
|
||||
//=============================================================================
|
||||
// Game_Interpreter
|
||||
// プラグインコマンドを追加定義します。
|
||||
//=============================================================================
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
this.pluginCommandMakeScreenCapture(command, args);
|
||||
};
|
||||
//=============================================================================
|
||||
// Game_Interpreter
|
||||
// プラグインコマンドを追加定義します。
|
||||
//=============================================================================
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
this.pluginCommandMakeScreenCapture(command, args);
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.pluginCommandMakeScreenCapture = function (command, args) {
|
||||
switch (getCommandName(command)) {
|
||||
case 'MSC_MAKE':
|
||||
case '画面キャプチャ作成':
|
||||
SceneManager.makeCapture();
|
||||
break;
|
||||
case 'MSC_PICTURE':
|
||||
case '画面キャプチャピクチャ':
|
||||
$gameScreen.captureFlg = true;
|
||||
break;
|
||||
case 'MSC_SAVE':
|
||||
case '画面キャプチャ保存':
|
||||
SceneManager.saveCapture(getArgString(args[0]) || paramFileName, paramFileFormat);
|
||||
break;
|
||||
}
|
||||
};
|
||||
Game_Interpreter.prototype.pluginCommandMakeScreenCapture = function (
|
||||
command,
|
||||
args
|
||||
) {
|
||||
switch (getCommandName(command)) {
|
||||
case "MSC_MAKE":
|
||||
case "画面キャプチャ作成":
|
||||
SceneManager.makeCapture();
|
||||
break;
|
||||
case "MSC_PICTURE":
|
||||
case "画面キャプチャピクチャ":
|
||||
$gameScreen.captureFlg = true;
|
||||
break;
|
||||
case "MSC_SAVE":
|
||||
case "画面キャプチャ保存":
|
||||
SceneManager.saveCapture(
|
||||
getArgString(args[0]) || paramFileName,
|
||||
paramFileFormat
|
||||
);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Screen
|
||||
// キャプチャピクチャ用のプロパティを追加定義します。
|
||||
//=============================================================================
|
||||
var _Game_Screen_clear = Game_Screen.prototype.clear;
|
||||
Game_Screen.prototype.clear = function () {
|
||||
_Game_Screen_clear.apply(this, arguments);
|
||||
this.clearCapturePicture();
|
||||
};
|
||||
//=============================================================================
|
||||
// Game_Screen
|
||||
// キャプチャピクチャ用のプロパティを追加定義します。
|
||||
//=============================================================================
|
||||
var _Game_Screen_clear = Game_Screen.prototype.clear;
|
||||
Game_Screen.prototype.clear = function () {
|
||||
_Game_Screen_clear.apply(this, arguments);
|
||||
this.clearCapturePicture();
|
||||
};
|
||||
|
||||
Game_Screen.prototype.clearCapturePicture = function () {
|
||||
this.captureFlg = false;
|
||||
};
|
||||
Game_Screen.prototype.clearCapturePicture = function () {
|
||||
this.captureFlg = false;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Picture
|
||||
// キャプチャピクチャ用のプロパティを追加定義します。
|
||||
//=============================================================================
|
||||
var _Game_Picture_show = Game_Picture.prototype.show;
|
||||
Game_Picture.prototype.show = function (name, origin, x, y, scaleX,
|
||||
scaleY, opacity, blendMode) {
|
||||
if ($gameScreen.captureFlg) {
|
||||
arguments[0] = Date.now().toString();
|
||||
this.captureFlg = true;
|
||||
} else {
|
||||
this.captureFlg = null;
|
||||
}
|
||||
$gameScreen.clearCapturePicture();
|
||||
_Game_Picture_show.apply(this, arguments);
|
||||
};
|
||||
//=============================================================================
|
||||
// Game_Picture
|
||||
// キャプチャピクチャ用のプロパティを追加定義します。
|
||||
//=============================================================================
|
||||
var _Game_Picture_show = Game_Picture.prototype.show;
|
||||
Game_Picture.prototype.show = function (
|
||||
name,
|
||||
origin,
|
||||
x,
|
||||
y,
|
||||
scaleX,
|
||||
scaleY,
|
||||
opacity,
|
||||
blendMode
|
||||
) {
|
||||
if ($gameScreen.captureFlg) {
|
||||
arguments[0] = Date.now().toString();
|
||||
this.captureFlg = true;
|
||||
} else {
|
||||
this.captureFlg = null;
|
||||
}
|
||||
$gameScreen.clearCapturePicture();
|
||||
_Game_Picture_show.apply(this, arguments);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Base
|
||||
// 定期実行キャプチャを定義します。
|
||||
//=============================================================================
|
||||
var _Scene_Base_update = Scene_Base.prototype.update;
|
||||
Scene_Base.prototype.update = function () {
|
||||
_Scene_Base_update.apply(this, arguments);
|
||||
var count = Graphics.frameCount;
|
||||
if (paramInterval !== 0 && Utils.isTestCapture() && (count + 1) % (paramInterval * 60) === 0) {
|
||||
SceneManager.takeCapture();
|
||||
}
|
||||
};
|
||||
//=============================================================================
|
||||
// Scene_Base
|
||||
// 定期実行キャプチャを定義します。
|
||||
//=============================================================================
|
||||
var _Scene_Base_update = Scene_Base.prototype.update;
|
||||
Scene_Base.prototype.update = function () {
|
||||
_Scene_Base_update.apply(this, arguments);
|
||||
var count = Graphics.frameCount;
|
||||
if (
|
||||
paramInterval !== 0 &&
|
||||
Utils.isTestCapture() &&
|
||||
(count + 1) % (paramInterval * 60) === 0
|
||||
) {
|
||||
SceneManager.takeCapture();
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Sprite_Picture
|
||||
// 画像の動的生成を追加定義します。
|
||||
//=============================================================================
|
||||
var _Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap;
|
||||
Sprite_Picture.prototype.loadBitmap = function () {
|
||||
if (this.picture().captureFlg) {
|
||||
this.bitmap = SceneManager.getCapture();
|
||||
} else {
|
||||
_Sprite_Picture_loadBitmap.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
//=============================================================================
|
||||
// Sprite_Picture
|
||||
// 画像の動的生成を追加定義します。
|
||||
//=============================================================================
|
||||
var _Sprite_Picture_loadBitmap = Sprite_Picture.prototype.loadBitmap;
|
||||
Sprite_Picture.prototype.loadBitmap = function () {
|
||||
if (this.picture().captureFlg) {
|
||||
this.bitmap = SceneManager.getCapture();
|
||||
} else {
|
||||
_Sprite_Picture_loadBitmap.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Utils
|
||||
// テスト用のキャプチャを許可するかどうかを返します。
|
||||
//=============================================================================
|
||||
Utils.isTestCapture = function () {
|
||||
return !settings.testOnly || Utils.isOptionValid('test');
|
||||
};
|
||||
//=============================================================================
|
||||
// Utils
|
||||
// テスト用のキャプチャを許可するかどうかを返します。
|
||||
//=============================================================================
|
||||
Utils.isTestCapture = function () {
|
||||
return !settings.testOnly || Utils.isOptionValid("test");
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Bitmap
|
||||
// 対象のビットマップを保存します。現状、ローカル環境下でのみ動作します。
|
||||
//=============================================================================
|
||||
Bitmap.prototype.save = function (fileName, format, extend) {
|
||||
var data = this._canvas.toDataURL('image/' + format, extend);
|
||||
data = data.replace(/^.*,/, '');
|
||||
if (format === 'jpeg') format = 'jpg';
|
||||
if (data) StorageManager.saveImg(fileName, format, data);
|
||||
};
|
||||
//=============================================================================
|
||||
// Bitmap
|
||||
// 対象のビットマップを保存します。現状、ローカル環境下でのみ動作します。
|
||||
//=============================================================================
|
||||
Bitmap.prototype.save = function (fileName, format, extend) {
|
||||
var data = this._canvas.toDataURL("image/" + format, extend);
|
||||
data = data.replace(/^.*,/, "");
|
||||
if (format === "jpeg") format = "jpg";
|
||||
if (data) StorageManager.saveImg(fileName, format, data);
|
||||
};
|
||||
|
||||
Bitmap.prototype.sign = function (text, fontInfo) {
|
||||
this.fontFace = fontInfo.face;
|
||||
this.fontSize = fontInfo.size;
|
||||
this.textColor = fontInfo.color;
|
||||
this.drawText(text, 8, this.height - this.fontSize - 8, this.width - 8 * 2, this.fontSize, fontInfo.align);
|
||||
};
|
||||
Bitmap.prototype.sign = function (text, fontInfo) {
|
||||
this.fontFace = fontInfo.face;
|
||||
this.fontSize = fontInfo.size;
|
||||
this.textColor = fontInfo.color;
|
||||
this.drawText(
|
||||
text,
|
||||
8,
|
||||
this.height - this.fontSize - 8,
|
||||
this.width - 8 * 2,
|
||||
this.fontSize,
|
||||
fontInfo.align
|
||||
);
|
||||
};
|
||||
|
||||
Bitmap.prototype.signAndSave = function (signature, fileName, format, signatureImage) {
|
||||
var fileFullPath = StorageManager.getLocalImgFileName(fileName);
|
||||
if (signatureImage) {
|
||||
this.signImage(signatureImage, signature);
|
||||
}
|
||||
this.sign(convertEscapeCharacters(paramSignature), signature);
|
||||
this.save(fileFullPath, format, format === 'jpeg' ? paramJpegQuality / 10 : undefined);
|
||||
};
|
||||
Bitmap.prototype.signAndSave = function (
|
||||
signature,
|
||||
fileName,
|
||||
format,
|
||||
signatureImage
|
||||
) {
|
||||
var fileFullPath = StorageManager.getLocalImgFileName(fileName);
|
||||
if (signatureImage) {
|
||||
this.signImage(signatureImage, signature);
|
||||
}
|
||||
this.sign(convertEscapeCharacters(paramSignature), signature);
|
||||
this.save(
|
||||
fileFullPath,
|
||||
format,
|
||||
format === "jpeg" ? paramJpegQuality / 10 : undefined
|
||||
);
|
||||
};
|
||||
|
||||
Bitmap.prototype.signImage = function (signBitmap, fontInfo) {
|
||||
var dx = 0, dy = this.height - signBitmap.height;
|
||||
switch (fontInfo.align) {
|
||||
case 'center':
|
||||
dx = this.width / 2 - signBitmap.width / 2;
|
||||
break;
|
||||
case 'right':
|
||||
dx = this.width - signBitmap.width;
|
||||
break;
|
||||
}
|
||||
this.blt(signBitmap, 0, 0, signBitmap.width, signBitmap.height, dx, dy);
|
||||
};
|
||||
Bitmap.prototype.signImage = function (signBitmap, fontInfo) {
|
||||
var dx = 0,
|
||||
dy = this.height - signBitmap.height;
|
||||
switch (fontInfo.align) {
|
||||
case "center":
|
||||
dx = this.width / 2 - signBitmap.width / 2;
|
||||
break;
|
||||
case "right":
|
||||
dx = this.width - signBitmap.width;
|
||||
break;
|
||||
}
|
||||
this.blt(signBitmap, 0, 0, signBitmap.width, signBitmap.height, dx, dy);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Input
|
||||
// ファンクションキーのマップを定義します。
|
||||
//=============================================================================
|
||||
Input.functionReverseMapper = {
|
||||
F1: 112,
|
||||
F2: 113,
|
||||
F3: 114,
|
||||
F4: 115,
|
||||
F5: 116,
|
||||
F6: 117,
|
||||
F7: 118,
|
||||
F8: 119,
|
||||
F9: 120,
|
||||
F10: 121,
|
||||
F11: 122,
|
||||
F12: 123
|
||||
};
|
||||
//=============================================================================
|
||||
// Input
|
||||
// ファンクションキーのマップを定義します。
|
||||
//=============================================================================
|
||||
Input.functionReverseMapper = {
|
||||
F1: 112,
|
||||
F2: 113,
|
||||
F3: 114,
|
||||
F4: 115,
|
||||
F5: 116,
|
||||
F6: 117,
|
||||
F7: 118,
|
||||
F8: 119,
|
||||
F9: 120,
|
||||
F10: 121,
|
||||
F11: 122,
|
||||
F12: 123,
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// SceneManager
|
||||
// ファンクションキーが押下されたときにキャプチャを実行します。
|
||||
//=============================================================================
|
||||
SceneManager.captureNumber = 0;
|
||||
SceneManager.makeCapture = function () {
|
||||
if (paramSeName) {
|
||||
var se = settings.se;
|
||||
se.name = paramSeName;
|
||||
AudioManager.playSe(se);
|
||||
}
|
||||
this._captureBitmap = this.snap();
|
||||
};
|
||||
//=============================================================================
|
||||
// SceneManager
|
||||
// ファンクションキーが押下されたときにキャプチャを実行します。
|
||||
//=============================================================================
|
||||
SceneManager.captureNumber = 0;
|
||||
SceneManager.makeCapture = function () {
|
||||
if (paramSeName) {
|
||||
var se = settings.se;
|
||||
se.name = paramSeName;
|
||||
AudioManager.playSe(se);
|
||||
}
|
||||
this._captureBitmap = this.snap();
|
||||
};
|
||||
|
||||
SceneManager.getCapture = function () {
|
||||
return this._captureBitmap || ImageManager.loadEmptyBitmap();
|
||||
};
|
||||
SceneManager.getCapture = function () {
|
||||
return this._captureBitmap || ImageManager.loadEmptyBitmap();
|
||||
};
|
||||
|
||||
SceneManager.saveCapture = function (fileName, format) {
|
||||
if (!this._captureBitmap) return;
|
||||
var signature = this.getSignature();
|
||||
if (paramSignatureImage) {
|
||||
var image = ImageManager.loadPicture(paramSignatureImage, 0);
|
||||
image.addLoadListener(function () {
|
||||
this._captureBitmap.signAndSave(signature, fileName, format, image);
|
||||
}.bind(this));
|
||||
} else {
|
||||
this._captureBitmap.signAndSave(signature, fileName, format, null);
|
||||
}
|
||||
};
|
||||
SceneManager.saveCapture = function (fileName, format) {
|
||||
if (!this._captureBitmap) return;
|
||||
var signature = this.getSignature();
|
||||
if (paramSignatureImage) {
|
||||
var image = ImageManager.loadPicture(paramSignatureImage, 0);
|
||||
image.addLoadListener(
|
||||
function () {
|
||||
this._captureBitmap.signAndSave(signature, fileName, format, image);
|
||||
}.bind(this)
|
||||
);
|
||||
} else {
|
||||
this._captureBitmap.signAndSave(signature, fileName, format, null);
|
||||
}
|
||||
};
|
||||
|
||||
SceneManager.getSignature = function () {
|
||||
var signature = settings.signature;
|
||||
signature.size = paramSignatureSize;
|
||||
return signature;
|
||||
};
|
||||
SceneManager.getSignature = function () {
|
||||
var signature = settings.signature;
|
||||
signature.size = paramSignatureSize;
|
||||
return signature;
|
||||
};
|
||||
|
||||
SceneManager.takeCapture = function (format) {
|
||||
if (!format) {
|
||||
format = paramFileFormat;
|
||||
}
|
||||
this.makeCapture();
|
||||
this.saveCapture(paramFileName, format);
|
||||
};
|
||||
SceneManager.takeCapture = function (format) {
|
||||
if (!format) {
|
||||
format = paramFileFormat;
|
||||
}
|
||||
this.makeCapture();
|
||||
this.saveCapture(paramFileName, format);
|
||||
};
|
||||
|
||||
var _SceneManager_setupErrorHandlers = SceneManager.setupErrorHandlers;
|
||||
SceneManager.setupErrorHandlers = function () {
|
||||
_SceneManager_setupErrorHandlers.apply(this, arguments);
|
||||
if (Utils.isTestCapture()) {
|
||||
document.addEventListener('keyup', this.onKeyUpForCapture.bind(this));
|
||||
}
|
||||
};
|
||||
var _SceneManager_setupErrorHandlers = SceneManager.setupErrorHandlers;
|
||||
SceneManager.setupErrorHandlers = function () {
|
||||
_SceneManager_setupErrorHandlers.apply(this, arguments);
|
||||
if (Utils.isTestCapture()) {
|
||||
document.addEventListener("keyup", this.onKeyUpForCapture.bind(this));
|
||||
}
|
||||
};
|
||||
|
||||
var _SceneManager_onKeyDown = SceneManager.onKeyDown;
|
||||
SceneManager.onKeyDown = function (event) {
|
||||
_SceneManager_onKeyDown.apply(this, arguments);
|
||||
if (paramSimultaneousCtrl === event.ctrlKey && paramSimultaneousAlt === event.altKey && Utils.isTestCapture()) {
|
||||
this.onKeyDownForCapture(event);
|
||||
}
|
||||
};
|
||||
var _SceneManager_onKeyDown = SceneManager.onKeyDown;
|
||||
SceneManager.onKeyDown = function (event) {
|
||||
_SceneManager_onKeyDown.apply(this, arguments);
|
||||
if (
|
||||
paramSimultaneousCtrl === event.ctrlKey &&
|
||||
paramSimultaneousAlt === event.altKey &&
|
||||
Utils.isTestCapture()
|
||||
) {
|
||||
this.onKeyDownForCapture(event);
|
||||
}
|
||||
};
|
||||
|
||||
SceneManager.onKeyDownForCapture = function (event) {
|
||||
switch (event.keyCode) {
|
||||
case Input.functionReverseMapper[paramFuncKeyPngCapture]:
|
||||
SceneManager.takeCapture('png');
|
||||
break;
|
||||
case Input.functionReverseMapper[paramFuncKeyJpegCapture]:
|
||||
SceneManager.takeCapture('jpeg');
|
||||
break;
|
||||
case Input.functionReverseMapper[paramFuncKeyWebpCapture]:
|
||||
SceneManager.takeCapture('webp');
|
||||
break;
|
||||
}
|
||||
};
|
||||
SceneManager.onKeyDownForCapture = function (event) {
|
||||
switch (event.keyCode) {
|
||||
case Input.functionReverseMapper[paramFuncKeyPngCapture]:
|
||||
SceneManager.takeCapture("png");
|
||||
break;
|
||||
case Input.functionReverseMapper[paramFuncKeyJpegCapture]:
|
||||
SceneManager.takeCapture("jpeg");
|
||||
break;
|
||||
case Input.functionReverseMapper[paramFuncKeyWebpCapture]:
|
||||
SceneManager.takeCapture("webp");
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
SceneManager.onKeyUpForCapture = function (event) {
|
||||
// PrintScreen
|
||||
if (event.keyCode === 44) SceneManager.takeCapture();
|
||||
};
|
||||
SceneManager.onKeyUpForCapture = function (event) {
|
||||
// PrintScreen
|
||||
if (event.keyCode === 44) SceneManager.takeCapture();
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// StorageManager
|
||||
// イメージファイルを保存します。
|
||||
//=============================================================================
|
||||
StorageManager.saveImg = function (fileName, format, data) {
|
||||
if (this.isLocalMode()) {
|
||||
this.saveImgToLocalFile(fileName + '.' + format, data);
|
||||
} else {
|
||||
this.saveImgToWebStorage(fileName, data);
|
||||
}
|
||||
};
|
||||
//=============================================================================
|
||||
// StorageManager
|
||||
// イメージファイルを保存します。
|
||||
//=============================================================================
|
||||
StorageManager.saveImg = function (fileName, format, data) {
|
||||
if (this.isLocalMode()) {
|
||||
this.saveImgToLocalFile(fileName + "." + format, data);
|
||||
} else {
|
||||
this.saveImgToWebStorage(fileName, data);
|
||||
}
|
||||
};
|
||||
|
||||
StorageManager.saveImgToWebStorage = function (fileName, data) {
|
||||
localStorage.setItem(fileName, data);
|
||||
};
|
||||
StorageManager.saveImgToWebStorage = function (fileName, data) {
|
||||
localStorage.setItem(fileName, data);
|
||||
};
|
||||
|
||||
StorageManager.saveImgToLocalFile = function (fileName, data) {
|
||||
var fs = require('fs');
|
||||
var dirPath = this.localImgFileDirectoryPath();
|
||||
var filePath = dirPath + fileName;
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
fs.mkdirSync(dirPath);
|
||||
}
|
||||
fs.writeFileSync(filePath, new Buffer(data, 'base64'));
|
||||
};
|
||||
StorageManager.saveImgToLocalFile = function (fileName, data) {
|
||||
var fs = require("fs");
|
||||
var dirPath = this.localImgFileDirectoryPath();
|
||||
var filePath = dirPath + fileName;
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
fs.mkdirSync(dirPath);
|
||||
}
|
||||
fs.writeFileSync(filePath, new Buffer(data, "base64"));
|
||||
};
|
||||
|
||||
StorageManager.localImgFileDirectoryPath = function () {
|
||||
var filePath = paramLocation;
|
||||
if (!filePath.match(/^[A-Z]:/)) {
|
||||
var path = require('path');
|
||||
filePath = path.join(path.dirname(process.mainModule.filename), filePath);
|
||||
}
|
||||
return decodeURIComponent(filePath.match(/\/$/) ? filePath : filePath + '/');
|
||||
};
|
||||
StorageManager.localImgFileDirectoryPath = function () {
|
||||
var filePath = paramLocation;
|
||||
if (!filePath.match(/^[A-Z]:/)) {
|
||||
var path = require("path");
|
||||
filePath = path.join(path.dirname(process.mainModule.filename), filePath);
|
||||
}
|
||||
return decodeURIComponent(
|
||||
filePath.match(/\/$/) ? filePath : filePath + "/"
|
||||
);
|
||||
};
|
||||
|
||||
StorageManager.getLocalImgFileName = function (fileName) {
|
||||
if (paramTimeStamp) {
|
||||
var date = new Date();
|
||||
return fileName + '_' + date.getFullYear() + (date.getMonth() + 1).padZero(2) + date.getDate().padZero(2) +
|
||||
'_' + date.getHours().padZero(2) + date.getMinutes().padZero(2) + date.getSeconds().padZero(2);
|
||||
} else {
|
||||
var number = SceneManager.captureNumber;
|
||||
if (number >= Math.pow(10, paramNumberDigit)) number = 0;
|
||||
SceneManager.captureNumber = number + 1;
|
||||
return fileName + (number > 0 ? number.padZero(paramNumberDigit) : '');
|
||||
}
|
||||
};
|
||||
StorageManager.getLocalImgFileName = function (fileName) {
|
||||
if (paramTimeStamp) {
|
||||
var date = new Date();
|
||||
return (
|
||||
fileName +
|
||||
"_" +
|
||||
date.getFullYear() +
|
||||
(date.getMonth() + 1).padZero(2) +
|
||||
date.getDate().padZero(2) +
|
||||
"_" +
|
||||
date.getHours().padZero(2) +
|
||||
date.getMinutes().padZero(2) +
|
||||
date.getSeconds().padZero(2)
|
||||
);
|
||||
} else {
|
||||
var number = SceneManager.captureNumber;
|
||||
if (number >= Math.pow(10, paramNumberDigit)) number = 0;
|
||||
SceneManager.captureNumber = number + 1;
|
||||
return fileName + (number > 0 ? number.padZero(paramNumberDigit) : "");
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -30,11 +30,10 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
var parameters = PluginManager.parameters('MenuCallCommon');
|
||||
var Noncha_ComEvent = Number(parameters['ComEvent'] || 1);
|
||||
var Noncha_ComCloseEvent = Number(parameters['ComCloseEvent'] || 1);
|
||||
var Noncha_ComSwitch = Number(parameters['ComSwitch'] || 1);
|
||||
var parameters = PluginManager.parameters("MenuCallCommon");
|
||||
var Noncha_ComEvent = Number(parameters["ComEvent"] || 1);
|
||||
var Noncha_ComCloseEvent = Number(parameters["ComCloseEvent"] || 1);
|
||||
var Noncha_ComSwitch = Number(parameters["ComSwitch"] || 1);
|
||||
|
||||
Scene_Map.prototype.updateCallMenu = function () {
|
||||
if (this.isMenuEnabled()) {
|
||||
|
|
@ -54,5 +53,4 @@
|
|||
this.menuCalling = false;
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -128,180 +128,197 @@
|
|||
* このプラグインはもうあなたのものです。
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Create plugin parameter. param[paramName] ex. param.commandPrefix
|
||||
* @param pluginName plugin name(EncounterSwitchConditions)
|
||||
* @returns {Object} Created parameter
|
||||
*/
|
||||
var createPluginParameter = function (pluginName) {
|
||||
var paramReplacer = function (key, value) {
|
||||
if (value === 'null') {
|
||||
return value;
|
||||
}
|
||||
if (value[0] === '"' && value[value.length - 1] === '"') {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
var parameter = JSON.parse(JSON.stringify(PluginManager.parameters(pluginName), paramReplacer));
|
||||
PluginManager.setParameters(pluginName, parameter);
|
||||
return parameter;
|
||||
/**
|
||||
* Create plugin parameter. param[paramName] ex. param.commandPrefix
|
||||
* @param pluginName plugin name(EncounterSwitchConditions)
|
||||
* @returns {Object} Created parameter
|
||||
*/
|
||||
var createPluginParameter = function (pluginName) {
|
||||
var paramReplacer = function (key, value) {
|
||||
if (value === "null") {
|
||||
return value;
|
||||
}
|
||||
if (value[0] === '"' && value[value.length - 1] === '"') {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
var param = createPluginParameter('MessageWindowHidden');
|
||||
var parameter = JSON.parse(
|
||||
JSON.stringify(PluginManager.parameters(pluginName), paramReplacer)
|
||||
);
|
||||
PluginManager.setParameters(pluginName, parameter);
|
||||
return parameter;
|
||||
};
|
||||
var param = createPluginParameter("MessageWindowHidden");
|
||||
|
||||
//=============================================================================
|
||||
// Game_Picture
|
||||
// メッセージウィンドウの表示可否と連動します。
|
||||
//=============================================================================
|
||||
Game_Picture.prototype.linkWithMessageWindow = function (opacity) {
|
||||
this._opacity = opacity;
|
||||
this._targetOpacity = opacity;
|
||||
};
|
||||
//=============================================================================
|
||||
// Game_Picture
|
||||
// メッセージウィンドウの表示可否と連動します。
|
||||
//=============================================================================
|
||||
Game_Picture.prototype.linkWithMessageWindow = function (opacity) {
|
||||
this._opacity = opacity;
|
||||
this._targetOpacity = opacity;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_Message
|
||||
// 指定されたボタン押下時にウィンドウとサブウィンドウを非表示にします。
|
||||
//=============================================================================
|
||||
var _Window_Message_updateWait = Window_Message.prototype.updateWait;
|
||||
Window_Message.prototype.updateWait = function () {
|
||||
if (!this.isClosed() && this.isTriggeredHidden() && !$gameMessage.isChoice()) {
|
||||
if (!this.isHidden()) {
|
||||
this.hideAllWindow();
|
||||
} else {
|
||||
this.showAllWindow();
|
||||
}
|
||||
}
|
||||
var wait = _Window_Message_updateWait.apply(this, arguments);
|
||||
if (this.isHidden() && this.visible) {
|
||||
this.hideAllWindow();
|
||||
}
|
||||
return wait;
|
||||
};
|
||||
//=============================================================================
|
||||
// Window_Message
|
||||
// 指定されたボタン押下時にウィンドウとサブウィンドウを非表示にします。
|
||||
//=============================================================================
|
||||
var _Window_Message_updateWait = Window_Message.prototype.updateWait;
|
||||
Window_Message.prototype.updateWait = function () {
|
||||
if (
|
||||
!this.isClosed() &&
|
||||
this.isTriggeredHidden() &&
|
||||
!$gameMessage.isChoice()
|
||||
) {
|
||||
if (!this.isHidden()) {
|
||||
this.hideAllWindow();
|
||||
} else {
|
||||
this.showAllWindow();
|
||||
}
|
||||
}
|
||||
var wait = _Window_Message_updateWait.apply(this, arguments);
|
||||
if (this.isHidden() && this.visible) {
|
||||
this.hideAllWindow();
|
||||
}
|
||||
return wait;
|
||||
};
|
||||
|
||||
Window_Message.prototype.hideAllWindow = function () {
|
||||
this.hide();
|
||||
this.subWindows().forEach(function (subWindow) {
|
||||
this.hideSubWindow(subWindow);
|
||||
}.bind(this));
|
||||
if (this.hasNameWindow() && !this.nameWindowIsSubWindow()) this.hideSubWindow(this._nameWindow);
|
||||
this._originalPictureOpacities = {};
|
||||
this.linkPictures(0, param.linkPictureNumbers);
|
||||
this.linkPictures(255, param.linkShowPictureNumbers);
|
||||
this._hideByMessageWindowHidden = true;
|
||||
};
|
||||
Window_Message.prototype.hideAllWindow = function () {
|
||||
this.hide();
|
||||
this.subWindows().forEach(
|
||||
function (subWindow) {
|
||||
this.hideSubWindow(subWindow);
|
||||
}.bind(this)
|
||||
);
|
||||
if (this.hasNameWindow() && !this.nameWindowIsSubWindow())
|
||||
this.hideSubWindow(this._nameWindow);
|
||||
this._originalPictureOpacities = {};
|
||||
this.linkPictures(0, param.linkPictureNumbers);
|
||||
this.linkPictures(255, param.linkShowPictureNumbers);
|
||||
this._hideByMessageWindowHidden = true;
|
||||
};
|
||||
|
||||
Window_Message.prototype.showAllWindow = function () {
|
||||
this.show();
|
||||
this.subWindows().forEach(function (subWindow) {
|
||||
this.showSubWindow(subWindow);
|
||||
}.bind(this));
|
||||
if (this.hasNameWindow() && !this.nameWindowIsSubWindow()) this.showSubWindow(this._nameWindow);
|
||||
this.linkPictures(null, param.linkShowPictureNumbers);
|
||||
this.linkPictures(null, param.linkPictureNumbers);
|
||||
this._hideByMessageWindowHidden = false;
|
||||
};
|
||||
Window_Message.prototype.showAllWindow = function () {
|
||||
this.show();
|
||||
this.subWindows().forEach(
|
||||
function (subWindow) {
|
||||
this.showSubWindow(subWindow);
|
||||
}.bind(this)
|
||||
);
|
||||
if (this.hasNameWindow() && !this.nameWindowIsSubWindow())
|
||||
this.showSubWindow(this._nameWindow);
|
||||
this.linkPictures(null, param.linkShowPictureNumbers);
|
||||
this.linkPictures(null, param.linkPictureNumbers);
|
||||
this._hideByMessageWindowHidden = false;
|
||||
};
|
||||
|
||||
Window_Message.prototype.isHidden = function () {
|
||||
return this._hideByMessageWindowHidden;
|
||||
};
|
||||
Window_Message.prototype.isHidden = function () {
|
||||
return this._hideByMessageWindowHidden;
|
||||
};
|
||||
|
||||
Window_Message.prototype.linkPictures = function (opacity, pictureNumbers) {
|
||||
if (!pictureNumbers) {
|
||||
return;
|
||||
}
|
||||
pictureNumbers.forEach(function (pictureId) {
|
||||
this.linkPicture(opacity, pictureId);
|
||||
}, this);
|
||||
};
|
||||
Window_Message.prototype.linkPictures = function (opacity, pictureNumbers) {
|
||||
if (!pictureNumbers) {
|
||||
return;
|
||||
}
|
||||
pictureNumbers.forEach(function (pictureId) {
|
||||
this.linkPicture(opacity, pictureId);
|
||||
}, this);
|
||||
};
|
||||
|
||||
Window_Message.prototype.linkPicture = function (opacity, pictureId) {
|
||||
var picture = $gameScreen.picture(pictureId);
|
||||
if (!picture) {
|
||||
return;
|
||||
}
|
||||
if (opacity === null) {
|
||||
opacity = this._originalPictureOpacities[pictureId] || 255;
|
||||
} else {
|
||||
this._originalPictureOpacities[pictureId] = picture.opacity();
|
||||
}
|
||||
picture.linkWithMessageWindow(opacity);
|
||||
};
|
||||
Window_Message.prototype.linkPicture = function (opacity, pictureId) {
|
||||
var picture = $gameScreen.picture(pictureId);
|
||||
if (!picture) {
|
||||
return;
|
||||
}
|
||||
if (opacity === null) {
|
||||
opacity = this._originalPictureOpacities[pictureId] || 255;
|
||||
} else {
|
||||
this._originalPictureOpacities[pictureId] = picture.opacity();
|
||||
}
|
||||
picture.linkWithMessageWindow(opacity);
|
||||
};
|
||||
|
||||
Window_Message.prototype.hideSubWindow = function (subWindow) {
|
||||
subWindow.prevVisible = subWindow.visible;
|
||||
subWindow.hide();
|
||||
};
|
||||
Window_Message.prototype.hideSubWindow = function (subWindow) {
|
||||
subWindow.prevVisible = subWindow.visible;
|
||||
subWindow.hide();
|
||||
};
|
||||
|
||||
Window_Message.prototype.showSubWindow = function (subWindow) {
|
||||
if (subWindow.prevVisible) subWindow.show();
|
||||
subWindow.prevVisible = undefined;
|
||||
};
|
||||
Window_Message.prototype.showSubWindow = function (subWindow) {
|
||||
if (subWindow.prevVisible) subWindow.show();
|
||||
subWindow.prevVisible = undefined;
|
||||
};
|
||||
|
||||
Window_Message.prototype.hasNameWindow = function () {
|
||||
return this._nameWindow && typeof Window_NameBox !== 'undefined';
|
||||
};
|
||||
Window_Message.prototype.hasNameWindow = function () {
|
||||
return this._nameWindow && typeof Window_NameBox !== "undefined";
|
||||
};
|
||||
|
||||
// 古いYEP_MessageCore.jsでは、ネーム表示ウィンドウはsubWindowsに含まれる
|
||||
Window_Message.prototype.nameWindowIsSubWindow = function () {
|
||||
return this.subWindows().filter(function (subWindow) {
|
||||
return subWindow === this._nameWindow;
|
||||
}, this).length > 0;
|
||||
};
|
||||
// 古いYEP_MessageCore.jsでは、ネーム表示ウィンドウはsubWindowsに含まれる
|
||||
Window_Message.prototype.nameWindowIsSubWindow = function () {
|
||||
return (
|
||||
this.subWindows().filter(function (subWindow) {
|
||||
return subWindow === this._nameWindow;
|
||||
}, this).length > 0
|
||||
);
|
||||
};
|
||||
|
||||
Window_Message.prototype.disableWindowHidden = function () {
|
||||
return (param.disableSwitchId > 0 && $gameSwitches.value(param.disableSwitchId)) ||
|
||||
(param.disableInBattle && $gameParty.inBattle());
|
||||
};
|
||||
Window_Message.prototype.disableWindowHidden = function () {
|
||||
return (
|
||||
(param.disableSwitchId > 0 &&
|
||||
$gameSwitches.value(param.disableSwitchId)) ||
|
||||
(param.disableInBattle && $gameParty.inBattle())
|
||||
);
|
||||
};
|
||||
|
||||
Window_Message.prototype.isTriggeredHidden = function () {
|
||||
if (this.disableWindowHidden()) {
|
||||
return false;
|
||||
}
|
||||
return param.triggerButton.some(function (button) {
|
||||
switch (button) {
|
||||
case '':
|
||||
case '右クリック':
|
||||
case 'light_click':
|
||||
return TouchInput.isCancelled();
|
||||
case 'ok':
|
||||
return false;
|
||||
default:
|
||||
return Input.isTriggered(button);
|
||||
}
|
||||
});
|
||||
};
|
||||
Window_Message.prototype.isTriggeredHidden = function () {
|
||||
if (this.disableWindowHidden()) {
|
||||
return false;
|
||||
}
|
||||
return param.triggerButton.some(function (button) {
|
||||
switch (button) {
|
||||
case "":
|
||||
case "右クリック":
|
||||
case "light_click":
|
||||
return TouchInput.isCancelled();
|
||||
case "ok":
|
||||
return false;
|
||||
default:
|
||||
return Input.isTriggered(button);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
var _Window_Message_updateInput = Window_Message.prototype.updateInput;
|
||||
Window_Message.prototype.updateInput = function () {
|
||||
if (this.isHidden()) return true;
|
||||
return _Window_Message_updateInput.apply(this, arguments);
|
||||
};
|
||||
var _Window_Message_updateInput = Window_Message.prototype.updateInput;
|
||||
Window_Message.prototype.updateInput = function () {
|
||||
if (this.isHidden()) return true;
|
||||
return _Window_Message_updateInput.apply(this, arguments);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Window_ChoiceList、Window_NumberInput、Window_EventItem
|
||||
// 非表示の間は更新を停止します。
|
||||
//=============================================================================
|
||||
var _Window_ChoiceList_update = Window_ChoiceList.prototype.update;
|
||||
Window_ChoiceList.prototype.update = function () {
|
||||
if (!this.visible) return;
|
||||
_Window_ChoiceList_update.apply(this, arguments);
|
||||
};
|
||||
//=============================================================================
|
||||
// Window_ChoiceList、Window_NumberInput、Window_EventItem
|
||||
// 非表示の間は更新を停止します。
|
||||
//=============================================================================
|
||||
var _Window_ChoiceList_update = Window_ChoiceList.prototype.update;
|
||||
Window_ChoiceList.prototype.update = function () {
|
||||
if (!this.visible) return;
|
||||
_Window_ChoiceList_update.apply(this, arguments);
|
||||
};
|
||||
|
||||
var _Window_NumberInput_update = Window_NumberInput.prototype.update;
|
||||
Window_NumberInput.prototype.update = function () {
|
||||
if (!this.visible) return;
|
||||
_Window_NumberInput_update.apply(this, arguments);
|
||||
};
|
||||
var _Window_NumberInput_update = Window_NumberInput.prototype.update;
|
||||
Window_NumberInput.prototype.update = function () {
|
||||
if (!this.visible) return;
|
||||
_Window_NumberInput_update.apply(this, arguments);
|
||||
};
|
||||
|
||||
var _Window_EventItem_update = Window_EventItem.prototype.update;
|
||||
Window_EventItem.prototype.update = function () {
|
||||
if (!this.visible) return;
|
||||
_Window_EventItem_update.apply(this, arguments);
|
||||
};
|
||||
var _Window_EventItem_update = Window_EventItem.prototype.update;
|
||||
Window_EventItem.prototype.update = function () {
|
||||
if (!this.visible) return;
|
||||
_Window_EventItem_update.apply(this, arguments);
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -5,31 +5,31 @@
|
|||
/*:
|
||||
* @plugindesc マップ全体を画像として出力します。
|
||||
* @author 奏ねこま(おとぶき ねこま)
|
||||
*
|
||||
*
|
||||
* @param GetImageTrigger1
|
||||
* @desc マップを画像出力するトリガーを指定してください。
|
||||
* @default Input.isPressed('control') && Input.isTriggered('pageup')
|
||||
*
|
||||
*
|
||||
* @param GetImageTrigger2
|
||||
* @desc マップを画像出力するトリガーを指定してください。(キャラクター表示OFF)
|
||||
* @default Input.isPressed('control') && Input.isTriggered('pagedown')
|
||||
*
|
||||
*
|
||||
* @param Vertical Split
|
||||
* @desc 画像出力時の縦方向の分割数を指定してください。
|
||||
* @default 1
|
||||
*
|
||||
*
|
||||
* @param Horizontal Split
|
||||
* @desc 画像出力時の横方向の分割数を指定してください。
|
||||
* @default 1
|
||||
*
|
||||
*
|
||||
* @param OutputFolder
|
||||
* @desc 画像を出力するフォルダを指定してください。
|
||||
* @default output
|
||||
*
|
||||
*
|
||||
* @param TestModeOnly
|
||||
* @desc テスト時のみ有効にする場合は true を指定してください。
|
||||
* @default true
|
||||
*
|
||||
*
|
||||
* @help
|
||||
* [説明]
|
||||
* マップ全体をPNG画像として出力します。
|
||||
|
|
@ -38,21 +38,21 @@
|
|||
* プラグイン設定のGetImageTrigger1またはGetImageTrigger2で指定した条件が成立し
|
||||
* た瞬間のマップ全体の画像を、PNG画像に出力します。
|
||||
* GetImageTrigger1とGetImageTrigger2のデフォルト設定は、以下のような意味です。
|
||||
*
|
||||
*
|
||||
* GetImageTrigger1
|
||||
* Input.isPressed('control') && Input.isTriggered('pageup')
|
||||
* Ctrlキー(またはAltキー)を押しながら、PageUpキーが押された瞬間。
|
||||
*
|
||||
*
|
||||
* GetImageTrigger2
|
||||
* Input.isPressed('control') && Input.isTriggered('pagedown')
|
||||
* Ctrlキー(またはAltキー)を押しながら、PageDownキーが押された瞬間。
|
||||
*
|
||||
*
|
||||
* [大きなマップを出力する際の注意]
|
||||
* 160×160以上の大きなマップを1枚の画像として出力するとエラーになることがありま
|
||||
* す。その場合はプラグイン設定のVertical SplitとHorizontal Splitに2以上の値を設
|
||||
* 定して分割出力してください。例えばVertical SplitとHorizontal Splitの値がとも
|
||||
* に2の場合、縦横それぞれ2分割され4枚の画像として出力されます。
|
||||
*
|
||||
*
|
||||
* [利用規約] ..................................................................
|
||||
* - 本プラグインの利用は、RPGツクールMV/RPGMakerMVの正規ユーザーに限られます。
|
||||
* - 商用、非商用、有償、無償、一般向け、成人向けを問わず、利用可能です。
|
||||
|
|
@ -75,150 +75,188 @@ var Imported = Imported || {};
|
|||
var Makonet = Makonet || {};
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
const plugin_name = 'MpiGetMapImage';
|
||||
const plugin_name = "MpiGetMapImage";
|
||||
|
||||
Imported[plugin_name] = true;
|
||||
Makonet[plugin_name] = {};
|
||||
Imported[plugin_name] = true;
|
||||
Makonet[plugin_name] = {};
|
||||
|
||||
let _plugin = Makonet[plugin_name];
|
||||
let _parameters = PluginManager.parameters(plugin_name);
|
||||
let _plugin = Makonet[plugin_name];
|
||||
let _parameters = PluginManager.parameters(plugin_name);
|
||||
|
||||
_plugin.trigger1 = _parameters['GetImageTrigger1'];
|
||||
_plugin.trigger2 = _parameters['GetImageTrigger2'];
|
||||
_plugin.vertical = Number(_parameters['Vertical Split']) || 1;
|
||||
_plugin.horizontal = Number(_parameters['Horizontal Split']) || 1;
|
||||
_plugin.folder = _parameters['OutputFolder'];
|
||||
_plugin.testOnly = _parameters['TestModeOnly'].toLowerCase() === 'true';
|
||||
_plugin.trigger1 = _parameters["GetImageTrigger1"];
|
||||
_plugin.trigger2 = _parameters["GetImageTrigger2"];
|
||||
_plugin.vertical = Number(_parameters["Vertical Split"]) || 1;
|
||||
_plugin.horizontal = Number(_parameters["Horizontal Split"]) || 1;
|
||||
_plugin.folder = _parameters["OutputFolder"];
|
||||
_plugin.testOnly = _parameters["TestModeOnly"].toLowerCase() === "true";
|
||||
|
||||
//==============================================================================
|
||||
// Local Function
|
||||
//==============================================================================
|
||||
//==============================================================================
|
||||
// Local Function
|
||||
//==============================================================================
|
||||
|
||||
function createMapImage() {
|
||||
// 現在のマップ表示情報を退避
|
||||
let displayX = $gameMap._displayX;
|
||||
let displayY = $gameMap._displayY;
|
||||
let parallaxOx = $gameMap.parallaxOx();
|
||||
let parallaxOy = $gameMap.parallaxOy();
|
||||
let foregroundOx, foregroundOy;
|
||||
if ($gameMap.foregroundOx) {
|
||||
foregroundOx = $gameMap.foregroundOx();
|
||||
foregroundOy = $gameMap.foregroundOy();
|
||||
}
|
||||
// コピー情報作成
|
||||
let copyInfo = [];
|
||||
let splitWidth = Math.ceil($gameMap.width() / _plugin.horizontal);
|
||||
let splitHeight = Math.ceil($gameMap.height() / _plugin.vertical);
|
||||
let screenWidth = Math.floor(Graphics.width / $gameMap.tileWidth());
|
||||
let screenHeight = Math.floor(Graphics.height / $gameMap.tileHeight());
|
||||
for (let i = 0; i < _plugin.vertical; i++) {
|
||||
for (let j = 0; j < _plugin.horizontal; j++) {
|
||||
let x1 = j * splitHeight;
|
||||
let y1 = i * splitWidth;
|
||||
let width1 = Math.min(splitWidth, $gameMap.width() - j * splitWidth);
|
||||
let height1 = Math.min(splitHeight, $gameMap.height() - i * splitHeight);
|
||||
for (let m = 0; m < Math.ceil(height1 / screenHeight); m++) {
|
||||
for (let n = 0; n < Math.ceil(width1 / screenWidth); n++) {
|
||||
let x2 = x1 + n * screenWidth;
|
||||
let y2 = y1 + m * screenHeight;
|
||||
let width2 = Math.min(screenWidth, width1 - n * screenWidth);
|
||||
let height2 = Math.min(screenHeight, height1 - m * screenHeight);
|
||||
copyInfo.push(new Map([
|
||||
['imageId', i * _plugin.vertical + j],
|
||||
['imageWidth', width1 * $gameMap.tileWidth()],
|
||||
['imageHeight', height1 * $gameMap.tileHeight()],
|
||||
['srcMapX', x2],
|
||||
['srcMapY', y2],
|
||||
['copyWidth', width2 * $gameMap.tileWidth()],
|
||||
['copyHeight', height2 * $gameMap.tileHeight()],
|
||||
['dstX', (x2 - x1) * $gameMap.tileWidth()],
|
||||
['dstY', (y2 - y1) * $gameMap.tileHeight()]
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Bitmap作成
|
||||
let bitmap = [];
|
||||
copyInfo.forEach(info => {
|
||||
bitmap[info.get('imageId')] = bitmap[info.get('imageId')] || new Bitmap(info.get('imageWidth'), info.get('imageHeight'));
|
||||
$gameMap._displayX = info.get('srcMapX');
|
||||
$gameMap._displayY = info.get('srcMapY');
|
||||
let spriteset = SceneManager._scene._spriteset;
|
||||
spriteset.update();
|
||||
if (spriteset._parallax.bitmap) {
|
||||
spriteset._parallax.origin.x = parallaxOx + ($gameMap._displayX - displayX) * $gameMap.tileWidth();
|
||||
spriteset._parallax.origin.y = parallaxOy + ($gameMap._displayY - displayY) * $gameMap.tileHeight();
|
||||
}
|
||||
if (spriteset._foreground && spriteset._foreground.bitmap) {
|
||||
spriteset._foreground.origin.x = foregroundOx + ($gameMap._displayX - displayX) * $gameMap.tileWidth();
|
||||
spriteset._foreground.origin.y = foregroundOy + ($gameMap._displayY - displayY) * $gameMap.tileHeight();
|
||||
}
|
||||
if (spriteset._parallaxNonBlur && spriteset._parallaxNonBlur.bitmap) {
|
||||
spriteset._parallaxNonBlur.setFrame(
|
||||
parallaxOx + ($gameMap._displayX - displayX) * $gameMap.tileWidth(),
|
||||
parallaxOy + ($gameMap._displayY - displayY) * $gameMap.tileHeight(),
|
||||
Graphics.width, Graphics.height
|
||||
);
|
||||
}
|
||||
Graphics._renderer.render(SceneManager._scene);
|
||||
let snap = Bitmap.snap(SceneManager._scene);
|
||||
bitmap[info.get('imageId')].blt(snap, 0, 0, info.get('copyWidth'), info.get('copyHeight'), info.get('dstX'), info.get('dstY'));
|
||||
});
|
||||
// ファイル出力
|
||||
bitmap.forEach((bitmap, index, array) => {
|
||||
let fs = require('fs');
|
||||
let path = StorageManager.localFileDirectoryPath().replace(/save[\\/]$/, '');
|
||||
let folder = path + _plugin.folder;
|
||||
if (!fs.existsSync(folder)) {
|
||||
fs.mkdirSync(folder);
|
||||
}
|
||||
let strIndex = (array.length > 1) ? '_' + index.padZero(2) : '';
|
||||
let date = (function () {
|
||||
let date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
let hours = date.getHours();
|
||||
let minutes = date.getMinutes();
|
||||
let seconds = date.getSeconds();
|
||||
return year + month.padZero(2) + day.padZero(2) + hours.padZero(2) + minutes.padZero(2) + seconds.padZero(2);
|
||||
}());
|
||||
let file = folder + '\\Map' + $gameMap.mapId().padZero(3) + strIndex + '_' + date + '.png';
|
||||
let data = bitmap._canvas.toDataURL('img/png').replace(/^.*,/, '');
|
||||
let buffer = new Buffer(data, 'base64');
|
||||
fs.writeFileSync(file, buffer);
|
||||
});
|
||||
// マップ表示位置を復帰
|
||||
$gameMap._displayX = displayX;
|
||||
$gameMap._displayY = displayY;
|
||||
SceneManager._scene._spriteset.update();
|
||||
Graphics._renderer.render(SceneManager._scene);
|
||||
function createMapImage() {
|
||||
// 現在のマップ表示情報を退避
|
||||
let displayX = $gameMap._displayX;
|
||||
let displayY = $gameMap._displayY;
|
||||
let parallaxOx = $gameMap.parallaxOx();
|
||||
let parallaxOy = $gameMap.parallaxOy();
|
||||
let foregroundOx, foregroundOy;
|
||||
if ($gameMap.foregroundOx) {
|
||||
foregroundOx = $gameMap.foregroundOx();
|
||||
foregroundOy = $gameMap.foregroundOy();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Scene_Map
|
||||
//==============================================================================
|
||||
|
||||
{
|
||||
let __update = Scene_Map.prototype.update;
|
||||
Scene_Map.prototype.update = function () {
|
||||
if ($gameTemp.isPlaytest() || !_plugin.testOnly) {
|
||||
let trigger1 = !!eval(_plugin.trigger1);
|
||||
let trigger2 = !!eval(_plugin.trigger2);
|
||||
if (trigger2) this._spriteset.hideCharacters();
|
||||
if (trigger1 || trigger2) {
|
||||
createMapImage();
|
||||
}
|
||||
if (trigger2) {
|
||||
this._spriteset._characterSprites.forEach(sprite => {
|
||||
if (!sprite.isTile()) sprite.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
__update.apply(this, arguments);
|
||||
};
|
||||
// コピー情報作成
|
||||
let copyInfo = [];
|
||||
let splitWidth = Math.ceil($gameMap.width() / _plugin.horizontal);
|
||||
let splitHeight = Math.ceil($gameMap.height() / _plugin.vertical);
|
||||
let screenWidth = Math.floor(Graphics.width / $gameMap.tileWidth());
|
||||
let screenHeight = Math.floor(Graphics.height / $gameMap.tileHeight());
|
||||
for (let i = 0; i < _plugin.vertical; i++) {
|
||||
for (let j = 0; j < _plugin.horizontal; j++) {
|
||||
let x1 = j * splitHeight;
|
||||
let y1 = i * splitWidth;
|
||||
let width1 = Math.min(splitWidth, $gameMap.width() - j * splitWidth);
|
||||
let height1 = Math.min(
|
||||
splitHeight,
|
||||
$gameMap.height() - i * splitHeight
|
||||
);
|
||||
for (let m = 0; m < Math.ceil(height1 / screenHeight); m++) {
|
||||
for (let n = 0; n < Math.ceil(width1 / screenWidth); n++) {
|
||||
let x2 = x1 + n * screenWidth;
|
||||
let y2 = y1 + m * screenHeight;
|
||||
let width2 = Math.min(screenWidth, width1 - n * screenWidth);
|
||||
let height2 = Math.min(screenHeight, height1 - m * screenHeight);
|
||||
copyInfo.push(
|
||||
new Map([
|
||||
["imageId", i * _plugin.vertical + j],
|
||||
["imageWidth", width1 * $gameMap.tileWidth()],
|
||||
["imageHeight", height1 * $gameMap.tileHeight()],
|
||||
["srcMapX", x2],
|
||||
["srcMapY", y2],
|
||||
["copyWidth", width2 * $gameMap.tileWidth()],
|
||||
["copyHeight", height2 * $gameMap.tileHeight()],
|
||||
["dstX", (x2 - x1) * $gameMap.tileWidth()],
|
||||
["dstY", (y2 - y1) * $gameMap.tileHeight()],
|
||||
])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}());
|
||||
// Bitmap作成
|
||||
let bitmap = [];
|
||||
copyInfo.forEach((info) => {
|
||||
bitmap[info.get("imageId")] =
|
||||
bitmap[info.get("imageId")] ||
|
||||
new Bitmap(info.get("imageWidth"), info.get("imageHeight"));
|
||||
$gameMap._displayX = info.get("srcMapX");
|
||||
$gameMap._displayY = info.get("srcMapY");
|
||||
let spriteset = SceneManager._scene._spriteset;
|
||||
spriteset.update();
|
||||
if (spriteset._parallax.bitmap) {
|
||||
spriteset._parallax.origin.x =
|
||||
parallaxOx + ($gameMap._displayX - displayX) * $gameMap.tileWidth();
|
||||
spriteset._parallax.origin.y =
|
||||
parallaxOy + ($gameMap._displayY - displayY) * $gameMap.tileHeight();
|
||||
}
|
||||
if (spriteset._foreground && spriteset._foreground.bitmap) {
|
||||
spriteset._foreground.origin.x =
|
||||
foregroundOx + ($gameMap._displayX - displayX) * $gameMap.tileWidth();
|
||||
spriteset._foreground.origin.y =
|
||||
foregroundOy +
|
||||
($gameMap._displayY - displayY) * $gameMap.tileHeight();
|
||||
}
|
||||
if (spriteset._parallaxNonBlur && spriteset._parallaxNonBlur.bitmap) {
|
||||
spriteset._parallaxNonBlur.setFrame(
|
||||
parallaxOx + ($gameMap._displayX - displayX) * $gameMap.tileWidth(),
|
||||
parallaxOy + ($gameMap._displayY - displayY) * $gameMap.tileHeight(),
|
||||
Graphics.width,
|
||||
Graphics.height
|
||||
);
|
||||
}
|
||||
Graphics._renderer.render(SceneManager._scene);
|
||||
let snap = Bitmap.snap(SceneManager._scene);
|
||||
bitmap[info.get("imageId")].blt(
|
||||
snap,
|
||||
0,
|
||||
0,
|
||||
info.get("copyWidth"),
|
||||
info.get("copyHeight"),
|
||||
info.get("dstX"),
|
||||
info.get("dstY")
|
||||
);
|
||||
});
|
||||
// ファイル出力
|
||||
bitmap.forEach((bitmap, index, array) => {
|
||||
let fs = require("fs");
|
||||
let path = StorageManager.localFileDirectoryPath().replace(
|
||||
/save[\\/]$/,
|
||||
""
|
||||
);
|
||||
let folder = path + _plugin.folder;
|
||||
if (!fs.existsSync(folder)) {
|
||||
fs.mkdirSync(folder);
|
||||
}
|
||||
let strIndex = array.length > 1 ? "_" + index.padZero(2) : "";
|
||||
let date = (function () {
|
||||
let date = new Date();
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
let hours = date.getHours();
|
||||
let minutes = date.getMinutes();
|
||||
let seconds = date.getSeconds();
|
||||
return (
|
||||
year +
|
||||
month.padZero(2) +
|
||||
day.padZero(2) +
|
||||
hours.padZero(2) +
|
||||
minutes.padZero(2) +
|
||||
seconds.padZero(2)
|
||||
);
|
||||
})();
|
||||
let file =
|
||||
folder +
|
||||
"\\Map" +
|
||||
$gameMap.mapId().padZero(3) +
|
||||
strIndex +
|
||||
"_" +
|
||||
date +
|
||||
".png";
|
||||
let data = bitmap._canvas.toDataURL("img/png").replace(/^.*,/, "");
|
||||
let buffer = new Buffer(data, "base64");
|
||||
fs.writeFileSync(file, buffer);
|
||||
});
|
||||
// マップ表示位置を復帰
|
||||
$gameMap._displayX = displayX;
|
||||
$gameMap._displayY = displayY;
|
||||
SceneManager._scene._spriteset.update();
|
||||
Graphics._renderer.render(SceneManager._scene);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Scene_Map
|
||||
//==============================================================================
|
||||
|
||||
{
|
||||
let __update = Scene_Map.prototype.update;
|
||||
Scene_Map.prototype.update = function () {
|
||||
if ($gameTemp.isPlaytest() || !_plugin.testOnly) {
|
||||
let trigger1 = !!eval(_plugin.trigger1);
|
||||
let trigger2 = !!eval(_plugin.trigger2);
|
||||
if (trigger2) this._spriteset.hideCharacters();
|
||||
if (trigger1 || trigger2) {
|
||||
createMapImage();
|
||||
}
|
||||
if (trigger2) {
|
||||
this._spriteset._characterSprites.forEach((sprite) => {
|
||||
if (!sprite.isTile()) sprite.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
__update.apply(this, arguments);
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -92,223 +92,234 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
var metaTagPrefix = 'PLM';
|
||||
"use strict";
|
||||
var metaTagPrefix = "PLM";
|
||||
|
||||
//=============================================================================
|
||||
// ローカル関数
|
||||
// プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
|
||||
//=============================================================================
|
||||
var getMetaValue = function (object, name) {
|
||||
var metaTagName = metaTagPrefix + name;
|
||||
if (!object || !object.meta) {
|
||||
return undefined;
|
||||
}
|
||||
return object.meta.hasOwnProperty(metaTagName) ? convertEscapeCharacters(object.meta[metaTagName]) : undefined;
|
||||
};
|
||||
|
||||
var getMetaValues = function (object, names) {
|
||||
for (var i = 0, n = names.length; i < n; i++) {
|
||||
var value = getMetaValue(object, names[i]);
|
||||
if (value !== undefined) return value;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
var convertEscapeCharacters = function (text) {
|
||||
if (isNotAString(text)) text = '';
|
||||
var windowLayer = SceneManager._scene._windowLayer;
|
||||
return windowLayer ? windowLayer.children[0].convertEscapeCharacters(text) : text;
|
||||
};
|
||||
|
||||
var isNotAString = function (args) {
|
||||
return String(args) !== args;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Map
|
||||
// 画面上のピクセル座標を返します。
|
||||
//=============================================================================
|
||||
Game_Map.prototype.displayPixelX = function () {
|
||||
return this._displayX * this.tileWidth();
|
||||
};
|
||||
|
||||
Game_Map.prototype.displayPixelY = function () {
|
||||
return this._displayY * this.tileHeight();
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Character
|
||||
// マップレイヤー名を取得します。
|
||||
//=============================================================================
|
||||
Game_CharacterBase.prototype.getMapLayerName = function () {
|
||||
return this._mapLayerName;
|
||||
};
|
||||
|
||||
Game_CharacterBase.prototype.isMapLayer = function () {
|
||||
return !!this._mapLayerName;
|
||||
};
|
||||
|
||||
var _Game_CharacterBase_isNearTheScreen = Game_CharacterBase.prototype.isNearTheScreen;
|
||||
Game_CharacterBase.prototype.isNearTheScreen = function () {
|
||||
return this.isMapLayer() || _Game_CharacterBase_isNearTheScreen.apply(this, arguments);
|
||||
};
|
||||
|
||||
Game_CharacterBase.prototype.shiftPosition = function (x, y) {
|
||||
this._additionalX = x;
|
||||
this._additionalY = y;
|
||||
};
|
||||
|
||||
Game_CharacterBase.prototype.existPage = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Event
|
||||
// レイヤーイベントに関する機能を実装します。
|
||||
//=============================================================================
|
||||
var _Game_Event_initialize = Game_Event.prototype.initialize;
|
||||
Game_Event.prototype.initialize = function (mapId, eventId) {
|
||||
_Game_Event_initialize.apply(this, arguments);
|
||||
this._mapLayerName = getMetaValue(this.getOriginalEvent(), '') || null;
|
||||
if (this._mapLayerName) {
|
||||
this.initBlendMode();
|
||||
this.initOpacity();
|
||||
this.initZ();
|
||||
}
|
||||
};
|
||||
|
||||
Game_Event.prototype.initBlendMode = function () {
|
||||
var blendMode = getMetaValues(this.getOriginalEvent(), ['_Blend', '合成']);
|
||||
if (blendMode) {
|
||||
this._blendMode = parseInt(blendMode);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Event.prototype.initOpacity = function () {
|
||||
var blendMode = getMetaValues(this.getOriginalEvent(), ['_Opacity', '不透明度']);
|
||||
if (blendMode) {
|
||||
this._opacity = parseInt(blendMode);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Event.prototype.initZ = function () {
|
||||
var z = getMetaValue(this.getOriginalEvent(), '_Z');
|
||||
if (z) {
|
||||
this._layerZ = parseInt(z);
|
||||
}
|
||||
};
|
||||
|
||||
// Resolve conflict for TemplateEvent
|
||||
Game_Event.prototype.getOriginalEvent = function () {
|
||||
return $dataMap.events[this._eventId];
|
||||
};
|
||||
|
||||
Game_Event.prototype.existPage = function () {
|
||||
return this._pageIndex >= 0;
|
||||
};
|
||||
|
||||
Game_Event.prototype.getLayerX = function () {
|
||||
return (this._additionalX || 0) - Math.round($gameMap.displayPixelX());
|
||||
};
|
||||
|
||||
Game_Event.prototype.getLayerY = function () {
|
||||
return (this._additionalY || 0) - Math.round($gameMap.displayPixelY());
|
||||
};
|
||||
|
||||
Game_Event.prototype.getLayerZ = function () {
|
||||
return this._layerZ || this.screenZ();
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Spriteset_Map
|
||||
// キャラクタースプライトをマップレイヤースプライトに差し替えます。
|
||||
//=============================================================================
|
||||
var _Spriteset_Map_createCharacters = Spriteset_Map.prototype.createCharacters;
|
||||
Spriteset_Map.prototype.createCharacters = function () {
|
||||
_Spriteset_Map_createCharacters.apply(this, arguments);
|
||||
var layerSprites = this._characterSprites.filter(function (sprite) {
|
||||
return sprite.isLayer && sprite.isLayer();
|
||||
});
|
||||
layerSprites.forEach(function (oldSprite) {
|
||||
this.replaceLayerSprite(oldSprite);
|
||||
}, this);
|
||||
};
|
||||
|
||||
Spriteset_Map.prototype.replaceLayerSprite = function (oldSprite) {
|
||||
var deleteIndex = this._characterSprites.indexOf(oldSprite);
|
||||
if (deleteIndex >= 0) {
|
||||
this._characterSprites.splice(deleteIndex, 1);
|
||||
}
|
||||
this._tilemap.removeChild(oldSprite);
|
||||
var newSprite = new Sprite_MapLayer(oldSprite.getCharacter());
|
||||
this._tilemap.addChild(newSprite);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Sprite_Character
|
||||
// マップレイヤー判定を追加します。
|
||||
//=============================================================================
|
||||
var _Sprite_Character_character = Sprite_Character.prototype.setCharacter;
|
||||
Sprite_Character.prototype.setCharacter = function (character) {
|
||||
_Sprite_Character_character.apply(this, arguments);
|
||||
this._layerName = character.getMapLayerName();
|
||||
};
|
||||
|
||||
Sprite_Character.prototype.getCharacter = function () {
|
||||
return this._character;
|
||||
};
|
||||
|
||||
Sprite_Character.prototype.isLayer = function () {
|
||||
return !!this._layerName;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Sprite_MapLayer
|
||||
// マップレイヤーを扱うクラスです。
|
||||
//=============================================================================
|
||||
function Sprite_MapLayer() {
|
||||
this.initialize.apply(this, arguments);
|
||||
//=============================================================================
|
||||
// ローカル関数
|
||||
// プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
|
||||
//=============================================================================
|
||||
var getMetaValue = function (object, name) {
|
||||
var metaTagName = metaTagPrefix + name;
|
||||
if (!object || !object.meta) {
|
||||
return undefined;
|
||||
}
|
||||
return object.meta.hasOwnProperty(metaTagName)
|
||||
? convertEscapeCharacters(object.meta[metaTagName])
|
||||
: undefined;
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype = Object.create(Sprite_Character.prototype);
|
||||
Sprite_MapLayer.prototype.constructor = Sprite_MapLayer;
|
||||
var getMetaValues = function (object, names) {
|
||||
for (var i = 0, n = names.length; i < n; i++) {
|
||||
var value = getMetaValue(object, names[i]);
|
||||
if (value !== undefined) return value;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.setCharacter = function (character) {
|
||||
Sprite_Character.prototype.setCharacter.apply(this, arguments);
|
||||
this.loadLayerBitmap();
|
||||
};
|
||||
var convertEscapeCharacters = function (text) {
|
||||
if (isNotAString(text)) text = "";
|
||||
var windowLayer = SceneManager._scene._windowLayer;
|
||||
return windowLayer
|
||||
? windowLayer.children[0].convertEscapeCharacters(text)
|
||||
: text;
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.initMembers = function () {
|
||||
Sprite_Character.prototype.initMembers.apply(this, arguments);
|
||||
this.anchor.x = 0;
|
||||
this.anchor.y = 0;
|
||||
};
|
||||
var isNotAString = function (args) {
|
||||
return String(args) !== args;
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.loadLayerBitmap = function () {
|
||||
this.bitmap = ImageManager.loadParallax(this._layerName, 0);
|
||||
};
|
||||
//=============================================================================
|
||||
// Game_Map
|
||||
// 画面上のピクセル座標を返します。
|
||||
//=============================================================================
|
||||
Game_Map.prototype.displayPixelX = function () {
|
||||
return this._displayX * this.tileWidth();
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.updateVisibility = function () {
|
||||
Sprite_Character.prototype.updateVisibility.apply(this, arguments);
|
||||
if (!this._character.existPage()) {
|
||||
this.visible = false;
|
||||
}
|
||||
this._isPicture = this._character.blendMode() > 3;
|
||||
};
|
||||
Game_Map.prototype.displayPixelY = function () {
|
||||
return this._displayY * this.tileHeight();
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.updatePosition = function () {
|
||||
this.x = this._character.getLayerX();
|
||||
this.y = this._character.getLayerY();
|
||||
this.z = this._character.getLayerZ();
|
||||
};
|
||||
//=============================================================================
|
||||
// Game_Character
|
||||
// マップレイヤー名を取得します。
|
||||
//=============================================================================
|
||||
Game_CharacterBase.prototype.getMapLayerName = function () {
|
||||
return this._mapLayerName;
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.updateBitmap = function () {
|
||||
this._characterName = '';
|
||||
};
|
||||
Game_CharacterBase.prototype.isMapLayer = function () {
|
||||
return !!this._mapLayerName;
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.updateFrame = function () {
|
||||
// do nothing
|
||||
};
|
||||
var _Game_CharacterBase_isNearTheScreen =
|
||||
Game_CharacterBase.prototype.isNearTheScreen;
|
||||
Game_CharacterBase.prototype.isNearTheScreen = function () {
|
||||
return (
|
||||
this.isMapLayer() ||
|
||||
_Game_CharacterBase_isNearTheScreen.apply(this, arguments)
|
||||
);
|
||||
};
|
||||
|
||||
Game_CharacterBase.prototype.shiftPosition = function (x, y) {
|
||||
this._additionalX = x;
|
||||
this._additionalY = y;
|
||||
};
|
||||
|
||||
Game_CharacterBase.prototype.existPage = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Game_Event
|
||||
// レイヤーイベントに関する機能を実装します。
|
||||
//=============================================================================
|
||||
var _Game_Event_initialize = Game_Event.prototype.initialize;
|
||||
Game_Event.prototype.initialize = function (mapId, eventId) {
|
||||
_Game_Event_initialize.apply(this, arguments);
|
||||
this._mapLayerName = getMetaValue(this.getOriginalEvent(), "") || null;
|
||||
if (this._mapLayerName) {
|
||||
this.initBlendMode();
|
||||
this.initOpacity();
|
||||
this.initZ();
|
||||
}
|
||||
};
|
||||
|
||||
Game_Event.prototype.initBlendMode = function () {
|
||||
var blendMode = getMetaValues(this.getOriginalEvent(), ["_Blend", "合成"]);
|
||||
if (blendMode) {
|
||||
this._blendMode = parseInt(blendMode);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Event.prototype.initOpacity = function () {
|
||||
var blendMode = getMetaValues(this.getOriginalEvent(), [
|
||||
"_Opacity",
|
||||
"不透明度",
|
||||
]);
|
||||
if (blendMode) {
|
||||
this._opacity = parseInt(blendMode);
|
||||
}
|
||||
};
|
||||
|
||||
Game_Event.prototype.initZ = function () {
|
||||
var z = getMetaValue(this.getOriginalEvent(), "_Z");
|
||||
if (z) {
|
||||
this._layerZ = parseInt(z);
|
||||
}
|
||||
};
|
||||
|
||||
// Resolve conflict for TemplateEvent
|
||||
Game_Event.prototype.getOriginalEvent = function () {
|
||||
return $dataMap.events[this._eventId];
|
||||
};
|
||||
|
||||
Game_Event.prototype.existPage = function () {
|
||||
return this._pageIndex >= 0;
|
||||
};
|
||||
|
||||
Game_Event.prototype.getLayerX = function () {
|
||||
return (this._additionalX || 0) - Math.round($gameMap.displayPixelX());
|
||||
};
|
||||
|
||||
Game_Event.prototype.getLayerY = function () {
|
||||
return (this._additionalY || 0) - Math.round($gameMap.displayPixelY());
|
||||
};
|
||||
|
||||
Game_Event.prototype.getLayerZ = function () {
|
||||
return this._layerZ || this.screenZ();
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Spriteset_Map
|
||||
// キャラクタースプライトをマップレイヤースプライトに差し替えます。
|
||||
//=============================================================================
|
||||
var _Spriteset_Map_createCharacters =
|
||||
Spriteset_Map.prototype.createCharacters;
|
||||
Spriteset_Map.prototype.createCharacters = function () {
|
||||
_Spriteset_Map_createCharacters.apply(this, arguments);
|
||||
var layerSprites = this._characterSprites.filter(function (sprite) {
|
||||
return sprite.isLayer && sprite.isLayer();
|
||||
});
|
||||
layerSprites.forEach(function (oldSprite) {
|
||||
this.replaceLayerSprite(oldSprite);
|
||||
}, this);
|
||||
};
|
||||
|
||||
Spriteset_Map.prototype.replaceLayerSprite = function (oldSprite) {
|
||||
var deleteIndex = this._characterSprites.indexOf(oldSprite);
|
||||
if (deleteIndex >= 0) {
|
||||
this._characterSprites.splice(deleteIndex, 1);
|
||||
}
|
||||
this._tilemap.removeChild(oldSprite);
|
||||
var newSprite = new Sprite_MapLayer(oldSprite.getCharacter());
|
||||
this._tilemap.addChild(newSprite);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Sprite_Character
|
||||
// マップレイヤー判定を追加します。
|
||||
//=============================================================================
|
||||
var _Sprite_Character_character = Sprite_Character.prototype.setCharacter;
|
||||
Sprite_Character.prototype.setCharacter = function (character) {
|
||||
_Sprite_Character_character.apply(this, arguments);
|
||||
this._layerName = character.getMapLayerName();
|
||||
};
|
||||
|
||||
Sprite_Character.prototype.getCharacter = function () {
|
||||
return this._character;
|
||||
};
|
||||
|
||||
Sprite_Character.prototype.isLayer = function () {
|
||||
return !!this._layerName;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Sprite_MapLayer
|
||||
// マップレイヤーを扱うクラスです。
|
||||
//=============================================================================
|
||||
function Sprite_MapLayer() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
Sprite_MapLayer.prototype = Object.create(Sprite_Character.prototype);
|
||||
Sprite_MapLayer.prototype.constructor = Sprite_MapLayer;
|
||||
|
||||
Sprite_MapLayer.prototype.setCharacter = function (character) {
|
||||
Sprite_Character.prototype.setCharacter.apply(this, arguments);
|
||||
this.loadLayerBitmap();
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.initMembers = function () {
|
||||
Sprite_Character.prototype.initMembers.apply(this, arguments);
|
||||
this.anchor.x = 0;
|
||||
this.anchor.y = 0;
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.loadLayerBitmap = function () {
|
||||
this.bitmap = ImageManager.loadParallax(this._layerName, 0);
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.updateVisibility = function () {
|
||||
Sprite_Character.prototype.updateVisibility.apply(this, arguments);
|
||||
if (!this._character.existPage()) {
|
||||
this.visible = false;
|
||||
}
|
||||
this._isPicture = this._character.blendMode() > 3;
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.updatePosition = function () {
|
||||
this.x = this._character.getLayerX();
|
||||
this.y = this._character.getLayerY();
|
||||
this.z = this._character.getLayerZ();
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.updateBitmap = function () {
|
||||
this._characterName = "";
|
||||
};
|
||||
|
||||
Sprite_MapLayer.prototype.updateFrame = function () {
|
||||
// do nothing
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -159,149 +159,153 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
const pluginName = 'PicturePriorityCustomize';
|
||||
"use strict";
|
||||
const pluginName = "PicturePriorityCustomize";
|
||||
|
||||
//=============================================================================
|
||||
// ローカル関数
|
||||
// プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
|
||||
//=============================================================================
|
||||
const getParamString = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (let i = 0; i < paramNames.length; i++) {
|
||||
const name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return name;
|
||||
}
|
||||
return '';
|
||||
};
|
||||
|
||||
const getParamNumber = function (paramNames, min, max) {
|
||||
const value = getParamString(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value) || 0).clamp(min, max);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
const param = {};
|
||||
param.upperPictureId = getParamNumber(['UpperPictureId', '上層ピクチャ番号']);
|
||||
param.lowerPictureId = getParamNumber(['LowerPictureId', '下層ピクチャ番号']);
|
||||
param.lowerPictureZ = getParamNumber(['LowerPictureZ', '下層ピクチャZ座標']);
|
||||
param.lowerPictureBattleZ = getParamNumber(['LowerPictureBattleZ', '戦闘下層ピクチャZ座標'], 0);
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Base
|
||||
// ウィンドウの上にピクチャを配置します。
|
||||
//=============================================================================
|
||||
var _Scene_Base_createWindowLayer = Scene_Base.prototype.createWindowLayer;
|
||||
Scene_Base.prototype.createWindowLayer = function () {
|
||||
_Scene_Base_createWindowLayer.apply(this, arguments);
|
||||
if (this._spriteset) {
|
||||
this._spriteset.setUpperPictureContainer(this);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Spriteset_Base
|
||||
// ピクチャを三層に分割します。
|
||||
//=============================================================================
|
||||
var _Spriteset_Base_createPictures = Spriteset_Base.prototype.createPictures;
|
||||
Spriteset_Base.prototype.createPictures = function () {
|
||||
_Spriteset_Base_createPictures.apply(this, arguments);
|
||||
this.removeChild(this._pictureContainer);
|
||||
this.createPictureLayer();
|
||||
};
|
||||
|
||||
Spriteset_Base.prototype.createPictureLayer = function () {
|
||||
var width = Graphics.boxWidth;
|
||||
var height = Graphics.boxHeight;
|
||||
var x = (Graphics.width - width) / 2;
|
||||
var y = (Graphics.height - height) / 2;
|
||||
this._pictureContainerLower = new Sprite();
|
||||
this._pictureContainerLower.setFrame(x, y, width, height);
|
||||
this._pictureContainerMiddle = new Sprite();
|
||||
this._pictureContainerMiddle.setFrame(x, y, width, height);
|
||||
this._pictureContainerUpper = new Sprite();
|
||||
this._pictureContainerUpper.setFrame(x, y, width, height);
|
||||
var pictureArray = this._pictureContainer.children.clone();
|
||||
pictureArray.forEach(function (picture) {
|
||||
var pictureId = picture.getPictureId();
|
||||
if (pictureId <= param.lowerPictureId) {
|
||||
this._pictureContainerLower.addChild(picture);
|
||||
} else if (pictureId >= param.upperPictureId) {
|
||||
this._pictureContainerUpper.addChild(picture);
|
||||
} else {
|
||||
this._pictureContainerMiddle.addChild(picture);
|
||||
}
|
||||
}, this);
|
||||
this._pictureContainer.children = pictureArray;
|
||||
this.setLowerPictureContainer();
|
||||
this.setMiddlePictureContainer();
|
||||
};
|
||||
|
||||
Spriteset_Base.prototype.setUpperPictureContainer = function (parentScene) {
|
||||
parentScene.addChild(this._pictureContainerUpper);
|
||||
};
|
||||
|
||||
Spriteset_Base.prototype.setMiddlePictureContainer = function () {
|
||||
this.addChild(this._pictureContainerMiddle);
|
||||
};
|
||||
|
||||
Spriteset_Base.prototype.setLowerPictureContainer = function () {
|
||||
this.addChild(this._pictureContainerLower);
|
||||
};
|
||||
|
||||
var _Spriteset_Base_updatePosition = Spriteset_Base.prototype.updatePosition;
|
||||
Spriteset_Base.prototype.updatePosition = function () {
|
||||
_Spriteset_Base_updatePosition.apply(this, arguments);
|
||||
this._pictureContainerUpper.x = this.x;
|
||||
this._pictureContainerUpper.y = this.y;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Spriteset_Map
|
||||
// 下層ピクチャの位置を設定します。
|
||||
//=============================================================================
|
||||
Spriteset_Map.prototype.setLowerPictureContainer = function () {
|
||||
this._pictureContainerLower.z = param.lowerPictureZ;
|
||||
this._tilemap.addChild(this._pictureContainerLower);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Spriteset_Battle
|
||||
// 下層ピクチャの位置を設定します。
|
||||
//=============================================================================
|
||||
Spriteset_Battle.prototype.setLowerPictureContainer = function () {
|
||||
this.updateLowerPictureContainerZ();
|
||||
// resolve conflict for GALV_LayerGraphics.js
|
||||
if (typeof Imported !== 'undefined' && Imported.Galv_LayerGraphics) {
|
||||
this._pictureContainerLower.z = 2;
|
||||
}
|
||||
};
|
||||
|
||||
Spriteset_Battle.prototype.updateLowerPictureContainerZ = function () {
|
||||
var compare = param.lowerPictureBattleZ > 0 ? this._enemySprites[this._enemySprites.length - 1] :
|
||||
this._back2Sprite;
|
||||
var index = this._battleField.getChildIndex(compare);
|
||||
this._battleField.addChildAt(this._pictureContainerLower, index + 1);
|
||||
};
|
||||
|
||||
if (typeof Yanfly !== 'undefined' && Yanfly.BEC) {
|
||||
var _Spriteset_Battle_update = Spriteset_Battle.prototype.update;
|
||||
Spriteset_Battle.prototype.update = function () {
|
||||
_Spriteset_Battle_update.apply(this, arguments);
|
||||
this.updateLowerPictureContainerZ();
|
||||
};
|
||||
//=============================================================================
|
||||
// ローカル関数
|
||||
// プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
|
||||
//=============================================================================
|
||||
const getParamString = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (let i = 0; i < paramNames.length; i++) {
|
||||
const name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return name;
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Sprite_Picture
|
||||
// ピクチャIDを取得可能にします。
|
||||
//=============================================================================
|
||||
Sprite_Picture.prototype.getPictureId = function () {
|
||||
return this._pictureId;
|
||||
const getParamNumber = function (paramNames, min, max) {
|
||||
const value = getParamString(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value) || 0).clamp(min, max);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
const param = {};
|
||||
param.upperPictureId = getParamNumber(["UpperPictureId", "上層ピクチャ番号"]);
|
||||
param.lowerPictureId = getParamNumber(["LowerPictureId", "下層ピクチャ番号"]);
|
||||
param.lowerPictureZ = getParamNumber(["LowerPictureZ", "下層ピクチャZ座標"]);
|
||||
param.lowerPictureBattleZ = getParamNumber(
|
||||
["LowerPictureBattleZ", "戦闘下層ピクチャZ座標"],
|
||||
0
|
||||
);
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Base
|
||||
// ウィンドウの上にピクチャを配置します。
|
||||
//=============================================================================
|
||||
var _Scene_Base_createWindowLayer = Scene_Base.prototype.createWindowLayer;
|
||||
Scene_Base.prototype.createWindowLayer = function () {
|
||||
_Scene_Base_createWindowLayer.apply(this, arguments);
|
||||
if (this._spriteset) {
|
||||
this._spriteset.setUpperPictureContainer(this);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Spriteset_Base
|
||||
// ピクチャを三層に分割します。
|
||||
//=============================================================================
|
||||
var _Spriteset_Base_createPictures = Spriteset_Base.prototype.createPictures;
|
||||
Spriteset_Base.prototype.createPictures = function () {
|
||||
_Spriteset_Base_createPictures.apply(this, arguments);
|
||||
this.removeChild(this._pictureContainer);
|
||||
this.createPictureLayer();
|
||||
};
|
||||
|
||||
Spriteset_Base.prototype.createPictureLayer = function () {
|
||||
var width = Graphics.boxWidth;
|
||||
var height = Graphics.boxHeight;
|
||||
var x = (Graphics.width - width) / 2;
|
||||
var y = (Graphics.height - height) / 2;
|
||||
this._pictureContainerLower = new Sprite();
|
||||
this._pictureContainerLower.setFrame(x, y, width, height);
|
||||
this._pictureContainerMiddle = new Sprite();
|
||||
this._pictureContainerMiddle.setFrame(x, y, width, height);
|
||||
this._pictureContainerUpper = new Sprite();
|
||||
this._pictureContainerUpper.setFrame(x, y, width, height);
|
||||
var pictureArray = this._pictureContainer.children.clone();
|
||||
pictureArray.forEach(function (picture) {
|
||||
var pictureId = picture.getPictureId();
|
||||
if (pictureId <= param.lowerPictureId) {
|
||||
this._pictureContainerLower.addChild(picture);
|
||||
} else if (pictureId >= param.upperPictureId) {
|
||||
this._pictureContainerUpper.addChild(picture);
|
||||
} else {
|
||||
this._pictureContainerMiddle.addChild(picture);
|
||||
}
|
||||
}, this);
|
||||
this._pictureContainer.children = pictureArray;
|
||||
this.setLowerPictureContainer();
|
||||
this.setMiddlePictureContainer();
|
||||
};
|
||||
|
||||
Spriteset_Base.prototype.setUpperPictureContainer = function (parentScene) {
|
||||
parentScene.addChild(this._pictureContainerUpper);
|
||||
};
|
||||
|
||||
Spriteset_Base.prototype.setMiddlePictureContainer = function () {
|
||||
this.addChild(this._pictureContainerMiddle);
|
||||
};
|
||||
|
||||
Spriteset_Base.prototype.setLowerPictureContainer = function () {
|
||||
this.addChild(this._pictureContainerLower);
|
||||
};
|
||||
|
||||
var _Spriteset_Base_updatePosition = Spriteset_Base.prototype.updatePosition;
|
||||
Spriteset_Base.prototype.updatePosition = function () {
|
||||
_Spriteset_Base_updatePosition.apply(this, arguments);
|
||||
this._pictureContainerUpper.x = this.x;
|
||||
this._pictureContainerUpper.y = this.y;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Spriteset_Map
|
||||
// 下層ピクチャの位置を設定します。
|
||||
//=============================================================================
|
||||
Spriteset_Map.prototype.setLowerPictureContainer = function () {
|
||||
this._pictureContainerLower.z = param.lowerPictureZ;
|
||||
this._tilemap.addChild(this._pictureContainerLower);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Spriteset_Battle
|
||||
// 下層ピクチャの位置を設定します。
|
||||
//=============================================================================
|
||||
Spriteset_Battle.prototype.setLowerPictureContainer = function () {
|
||||
this.updateLowerPictureContainerZ();
|
||||
// resolve conflict for GALV_LayerGraphics.js
|
||||
if (typeof Imported !== "undefined" && Imported.Galv_LayerGraphics) {
|
||||
this._pictureContainerLower.z = 2;
|
||||
}
|
||||
};
|
||||
|
||||
Spriteset_Battle.prototype.updateLowerPictureContainerZ = function () {
|
||||
var compare =
|
||||
param.lowerPictureBattleZ > 0
|
||||
? this._enemySprites[this._enemySprites.length - 1]
|
||||
: this._back2Sprite;
|
||||
var index = this._battleField.getChildIndex(compare);
|
||||
this._battleField.addChildAt(this._pictureContainerLower, index + 1);
|
||||
};
|
||||
|
||||
if (typeof Yanfly !== "undefined" && Yanfly.BEC) {
|
||||
var _Spriteset_Battle_update = Spriteset_Battle.prototype.update;
|
||||
Spriteset_Battle.prototype.update = function () {
|
||||
_Spriteset_Battle_update.apply(this, arguments);
|
||||
this.updateLowerPictureContainerZ();
|
||||
};
|
||||
})();
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
// Sprite_Picture
|
||||
// ピクチャIDを取得可能にします。
|
||||
//=============================================================================
|
||||
Sprite_Picture.prototype.getPictureId = function () {
|
||||
return this._pictureId;
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -89,126 +89,144 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
var metaTagPrefix = 'SST_';
|
||||
"use strict";
|
||||
var metaTagPrefix = "SST_";
|
||||
|
||||
//=============================================================================
|
||||
// ローカル関数
|
||||
// プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
|
||||
//=============================================================================
|
||||
var getMetaValue = function (object, name) {
|
||||
var metaTagName = metaTagPrefix + name;
|
||||
return object.meta.hasOwnProperty(metaTagName) ? convertEscapeCharacters(object.meta[metaTagName]) : undefined;
|
||||
//=============================================================================
|
||||
// ローカル関数
|
||||
// プラグインパラメータやプラグインコマンドパラメータの整形やチェックをします
|
||||
//=============================================================================
|
||||
var getMetaValue = function (object, name) {
|
||||
var metaTagName = metaTagPrefix + name;
|
||||
return object.meta.hasOwnProperty(metaTagName)
|
||||
? convertEscapeCharacters(object.meta[metaTagName])
|
||||
: undefined;
|
||||
};
|
||||
|
||||
var getMetaValues = function (object, names) {
|
||||
for (var i = 0, n = names.length; i < n; i++) {
|
||||
var value = getMetaValue(object, names[i]);
|
||||
if (value !== undefined) return value;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
var getArgArrayString = function (args) {
|
||||
var values = args.split(",");
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
values[i] = values[i].trim();
|
||||
}
|
||||
return values;
|
||||
};
|
||||
|
||||
var convertEscapeCharacters = function (text) {
|
||||
if (String(text) !== text) return text;
|
||||
var windowLayer = SceneManager._scene._windowLayer;
|
||||
return windowLayer
|
||||
? windowLayer.children[0].convertEscapeCharacters(text)
|
||||
: text;
|
||||
};
|
||||
|
||||
var createPluginParameter = function (pluginName) {
|
||||
var paramReplacer = function (key, value) {
|
||||
if (value === "null") {
|
||||
return value;
|
||||
}
|
||||
if (value[0] === '"' && value[value.length - 1] === '"') {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
var parameter = JSON.parse(
|
||||
JSON.stringify(PluginManager.parameters(pluginName), paramReplacer)
|
||||
);
|
||||
PluginManager.setParameters(pluginName, parameter);
|
||||
return parameter;
|
||||
};
|
||||
|
||||
var getMetaValues = function (object, names) {
|
||||
for (var i = 0, n = names.length; i < n; i++) {
|
||||
var value = getMetaValue(object, names[i]);
|
||||
if (value !== undefined) return value;
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
var param = createPluginParameter("SelfSwitchTemporary");
|
||||
|
||||
var getArgArrayString = function (args) {
|
||||
var values = args.split(',');
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
values[i] = values[i].trim();
|
||||
}
|
||||
return values;
|
||||
};
|
||||
/**
|
||||
* Game_Interpreter
|
||||
* プラグインコマンドを追加定義します。
|
||||
*/
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
if (
|
||||
command === "CLEAR_TEMPORARY_SELF_SWITCH" ||
|
||||
command === "一時セルフスイッチ解除"
|
||||
) {
|
||||
$gameSelfSwitches.clearTemporary();
|
||||
}
|
||||
};
|
||||
|
||||
var convertEscapeCharacters = function (text) {
|
||||
if (String(text) !== text) return text;
|
||||
var windowLayer = SceneManager._scene._windowLayer;
|
||||
return windowLayer ? windowLayer.children[0].convertEscapeCharacters(text) : text;
|
||||
};
|
||||
/**
|
||||
* Game_SelfSwitches
|
||||
*/
|
||||
Game_SelfSwitches.prototype.appendTemporary = function (
|
||||
mapId,
|
||||
eventId,
|
||||
type
|
||||
) {
|
||||
if (!this._temporaryList) {
|
||||
this._temporaryList = {};
|
||||
}
|
||||
this._temporaryList[[mapId, eventId, type]] = true;
|
||||
};
|
||||
|
||||
var createPluginParameter = function (pluginName) {
|
||||
var paramReplacer = function (key, value) {
|
||||
if (value === 'null') {
|
||||
return value;
|
||||
}
|
||||
if (value[0] === '"' && value[value.length - 1] === '"') {
|
||||
return value;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(value);
|
||||
} catch (e) {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
var parameter = JSON.parse(JSON.stringify(PluginManager.parameters(pluginName), paramReplacer));
|
||||
PluginManager.setParameters(pluginName, parameter);
|
||||
return parameter;
|
||||
};
|
||||
Game_SelfSwitches.prototype.clearTemporary = function () {
|
||||
if (!this._temporaryList) {
|
||||
return;
|
||||
}
|
||||
Object.keys(this._temporaryList).forEach(function (key) {
|
||||
this.setValue(key, false);
|
||||
}, this);
|
||||
};
|
||||
|
||||
var param = createPluginParameter('SelfSwitchTemporary');
|
||||
/**
|
||||
* Game_Map
|
||||
*/
|
||||
var _Game_Map_setupEvents = Game_Map.prototype.setupEvents;
|
||||
Game_Map.prototype.setupEvents = function () {
|
||||
if (param.clearTransfer) {
|
||||
$gameSelfSwitches.clearTemporary();
|
||||
}
|
||||
_Game_Map_setupEvents.apply(this, arguments);
|
||||
this.events().forEach(function (event) {
|
||||
event.addTemporarySelfSwitch();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Game_Interpreter
|
||||
* プラグインコマンドを追加定義します。
|
||||
*/
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
if (command === 'CLEAR_TEMPORARY_SELF_SWITCH' || command === '一時セルフスイッチ解除') {
|
||||
$gameSelfSwitches.clearTemporary();
|
||||
}
|
||||
};
|
||||
/**
|
||||
* Game_Event
|
||||
*/
|
||||
Game_Event.prototype.addTemporarySelfSwitch = function () {
|
||||
var switchList = this.findTemporarySelfSwitch();
|
||||
if (!switchList) {
|
||||
return;
|
||||
}
|
||||
switchList.forEach(function (type) {
|
||||
$gameSelfSwitches.appendTemporary(
|
||||
$gameMap.mapId(),
|
||||
this.eventId(),
|
||||
type.toUpperCase()
|
||||
);
|
||||
}, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Game_SelfSwitches
|
||||
*/
|
||||
Game_SelfSwitches.prototype.appendTemporary = function (mapId, eventId, type) {
|
||||
if (!this._temporaryList) {
|
||||
this._temporaryList = {};
|
||||
}
|
||||
this._temporaryList[[mapId, eventId, type]] = true;
|
||||
};
|
||||
|
||||
Game_SelfSwitches.prototype.clearTemporary = function () {
|
||||
if (!this._temporaryList) {
|
||||
return;
|
||||
}
|
||||
Object.keys(this._temporaryList).forEach(function (key) {
|
||||
this.setValue(key, false);
|
||||
}, this);
|
||||
};
|
||||
|
||||
/**
|
||||
* Game_Map
|
||||
*/
|
||||
var _Game_Map_setupEvents = Game_Map.prototype.setupEvents;
|
||||
Game_Map.prototype.setupEvents = function () {
|
||||
if (param.clearTransfer) {
|
||||
$gameSelfSwitches.clearTemporary();
|
||||
}
|
||||
_Game_Map_setupEvents.apply(this, arguments);
|
||||
this.events().forEach(function (event) {
|
||||
event.addTemporarySelfSwitch();
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Game_Event
|
||||
*/
|
||||
Game_Event.prototype.addTemporarySelfSwitch = function () {
|
||||
var switchList = this.findTemporarySelfSwitch();
|
||||
if (!switchList) {
|
||||
return;
|
||||
}
|
||||
switchList.forEach(function (type) {
|
||||
$gameSelfSwitches.appendTemporary($gameMap.mapId(), this.eventId(), type.toUpperCase());
|
||||
}, this);
|
||||
};
|
||||
|
||||
Game_Event.prototype.findTemporarySelfSwitch = function () {
|
||||
var metaValue = getMetaValues(this.event(), ['Switch', 'スイッチ']);
|
||||
if (!metaValue) {
|
||||
return param.defaultTemporary || null;
|
||||
}
|
||||
var list = metaValue === true ? ['A', 'B', 'C', 'D'] : getArgArrayString(metaValue);
|
||||
return param.defaultTemporary ? list.concat(param.defaultTemporary) : list;
|
||||
};
|
||||
Game_Event.prototype.findTemporarySelfSwitch = function () {
|
||||
var metaValue = getMetaValues(this.event(), ["Switch", "スイッチ"]);
|
||||
if (!metaValue) {
|
||||
return param.defaultTemporary || null;
|
||||
}
|
||||
var list =
|
||||
metaValue === true ? ["A", "B", "C", "D"] : getArgArrayString(metaValue);
|
||||
return param.defaultTemporary ? list.concat(param.defaultTemporary) : list;
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
* @help This plugin does not provide plugin commands.
|
||||
*
|
||||
* By not displaying the log and only displaying the skill name,
|
||||
* the speed of battle will increase slightly.
|
||||
* the speed of battle will increase slightly.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
|
|
@ -38,17 +38,16 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
var parameters = PluginManager.parameters('SimpleMsgSideView');
|
||||
var displayAttack = Number(parameters['displayAttack']) != 0;
|
||||
var position = Number(parameters['position'] || 1);
|
||||
var parameters = PluginManager.parameters("SimpleMsgSideView");
|
||||
var displayAttack = Number(parameters["displayAttack"]) != 0;
|
||||
var position = Number(parameters["position"] || 1);
|
||||
|
||||
var _Window_BattleLog_addText = Window_BattleLog.prototype.addText;
|
||||
Window_BattleLog.prototype.addText = function (text) {
|
||||
if ($gameSystem.isSideView()) {
|
||||
this.refresh();
|
||||
this.wait();
|
||||
return; // not display battle log
|
||||
return; // not display battle log
|
||||
}
|
||||
_Window_BattleLog_addText.call(this, text);
|
||||
};
|
||||
|
|
@ -64,11 +63,13 @@
|
|||
Window_BattleLog.prototype.displayAction;
|
||||
Window_BattleLog.prototype.displayAction = function (subject, item) {
|
||||
if ($gameSystem.isSideView()) {
|
||||
if (displayAttack ||
|
||||
!(DataManager.isSkill(item) && item.id == subject.attackSkillId())) {
|
||||
this.push('addItemNameText', item.name); // display item/skill name
|
||||
if (
|
||||
displayAttack ||
|
||||
!(DataManager.isSkill(item) && item.id == subject.attackSkillId())
|
||||
) {
|
||||
this.push("addItemNameText", item.name); // display item/skill name
|
||||
} else {
|
||||
this.push('wait');
|
||||
this.push("wait");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -81,11 +82,9 @@
|
|||
if ($gameSystem.isSideView() && position == 1) {
|
||||
var rect = this.itemRectForText(index);
|
||||
this.contents.clearRect(rect.x, rect.y, rect.width, rect.height);
|
||||
this.drawText(this._lines[index], rect.x, rect.y,
|
||||
rect.width, 'center');
|
||||
this.drawText(this._lines[index], rect.x, rect.y, rect.width, "center");
|
||||
return;
|
||||
}
|
||||
_Window_BattleLog_drawLineText.call(this, index);
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -102,15 +102,16 @@ Imported.TMAnimeLight = true;
|
|||
|
||||
var TMPlugin = TMPlugin || {};
|
||||
TMPlugin.AnimeLight = {};
|
||||
TMPlugin.AnimeLight.Parameters = PluginManager.parameters('TMAnimeLight');
|
||||
TMPlugin.AnimeLight.Range = +(TMPlugin.AnimeLight.Parameters['range'] || 0.1);
|
||||
TMPlugin.AnimeLight.DefaultZ = +(TMPlugin.AnimeLight.Parameters['defaultZ'] || 4);
|
||||
TMPlugin.AnimeLight.Frames = +(TMPlugin.AnimeLight.Parameters['frames'] || 30);
|
||||
TMPlugin.AnimeLight.Parameters = PluginManager.parameters("TMAnimeLight");
|
||||
TMPlugin.AnimeLight.Range = +(TMPlugin.AnimeLight.Parameters["range"] || 0.1);
|
||||
TMPlugin.AnimeLight.DefaultZ = +(
|
||||
TMPlugin.AnimeLight.Parameters["defaultZ"] || 4
|
||||
);
|
||||
TMPlugin.AnimeLight.Frames = +(TMPlugin.AnimeLight.Parameters["frames"] || 30);
|
||||
|
||||
if (!TMPlugin.EventBase) {
|
||||
TMPlugin.EventBase = true;
|
||||
(function () {
|
||||
|
||||
var _Game_Event_setupPage = Game_Event.prototype.setupPage;
|
||||
Game_Event.prototype.setupPage = function () {
|
||||
_Game_Event_setupPage.call(this);
|
||||
|
|
@ -123,11 +124,12 @@ if (!TMPlugin.EventBase) {
|
|||
var list = this.list();
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var command = list[i];
|
||||
if (command && command.code == 108 || command.code == 408) {
|
||||
for (; ;) {
|
||||
if ((command && command.code == 108) || command.code == 408) {
|
||||
for (;;) {
|
||||
var match = re.exec(command.parameters[0]);
|
||||
if (match) {
|
||||
this._commentParams[match[1]] = match[2] === ':' ? match[3] : true;
|
||||
this._commentParams[match[1]] =
|
||||
match[2] === ":" ? match[3] : true;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
|
@ -141,48 +143,56 @@ if (!TMPlugin.EventBase) {
|
|||
Game_Event.prototype.loadTagParam = function (paramName) {
|
||||
return this._commentParams[paramName] || this.event().meta[paramName];
|
||||
};
|
||||
|
||||
})();
|
||||
} // TMPlugin.EventBase
|
||||
|
||||
if (!TMPlugin.InterpreterBase) {
|
||||
TMPlugin.InterpreterBase = true;
|
||||
(function () {
|
||||
|
||||
Game_Interpreter.prototype.convertEscapeCharactersTM = function (text) {
|
||||
text = text.replace(/\\/g, '\x1b');
|
||||
text = text.replace(/\x1b\x1b/g, '\\');
|
||||
text = text.replace(/\x1bV\[(\d+)\]/gi, function () {
|
||||
return $gameVariables.value(parseInt(arguments[1]));
|
||||
}.bind(this));
|
||||
text = text.replace(/\x1bV\[(\d+)\]/gi, function () {
|
||||
return $gameVariables.value(parseInt(arguments[1]));
|
||||
}.bind(this));
|
||||
text = text.replace(/\x1bN\[(\d+)\]/gi, function () {
|
||||
return this.actorNameTM(parseInt(arguments[1]));
|
||||
}.bind(this));
|
||||
text = text.replace(/\x1bP\[(\d+)\]/gi, function () {
|
||||
return this.partyMemberNameTM(parseInt(arguments[1]));
|
||||
}.bind(this));
|
||||
text = text.replace(/\\/g, "\x1b");
|
||||
text = text.replace(/\x1b\x1b/g, "\\");
|
||||
text = text.replace(
|
||||
/\x1bV\[(\d+)\]/gi,
|
||||
function () {
|
||||
return $gameVariables.value(parseInt(arguments[1]));
|
||||
}.bind(this)
|
||||
);
|
||||
text = text.replace(
|
||||
/\x1bV\[(\d+)\]/gi,
|
||||
function () {
|
||||
return $gameVariables.value(parseInt(arguments[1]));
|
||||
}.bind(this)
|
||||
);
|
||||
text = text.replace(
|
||||
/\x1bN\[(\d+)\]/gi,
|
||||
function () {
|
||||
return this.actorNameTM(parseInt(arguments[1]));
|
||||
}.bind(this)
|
||||
);
|
||||
text = text.replace(
|
||||
/\x1bP\[(\d+)\]/gi,
|
||||
function () {
|
||||
return this.partyMemberNameTM(parseInt(arguments[1]));
|
||||
}.bind(this)
|
||||
);
|
||||
text = text.replace(/\x1bG/gi, TextManager.currencyUnit);
|
||||
return text;
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.actorNameTM = function (n) {
|
||||
var actor = n >= 1 ? $gameActors.actor(n) : null;
|
||||
return actor ? actor.name() : '';
|
||||
return actor ? actor.name() : "";
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.partyMemberNameTM = function (n) {
|
||||
var actor = n >= 1 ? $gameParty.members()[n - 1] : null;
|
||||
return actor ? actor.name() : '';
|
||||
return actor ? actor.name() : "";
|
||||
};
|
||||
|
||||
})();
|
||||
} // TMPlugin.InterpreterBase
|
||||
|
||||
(function () {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Temp
|
||||
//
|
||||
|
|
@ -196,8 +206,10 @@ if (!TMPlugin.InterpreterBase) {
|
|||
Game_Temp.prototype.createAnimeLightSinTable = function () {
|
||||
this._animeLightSinTable = [];
|
||||
for (var i = 0; i < TMPlugin.AnimeLight.Frames; i++) {
|
||||
this._animeLightSinTable[i] = Math.sin(Math.PI * i / (TMPlugin.AnimeLight.Frames / 2)) *
|
||||
TMPlugin.AnimeLight.Range + 1;
|
||||
this._animeLightSinTable[i] =
|
||||
Math.sin((Math.PI * i) / (TMPlugin.AnimeLight.Frames / 2)) *
|
||||
TMPlugin.AnimeLight.Range +
|
||||
1;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -229,18 +241,18 @@ if (!TMPlugin.InterpreterBase) {
|
|||
Game_Event.prototype.setupPage = function () {
|
||||
_Game_Event_setupPage.call(this);
|
||||
if (this._pageIndex >= 0) {
|
||||
var animeLight = this.loadTagParam('animeLight');
|
||||
var animeLight = this.loadTagParam("animeLight");
|
||||
if (animeLight) {
|
||||
var arr = animeLight.split(' ');
|
||||
var arr = animeLight.split(" ");
|
||||
this._animeLight = arr[0];
|
||||
this._animeLightOpacity = arr[1] || 255;
|
||||
this._animeLightShiftX = arr[2] || 0;
|
||||
this._animeLightShiftY = arr[3] || 0;
|
||||
this._animeLightZ = arr[4] || TMPlugin.AnimeLight.DefaultZ;
|
||||
this._animeLightNone = arr[5] === '1';
|
||||
this._animeLightNone = arr[5] === "1";
|
||||
}
|
||||
} else {
|
||||
this._animeLight = '';
|
||||
this._animeLight = "";
|
||||
this._animeLightOpacity = 255;
|
||||
this._animeLightShiftX = 0;
|
||||
this._animeLightShiftY = 0;
|
||||
|
|
@ -254,10 +266,11 @@ if (!TMPlugin.InterpreterBase) {
|
|||
// Game_Interpreter
|
||||
//
|
||||
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'animeLight') {
|
||||
if (command === "animeLight") {
|
||||
var arr = args.map(this.convertEscapeCharactersTM, this);
|
||||
var character = this.character(+arr[0]);
|
||||
if (character) {
|
||||
|
|
@ -266,7 +279,7 @@ if (!TMPlugin.InterpreterBase) {
|
|||
character._animeLightShiftX = arr[3] || 0;
|
||||
character._animeLightShiftY = arr[4] || 0;
|
||||
character._animeLightZ = arr[5] || TMPlugin.AnimeLight.DefaultZ;
|
||||
character._animeLightNone = arr[6] === '1';
|
||||
character._animeLightNone = arr[6] === "1";
|
||||
character.requestAnimeLight();
|
||||
}
|
||||
}
|
||||
|
|
@ -283,8 +296,10 @@ if (!TMPlugin.InterpreterBase) {
|
|||
};
|
||||
|
||||
Sprite_Character.prototype.updateAnimeLight = function () {
|
||||
if (this._character.isAnimeLightRequested() ||
|
||||
this._animeLight !== this._character._animeLight) {
|
||||
if (
|
||||
this._character.isAnimeLightRequested() ||
|
||||
this._animeLight !== this._character._animeLight
|
||||
) {
|
||||
this._character.onChangeAnimeLight();
|
||||
this._animeLight = this._character._animeLight;
|
||||
if (this._animeLight) {
|
||||
|
|
@ -341,5 +356,4 @@ if (!TMPlugin.InterpreterBase) {
|
|||
this.y = this._characterSprite.y + this._shiftY;
|
||||
this.z = +this._characterSprite._character._animeLightZ;
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
*
|
||||
* プラグインコマンドによるフキダシループは、イベントページの切り替わりや
|
||||
* イベントコマンド『イベントの一時消去』などによって解除されます。
|
||||
*
|
||||
*
|
||||
* プラグインコマンド:
|
||||
* setBalloonLoop 2 1
|
||||
* 2番のイベントにフキダシループとしてびっくりアイコンを設定します。イベ
|
||||
|
|
@ -44,7 +44,6 @@ Imported.TMBalloonLoop = true;
|
|||
if (!Imported.TMEventBase) {
|
||||
Imported.TMEventBase = true;
|
||||
(function () {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Event
|
||||
//
|
||||
|
|
@ -63,11 +62,11 @@ if (!Imported.TMEventBase) {
|
|||
var list = this.list();
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var command = list[i];
|
||||
if (command && command.code == 108 || command.code == 408) {
|
||||
for (; ;) {
|
||||
if ((command && command.code == 108) || command.code == 408) {
|
||||
for (;;) {
|
||||
var match = re.exec(command.parameters[0]);
|
||||
if (match) {
|
||||
if (match[2] === ':') {
|
||||
if (match[2] === ":") {
|
||||
this._commentParams[match[1]] = match[3];
|
||||
} else {
|
||||
this._commentParams[match[1]] = true;
|
||||
|
|
@ -91,12 +90,10 @@ if (!Imported.TMEventBase) {
|
|||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
}
|
||||
|
||||
(function () {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_CharacterBase
|
||||
//
|
||||
|
|
@ -126,7 +123,7 @@ if (!Imported.TMEventBase) {
|
|||
Game_Event.prototype.setupPage = function () {
|
||||
_Game_Event_setupPage.call(this);
|
||||
if (this._pageIndex >= 0) {
|
||||
var balloonLoop = +this.loadTagParam('balloonLoop');
|
||||
var balloonLoop = +this.loadTagParam("balloonLoop");
|
||||
if (balloonLoop) {
|
||||
this.setBalloonLoop(balloonLoop);
|
||||
}
|
||||
|
|
@ -139,10 +136,11 @@ if (!Imported.TMEventBase) {
|
|||
// Game_Interpreter
|
||||
//
|
||||
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'setBalloonLoop') {
|
||||
if (command === "setBalloonLoop") {
|
||||
var character = this.character(+args[0]);
|
||||
if (character) {
|
||||
character.setBalloonLoop(+args[1]);
|
||||
|
|
@ -163,5 +161,4 @@ if (!Imported.TMEventBase) {
|
|||
_Sprite_Character_endBalloon.call(this);
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
* @desc ログウィンドウの1行の高さ。
|
||||
* 初期値: 24
|
||||
* @default 24
|
||||
*
|
||||
*
|
||||
* @param padding
|
||||
* @type number
|
||||
* @desc ログウィンドウの余白の大きさ。
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
* @desc ウィンドウフレームと背景の不透明度。
|
||||
* 初期値: 255 ( 0 ~ 255 )
|
||||
* @default 255
|
||||
*
|
||||
*
|
||||
* @param collideOpacity
|
||||
* @type number
|
||||
* @max 255
|
||||
|
|
@ -89,13 +89,13 @@
|
|||
* @desc イベント起動中はログウィンドウを隠す。
|
||||
* 初期値: ON( true = ON 隠す / false = OFF 隠さない )
|
||||
* @default true
|
||||
*
|
||||
*
|
||||
* @param maxLogs
|
||||
* @type number
|
||||
* @desc 保存するログの最大行数。
|
||||
* 初期値: 30
|
||||
* @default 30
|
||||
*
|
||||
*
|
||||
* @param autoDelete
|
||||
* @type variable
|
||||
* @desc 指定したゲーム変数に代入された値の間隔で、自動的にテキストを
|
||||
|
|
@ -104,54 +104,54 @@
|
|||
*
|
||||
* @help
|
||||
* TMPlugin - ログウィンドウ ver1.1.1
|
||||
*
|
||||
*
|
||||
* 使い方:
|
||||
*
|
||||
*
|
||||
* プラグインを導入するとマップシーンにログウィンドウが追加されます。
|
||||
* プラグインコマンドを使って手動で書き込むか、転記モードで
|
||||
* 自動的に書き込むことでログウィンドウにテキストを表示できます。
|
||||
*
|
||||
*
|
||||
* このプラグインは RPGツクールMV Version 1.6.1 で動作確認をしています。
|
||||
*
|
||||
* このプラグインはMITライセンスのもとに配布しています、商用利用、
|
||||
* 改造、再配布など、自由にお使いいただけます。
|
||||
*
|
||||
*
|
||||
*
|
||||
* プラグインコマンド:
|
||||
*
|
||||
*
|
||||
* showLogWindow
|
||||
* ログウィンドウを表示する。
|
||||
*
|
||||
*
|
||||
* hideLogWindow
|
||||
* ログウィンドウを隠す。
|
||||
*
|
||||
*
|
||||
* addLog テキスト
|
||||
* テキストをログウィンドウに追加する。
|
||||
* 一部の制御文字も使えます(\V[n], \N[n], \P[n], \G, \C[n])
|
||||
*
|
||||
*
|
||||
* deleteLog
|
||||
* 一番古いテキストをひとつ削除する。
|
||||
*
|
||||
*
|
||||
* startMirrorLogWindow
|
||||
* イベントコマンド『文章の表示』をトレースする転記モードを有効化。
|
||||
*
|
||||
*
|
||||
* stopMirrorLogWindow
|
||||
* startMirrorLogWindow で有効化した機能を無効化します。
|
||||
*
|
||||
*
|
||||
* startAutoLogWindow
|
||||
* 『TMJumpAction.js』などの対応プラグインと併用した場合に
|
||||
* 敵撃破時の報酬情報を自動でログに追記する機能を有効化します。
|
||||
* この機能はゲーム開始時には自動的にオンになっています。
|
||||
*
|
||||
*
|
||||
* stopAutoLogWindow
|
||||
* startAutoLogWindow で有効化した機能を無効化します。
|
||||
*
|
||||
*
|
||||
* openLogScene
|
||||
* ログ確認シーンへ移行します。
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* プラグインパラメータ補足:
|
||||
*
|
||||
*
|
||||
* padding
|
||||
* テキストの表示領域とウィンドウフレーム外側までのドット数です。
|
||||
* ウィンドウの高さ(縦方向の大きさ)は以下の式で算出されます。
|
||||
|
|
@ -159,12 +159,12 @@
|
|||
* 画面の下部ぴったりにウィンドウを表示したい場合は縦方向の
|
||||
* 画面サイズから上記の式の結果を引いた値を logWindowY に
|
||||
* 設定してください。
|
||||
*
|
||||
*
|
||||
* collideOpacity
|
||||
* opacity よりも大きい値を設定した場合、ログの内容には
|
||||
* collideOpacity を適用し、ウィンドウフレームと背景には
|
||||
* opacity を適用します。
|
||||
*
|
||||
*
|
||||
* autoDelete
|
||||
* 指定したゲーム変数の値が 0 の場合は、自動削除の機能が
|
||||
* 停止します。
|
||||
|
|
@ -174,405 +174,420 @@ var Imported = Imported || {};
|
|||
Imported.TMLogWindow = true;
|
||||
|
||||
(function () {
|
||||
parameters = PluginManager.parameters("TMLogWindow");
|
||||
logWindowX = +(parameters["logWindowX"] || 0);
|
||||
logWindowY = +(parameters["logWindowY"] || 464);
|
||||
logWindowWidth = +(parameters["logWindowWidth"] || 480);
|
||||
logWindowLines = +(parameters["lines"] || 6);
|
||||
logWindowLineHeight = +(parameters["lineHeight"] || 24);
|
||||
logWindowPadding = +(parameters["padding"] || 10);
|
||||
logWindowFontSize = +(parameters["fontSize"] || 20);
|
||||
logWindowStartVisible = JSON.parse(parameters["startVisible"]);
|
||||
logWindowOpacity = +(parameters["opacity"] || 255);
|
||||
logWindowCollideOpacity = +(parameters["collideOpacity"] || 128);
|
||||
logWindowMessageBusyHide = JSON.parse(parameters["messageBusyHide"]);
|
||||
logWindowEventBusyHide = JSON.parse(parameters["eventBusyHide"]);
|
||||
logWindowMaxLogs = +(parameters["maxLogs"] || 20);
|
||||
logWindowAutoDelete = +(parameters["autoDelete"] || 0);
|
||||
|
||||
parameters = PluginManager.parameters('TMLogWindow');
|
||||
logWindowX = +(parameters['logWindowX'] || 0);
|
||||
logWindowY = +(parameters['logWindowY'] || 464);
|
||||
logWindowWidth = +(parameters['logWindowWidth'] || 480);
|
||||
logWindowLines = +(parameters['lines'] || 6);
|
||||
logWindowLineHeight = +(parameters['lineHeight'] || 24);
|
||||
logWindowPadding = +(parameters['padding'] || 10);
|
||||
logWindowFontSize = +(parameters['fontSize'] || 20);
|
||||
logWindowStartVisible = JSON.parse(parameters['startVisible']);
|
||||
logWindowOpacity = +(parameters['opacity'] || 255);
|
||||
logWindowCollideOpacity = +(parameters['collideOpacity'] || 128);
|
||||
logWindowMessageBusyHide = JSON.parse(parameters['messageBusyHide']);
|
||||
logWindowEventBusyHide = JSON.parse(parameters['eventBusyHide']);
|
||||
logWindowMaxLogs = +(parameters['maxLogs'] || 20);
|
||||
logWindowAutoDelete = +(parameters['autoDelete'] || 0);
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Temp
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Temp
|
||||
//
|
||||
Game_Temp.prototype.dummyWindow = function () {
|
||||
if (!this._dummyWindow) {
|
||||
this._dummyWindow = new Window_Base(0, 0, 64, 64);
|
||||
}
|
||||
return this._dummyWindow;
|
||||
};
|
||||
|
||||
Game_Temp.prototype.dummyWindow = function () {
|
||||
if (!this._dummyWindow) {
|
||||
this._dummyWindow = new Window_Base(0, 0, 64, 64);
|
||||
}
|
||||
return this._dummyWindow;
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_System
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_System
|
||||
//
|
||||
var _Game_System_initialize = Game_System.prototype.initialize;
|
||||
Game_System.prototype.initialize = function () {
|
||||
_Game_System_initialize.call(this);
|
||||
this._visibleLogWindow = logWindowStartVisible;
|
||||
this._mirrorLogWindow = false;
|
||||
this._autoLogWindow = true;
|
||||
this._actionLog = [];
|
||||
};
|
||||
|
||||
var _Game_System_initialize = Game_System.prototype.initialize;
|
||||
Game_System.prototype.initialize = function () {
|
||||
_Game_System_initialize.call(this);
|
||||
this._visibleLogWindow = logWindowStartVisible;
|
||||
this._mirrorLogWindow = false;
|
||||
this._autoLogWindow = true;
|
||||
this._actionLog = [];
|
||||
};
|
||||
Game_System.prototype.isVisibleLogWindow = function () {
|
||||
return this._visibleLogWindow;
|
||||
};
|
||||
|
||||
Game_System.prototype.isVisibleLogWindow = function () {
|
||||
return this._visibleLogWindow;
|
||||
};
|
||||
Game_System.prototype.isMirrorLogWindow = function () {
|
||||
return this._mirrorLogWindow;
|
||||
};
|
||||
|
||||
Game_System.prototype.isMirrorLogWindow = function () {
|
||||
return this._mirrorLogWindow;
|
||||
};
|
||||
Game_System.prototype.isAutoLogWindow = function () {
|
||||
return this._autoLogWindow;
|
||||
};
|
||||
|
||||
Game_System.prototype.isAutoLogWindow = function () {
|
||||
return this._autoLogWindow;
|
||||
};
|
||||
Game_System.prototype.setVisibleLogWindow = function (visible) {
|
||||
this._visibleLogWindow = visible;
|
||||
};
|
||||
|
||||
Game_System.prototype.setVisibleLogWindow = function (visible) {
|
||||
this._visibleLogWindow = visible;
|
||||
};
|
||||
Game_System.prototype.setMirrorMode = function (flag) {
|
||||
this._mirrorLogWindow = flag;
|
||||
};
|
||||
|
||||
Game_System.prototype.setMirrorMode = function (flag) {
|
||||
this._mirrorLogWindow = flag;
|
||||
};
|
||||
Game_System.prototype.setAutoMode = function (flag) {
|
||||
this._autoLogWindow = flag;
|
||||
};
|
||||
|
||||
Game_System.prototype.setAutoMode = function (flag) {
|
||||
this._autoLogWindow = flag;
|
||||
};
|
||||
Game_System.prototype.addLog = function (text) {
|
||||
text = $gameTemp.dummyWindow().convertEscapeCharacters(text);
|
||||
this._actionLog.push(text);
|
||||
if (this._actionLog.length > logWindowMaxLogs) {
|
||||
this._actionLog.shift();
|
||||
}
|
||||
this._needsActionLogRefresh = true;
|
||||
};
|
||||
|
||||
Game_System.prototype.addLog = function (text) {
|
||||
text = $gameTemp.dummyWindow().convertEscapeCharacters(text);
|
||||
this._actionLog.push(text);
|
||||
if (this._actionLog.length > logWindowMaxLogs) {
|
||||
this._actionLog.shift();
|
||||
}
|
||||
this._needsActionLogRefresh = true;
|
||||
};
|
||||
Game_System.prototype.deleteLog = function () {
|
||||
if (this._actionLog.length > 0) {
|
||||
this._actionLog.shift();
|
||||
this._needsActionLogRefresh = true;
|
||||
}
|
||||
};
|
||||
|
||||
Game_System.prototype.deleteLog = function () {
|
||||
if (this._actionLog.length > 0) {
|
||||
this._actionLog.shift();
|
||||
this._needsActionLogRefresh = true;
|
||||
}
|
||||
};
|
||||
Game_System.prototype.actionLog = function () {
|
||||
return this._actionLog;
|
||||
};
|
||||
|
||||
Game_System.prototype.actionLog = function () {
|
||||
return this._actionLog;
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Message
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Message
|
||||
//
|
||||
var _Game_Message_add = Game_Message.prototype.add;
|
||||
Game_Message.prototype.add = function (text) {
|
||||
_Game_Message_add.call(this, text);
|
||||
if ($gameSystem.isMirrorLogWindow()) {
|
||||
$gameSystem.addLog(text);
|
||||
}
|
||||
};
|
||||
|
||||
var _Game_Message_add = Game_Message.prototype.add;
|
||||
Game_Message.prototype.add = function (text) {
|
||||
_Game_Message_add.call(this, text);
|
||||
if ($gameSystem.isMirrorLogWindow()) {
|
||||
$gameSystem.addLog(text);
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Actor
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Actor
|
||||
//
|
||||
// レベルアップの表示
|
||||
var _Game_Actor_displayLevelUp = Game_Actor.prototype.displayLevelUp;
|
||||
Game_Actor.prototype.displayLevelUp = function (newSkills) {
|
||||
_Game_Actor_displayLevelUp.call(this, newSkills);
|
||||
if ($gameSystem.isAutoLogWindow() && !$gameParty.inBattle()) {
|
||||
var text = TextManager.levelUp.format(
|
||||
this._name,
|
||||
TextManager.level,
|
||||
this._level
|
||||
);
|
||||
$gameSystem.addLog(text);
|
||||
}
|
||||
};
|
||||
|
||||
// レベルアップの表示
|
||||
var _Game_Actor_displayLevelUp = Game_Actor.prototype.displayLevelUp;
|
||||
Game_Actor.prototype.displayLevelUp = function (newSkills) {
|
||||
_Game_Actor_displayLevelUp.call(this, newSkills);
|
||||
if ($gameSystem.isAutoLogWindow() && !$gameParty.inBattle()) {
|
||||
var text = TextManager.levelUp.format(this._name, TextManager.level, this._level);
|
||||
$gameSystem.addLog(text);
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Event
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Event
|
||||
//
|
||||
var _Game_Event_gainRewards = Game_Event.prototype.gainRewards;
|
||||
Game_Event.prototype.gainRewards = function () {
|
||||
if ($gameSystem.isAutoLogWindow()) {
|
||||
var battler = this.battler();
|
||||
var exp = battler.exp();
|
||||
var gold = battler.gold();
|
||||
var text = battler.name() + $dataStates[battler.deathStateId()].message2;
|
||||
var rewardText = "";
|
||||
if (exp > 0) {
|
||||
rewardText += "" + exp + "\\C[16]" + TextManager.expA + "\\C[0]";
|
||||
}
|
||||
if (gold > 0) {
|
||||
if (exp > 0) {
|
||||
rewardText += " / ";
|
||||
}
|
||||
rewardText +=
|
||||
"" + gold + "\\C[16]" + TextManager.currencyUnit + "\\C[0]";
|
||||
}
|
||||
if (rewardText) {
|
||||
text += " ( " + rewardText + " )";
|
||||
}
|
||||
$gameSystem.addLog(text);
|
||||
}
|
||||
_Game_Event_gainRewards.call(this);
|
||||
};
|
||||
|
||||
var _Game_Event_gainRewards = Game_Event.prototype.gainRewards;
|
||||
Game_Event.prototype.gainRewards = function () {
|
||||
if ($gameSystem.isAutoLogWindow()) {
|
||||
var battler = this.battler();
|
||||
var exp = battler.exp();
|
||||
var gold = battler.gold();
|
||||
var text = battler.name() + $dataStates[battler.deathStateId()].message2;
|
||||
var rewardText = '';
|
||||
if (exp > 0) {
|
||||
rewardText += '' + exp + '\\C[16]' + TextManager.expA + '\\C[0]';
|
||||
}
|
||||
if (gold > 0) {
|
||||
if (exp > 0) {
|
||||
rewardText += ' / ';
|
||||
}
|
||||
rewardText += '' + gold + '\\C[16]' + TextManager.currencyUnit + '\\C[0]';
|
||||
}
|
||||
if (rewardText) {
|
||||
text += ' ( ' + rewardText + ' )';
|
||||
}
|
||||
$gameSystem.addLog(text)
|
||||
}
|
||||
_Game_Event_gainRewards.call(this);
|
||||
};
|
||||
var _Game_Event_gainRewardItem = Game_Event.prototype.gainRewardItem;
|
||||
Game_Event.prototype.gainRewardItem = function (item, y) {
|
||||
_Game_Event_gainRewardItem.call(this, item, y);
|
||||
if ($gameSystem.isAutoLogWindow()) {
|
||||
var text = TextManager.obtainItem.format(item.name);
|
||||
$gameSystem.addLog(text);
|
||||
}
|
||||
};
|
||||
|
||||
var _Game_Event_gainRewardItem = Game_Event.prototype.gainRewardItem;
|
||||
Game_Event.prototype.gainRewardItem = function (item, y) {
|
||||
_Game_Event_gainRewardItem.call(this, item, y);
|
||||
if ($gameSystem.isAutoLogWindow()) {
|
||||
var text = TextManager.obtainItem.format(item.name);
|
||||
$gameSystem.addLog(text);
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Interpreter
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_Interpreter
|
||||
//
|
||||
// プラグインコマンド
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === "showLogWindow") {
|
||||
$gameSystem.setVisibleLogWindow(true);
|
||||
} else if (command === "hideLogWindow") {
|
||||
$gameSystem.setVisibleLogWindow(false);
|
||||
} else if (command === "addLog") {
|
||||
$gameSystem.addLog(args[0]);
|
||||
} else if (command === "deleteLog") {
|
||||
$gameSystem.deleteLog();
|
||||
} else if (command === "startMirrorLogWindow") {
|
||||
$gameSystem.setMirrorMode(true);
|
||||
} else if (command === "stopMirrorLogWindow") {
|
||||
$gameSystem.setMirrorMode(false);
|
||||
} else if (command === "startAutoLogWindow") {
|
||||
$gameSystem.setAutoMode(true);
|
||||
} else if (command === "stopAutoLogWindow") {
|
||||
$gameSystem.setAutoMode(false);
|
||||
} else if (command === "openLogScene") {
|
||||
SceneManager.push(Scene_Log);
|
||||
}
|
||||
};
|
||||
|
||||
// プラグインコマンド
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'showLogWindow') {
|
||||
$gameSystem.setVisibleLogWindow(true);
|
||||
} else if (command === 'hideLogWindow') {
|
||||
$gameSystem.setVisibleLogWindow(false);
|
||||
} else if (command === 'addLog') {
|
||||
$gameSystem.addLog(args[0]);
|
||||
} else if (command === 'deleteLog') {
|
||||
$gameSystem.deleteLog();
|
||||
} else if (command === 'startMirrorLogWindow') {
|
||||
$gameSystem.setMirrorMode(true);
|
||||
} else if (command === 'stopMirrorLogWindow') {
|
||||
$gameSystem.setMirrorMode(false);
|
||||
} else if (command === 'startAutoLogWindow') {
|
||||
$gameSystem.setAutoMode(true);
|
||||
} else if (command === 'stopAutoLogWindow') {
|
||||
$gameSystem.setAutoMode(false);
|
||||
} else if (command === 'openLogScene') {
|
||||
SceneManager.push(Scene_Log);
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_MapLog
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_MapLog
|
||||
//
|
||||
function Window_MapLog() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
function Window_MapLog() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
Window_MapLog.prototype = Object.create(Window_Base.prototype);
|
||||
Window_MapLog.prototype.constructor = Window_MapLog;
|
||||
|
||||
Window_MapLog.prototype = Object.create(Window_Base.prototype);
|
||||
Window_MapLog.prototype.constructor = Window_MapLog;
|
||||
Window_MapLog.prototype.initialize = function () {
|
||||
var x = logWindowX;
|
||||
var y = logWindowY;
|
||||
var wight = this.windowWidth();
|
||||
var height = this.windowHeight();
|
||||
Window_Base.prototype.initialize.call(this, x, y, wight, height);
|
||||
this.openness = $gameSystem.isVisibleLogWindow() ? 255 : 0;
|
||||
this.opacity = 255;
|
||||
this.contentsOpacity = 255;
|
||||
this._hideCount = 0;
|
||||
this._autoDeleteCount = 0;
|
||||
this.refresh();
|
||||
};
|
||||
|
||||
Window_MapLog.prototype.initialize = function () {
|
||||
var x = logWindowX;
|
||||
var y = logWindowY;
|
||||
var wight = this.windowWidth();
|
||||
var height = this.windowHeight();
|
||||
Window_Base.prototype.initialize.call(this, x, y, wight, height);
|
||||
this.openness = $gameSystem.isVisibleLogWindow() ? 255 : 0;
|
||||
this.opacity = 255;
|
||||
this.contentsOpacity = 255;
|
||||
this._hideCount = 0;
|
||||
this._autoDeleteCount = 0;
|
||||
this.refresh();
|
||||
};
|
||||
Window_MapLog.prototype.standardFontSize = function () {
|
||||
return logWindowFontSize;
|
||||
};
|
||||
|
||||
Window_MapLog.prototype.standardFontSize = function () {
|
||||
return logWindowFontSize;
|
||||
};
|
||||
// ウィンドウの幅を取得
|
||||
Window_MapLog.prototype.windowWidth = function () {
|
||||
return logWindowWidth;
|
||||
};
|
||||
|
||||
// ウィンドウの幅を取得
|
||||
Window_MapLog.prototype.windowWidth = function () {
|
||||
return logWindowWidth;
|
||||
};
|
||||
// ウィンドウの高さを取得
|
||||
Window_MapLog.prototype.windowHeight = function () {
|
||||
return this.fittingHeight(logWindowLines);
|
||||
};
|
||||
|
||||
// ウィンドウの高さを取得
|
||||
Window_MapLog.prototype.windowHeight = function () {
|
||||
return this.fittingHeight(logWindowLines);
|
||||
};
|
||||
// 標準パディングを取得
|
||||
Window_MapLog.prototype.standardPadding = function () {
|
||||
return logWindowPadding;
|
||||
};
|
||||
|
||||
// 標準パディングを取得
|
||||
Window_MapLog.prototype.standardPadding = function () {
|
||||
return logWindowPadding;
|
||||
};
|
||||
// ウィンドウの1行の高さを取得
|
||||
Window_MapLog.prototype.lineHeight = function () {
|
||||
return logWindowLineHeight;
|
||||
};
|
||||
|
||||
// ウィンドウの1行の高さを取得
|
||||
Window_MapLog.prototype.lineHeight = function () {
|
||||
return logWindowLineHeight;
|
||||
};
|
||||
// フレーム更新
|
||||
Window_MapLog.prototype.update = function () {
|
||||
Window_Base.prototype.update.call(this);
|
||||
if (logWindowAutoDelete > 0) {
|
||||
var maxCount = $gameVariables.value(logWindowAutoDelete);
|
||||
if (maxCount > 0) {
|
||||
var actionLog = $gameSystem.actionLog();
|
||||
if (actionLog.length > 0) {
|
||||
this._autoDeleteCount++;
|
||||
}
|
||||
if (this._autoDeleteCount >= maxCount) {
|
||||
$gameSystem.deleteLog();
|
||||
this._autoDeleteCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.updateVisibility()) {
|
||||
this.open();
|
||||
if ($gameSystem._needsActionLogRefresh) {
|
||||
this.refresh();
|
||||
$gameSystem._needsActionLogRefresh = false;
|
||||
}
|
||||
this.updateOpacity();
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
|
||||
// フレーム更新
|
||||
Window_MapLog.prototype.update = function () {
|
||||
Window_Base.prototype.update.call(this);
|
||||
if (logWindowAutoDelete > 0) {
|
||||
var maxCount = $gameVariables.value(logWindowAutoDelete);
|
||||
if (maxCount > 0) {
|
||||
var actionLog = $gameSystem.actionLog();
|
||||
if (actionLog.length > 0) {
|
||||
this._autoDeleteCount++;
|
||||
}
|
||||
if (this._autoDeleteCount >= maxCount) {
|
||||
$gameSystem.deleteLog();
|
||||
this._autoDeleteCount = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.updateVisibility()) {
|
||||
this.open();
|
||||
if ($gameSystem._needsActionLogRefresh) {
|
||||
this.refresh();
|
||||
$gameSystem._needsActionLogRefresh = false;
|
||||
}
|
||||
this.updateOpacity();
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
};
|
||||
// ウィンドウ表示状態の更新
|
||||
Window_MapLog.prototype.updateVisibility = function () {
|
||||
if (!$gameSystem.isVisibleLogWindow()) {
|
||||
return false;
|
||||
}
|
||||
if (
|
||||
(logWindowEventBusyHide && $gameMap.isEventRunning()) ||
|
||||
(logWindowMessageBusyHide && $gameMessage.isBusy())
|
||||
) {
|
||||
this._hideCount++;
|
||||
} else {
|
||||
this._hideCount = 0;
|
||||
}
|
||||
return this._hideCount < 10;
|
||||
};
|
||||
|
||||
// ウィンドウ表示状態の更新
|
||||
Window_MapLog.prototype.updateVisibility = function () {
|
||||
if (!$gameSystem.isVisibleLogWindow()) {
|
||||
return false;
|
||||
}
|
||||
if ((logWindowEventBusyHide && $gameMap.isEventRunning()) ||
|
||||
(logWindowMessageBusyHide && $gameMessage.isBusy())) {
|
||||
this._hideCount++;
|
||||
} else {
|
||||
this._hideCount = 0;
|
||||
}
|
||||
return this._hideCount < 10;
|
||||
};
|
||||
// 不透明度の更新
|
||||
Window_MapLog.prototype.updateOpacity = function () {
|
||||
if (
|
||||
this.x < $gamePlayer.screenX() + 24 &&
|
||||
this.x + this.windowWidth() > $gamePlayer.screenX() - 24 &&
|
||||
this.y < $gamePlayer.screenY() &&
|
||||
this.y + this.windowHeight() > $gamePlayer.screenY() - 48
|
||||
) {
|
||||
this.opacity = Math.min(logWindowCollideOpacity, logWindowOpacity);
|
||||
this.contentsOpacity = logWindowCollideOpacity;
|
||||
} else {
|
||||
this.opacity = logWindowOpacity;
|
||||
this.contentsOpacity = 255;
|
||||
}
|
||||
};
|
||||
|
||||
// 不透明度の更新
|
||||
Window_MapLog.prototype.updateOpacity = function () {
|
||||
if (this.x < $gamePlayer.screenX() + 24 &&
|
||||
this.x + this.windowWidth() > $gamePlayer.screenX() - 24 &&
|
||||
this.y < $gamePlayer.screenY() &&
|
||||
this.y + this.windowHeight() > $gamePlayer.screenY() - 48) {
|
||||
this.opacity = Math.min(logWindowCollideOpacity, logWindowOpacity);
|
||||
this.contentsOpacity = logWindowCollideOpacity;
|
||||
} else {
|
||||
this.opacity = logWindowOpacity;
|
||||
this.contentsOpacity = 255;
|
||||
}
|
||||
};
|
||||
// リフレッシュ
|
||||
Window_MapLog.prototype.refresh = function () {
|
||||
this.contents.clear();
|
||||
var actionLog = $gameSystem.actionLog();
|
||||
var lh = this.lineHeight();
|
||||
var n = Math.min(logWindowLines, actionLog.length);
|
||||
for (var i = 0; i < n; i++) {
|
||||
this.drawTextEx(actionLog[actionLog.length - n + i], 0, lh * i);
|
||||
}
|
||||
};
|
||||
|
||||
// リフレッシュ
|
||||
Window_MapLog.prototype.refresh = function () {
|
||||
this.contents.clear();
|
||||
var actionLog = $gameSystem.actionLog();
|
||||
var lh = this.lineHeight();
|
||||
var n = Math.min(logWindowLines, actionLog.length);
|
||||
for (var i = 0; i < n; i++) {
|
||||
this.drawTextEx(actionLog[actionLog.length - n + i], 0, lh * i);
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_MenuLog
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_MenuLog
|
||||
//
|
||||
function Window_MenuLog() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
function Window_MenuLog() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
Window_MenuLog.prototype = Object.create(Window_Selectable.prototype);
|
||||
Window_MenuLog.prototype.constructor = Window_MenuLog;
|
||||
|
||||
Window_MenuLog.prototype = Object.create(Window_Selectable.prototype);
|
||||
Window_MenuLog.prototype.constructor = Window_MenuLog;
|
||||
Window_MenuLog.prototype.initialize = function () {
|
||||
Window_Selectable.prototype.initialize.call(
|
||||
this,
|
||||
0,
|
||||
0,
|
||||
Graphics.boxWidth,
|
||||
Graphics.boxHeight
|
||||
);
|
||||
this._data = $gameSystem.actionLog();
|
||||
this.refresh();
|
||||
this.select(Math.max(this._data.length - 1, 0));
|
||||
this.activate();
|
||||
};
|
||||
|
||||
Window_MenuLog.prototype.initialize = function () {
|
||||
Window_Selectable.prototype.initialize.call(this, 0, 0, Graphics.boxWidth, Graphics.boxHeight);
|
||||
this._data = $gameSystem.actionLog();
|
||||
this.refresh();
|
||||
this.select(Math.max(this._data.length - 1, 0));
|
||||
this.activate();
|
||||
};
|
||||
Window_MenuLog.prototype.standardFontSize = function () {
|
||||
return logWindowFontSize;
|
||||
};
|
||||
|
||||
Window_MenuLog.prototype.standardFontSize = function () {
|
||||
return logWindowFontSize;
|
||||
};
|
||||
Window_MenuLog.prototype.standardPadding = function () {
|
||||
return logWindowPadding;
|
||||
};
|
||||
|
||||
Window_MenuLog.prototype.standardPadding = function () {
|
||||
return logWindowPadding;
|
||||
};
|
||||
Window_MenuLog.prototype.lineHeight = function () {
|
||||
return logWindowLineHeight;
|
||||
};
|
||||
|
||||
Window_MenuLog.prototype.lineHeight = function () {
|
||||
return logWindowLineHeight;
|
||||
};
|
||||
Window_MenuLog.prototype.maxItems = function () {
|
||||
return this._data ? this._data.length : 1;
|
||||
};
|
||||
|
||||
Window_MenuLog.prototype.maxItems = function () {
|
||||
return this._data ? this._data.length : 1;
|
||||
};
|
||||
Window_MenuLog.prototype.item = function () {
|
||||
var index = this.index();
|
||||
return this._data && index >= 0 ? this._data[index] : null;
|
||||
};
|
||||
|
||||
Window_MenuLog.prototype.item = function () {
|
||||
var index = this.index();
|
||||
return this._data && index >= 0 ? this._data[index] : null;
|
||||
};
|
||||
Window_MenuLog.prototype.drawItem = function (index) {
|
||||
var item = this._data[index];
|
||||
if (item) {
|
||||
var rect = this.itemRectForText(index);
|
||||
this.drawTextEx(item, 0, rect.y);
|
||||
}
|
||||
};
|
||||
|
||||
Window_MenuLog.prototype.drawItem = function (index) {
|
||||
var item = this._data[index];
|
||||
if (item) {
|
||||
var rect = this.itemRectForText(index);
|
||||
this.drawTextEx(item, 0, rect.y);
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Map
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Map
|
||||
//
|
||||
var _Scene_Map_createDisplayObjects =
|
||||
Scene_Map.prototype.createDisplayObjects;
|
||||
Scene_Map.prototype.createDisplayObjects = function () {
|
||||
_Scene_Map_createDisplayObjects.call(this);
|
||||
this.createMapLogWindow();
|
||||
};
|
||||
|
||||
var _Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
|
||||
Scene_Map.prototype.createDisplayObjects = function () {
|
||||
_Scene_Map_createDisplayObjects.call(this);
|
||||
this.createMapLogWindow();
|
||||
};
|
||||
// ログウィンドウの作成
|
||||
Scene_Map.prototype.createMapLogWindow = function () {
|
||||
this._mapLogWindow = new Window_MapLog();
|
||||
this.addChild(this._mapLogWindow);
|
||||
};
|
||||
|
||||
// ログウィンドウの作成
|
||||
Scene_Map.prototype.createMapLogWindow = function () {
|
||||
this._mapLogWindow = new Window_MapLog();
|
||||
this.addChild(this._mapLogWindow);
|
||||
};
|
||||
var _Scene_Map_terminate = Scene_Map.prototype.terminate;
|
||||
Scene_Map.prototype.terminate = function () {
|
||||
if (!SceneManager.isNextScene(Scene_Battle)) {
|
||||
this._mapLogWindow.hide();
|
||||
}
|
||||
_Scene_Map_terminate.call(this);
|
||||
};
|
||||
|
||||
var _Scene_Map_terminate = Scene_Map.prototype.terminate;
|
||||
Scene_Map.prototype.terminate = function () {
|
||||
if (!SceneManager.isNextScene(Scene_Battle)) {
|
||||
this._mapLogWindow.hide();
|
||||
}
|
||||
_Scene_Map_terminate.call(this);
|
||||
};
|
||||
var _Scene_Map_launchBattle = Scene_Map.prototype.launchBattle;
|
||||
Scene_Map.prototype.launchBattle = function () {
|
||||
this._mapLogWindow.hide();
|
||||
this.removeChild(this._mapLogWindow);
|
||||
this._mapLogWindow = null;
|
||||
_Scene_Map_launchBattle.call(this);
|
||||
};
|
||||
|
||||
var _Scene_Map_launchBattle = Scene_Map.prototype.launchBattle;
|
||||
Scene_Map.prototype.launchBattle = function () {
|
||||
this._mapLogWindow.hide();
|
||||
this.removeChild(this._mapLogWindow);
|
||||
this._mapLogWindow = null;
|
||||
_Scene_Map_launchBattle.call(this);
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Log
|
||||
//
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Log
|
||||
//
|
||||
function Scene_Log() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
function Scene_Log() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
Scene_Log.prototype = Object.create(Scene_MenuBase.prototype);
|
||||
Scene_Log.prototype.constructor = Scene_Log;
|
||||
|
||||
Scene_Log.prototype = Object.create(Scene_MenuBase.prototype);
|
||||
Scene_Log.prototype.constructor = Scene_Log;
|
||||
Scene_Log.prototype.initialize = function () {
|
||||
Scene_MenuBase.prototype.initialize.call(this);
|
||||
};
|
||||
|
||||
Scene_Log.prototype.initialize = function () {
|
||||
Scene_MenuBase.prototype.initialize.call(this);
|
||||
};
|
||||
|
||||
Scene_Log.prototype.create = function () {
|
||||
Scene_MenuBase.prototype.create.call(this);
|
||||
this.createCreditsWindow();
|
||||
};
|
||||
|
||||
Scene_Log.prototype.createCreditsWindow = function () {
|
||||
this._logWindow = new Window_MenuLog();
|
||||
this._logWindow.setHandler('ok', this.popScene.bind(this));
|
||||
this._logWindow.setHandler('cancel', this.popScene.bind(this));
|
||||
this.addWindow(this._logWindow);
|
||||
};
|
||||
Scene_Log.prototype.create = function () {
|
||||
Scene_MenuBase.prototype.create.call(this);
|
||||
this.createCreditsWindow();
|
||||
};
|
||||
|
||||
Scene_Log.prototype.createCreditsWindow = function () {
|
||||
this._logWindow = new Window_MenuLog();
|
||||
this._logWindow.setHandler("ok", this.popScene.bind(this));
|
||||
this._logWindow.setHandler("cancel", this.popScene.bind(this));
|
||||
this.addWindow(this._logWindow);
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
* @desc HPゲージウィンドウの高さ
|
||||
* 初期値: 64
|
||||
* @default 64
|
||||
*
|
||||
*
|
||||
* @param gaugeA
|
||||
* @type struct<Gauge>
|
||||
* @desc ゲージAのパラメータ
|
||||
|
|
@ -114,7 +114,7 @@
|
|||
* @desc 所持金表示のY座標
|
||||
* 初期値: 12
|
||||
* @default 12
|
||||
*
|
||||
*
|
||||
* @param vnMax
|
||||
* @type boolean
|
||||
* @desc ゲージタイプ VN の最大値を表示するかどうか
|
||||
|
|
@ -180,7 +180,7 @@
|
|||
*
|
||||
* @help
|
||||
* TMPlugin - マップHPゲージ ver1.4.1
|
||||
*
|
||||
*
|
||||
* 使い方:
|
||||
*
|
||||
* プラグインパラメータをいじってお好みのHPゲージを表示してください。
|
||||
|
|
@ -190,7 +190,7 @@
|
|||
* このプラグインはMITライセンスのもとに配布しています、商用利用、
|
||||
* 改造、再配布など、自由にお使いいただけます。
|
||||
*
|
||||
*
|
||||
*
|
||||
* プラグインコマンド:
|
||||
*
|
||||
* showHpGauge
|
||||
|
|
@ -201,15 +201,15 @@
|
|||
* showHpGauge A
|
||||
* ゲージAを表示します。プラグインパラメータでタイプが設定されている場合、
|
||||
* ゲーム開始時に自動的に表示状態になります。
|
||||
*
|
||||
*
|
||||
* hideHpGauge
|
||||
* HPゲージウィンドウを隠します。showHpGauge コマンドが実行されるまで
|
||||
* 表示されないままです。
|
||||
*
|
||||
*
|
||||
* hideHpGauge B
|
||||
* ゲージBを隠します。showHpGauge B コマンドが実行されるまで
|
||||
* 表示されないままです。
|
||||
*
|
||||
*
|
||||
* moveHpGaugeWindow 100 200
|
||||
* HPゲージウィンドウの位置を X座標 = 100 / Y座標 = 200 の位置へ
|
||||
* 移動します。
|
||||
|
|
@ -218,7 +218,7 @@
|
|||
* プラグインパラメータ補足:
|
||||
*
|
||||
* gaugeA ~ gaugeD
|
||||
*
|
||||
*
|
||||
* param
|
||||
* ゲージのタイプが VN の場合に、ゲージの現在値として扱う
|
||||
* ゲーム変数番号を設定してください。
|
||||
|
|
@ -230,7 +230,7 @@
|
|||
* 初めて最大値として機能します。
|
||||
* この設定はゲージの長さにのみ影響します、変数の値が最大値を
|
||||
* 超えなくなるような機能はありません。
|
||||
*
|
||||
*
|
||||
* windowOpacity / collideOpacity
|
||||
* windowOpacity はウィンドウフレーム及び背景に影響し、collideOpacity
|
||||
* はゲージや顔グラフィックにも影響します。
|
||||
|
|
@ -238,10 +238,10 @@
|
|||
* 重なった際の不透明度として windowOpacity の値が適用されます。
|
||||
* ただし、ゲージと顔グラフィックに関しては通常どおり collideOpacity の
|
||||
* 値が適用されます。
|
||||
*
|
||||
*
|
||||
* faceOffsetX
|
||||
* この値を -1000 に設定すると顔グラフィックが非表示となります。
|
||||
*
|
||||
*
|
||||
* vnMax
|
||||
* 値が true なら最大値も表示しますが、現在値と最大値を表示するための
|
||||
* スペースが足りない(ゲージの長さが短い)場合は vnMax の設定に関わらず
|
||||
|
|
@ -252,7 +252,7 @@
|
|||
* @param type
|
||||
* @type select
|
||||
* @option なし
|
||||
* @value
|
||||
* @value
|
||||
* @option HP
|
||||
* @option MP
|
||||
* @option TP
|
||||
|
|
@ -323,15 +323,14 @@ var Imported = Imported || {};
|
|||
Imported.TMMapHpGauge = true;
|
||||
|
||||
(function () {
|
||||
|
||||
var parameters = PluginManager.parameters('TMMapHpGauge');
|
||||
var gaugeWindowX = +(parameters['gaugeWindowX'] || 0);
|
||||
var gaugeWindowY = +(parameters['gaugeWindowY'] || 0);
|
||||
var gaugeWindowWidth = +(parameters['gaugeWindowWidth'] || 288);
|
||||
var gaugeWindowHeight = +(parameters['gaugeWindowHeight'] || 64);
|
||||
var parameters = PluginManager.parameters("TMMapHpGauge");
|
||||
var gaugeWindowX = +(parameters["gaugeWindowX"] || 0);
|
||||
var gaugeWindowY = +(parameters["gaugeWindowY"] || 0);
|
||||
var gaugeWindowWidth = +(parameters["gaugeWindowWidth"] || 288);
|
||||
var gaugeWindowHeight = +(parameters["gaugeWindowHeight"] || 64);
|
||||
var gauges = [];
|
||||
['A', 'B', 'C', 'D'].forEach(function (code, i) {
|
||||
gauges[i] = JSON.parse(parameters['gauge' + code]);
|
||||
["A", "B", "C", "D"].forEach(function (code, i) {
|
||||
gauges[i] = JSON.parse(parameters["gauge" + code]);
|
||||
gauges[i].x = +gauges[i].x;
|
||||
gauges[i].y = +gauges[i].y;
|
||||
gauges[i].width = +gauges[i].width;
|
||||
|
|
@ -339,26 +338,26 @@ Imported.TMMapHpGauge = true;
|
|||
gauges[i].fontSize = +gauges[i].fontSize;
|
||||
gauges[i].param = +gauges[i].param;
|
||||
gauges[i].max = +gauges[i].max;
|
||||
gauges[i].color = gauges[i].color.split(' ');
|
||||
gauges[i].color = gauges[i].color.split(" ");
|
||||
});
|
||||
var faceOffsetX = +(parameters['faceOffsetX'] || -4);
|
||||
var faceOffsetY = +(parameters['faceOffsetY'] || -4);
|
||||
var stateIconMax = +(parameters['stateIconMax'] || 4);
|
||||
var stateIconX = +(parameters['stateIconX'] || 156);
|
||||
var stateIconY = +(parameters['stateIconY'] || 24);
|
||||
var goldWidth = +(parameters['goldWidth'] || 0);
|
||||
var goldX = +(parameters['goldX'] || 0);
|
||||
var goldY = +(parameters['goldY'] || 0);
|
||||
var vnMax = JSON.parse(parameters['vnMax'] || 'false');
|
||||
var shakeTime = +(parameters['shakeTime'] || 20);
|
||||
var collideOpacity = +(parameters['collideOpacity'] || 128);
|
||||
var startVisible = JSON.parse(parameters['startVisible'] || 'true');
|
||||
var windowOpacity = +(parameters['windowOpacity'] || 255);
|
||||
var messageBusyHide = JSON.parse(parameters['messageBusyHide'] || 'true');
|
||||
var eventBusyHide = JSON.parse(parameters['eventBusyHide'] || 'true');
|
||||
var useBattleScene = JSON.parse(parameters['useBattleScene'] || 'false');
|
||||
var gaugeWindowBattleX = +(parameters['gaugeWindowBattleX'] || 0);
|
||||
var gaugeWindowBattleY = +(parameters['gaugeWindowBattleY'] || 0);
|
||||
var faceOffsetX = +(parameters["faceOffsetX"] || -4);
|
||||
var faceOffsetY = +(parameters["faceOffsetY"] || -4);
|
||||
var stateIconMax = +(parameters["stateIconMax"] || 4);
|
||||
var stateIconX = +(parameters["stateIconX"] || 156);
|
||||
var stateIconY = +(parameters["stateIconY"] || 24);
|
||||
var goldWidth = +(parameters["goldWidth"] || 0);
|
||||
var goldX = +(parameters["goldX"] || 0);
|
||||
var goldY = +(parameters["goldY"] || 0);
|
||||
var vnMax = JSON.parse(parameters["vnMax"] || "false");
|
||||
var shakeTime = +(parameters["shakeTime"] || 20);
|
||||
var collideOpacity = +(parameters["collideOpacity"] || 128);
|
||||
var startVisible = JSON.parse(parameters["startVisible"] || "true");
|
||||
var windowOpacity = +(parameters["windowOpacity"] || 255);
|
||||
var messageBusyHide = JSON.parse(parameters["messageBusyHide"] || "true");
|
||||
var eventBusyHide = JSON.parse(parameters["eventBusyHide"] || "true");
|
||||
var useBattleScene = JSON.parse(parameters["useBattleScene"] || "false");
|
||||
var gaugeWindowBattleX = +(parameters["gaugeWindowBattleX"] || 0);
|
||||
var gaugeWindowBattleY = +(parameters["gaugeWindowBattleY"] || 0);
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_System
|
||||
|
|
@ -377,7 +376,7 @@ Imported.TMMapHpGauge = true;
|
|||
if (this._visibleMapHpGauges == null) {
|
||||
this._visibleMapHpGauges = [];
|
||||
for (var i = 0; i < gauges.length; i++) {
|
||||
this._visibleMapHpGauges[i] = gauges[i].type !== '';
|
||||
this._visibleMapHpGauges[i] = gauges[i].type !== "";
|
||||
}
|
||||
}
|
||||
return this._visibleMapHpGauges[gaugeId];
|
||||
|
|
@ -391,24 +390,25 @@ Imported.TMMapHpGauge = true;
|
|||
// Game_Interpreter
|
||||
//
|
||||
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'showHpGauge') {
|
||||
if (command === "showHpGauge") {
|
||||
if (args[0]) {
|
||||
var gaugeId = ['A', 'B', 'C', 'D'].indexOf(args[0]);
|
||||
var gaugeId = ["A", "B", "C", "D"].indexOf(args[0]);
|
||||
$gameSystem.setVisibleMapHpGauges(gaugeId, true);
|
||||
} else {
|
||||
$gameSystem.setVisibleMapHpGauge(true);
|
||||
}
|
||||
} else if (command === 'hideHpGauge') {
|
||||
} else if (command === "hideHpGauge") {
|
||||
if (args[0]) {
|
||||
var gaugeId = ['A', 'B', 'C', 'D'].indexOf(args[0]);
|
||||
var gaugeId = ["A", "B", "C", "D"].indexOf(args[0]);
|
||||
$gameSystem.setVisibleMapHpGauges(gaugeId, false);
|
||||
} else {
|
||||
$gameSystem.setVisibleMapHpGauge(false);
|
||||
}
|
||||
} else if (command === 'moveHpGaugeWindow') {
|
||||
} else if (command === "moveHpGaugeWindow") {
|
||||
$gameSystem._mapHpGaugeWindowX = +args[0];
|
||||
$gameSystem._mapHpGaugeWindowY = +args[1];
|
||||
if (SceneManager._scene._mapHpGaugeWindow) {
|
||||
|
|
@ -435,8 +435,14 @@ Imported.TMMapHpGauge = true;
|
|||
var x = gaugeWindowBattleX;
|
||||
var y = gaugeWindowBattleY;
|
||||
} else {
|
||||
var x = $gameSystem._mapHpGaugeWindowX != null ? $gameSystem._mapHpGaugeWindowX : gaugeWindowX;
|
||||
var y = $gameSystem._mapHpGaugeWindowY != null ? $gameSystem._mapHpGaugeWindowY : gaugeWindowY;
|
||||
var x =
|
||||
$gameSystem._mapHpGaugeWindowX != null
|
||||
? $gameSystem._mapHpGaugeWindowX
|
||||
: gaugeWindowX;
|
||||
var y =
|
||||
$gameSystem._mapHpGaugeWindowY != null
|
||||
? $gameSystem._mapHpGaugeWindowY
|
||||
: gaugeWindowY;
|
||||
}
|
||||
var wight = gaugeWindowWidth;
|
||||
var height = gaugeWindowHeight;
|
||||
|
|
@ -470,31 +476,31 @@ Imported.TMMapHpGauge = true;
|
|||
Window_Base.prototype.update.call(this);
|
||||
if (this.updateVisibility()) {
|
||||
this.open();
|
||||
var needRefresh = this.isNeedRefresh()
|
||||
var needRefresh = this.isNeedRefresh();
|
||||
if (this._needFaceRefresh) {
|
||||
this.refreshFace();
|
||||
if (!this._needFaceRefresh) needRefresh = true;
|
||||
}
|
||||
if (needRefresh) {
|
||||
var actor = $gameParty.leader();
|
||||
if (needRefresh === 'SHAKE') this._shakeDuration = shakeTime;
|
||||
if (needRefresh === "SHAKE") this._shakeDuration = shakeTime;
|
||||
for (var i = 0; i < gauges.length; i++) {
|
||||
this._gaugeVisible[i] = $gameSystem.isVisibleMapHpGauges(i);
|
||||
var gauge = gauges[i];
|
||||
if (gauge.type === 'HP') {
|
||||
if (gauge.type === "HP") {
|
||||
this._gaugeParams[i].param = actor.hp;
|
||||
this._gaugeParams[i].max = actor.mhp;
|
||||
} else if (gauge.type === 'MP') {
|
||||
} else if (gauge.type === "MP") {
|
||||
this._gaugeParams[i].param = actor.mp;
|
||||
this._gaugeParams[i].max = actor.mmp;
|
||||
} else if (gauge.type === 'TP') {
|
||||
} else if (gauge.type === "TP") {
|
||||
this._gaugeParams[i].param = actor.tp;
|
||||
this._gaugeParams[i].max = actor.maxTp();
|
||||
} else if (gauge.type === 'LV') {
|
||||
} else if (gauge.type === "LV") {
|
||||
this._gaugeParams[i].param = actor.currentExp();
|
||||
this._gaugeParams[i].max = actor.nextLevelExp();
|
||||
this._gaugeParams[i].subParam = actor.level;
|
||||
} else if (gauge.type === 'VN') {
|
||||
} else if (gauge.type === "VN") {
|
||||
this._gaugeParams[i].param = $gameVariables.value(gauge.param);
|
||||
this._gaugeParams[i].max = $gameVariables.value(gauge.max);
|
||||
}
|
||||
|
|
@ -514,8 +520,10 @@ Imported.TMMapHpGauge = true;
|
|||
Window_MapHpGauge.prototype.updateVisibility = function () {
|
||||
if (!$gameSystem.isVisibleMapHpGauge()) return false;
|
||||
if ($gameParty.inBattle()) return true;
|
||||
if ((eventBusyHide && $gameMap.isEventRunning()) ||
|
||||
(messageBusyHide && $gameMessage.isBusy())) {
|
||||
if (
|
||||
(eventBusyHide && $gameMap.isEventRunning()) ||
|
||||
(messageBusyHide && $gameMessage.isBusy())
|
||||
) {
|
||||
this._hideCount++;
|
||||
} else {
|
||||
this._hideCount = 0;
|
||||
|
|
@ -528,23 +536,33 @@ Imported.TMMapHpGauge = true;
|
|||
if (actor) {
|
||||
if (this._actorId !== actor.actorId()) return true;
|
||||
for (var i = 0; i < gauges.length; i++) {
|
||||
if (this._gaugeVisible[i] !== $gameSystem.isVisibleMapHpGauges(i)) return true;
|
||||
if (this._gaugeVisible[i] !== $gameSystem.isVisibleMapHpGauges(i))
|
||||
return true;
|
||||
var gauge = gauges[i];
|
||||
var gaugeParam = this._gaugeParams[i];
|
||||
if (gauge.type === 'HP') {
|
||||
if (gauge.type === "HP") {
|
||||
if (gaugeParam.param !== actor.hp || gaugeParam.max !== actor.mhp) {
|
||||
return gaugeParam.param > actor.hp ? 'SHAKE' : true;
|
||||
return gaugeParam.param > actor.hp ? "SHAKE" : true;
|
||||
}
|
||||
} else if (gauge.type === 'MP') {
|
||||
if (gaugeParam.param !== actor.mp || gaugeParam.max !== actor.mmp) return true;
|
||||
} else if (gauge.type === 'TP') {
|
||||
if (gaugeParam.param !== actor.tp || gaugeParam.max !== actor.maxTp()) return true;
|
||||
} else if (gauge.type === 'LV') {
|
||||
if (gaugeParam.param !== actor.currentExp() || gaugeParam.max !== actor.nextLevelExp() ||
|
||||
gaugeParam.subParam !== actor.level) return true;
|
||||
} else if (gauge.type === 'VN') {
|
||||
if (gaugeParam.param !== $gameVariables.value(gauge.param) ||
|
||||
gaugeParam.max !== $gameVariables.value(gauge.max)) return true;
|
||||
} else if (gauge.type === "MP") {
|
||||
if (gaugeParam.param !== actor.mp || gaugeParam.max !== actor.mmp)
|
||||
return true;
|
||||
} else if (gauge.type === "TP") {
|
||||
if (gaugeParam.param !== actor.tp || gaugeParam.max !== actor.maxTp())
|
||||
return true;
|
||||
} else if (gauge.type === "LV") {
|
||||
if (
|
||||
gaugeParam.param !== actor.currentExp() ||
|
||||
gaugeParam.max !== actor.nextLevelExp() ||
|
||||
gaugeParam.subParam !== actor.level
|
||||
)
|
||||
return true;
|
||||
} else if (gauge.type === "VN") {
|
||||
if (
|
||||
gaugeParam.param !== $gameVariables.value(gauge.param) ||
|
||||
gaugeParam.max !== $gameVariables.value(gauge.max)
|
||||
)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (stateIconMax > 0) {
|
||||
|
|
@ -561,16 +579,20 @@ Imported.TMMapHpGauge = true;
|
|||
this._shakeDuration--;
|
||||
this.x = this._baseX;
|
||||
if (this._shakeDuration > 0) {
|
||||
this.x += Math.floor(Math.sin((this._shakeDuration % 10) * Math.PI / 5) * 8);
|
||||
this.x += Math.floor(
|
||||
Math.sin(((this._shakeDuration % 10) * Math.PI) / 5) * 8
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Window_MapHpGauge.prototype.updateOpacity = function () {
|
||||
if (this.x < $gamePlayer.screenX() + 24 &&
|
||||
if (
|
||||
this.x < $gamePlayer.screenX() + 24 &&
|
||||
this.x + gaugeWindowWidth > $gamePlayer.screenX() - 24 &&
|
||||
this.y < $gamePlayer.screenY() &&
|
||||
this.y + gaugeWindowHeight > $gamePlayer.screenY() - 48) {
|
||||
this.y + gaugeWindowHeight > $gamePlayer.screenY() - 48
|
||||
) {
|
||||
this.opacity = Math.min(collideOpacity, windowOpacity);
|
||||
this.contentsOpacity = collideOpacity;
|
||||
} else {
|
||||
|
|
@ -589,15 +611,15 @@ Imported.TMMapHpGauge = true;
|
|||
var gauge = gauges[i];
|
||||
this._lineHeight = gauge.height;
|
||||
this.contents.fontSize = gauge.fontSize;
|
||||
if (gauge.type === 'HP') {
|
||||
if (gauge.type === "HP") {
|
||||
this.drawActorHp(actor, gauge.x, gauge.y, gauge.width);
|
||||
} else if (gauge.type === 'MP') {
|
||||
} else if (gauge.type === "MP") {
|
||||
this.drawActorMp(actor, gauge.x, gauge.y, gauge.width);
|
||||
} else if (gauge.type === 'TP') {
|
||||
} else if (gauge.type === "TP") {
|
||||
this.drawActorTp(actor, gauge.x, gauge.y, gauge.width);
|
||||
} else if (gauge.type === 'LV') {
|
||||
} else if (gauge.type === "LV") {
|
||||
this.drawLvGauge(actor, gauge);
|
||||
} else if (gauge.type === 'VN') {
|
||||
} else if (gauge.type === "VN") {
|
||||
this.drawVnGauge(this._gaugeParams[i], gauge);
|
||||
}
|
||||
}
|
||||
|
|
@ -607,8 +629,13 @@ Imported.TMMapHpGauge = true;
|
|||
this.drawIcon(this._icons[i], x, stateIconY);
|
||||
}
|
||||
if (goldWidth > 0) {
|
||||
this.drawCurrencyValue(this._gold, TextManager.currencyUnit, goldX,
|
||||
goldY, goldWidth);
|
||||
this.drawCurrencyValue(
|
||||
this._gold,
|
||||
TextManager.currencyUnit,
|
||||
goldX,
|
||||
goldY,
|
||||
goldWidth
|
||||
);
|
||||
}
|
||||
this._lineHeight = 36;
|
||||
}
|
||||
|
|
@ -616,8 +643,8 @@ Imported.TMMapHpGauge = true;
|
|||
|
||||
Window_MapHpGauge.prototype.drawLvGauge = function (actor, gauge) {
|
||||
if (actor.isMaxLevel()) {
|
||||
var value1 = '-------';
|
||||
var value2 = '-------';
|
||||
var value1 = "-------";
|
||||
var value2 = "-------";
|
||||
var rate = 1;
|
||||
} else {
|
||||
var n = actor.currentLevelExp();
|
||||
|
|
@ -625,46 +652,86 @@ Imported.TMMapHpGauge = true;
|
|||
var value2 = actor.nextLevelExp() - n;
|
||||
var rate = value1 / value2;
|
||||
}
|
||||
this.drawGauge(gauge.x, gauge.y, gauge.width, rate, gauge.color[0], gauge.color[1]);
|
||||
this.drawGauge(
|
||||
gauge.x,
|
||||
gauge.y,
|
||||
gauge.width,
|
||||
rate,
|
||||
gauge.color[0],
|
||||
gauge.color[1]
|
||||
);
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(TextManager.levelA, gauge.x, gauge.y, 44);
|
||||
var color = this.normalColor();
|
||||
this.changeTextColor(color);
|
||||
var width = this.textWidth(TextManager.levelA) + 4;
|
||||
this.drawText(actor.level, gauge.x + width, gauge.y, 44)
|
||||
width = gauge.width - width - this.textWidth('' + actor.level);
|
||||
this.drawCurrentAndMax(value1, value2, gauge.x + gauge.width - width, gauge.y, width,
|
||||
color, color);
|
||||
this.drawText(actor.level, gauge.x + width, gauge.y, 44);
|
||||
width = gauge.width - width - this.textWidth("" + actor.level);
|
||||
this.drawCurrentAndMax(
|
||||
value1,
|
||||
value2,
|
||||
gauge.x + gauge.width - width,
|
||||
gauge.y,
|
||||
width,
|
||||
color,
|
||||
color
|
||||
);
|
||||
};
|
||||
|
||||
Window_MapHpGauge.prototype.drawVnGauge = function (params, gauge) {
|
||||
var rate = params.max === 0 ? 0 : params.param / params.max;
|
||||
this.drawGauge(gauge.x, gauge.y, gauge.width, rate, gauge.color[0], gauge.color[1]);
|
||||
this.drawGauge(
|
||||
gauge.x,
|
||||
gauge.y,
|
||||
gauge.width,
|
||||
rate,
|
||||
gauge.color[0],
|
||||
gauge.color[1]
|
||||
);
|
||||
this.changeTextColor(this.systemColor());
|
||||
this.drawText(gauge.name, gauge.x, gauge.y, this.textWidth(gauge.name));
|
||||
this.changeTextColor(this.normalColor());
|
||||
if (vnMax) {
|
||||
this.drawVnCurrentAndMax(gauge.name, params.param, params.max,
|
||||
gauge.x, gauge.y, gauge.width);
|
||||
this.drawVnCurrentAndMax(
|
||||
gauge.name,
|
||||
params.param,
|
||||
params.max,
|
||||
gauge.x,
|
||||
gauge.y,
|
||||
gauge.width
|
||||
);
|
||||
} else {
|
||||
this.drawText(params.param, gauge.x + gauge.width - 64, gauge.y, 64, 'right');
|
||||
this.drawText(
|
||||
params.param,
|
||||
gauge.x + gauge.width - 64,
|
||||
gauge.y,
|
||||
64,
|
||||
"right"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
Window_MapHpGauge.prototype.drawVnCurrentAndMax = function (name, current, max, x, y, width) {
|
||||
Window_MapHpGauge.prototype.drawVnCurrentAndMax = function (
|
||||
name,
|
||||
current,
|
||||
max,
|
||||
x,
|
||||
y,
|
||||
width
|
||||
) {
|
||||
var labelWidth = this.textWidth(name);
|
||||
var valueWidth = this.textWidth('0' + max);
|
||||
var slashWidth = this.textWidth('/');
|
||||
var valueWidth = this.textWidth("0" + max);
|
||||
var slashWidth = this.textWidth("/");
|
||||
var x1 = x + width - valueWidth;
|
||||
var x2 = x1 - slashWidth;
|
||||
var x3 = x2 - valueWidth;
|
||||
this.changeTextColor(this.normalColor());
|
||||
if (x3 >= x + labelWidth) {
|
||||
this.drawText(current, x3, y, valueWidth, 'right');
|
||||
this.drawText('/', x2, y, slashWidth, 'right');
|
||||
this.drawText(max, x1, y, valueWidth, 'right');
|
||||
this.drawText(current, x3, y, valueWidth, "right");
|
||||
this.drawText("/", x2, y, slashWidth, "right");
|
||||
this.drawText(max, x1, y, valueWidth, "right");
|
||||
} else {
|
||||
this.drawText(current, x1, y, valueWidth, 'right');
|
||||
this.drawText(current, x1, y, valueWidth, "right");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -694,7 +761,8 @@ Imported.TMMapHpGauge = true;
|
|||
// Scene_Map
|
||||
//
|
||||
|
||||
var _Scene_Map_createDisplayObjects = Scene_Map.prototype.createDisplayObjects;
|
||||
var _Scene_Map_createDisplayObjects =
|
||||
Scene_Map.prototype.createDisplayObjects;
|
||||
Scene_Map.prototype.createDisplayObjects = function () {
|
||||
_Scene_Map_createDisplayObjects.call(this);
|
||||
this.createMapHpGaugeWindow();
|
||||
|
|
@ -717,7 +785,8 @@ Imported.TMMapHpGauge = true;
|
|||
// Scene_Battle
|
||||
//
|
||||
|
||||
var _Scene_Battle_createDisplayObjects = Scene_Battle.prototype.createDisplayObjects;
|
||||
var _Scene_Battle_createDisplayObjects =
|
||||
Scene_Battle.prototype.createDisplayObjects;
|
||||
Scene_Battle.prototype.createDisplayObjects = function () {
|
||||
_Scene_Battle_createDisplayObjects.call(this);
|
||||
if (useBattleScene) this.createMapHpGaugeWindow();
|
||||
|
|
@ -728,5 +797,4 @@ Imported.TMMapHpGauge = true;
|
|||
_Scene_Battle_terminate.call(this);
|
||||
if (this._mapHpGaugeWindow) this.removeChild(this._mapHpGaugeWindow);
|
||||
};
|
||||
|
||||
})();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -204,44 +204,59 @@ Imported.TMMenuLabel = true;
|
|||
|
||||
var TMPlugin = TMPlugin || {};
|
||||
TMPlugin.MenuLabel = {};
|
||||
TMPlugin.MenuLabel.Parameters = PluginManager.parameters('TMMenuLabel');
|
||||
TMPlugin.MenuLabel.Parameters = PluginManager.parameters("TMMenuLabel");
|
||||
TMPlugin.MenuLabel.Labels = [];
|
||||
TMPlugin.MenuLabel.Labels[0] = {
|
||||
name: TMPlugin.MenuLabel.Parameters['labelAName'],
|
||||
id: +(TMPlugin.MenuLabel.Parameters['labelAId'] || 10),
|
||||
max: +(TMPlugin.MenuLabel.Parameters['labelAMax'] || 9999),
|
||||
footer: TMPlugin.MenuLabel.Parameters['labelAFooter']
|
||||
name: TMPlugin.MenuLabel.Parameters["labelAName"],
|
||||
id: +(TMPlugin.MenuLabel.Parameters["labelAId"] || 10),
|
||||
max: +(TMPlugin.MenuLabel.Parameters["labelAMax"] || 9999),
|
||||
footer: TMPlugin.MenuLabel.Parameters["labelAFooter"],
|
||||
};
|
||||
TMPlugin.MenuLabel.Labels[1] = {
|
||||
name: TMPlugin.MenuLabel.Parameters['labelBName'],
|
||||
id: +(TMPlugin.MenuLabel.Parameters['labelBId'] || 10),
|
||||
max: +(TMPlugin.MenuLabel.Parameters['labelBMax'] || 9999),
|
||||
footer: TMPlugin.MenuLabel.Parameters['labelBFooter']
|
||||
name: TMPlugin.MenuLabel.Parameters["labelBName"],
|
||||
id: +(TMPlugin.MenuLabel.Parameters["labelBId"] || 10),
|
||||
max: +(TMPlugin.MenuLabel.Parameters["labelBMax"] || 9999),
|
||||
footer: TMPlugin.MenuLabel.Parameters["labelBFooter"],
|
||||
};
|
||||
TMPlugin.MenuLabel.Labels[2] = {
|
||||
name: TMPlugin.MenuLabel.Parameters['labelCName'],
|
||||
id: +(TMPlugin.MenuLabel.Parameters['labelCId'] || 10),
|
||||
max: +(TMPlugin.MenuLabel.Parameters['labelCMax'] || 9999),
|
||||
footer: TMPlugin.MenuLabel.Parameters['labelCFooter']
|
||||
name: TMPlugin.MenuLabel.Parameters["labelCName"],
|
||||
id: +(TMPlugin.MenuLabel.Parameters["labelCId"] || 10),
|
||||
max: +(TMPlugin.MenuLabel.Parameters["labelCMax"] || 9999),
|
||||
footer: TMPlugin.MenuLabel.Parameters["labelCFooter"],
|
||||
};
|
||||
TMPlugin.MenuLabel.Labels[3] = {
|
||||
name: TMPlugin.MenuLabel.Parameters['labelDName'],
|
||||
id: +(TMPlugin.MenuLabel.Parameters['labelDId'] || 10),
|
||||
max: +(TMPlugin.MenuLabel.Parameters['labelDMax'] || 9999),
|
||||
footer: TMPlugin.MenuLabel.Parameters['labelDFooter']
|
||||
name: TMPlugin.MenuLabel.Parameters["labelDName"],
|
||||
id: +(TMPlugin.MenuLabel.Parameters["labelDId"] || 10),
|
||||
max: +(TMPlugin.MenuLabel.Parameters["labelDMax"] || 9999),
|
||||
footer: TMPlugin.MenuLabel.Parameters["labelDFooter"],
|
||||
};
|
||||
TMPlugin.MenuLabel.NameWidth = +(TMPlugin.MenuLabel.Parameters['labelNameWidth'] || 160);
|
||||
TMPlugin.MenuLabel.ValueWidth = +(TMPlugin.MenuLabel.Parameters['labelValueWidth'] || 96);
|
||||
TMPlugin.MenuLabel.NameColorId = +(TMPlugin.MenuLabel.Parameters['labelNameColorId'] || 16);
|
||||
TMPlugin.MenuLabel.ValueColorId = +(TMPlugin.MenuLabel.Parameters['labelValueColorId'] || 0);
|
||||
TMPlugin.MenuLabel.MaxColorId = +(TMPlugin.MenuLabel.Parameters['labelMaxColorId'] || 2);
|
||||
TMPlugin.MenuLabel.FooterColorId = +(TMPlugin.MenuLabel.Parameters['labelFooterColorId'] || 0);
|
||||
TMPlugin.MenuLabel.FooterSpace = +(TMPlugin.MenuLabel.Parameters['footerSpace'] || 0);
|
||||
TMPlugin.MenuLabel.ReverseMenuWindow = TMPlugin.MenuLabel.Parameters['reverseMenuWindow'] === '1';
|
||||
TMPlugin.MenuLabel.MenuTextAlign = TMPlugin.MenuLabel.Parameters['menuTextAlign'] || 'left';
|
||||
TMPlugin.MenuLabel.NameWidth = +(
|
||||
TMPlugin.MenuLabel.Parameters["labelNameWidth"] || 160
|
||||
);
|
||||
TMPlugin.MenuLabel.ValueWidth = +(
|
||||
TMPlugin.MenuLabel.Parameters["labelValueWidth"] || 96
|
||||
);
|
||||
TMPlugin.MenuLabel.NameColorId = +(
|
||||
TMPlugin.MenuLabel.Parameters["labelNameColorId"] || 16
|
||||
);
|
||||
TMPlugin.MenuLabel.ValueColorId = +(
|
||||
TMPlugin.MenuLabel.Parameters["labelValueColorId"] || 0
|
||||
);
|
||||
TMPlugin.MenuLabel.MaxColorId = +(
|
||||
TMPlugin.MenuLabel.Parameters["labelMaxColorId"] || 2
|
||||
);
|
||||
TMPlugin.MenuLabel.FooterColorId = +(
|
||||
TMPlugin.MenuLabel.Parameters["labelFooterColorId"] || 0
|
||||
);
|
||||
TMPlugin.MenuLabel.FooterSpace = +(
|
||||
TMPlugin.MenuLabel.Parameters["footerSpace"] || 0
|
||||
);
|
||||
TMPlugin.MenuLabel.ReverseMenuWindow =
|
||||
TMPlugin.MenuLabel.Parameters["reverseMenuWindow"] === "1";
|
||||
TMPlugin.MenuLabel.MenuTextAlign =
|
||||
TMPlugin.MenuLabel.Parameters["menuTextAlign"] || "left";
|
||||
|
||||
(function () {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_System
|
||||
//
|
||||
|
|
@ -259,12 +274,13 @@ TMPlugin.MenuLabel.MenuTextAlign = TMPlugin.MenuLabel.Parameters['menuTextAlign'
|
|||
// Game_Interpreter
|
||||
//
|
||||
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'startMenuLabel') {
|
||||
if (command === "startMenuLabel") {
|
||||
$gameSystem.setMenuLabel(true);
|
||||
} else if (command === 'stopMenuLabel') {
|
||||
} else if (command === "stopMenuLabel") {
|
||||
$gameSystem.setMenuLabel(false);
|
||||
}
|
||||
};
|
||||
|
|
@ -359,10 +375,15 @@ TMPlugin.MenuLabel.MenuTextAlign = TMPlugin.MenuLabel.Parameters['menuTextAlign'
|
|||
value = label.max;
|
||||
this.changeTextColor(this.textColor(TMPlugin.MenuLabel.MaxColorId));
|
||||
}
|
||||
this.drawText(value, x, y, TMPlugin.MenuLabel.ValueWidth, 'right');
|
||||
this.drawText(value, x, y, TMPlugin.MenuLabel.ValueWidth, "right");
|
||||
if (label.name) {
|
||||
this.changeTextColor(this.textColor(TMPlugin.MenuLabel.NameColorId));
|
||||
this.drawText(label.name, this.textPadding(), y, TMPlugin.MenuLabel.NameWidth);
|
||||
this.drawText(
|
||||
label.name,
|
||||
this.textPadding(),
|
||||
y,
|
||||
TMPlugin.MenuLabel.NameWidth
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -377,8 +398,9 @@ TMPlugin.MenuLabel.MenuTextAlign = TMPlugin.MenuLabel.Parameters['menuTextAlign'
|
|||
if (TMPlugin.MenuLabel.ReverseMenuWindow) {
|
||||
this._statusWindow.x = 0;
|
||||
this._commandWindow.x = this._statusWindow.width;
|
||||
this._goldWindow.x = this._commandWindow.x
|
||||
if (this._menuLabelWindow) this._menuLabelWindow.x = this._commandWindow.x
|
||||
this._goldWindow.x = this._commandWindow.x;
|
||||
if (this._menuLabelWindow)
|
||||
this._menuLabelWindow.x = this._commandWindow.x;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -387,5 +409,4 @@ TMPlugin.MenuLabel.MenuTextAlign = TMPlugin.MenuLabel.Parameters['menuTextAlign'
|
|||
this._menuLabelWindow.y = this._goldWindow.y - this._menuLabelWindow.height;
|
||||
this.addWindow(this._menuLabelWindow);
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -119,19 +119,24 @@ Imported.TMNamePop = true;
|
|||
|
||||
var TMPlugin = TMPlugin || {};
|
||||
TMPlugin.NamePop = {};
|
||||
TMPlugin.NamePop.Parameters = PluginManager.parameters('TMNamePop');
|
||||
TMPlugin.NamePop.BackOpacity = +(TMPlugin.NamePop.Parameters['backOpacity'] || 96);
|
||||
TMPlugin.NamePop.FontSize = +(TMPlugin.NamePop.Parameters['fontSize'] || 20);
|
||||
TMPlugin.NamePop.OutlineWidth = +(TMPlugin.NamePop.Parameters['outlineWidth'] || 4);
|
||||
TMPlugin.NamePop.OutlineColor = TMPlugin.NamePop.Parameters['outlineColor'] || 'rgba(0, 0, 0, 0.5)';
|
||||
TMPlugin.NamePop.Width = +(TMPlugin.NamePop.Parameters['width'] || 160);
|
||||
TMPlugin.NamePop.RoundRectRadius = +(TMPlugin.NamePop.Parameters['roundRectRadius'] || 6);
|
||||
|
||||
TMPlugin.NamePop.Parameters = PluginManager.parameters("TMNamePop");
|
||||
TMPlugin.NamePop.BackOpacity = +(
|
||||
TMPlugin.NamePop.Parameters["backOpacity"] || 96
|
||||
);
|
||||
TMPlugin.NamePop.FontSize = +(TMPlugin.NamePop.Parameters["fontSize"] || 20);
|
||||
TMPlugin.NamePop.OutlineWidth = +(
|
||||
TMPlugin.NamePop.Parameters["outlineWidth"] || 4
|
||||
);
|
||||
TMPlugin.NamePop.OutlineColor =
|
||||
TMPlugin.NamePop.Parameters["outlineColor"] || "rgba(0, 0, 0, 0.5)";
|
||||
TMPlugin.NamePop.Width = +(TMPlugin.NamePop.Parameters["width"] || 160);
|
||||
TMPlugin.NamePop.RoundRectRadius = +(
|
||||
TMPlugin.NamePop.Parameters["roundRectRadius"] || 6
|
||||
);
|
||||
|
||||
if (!TMPlugin.EventBase) {
|
||||
TMPlugin.EventBase = true;
|
||||
(function () {
|
||||
|
||||
var _Game_Event_setupPage = Game_Event.prototype.setupPage;
|
||||
Game_Event.prototype.setupPage = function () {
|
||||
_Game_Event_setupPage.call(this);
|
||||
|
|
@ -144,11 +149,12 @@ if (!TMPlugin.EventBase) {
|
|||
var list = this.list();
|
||||
for (var i = 0; i < list.length; i++) {
|
||||
var command = list[i];
|
||||
if (command && command.code == 108 || command.code == 408) {
|
||||
for (; ;) {
|
||||
if ((command && command.code == 108) || command.code == 408) {
|
||||
for (;;) {
|
||||
var match = re.exec(command.parameters[0]);
|
||||
if (match) {
|
||||
this._commentParams[match[1]] = match[2] === ':' ? match[3] : true;
|
||||
this._commentParams[match[1]] =
|
||||
match[2] === ":" ? match[3] : true;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
|
@ -162,48 +168,56 @@ if (!TMPlugin.EventBase) {
|
|||
Game_Event.prototype.loadTagParam = function (paramName) {
|
||||
return this._commentParams[paramName] || this.event().meta[paramName];
|
||||
};
|
||||
|
||||
})();
|
||||
} // TMPlugin.EventBase
|
||||
|
||||
if (!TMPlugin.InterpreterBase) {
|
||||
TMPlugin.InterpreterBase = true;
|
||||
(function () {
|
||||
|
||||
Game_Interpreter.prototype.convertEscapeCharactersTM = function (text) {
|
||||
text = text.replace(/\\/g, '\x1b');
|
||||
text = text.replace(/\x1b\x1b/g, '\\');
|
||||
text = text.replace(/\x1bV\[(\d+)\]/gi, function () {
|
||||
return $gameVariables.value(parseInt(arguments[1]));
|
||||
}.bind(this));
|
||||
text = text.replace(/\x1bV\[(\d+)\]/gi, function () {
|
||||
return $gameVariables.value(parseInt(arguments[1]));
|
||||
}.bind(this));
|
||||
text = text.replace(/\x1bN\[(\d+)\]/gi, function () {
|
||||
return this.actorNameTM(parseInt(arguments[1]));
|
||||
}.bind(this));
|
||||
text = text.replace(/\x1bP\[(\d+)\]/gi, function () {
|
||||
return this.partyMemberNameTM(parseInt(arguments[1]));
|
||||
}.bind(this));
|
||||
text = text.replace(/\\/g, "\x1b");
|
||||
text = text.replace(/\x1b\x1b/g, "\\");
|
||||
text = text.replace(
|
||||
/\x1bV\[(\d+)\]/gi,
|
||||
function () {
|
||||
return $gameVariables.value(parseInt(arguments[1]));
|
||||
}.bind(this)
|
||||
);
|
||||
text = text.replace(
|
||||
/\x1bV\[(\d+)\]/gi,
|
||||
function () {
|
||||
return $gameVariables.value(parseInt(arguments[1]));
|
||||
}.bind(this)
|
||||
);
|
||||
text = text.replace(
|
||||
/\x1bN\[(\d+)\]/gi,
|
||||
function () {
|
||||
return this.actorNameTM(parseInt(arguments[1]));
|
||||
}.bind(this)
|
||||
);
|
||||
text = text.replace(
|
||||
/\x1bP\[(\d+)\]/gi,
|
||||
function () {
|
||||
return this.partyMemberNameTM(parseInt(arguments[1]));
|
||||
}.bind(this)
|
||||
);
|
||||
text = text.replace(/\x1bG/gi, TextManager.currencyUnit);
|
||||
return text;
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.actorNameTM = function (n) {
|
||||
var actor = n >= 1 ? $gameActors.actor(n) : null;
|
||||
return actor ? actor.name() : '';
|
||||
return actor ? actor.name() : "";
|
||||
};
|
||||
|
||||
Game_Interpreter.prototype.partyMemberNameTM = function (n) {
|
||||
var actor = n >= 1 ? $gameParty.members()[n - 1] : null;
|
||||
return actor ? actor.name() : '';
|
||||
return actor ? actor.name() : "";
|
||||
};
|
||||
|
||||
})();
|
||||
} // TMPlugin.InterpreterBase
|
||||
|
||||
(function () {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Game_CharacterBase
|
||||
//
|
||||
|
|
@ -220,7 +234,9 @@ if (!TMPlugin.InterpreterBase) {
|
|||
return this._namePopOutlineColor || TMPlugin.NamePop.OutlineColor;
|
||||
};
|
||||
|
||||
Game_CharacterBase.prototype.setNamePopOutlineColor = function (outlineColor) {
|
||||
Game_CharacterBase.prototype.setNamePopOutlineColor = function (
|
||||
outlineColor
|
||||
) {
|
||||
this._namePopOutlineColor = outlineColor;
|
||||
};
|
||||
|
||||
|
|
@ -244,9 +260,9 @@ if (!TMPlugin.InterpreterBase) {
|
|||
Game_Event.prototype.setupPage = function () {
|
||||
_Game_Event_setupPage.call(this);
|
||||
if (this._pageIndex >= 0) {
|
||||
var namePop = this.loadTagParam('namePop');
|
||||
var namePop = this.loadTagParam("namePop");
|
||||
if (namePop) {
|
||||
var arr = namePop.split(' ');
|
||||
var arr = namePop.split(" ");
|
||||
this.setNamePop(arr[0], arr[1]);
|
||||
this.setNamePopOutlineColor(arr[2]);
|
||||
}
|
||||
|
|
@ -260,10 +276,11 @@ if (!TMPlugin.InterpreterBase) {
|
|||
// Game_Interpreter
|
||||
//
|
||||
|
||||
var _Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'namePop') {
|
||||
if (command === "namePop") {
|
||||
var arr = args.map(this.convertEscapeCharactersTM, this);
|
||||
var character = this.character(+arr[0]);
|
||||
if (character) {
|
||||
|
|
@ -285,8 +302,10 @@ if (!TMPlugin.InterpreterBase) {
|
|||
};
|
||||
|
||||
Sprite_Character.prototype.updateNamePop = function () {
|
||||
if (this._character.isNamePopRequested() ||
|
||||
this._namePop !== this._character._namePop) {
|
||||
if (
|
||||
this._character.isNamePopRequested() ||
|
||||
this._namePop !== this._character._namePop
|
||||
) {
|
||||
this._character.onChangeNamePop();
|
||||
this._namePop = this._character._namePop;
|
||||
if (this._namePop) {
|
||||
|
|
@ -295,8 +314,10 @@ if (!TMPlugin.InterpreterBase) {
|
|||
this.addChild(this._namePopSprite);
|
||||
this._namePopSprite.y = this.namePopShiftY();
|
||||
}
|
||||
this._namePopSprite.refresh(this._namePop,
|
||||
this._character.namePopOutlineColor());
|
||||
this._namePopSprite.refresh(
|
||||
this._namePop,
|
||||
this._character.namePopOutlineColor()
|
||||
);
|
||||
} else {
|
||||
this.removeChild(this._namePopSprite);
|
||||
this._namePopSprite = null;
|
||||
|
|
@ -321,7 +342,10 @@ if (!TMPlugin.InterpreterBase) {
|
|||
|
||||
Sprite_NamePop.prototype.initialize = function () {
|
||||
Sprite.prototype.initialize.call(this);
|
||||
this.bitmap = new Bitmap(TMPlugin.NamePop.Width, TMPlugin.NamePop.FontSize + 4);
|
||||
this.bitmap = new Bitmap(
|
||||
TMPlugin.NamePop.Width,
|
||||
TMPlugin.NamePop.FontSize + 4
|
||||
);
|
||||
this.bitmap.fontSize = TMPlugin.NamePop.FontSize;
|
||||
this.bitmap.outlineWidth = TMPlugin.NamePop.OutlineWidth;
|
||||
this.anchor.x = 0.5;
|
||||
|
|
@ -335,7 +359,7 @@ if (!TMPlugin.InterpreterBase) {
|
|||
|
||||
Sprite_NamePop.prototype.refresh = function (text, outlineColor) {
|
||||
this.bitmap.clear();
|
||||
this.bitmap.textColor = '#ffffff';
|
||||
this.bitmap.textColor = "#ffffff";
|
||||
this.bitmap.outlineColor = outlineColor;
|
||||
text = this.convertEscapeCharacters(text);
|
||||
var tw = this.bitmap.measureTextWidth(text);
|
||||
|
|
@ -343,27 +367,36 @@ if (!TMPlugin.InterpreterBase) {
|
|||
var w = Math.min(tw + 8, this.width);
|
||||
this.bitmap.paintOpacity = TMPlugin.NamePop.BackOpacity;
|
||||
if (Imported.TMBitmapEx && TMPlugin.NamePop.RoundRectRadius) {
|
||||
this.bitmap.fillRoundRect(x, 0, w, this.height, TMPlugin.NamePop.RoundRectRadius, '#000000');
|
||||
this.bitmap.fillRoundRect(
|
||||
x,
|
||||
0,
|
||||
w,
|
||||
this.height,
|
||||
TMPlugin.NamePop.RoundRectRadius,
|
||||
"#000000"
|
||||
);
|
||||
} else {
|
||||
this.bitmap.fillRect(x, 0, w, this.height, '#000000');
|
||||
this.bitmap.fillRect(x, 0, w, this.height, "#000000");
|
||||
}
|
||||
this.bitmap.paintOpacity = 255;
|
||||
this.bitmap.drawText(text, 0, 0, this.width, this.height, 'center');
|
||||
this.bitmap.drawText(text, 0, 0, this.width, this.height, "center");
|
||||
};
|
||||
|
||||
Sprite_NamePop.prototype.convertEscapeCharacters = function (text) {
|
||||
text = text.replace(/\x1bC\[(\d+)\]/gi, function () {
|
||||
this.bitmap.textColor = this.textColor(arguments[1]);
|
||||
return '';
|
||||
}.bind(this));
|
||||
text = text.replace(
|
||||
/\x1bC\[(\d+)\]/gi,
|
||||
function () {
|
||||
this.bitmap.textColor = this.textColor(arguments[1]);
|
||||
return "";
|
||||
}.bind(this)
|
||||
);
|
||||
return text;
|
||||
};
|
||||
|
||||
Sprite_NamePop.prototype.textColor = function (n) {
|
||||
var px = 96 + (n % 8) * 12 + 6;
|
||||
var py = 144 + Math.floor(n / 8) * 12 + 6;
|
||||
var windowskin = ImageManager.loadSystem('Window');
|
||||
var windowskin = ImageManager.loadSystem("Window");
|
||||
return windowskin.getPixel(px, py);
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -31,8 +31,8 @@
|
|||
*
|
||||
* @param labelAFooter
|
||||
* @desc ラベルAのフッターテキスト
|
||||
* 初期値:
|
||||
* @default
|
||||
* 初期値:
|
||||
* @default
|
||||
*
|
||||
* @param labelBName
|
||||
* @desc ラベルBの名前
|
||||
|
|
@ -51,8 +51,8 @@
|
|||
*
|
||||
* @param labelBFooter
|
||||
* @desc ラベルBのフッターテキスト
|
||||
* 初期値:
|
||||
* @default
|
||||
* 初期値:
|
||||
* @default
|
||||
*
|
||||
* @param labelNameWidth
|
||||
* @desc ラベル名の表示幅
|
||||
|
|
@ -125,24 +125,47 @@ Imported.TMSaveDataLabel = true;
|
|||
|
||||
var TMPlugin = TMPlugin || {};
|
||||
TMPlugin.SaveDataLabel = {};
|
||||
TMPlugin.SaveDataLabel.Parameters = PluginManager.parameters('TMSaveDataLabel');
|
||||
TMPlugin.SaveDataLabel.LabelAName = TMPlugin.SaveDataLabel.Parameters['labelAName'];
|
||||
TMPlugin.SaveDataLabel.LabelAId = +(TMPlugin.SaveDataLabel.Parameters['labelAId'] || 10);
|
||||
TMPlugin.SaveDataLabel.LabelAMax = +(TMPlugin.SaveDataLabel.Parameters['labelAMax'] || 9999);
|
||||
TMPlugin.SaveDataLabel.LabelAFooter = TMPlugin.SaveDataLabel.Parameters['labelAFooter'];
|
||||
TMPlugin.SaveDataLabel.LabelBName = TMPlugin.SaveDataLabel.Parameters['labelBName'];
|
||||
TMPlugin.SaveDataLabel.LabelBId = +(TMPlugin.SaveDataLabel.Parameters['labelBId'] || 0);
|
||||
TMPlugin.SaveDataLabel.LabelBMax = +(TMPlugin.SaveDataLabel.Parameters['labelBMax'] || 9999);
|
||||
TMPlugin.SaveDataLabel.LabelBFooter = TMPlugin.SaveDataLabel.Parameters['labelBFooter'];
|
||||
TMPlugin.SaveDataLabel.NameWidth = +(TMPlugin.SaveDataLabel.Parameters['labelNameWidth'] || 160);
|
||||
TMPlugin.SaveDataLabel.ValueWidth = +(TMPlugin.SaveDataLabel.Parameters['labelValueWidth'] || 96);
|
||||
TMPlugin.SaveDataLabel.NameColorId = +(TMPlugin.SaveDataLabel.Parameters['labelNameColorId'] || 16);
|
||||
TMPlugin.SaveDataLabel.ValueColorId = +(TMPlugin.SaveDataLabel.Parameters['labelValueColorId'] || 0);
|
||||
TMPlugin.SaveDataLabel.MaxColorId = +(TMPlugin.SaveDataLabel.Parameters['labelMaxColorId'] || 2);
|
||||
TMPlugin.SaveDataLabel.FooterColorId = +(TMPlugin.SaveDataLabel.Parameters['labelFooterColorId'] || 0);
|
||||
TMPlugin.SaveDataLabel.Parameters = PluginManager.parameters("TMSaveDataLabel");
|
||||
TMPlugin.SaveDataLabel.LabelAName =
|
||||
TMPlugin.SaveDataLabel.Parameters["labelAName"];
|
||||
TMPlugin.SaveDataLabel.LabelAId = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelAId"] || 10
|
||||
);
|
||||
TMPlugin.SaveDataLabel.LabelAMax = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelAMax"] || 9999
|
||||
);
|
||||
TMPlugin.SaveDataLabel.LabelAFooter =
|
||||
TMPlugin.SaveDataLabel.Parameters["labelAFooter"];
|
||||
TMPlugin.SaveDataLabel.LabelBName =
|
||||
TMPlugin.SaveDataLabel.Parameters["labelBName"];
|
||||
TMPlugin.SaveDataLabel.LabelBId = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelBId"] || 0
|
||||
);
|
||||
TMPlugin.SaveDataLabel.LabelBMax = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelBMax"] || 9999
|
||||
);
|
||||
TMPlugin.SaveDataLabel.LabelBFooter =
|
||||
TMPlugin.SaveDataLabel.Parameters["labelBFooter"];
|
||||
TMPlugin.SaveDataLabel.NameWidth = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelNameWidth"] || 160
|
||||
);
|
||||
TMPlugin.SaveDataLabel.ValueWidth = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelValueWidth"] || 96
|
||||
);
|
||||
TMPlugin.SaveDataLabel.NameColorId = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelNameColorId"] || 16
|
||||
);
|
||||
TMPlugin.SaveDataLabel.ValueColorId = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelValueColorId"] || 0
|
||||
);
|
||||
TMPlugin.SaveDataLabel.MaxColorId = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelMaxColorId"] || 2
|
||||
);
|
||||
TMPlugin.SaveDataLabel.FooterColorId = +(
|
||||
TMPlugin.SaveDataLabel.Parameters["labelFooterColorId"] || 0
|
||||
);
|
||||
|
||||
(function () {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DataManager
|
||||
//
|
||||
|
|
@ -150,8 +173,12 @@ TMPlugin.SaveDataLabel.FooterColorId = +(TMPlugin.SaveDataLabel.Parameters['labe
|
|||
var _DataManager_makeSavefileInfo = DataManager.makeSavefileInfo;
|
||||
DataManager.makeSavefileInfo = function () {
|
||||
var info = _DataManager_makeSavefileInfo.call(this);
|
||||
info.labelA = TMPlugin.SaveDataLabel.LabelAId ? $gameVariables.value(TMPlugin.SaveDataLabel.LabelAId) : 0;
|
||||
info.labelB = TMPlugin.SaveDataLabel.LabelBId ? $gameVariables.value(TMPlugin.SaveDataLabel.LabelBId) : 0;
|
||||
info.labelA = TMPlugin.SaveDataLabel.LabelAId
|
||||
? $gameVariables.value(TMPlugin.SaveDataLabel.LabelAId)
|
||||
: 0;
|
||||
info.labelB = TMPlugin.SaveDataLabel.LabelBId
|
||||
? $gameVariables.value(TMPlugin.SaveDataLabel.LabelBId)
|
||||
: 0;
|
||||
return info;
|
||||
};
|
||||
|
||||
|
|
@ -164,23 +191,25 @@ TMPlugin.SaveDataLabel.FooterColorId = +(TMPlugin.SaveDataLabel.Parameters['labe
|
|||
_Window_SavefileList_drawItem.call(this, index);
|
||||
var id = index + 1;
|
||||
var valid = DataManager.isThisGameFile(id);
|
||||
var info = DataManager.loadSavefileInfo(id)
|
||||
var info = DataManager.loadSavefileInfo(id);
|
||||
if (info && valid) {
|
||||
var rect = this.itemRectForText(index);
|
||||
var x = rect.width + this.textPadding();
|
||||
if (TMPlugin.SaveDataLabel.LabelAId && info.labelA != null) {
|
||||
var label = {
|
||||
name: TMPlugin.SaveDataLabel.LabelAName, value: info.labelA,
|
||||
name: TMPlugin.SaveDataLabel.LabelAName,
|
||||
value: info.labelA,
|
||||
max: TMPlugin.SaveDataLabel.LabelAMax,
|
||||
footer: TMPlugin.SaveDataLabel.LabelAFooter
|
||||
footer: TMPlugin.SaveDataLabel.LabelAFooter,
|
||||
};
|
||||
this.drawSaveDataLabel(x, rect.y, label);
|
||||
}
|
||||
if (TMPlugin.SaveDataLabel.LabelBId && info.labelB != null) {
|
||||
var label = {
|
||||
name: TMPlugin.SaveDataLabel.LabelBName, value: info.labelB,
|
||||
name: TMPlugin.SaveDataLabel.LabelBName,
|
||||
value: info.labelB,
|
||||
max: TMPlugin.SaveDataLabel.LabelBMax,
|
||||
footer: TMPlugin.SaveDataLabel.LabelBFooter
|
||||
footer: TMPlugin.SaveDataLabel.LabelBFooter,
|
||||
};
|
||||
this.drawSaveDataLabel(x, rect.y + this.lineHeight(), label);
|
||||
}
|
||||
|
|
@ -191,7 +220,9 @@ TMPlugin.SaveDataLabel.FooterColorId = +(TMPlugin.SaveDataLabel.Parameters['labe
|
|||
if (label.footer) {
|
||||
var footerWidth = this.textWidth(label.footer);
|
||||
x -= footerWidth;
|
||||
this.changeTextColor(this.textColor(TMPlugin.SaveDataLabel.FooterColorId));
|
||||
this.changeTextColor(
|
||||
this.textColor(TMPlugin.SaveDataLabel.FooterColorId)
|
||||
);
|
||||
this.drawText(label.footer, x, y, footerWidth);
|
||||
}
|
||||
x -= TMPlugin.SaveDataLabel.ValueWidth;
|
||||
|
|
@ -200,12 +231,17 @@ TMPlugin.SaveDataLabel.FooterColorId = +(TMPlugin.SaveDataLabel.Parameters['labe
|
|||
label.value = label.max;
|
||||
this.changeTextColor(this.textColor(TMPlugin.SaveDataLabel.MaxColorId));
|
||||
}
|
||||
this.drawText(label.value, x, y, TMPlugin.SaveDataLabel.ValueWidth, 'right');
|
||||
this.drawText(
|
||||
label.value,
|
||||
x,
|
||||
y,
|
||||
TMPlugin.SaveDataLabel.ValueWidth,
|
||||
"right"
|
||||
);
|
||||
if (label.name) {
|
||||
x -= TMPlugin.SaveDataLabel.NameWidth;
|
||||
this.changeTextColor(this.textColor(TMPlugin.SaveDataLabel.NameColorId));
|
||||
this.drawText(label.name, x, y, TMPlugin.SaveDataLabel.NameWidth);
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -49,24 +49,22 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
var parameters = PluginManager.parameters("TitleCommandPosition");
|
||||
var offsetX = Number(parameters["Offset X"] || 0);
|
||||
var offsetY = Number(parameters["Offset Y"] || 0);
|
||||
var width = Number(parameters["Width"] || 240);
|
||||
var background = Number(parameters["Background"] || 0);
|
||||
|
||||
var parameters = PluginManager.parameters('TitleCommandPosition');
|
||||
var offsetX = Number(parameters['Offset X'] || 0);
|
||||
var offsetY = Number(parameters['Offset Y'] || 0);
|
||||
var width = Number(parameters['Width'] || 240);
|
||||
var background = Number(parameters['Background'] || 0);
|
||||
|
||||
var _Window_TitleCommand_updatePlacement =
|
||||
Window_TitleCommand.prototype.updatePlacement;
|
||||
Window_TitleCommand.prototype.updatePlacement = function () {
|
||||
_Window_TitleCommand_updatePlacement.call(this);
|
||||
this.x += offsetX;
|
||||
this.y += offsetY;
|
||||
this.setBackgroundType(background);
|
||||
};
|
||||
|
||||
Window_TitleCommand.prototype.windowWidth = function () {
|
||||
return width;
|
||||
};
|
||||
var _Window_TitleCommand_updatePlacement =
|
||||
Window_TitleCommand.prototype.updatePlacement;
|
||||
Window_TitleCommand.prototype.updatePlacement = function () {
|
||||
_Window_TitleCommand_updatePlacement.call(this);
|
||||
this.x += offsetX;
|
||||
this.y += offsetY;
|
||||
this.setBackgroundType(background);
|
||||
};
|
||||
|
||||
Window_TitleCommand.prototype.windowWidth = function () {
|
||||
return width;
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -133,193 +133,211 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
var pluginName = 'TitleImageChange';
|
||||
"use strict";
|
||||
var pluginName = "TitleImageChange";
|
||||
|
||||
var getParamString = function (paramNames) {
|
||||
var value = getParamOther(paramNames);
|
||||
return value == null ? '' : value;
|
||||
};
|
||||
var getParamString = function (paramNames) {
|
||||
var value = getParamOther(paramNames);
|
||||
return value == null ? "" : value;
|
||||
};
|
||||
|
||||
var getParamNumber = function (paramNames, min, max) {
|
||||
var value = getParamOther(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value, 10) || 0).clamp(min, max);
|
||||
};
|
||||
var getParamNumber = function (paramNames, min, max) {
|
||||
var value = getParamOther(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
return (parseInt(value, 10) || 0).clamp(min, max);
|
||||
};
|
||||
|
||||
var getParamOther = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (var i = 0; i < paramNames.length; i++) {
|
||||
var name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return name;
|
||||
var getParamOther = function (paramNames) {
|
||||
if (!Array.isArray(paramNames)) paramNames = [paramNames];
|
||||
for (var i = 0; i < paramNames.length; i++) {
|
||||
var name = PluginManager.parameters(pluginName)[paramNames[i]];
|
||||
if (name) return name;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
var getParamArrayString = function (paramNames) {
|
||||
var valuesText = getParamString(paramNames);
|
||||
if (!valuesText) return [];
|
||||
var values = valuesText.split(",");
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
values[i] = values[i].trim();
|
||||
}
|
||||
return values;
|
||||
};
|
||||
|
||||
var getParamArrayNumber = function (paramNames, min, max) {
|
||||
var values = getParamArrayString(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
if (!isNaN(parseInt(values[i], 10))) {
|
||||
values[i] = (parseInt(values[i], 10) || 0).clamp(min, max);
|
||||
} else {
|
||||
values.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
return values;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
var paramGradeVariable = getParamNumber(
|
||||
["GradeVariable", "進行度変数"],
|
||||
1,
|
||||
5000
|
||||
);
|
||||
var paramPriorityVariable = getParamNumber(
|
||||
["PriorityVariable", "優先度変数"],
|
||||
0,
|
||||
5000
|
||||
);
|
||||
var paramTitleGrades = [];
|
||||
paramTitleGrades.push(getParamNumber(["TitleGrade1", "タイトル1の進行度"]));
|
||||
paramTitleGrades.push(getParamNumber(["TitleGrade2", "タイトル2の進行度"]));
|
||||
paramTitleGrades.push(getParamNumber(["TitleGrade3", "タイトル3の進行度"]));
|
||||
var paramTitleImages = [];
|
||||
paramTitleImages.push(getParamString(["TitleImage1", "タイトル1の画像"]));
|
||||
paramTitleImages.push(getParamString(["TitleImage2", "タイトル2の画像"]));
|
||||
paramTitleImages.push(getParamString(["TitleImage3", "タイトル3の画像"]));
|
||||
var paramTitleBgms = [];
|
||||
paramTitleBgms.push(getParamString(["TitleBgm1", "タイトル1のBGM"]));
|
||||
paramTitleBgms.push(getParamString(["TitleBgm2", "タイトル2のBGM"]));
|
||||
paramTitleBgms.push(getParamString(["TitleBgm3", "タイトル3のBGM"]));
|
||||
paramTitleGrades = paramTitleGrades
|
||||
.concat(getParamArrayNumber(["TitleGradeAfter", "以降の進行度"]))
|
||||
.reverse();
|
||||
paramTitleImages = paramTitleImages
|
||||
.concat(getParamArrayString(["TitleImageAfter", "以降の画像"]))
|
||||
.reverse();
|
||||
paramTitleBgms = paramTitleBgms
|
||||
.concat(getParamArrayString(["TitleBgmAfter", "以降のBGM"]))
|
||||
.reverse();
|
||||
|
||||
//=============================================================================
|
||||
// DataManager
|
||||
// ゲーム進行状況を保存します。
|
||||
//=============================================================================
|
||||
var _DataManager_makeSavefileInfo = DataManager.makeSavefileInfo;
|
||||
DataManager.makeSavefileInfo = function () {
|
||||
var info = _DataManager_makeSavefileInfo.apply(this, arguments);
|
||||
this.setGradeVariable(info);
|
||||
return info;
|
||||
};
|
||||
|
||||
DataManager.getFirstPriorityGradeVariable = function () {
|
||||
this._loadGrade = true;
|
||||
var globalInfo = this.loadGlobalInfo().filter(function (data, id) {
|
||||
return this.isThisGameFile(id);
|
||||
}, this);
|
||||
this._loadGrade = false;
|
||||
var gradeVariable = 0;
|
||||
if (globalInfo && globalInfo.length > 0) {
|
||||
var sortedGlobalInfo = globalInfo
|
||||
.clone()
|
||||
.sort(this._compareOrderForGradeVariable);
|
||||
if (sortedGlobalInfo[0]) {
|
||||
gradeVariable = sortedGlobalInfo[0].gradeVariable || 0;
|
||||
}
|
||||
}
|
||||
return gradeVariable;
|
||||
};
|
||||
|
||||
var _DataManager_loadGlobalInfo = DataManager.loadGlobalInfo;
|
||||
DataManager.loadGlobalInfo = function () {
|
||||
if (this._loadGrade) {
|
||||
if (!this._globalInfo) {
|
||||
try {
|
||||
var json = StorageManager.load(0);
|
||||
this._globalInfo = json ? JSON.parse(json) : [];
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this._globalInfo = [];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
}
|
||||
return this._globalInfo;
|
||||
} else {
|
||||
return _DataManager_loadGlobalInfo.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
var getParamArrayString = function (paramNames) {
|
||||
var valuesText = getParamString(paramNames);
|
||||
if (!valuesText) return [];
|
||||
var values = valuesText.split(',');
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
values[i] = values[i].trim();
|
||||
}
|
||||
return values;
|
||||
};
|
||||
DataManager._compareOrderForGradeVariable = function (a, b) {
|
||||
if (!a) {
|
||||
return 1;
|
||||
} else if (!b) {
|
||||
return -1;
|
||||
} else if (
|
||||
a.priorityVariable !== b.priorityVariable &&
|
||||
paramPriorityVariable > 0
|
||||
) {
|
||||
return (b.priorityVariable || 0) - (a.priorityVariable || 0);
|
||||
} else {
|
||||
return (b.gradeVariable || 0) - (a.gradeVariable || 0);
|
||||
}
|
||||
};
|
||||
|
||||
var getParamArrayNumber = function (paramNames, min, max) {
|
||||
var values = getParamArrayString(paramNames);
|
||||
if (arguments.length < 2) min = -Infinity;
|
||||
if (arguments.length < 3) max = Infinity;
|
||||
for (var i = 0; i < values.length; i++) {
|
||||
if (!isNaN(parseInt(values[i], 10))) {
|
||||
values[i] = (parseInt(values[i], 10) || 0).clamp(min, max);
|
||||
} else {
|
||||
values.splice(i--, 1);
|
||||
}
|
||||
}
|
||||
return values;
|
||||
};
|
||||
DataManager.saveOnlyGradeVariable = function () {
|
||||
var saveFileId = this.lastAccessedSavefileId();
|
||||
var globalInfo = this.loadGlobalInfo() || [];
|
||||
if (globalInfo[saveFileId]) {
|
||||
this.setGradeVariable(globalInfo[saveFileId]);
|
||||
} else {
|
||||
globalInfo[saveFileId] = this.makeSavefileInfo();
|
||||
}
|
||||
this.saveGlobalInfo(globalInfo);
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// パラメータの取得と整形
|
||||
//=============================================================================
|
||||
var paramGradeVariable = getParamNumber(['GradeVariable', '進行度変数'], 1, 5000);
|
||||
var paramPriorityVariable = getParamNumber(['PriorityVariable', '優先度変数'], 0, 5000);
|
||||
var paramTitleGrades = [];
|
||||
paramTitleGrades.push(getParamNumber(['TitleGrade1', 'タイトル1の進行度']));
|
||||
paramTitleGrades.push(getParamNumber(['TitleGrade2', 'タイトル2の進行度']));
|
||||
paramTitleGrades.push(getParamNumber(['TitleGrade3', 'タイトル3の進行度']));
|
||||
var paramTitleImages = [];
|
||||
paramTitleImages.push(getParamString(['TitleImage1', 'タイトル1の画像']));
|
||||
paramTitleImages.push(getParamString(['TitleImage2', 'タイトル2の画像']));
|
||||
paramTitleImages.push(getParamString(['TitleImage3', 'タイトル3の画像']));
|
||||
var paramTitleBgms = [];
|
||||
paramTitleBgms.push(getParamString(['TitleBgm1', 'タイトル1のBGM']));
|
||||
paramTitleBgms.push(getParamString(['TitleBgm2', 'タイトル2のBGM']));
|
||||
paramTitleBgms.push(getParamString(['TitleBgm3', 'タイトル3のBGM']));
|
||||
paramTitleGrades = paramTitleGrades.concat(getParamArrayNumber(['TitleGradeAfter', '以降の進行度'])).reverse();
|
||||
paramTitleImages = paramTitleImages.concat(getParamArrayString(['TitleImageAfter', '以降の画像'])).reverse();
|
||||
paramTitleBgms = paramTitleBgms.concat(getParamArrayString(['TitleBgmAfter', '以降のBGM'])).reverse();
|
||||
DataManager.setGradeVariable = function (info) {
|
||||
info.gradeVariable = $gameVariables.value(paramGradeVariable);
|
||||
if (paramPriorityVariable > 0) {
|
||||
info.priorityVariable = $gameVariables.value(paramPriorityVariable);
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// DataManager
|
||||
// ゲーム進行状況を保存します。
|
||||
//=============================================================================
|
||||
var _DataManager_makeSavefileInfo = DataManager.makeSavefileInfo;
|
||||
DataManager.makeSavefileInfo = function () {
|
||||
var info = _DataManager_makeSavefileInfo.apply(this, arguments);
|
||||
this.setGradeVariable(info);
|
||||
return info;
|
||||
};
|
||||
var _DataManager_saveGlobalInfo = DataManager.saveGlobalInfo;
|
||||
DataManager.saveGlobalInfo = function (info) {
|
||||
_DataManager_saveGlobalInfo.apply(this, arguments);
|
||||
this._globalInfo = null;
|
||||
};
|
||||
|
||||
DataManager.getFirstPriorityGradeVariable = function () {
|
||||
this._loadGrade = true;
|
||||
var globalInfo = this.loadGlobalInfo().filter(function (data, id) {
|
||||
return this.isThisGameFile(id);
|
||||
}, this);
|
||||
this._loadGrade = false;
|
||||
var gradeVariable = 0;
|
||||
if (globalInfo && globalInfo.length > 0) {
|
||||
var sortedGlobalInfo = globalInfo.clone().sort(this._compareOrderForGradeVariable);
|
||||
if (sortedGlobalInfo[0]) {
|
||||
gradeVariable = sortedGlobalInfo[0].gradeVariable || 0;
|
||||
}
|
||||
}
|
||||
return gradeVariable;
|
||||
};
|
||||
//=============================================================================
|
||||
// Scene_Title
|
||||
// 進行状況が一定以上の場合、タイトル画像を差し替えます。
|
||||
//=============================================================================
|
||||
var _Scene_Title_initialize = Scene_Title.prototype.initialize;
|
||||
Scene_Title.prototype.initialize = function () {
|
||||
_Scene_Title_initialize.apply(this, arguments);
|
||||
this.changeTitleImage();
|
||||
this.changeTitleBgm();
|
||||
};
|
||||
|
||||
var _DataManager_loadGlobalInfo = DataManager.loadGlobalInfo;
|
||||
DataManager.loadGlobalInfo = function () {
|
||||
if (this._loadGrade) {
|
||||
if (!this._globalInfo) {
|
||||
try {
|
||||
var json = StorageManager.load(0);
|
||||
this._globalInfo = json ? JSON.parse(json) : [];
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
this._globalInfo = [];
|
||||
}
|
||||
}
|
||||
return this._globalInfo;
|
||||
} else {
|
||||
return _DataManager_loadGlobalInfo.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
Scene_Title.prototype.changeTitleImage = function () {
|
||||
var gradeVariable = DataManager.getFirstPriorityGradeVariable();
|
||||
if ($dataSystem.originalTitle1Name !== undefined) {
|
||||
$dataSystem.title1Name = $dataSystem.originalTitle1Name;
|
||||
}
|
||||
for (var i = 0, n = paramTitleGrades.length; i < n; i++) {
|
||||
if (paramTitleImages[i] && gradeVariable >= paramTitleGrades[i]) {
|
||||
$dataSystem.originalTitle1Name = $dataSystem.title1Name;
|
||||
$dataSystem.title1Name = paramTitleImages[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
DataManager._compareOrderForGradeVariable = function (a, b) {
|
||||
if (!a) {
|
||||
return 1;
|
||||
} else if (!b) {
|
||||
return -1;
|
||||
} else if (a.priorityVariable !== b.priorityVariable && paramPriorityVariable > 0) {
|
||||
return (b.priorityVariable || 0) - (a.priorityVariable || 0);
|
||||
} else {
|
||||
return (b.gradeVariable || 0) - (a.gradeVariable || 0);
|
||||
}
|
||||
};
|
||||
|
||||
DataManager.saveOnlyGradeVariable = function () {
|
||||
var saveFileId = this.lastAccessedSavefileId();
|
||||
var globalInfo = this.loadGlobalInfo() || [];
|
||||
if (globalInfo[saveFileId]) {
|
||||
this.setGradeVariable(globalInfo[saveFileId]);
|
||||
} else {
|
||||
globalInfo[saveFileId] = this.makeSavefileInfo();
|
||||
}
|
||||
this.saveGlobalInfo(globalInfo);
|
||||
};
|
||||
|
||||
DataManager.setGradeVariable = function (info) {
|
||||
info.gradeVariable = $gameVariables.value(paramGradeVariable);
|
||||
if (paramPriorityVariable > 0) {
|
||||
info.priorityVariable = $gameVariables.value(paramPriorityVariable);
|
||||
}
|
||||
};
|
||||
|
||||
var _DataManager_saveGlobalInfo = DataManager.saveGlobalInfo;
|
||||
DataManager.saveGlobalInfo = function (info) {
|
||||
_DataManager_saveGlobalInfo.apply(this, arguments);
|
||||
this._globalInfo = null;
|
||||
};
|
||||
|
||||
//=============================================================================
|
||||
// Scene_Title
|
||||
// 進行状況が一定以上の場合、タイトル画像を差し替えます。
|
||||
//=============================================================================
|
||||
var _Scene_Title_initialize = Scene_Title.prototype.initialize;
|
||||
Scene_Title.prototype.initialize = function () {
|
||||
_Scene_Title_initialize.apply(this, arguments);
|
||||
this.changeTitleImage();
|
||||
this.changeTitleBgm();
|
||||
};
|
||||
|
||||
Scene_Title.prototype.changeTitleImage = function () {
|
||||
var gradeVariable = DataManager.getFirstPriorityGradeVariable();
|
||||
if ($dataSystem.originalTitle1Name !== undefined) {
|
||||
$dataSystem.title1Name = $dataSystem.originalTitle1Name;
|
||||
}
|
||||
for (var i = 0, n = paramTitleGrades.length; i < n; i++) {
|
||||
if (paramTitleImages[i] && gradeVariable >= paramTitleGrades[i]) {
|
||||
$dataSystem.originalTitle1Name = $dataSystem.title1Name;
|
||||
$dataSystem.title1Name = paramTitleImages[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Title.prototype.changeTitleBgm = function () {
|
||||
var gradeVariable = DataManager.getFirstPriorityGradeVariable();
|
||||
if ($dataSystem.titleBgm.originalName !== undefined) {
|
||||
$dataSystem.titleBgm.name = $dataSystem.titleBgm.originalName;
|
||||
}
|
||||
for (var i = 0, n = paramTitleGrades.length; i < n; i++) {
|
||||
if (paramTitleBgms[i] && gradeVariable >= paramTitleGrades[i]) {
|
||||
$dataSystem.titleBgm.originalName = $dataSystem.titleBgm.name;
|
||||
$dataSystem.titleBgm.name = paramTitleBgms[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
Scene_Title.prototype.changeTitleBgm = function () {
|
||||
var gradeVariable = DataManager.getFirstPriorityGradeVariable();
|
||||
if ($dataSystem.titleBgm.originalName !== undefined) {
|
||||
$dataSystem.titleBgm.name = $dataSystem.titleBgm.originalName;
|
||||
}
|
||||
for (var i = 0, n = paramTitleGrades.length; i < n; i++) {
|
||||
if (paramTitleBgms[i] && gradeVariable >= paramTitleGrades[i]) {
|
||||
$dataSystem.titleBgm.originalName = $dataSystem.titleBgm.name;
|
||||
$dataSystem.titleBgm.name = paramTitleBgms[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
||||
|
|
|
|||
|
|
@ -75,125 +75,155 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
const Torigoya = (window.Torigoya = window.Torigoya || {});
|
||||
const Torigoya = (window.Torigoya = window.Torigoya || {});
|
||||
|
||||
function getPluginName() {
|
||||
const cs = document.currentScript;
|
||||
return cs ? cs.src.split('/').pop().replace(/\.js$/, '') : 'Torigoya_CommonMenu';
|
||||
}
|
||||
function getPluginName() {
|
||||
const cs = document.currentScript;
|
||||
return cs
|
||||
? cs.src.split("/").pop().replace(/\.js$/, "")
|
||||
: "Torigoya_CommonMenu";
|
||||
}
|
||||
|
||||
function pickStringValueFromParameter(parameter, key, defaultValue = '') {
|
||||
if (!parameter.hasOwnProperty(key)) return defaultValue;
|
||||
return `${parameter[key] || ''}`;
|
||||
}
|
||||
function pickStringValueFromParameter(parameter, key, defaultValue = "") {
|
||||
if (!parameter.hasOwnProperty(key)) return defaultValue;
|
||||
return `${parameter[key] || ""}`;
|
||||
}
|
||||
|
||||
function pickIntegerValueFromParameter(parameter, key, defaultValue = 0) {
|
||||
if (!parameter.hasOwnProperty(key) || parameter[key] === '') return defaultValue;
|
||||
return parseInt(parameter[key], 10);
|
||||
}
|
||||
function pickIntegerValueFromParameter(parameter, key, defaultValue = 0) {
|
||||
if (!parameter.hasOwnProperty(key) || parameter[key] === "")
|
||||
return defaultValue;
|
||||
return parseInt(parameter[key], 10);
|
||||
}
|
||||
|
||||
function pickBooleanValueFromParameter(parameter, key, defaultValue = 'false') {
|
||||
return `${parameter[key] || defaultValue}` === 'true';
|
||||
}
|
||||
function pickBooleanValueFromParameter(
|
||||
parameter,
|
||||
key,
|
||||
defaultValue = "false"
|
||||
) {
|
||||
return `${parameter[key] || defaultValue}` === "true";
|
||||
}
|
||||
|
||||
function pickNoteStringValueFromParameter(parameter, key, defaultValue = '') {
|
||||
if (!parameter.hasOwnProperty(key)) return defaultValue;
|
||||
return (parameter[key].startsWith('"') ? JSON.parse(parameter[key]) : parameter[key]) || '';
|
||||
}
|
||||
function pickNoteStringValueFromParameter(parameter, key, defaultValue = "") {
|
||||
if (!parameter.hasOwnProperty(key)) return defaultValue;
|
||||
return (
|
||||
(parameter[key].startsWith('"')
|
||||
? JSON.parse(parameter[key])
|
||||
: parameter[key]) || ""
|
||||
);
|
||||
}
|
||||
|
||||
function pickStructMenuItem(parameter) {
|
||||
parameter = parameter || {};
|
||||
if (typeof parameter === 'string') parameter = JSON.parse(parameter);
|
||||
return {
|
||||
name: pickStringValueFromParameter(parameter, 'name', ''),
|
||||
commonEvent: pickIntegerValueFromParameter(parameter, 'commonEvent', 0),
|
||||
switchId: pickIntegerValueFromParameter(parameter, 'switchId', 0),
|
||||
visibility: pickBooleanValueFromParameter(parameter, 'visibility', 'true'),
|
||||
note: pickNoteStringValueFromParameter(parameter, 'note', ''),
|
||||
};
|
||||
}
|
||||
function pickStructMenuItem(parameter) {
|
||||
parameter = parameter || {};
|
||||
if (typeof parameter === "string") parameter = JSON.parse(parameter);
|
||||
return {
|
||||
name: pickStringValueFromParameter(parameter, "name", ""),
|
||||
commonEvent: pickIntegerValueFromParameter(parameter, "commonEvent", 0),
|
||||
switchId: pickIntegerValueFromParameter(parameter, "switchId", 0),
|
||||
visibility: pickBooleanValueFromParameter(
|
||||
parameter,
|
||||
"visibility",
|
||||
"true"
|
||||
),
|
||||
note: pickNoteStringValueFromParameter(parameter, "note", ""),
|
||||
};
|
||||
}
|
||||
|
||||
function readParameter() {
|
||||
const parameter = PluginManager.parameters(getPluginName());
|
||||
return {
|
||||
version: '1.2.0',
|
||||
baseItems: ((parameters) => {
|
||||
parameters = parameters || [];
|
||||
if (typeof parameters === 'string') parameters = JSON.parse(parameters);
|
||||
return parameters.map((parameter) => {
|
||||
return pickStructMenuItem(parameter);
|
||||
});
|
||||
})(parameter.baseItems),
|
||||
};
|
||||
}
|
||||
function readParameter() {
|
||||
const parameter = PluginManager.parameters(getPluginName());
|
||||
return {
|
||||
version: "1.2.0",
|
||||
baseItems: ((parameters) => {
|
||||
parameters = parameters || [];
|
||||
if (typeof parameters === "string") parameters = JSON.parse(parameters);
|
||||
return parameters.map((parameter) => {
|
||||
return pickStructMenuItem(parameter);
|
||||
});
|
||||
})(parameter.baseItems),
|
||||
};
|
||||
}
|
||||
|
||||
Torigoya.CommonMenu = {
|
||||
name: getPluginName(),
|
||||
parameter: readParameter(),
|
||||
Torigoya.CommonMenu = {
|
||||
name: getPluginName(),
|
||||
parameter: readParameter(),
|
||||
};
|
||||
|
||||
(() => {
|
||||
/**
|
||||
* メニュー項目の追加
|
||||
* @param item
|
||||
* @param index
|
||||
*/
|
||||
Window_MenuCommand.prototype.torigoyaCommonMenu_addCommand = function (
|
||||
item,
|
||||
index
|
||||
) {
|
||||
const enabled = this.torigoyaCommonMenu_isEnable(item);
|
||||
if (!enabled && !this.torigoyaCommonMenu_isVisibility(item)) return;
|
||||
|
||||
this.addCommand(
|
||||
this.torigoyaCommonMenu_itemName(item),
|
||||
`TorigoyaCommonMenu_${index}`,
|
||||
enabled
|
||||
);
|
||||
};
|
||||
|
||||
(() => {
|
||||
/**
|
||||
* メニュー項目の追加
|
||||
* @param item
|
||||
* @param index
|
||||
*/
|
||||
Window_MenuCommand.prototype.torigoyaCommonMenu_addCommand = function (item, index) {
|
||||
const enabled = this.torigoyaCommonMenu_isEnable(item);
|
||||
if (!enabled && !this.torigoyaCommonMenu_isVisibility(item)) return;
|
||||
/**
|
||||
* メニュー項目が有効であるか?
|
||||
* @param item
|
||||
* @returns {boolean}
|
||||
*/
|
||||
Window_MenuCommand.prototype.torigoyaCommonMenu_isEnable = function (item) {
|
||||
return item.switchId
|
||||
? $gameSwitches.value(parseInt(item.switchId, 10))
|
||||
: true;
|
||||
};
|
||||
|
||||
this.addCommand(this.torigoyaCommonMenu_itemName(item), `TorigoyaCommonMenu_${index}`, enabled);
|
||||
};
|
||||
/**
|
||||
* メニュー項目が可視状態であるか?
|
||||
* @param item
|
||||
* @returns {boolean}
|
||||
*/
|
||||
Window_MenuCommand.prototype.torigoyaCommonMenu_isVisibility = function (
|
||||
item
|
||||
) {
|
||||
return item.visibility;
|
||||
};
|
||||
|
||||
/**
|
||||
* メニュー項目が有効であるか?
|
||||
* @param item
|
||||
* @returns {boolean}
|
||||
*/
|
||||
Window_MenuCommand.prototype.torigoyaCommonMenu_isEnable = function (item) {
|
||||
return item.switchId ? $gameSwitches.value(parseInt(item.switchId, 10)) : true;
|
||||
};
|
||||
/**
|
||||
* メニュー項目の名前を取得
|
||||
* @param item
|
||||
* @returns {string}
|
||||
*/
|
||||
Window_MenuCommand.prototype.torigoyaCommonMenu_itemName = function (item) {
|
||||
return item ? item.name : "";
|
||||
};
|
||||
|
||||
/**
|
||||
* メニュー項目が可視状態であるか?
|
||||
* @param item
|
||||
* @returns {boolean}
|
||||
*/
|
||||
Window_MenuCommand.prototype.torigoyaCommonMenu_isVisibility = function (item) {
|
||||
return item.visibility;
|
||||
};
|
||||
const upstream_Window_MenuCommand_addOriginalCommands =
|
||||
Window_MenuCommand.prototype.addOriginalCommands;
|
||||
Window_MenuCommand.prototype.addOriginalCommands = function () {
|
||||
upstream_Window_MenuCommand_addOriginalCommands.apply(this);
|
||||
|
||||
/**
|
||||
* メニュー項目の名前を取得
|
||||
* @param item
|
||||
* @returns {string}
|
||||
*/
|
||||
Window_MenuCommand.prototype.torigoyaCommonMenu_itemName = function (item) {
|
||||
return item ? item.name : '';
|
||||
};
|
||||
Torigoya.CommonMenu.parameter.baseItems.forEach(
|
||||
this.torigoyaCommonMenu_addCommand.bind(this)
|
||||
);
|
||||
};
|
||||
|
||||
const upstream_Window_MenuCommand_addOriginalCommands = Window_MenuCommand.prototype.addOriginalCommands;
|
||||
Window_MenuCommand.prototype.addOriginalCommands = function () {
|
||||
upstream_Window_MenuCommand_addOriginalCommands.apply(this);
|
||||
const upstream_Scene_Menu_createCommandWindow =
|
||||
Scene_Menu.prototype.createCommandWindow;
|
||||
Scene_Menu.prototype.createCommandWindow = function () {
|
||||
upstream_Scene_Menu_createCommandWindow.apply(this);
|
||||
|
||||
Torigoya.CommonMenu.parameter.baseItems.forEach(this.torigoyaCommonMenu_addCommand.bind(this));
|
||||
};
|
||||
Torigoya.CommonMenu.parameter.baseItems.forEach((item, i) => {
|
||||
const id = parseInt(item.commonEvent, 10);
|
||||
if (!id) return;
|
||||
|
||||
const upstream_Scene_Menu_createCommandWindow = Scene_Menu.prototype.createCommandWindow;
|
||||
Scene_Menu.prototype.createCommandWindow = function () {
|
||||
upstream_Scene_Menu_createCommandWindow.apply(this);
|
||||
|
||||
Torigoya.CommonMenu.parameter.baseItems.forEach((item, i) => {
|
||||
const id = parseInt(item.commonEvent, 10);
|
||||
if (!id) return;
|
||||
|
||||
this._commandWindow.setHandler(`TorigoyaCommonMenu_${i}`, () => {
|
||||
$gameTemp.reserveCommonEvent(id);
|
||||
SceneManager.goto(Scene_Map);
|
||||
});
|
||||
});
|
||||
};
|
||||
})();
|
||||
this._commandWindow.setHandler(`TorigoyaCommonMenu_${i}`, () => {
|
||||
$gameTemp.reserveCommonEvent(id);
|
||||
SceneManager.goto(Scene_Map);
|
||||
});
|
||||
});
|
||||
};
|
||||
})();
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -105,154 +105,164 @@
|
|||
*/
|
||||
|
||||
(function (global) {
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
var SaveCommand = {
|
||||
name: 'Torigoya_SaveCommand',
|
||||
settings: {},
|
||||
lastTimestamp: undefined,
|
||||
lastAccessId: undefined
|
||||
};
|
||||
var SaveCommand = {
|
||||
name: "Torigoya_SaveCommand",
|
||||
settings: {},
|
||||
lastTimestamp: undefined,
|
||||
lastAccessId: undefined,
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// SaveCommand
|
||||
// -------------------------------------------------------------------------
|
||||
// SaveCommand
|
||||
|
||||
/**
|
||||
* スロットID指定文字列からスロットIDを求める
|
||||
* @param {string} str
|
||||
* @returns {number}
|
||||
*/
|
||||
SaveCommand.parseSlotId = function (str) {
|
||||
var slotId, matches;
|
||||
if (matches = str.match(/^\[(\d+)\]$/)) {
|
||||
slotId = $gameVariables.value(~~matches[1]);
|
||||
} else if (str.match(/^\d+$/)) {
|
||||
slotId = ~~str;
|
||||
} else {
|
||||
switch (str) {
|
||||
case 'last':
|
||||
slotId = DataManager.lastAccessedSavefileId();
|
||||
break;
|
||||
case 'latest':
|
||||
slotId = DataManager.latestSavefileId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* スロットID指定文字列からスロットIDを求める
|
||||
* @param {string} str
|
||||
* @returns {number}
|
||||
*/
|
||||
SaveCommand.parseSlotId = function (str) {
|
||||
var slotId, matches;
|
||||
if ((matches = str.match(/^\[(\d+)\]$/))) {
|
||||
slotId = $gameVariables.value(~~matches[1]);
|
||||
} else if (str.match(/^\d+$/)) {
|
||||
slotId = ~~str;
|
||||
} else {
|
||||
switch (str) {
|
||||
case "last":
|
||||
slotId = DataManager.lastAccessedSavefileId();
|
||||
break;
|
||||
case "latest":
|
||||
slotId = DataManager.latestSavefileId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (~~slotId <= 0) {
|
||||
throw '[Torigoya_SaveCommand.js] invalid SlotId: ' + slotId;
|
||||
}
|
||||
if (~~slotId <= 0) {
|
||||
throw "[Torigoya_SaveCommand.js] invalid SlotId: " + slotId;
|
||||
}
|
||||
|
||||
return slotId;
|
||||
};
|
||||
return slotId;
|
||||
};
|
||||
|
||||
/**
|
||||
* セーブ系コマンド処理の実行
|
||||
* @param {Game_Interpreter} gameInterpreter
|
||||
* @param {string} type
|
||||
* @param {number} slotId
|
||||
* @param {boolean} skipTimestamp
|
||||
*/
|
||||
SaveCommand.runCommand = function (gameInterpreter, type, slotId, skipTimestamp) {
|
||||
switch (type) {
|
||||
case 'load':
|
||||
this.runCommandLoad(gameInterpreter, slotId);
|
||||
break;
|
||||
case 'save':
|
||||
this.runCommandSave(gameInterpreter, slotId, skipTimestamp);
|
||||
break;
|
||||
case 'remove':
|
||||
this.runCommandRemove(gameInterpreter, slotId);
|
||||
break;
|
||||
}
|
||||
};
|
||||
/**
|
||||
* セーブ系コマンド処理の実行
|
||||
* @param {Game_Interpreter} gameInterpreter
|
||||
* @param {string} type
|
||||
* @param {number} slotId
|
||||
* @param {boolean} skipTimestamp
|
||||
*/
|
||||
SaveCommand.runCommand = function (
|
||||
gameInterpreter,
|
||||
type,
|
||||
slotId,
|
||||
skipTimestamp
|
||||
) {
|
||||
switch (type) {
|
||||
case "load":
|
||||
this.runCommandLoad(gameInterpreter, slotId);
|
||||
break;
|
||||
case "save":
|
||||
this.runCommandSave(gameInterpreter, slotId, skipTimestamp);
|
||||
break;
|
||||
case "remove":
|
||||
this.runCommandRemove(gameInterpreter, slotId);
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* ロード処理
|
||||
* @note ちょっと無理やり感があるのでイベントの組み方次第ではまずそう
|
||||
* @param {Game_Interpreter} gameInterpreter
|
||||
* @param {number} slotId
|
||||
*/
|
||||
SaveCommand.runCommandLoad = function (gameInterpreter, slotId) {
|
||||
if (!DataManager.isThisGameFile(slotId)) return;
|
||||
/**
|
||||
* ロード処理
|
||||
* @note ちょっと無理やり感があるのでイベントの組み方次第ではまずそう
|
||||
* @param {Game_Interpreter} gameInterpreter
|
||||
* @param {number} slotId
|
||||
*/
|
||||
SaveCommand.runCommandLoad = function (gameInterpreter, slotId) {
|
||||
if (!DataManager.isThisGameFile(slotId)) return;
|
||||
|
||||
var scene = SceneManager._scene;
|
||||
scene.fadeOutAll();
|
||||
DataManager.loadGame(slotId);
|
||||
gameInterpreter.command115(); // 今のイベントが継続しないように中断コマンドを実行する
|
||||
Scene_Load.prototype.reloadMapIfUpdated.apply(scene);
|
||||
SceneManager.goto(Scene_Map);
|
||||
$gameSystem.onAfterLoad();
|
||||
};
|
||||
var scene = SceneManager._scene;
|
||||
scene.fadeOutAll();
|
||||
DataManager.loadGame(slotId);
|
||||
gameInterpreter.command115(); // 今のイベントが継続しないように中断コマンドを実行する
|
||||
Scene_Load.prototype.reloadMapIfUpdated.apply(scene);
|
||||
SceneManager.goto(Scene_Map);
|
||||
$gameSystem.onAfterLoad();
|
||||
};
|
||||
|
||||
/**
|
||||
* セーブ処理
|
||||
* @param {Game_Interpreter} gameInterpreter
|
||||
* @param {number} slotId
|
||||
* @param {boolean} skipTimestamp
|
||||
*/
|
||||
SaveCommand.runCommandSave = function (gameInterpreter, slotId, skipTimestamp) {
|
||||
if (skipTimestamp) {
|
||||
var info = DataManager.loadSavefileInfo(slotId);
|
||||
SaveCommand.lastTimestamp = info && info.timestamp ? info.timestamp : 0;
|
||||
SaveCommand.lastAccessId = DataManager.lastAccessedSavefileId();
|
||||
}
|
||||
/**
|
||||
* セーブ処理
|
||||
* @param {Game_Interpreter} gameInterpreter
|
||||
* @param {number} slotId
|
||||
* @param {boolean} skipTimestamp
|
||||
*/
|
||||
SaveCommand.runCommandSave = function (
|
||||
gameInterpreter,
|
||||
slotId,
|
||||
skipTimestamp
|
||||
) {
|
||||
if (skipTimestamp) {
|
||||
var info = DataManager.loadSavefileInfo(slotId);
|
||||
SaveCommand.lastTimestamp = info && info.timestamp ? info.timestamp : 0;
|
||||
SaveCommand.lastAccessId = DataManager.lastAccessedSavefileId();
|
||||
}
|
||||
|
||||
// そのままセーブしてしまうと
|
||||
// ロード時にもプラグインコマンドが呼び出されてしまうため
|
||||
// 次の行のイベントコマンドから始まるように細工する
|
||||
var originalIndex = gameInterpreter._index;
|
||||
gameInterpreter._index++;
|
||||
// そのままセーブしてしまうと
|
||||
// ロード時にもプラグインコマンドが呼び出されてしまうため
|
||||
// 次の行のイベントコマンドから始まるように細工する
|
||||
var originalIndex = gameInterpreter._index;
|
||||
gameInterpreter._index++;
|
||||
|
||||
$gameSystem.onBeforeSave();
|
||||
if (DataManager.saveGame(slotId) && StorageManager.cleanBackup) {
|
||||
StorageManager.cleanBackup(slotId);
|
||||
}
|
||||
$gameSystem.onBeforeSave();
|
||||
if (DataManager.saveGame(slotId) && StorageManager.cleanBackup) {
|
||||
StorageManager.cleanBackup(slotId);
|
||||
}
|
||||
|
||||
if (skipTimestamp) {
|
||||
DataManager._lastAccessedId = SaveCommand.lastAccessId;
|
||||
SaveCommand.lastTimestamp = undefined;
|
||||
SaveCommand.lastAccessId = undefined;
|
||||
}
|
||||
if (skipTimestamp) {
|
||||
DataManager._lastAccessedId = SaveCommand.lastAccessId;
|
||||
SaveCommand.lastTimestamp = undefined;
|
||||
SaveCommand.lastAccessId = undefined;
|
||||
}
|
||||
|
||||
// 細工した分を戻す
|
||||
gameInterpreter._index = originalIndex;
|
||||
};
|
||||
// 細工した分を戻す
|
||||
gameInterpreter._index = originalIndex;
|
||||
};
|
||||
|
||||
/**
|
||||
* セーブファイルの削除処理
|
||||
* @param {Game_Interpreter} _
|
||||
* @param {number} slotId
|
||||
*/
|
||||
SaveCommand.runCommandRemove = function (_, slotId) {
|
||||
StorageManager.remove(slotId);
|
||||
};
|
||||
/**
|
||||
* セーブファイルの削除処理
|
||||
* @param {Game_Interpreter} _
|
||||
* @param {number} slotId
|
||||
*/
|
||||
SaveCommand.runCommandRemove = function (_, slotId) {
|
||||
StorageManager.remove(slotId);
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
// alias
|
||||
// -------------------------------------------------------------------------
|
||||
// alias
|
||||
|
||||
var upstream_DataManager_makeSavefileInfo = DataManager.makeSavefileInfo;
|
||||
DataManager.makeSavefileInfo = function () {
|
||||
var info = upstream_DataManager_makeSavefileInfo.apply(this);
|
||||
if (SaveCommand.lastTimestamp !== undefined) {
|
||||
info.timestamp = SaveCommand.lastTimestamp;
|
||||
}
|
||||
return info;
|
||||
};
|
||||
var upstream_DataManager_makeSavefileInfo = DataManager.makeSavefileInfo;
|
||||
DataManager.makeSavefileInfo = function () {
|
||||
var info = upstream_DataManager_makeSavefileInfo.apply(this);
|
||||
if (SaveCommand.lastTimestamp !== undefined) {
|
||||
info.timestamp = SaveCommand.lastTimestamp;
|
||||
}
|
||||
return info;
|
||||
};
|
||||
|
||||
var upstream_Game_Interpreter_pluginCommand = Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
if (command === 'SaveCommand') {
|
||||
var type = (args[0] || '').trim();
|
||||
var slotId = SaveCommand.parseSlotId((args[1] || '').trim());
|
||||
var skipTimestamp = (args[2] === 'notime');
|
||||
SaveCommand.runCommand(this, type, slotId, skipTimestamp);
|
||||
return;
|
||||
}
|
||||
upstream_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
};
|
||||
var upstream_Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
if (command === "SaveCommand") {
|
||||
var type = (args[0] || "").trim();
|
||||
var slotId = SaveCommand.parseSlotId((args[1] || "").trim());
|
||||
var skipTimestamp = args[2] === "notime";
|
||||
SaveCommand.runCommand(this, type, slotId, skipTimestamp);
|
||||
return;
|
||||
}
|
||||
upstream_Game_Interpreter_pluginCommand.apply(this, arguments);
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
global.Torigoya = (global.Torigoya || {});
|
||||
global.Torigoya.SaveCommand = SaveCommand;
|
||||
// -------------------------------------------------------------------------
|
||||
global.Torigoya = global.Torigoya || {};
|
||||
global.Torigoya.SaveCommand = SaveCommand;
|
||||
})(window);
|
||||
|
|
|
|||
|
|
@ -12,44 +12,44 @@
|
|||
/*:
|
||||
* @plugindesc Create a share save data. Share state of game switch and variables between each save data.
|
||||
* @author T.Akatsuki
|
||||
*
|
||||
*
|
||||
* @param Target Switches
|
||||
* @desc Set target switch index number.
|
||||
* If you want to set multiple, put comma between indexes.
|
||||
* Using "-", the range can be specified.
|
||||
* (ex) 1-3,11,12,13,20,21
|
||||
* @default
|
||||
*
|
||||
* @default
|
||||
*
|
||||
* @param Target Variables
|
||||
* @desc Set target variable index number.
|
||||
* If you want to set multiple, put comma between indexes.
|
||||
* Using "-", the range can be specified.
|
||||
* (ex) 1-5,11,12,13,23,24
|
||||
* @default
|
||||
*
|
||||
* @default
|
||||
*
|
||||
* @param Is Auto
|
||||
* @desc Automatically to set save / load common save data on save / load timing.
|
||||
* true : Automatically common save data is saved/loaded on save / load timing.
|
||||
* false : Save and load of common save data you do manually.
|
||||
* @default true
|
||||
*
|
||||
*
|
||||
* @param Auto on Gameover
|
||||
* @desc If auto saving common save data is enabled , it automatically saves common save data on gameover.
|
||||
* true : It save common save data on game over.
|
||||
* false : It do nothing on game over.
|
||||
* false : It do nothing on game over.
|
||||
* @default false
|
||||
*
|
||||
*
|
||||
* @param Show Trace
|
||||
* @desc Set state traces display.
|
||||
* true : Show trace., false : Don't show trace.
|
||||
* @default false
|
||||
*
|
||||
*
|
||||
* @help # Overview
|
||||
* Create a share save data. Share state of game switch and variables between each save data.
|
||||
* If you use plugin command, you can operate common save data at any time.
|
||||
*
|
||||
*
|
||||
* Common save data will be saved with a name "common.rpgsave" below save directory.
|
||||
*
|
||||
*
|
||||
* # Parameters
|
||||
* Target Switches [Switch No, ...]
|
||||
* Set target switch index number.
|
||||
|
|
@ -57,50 +57,50 @@
|
|||
* Using "-", the range can be specified.
|
||||
* (Ex) 1-3,11,12,13,20,21
|
||||
* => number 1,2,3,11,12,13,20,21 switches are target.
|
||||
*
|
||||
*
|
||||
* Target Variables [Valiable No, ...]
|
||||
* Set target variable index number.
|
||||
* If you want to set multiple, put comma between indexes.
|
||||
* Using "-", the range can be specified.
|
||||
* (Ex) 1-3,11,12,13,14,15
|
||||
* => number 1,2,3,11,12,13,14,15 variables are target.
|
||||
*
|
||||
*
|
||||
* Is Auto [true|false]
|
||||
* Automatically to set save / load common save data on save / load timing.
|
||||
*
|
||||
*
|
||||
* Auto on Gameover [true|false]
|
||||
* If auto saving common save data is enabled , it automatically saves common save data on gameover.
|
||||
*
|
||||
*
|
||||
* Show Trace [true|false]
|
||||
* Set whether the issue a trace for debugging.
|
||||
*
|
||||
*
|
||||
* # Plugin Command
|
||||
* CommonSave load # Read GameSwitches and GameVariables from common save data and apply game data.
|
||||
* # This command is used when you want to load common save data at any time.
|
||||
* CommonSave save # Save target GameSwitches and GameVariables common save data.
|
||||
* # This command is used when you want to save in common save data at any time.
|
||||
* CommonSave remove # Remove common save data file.
|
||||
*
|
||||
*
|
||||
* CommonSave setTrace [true|false] # Setting to enabled trace on console.
|
||||
*
|
||||
*
|
||||
* CommonSave check # Show sharing target switches and variables to console.
|
||||
*
|
||||
*
|
||||
* # Change Log
|
||||
* ver 1.20 (2016.05.11)
|
||||
* Using "-", the range can be specified.
|
||||
* Add setTrace plugin command.
|
||||
* Add check plugin command.
|
||||
*
|
||||
*
|
||||
* ver 1.10 (Fed 17, 2016)
|
||||
* Rename to UTA_CommonSave.js.
|
||||
* To be able to set trace in the parameter.
|
||||
*
|
||||
*
|
||||
* ver1.01 (Jan 14, 2016)
|
||||
* Fixed bug where could not share variables.
|
||||
*
|
||||
*
|
||||
* ver1.00 (Dec 31, 2015)
|
||||
* To ver1.00 according to the Japanese version of RPG Maker MV.
|
||||
*
|
||||
*
|
||||
* ver0.01 (Nov 05, 2015)
|
||||
* Initial release.
|
||||
*/
|
||||
|
|
@ -108,67 +108,67 @@
|
|||
/*:ja
|
||||
* @plugindesc 共有のセーブデータを作成し、指定したスイッチ・変数の状態をセーブデータ間で共有します。
|
||||
* @author 赤月 智平
|
||||
*
|
||||
*
|
||||
* @param Target Switches
|
||||
* @desc 対象となるスイッチの番号を指定します。
|
||||
* カンマ区切りで複数指定、ハイフンで範囲指定が可能です。
|
||||
* (例) 1-3,11,12,13,20,21
|
||||
* @default
|
||||
*
|
||||
* @default
|
||||
*
|
||||
* @param Target Variables
|
||||
* @desc 対象となる変数の番号を指定します。
|
||||
* カンマ区切りで複数指定、ハイフンで範囲指定が可能です。
|
||||
* (例) 1-5,11,12,13,23,24
|
||||
* @default
|
||||
*
|
||||
* @default
|
||||
*
|
||||
* @param Is Auto
|
||||
* @desc セーブ・ロード時に自動的に共通セーブデータのセーブ・ロードを行うかを設定します。
|
||||
* true : セーブ・ロード時に自動的に共有セーブデータにデータのセーブ・ロードを行う。
|
||||
* false : 共通セーブデータのセーブ・ロードは手動で行う。
|
||||
* @default true
|
||||
*
|
||||
*
|
||||
* @param Auto on Gameover
|
||||
* @desc 自動セーブ設定がONの時にゲームオーバー時に共有セーブデータの自動セーブを行うかを設定します。
|
||||
* true : ゲームオーバー時に自動共有セーブを行う。
|
||||
* false : ゲームオーバー時は自動共有セーブを行わない。
|
||||
* @default false
|
||||
*
|
||||
*
|
||||
* @param Show Trace
|
||||
* @desc デバッグ用のトレースを出すかを設定します。
|
||||
* true: トレースを表示, false: トレースを表示しない
|
||||
* @default false
|
||||
*
|
||||
*
|
||||
* @help ■概要
|
||||
* CommonSaveプラグインは共有セーブデータを作成し、指定したスイッチ・変数の状態をセーブデータ間で共有する事ができます。
|
||||
* 基本的にはセーブ・ロード時に設定に応じて自動的に処理してくれます。
|
||||
* プラグインコマンドを利用すると、任意のタイミングで共有セーブデータの操作を行う事ができます。
|
||||
*
|
||||
* 共有セーブデータはsaveディレクトリ以下に「common.rpgsave」という名前で保存されます。
|
||||
*
|
||||
*
|
||||
* ■パラメータの説明
|
||||
* Target Switches [スイッチ番号, ...]
|
||||
* 共有したいスイッチの番号を指定します。「,」で区切り複数の値を指定する事ができます。
|
||||
* 「-」で数値の範囲を指定する事も可能です。
|
||||
* (例) 1-3,11,12,13,20,21
|
||||
* => 1,2,3,11,12,13,20,21番のスイッチが対象になる。
|
||||
*
|
||||
*
|
||||
* Target Variables [変数番号, ...]
|
||||
* 共有したい変数の番号を指定します。「,」で区切り複数の値を指定する事ができます。
|
||||
* 「-」で数値の範囲を指定する事も可能です。
|
||||
* (例) 1-3,11,12,13,14,15
|
||||
* => 1,2,3,11,12,13,14,15番の変数が対象になる。
|
||||
*
|
||||
*
|
||||
* Is Auto [true|false]
|
||||
* セーブ・ロード時に自動的に共通セーブデータのセーブ・ロードを行うかを設定します。
|
||||
* デフォルトではtrue(セーブ・ロード時に自動的に共有セーブ・ロードを行う)になっています。
|
||||
*
|
||||
*
|
||||
* Auto on Gameover [true|false]
|
||||
* 自動セーブ設定がONの時にゲームオーバー時に共有セーブデータの自動セーブを行うかを設定します。
|
||||
* デフォルトではfalse(ゲームオーバー時に自動共有セーブを行わない)になっています。
|
||||
*
|
||||
*
|
||||
* Show Trace [true|false]
|
||||
* デバッグ用のトレースを出すかを設定します。
|
||||
*
|
||||
*
|
||||
* ■プラグインコマンド
|
||||
* CommonSave load # 共有セーブデータからスイッチ・変数を読み込み反映させます。
|
||||
* # 任意のタイミングで共有セーブデータのロードを行いたい場合に使用します。
|
||||
|
|
@ -179,23 +179,23 @@
|
|||
* CommonSave setTrace [true|false] # コンソールにトレースを出力するかを設定します。
|
||||
* # ゲーム実行中にトレース状態を切り替えたい場合に使用します。
|
||||
* CommonSave check # 共有状態になっているスイッチ・変数番号をコンソールに表示し確認します。
|
||||
*
|
||||
*
|
||||
* ■更新履歴
|
||||
* ver 1.20 (2016.05.11)
|
||||
* スイッチ・変数の指定の際に「-」を使う事で範囲指定を可能に。
|
||||
* トレース状態を動的に変えられるように setTrace プラグインコマンドを追加。
|
||||
* 共有対象になっているスイッチ・変数を確認できる check プラグインコマンドを追加。
|
||||
*
|
||||
*
|
||||
* ver 1.10 (2016.02.17)
|
||||
* ファイル名をUTA_CommonSave.jsに変更。
|
||||
* トレース出力の有無をパラメータで設定できるように。
|
||||
*
|
||||
*
|
||||
* ver 1.01 (2016.01.14)
|
||||
* 変数の共有が上手くできていないバグの修正。
|
||||
*
|
||||
*
|
||||
* ver 1.00 (2015.12.31)
|
||||
* 日本語版RPGツクールMVの発売に合わせver1.00に。
|
||||
*
|
||||
*
|
||||
* ver 0.01 (2015.11.05)
|
||||
* 初版。
|
||||
*/
|
||||
|
|
@ -208,395 +208,422 @@ var utakata = utakata || (utakata = {});
|
|||
// class CommonSaveManager
|
||||
//-----------------------------------------------------------------------------
|
||||
(function (utakata) {
|
||||
var CommonSaveManager = (function () {
|
||||
//constructor
|
||||
function CommonSaveManager() {
|
||||
//member variables
|
||||
this._targetSwitchList = [];
|
||||
this._targetVariableList = [];
|
||||
var CommonSaveManager = (function () {
|
||||
//constructor
|
||||
function CommonSaveManager() {
|
||||
//member variables
|
||||
this._targetSwitchList = [];
|
||||
this._targetVariableList = [];
|
||||
|
||||
this._showTrace = false;
|
||||
this._tr = null;
|
||||
this._showTrace = false;
|
||||
this._tr = null;
|
||||
|
||||
this.initialize();
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
//private methods
|
||||
CommonSaveManager.prototype.initialize = function () {
|
||||
this.parameters = PluginManager.parameters("UTA_CommonSave");
|
||||
|
||||
this._showTrace = String(this.parameters["Show Trace"]) === "true";
|
||||
|
||||
this._tr = function (s) {
|
||||
if (!this._showTrace) {
|
||||
return;
|
||||
}
|
||||
var str = "CommonSaveManager: " + s;
|
||||
console.log(str);
|
||||
};
|
||||
|
||||
var targetSwitchStr = String(this.parameters["Target Switches"]);
|
||||
var targetVariableStr = String(this.parameters["Target Variables"]);
|
||||
|
||||
this._targetSwitchList = this._parseTargetNumber(targetSwitchStr);
|
||||
this._targetVariableList = this._parseTargetNumber(targetVariableStr);
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype._parseTargetNumber = function (str) {
|
||||
if (typeof str === "undefined" || str === "undefined") {
|
||||
return [];
|
||||
}
|
||||
|
||||
str = str.replace(/\s+/g, "");
|
||||
|
||||
var split_str = ",";
|
||||
var rgn_split_str = "-";
|
||||
|
||||
var indexes = str.split(split_str, -1);
|
||||
var ret = [];
|
||||
|
||||
var parseTargetNumbersFromRegion = function (rgn_target) {
|
||||
var ret = [];
|
||||
var target_number = rgn_target.split(rgn_split_str, -1);
|
||||
if (
|
||||
typeof target_number[0] === "undefined" ||
|
||||
typeof target_number[1] === "undefined"
|
||||
) {
|
||||
return [];
|
||||
}
|
||||
|
||||
//private methods
|
||||
CommonSaveManager.prototype.initialize = function () {
|
||||
this.parameters = PluginManager.parameters('UTA_CommonSave');
|
||||
var s_number = parseInt(target_number[0]);
|
||||
if (s_number !== s_number) {
|
||||
this._tr(
|
||||
"_parseTargetNumber getTargetNumbersFromRegion: Setting parameter is invalid."
|
||||
);
|
||||
return [];
|
||||
}
|
||||
|
||||
this._showTrace = (String(this.parameters['Show Trace']) === "true");
|
||||
var e_number = parseInt(target_number[1]);
|
||||
if (e_number !== e_number) {
|
||||
this._tr(
|
||||
"_parseTargetNumber getTargetNumbersFromRegion: Setting parameter is invalid."
|
||||
);
|
||||
return [];
|
||||
}
|
||||
|
||||
this._tr = function (s) {
|
||||
if (!this._showTrace) { return; }
|
||||
var str = "CommonSaveManager: " + s; console.log(str);
|
||||
};
|
||||
for (var i = s_number; i <= e_number; i++) {
|
||||
ret.push(i);
|
||||
}
|
||||
|
||||
var targetSwitchStr = String(this.parameters['Target Switches']);
|
||||
var targetVariableStr = String(this.parameters['Target Variables']);
|
||||
return ret;
|
||||
};
|
||||
|
||||
this._targetSwitchList = this._parseTargetNumber(targetSwitchStr);
|
||||
this._targetVariableList = this._parseTargetNumber(targetVariableStr);
|
||||
};
|
||||
for (var i = 0; i < indexes.length; i++) {
|
||||
var rgn_target = indexes[i].match(/\d+-\d+/g);
|
||||
if (!!rgn_target) {
|
||||
var parseIndexes = parseTargetNumbersFromRegion(rgn_target[0]);
|
||||
if (parseIndexes.length <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CommonSaveManager.prototype._parseTargetNumber = function (str) {
|
||||
if (typeof str === "undefined" || str === "undefined") { return []; }
|
||||
ret = ret.concat(parseIndexes);
|
||||
} else {
|
||||
var parseIndex = parseInt(indexes[i]);
|
||||
if (parseIndex !== parseIndex) {
|
||||
this._tr("_parseTargetNumber: Setting parameter is invalid.");
|
||||
continue;
|
||||
}
|
||||
ret.push(parseIndex);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
str = str.replace(/\s+/g, "");
|
||||
CommonSaveManager.prototype._getTargetSwitchJson = function () {
|
||||
var json = {};
|
||||
|
||||
var split_str = ',';
|
||||
var rgn_split_str = '-';
|
||||
for (var i = 0; i < this._targetSwitchList.length; i++) {
|
||||
var idx = this._targetSwitchList[i].toString();
|
||||
var value = $gameSwitches.value(idx);
|
||||
json[idx] = value;
|
||||
}
|
||||
|
||||
var indexes = str.split(split_str, -1);
|
||||
var ret = [];
|
||||
return json;
|
||||
};
|
||||
|
||||
var parseTargetNumbersFromRegion = function (rgn_target) {
|
||||
var ret = [];
|
||||
var target_number = rgn_target.split(rgn_split_str, -1);
|
||||
if (typeof target_number[0] === "undefined" || typeof target_number[1] === "undefined") { return []; }
|
||||
CommonSaveManager.prototype._getTargetVariableJson = function () {
|
||||
var json = {};
|
||||
|
||||
var s_number = parseInt(target_number[0]);
|
||||
if (s_number !== s_number) {
|
||||
this._tr("_parseTargetNumber getTargetNumbersFromRegion: Setting parameter is invalid.");
|
||||
return [];
|
||||
}
|
||||
for (var i = 0; i < this._targetVariableList.length; i++) {
|
||||
var idx = this._targetVariableList[i].toString();
|
||||
var value = $gameVariables.value(idx);
|
||||
json[idx] = value;
|
||||
}
|
||||
|
||||
var e_number = parseInt(target_number[1]);
|
||||
if (e_number !== e_number) {
|
||||
this._tr("_parseTargetNumber getTargetNumbersFromRegion: Setting parameter is invalid.");
|
||||
return [];
|
||||
}
|
||||
return json;
|
||||
};
|
||||
|
||||
for (var i = s_number; i <= e_number; i++) {
|
||||
ret.push(i);
|
||||
}
|
||||
CommonSaveManager.prototype.setLoadSwitches = function (switches) {
|
||||
for (var key in switches) {
|
||||
var idx = parseInt(key);
|
||||
var value = switches[key];
|
||||
$gameSwitches.setValue(idx, value);
|
||||
}
|
||||
};
|
||||
|
||||
return ret;
|
||||
};
|
||||
CommonSaveManager.prototype.setLoadVariables = function (variables) {
|
||||
for (var key in variables) {
|
||||
var idx = parseInt(key);
|
||||
var value = variables[key];
|
||||
$gameVariables.setValue(idx, value);
|
||||
}
|
||||
};
|
||||
|
||||
for (var i = 0; i < indexes.length; i++) {
|
||||
var rgn_target = indexes[i].match(/\d+-\d+/g);
|
||||
if (!!rgn_target) {
|
||||
var parseIndexes = parseTargetNumbersFromRegion(rgn_target[0]);
|
||||
if (parseIndexes.length <= 0) { continue; }
|
||||
//public methods
|
||||
CommonSaveManager.prototype.load = function () {
|
||||
this._tr("load common save data.");
|
||||
|
||||
ret = ret.concat(parseIndexes);
|
||||
} else {
|
||||
var parseIndex = parseInt(indexes[i]);
|
||||
if (parseIndex !== parseIndex) {
|
||||
this._tr("_parseTargetNumber: Setting parameter is invalid.");
|
||||
continue;
|
||||
}
|
||||
ret.push(parseIndex);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
if (!this.exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CommonSaveManager.prototype._getTargetSwitchJson = function () {
|
||||
var json = {};
|
||||
var loadData = DataManager.loadCommonSave();
|
||||
|
||||
for (var i = 0; i < this._targetSwitchList.length; i++) {
|
||||
var idx = this._targetSwitchList[i].toString();
|
||||
var value = $gameSwitches.value(idx);
|
||||
json[idx] = value;
|
||||
}
|
||||
if ("gameSwitches" in loadData) {
|
||||
this.setLoadSwitches(loadData["gameSwitches"]);
|
||||
}
|
||||
if ("gameVariables" in loadData) {
|
||||
this.setLoadVariables(loadData["gameVariables"]);
|
||||
}
|
||||
};
|
||||
|
||||
return json;
|
||||
};
|
||||
CommonSaveManager.prototype.save = function () {
|
||||
this._tr("save common save data.");
|
||||
|
||||
CommonSaveManager.prototype._getTargetVariableJson = function () {
|
||||
var json = {};
|
||||
var switchesJson = this._getTargetSwitchJson();
|
||||
var variablesJson = this._getTargetVariableJson();
|
||||
|
||||
for (var i = 0; i < this._targetVariableList.length; i++) {
|
||||
var idx = this._targetVariableList[i].toString();
|
||||
var value = $gameVariables.value(idx);
|
||||
json[idx] = value;
|
||||
}
|
||||
var json = {
|
||||
gameSwitches: switchesJson,
|
||||
gameVariables: variablesJson,
|
||||
};
|
||||
|
||||
return json;
|
||||
};
|
||||
DataManager.saveCommonSave(json);
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype.setLoadSwitches = function (switches) {
|
||||
for (var key in switches) {
|
||||
var idx = parseInt(key);
|
||||
var value = switches[key];
|
||||
$gameSwitches.setValue(idx, value);
|
||||
}
|
||||
};
|
||||
CommonSaveManager.prototype.exists = function () {
|
||||
this._tr("check exists common save data.");
|
||||
return StorageManager.existsCommonSave();
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype.setLoadVariables = function (variables) {
|
||||
for (var key in variables) {
|
||||
var idx = parseInt(key);
|
||||
var value = variables[key];
|
||||
$gameVariables.setValue(idx, value);
|
||||
}
|
||||
};
|
||||
CommonSaveManager.prototype.remove = function () {
|
||||
this._tr("remove common save data.");
|
||||
StorageManager.removeCommonSave();
|
||||
};
|
||||
|
||||
//public methods
|
||||
CommonSaveManager.prototype.load = function () {
|
||||
this._tr("load common save data.");
|
||||
CommonSaveManager.prototype.setShowTrace = function (args) {
|
||||
if (!args) {
|
||||
return;
|
||||
}
|
||||
var enabled = String(args[1]) === "true" ? true : false;
|
||||
this._tr("setShowTrace: " + this._showTrace);
|
||||
this._showTrace = enabled;
|
||||
};
|
||||
|
||||
if (!this.exists()) { return false; }
|
||||
CommonSaveManager.prototype.check = function () {
|
||||
var str = "CommonSaveManager: \n";
|
||||
str += " # Share switch targets : \n";
|
||||
str += JSON.stringify(this._targetSwitchList);
|
||||
|
||||
var loadData = DataManager.loadCommonSave();
|
||||
str += "\n # Share variable targets : \n";
|
||||
str += JSON.stringify(this._targetVariableList);
|
||||
|
||||
if ("gameSwitches" in loadData) {
|
||||
this.setLoadSwitches(loadData["gameSwitches"]);
|
||||
}
|
||||
if ("gameVariables" in loadData) {
|
||||
this.setLoadVariables(loadData["gameVariables"]);
|
||||
}
|
||||
};
|
||||
console.log(str);
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype.save = function () {
|
||||
this._tr("save common save data.");
|
||||
CommonSaveManager.prototype.isAuto = function () {
|
||||
return String(this.parameters["Is Auto"]) === "true";
|
||||
};
|
||||
|
||||
var switchesJson = this._getTargetSwitchJson();
|
||||
var variablesJson = this._getTargetVariableJson();
|
||||
|
||||
var json = {
|
||||
"gameSwitches": switchesJson,
|
||||
"gameVariables": variablesJson
|
||||
};
|
||||
|
||||
DataManager.saveCommonSave(json);
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype.exists = function () {
|
||||
this._tr("check exists common save data.");
|
||||
return StorageManager.existsCommonSave();
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype.remove = function () {
|
||||
this._tr("remove common save data.");
|
||||
StorageManager.removeCommonSave();
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype.setShowTrace = function (args) {
|
||||
if (!args) { return; }
|
||||
var enabled = String(args[1]) === "true" ? true : false;
|
||||
this._tr("setShowTrace: " + this._showTrace);
|
||||
this._showTrace = enabled;
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype.check = function () {
|
||||
var str = "CommonSaveManager: \n";
|
||||
str += " # Share switch targets : \n";
|
||||
str += JSON.stringify(this._targetSwitchList);
|
||||
|
||||
str += "\n # Share variable targets : \n";
|
||||
str += JSON.stringify(this._targetVariableList);
|
||||
|
||||
console.log(str);
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype.isAuto = function () {
|
||||
return String(this.parameters['Is Auto']) === "true";
|
||||
};
|
||||
|
||||
CommonSaveManager.prototype.isAutoOnGameOver = function () {
|
||||
return String(this.parameters['Auto on Gameover']) === "true";
|
||||
};
|
||||
|
||||
return CommonSaveManager;
|
||||
})();
|
||||
utakata.CommonSaveManager = new CommonSaveManager();
|
||||
CommonSaveManager.prototype.isAutoOnGameOver = function () {
|
||||
return String(this.parameters["Auto on Gameover"]) === "true";
|
||||
};
|
||||
|
||||
return CommonSaveManager;
|
||||
})();
|
||||
utakata.CommonSaveManager = new CommonSaveManager();
|
||||
})(utakata || (utakata = {}));
|
||||
|
||||
(function () {
|
||||
//parse and dispatch plugin command
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === 'CommonSave') {
|
||||
switch (args[0]) {
|
||||
case 'load':
|
||||
utakata.CommonSaveManager.load();
|
||||
break;
|
||||
case 'save':
|
||||
utakata.CommonSaveManager.save();
|
||||
break;
|
||||
case 'exists':
|
||||
utakata.CommonSaveManager.exists();
|
||||
break;
|
||||
case 'remove':
|
||||
utakata.CommonSaveManager.remove();
|
||||
break;
|
||||
case 'setTrace':
|
||||
utakata.CommonSaveManager.setShowTrace(args);
|
||||
break;
|
||||
case 'check':
|
||||
utakata.CommonSaveManager.check();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
//parse and dispatch plugin command
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
if (command === "CommonSave") {
|
||||
switch (args[0]) {
|
||||
case "load":
|
||||
utakata.CommonSaveManager.load();
|
||||
break;
|
||||
case "save":
|
||||
utakata.CommonSaveManager.save();
|
||||
break;
|
||||
case "exists":
|
||||
utakata.CommonSaveManager.exists();
|
||||
break;
|
||||
case "remove":
|
||||
utakata.CommonSaveManager.remove();
|
||||
break;
|
||||
case "setTrace":
|
||||
utakata.CommonSaveManager.setShowTrace(args);
|
||||
break;
|
||||
case "check":
|
||||
utakata.CommonSaveManager.check();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// DataManager
|
||||
//-----------------------------------------------------------------------------
|
||||
// # extension
|
||||
var _Data_Manager_loadGame = DataManager.loadGame;
|
||||
DataManager.loadGame = function (savefileId) {
|
||||
var ret = _Data_Manager_loadGame.call(this, savefileId);
|
||||
//-----------------------------------------------------------------------------
|
||||
// DataManager
|
||||
//-----------------------------------------------------------------------------
|
||||
// # extension
|
||||
var _Data_Manager_loadGame = DataManager.loadGame;
|
||||
DataManager.loadGame = function (savefileId) {
|
||||
var ret = _Data_Manager_loadGame.call(this, savefileId);
|
||||
|
||||
if (utakata.CommonSaveManager.isAuto()) { utakata.CommonSaveManager.load(); }
|
||||
return ret;
|
||||
};
|
||||
if (utakata.CommonSaveManager.isAuto()) {
|
||||
utakata.CommonSaveManager.load();
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
var _Data_Manager_saveGame = DataManager.saveGame;
|
||||
DataManager.saveGame = function (savefileId) {
|
||||
var ret = _Data_Manager_saveGame.call(this, savefileId);
|
||||
var _Data_Manager_saveGame = DataManager.saveGame;
|
||||
DataManager.saveGame = function (savefileId) {
|
||||
var ret = _Data_Manager_saveGame.call(this, savefileId);
|
||||
|
||||
if (utakata.CommonSaveManager.isAuto()) { utakata.CommonSaveManager.save(); }
|
||||
return ret;
|
||||
};
|
||||
if (utakata.CommonSaveManager.isAuto()) {
|
||||
utakata.CommonSaveManager.save();
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
var _Data_Manager_setupNewGame = DataManager.setupNewGame;
|
||||
DataManager.setupNewGame = function () {
|
||||
_Data_Manager_setupNewGame.call(this);
|
||||
if (utakata.CommonSaveManager.isAuto()) { utakata.CommonSaveManager.load(); }
|
||||
};
|
||||
var _Data_Manager_setupNewGame = DataManager.setupNewGame;
|
||||
DataManager.setupNewGame = function () {
|
||||
_Data_Manager_setupNewGame.call(this);
|
||||
if (utakata.CommonSaveManager.isAuto()) {
|
||||
utakata.CommonSaveManager.load();
|
||||
}
|
||||
};
|
||||
|
||||
// # add methods
|
||||
DataManager.loadCommonSave = function () {
|
||||
var json;
|
||||
try {
|
||||
json = StorageManager.loadCommonSave();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
if (json) {
|
||||
var commonInfo = JSON.parse(json);
|
||||
return commonInfo;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
// # add methods
|
||||
DataManager.loadCommonSave = function () {
|
||||
var json;
|
||||
try {
|
||||
json = StorageManager.loadCommonSave();
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
if (json) {
|
||||
var commonInfo = JSON.parse(json);
|
||||
return commonInfo;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
DataManager.saveCommonSave = function (json) {
|
||||
var jsonStr = JsonEx.stringify(json);
|
||||
if (jsonStr.length >= 200000) {
|
||||
console.warn('Common Save too big!');
|
||||
}
|
||||
StorageManager.saveCommonSave(jsonStr);
|
||||
return true;
|
||||
};
|
||||
DataManager.saveCommonSave = function (json) {
|
||||
var jsonStr = JsonEx.stringify(json);
|
||||
if (jsonStr.length >= 200000) {
|
||||
console.warn("Common Save too big!");
|
||||
}
|
||||
StorageManager.saveCommonSave(jsonStr);
|
||||
return true;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// StorageManager
|
||||
//-----------------------------------------------------------------------------
|
||||
//load methods ----------------------------------------------------------------
|
||||
StorageManager.loadCommonSave = function () {
|
||||
if (this.isLocalMode()) {
|
||||
return this.loadFromLocalFileCommonSave();
|
||||
} else {
|
||||
return this.loadFromWebStorageCommonSave();
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------
|
||||
// StorageManager
|
||||
//-----------------------------------------------------------------------------
|
||||
//load methods ----------------------------------------------------------------
|
||||
StorageManager.loadCommonSave = function () {
|
||||
if (this.isLocalMode()) {
|
||||
return this.loadFromLocalFileCommonSave();
|
||||
} else {
|
||||
return this.loadFromWebStorageCommonSave();
|
||||
}
|
||||
};
|
||||
|
||||
StorageManager.loadFromLocalFileCommonSave = function () {
|
||||
var data = null;
|
||||
var fs = require('fs');
|
||||
var filePath = this.localFilePathCommonSave();
|
||||
if (fs.existsSync(filePath)) {
|
||||
data = fs.readFileSync(filePath, { encoding: 'utf8' });
|
||||
}
|
||||
return LZString.decompressFromBase64(data);
|
||||
};
|
||||
StorageManager.loadFromLocalFileCommonSave = function () {
|
||||
var data = null;
|
||||
var fs = require("fs");
|
||||
var filePath = this.localFilePathCommonSave();
|
||||
if (fs.existsSync(filePath)) {
|
||||
data = fs.readFileSync(filePath, { encoding: "utf8" });
|
||||
}
|
||||
return LZString.decompressFromBase64(data);
|
||||
};
|
||||
|
||||
StorageManager.loadFromWebStorageCommonSave = function () {
|
||||
var key = this.webStorageKeyCommonSave();
|
||||
var data = localStorage.getItem(key);
|
||||
return LZString.decompressFromBase64(data);
|
||||
};
|
||||
StorageManager.loadFromWebStorageCommonSave = function () {
|
||||
var key = this.webStorageKeyCommonSave();
|
||||
var data = localStorage.getItem(key);
|
||||
return LZString.decompressFromBase64(data);
|
||||
};
|
||||
|
||||
// save methods ---------------------------------------------------------------
|
||||
StorageManager.saveCommonSave = function (json) {
|
||||
if (this.isLocalMode()) {
|
||||
this.saveToLocalFileCommonSave(json);
|
||||
} else {
|
||||
this.saveToWebStorageCommonSave(json);
|
||||
}
|
||||
};
|
||||
// save methods ---------------------------------------------------------------
|
||||
StorageManager.saveCommonSave = function (json) {
|
||||
if (this.isLocalMode()) {
|
||||
this.saveToLocalFileCommonSave(json);
|
||||
} else {
|
||||
this.saveToWebStorageCommonSave(json);
|
||||
}
|
||||
};
|
||||
|
||||
StorageManager.saveToLocalFileCommonSave = function (json) {
|
||||
var data = LZString.compressToBase64(json);
|
||||
var fs = require('fs');
|
||||
var dirPath = this.localFileDirectoryPath();
|
||||
var filePath = this.localFilePathCommonSave();
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
fs.mkdirSync(dirPath);
|
||||
}
|
||||
fs.writeFileSync(filePath, data);
|
||||
};
|
||||
StorageManager.saveToLocalFileCommonSave = function (json) {
|
||||
var data = LZString.compressToBase64(json);
|
||||
var fs = require("fs");
|
||||
var dirPath = this.localFileDirectoryPath();
|
||||
var filePath = this.localFilePathCommonSave();
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
fs.mkdirSync(dirPath);
|
||||
}
|
||||
fs.writeFileSync(filePath, data);
|
||||
};
|
||||
|
||||
StorageManager.saveToWebStorageCommonSave = function (json) {
|
||||
var key = this.webStorageKeyCommonSave();
|
||||
var data = LZString.compressToBase64(json);
|
||||
localStorage.setItem(key, data);
|
||||
};
|
||||
StorageManager.saveToWebStorageCommonSave = function (json) {
|
||||
var key = this.webStorageKeyCommonSave();
|
||||
var data = LZString.compressToBase64(json);
|
||||
localStorage.setItem(key, data);
|
||||
};
|
||||
|
||||
//check exists ----------------------------------------------------------------
|
||||
StorageManager.existsCommonSave = function () {
|
||||
if (this.isLocalMode()) {
|
||||
return this.localFileExistsCommonSave();
|
||||
} else {
|
||||
return this.webStorageExistsCommonSave();
|
||||
}
|
||||
};
|
||||
//check exists ----------------------------------------------------------------
|
||||
StorageManager.existsCommonSave = function () {
|
||||
if (this.isLocalMode()) {
|
||||
return this.localFileExistsCommonSave();
|
||||
} else {
|
||||
return this.webStorageExistsCommonSave();
|
||||
}
|
||||
};
|
||||
|
||||
StorageManager.localFileExistsCommonSave = function () {
|
||||
var fs = require('fs');
|
||||
return fs.existsSync(this.localFilePathCommonSave());
|
||||
};
|
||||
StorageManager.localFileExistsCommonSave = function () {
|
||||
var fs = require("fs");
|
||||
return fs.existsSync(this.localFilePathCommonSave());
|
||||
};
|
||||
|
||||
StorageManager.webStorageExistsCommonSave = function () {
|
||||
var key = this.webStorageKeyCommonSave();
|
||||
return !!localStorage.getItem(key);
|
||||
};
|
||||
StorageManager.webStorageExistsCommonSave = function () {
|
||||
var key = this.webStorageKeyCommonSave();
|
||||
return !!localStorage.getItem(key);
|
||||
};
|
||||
|
||||
//remove ----------------------------------------------------------------------
|
||||
StorageManager.removeCommonSave = function () {
|
||||
if (this.isLocalMode()) {
|
||||
this.removeLocalFileCommonSave();
|
||||
} else {
|
||||
this.removeWebStorageCommonSave();
|
||||
}
|
||||
};
|
||||
//remove ----------------------------------------------------------------------
|
||||
StorageManager.removeCommonSave = function () {
|
||||
if (this.isLocalMode()) {
|
||||
this.removeLocalFileCommonSave();
|
||||
} else {
|
||||
this.removeWebStorageCommonSave();
|
||||
}
|
||||
};
|
||||
|
||||
StorageManager.removeLocalFileCommonSave = function () {
|
||||
var fs = require('fs');
|
||||
var filePath = this.localFilePathCommonSave();
|
||||
if (fs.existsSync(filePath)) {
|
||||
fs.unlinkSync(filePath);
|
||||
}
|
||||
};
|
||||
StorageManager.removeLocalFileCommonSave = function () {
|
||||
var fs = require("fs");
|
||||
var filePath = this.localFilePathCommonSave();
|
||||
if (fs.existsSync(filePath)) {
|
||||
fs.unlinkSync(filePath);
|
||||
}
|
||||
};
|
||||
|
||||
StorageManager.removeWebStorageCommonSave = function () {
|
||||
var key = this.webStorageKeyCommonSave();
|
||||
localStorage.removeItem(key);
|
||||
};
|
||||
StorageManager.removeWebStorageCommonSave = function () {
|
||||
var key = this.webStorageKeyCommonSave();
|
||||
localStorage.removeItem(key);
|
||||
};
|
||||
|
||||
StorageManager.localFilePathCommonSave = function () { return this.localFileDirectoryPath() + 'common.rpgsave'; };
|
||||
StorageManager.webStorageKeyCommonSave = function () { return 'RPG Common'; };
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Gameover
|
||||
//-----------------------------------------------------------------------------
|
||||
var _Scene_Gameover_Start = Scene_Gameover.prototype.start;
|
||||
Scene_Gameover.prototype.start = function () {
|
||||
if (utakata.CommonSaveManager.isAutoOnGameOver()) {
|
||||
utakata.CommonSaveManager.save();
|
||||
}
|
||||
_Scene_Gameover_Start.call(this);
|
||||
};
|
||||
StorageManager.localFilePathCommonSave = function () {
|
||||
return this.localFileDirectoryPath() + "common.rpgsave";
|
||||
};
|
||||
StorageManager.webStorageKeyCommonSave = function () {
|
||||
return "RPG Common";
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Gameover
|
||||
//-----------------------------------------------------------------------------
|
||||
var _Scene_Gameover_Start = Scene_Gameover.prototype.start;
|
||||
Scene_Gameover.prototype.start = function () {
|
||||
if (utakata.CommonSaveManager.isAutoOnGameOver()) {
|
||||
utakata.CommonSaveManager.save();
|
||||
}
|
||||
_Scene_Gameover_Start.call(this);
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -12,33 +12,33 @@
|
|||
/*:
|
||||
* @plugindesc Skip message on pressing a particular key.
|
||||
* @author T.Akatsuki
|
||||
*
|
||||
*
|
||||
* @param Skip Key
|
||||
* @desc Set the message skip key. The value has been defined in the Input.KeyMapper is valid.
|
||||
* @default control
|
||||
*
|
||||
*
|
||||
* @param Show Trace
|
||||
* @desc Set state traces display.
|
||||
* true : Show trace., false : Don't show trace.
|
||||
* @default false
|
||||
*
|
||||
*
|
||||
* @help # Overview
|
||||
* MessageSkip plugin can be done to skip in that continue to press a specfic key in a message display.
|
||||
* Well there is a message skip functions in such Novel games.
|
||||
* Skip if choice window will be temporarily supended.
|
||||
*
|
||||
*
|
||||
* # Parameters
|
||||
* Skip Key [any key]
|
||||
* Set the message skip key.
|
||||
* The value that has been defined in Input.keyMapper is valid.
|
||||
* Initial value is in 'control'.
|
||||
*
|
||||
*
|
||||
* Show Trace [true|false]
|
||||
* Set whether the issue a trace for debugging.
|
||||
*
|
||||
*
|
||||
* # Plugin Commands
|
||||
* There is no plugin command.
|
||||
*
|
||||
*
|
||||
* # Change Log
|
||||
* ver 1.00 (Feb 17, 2016)
|
||||
* Initial release.
|
||||
|
|
@ -47,33 +47,33 @@
|
|||
/*:ja
|
||||
* @plugindesc 特定キーを押す事でメッセージをスキップできるようにします。
|
||||
* @author 赤月 智平
|
||||
*
|
||||
*
|
||||
* @param Skip Key
|
||||
* @desc メッセージスキップキーを設定します。Input.keyMapperに定義された値が有効です。
|
||||
* @default control
|
||||
*
|
||||
*
|
||||
* @param Show Trace
|
||||
* @desc デバッグ用のトレースを出すかを設定します。
|
||||
* true: トレースを表示, false: トレースを表示しない
|
||||
* @default false
|
||||
*
|
||||
*
|
||||
* @help ■概要
|
||||
* MessageSkipプラグインではメッセージ表示中に特定のキーを押し続ける事で
|
||||
* スキップ処理を行う事ができます。
|
||||
* ADV等で良くあるメッセージスキップの機能です。
|
||||
* 選択肢を挟む場合は選択肢が表示されるタイミングでスキップが中断されます。
|
||||
*
|
||||
*
|
||||
* ■パラメータの説明
|
||||
* Skip Key [任意のキー]
|
||||
* メッセージスキップキーを設定します。Input.keyMapperに定義された値が有効です。
|
||||
* 初期値はcontrolになっています。他にもshift等が使いやすそうです。
|
||||
*
|
||||
*
|
||||
* Show Trace [true|false]
|
||||
* デバッグ用のトレースを出すかを設定します。
|
||||
*
|
||||
*
|
||||
* ■プラグインコマンド
|
||||
* プラグインコマンドはありません。
|
||||
*
|
||||
*
|
||||
* ■更新履歴
|
||||
* ver 1.00 (2016.02.17)
|
||||
* 初版。
|
||||
|
|
@ -84,118 +84,120 @@
|
|||
var utakata = utakata || (utakata = {});
|
||||
|
||||
(function (utakata) {
|
||||
//-----------------------------------------------------------------------------
|
||||
// class MessageSkip
|
||||
//-----------------------------------------------------------------------------
|
||||
var MessageSkip = (function () {
|
||||
//constructor
|
||||
function MessageSkip() {
|
||||
this._skipKey = ""; //bind target key
|
||||
//-----------------------------------------------------------------------------
|
||||
// class MessageSkip
|
||||
//-----------------------------------------------------------------------------
|
||||
var MessageSkip = (function () {
|
||||
//constructor
|
||||
function MessageSkip() {
|
||||
this._skipKey = ""; //bind target key
|
||||
|
||||
//trace
|
||||
this._showTrace = false;
|
||||
this._tr = null;
|
||||
//trace
|
||||
this._showTrace = false;
|
||||
this._tr = null;
|
||||
|
||||
this.initialize();
|
||||
}
|
||||
this.initialize();
|
||||
}
|
||||
|
||||
//private methods
|
||||
MessageSkip.prototype.initialize = function () {
|
||||
var parameters = PluginManager.parameters('UTA_MessageSkip');
|
||||
//private methods
|
||||
MessageSkip.prototype.initialize = function () {
|
||||
var parameters = PluginManager.parameters("UTA_MessageSkip");
|
||||
|
||||
this._skipKey = String(parameters['Skip Key']) || null;
|
||||
this._skipKey = String(parameters["Skip Key"]) || null;
|
||||
|
||||
var _show_tr = (String(parameters['Show Trace']) === "true");
|
||||
this._tr = _show_tr ? function (s) { var str = "MessageSkip: " + s; console.log(str); } : function (s) { };
|
||||
var _show_tr = String(parameters["Show Trace"]) === "true";
|
||||
this._tr = _show_tr
|
||||
? function (s) {
|
||||
var str = "MessageSkip: " + s;
|
||||
console.log(str);
|
||||
}
|
||||
: function (s) {};
|
||||
|
||||
this._tr("skip key bind: " + this._skipKey);
|
||||
};
|
||||
this._tr("skip key bind: " + this._skipKey);
|
||||
};
|
||||
|
||||
//protected methods
|
||||
MessageSkip.prototype.isPressedMsgSkipButton = function () {
|
||||
return Input.isPressed(this._skipKey);
|
||||
};
|
||||
//protected methods
|
||||
MessageSkip.prototype.isPressedMsgSkipButton = function () {
|
||||
return Input.isPressed(this._skipKey);
|
||||
};
|
||||
|
||||
return MessageSkip;
|
||||
})();
|
||||
utakata.MessageSkip = new MessageSkip();
|
||||
return MessageSkip;
|
||||
})();
|
||||
utakata.MessageSkip = new MessageSkip();
|
||||
})(utakata || (utakata = {}));
|
||||
|
||||
|
||||
(function () {
|
||||
//-----------------------------------------------------------------------------
|
||||
// PluginCommands
|
||||
//-----------------------------------------------------------------------------
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
//-----------------------------------------------------------------------------
|
||||
// PluginCommands
|
||||
//-----------------------------------------------------------------------------
|
||||
var _Game_Interpreter_pluginCommand =
|
||||
Game_Interpreter.prototype.pluginCommand;
|
||||
Game_Interpreter.prototype.pluginCommand = function (command, args) {
|
||||
_Game_Interpreter_pluginCommand.call(this, command, args);
|
||||
|
||||
//UT_MessageSkip don't have plugin commands.
|
||||
if (command === 'UT_MessageSkip') {
|
||||
switch (args[0]) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
//UT_MessageSkip don't have plugin commands.
|
||||
if (command === "UT_MessageSkip") {
|
||||
switch (args[0]) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_Message
|
||||
//-----------------------------------------------------------------------------
|
||||
//文章表示途中にskipキーが入力された場合は即全表示
|
||||
var _Window_Message_updateShowFast = Window_Message.prototype.updateShowFast;
|
||||
Window_Message.prototype.updateShowFast = function () {
|
||||
_Window_Message_updateShowFast.call(this);
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_Message
|
||||
//-----------------------------------------------------------------------------
|
||||
//文章表示途中にskipキーが入力された場合は即全表示
|
||||
var _Window_Message_updateShowFast = Window_Message.prototype.updateShowFast;
|
||||
Window_Message.prototype.updateShowFast = function () {
|
||||
_Window_Message_updateShowFast.call(this);
|
||||
|
||||
if (utakata.MessageSkip.isPressedMsgSkipButton()) {
|
||||
this._showFast = true;
|
||||
this._pauseSkip = true;
|
||||
}
|
||||
};
|
||||
if (utakata.MessageSkip.isPressedMsgSkipButton()) {
|
||||
this._showFast = true;
|
||||
this._pauseSkip = true;
|
||||
}
|
||||
};
|
||||
|
||||
//文章が表示されkey入力待ちの際もskipキーの入力を監視しておく
|
||||
var _Window_Message_updateInput = Window_Message.prototype.updateInput;
|
||||
Window_Message.prototype.updateInput = function () {
|
||||
var ret = _Window_Message_updateInput.call(this);
|
||||
//文章が表示されkey入力待ちの際もskipキーの入力を監視しておく
|
||||
var _Window_Message_updateInput = Window_Message.prototype.updateInput;
|
||||
Window_Message.prototype.updateInput = function () {
|
||||
var ret = _Window_Message_updateInput.call(this);
|
||||
|
||||
if (this.pause && utakata.MessageSkip.isPressedMsgSkipButton()) {
|
||||
this.pause = false;
|
||||
if (!this._textState) {
|
||||
this.terminateMessage();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (this.pause && utakata.MessageSkip.isPressedMsgSkipButton()) {
|
||||
this.pause = false;
|
||||
if (!this._textState) {
|
||||
this.terminateMessage();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
return ret;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_ScrollText
|
||||
//-----------------------------------------------------------------------------
|
||||
//スクロールメッセージは更に爆速で流れるように
|
||||
var Window_ScrollText_scrollSpeed = Window_ScrollText.prototype.scrollSpeed;
|
||||
Window_ScrollText.prototype.scrollSpeed = function () {
|
||||
var ret = Window_ScrollText_scrollSpeed.call(this);
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_ScrollText
|
||||
//-----------------------------------------------------------------------------
|
||||
//スクロールメッセージは更に爆速で流れるように
|
||||
var Window_ScrollText_scrollSpeed = Window_ScrollText.prototype.scrollSpeed;
|
||||
Window_ScrollText.prototype.scrollSpeed = function () {
|
||||
var ret = Window_ScrollText_scrollSpeed.call(this);
|
||||
|
||||
if (utakata.MessageSkip.isPressedMsgSkipButton()) {
|
||||
ret *= 100;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_BattleLog
|
||||
//-----------------------------------------------------------------------------
|
||||
//バトルログを超高速に
|
||||
var _Window_BattleLog_messageSpeed = Window_BattleLog.prototype.messageSpeed;
|
||||
Window_BattleLog.prototype.messageSpeed = function () {
|
||||
var ret = _Window_BattleLog_messageSpeed.call(this);
|
||||
if (utakata.MessageSkip.isPressedMsgSkipButton()) {
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
if (utakata.MessageSkip.isPressedMsgSkipButton()) {
|
||||
ret *= 100;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Window_BattleLog
|
||||
//-----------------------------------------------------------------------------
|
||||
//バトルログを超高速に
|
||||
var _Window_BattleLog_messageSpeed = Window_BattleLog.prototype.messageSpeed;
|
||||
Window_BattleLog.prototype.messageSpeed = function () {
|
||||
var ret = _Window_BattleLog_messageSpeed.call(this);
|
||||
if (utakata.MessageSkip.isPressedMsgSkipButton()) {
|
||||
ret = 1;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
* @help This plugin does not provide plugin commands.
|
||||
*
|
||||
* When <skill_id:3> is written in a weapon's note field,
|
||||
* When <skill_id:3> is written in a weapon's note field,
|
||||
* skill id # 3 is used for the weapon's attack.
|
||||
* If nothing is written, default id(=1) is used.
|
||||
*
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
* - to create all-range weapons
|
||||
* - to create dual-attack or triple-attack weapons
|
||||
* - If healing skill is set when actor attacks, you can choose a friend to heal.
|
||||
* - It is possible to make a weapon that functions similar to a guard command.
|
||||
* - It is possible to make a weapon that functions similar to a guard command.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
|
|
@ -49,7 +49,6 @@
|
|||
*/
|
||||
|
||||
(function () {
|
||||
|
||||
//
|
||||
// set skill id for attack.
|
||||
//
|
||||
|
|
@ -58,7 +57,7 @@
|
|||
if (this.hasNoWeapons()) {
|
||||
return normalId;
|
||||
}
|
||||
var weapon = this.weapons()[0]; // at plural weapon, one's first skill.
|
||||
var weapon = this.weapons()[0]; // at plural weapon, one's first skill.
|
||||
var id = weapon.meta.skill_id;
|
||||
return id ? Number(id) : normalId;
|
||||
};
|
||||
|
|
@ -78,6 +77,4 @@
|
|||
// special skill weapon
|
||||
this.onSelectAction();
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
|||
(function () {
|
||||
let __isNearTheScreen = Game_Event.prototype.isNearTheScreen;
|
||||
Game_Event.prototype.isNearTheScreen = function () {
|
||||
return __isNearTheScreen.apply(this, arguments) || this._moveType == 3;
|
||||
};
|
||||
}());
|
||||
let __isNearTheScreen = Game_Event.prototype.isNearTheScreen;
|
||||
Game_Event.prototype.isNearTheScreen = function () {
|
||||
return __isNearTheScreen.apply(this, arguments) || this._moveType == 3;
|
||||
};
|
||||
})();
|
||||
|
|
|
|||
9049
www/js/rpg_core.js
9049
www/js/rpg_core.js
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
12450
www/js/rpg_objects.js
12450
www/js/rpg_objects.js
File diff suppressed because it is too large
Load diff
2735
www/js/rpg_scenes.js
2735
www/js/rpg_scenes.js
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue