Add jobquest
This commit is contained in:
15
js/libs/fpsmeter.js
Normal file
15
js/libs/fpsmeter.js
Normal file
@@ -0,0 +1,15 @@
|
||||
/*! 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}})})(window,FPSMeter);
|
||||
3
js/libs/iphone-inline-video.browser.js
Normal file
3
js/libs/iphone-inline-video.browser.js
Normal file
@@ -0,0 +1,3 @@
|
||||
/*! 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}();
|
||||
1
js/libs/lz-string.js
Normal file
1
js/libs/lz-string.js
Normal file
File diff suppressed because one or more lines are too long
428
js/libs/pixi-picture.js
Normal file
428
js/libs/pixi-picture.js
Normal file
@@ -0,0 +1,428 @@
|
||||
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 __());
|
||||
};
|
||||
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 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)];
|
||||
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 = {}));
|
||||
})(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 = {}));
|
||||
})(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 = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
//# sourceMappingURL=pixi-picture.js.map
|
||||
887
js/libs/pixi-tilemap.js
Normal file
887
js/libs/pixi-tilemap.js
Normal file
@@ -0,0 +1,887 @@
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var tilemap;
|
||||
(function (tilemap) {
|
||||
var CanvasTileRenderer = (function () {
|
||||
function CanvasTileRenderer(renderer) {
|
||||
this.tileAnim = [0, 0];
|
||||
this.dontUseTransform = false;
|
||||
this.renderer = renderer;
|
||||
this.tileAnim = [0, 0];
|
||||
}
|
||||
return CanvasTileRenderer;
|
||||
}());
|
||||
tilemap.CanvasTileRenderer = CanvasTileRenderer;
|
||||
PIXI.CanvasRenderer.registerPlugin('tilemap', CanvasTileRenderer);
|
||||
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var tilemap;
|
||||
(function (tilemap) {
|
||||
var CompositeRectTileLayer = (function (_super) {
|
||||
__extends(CompositeRectTileLayer, _super);
|
||||
function CompositeRectTileLayer(zIndex, bitmaps, useSquare, texPerChild) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.shadowColor = new Float32Array([0.0, 0.0, 0.0, 0.5]);
|
||||
_this.modificationMarker = 0;
|
||||
_this._globalMat = null;
|
||||
_this._tempScale = null;
|
||||
_this.initialize.apply(_this, arguments);
|
||||
return _this;
|
||||
}
|
||||
CompositeRectTileLayer.prototype.updateTransform = function () {
|
||||
_super.prototype.displayObjectUpdateTransform.call(this);
|
||||
};
|
||||
CompositeRectTileLayer.prototype.initialize = function (zIndex, bitmaps, useSquare, texPerChild) {
|
||||
this.z = this.zIndex = zIndex;
|
||||
this.useSquare = useSquare;
|
||||
this.texPerChild = texPerChild || 16;
|
||||
if (bitmaps) {
|
||||
this.setBitmaps(bitmaps);
|
||||
}
|
||||
};
|
||||
CompositeRectTileLayer.prototype.setBitmaps = function (bitmaps) {
|
||||
var texPerChild = this.texPerChild;
|
||||
var len1 = this.children.length;
|
||||
var len2 = Math.ceil(bitmaps.length / texPerChild);
|
||||
var i;
|
||||
for (i = 0; i < len1; i++) {
|
||||
this.children[i].textures = bitmaps.slice(i * texPerChild, (i + 1) * texPerChild);
|
||||
}
|
||||
for (i = len1; i < len2; i++) {
|
||||
this.addChild(new tilemap.RectTileLayer(this.zIndex, bitmaps.slice(i * texPerChild, (i + 1) * texPerChild)));
|
||||
}
|
||||
};
|
||||
CompositeRectTileLayer.prototype.clear = function () {
|
||||
for (var i = 0; i < this.children.length; i++)
|
||||
this.children[i].clear();
|
||||
this.modificationMarker = 0;
|
||||
};
|
||||
CompositeRectTileLayer.prototype.addRect = function (num, u, v, x, y, tileWidth, tileHeight) {
|
||||
if (this.children[num] && this.children[num].textures)
|
||||
this.children[num].addRect(0, u, v, x, y, tileWidth, tileHeight);
|
||||
};
|
||||
CompositeRectTileLayer.prototype.addFrame = function (texture_, x, y, animX, animY) {
|
||||
var texture;
|
||||
var layer = null, ind = 0;
|
||||
var children = this.children;
|
||||
if (typeof texture_ === "number") {
|
||||
var childIndex = texture_ / this.texPerChild >> 0;
|
||||
layer = children[childIndex];
|
||||
if (!layer) {
|
||||
layer = children[0];
|
||||
if (!layer) {
|
||||
return false;
|
||||
}
|
||||
ind = 0;
|
||||
}
|
||||
else {
|
||||
ind = texture_ % this.texPerChild;
|
||||
}
|
||||
texture = layer.textures[ind];
|
||||
}
|
||||
else if (typeof texture_ === "string") {
|
||||
texture = PIXI.Texture.fromImage(texture_);
|
||||
}
|
||||
else {
|
||||
texture = texture_;
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
var tex = child.textures;
|
||||
for (var j = 0; j < tex.length; j++) {
|
||||
if (tex[j].baseTexture == texture.baseTexture) {
|
||||
layer = child;
|
||||
ind = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (layer) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!layer) {
|
||||
for (i = 0; i < children.length; i++) {
|
||||
var child = children[i];
|
||||
if (child.textures.length < this.texPerChild) {
|
||||
layer = child;
|
||||
ind = child.textures.length;
|
||||
child.textures.push(texture);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!layer) {
|
||||
children.push(layer = new tilemap.RectTileLayer(this.zIndex, texture));
|
||||
ind = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
layer.addRect(ind, texture.frame.x, texture.frame.y, x, y, texture.frame.width, texture.frame.height, animX, animY);
|
||||
return true;
|
||||
};
|
||||
;
|
||||
CompositeRectTileLayer.prototype.renderCanvas = function (renderer) {
|
||||
if (!renderer.plugins.tilemap.dontUseTransform) {
|
||||
var wt = this.worldTransform;
|
||||
renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
|
||||
}
|
||||
var layers = this.children;
|
||||
for (var i = 0; i < layers.length; i++)
|
||||
layers[i].renderCanvas(renderer);
|
||||
};
|
||||
;
|
||||
CompositeRectTileLayer.prototype.renderWebGL = function (renderer) {
|
||||
var gl = renderer.gl;
|
||||
var shader = renderer.plugins.tilemap.getShader(this.useSquare);
|
||||
renderer.setObjectRenderer(renderer.plugins.tilemap);
|
||||
renderer.bindShader(shader);
|
||||
this._globalMat = this._globalMat || new PIXI.Matrix();
|
||||
renderer._activeRenderTarget.projectionMatrix.copy(this._globalMat).append(this.worldTransform);
|
||||
shader.uniforms.projectionMatrix = this._globalMat.toArray(true);
|
||||
shader.uniforms.shadowColor = this.shadowColor;
|
||||
if (this.useSquare) {
|
||||
var tempScale = this._tempScale = (this._tempScale || [0, 0]);
|
||||
tempScale[0] = this._globalMat.a >= 0 ? 1 : -1;
|
||||
tempScale[1] = this._globalMat.d < 0 ? 1 : -1;
|
||||
var ps = shader.uniforms.pointScale = tempScale;
|
||||
shader.uniforms.projectionScale = Math.abs(this.worldTransform.a) * renderer.resolution;
|
||||
}
|
||||
var af = shader.uniforms.animationFrame = renderer.plugins.tilemap.tileAnim;
|
||||
var layers = this.children;
|
||||
for (var i = 0; i < layers.length; i++)
|
||||
layers[i].renderWebGL(renderer, this.useSquare);
|
||||
};
|
||||
CompositeRectTileLayer.prototype.isModified = function (anim) {
|
||||
var layers = this.children;
|
||||
if (this.modificationMarker != layers.length) {
|
||||
return true;
|
||||
}
|
||||
for (var i = 0; i < layers.length; i++) {
|
||||
var layer = layers[i];
|
||||
if (layer.modificationMarker != layer.pointsBuf.length ||
|
||||
anim && layer.hasAnim) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
CompositeRectTileLayer.prototype.clearModify = function () {
|
||||
var layers = this.children;
|
||||
this.modificationMarker = layers.length;
|
||||
for (var i = 0; i < layers.length; i++) {
|
||||
var layer = layers[i];
|
||||
layer.modificationMarker = layer.pointsBuf.length;
|
||||
}
|
||||
};
|
||||
return CompositeRectTileLayer;
|
||||
}(PIXI.Container));
|
||||
tilemap.CompositeRectTileLayer = CompositeRectTileLayer;
|
||||
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var tilemap;
|
||||
(function (tilemap) {
|
||||
var GraphicsLayer = (function (_super) {
|
||||
__extends(GraphicsLayer, _super);
|
||||
function GraphicsLayer(zIndex) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.z = _this.zIndex = zIndex;
|
||||
return _this;
|
||||
}
|
||||
GraphicsLayer.prototype.renderCanvas = function (renderer) {
|
||||
var wt = null;
|
||||
if (renderer.plugins.tilemap.dontUseTransform) {
|
||||
wt = this.transform.worldTransform;
|
||||
this.transform.worldTransform = PIXI.Matrix.IDENTITY;
|
||||
}
|
||||
renderer.plugins.graphics.render(this);
|
||||
if (renderer.plugins.tilemap.dontUseTransform) {
|
||||
this.transform.worldTransform = wt;
|
||||
}
|
||||
renderer.context.globalAlpha = 1.0;
|
||||
};
|
||||
GraphicsLayer.prototype.renderWebGL = function (renderer) {
|
||||
if (!this._webGL[renderer.CONTEXT_UID])
|
||||
this.dirty = true;
|
||||
_super.prototype.renderWebGL.call(this, renderer);
|
||||
};
|
||||
GraphicsLayer.prototype.isModified = function (anim) {
|
||||
return false;
|
||||
};
|
||||
GraphicsLayer.prototype.clearModify = function () {
|
||||
};
|
||||
return GraphicsLayer;
|
||||
}(PIXI.Graphics));
|
||||
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var tilemap;
|
||||
(function (tilemap) {
|
||||
var RectTileLayer = (function (_super) {
|
||||
__extends(RectTileLayer, _super);
|
||||
function RectTileLayer(zIndex, texture) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this.z = 0;
|
||||
_this.zIndex = 0;
|
||||
_this.pointsBuf = [];
|
||||
_this._tempSize = new Float32Array([0, 0]);
|
||||
_this._tempTexSize = 1;
|
||||
_this.modificationMarker = 0;
|
||||
_this.hasAnim = false;
|
||||
_this.vbId = 0;
|
||||
_this.vbBuffer = null;
|
||||
_this.vbArray = null;
|
||||
_this.vbInts = null;
|
||||
_this.initialize(zIndex, texture);
|
||||
return _this;
|
||||
}
|
||||
RectTileLayer.prototype.initialize = function (zIndex, textures) {
|
||||
if (!textures) {
|
||||
textures = [];
|
||||
}
|
||||
else if (!(textures instanceof Array) && textures.baseTexture) {
|
||||
textures = [textures];
|
||||
}
|
||||
this.textures = textures;
|
||||
this.z = this.zIndex = zIndex;
|
||||
this.visible = false;
|
||||
};
|
||||
RectTileLayer.prototype.clear = function () {
|
||||
this.pointsBuf.length = 0;
|
||||
this.modificationMarker = 0;
|
||||
this.hasAnim = false;
|
||||
};
|
||||
RectTileLayer.prototype.renderCanvas = function (renderer) {
|
||||
if (this.textures.length === 0)
|
||||
return;
|
||||
var points = this.pointsBuf;
|
||||
renderer.context.fillStyle = '#000000';
|
||||
for (var i = 0, n = points.length; i < n; i += 9) {
|
||||
var x1 = points[i], y1 = points[i + 1];
|
||||
var x2 = points[i + 2], y2 = points[i + 3];
|
||||
var w = points[i + 4];
|
||||
var h = points[i + 5];
|
||||
x1 += points[i + 6] * renderer.plugins.tilemap.tileAnim[0];
|
||||
y1 += points[i + 7] * renderer.plugins.tilemap.tileAnim[1];
|
||||
var textureId = points[i + 8];
|
||||
if (textureId >= 0) {
|
||||
renderer.context.drawImage(this.textures[textureId].baseTexture.source, x1, y1, w, h, x2, y2, w, h);
|
||||
}
|
||||
else {
|
||||
renderer.context.globalAlpha = 0.5;
|
||||
renderer.context.fillRect(x2, y2, w, h);
|
||||
renderer.context.globalAlpha = 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
RectTileLayer.prototype.addRect = function (textureId, u, v, x, y, tileWidth, tileHeight, animX, animY) {
|
||||
if (animX === void 0) { animX = 0; }
|
||||
if (animY === void 0) { animY = 0; }
|
||||
var pb = this.pointsBuf;
|
||||
this.hasAnim = this.hasAnim || animX > 0 || animY > 0;
|
||||
if (tileWidth == tileHeight) {
|
||||
pb.push(u);
|
||||
pb.push(v);
|
||||
pb.push(x);
|
||||
pb.push(y);
|
||||
pb.push(tileWidth);
|
||||
pb.push(tileHeight);
|
||||
pb.push(animX | 0);
|
||||
pb.push(animY | 0);
|
||||
pb.push(textureId);
|
||||
}
|
||||
else {
|
||||
var i;
|
||||
if (tileWidth % tileHeight === 0) {
|
||||
for (i = 0; i < tileWidth / tileHeight; i++) {
|
||||
pb.push(u + i * tileHeight);
|
||||
pb.push(v);
|
||||
pb.push(x + i * tileHeight);
|
||||
pb.push(y);
|
||||
pb.push(tileHeight);
|
||||
pb.push(tileHeight);
|
||||
pb.push(animX | 0);
|
||||
pb.push(animY | 0);
|
||||
pb.push(textureId);
|
||||
}
|
||||
}
|
||||
else if (tileHeight % tileWidth === 0) {
|
||||
for (i = 0; i < tileHeight / tileWidth; i++) {
|
||||
pb.push(u);
|
||||
pb.push(v + i * tileWidth);
|
||||
pb.push(x);
|
||||
pb.push(y + i * tileWidth);
|
||||
pb.push(tileWidth);
|
||||
pb.push(tileWidth);
|
||||
pb.push(animX | 0);
|
||||
pb.push(animY | 0);
|
||||
pb.push(textureId);
|
||||
}
|
||||
}
|
||||
else {
|
||||
pb.push(u);
|
||||
pb.push(v);
|
||||
pb.push(x);
|
||||
pb.push(y);
|
||||
pb.push(tileWidth);
|
||||
pb.push(tileHeight);
|
||||
pb.push(animX | 0);
|
||||
pb.push(animY | 0);
|
||||
pb.push(textureId);
|
||||
}
|
||||
}
|
||||
};
|
||||
;
|
||||
RectTileLayer.prototype.renderWebGL = function (renderer, useSquare) {
|
||||
if (useSquare === void 0) { useSquare = false; }
|
||||
var points = this.pointsBuf;
|
||||
if (points.length === 0)
|
||||
return;
|
||||
var rectsCount = points.length / 9;
|
||||
var tile = renderer.plugins.tilemap;
|
||||
var gl = renderer.gl;
|
||||
if (!useSquare) {
|
||||
tile.checkIndexBuffer(rectsCount);
|
||||
}
|
||||
var shader = tile.getShader(useSquare);
|
||||
var textures = this.textures;
|
||||
if (textures.length === 0)
|
||||
return;
|
||||
var len = textures.length;
|
||||
if (this._tempTexSize < shader.maxTextures) {
|
||||
this._tempTexSize = shader.maxTextures;
|
||||
this._tempSize = new Float32Array(2 * shader.maxTextures);
|
||||
}
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (!textures[i] || !textures[i].valid)
|
||||
return;
|
||||
var texture = textures[i].baseTexture;
|
||||
}
|
||||
tile.bindTextures(renderer, shader, textures);
|
||||
var vb = tile.getVb(this.vbId);
|
||||
if (!vb) {
|
||||
vb = tile.createVb(useSquare);
|
||||
this.vbId = vb.id;
|
||||
this.vbBuffer = null;
|
||||
this.modificationMarker = 0;
|
||||
}
|
||||
var vao = vb.vao;
|
||||
renderer.bindVao(vao);
|
||||
var vertexBuf = vb.vb;
|
||||
vertexBuf.bind();
|
||||
var vertices = rectsCount * shader.vertPerQuad;
|
||||
if (vertices === 0)
|
||||
return;
|
||||
if (this.modificationMarker != vertices) {
|
||||
this.modificationMarker = vertices;
|
||||
var vs = shader.stride * vertices;
|
||||
if (!this.vbBuffer || this.vbBuffer.byteLength < vs) {
|
||||
var bk = shader.stride;
|
||||
while (bk < vs) {
|
||||
bk *= 2;
|
||||
}
|
||||
this.vbBuffer = new ArrayBuffer(bk);
|
||||
this.vbArray = new Float32Array(this.vbBuffer);
|
||||
this.vbInts = new Uint32Array(this.vbBuffer);
|
||||
vertexBuf.upload(this.vbBuffer, 0, true);
|
||||
}
|
||||
var arr = this.vbArray, ints = this.vbInts;
|
||||
var sz = 0;
|
||||
var textureId, shiftU, shiftV;
|
||||
if (useSquare) {
|
||||
for (i = 0; i < points.length; i += 9) {
|
||||
textureId = (points[i + 8] >> 2);
|
||||
shiftU = 1024 * (points[i + 8] & 1);
|
||||
shiftV = 1024 * ((points[i + 8] >> 1) & 1);
|
||||
arr[sz++] = points[i + 2];
|
||||
arr[sz++] = points[i + 3];
|
||||
arr[sz++] = points[i + 0] + shiftU;
|
||||
arr[sz++] = points[i + 1] + shiftV;
|
||||
arr[sz++] = points[i + 4];
|
||||
arr[sz++] = points[i + 6];
|
||||
arr[sz++] = points[i + 7];
|
||||
arr[sz++] = textureId;
|
||||
}
|
||||
}
|
||||
else {
|
||||
var tint = -1;
|
||||
for (i = 0; i < points.length; i += 9) {
|
||||
var eps = 0.5;
|
||||
textureId = (points[i + 8] >> 2);
|
||||
shiftU = 1024 * (points[i + 8] & 1);
|
||||
shiftV = 1024 * ((points[i + 8] >> 1) & 1);
|
||||
var x = points[i + 2], y = points[i + 3];
|
||||
var w = points[i + 4], h = points[i + 5];
|
||||
var u = points[i] + shiftU, v = points[i + 1] + shiftV;
|
||||
var animX = points[i + 6], animY = points[i + 7];
|
||||
arr[sz++] = x;
|
||||
arr[sz++] = y;
|
||||
arr[sz++] = u;
|
||||
arr[sz++] = v;
|
||||
arr[sz++] = u + eps;
|
||||
arr[sz++] = v + eps;
|
||||
arr[sz++] = u + w - eps;
|
||||
arr[sz++] = v + h - eps;
|
||||
arr[sz++] = animX;
|
||||
arr[sz++] = animY;
|
||||
arr[sz++] = textureId;
|
||||
arr[sz++] = x + w;
|
||||
arr[sz++] = y;
|
||||
arr[sz++] = u + w;
|
||||
arr[sz++] = v;
|
||||
arr[sz++] = u + eps;
|
||||
arr[sz++] = v + eps;
|
||||
arr[sz++] = u + w - eps;
|
||||
arr[sz++] = v + h - eps;
|
||||
arr[sz++] = animX;
|
||||
arr[sz++] = animY;
|
||||
arr[sz++] = textureId;
|
||||
arr[sz++] = x + w;
|
||||
arr[sz++] = y + h;
|
||||
arr[sz++] = u + w;
|
||||
arr[sz++] = v + h;
|
||||
arr[sz++] = u + eps;
|
||||
arr[sz++] = v + eps;
|
||||
arr[sz++] = u + w - eps;
|
||||
arr[sz++] = v + h - eps;
|
||||
arr[sz++] = animX;
|
||||
arr[sz++] = animY;
|
||||
arr[sz++] = textureId;
|
||||
arr[sz++] = x;
|
||||
arr[sz++] = y + h;
|
||||
arr[sz++] = u;
|
||||
arr[sz++] = v + h;
|
||||
arr[sz++] = u + eps;
|
||||
arr[sz++] = v + eps;
|
||||
arr[sz++] = u + w - eps;
|
||||
arr[sz++] = v + h - eps;
|
||||
arr[sz++] = animX;
|
||||
arr[sz++] = animY;
|
||||
arr[sz++] = textureId;
|
||||
}
|
||||
}
|
||||
vertexBuf.upload(arr, 0, true);
|
||||
}
|
||||
if (useSquare)
|
||||
gl.drawArrays(gl.POINTS, 0, vertices);
|
||||
else
|
||||
gl.drawElements(gl.TRIANGLES, rectsCount * 6, gl.UNSIGNED_SHORT, 0);
|
||||
};
|
||||
return RectTileLayer;
|
||||
}(PIXI.Container));
|
||||
tilemap.RectTileLayer = RectTileLayer;
|
||||
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var tilemap;
|
||||
(function (tilemap) {
|
||||
var rectShaderFrag = "varying vec2 vTextureCoord;\nvarying vec4 vFrame;\nvarying float vTextureId;\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\n\nvoid main(void){\n vec2 textureCoord = clamp(vTextureCoord, vFrame.xy, vFrame.zw);\n float textureId = floor(vTextureId + 0.5);\n\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}";
|
||||
var rectShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec4 aFrame;\nattribute vec2 aAnim;\nattribute float aTextureId;\n\nuniform mat3 projectionMatrix;\nuniform vec2 animationFrame;\n\nvarying vec2 vTextureCoord;\nvarying float vTextureId;\nvarying vec4 vFrame;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vec2 anim = aAnim * animationFrame;\n vTextureCoord = aTextureCoord + anim;\n vFrame = aFrame + vec4(anim, anim);\n vTextureId = aTextureId;\n}\n";
|
||||
var TilemapShader = (function (_super) {
|
||||
__extends(TilemapShader, _super);
|
||||
function TilemapShader(gl, maxTextures, shaderVert, shaderFrag) {
|
||||
var _this = _super.call(this, gl, shaderVert, shaderFrag) || this;
|
||||
_this.maxTextures = 0;
|
||||
_this.maxTextures = maxTextures;
|
||||
tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures);
|
||||
return _this;
|
||||
}
|
||||
return TilemapShader;
|
||||
}(PIXI.Shader));
|
||||
tilemap.TilemapShader = TilemapShader;
|
||||
var RectTileShader = (function (_super) {
|
||||
__extends(RectTileShader, _super);
|
||||
function RectTileShader(gl, maxTextures) {
|
||||
var _this = _super.call(this, gl, maxTextures, rectShaderVert, tilemap.shaderGenerator.generateFragmentSrc(maxTextures, rectShaderFrag)) || this;
|
||||
_this.vertSize = 11;
|
||||
_this.vertPerQuad = 4;
|
||||
_this.stride = _this.vertSize * 4;
|
||||
tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures);
|
||||
return _this;
|
||||
}
|
||||
RectTileShader.prototype.createVao = function (renderer, vb) {
|
||||
var gl = renderer.gl;
|
||||
return renderer.createVao()
|
||||
.addIndex(this.indexBuffer)
|
||||
.addAttribute(vb, this.attributes.aVertexPosition, gl.FLOAT, false, this.stride, 0)
|
||||
.addAttribute(vb, this.attributes.aTextureCoord, gl.FLOAT, false, this.stride, 2 * 4)
|
||||
.addAttribute(vb, this.attributes.aFrame, gl.FLOAT, false, this.stride, 4 * 4)
|
||||
.addAttribute(vb, this.attributes.aAnim, gl.FLOAT, false, this.stride, 8 * 4)
|
||||
.addAttribute(vb, this.attributes.aTextureId, gl.FLOAT, false, this.stride, 10 * 4);
|
||||
};
|
||||
return RectTileShader;
|
||||
}(TilemapShader));
|
||||
tilemap.RectTileShader = RectTileShader;
|
||||
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var tilemap;
|
||||
(function (tilemap) {
|
||||
var shaderGenerator;
|
||||
(function (shaderGenerator) {
|
||||
function fillSamplers(shader, maxTextures) {
|
||||
var sampleValues = [];
|
||||
for (var i = 0; i < maxTextures; i++) {
|
||||
sampleValues[i] = i;
|
||||
}
|
||||
shader.bind();
|
||||
shader.uniforms.uSamplers = sampleValues;
|
||||
var samplerSize = [];
|
||||
for (i = 0; i < maxTextures; i++) {
|
||||
samplerSize.push(1.0 / 2048);
|
||||
samplerSize.push(1.0 / 2048);
|
||||
}
|
||||
shader.uniforms.uSamplerSize = samplerSize;
|
||||
}
|
||||
shaderGenerator.fillSamplers = fillSamplers;
|
||||
function generateFragmentSrc(maxTextures, fragmentSrc) {
|
||||
return fragmentSrc.replace(/%count%/gi, maxTextures + "")
|
||||
.replace(/%forloop%/gi, this.generateSampleSrc(maxTextures));
|
||||
}
|
||||
shaderGenerator.generateFragmentSrc = generateFragmentSrc;
|
||||
function generateSampleSrc(maxTextures) {
|
||||
var src = '';
|
||||
src += '\n';
|
||||
src += '\n';
|
||||
src += 'if(vTextureId <= -1.0) {';
|
||||
src += '\n\tcolor = shadowColor;';
|
||||
src += '\n}';
|
||||
for (var i = 0; i < maxTextures; i++) {
|
||||
src += '\nelse ';
|
||||
if (i < maxTextures - 1) {
|
||||
src += 'if(textureId == ' + i + '.0)';
|
||||
}
|
||||
src += '\n{';
|
||||
src += '\n\tcolor = texture2D(uSamplers[' + i + '], textureCoord * uSamplerSize[' + i + ']);';
|
||||
src += '\n}';
|
||||
}
|
||||
src += '\n';
|
||||
src += '\n';
|
||||
return src;
|
||||
}
|
||||
shaderGenerator.generateSampleSrc = generateSampleSrc;
|
||||
})(shaderGenerator = tilemap.shaderGenerator || (tilemap.shaderGenerator = {}));
|
||||
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var tilemap;
|
||||
(function (tilemap) {
|
||||
var squareShaderVert = "\nattribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\nattribute vec2 aAnim;\nattribute float aTextureId;\nattribute float aSize;\n\nuniform mat3 projectionMatrix;\nuniform vec2 samplerSize;\nuniform vec2 animationFrame;\nuniform float projectionScale;\n\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nvoid main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition + aSize * 0.5, 1.0)).xy, 0.0, 1.0);\n gl_PointSize = aSize * projectionScale;\n vTextureCoord = aTextureCoord + aAnim * animationFrame;\n vTextureId = aTextureId;\n vSize = aSize;\n}\n";
|
||||
var squareShaderFrag = "\nvarying vec2 vTextureCoord;\nvarying float vSize;\nvarying float vTextureId;\n\nuniform vec4 shadowColor;\nuniform sampler2D uSamplers[%count%];\nuniform vec2 uSamplerSize[%count%];\nuniform vec2 pointScale;\n\nvoid main(void){\n float margin = 0.5 / vSize;\n vec2 pointCoord = (gl_PointCoord - 0.5) * pointScale + 0.5;\n vec2 clamped = vec2(clamp(pointCoord.x, margin, 1.0 - margin), clamp(pointCoord.y, margin, 1.0 - margin));\n vec2 textureCoord = pointCoord * vSize + vTextureCoord;\n float textureId = vTextureId;\n vec4 color;\n %forloop%\n gl_FragColor = color;\n}\n\n";
|
||||
var SquareTileShader = (function (_super) {
|
||||
__extends(SquareTileShader, _super);
|
||||
function SquareTileShader(gl, maxTextures) {
|
||||
var _this = _super.call(this, gl, maxTextures, squareShaderVert, tilemap.shaderGenerator.generateFragmentSrc(maxTextures, squareShaderFrag)) || this;
|
||||
_this.vertSize = 8;
|
||||
_this.vertPerQuad = 1;
|
||||
_this.stride = _this.vertSize * 4;
|
||||
_this.maxTextures = maxTextures;
|
||||
tilemap.shaderGenerator.fillSamplers(_this, _this.maxTextures);
|
||||
return _this;
|
||||
}
|
||||
SquareTileShader.prototype.createVao = function (renderer, vb) {
|
||||
var gl = renderer.gl;
|
||||
return renderer.createVao()
|
||||
.addIndex(this.indexBuffer)
|
||||
.addAttribute(vb, this.attributes.aVertexPosition, gl.FLOAT, false, this.stride, 0)
|
||||
.addAttribute(vb, this.attributes.aTextureCoord, gl.FLOAT, false, this.stride, 2 * 4)
|
||||
.addAttribute(vb, this.attributes.aSize, gl.FLOAT, false, this.stride, 4 * 4)
|
||||
.addAttribute(vb, this.attributes.aAnim, gl.FLOAT, false, this.stride, 5 * 4)
|
||||
.addAttribute(vb, this.attributes.aTextureId, gl.FLOAT, false, this.stride, 7 * 4);
|
||||
};
|
||||
;
|
||||
return SquareTileShader;
|
||||
}(tilemap.TilemapShader));
|
||||
tilemap.SquareTileShader = SquareTileShader;
|
||||
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var tilemap;
|
||||
(function (tilemap) {
|
||||
var glCore = PIXI.glCore;
|
||||
function _hackSubImage(tex, sprite, clearBuffer, clearWidth, clearHeight) {
|
||||
var gl = tex.gl;
|
||||
var baseTex = sprite.texture.baseTexture;
|
||||
if (clearBuffer && clearWidth > 0 && clearHeight > 0) {
|
||||
gl.texSubImage2D(gl.TEXTURE_2D, 0, sprite.position.x, sprite.position.y, clearWidth, clearHeight, tex.format, tex.type, clearBuffer);
|
||||
}
|
||||
gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 1);
|
||||
gl.texSubImage2D(gl.TEXTURE_2D, 0, sprite.position.x, sprite.position.y, tex.format, tex.type, baseTex.source);
|
||||
}
|
||||
var TileRenderer = (function (_super) {
|
||||
__extends(TileRenderer, _super);
|
||||
function TileRenderer(renderer) {
|
||||
var _this = _super.call(this, renderer) || this;
|
||||
_this.vbs = {};
|
||||
_this.indices = new Uint16Array(0);
|
||||
_this.lastTimeCheck = 0;
|
||||
_this.tileAnim = [0, 0];
|
||||
_this.maxTextures = 4;
|
||||
_this.texLoc = [];
|
||||
return _this;
|
||||
}
|
||||
TileRenderer.prototype.onContextChange = function () {
|
||||
var gl = this.renderer.gl;
|
||||
var maxTextures = this.maxTextures;
|
||||
this.rectShader = new tilemap.RectTileShader(gl, maxTextures);
|
||||
this.squareShader = new tilemap.SquareTileShader(gl, maxTextures);
|
||||
this.checkIndexBuffer(2000);
|
||||
this.rectShader.indexBuffer = this.indexBuffer;
|
||||
this.squareShader.indexBuffer = this.indexBuffer;
|
||||
this.vbs = {};
|
||||
this.glTextures = [];
|
||||
this.boundSprites = [];
|
||||
this.initBounds();
|
||||
};
|
||||
TileRenderer.prototype.initBounds = function () {
|
||||
var gl = this.renderer.gl;
|
||||
var tempCanvas = document.createElement('canvas');
|
||||
tempCanvas.width = 2048;
|
||||
tempCanvas.height = 2048;
|
||||
for (var i = 0; i < this.maxTextures; i++) {
|
||||
var rt = PIXI.RenderTexture.create(2048, 2048);
|
||||
rt.baseTexture.premultipliedAlpha = true;
|
||||
rt.baseTexture.scaleMode = TileRenderer.SCALE_MODE;
|
||||
rt.baseTexture.wrapMode = PIXI.WRAP_MODES.CLAMP;
|
||||
this.renderer.textureManager.updateTexture(rt);
|
||||
this.glTextures.push(rt);
|
||||
var bs = [];
|
||||
for (var j = 0; j < 4; j++) {
|
||||
var spr = new PIXI.Sprite();
|
||||
spr.position.x = 1024 * (j & 1);
|
||||
spr.position.y = 1024 * (j >> 1);
|
||||
bs.push(spr);
|
||||
}
|
||||
this.boundSprites.push(bs);
|
||||
}
|
||||
};
|
||||
TileRenderer.prototype.bindTextures = function (renderer, shader, textures) {
|
||||
var bounds = this.boundSprites;
|
||||
var glts = this.glTextures;
|
||||
var len = textures.length;
|
||||
var maxTextures = this.maxTextures;
|
||||
if (len > 4 * maxTextures) {
|
||||
return;
|
||||
}
|
||||
var doClear = TileRenderer.DO_CLEAR;
|
||||
if (doClear && !this._clearBuffer) {
|
||||
this._clearBuffer = new Uint8Array(1024 * 1024 * 4);
|
||||
}
|
||||
var i;
|
||||
for (i = 0; i < len; i++) {
|
||||
var texture = textures[i];
|
||||
if (!texture || !textures[i].valid)
|
||||
continue;
|
||||
var bs = bounds[i >> 2][i & 3];
|
||||
if (!bs.texture ||
|
||||
bs.texture.baseTexture !== texture.baseTexture) {
|
||||
bs.texture = texture;
|
||||
var glt = glts[i >> 2];
|
||||
renderer.bindTexture(glt, 0, true);
|
||||
if (doClear) {
|
||||
_hackSubImage(glt.baseTexture._glTextures[renderer.CONTEXT_UID], bs, this._clearBuffer, 1024, 1024);
|
||||
}
|
||||
else {
|
||||
_hackSubImage(glt.baseTexture._glTextures[renderer.CONTEXT_UID], bs);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.texLoc.length = 0;
|
||||
for (i = 0; i < maxTextures; i++) {
|
||||
this.texLoc.push(renderer.bindTexture(glts[i], i, true));
|
||||
}
|
||||
shader.uniforms.uSamplers = this.texLoc;
|
||||
};
|
||||
TileRenderer.prototype.checkLeaks = function () {
|
||||
var now = Date.now();
|
||||
var old = now - 10000;
|
||||
if (this.lastTimeCheck < old ||
|
||||
this.lastTimeCheck > now) {
|
||||
this.lastTimeCheck = now;
|
||||
var vbs = this.vbs;
|
||||
for (var key in vbs) {
|
||||
if (vbs[key].lastTimeAccess < old) {
|
||||
this.removeVb(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
;
|
||||
TileRenderer.prototype.start = function () {
|
||||
this.renderer.state.setBlendMode(PIXI.BLEND_MODES.NORMAL);
|
||||
};
|
||||
TileRenderer.prototype.getVb = function (id) {
|
||||
this.checkLeaks();
|
||||
var vb = this.vbs[id];
|
||||
if (vb) {
|
||||
vb.lastAccessTime = Date.now();
|
||||
return vb;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
TileRenderer.prototype.createVb = function (useSquare) {
|
||||
var id = ++TileRenderer.vbAutoincrement;
|
||||
var shader = this.getShader(useSquare);
|
||||
var gl = this.renderer.gl;
|
||||
var vb = PIXI.glCore.GLBuffer.createVertexBuffer(gl, null, gl.STREAM_DRAW);
|
||||
var stuff = {
|
||||
id: id,
|
||||
vb: vb,
|
||||
vao: shader.createVao(this.renderer, vb),
|
||||
lastTimeAccess: Date.now(),
|
||||
useSquare: useSquare,
|
||||
shader: shader
|
||||
};
|
||||
this.vbs[id] = stuff;
|
||||
return stuff;
|
||||
};
|
||||
TileRenderer.prototype.removeVb = function (id) {
|
||||
if (this.vbs[id]) {
|
||||
this.vbs[id].vb.destroy();
|
||||
this.vbs[id].vao.destroy();
|
||||
delete this.vbs[id];
|
||||
}
|
||||
};
|
||||
TileRenderer.prototype.checkIndexBuffer = function (size) {
|
||||
var totalIndices = size * 6;
|
||||
var indices = this.indices;
|
||||
if (totalIndices <= indices.length) {
|
||||
return;
|
||||
}
|
||||
var len = indices.length || totalIndices;
|
||||
while (len < totalIndices) {
|
||||
len <<= 1;
|
||||
}
|
||||
indices = new Uint16Array(len);
|
||||
this.indices = indices;
|
||||
for (var i = 0, j = 0; i + 5 < indices.length; i += 6, j += 4) {
|
||||
indices[i + 0] = j + 0;
|
||||
indices[i + 1] = j + 1;
|
||||
indices[i + 2] = j + 2;
|
||||
indices[i + 3] = j + 0;
|
||||
indices[i + 4] = j + 2;
|
||||
indices[i + 5] = j + 3;
|
||||
}
|
||||
if (this.indexBuffer) {
|
||||
this.indexBuffer.upload(indices);
|
||||
}
|
||||
else {
|
||||
var gl = this.renderer.gl;
|
||||
this.indexBuffer = glCore.GLBuffer.createIndexBuffer(gl, this.indices, gl.STATIC_DRAW);
|
||||
}
|
||||
};
|
||||
TileRenderer.prototype.getShader = function (useSquare) {
|
||||
return useSquare ? this.squareShader : this.rectShader;
|
||||
};
|
||||
TileRenderer.prototype.destroy = function () {
|
||||
_super.prototype.destroy.call(this);
|
||||
this.rectShader.destroy();
|
||||
this.squareShader.destroy();
|
||||
this.rectShader = null;
|
||||
this.squareShader = null;
|
||||
};
|
||||
;
|
||||
return TileRenderer;
|
||||
}(PIXI.ObjectRenderer));
|
||||
TileRenderer.vbAutoincrement = 0;
|
||||
TileRenderer.SCALE_MODE = PIXI.SCALE_MODES.LINEAR;
|
||||
TileRenderer.DO_CLEAR = false;
|
||||
tilemap.TileRenderer = TileRenderer;
|
||||
PIXI.WebGLRenderer.registerPlugin('tilemap', TileRenderer);
|
||||
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
var PIXI;
|
||||
(function (PIXI) {
|
||||
var tilemap;
|
||||
(function (tilemap_1) {
|
||||
var ZLayer = (function (_super) {
|
||||
__extends(ZLayer, _super);
|
||||
function ZLayer(tilemap, zIndex) {
|
||||
var _this = _super.call(this) || this;
|
||||
_this._lastAnimationFrame = -1;
|
||||
_this.tilemap = tilemap;
|
||||
_this.z = zIndex;
|
||||
return _this;
|
||||
}
|
||||
ZLayer.prototype.clear = function () {
|
||||
var layers = this.children;
|
||||
for (var i = 0; i < layers.length; i++)
|
||||
layers[i].clear();
|
||||
this._previousLayers = 0;
|
||||
};
|
||||
ZLayer.prototype.cacheIfDirty = function () {
|
||||
var tilemap = this.tilemap;
|
||||
var layers = this.children;
|
||||
var modified = this._previousLayers != layers.length;
|
||||
this._previousLayers = layers.length;
|
||||
var buf = this.canvasBuffer;
|
||||
var tempRender = this._tempRender;
|
||||
if (!buf) {
|
||||
buf = this.canvasBuffer = document.createElement('canvas');
|
||||
tempRender = this._tempRender = new PIXI.CanvasRenderer(100, 100, { view: buf });
|
||||
tempRender.context = tempRender.rootContext;
|
||||
tempRender.plugins.tilemap.dontUseTransform = true;
|
||||
}
|
||||
if (buf.width != tilemap._layerWidth ||
|
||||
buf.height != tilemap._layerHeight) {
|
||||
buf.width = tilemap._layerWidth;
|
||||
buf.height = tilemap._layerHeight;
|
||||
modified = true;
|
||||
}
|
||||
var i;
|
||||
if (!modified) {
|
||||
for (i = 0; i < layers.length; i++) {
|
||||
if (layers[i].isModified(this._lastAnimationFrame != tilemap.animationFrame)) {
|
||||
modified = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
this._lastAnimationFrame = tilemap.animationFrame;
|
||||
if (modified) {
|
||||
if (tilemap._hackRenderer) {
|
||||
tilemap._hackRenderer(tempRender);
|
||||
}
|
||||
tempRender.context.clearRect(0, 0, buf.width, buf.height);
|
||||
for (i = 0; i < layers.length; i++) {
|
||||
layers[i].clearModify();
|
||||
layers[i].renderCanvas(tempRender);
|
||||
}
|
||||
}
|
||||
this.layerTransform = this.worldTransform;
|
||||
for (i = 0; i < layers.length; i++) {
|
||||
this.layerTransform = layers[i].worldTransform;
|
||||
break;
|
||||
}
|
||||
};
|
||||
;
|
||||
ZLayer.prototype.renderCanvas = function (renderer) {
|
||||
this.cacheIfDirty();
|
||||
var wt = this.layerTransform;
|
||||
renderer.context.setTransform(wt.a, wt.b, wt.c, wt.d, wt.tx * renderer.resolution, wt.ty * renderer.resolution);
|
||||
var tilemap = this.tilemap;
|
||||
renderer.context.drawImage(this.canvasBuffer, 0, 0);
|
||||
};
|
||||
;
|
||||
return ZLayer;
|
||||
}(PIXI.Container));
|
||||
tilemap_1.ZLayer = ZLayer;
|
||||
})(tilemap = PIXI.tilemap || (PIXI.tilemap = {}));
|
||||
})(PIXI || (PIXI = {}));
|
||||
//# sourceMappingURL=pixi-tilemap.js.map
|
||||
40318
js/libs/pixi.js
Normal file
40318
js/libs/pixi.js
Normal file
File diff suppressed because it is too large
Load Diff
9
js/main.js
Normal file
9
js/main.js
Normal file
@@ -0,0 +1,9 @@
|
||||
//=============================================================================
|
||||
// main.js
|
||||
//=============================================================================
|
||||
|
||||
PluginManager.setup($plugins);
|
||||
|
||||
window.onload = function() {
|
||||
SceneManager.run(Scene_Boot);
|
||||
};
|
||||
7
js/plugins.js
Normal file
7
js/plugins.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// Generated by RPG Maker.
|
||||
// Do not edit this file directly.
|
||||
var $plugins =
|
||||
[
|
||||
{"name":"Community_Basic","status":true,"description":"Basic plugin for manipulating important parameters.","parameters":{"cacheLimit":"20","screenWidth":"816","screenHeight":"624","changeWindowWidthTo":"","changeWindowHeightTo":"","renderingMode":"auto","alwaysDash":"off"}},
|
||||
{"name":"CustomLogo","status":true,"description":"Shows RPG Maker and user logos at the start of the game.","parameters":{"logo1":"","logo1ImageName":"MadeWithMv","logo1Skippable":"true","logo1Coordinate":"","logo1X":"408","logo1Y":"312","logo1Origin":"0.5","logo1Time":"","logo1FadeinFrames":"12","logo1FadeoutFrames":"12","logo1DurationFrames":"120","logo2":"","logo2ImageName":"","logo2Skippable":"true","logo2Coordinate":"","logo2X":"408","logo2Y":"312","logo2Origin":"0.5","logo2Time":"","logo2FadeinFrames":"12","logo2FadeoutFrames":"12","logo2DurationFrames":"120","logo3":"","logo3ImageName":"","logo3Skippable":"true","logo3Coordinate":"","logo3X":"408","logo3Y":"312","logo3Origin":"0.5","logo3Time":"","logo3FadeinFrames":"12","logo3FadeoutFrames":"12","logo3DurationFrames":"120","allowTotalSkip":"true"}}
|
||||
];
|
||||
92
js/plugins/AltMenuScreen.js
Normal file
92
js/plugins/AltMenuScreen.js
Normal file
@@ -0,0 +1,92 @@
|
||||
//=============================================================================
|
||||
// AltMenuScreen.js
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @plugindesc Alternative menu screen layout.
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help This plugin does not provide plugin commands.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @plugindesc メニュー画面のレイアウトを変更します。
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help このプラグインには、プラグインコマンドはありません。
|
||||
*/
|
||||
|
||||
(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;
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.windowWidth = function() {
|
||||
return Graphics.boxWidth;
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.maxCols = function() {
|
||||
return 4;
|
||||
};
|
||||
|
||||
Window_MenuCommand.prototype.numVisibleRows = function() {
|
||||
return 2;
|
||||
};
|
||||
|
||||
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.maxCols = function() {
|
||||
return 4;
|
||||
};
|
||||
|
||||
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.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);
|
||||
};
|
||||
|
||||
})();
|
||||
134
js/plugins/AltSaveScreen.js
Normal file
134
js/plugins/AltSaveScreen.js
Normal file
@@ -0,0 +1,134 @@
|
||||
//=============================================================================
|
||||
// AltSaveScreen.js
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @plugindesc Alternative save/load screen layout.
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help This plugin does not provide plugin commands.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @plugindesc セーブ/ロード画面のレイアウトを変更します。
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @help このプラグインには、プラグインコマンドはありません。
|
||||
*/
|
||||
|
||||
(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_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.maxCols = function() {
|
||||
return 4;
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.numVisibleRows = function() {
|
||||
return 5;
|
||||
};
|
||||
|
||||
Window_SavefileList.prototype.spacing = function() {
|
||||
return 8;
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Window_SavefileStatus.prototype = Object.create(Window_Base.prototype);
|
||||
Window_SavefileStatus.prototype.constructor = Window_SavefileStatus;
|
||||
|
||||
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.setMode = function(mode) {
|
||||
this._mode = mode;
|
||||
};
|
||||
|
||||
Window_SavefileStatus.prototype.setId = function(id) {
|
||||
this._id = id;
|
||||
this.refresh();
|
||||
};
|
||||
|
||||
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.drawFileId = function(id, x, y) {
|
||||
this.drawText(TextManager.file + ' ' + id, x, y, 180);
|
||||
};
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
137
js/plugins/Community_Basic.js
Normal file
137
js/plugins/Community_Basic.js
Normal file
@@ -0,0 +1,137 @@
|
||||
/*:
|
||||
* @plugindesc Plugin used to set basic parameters.
|
||||
* @author RM CoreScript team
|
||||
*
|
||||
* @help This plugin does not provide plugin commands.
|
||||
*
|
||||
* @param cacheLimit
|
||||
* @desc For setting the upper limit of image memory cache. (MPix)
|
||||
* @default 10
|
||||
*
|
||||
* @param screenWidth
|
||||
* @desc For setting the screen width.
|
||||
* @default 816
|
||||
*
|
||||
* @param screenHeight
|
||||
* @desc For setting the screen height.
|
||||
* @default 624
|
||||
*
|
||||
* @param changeWindowWidthTo
|
||||
* @desc If set, change window width to this value
|
||||
*
|
||||
* @param changeWindowHeightTo
|
||||
* @desc If set, change window height to this value
|
||||
*
|
||||
* @param renderingMode
|
||||
* @desc Rendering mode (canvas/webgl/auto)
|
||||
* @default auto
|
||||
*
|
||||
* @param alwaysDash
|
||||
* @desc To set initial value as to whether the player always dashes. (on/off)
|
||||
* @default off
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @plugindesc 基本的なパラメーターを設定するプラグインです。
|
||||
* @author RM CoreScript team
|
||||
*
|
||||
* @help このプラグインにはプラグインコマンドはありません。
|
||||
*
|
||||
* @param cacheLimit
|
||||
* @desc 画像のメモリへのキャッシュの上限値 (MPix)
|
||||
* @default 10
|
||||
*
|
||||
* @param screenWidth
|
||||
* @desc 画面サイズの幅
|
||||
* @default 816
|
||||
*
|
||||
* @param screenHeight
|
||||
* @desc 画面サイズの高さ
|
||||
* @default 624
|
||||
*
|
||||
* @param changeWindowWidthTo
|
||||
* @desc 値が設定された場合、ウインドウの幅を指定した値に変更
|
||||
*
|
||||
* @param changeWindowHeightTo
|
||||
* @desc 値が設定された場合、ウインドウの高さを指定した値に変更
|
||||
*
|
||||
* @param renderingMode
|
||||
* @desc レンダリングモード (canvas/webgl/auto)
|
||||
* @default auto
|
||||
*
|
||||
* @param alwaysDash
|
||||
* @desc プレイヤーが常時ダッシュするかどうかの初期値 (on/off)
|
||||
* @default off
|
||||
*/
|
||||
|
||||
(function() {
|
||||
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 _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);
|
||||
}
|
||||
};
|
||||
})();
|
||||
802
js/plugins/CustomLogo.js
Normal file
802
js/plugins/CustomLogo.js
Normal file
@@ -0,0 +1,802 @@
|
||||
//=============================================================================
|
||||
// RPG Maker MZ - CustomLogo
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @target MV MZ
|
||||
* @plugindesc Shows RPG Maker and user logos at the start of the game.
|
||||
* @author nz_prism
|
||||
*
|
||||
* @help CustomLogo.js
|
||||
* ver. 1.0.0
|
||||
*
|
||||
* [History]
|
||||
* 05/12/2023 1.0.0 Released
|
||||
*
|
||||
* This plugin shows RPG Maker logo and other images at the start of the game,
|
||||
* such as user logos or notes. It can show up to 3 logos in turns. Logo
|
||||
* settings including image file and showing times can be configured through
|
||||
* plugin parameters.
|
||||
* Setting the plugin parameter "Logo n Skippable" to true enables players to
|
||||
* skip the logo by pressing OK or cancel button. Plus, setting the plugin
|
||||
* parameter "Allow Total Skip" to true enables players to skip all the logos
|
||||
* just by single button pressing. If there are any logos which aren't
|
||||
* skippable, it will proceed to the timing before the logo appears.
|
||||
*
|
||||
* Note the default image for Logo 1 is an RPG Maker logo. Although you can
|
||||
* replace it with any image, you are recommended to use it to display your
|
||||
* game is made with RPG Maker.
|
||||
*
|
||||
* @param logo1
|
||||
* @text Logo 1 Settings
|
||||
* @desc The settings for the first logo.
|
||||
*
|
||||
* @param logo1ImageName
|
||||
* @text Logo 1 Image Name
|
||||
* @desc The image file name for the first logo. If no image is specified, the next logo will be shown.
|
||||
* @parent logo1
|
||||
* @type file
|
||||
* @dir img/system
|
||||
*
|
||||
* @param logo1Skippable
|
||||
* @text Logo 1 Skippable
|
||||
* @desc If true, players can skip the first logo.
|
||||
* @parent logo1
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @param logo1Coordinate
|
||||
* @text Logo 1 Coordinate
|
||||
* @desc The coordinate settings for the first logo.
|
||||
* @parent logo1
|
||||
*
|
||||
* @param logo1X
|
||||
* @text Logo 1 X
|
||||
* @desc The x for the first logo.
|
||||
* @parent logo1Coordinate
|
||||
* @type number
|
||||
* @default 408
|
||||
*
|
||||
* @param logo1Y
|
||||
* @text Logo 1 Y
|
||||
* @desc The y for the first logo.
|
||||
* @parent logo1Coordinate
|
||||
* @type number
|
||||
* @default 312
|
||||
*
|
||||
* @param logo1Origin
|
||||
* @text Logo 1 Origin
|
||||
* @desc THe origin for the first logo.
|
||||
* @parent logo1Coordinate
|
||||
* @default 0.5
|
||||
* @type select
|
||||
* @option Upper Left
|
||||
* @value 0
|
||||
* @option Center
|
||||
* @value 0.5
|
||||
*
|
||||
* @param logo1Time
|
||||
* @text Logo 1 Times
|
||||
* @desc The time settings for the first logo.
|
||||
* @parent logo1
|
||||
*
|
||||
* @param logo1FadeinFrames
|
||||
* @text Logo 1 Fade-in Time
|
||||
* @desc The frames for the first logo to fade in.
|
||||
* @parent logo1Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo1FadeoutFrames
|
||||
* @text Logo 1 Fade-out Time
|
||||
* @desc The frames for the first logo to fade out.
|
||||
* @parent logo1Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo1DurationFrames
|
||||
* @text Logo 1 Shown Time
|
||||
* @desc The frames for the first logo to be shown.
|
||||
* @parent logo1Time
|
||||
* @type number
|
||||
* @default 120
|
||||
* @min 1
|
||||
*
|
||||
* @param logo2
|
||||
* @text Logo 2 Settings
|
||||
* @desc The settings for the second logo.
|
||||
*
|
||||
* @param logo2ImageName
|
||||
* @text Logo 2 Image Name
|
||||
* @desc The image file name for the second logo. If no image is specified, the next logo will be shown.
|
||||
* @parent logo2
|
||||
* @type file
|
||||
* @dir img/system
|
||||
*
|
||||
* @param logo2Skippable
|
||||
* @text Logo 2 Skippable
|
||||
* @desc If true, players can skip the second logo.
|
||||
* @parent logo2
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @param logo2Coordinate
|
||||
* @text Logo 2 Coordinate
|
||||
* @desc The coordinate settings for the second logo.
|
||||
* @parent logo2
|
||||
*
|
||||
* @param logo2X
|
||||
* @text Logo 2 X
|
||||
* @desc The x for the second logo.
|
||||
* @parent logo2Coordinate
|
||||
* @type number
|
||||
* @default 408
|
||||
*
|
||||
* @param logo2Y
|
||||
* @text Logo 2 Y
|
||||
* @desc The y for the second logo.
|
||||
* @parent logo2Coordinate
|
||||
* @type number
|
||||
* @default 312
|
||||
*
|
||||
* @param logo2Origin
|
||||
* @text Logo 2 Origin
|
||||
* @desc THe origin for the second logo.
|
||||
* @parent logo2Coordinate
|
||||
* @default 0.5
|
||||
* @type select
|
||||
* @option Upper Left
|
||||
* @value 0
|
||||
* @option Center
|
||||
* @value 0.5
|
||||
*
|
||||
* @param logo2Time
|
||||
* @text Logo 2 Times
|
||||
* @desc The time settings for the second logo.
|
||||
* @parent logo2
|
||||
*
|
||||
* @param logo2FadeinFrames
|
||||
* @text Logo 2 Fade-in Time
|
||||
* @desc The frames for the second logo to fade in.
|
||||
* @parent logo2Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo2FadeoutFrames
|
||||
* @text Logo 2 Fade-out Time
|
||||
* @desc The frames for the second logo to fade out.
|
||||
* @parent logo2Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo2DurationFrames
|
||||
* @text Logo 2 Shown Time
|
||||
* @desc The frames for the second logo to be shown.
|
||||
* @parent logo2Time
|
||||
* @type number
|
||||
* @default 120
|
||||
* @min 1
|
||||
*
|
||||
* @param logo3
|
||||
* @text Logo 3 Settings
|
||||
* @desc The settings for the third logo.
|
||||
*
|
||||
* @param logo3ImageName
|
||||
* @text Logo 3 Image Name
|
||||
* @desc The image file name for the third logo. If no image is specified, it will proceed to the title scene.
|
||||
* @parent logo3
|
||||
* @type file
|
||||
* @dir img/system
|
||||
*
|
||||
* @param logo3Skippable
|
||||
* @text Logo 3 Skippable
|
||||
* @desc If true, players can skip the third logo.
|
||||
* @parent logo3
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @param logo3Coordinate
|
||||
* @text Logo 3 Coordinate
|
||||
* @desc The coordinate settings for the third logo.
|
||||
* @parent logo3
|
||||
*
|
||||
* @param logo3X
|
||||
* @text Logo 3 X
|
||||
* @desc The x for the third logo.
|
||||
* @parent logo3Coordinate
|
||||
* @type number
|
||||
* @default 408
|
||||
*
|
||||
* @param logo3Y
|
||||
* @text Logo 3 Y
|
||||
* @desc The y for the third logo.
|
||||
* @parent logo3Coordinate
|
||||
* @type number
|
||||
* @default 312
|
||||
*
|
||||
* @param logo3Origin
|
||||
* @text Logo 3 Origin
|
||||
* @desc THe origin for the third logo.
|
||||
* @parent logo3Coordinate
|
||||
* @default 0.5
|
||||
* @type select
|
||||
* @option Upper Left
|
||||
* @value 0
|
||||
* @option Center
|
||||
* @value 0.5
|
||||
*
|
||||
* @param logo3Time
|
||||
* @text Logo 3 Times
|
||||
* @desc The time settings for the third logo.
|
||||
* @parent logo3
|
||||
*
|
||||
* @param logo3FadeinFrames
|
||||
* @text Logo 3 Fade-in Time
|
||||
* @desc The frames for the third logo to fade in.
|
||||
* @parent logo3Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo3FadeoutFrames
|
||||
* @text Logo 3 Fade-out Time
|
||||
* @desc The frames for the third logo to fade out.
|
||||
* @parent logo3Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo3DurationFrames
|
||||
* @text Logo 3 Shown Time
|
||||
* @desc The frames for the third logo to be shown.
|
||||
* @parent logo3Time
|
||||
* @type number
|
||||
* @default 120
|
||||
* @min 1
|
||||
*
|
||||
* @param allowTotalSkip
|
||||
* @text Allow Total Skip
|
||||
* @desc If true, players can skip all the logos just by single button pressing.
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @target MV MZ
|
||||
* @plugindesc ゲーム起動時にRPG Makerおよびユーザーロゴを表示します。
|
||||
* @author nz_prism
|
||||
*
|
||||
* @help CustomLogo.js
|
||||
* ver. 1.0.0
|
||||
*
|
||||
* [バージョン履歴]
|
||||
* 2023/05/12 1.0.0 リリース
|
||||
*
|
||||
* RPG Makerロゴおよび各種ユーザーロゴや注意書きなどをゲーム起動時に表示するプ
|
||||
* ラグインです。最大3つまでのロゴを順番に表示できます。表示画像や表示時間はプ
|
||||
* ラグインパラメータにより細かく設定することが可能です。
|
||||
* プラグインパラメータ「ロゴnスキップ可能」をオンに設定すると、決定ボタンや
|
||||
* キャンセルボタンの押下によるそのロゴのスキップが可能になります。また、プラグ
|
||||
* インパラメータ「全スキップを許可」をオンにすると、一回のボタン押下により全て
|
||||
* のロゴがスキップされるようになります。スキップ不可のロゴが存在する場合、その
|
||||
* ロゴの前までのロゴがスキップされます。
|
||||
*
|
||||
* なおロゴ1の画像としてデフォルトで設定されている画像はRPG Makerのロゴです。
|
||||
* 本ロゴについては、RPGMaker製ゲームであることを明示するために表示を推奨して
|
||||
* おります。
|
||||
*
|
||||
* @param logo1
|
||||
* @text ロゴ1設定
|
||||
* @desc 最初に表示するロゴの設定です。
|
||||
*
|
||||
* @param logo1ImageName
|
||||
* @text ロゴ1画像名
|
||||
* @desc 最初に表示するロゴの画像ファイル名です。未設定の場合、次のロゴが表示されます。
|
||||
* @parent logo1
|
||||
* @type file
|
||||
* @dir img/system
|
||||
*
|
||||
* @param logo1Skippable
|
||||
* @text ロゴ1スキップ可能
|
||||
* @desc オンにすると最初に表示するロゴをボタン押下によりスキップ可能になります。
|
||||
* @parent logo1
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @param logo1Coordinate
|
||||
* @text ロゴ1座標
|
||||
* @desc 最初に表示するロゴの座標設定です。
|
||||
* @parent logo1
|
||||
*
|
||||
* @param logo1X
|
||||
* @text ロゴ1X座標
|
||||
* @desc 最初に表示するロゴのX座標です。
|
||||
* @parent logo1Coordinate
|
||||
* @type number
|
||||
* @default 408
|
||||
*
|
||||
* @param logo1Y
|
||||
* @text ロゴ1Y座標
|
||||
* @desc 最初に表示するロゴのY座標です。
|
||||
* @parent logo1Coordinate
|
||||
* @type number
|
||||
* @default 312
|
||||
*
|
||||
* @param logo1Origin
|
||||
* @text ロゴ1原点
|
||||
* @desc 最初に表示するロゴの座標原点です。
|
||||
* @parent logo1Coordinate
|
||||
* @default 0.5
|
||||
* @type select
|
||||
* @option 左上
|
||||
* @value 0
|
||||
* @option 中央
|
||||
* @value 0.5
|
||||
*
|
||||
* @param logo1Time
|
||||
* @text ロゴ1表示時間
|
||||
* @desc 最初に表示するロゴの表示時間設定です。
|
||||
* @parent logo1
|
||||
*
|
||||
* @param logo1FadeinFrames
|
||||
* @text ロゴ1フェードイン時間
|
||||
* @desc 最初に表示するロゴのフェードインフレーム数です。
|
||||
* @parent logo1Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo1FadeoutFrames
|
||||
* @text ロゴ1フェードアウト時間
|
||||
* @desc 最初に表示するロゴのフェードアウトフレーム数です。
|
||||
* @parent logo1Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo1DurationFrames
|
||||
* @text ロゴ1表示時間
|
||||
* @desc 最初に表示するロゴの表示フレーム数です。
|
||||
* @parent logo1Time
|
||||
* @type number
|
||||
* @default 120
|
||||
* @min 1
|
||||
*
|
||||
* @param logo2
|
||||
* @text ロゴ2設定
|
||||
* @desc 2番目に表示するロゴの設定です。
|
||||
*
|
||||
* @param logo2ImageName
|
||||
* @text ロゴ2画像名
|
||||
* @desc 2番目に表示するロゴの画像ファイル名です。未設定の場合、次のロゴが表示されます。
|
||||
* @parent logo2
|
||||
* @type file
|
||||
* @dir img/system
|
||||
*
|
||||
* @param logo2Skippable
|
||||
* @text ロゴ2スキップ可能
|
||||
* @desc オンにすると2番目に表示するロゴをボタン押下によりスキップ可能になります。
|
||||
* @parent logo2
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @param logo2Coordinate
|
||||
* @text ロゴ2座標
|
||||
* @desc 2番目に表示するロゴの座標設定です。
|
||||
* @parent logo2
|
||||
*
|
||||
* @param logo2X
|
||||
* @text ロゴ2X座標
|
||||
* @desc 2番目に表示するロゴのX座標です。
|
||||
* @parent logo2Coordinate
|
||||
* @type number
|
||||
* @default 408
|
||||
*
|
||||
* @param logo2Y
|
||||
* @text ロゴ2Y座標
|
||||
* @desc 2番目に表示するロゴのY座標です。
|
||||
* @parent logo2Coordinate
|
||||
* @type number
|
||||
* @default 312
|
||||
*
|
||||
* @param logo2Origin
|
||||
* @text ロゴ2原点
|
||||
* @desc 2番目に表示するロゴの座標原点です。
|
||||
* @parent logo2Coordinate
|
||||
* @default 0.5
|
||||
* @type select
|
||||
* @option 左上
|
||||
* @value 0
|
||||
* @option 中央
|
||||
* @value 0.5
|
||||
*
|
||||
* @param logo2Time
|
||||
* @text ロゴ2表示時間
|
||||
* @desc 2番目に表示するロゴの表示時間設定です。
|
||||
* @parent logo2
|
||||
*
|
||||
* @param logo2FadeinFrames
|
||||
* @text ロゴ2フェードイン時間
|
||||
* @desc 2番目に表示するロゴのフェードインフレーム数です。
|
||||
* @parent logo2Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo2FadeoutFrames
|
||||
* @text ロゴ2フェードアウト時間
|
||||
* @desc 2番目に表示するロゴのフェードアウトフレーム数です。
|
||||
* @parent logo2Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo2DurationFrames
|
||||
* @text ロゴ2表示時間
|
||||
* @desc 2番目に表示するロゴの表示フレーム数です。
|
||||
* @parent logo2Time
|
||||
* @type number
|
||||
* @default 120
|
||||
* @min 1
|
||||
*
|
||||
* @param logo3
|
||||
* @text ロゴ3設定
|
||||
* @desc 3番目に表示するロゴの設定です。
|
||||
*
|
||||
* @param logo3ImageName
|
||||
* @text ロゴ3画像名
|
||||
* @desc 3番目に表示するロゴの画像ファイル名です。未設定の場合、タイトル画面に移行します。
|
||||
* @parent logo3
|
||||
* @type file
|
||||
* @dir img/system
|
||||
*
|
||||
* @param logo3Skippable
|
||||
* @text ロゴ3スキップ可能
|
||||
* @desc オンにすると3番目に表示するロゴをボタン押下によりスキップ可能になります。
|
||||
* @parent logo3
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
* @param logo3Coordinate
|
||||
* @text ロゴ3座標
|
||||
* @desc 3番目に表示するロゴの座標設定です。
|
||||
* @parent logo3
|
||||
*
|
||||
* @param logo3X
|
||||
* @text ロゴ3X座標
|
||||
* @desc 3番目に表示するロゴのX座標です。
|
||||
* @parent logo3Coordinate
|
||||
* @type number
|
||||
* @default 408
|
||||
*
|
||||
* @param logo3Y
|
||||
* @text ロゴ3Y座標
|
||||
* @desc 3番目に表示するロゴのY座標です。
|
||||
* @parent logo3Coordinate
|
||||
* @type number
|
||||
* @default 312
|
||||
*
|
||||
* @param logo3Origin
|
||||
* @text ロゴ3原点
|
||||
* @desc 3番目に表示するロゴの座標原点です。
|
||||
* @parent logo3Coordinate
|
||||
* @default 0.5
|
||||
* @type select
|
||||
* @option 左上
|
||||
* @value 0
|
||||
* @option 中央
|
||||
* @value 0.5
|
||||
*
|
||||
* @param logo3Time
|
||||
* @text ロゴ3表示時間
|
||||
* @desc 3番目に表示するロゴの表示時間設定です。
|
||||
* @parent logo3
|
||||
*
|
||||
* @param logo3FadeinFrames
|
||||
* @text ロゴ3フェードイン時間
|
||||
* @desc 3番目に表示するロゴのフェードインフレーム数です。
|
||||
* @parent logo3Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo3FadeoutFrames
|
||||
* @text ロゴ3フェードアウト時間
|
||||
* @desc 3番目に表示するロゴのフェードアウトフレーム数です。
|
||||
* @parent logo3Time
|
||||
* @type number
|
||||
* @default 12
|
||||
* @min 1
|
||||
*
|
||||
* @param logo3DurationFrames
|
||||
* @text ロゴ3表示時間
|
||||
* @desc 3番目に表示するロゴの表示フレーム数です。
|
||||
* @parent logo3Time
|
||||
* @type number
|
||||
* @default 120
|
||||
* @min 1
|
||||
*
|
||||
* @param allowTotalSkip
|
||||
* @text 全スキップを許可
|
||||
* @desc オンにすると一回のボタン押下によりすべてのロゴがスキップされます(スキップ可能なもののみ)。
|
||||
* @type boolean
|
||||
* @default true
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
(() => {
|
||||
'use strict';
|
||||
var PLUGIN_NAME = "CustomLogo";
|
||||
var pluginParams = PluginManager.parameters(PLUGIN_NAME);
|
||||
|
||||
var LOGO1_IMAGE_NAME = pluginParams.logo1ImageName;
|
||||
var LOGO1_SKIPPABLE = pluginParams.logo1Skippable == "true";
|
||||
var LOGO1_X = Number(pluginParams.logo1X);
|
||||
var LOGO1_Y = Number(pluginParams.logo1Y);
|
||||
var LOGO1_ORIGN = Number(pluginParams.logo1Origin);
|
||||
var LOGO1_FADEIN_FRAMES = Number(pluginParams.logo1FadeinFrames);
|
||||
var LOGO1_FADEOUT_FRAMES = Number(pluginParams.logo1FadeoutFrames);
|
||||
var LOGO1_DURATION_FRAMES = Number(pluginParams.logo1DurationFrames);
|
||||
|
||||
var LOGO2_IMAGE_NAME = pluginParams.logo2ImageName;
|
||||
var LOGO2_SKIPPABLE = pluginParams.logo2Skippable == "true";
|
||||
var LOGO2_X = Number(pluginParams.logo2X);
|
||||
var LOGO2_Y = Number(pluginParams.logo2Y);
|
||||
var LOGO2_ORIGN = Number(pluginParams.logo2Origin);
|
||||
var LOGO2_FADEIN_FRAMES = Number(pluginParams.logo2FadeinFrames);
|
||||
var LOGO2_FADEOUT_FRAMES = Number(pluginParams.logo2FadeoutFrames);
|
||||
var LOGO2_DURATION_FRAMES = Number(pluginParams.logo2DurationFrames);
|
||||
|
||||
var LOGO3_IMAGE_NAME = pluginParams.logo3ImageName;
|
||||
var LOGO3_SKIPPABLE = pluginParams.logo3Skippable == "true";
|
||||
var LOGO3_X = Number(pluginParams.logo3X);
|
||||
var LOGO3_Y = Number(pluginParams.logo3Y);
|
||||
var LOGO3_ORIGN = Number(pluginParams.logo3Origin);
|
||||
var LOGO3_FADEIN_FRAMES = Number(pluginParams.logo3FadeinFrames);
|
||||
var LOGO3_FADEOUT_FRAMES = Number(pluginParams.logo3FadeoutFrames);
|
||||
var LOGO3_DURATION_FRAMES = Number(pluginParams.logo3DurationFrames);
|
||||
|
||||
var ALLOW_TOTAL_SKIP = pluginParams.allowTotalSkip == "true";
|
||||
|
||||
|
||||
ImageManager.loadLogoImages = function() {
|
||||
this.loadSystem(LOGO1_IMAGE_NAME);
|
||||
this.loadSystem(LOGO2_IMAGE_NAME);
|
||||
this.loadSystem(LOGO3_IMAGE_NAME);
|
||||
};
|
||||
|
||||
|
||||
var _Scene_Boot_prototype_loadSystemImages = Scene_Boot.prototype.loadSystemImages;
|
||||
Scene_Boot.prototype.loadSystemImages = function() {
|
||||
_Scene_Boot_prototype_loadSystemImages.call(this);
|
||||
ImageManager.loadLogoImages();
|
||||
};
|
||||
|
||||
if (Utils.RPGMAKER_NAME == "MZ") {
|
||||
Scene_Boot.prototype.startNormalGame = function() {
|
||||
this.checkPlayerLocation();
|
||||
DataManager.setupNewGame();
|
||||
SceneManager.goto(Scene_Logo);
|
||||
Window_TitleCommand.initCommandPosition();
|
||||
};
|
||||
} else {
|
||||
Scene_Boot.prototype.start = 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_Logo);
|
||||
Window_TitleCommand.initCommandPosition();
|
||||
}
|
||||
this.updateDocumentTitle();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
function Scene_Logo() {
|
||||
this.initialize(...arguments);
|
||||
}
|
||||
|
||||
Scene_Logo.prototype = Object.create(Scene_Base.prototype);
|
||||
Scene_Logo.prototype.constructor = Scene_Logo;
|
||||
|
||||
Scene_Logo.prototype.initialize = function() {
|
||||
Scene_Base.prototype.initialize.call(this);
|
||||
this._logoIndex = 0;
|
||||
this._phase = 0;
|
||||
this._duration = 0;
|
||||
};
|
||||
|
||||
Scene_Logo.prototype.create = function() {
|
||||
Scene_Base.prototype.create.call(this);
|
||||
this.createSprites();
|
||||
};
|
||||
|
||||
Scene_Logo.prototype.start = function() {
|
||||
Scene_Base.prototype.start.call(this);
|
||||
SceneManager.clearStack();
|
||||
};
|
||||
|
||||
Scene_Logo.prototype.update = function() {
|
||||
Scene_Base.prototype.update.call(this);
|
||||
this.updateInput();
|
||||
this.updatePhase();
|
||||
};
|
||||
|
||||
Scene_Logo.prototype.updateInput = function() {
|
||||
if (
|
||||
Input.isTriggered("ok") ||
|
||||
Input.isTriggered("cancel") ||
|
||||
TouchInput.isTriggered() ||
|
||||
TouchInput.isCancelled()
|
||||
) {
|
||||
var oldLogoIndex = this._logoIndex;
|
||||
switch (this._logoIndex) {
|
||||
case 0:
|
||||
if (LOGO1_SKIPPABLE) {
|
||||
this._logoIndex++;
|
||||
this._logo1Sprite.opacity = 0;
|
||||
if (ALLOW_TOTAL_SKIP) {
|
||||
if (LOGO2_SKIPPABLE) {
|
||||
this._logoIndex++;
|
||||
if (LOGO3_SKIPPABLE) {
|
||||
this._logoIndex++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (LOGO2_SKIPPABLE) {
|
||||
this._logoIndex++;
|
||||
this._logo2Sprite.opacity = 0;
|
||||
if (ALLOW_TOTAL_SKIP && LOGO3_SKIPPABLE) {
|
||||
this._logoIndex++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (LOGO3_SKIPPABLE) this._logoIndex++;
|
||||
break;
|
||||
}
|
||||
if (this._logoIndex != oldLogoIndex) {
|
||||
this._phase = 0;
|
||||
this._duration = 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Logo.prototype.increasingOpacityPerFrame = function() {
|
||||
switch (this._logoIndex) {
|
||||
case 0: return Math.ceil(255 / LOGO1_FADEIN_FRAMES);
|
||||
case 1: return Math.ceil(255 / LOGO2_FADEIN_FRAMES);
|
||||
case 2: return Math.ceil(255 / LOGO3_FADEIN_FRAMES);
|
||||
default: return 22;
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Logo.prototype.decreasingOpacityPerFrame = function() {
|
||||
switch (this._logoIndex) {
|
||||
case 0: return Math.ceil(255 / LOGO1_FADEOUT_FRAMES);
|
||||
case 1: return Math.ceil(255 / LOGO2_FADEOUT_FRAMES);
|
||||
case 2: return Math.ceil(255 / LOGO3_FADEOUT_FRAMES);
|
||||
default: return 22;
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Logo.prototype.updatePhase = function() {
|
||||
var sprite;
|
||||
var maxDuration;
|
||||
switch (this._logoIndex) {
|
||||
case 0:
|
||||
if (LOGO1_IMAGE_NAME) {
|
||||
sprite = this._logo1Sprite;
|
||||
switch (this._phase) {
|
||||
case 0: maxDuration = LOGO1_FADEIN_FRAMES; break;
|
||||
case 2: maxDuration = LOGO1_FADEOUT_FRAMES; break;
|
||||
default: maxDuration = LOGO1_DURATION_FRAMES; break;
|
||||
}
|
||||
} else {
|
||||
this._logoIndex++;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (LOGO2_IMAGE_NAME) {
|
||||
sprite = this._logo2Sprite;
|
||||
switch (this._phase) {
|
||||
case 0: maxDuration = LOGO2_FADEIN_FRAMES; break;
|
||||
case 2: maxDuration = LOGO2_FADEOUT_FRAMES; break;
|
||||
default: maxDuration = LOGO2_DURATION_FRAMES; break;
|
||||
}
|
||||
} else {
|
||||
this._logoIndex++;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (LOGO3_IMAGE_NAME) {
|
||||
sprite = this._logo3Sprite;
|
||||
switch (this._phase) {
|
||||
case 0: maxDuration = LOGO3_FADEIN_FRAMES; break;
|
||||
case 2: maxDuration = LOGO3_FADEOUT_FRAMES; break;
|
||||
default: maxDuration = LOGO3_DURATION_FRAMES; break;
|
||||
}
|
||||
} else {
|
||||
this._logoIndex++;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SceneManager.goto(Scene_Title);
|
||||
return;
|
||||
}
|
||||
if (this._duration < maxDuration) {
|
||||
this._duration++;
|
||||
switch (this._phase) {
|
||||
case 0:
|
||||
sprite.opacity = Math.min(sprite.opacity + this.increasingOpacityPerFrame(), 255);
|
||||
break;
|
||||
case 2:
|
||||
sprite.opacity = Math.max(sprite.opacity - this.decreasingOpacityPerFrame(), 0);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
this._duration = 0;
|
||||
this._phase++;
|
||||
if (this._phase == 3) {
|
||||
this._phase = 0;
|
||||
this._logoIndex++;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Scene_Logo.prototype.isBusy = function() {
|
||||
return false;
|
||||
};
|
||||
|
||||
Scene_Logo.prototype.createSprites = function() {
|
||||
var logo1 = new Sprite();
|
||||
var logo2 = new Sprite();
|
||||
var logo3 = new Sprite();
|
||||
logo1.bitmap = ImageManager.loadSystem(LOGO1_IMAGE_NAME);
|
||||
logo2.bitmap = ImageManager.loadSystem(LOGO2_IMAGE_NAME);
|
||||
logo3.bitmap = ImageManager.loadSystem(LOGO3_IMAGE_NAME);
|
||||
logo1.anchor.x = LOGO1_ORIGN;
|
||||
logo1.anchor.y = LOGO1_ORIGN;
|
||||
logo2.anchor.x = LOGO2_ORIGN;
|
||||
logo2.anchor.y = LOGO2_ORIGN;
|
||||
logo3.anchor.x = LOGO3_ORIGN;
|
||||
logo3.anchor.y = LOGO3_ORIGN;
|
||||
logo1.x = LOGO1_X;
|
||||
logo1.y = LOGO1_Y;
|
||||
logo2.x = LOGO2_X;
|
||||
logo2.y = LOGO2_Y;
|
||||
logo3.x = LOGO3_X;
|
||||
logo3.y = LOGO3_Y;
|
||||
this._logo1Sprite = logo1;
|
||||
this._logo2Sprite = logo2;
|
||||
this._logo3Sprite = logo3;
|
||||
logo1.opacity = 0;
|
||||
logo2.opacity = 0;
|
||||
logo3.opacity = 0;
|
||||
this.addChild(logo1);
|
||||
this.addChild(logo2);
|
||||
this.addChild(logo3);
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
347
js/plugins/EnemyBook.js
Normal file
347
js/plugins/EnemyBook.js
Normal file
@@ -0,0 +1,347 @@
|
||||
//=============================================================================
|
||||
// EnemyBook.js
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @plugindesc Displays detailed statuses of enemies.
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @param Unknown Data
|
||||
* @desc The index name for an unknown enemy.
|
||||
* @default ??????
|
||||
*
|
||||
* @help
|
||||
*
|
||||
* Plugin Command:
|
||||
* EnemyBook open # Open the enemy book screen
|
||||
* EnemyBook add 3 # Add enemy #3 to the enemy book
|
||||
* EnemyBook remove 4 # Remove enemy #4 from the enemy book
|
||||
* EnemyBook complete # Complete the enemy book
|
||||
* EnemyBook clear # Clear the enemy book
|
||||
*
|
||||
* Enemy Note:
|
||||
* <desc1:foobar> # Description text in the enemy book, line 1
|
||||
* <desc2:blahblah> # Description text in the enemy book, line 2
|
||||
* <book:no> # This enemy does not appear in the enemy book
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @plugindesc モンスター図鑑です。敵キャラの詳細なステータスを表示します。
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @param Unknown Data
|
||||
* @desc 未確認の敵キャラの索引名です。
|
||||
* @default ??????
|
||||
*
|
||||
* @help
|
||||
*
|
||||
* プラグインコマンド:
|
||||
* EnemyBook open # 図鑑画面を開く
|
||||
* EnemyBook add 3 # 敵キャラ3番を図鑑に追加
|
||||
* EnemyBook remove 4 # 敵キャラ4番を図鑑から削除
|
||||
* EnemyBook complete # 図鑑を完成させる
|
||||
* EnemyBook clear # 図鑑をクリアする
|
||||
*
|
||||
* 敵キャラのメモ:
|
||||
* <desc1:なんとか> # 説明1行目
|
||||
* <desc2:かんとか> # 説明2行目
|
||||
* <book:no> # 図鑑に載せない場合
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
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.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.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_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);
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
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);
|
||||
};
|
||||
|
||||
})();
|
||||
383
js/plugins/ItemBook.js
Normal file
383
js/plugins/ItemBook.js
Normal file
@@ -0,0 +1,383 @@
|
||||
//=============================================================================
|
||||
// ItemBook.js
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @plugindesc Displays detailed statuses of items.
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @param Unknown Data
|
||||
* @desc The index name for an unknown item.
|
||||
* @default ??????
|
||||
*
|
||||
* @param Price Text
|
||||
* @desc The text for "Price".
|
||||
* @default Price
|
||||
*
|
||||
* @param Equip Text
|
||||
* @desc The text for "Equip".
|
||||
* @default Equip
|
||||
*
|
||||
* @param Type Text
|
||||
* @desc The text for "Type".
|
||||
* @default Type
|
||||
*
|
||||
* @help
|
||||
*
|
||||
* Plugin Command:
|
||||
* ItemBook open # Open the item book screen
|
||||
* ItemBook add weapon 3 # Add weapon #3 to the item book
|
||||
* ItemBook add armor 4 # Add armor #4 to the item book
|
||||
* ItemBook remove armor 5 # Remove armor #5 from the item book
|
||||
* ItemBook remove item 6 # Remove item #6 from the item book
|
||||
* ItemBook complete # Complete the item book
|
||||
* ItemBook clear # Clear the item book
|
||||
*
|
||||
* Item (Weapon, Armor) Note:
|
||||
* <book:no> # This item does not appear in the item book
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @plugindesc アイテム図鑑です。アイテムの詳細なステータスを表示します。
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @param Unknown Data
|
||||
* @desc 未確認のアイテムの索引名です。
|
||||
* @default ??????
|
||||
*
|
||||
* @param Price Text
|
||||
* @desc 「価格」の文字列です。
|
||||
* @default 価格
|
||||
*
|
||||
* @param Equip Text
|
||||
* @desc 「装備」の文字列です。
|
||||
* @default 装備
|
||||
*
|
||||
* @param Type Text
|
||||
* @desc 「タイプ」の文字列です。
|
||||
* @default タイプ
|
||||
*
|
||||
* @help
|
||||
*
|
||||
* プラグインコマンド:
|
||||
* ItemBook open # 図鑑画面を開く
|
||||
* ItemBook add weapon 3 # 武器3番を図鑑に追加
|
||||
* ItemBook add armor 4 # 防具4番を図鑑に追加
|
||||
* ItemBook remove armor 5 # 防具5番を図鑑から削除
|
||||
* ItemBook remove item 6 # アイテム6番を図鑑から削除
|
||||
* ItemBook complete # 図鑑を完成させる
|
||||
* ItemBook clear # 図鑑をクリアする
|
||||
*
|
||||
* アイテム(武器、防具)のメモ:
|
||||
* <book:no> # 図鑑に載せない場合
|
||||
*/
|
||||
|
||||
(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 _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.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.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.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);
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
this.drawItemName(item, x, y);
|
||||
|
||||
x = this.textPadding();
|
||||
y = lineHeight + this.textPadding();
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
})();
|
||||
304
js/plugins/MadeWithMv.js
Normal file
304
js/plugins/MadeWithMv.js
Normal file
@@ -0,0 +1,304 @@
|
||||
/*:
|
||||
* NOTE: Images are stored in the img/system folder.
|
||||
*
|
||||
* @plugindesc Show a Splash Screen "Made with MV" and/or a Custom Splash Screen before going to main screen.
|
||||
* @author Dan "Liquidize" Deptula
|
||||
*
|
||||
* @help This plugin does not provide plugin commands.
|
||||
*
|
||||
* @param Show Made With MV
|
||||
* @desc Enabled/Disables showing the "Made with MV" splash screen.
|
||||
* OFF - false ON - true
|
||||
* Default: ON
|
||||
* @default true
|
||||
*
|
||||
* @param Made with MV Image
|
||||
* @desc The image to use when showing "Made with MV"
|
||||
* Default: MadeWithMv
|
||||
* @default MadeWithMv
|
||||
* @require 1
|
||||
* @dir img/system/
|
||||
* @type file
|
||||
*
|
||||
* @param Show Custom Splash
|
||||
* @desc Enabled/Disables showing the "Made with MV" splash screen.
|
||||
* OFF - false ON - true
|
||||
* Default: OFF
|
||||
* @default false
|
||||
*
|
||||
* @param Custom Image
|
||||
* @desc The image to use when showing "Made with MV"
|
||||
* Default:
|
||||
* @default
|
||||
* @require 1
|
||||
* @dir img/system/
|
||||
* @type file
|
||||
*
|
||||
* @param Fade Out Time
|
||||
* @desc The time it takes to fade out, in frames.
|
||||
* Default: 120
|
||||
* @default 120
|
||||
*
|
||||
* @param Fade In Time
|
||||
* @desc The time it takes to fade in, in frames.
|
||||
* Default: 120
|
||||
* @default 120
|
||||
*
|
||||
* @param Wait Time
|
||||
* @desc The time between fading in and out, in frames.
|
||||
* Default: 160
|
||||
* @default 160
|
||||
*
|
||||
*/
|
||||
/*:ja
|
||||
* メモ: イメージはimg/systemフォルダ内に保存されます。
|
||||
*
|
||||
* @plugindesc メイン画面へ進む前に、"Made with MV"のスプラッシュ画面もしくはカスタマイズされたスプラッシュ画面を表示します。
|
||||
* @author Dan "Liquidize" Deptula
|
||||
*
|
||||
* @help このプラグインにはプラグインコマンドはありません。
|
||||
*
|
||||
* @param Show Made With MV
|
||||
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします。
|
||||
* OFF - false ON - true
|
||||
* デフォルト: ON
|
||||
* @default true
|
||||
*
|
||||
* @param Made with MV Image
|
||||
* @desc "Made with MV"を表示する際に使用する画像
|
||||
* デフォルト: MadeWithMv
|
||||
* @default MadeWithMv
|
||||
* @require 1
|
||||
* @dir img/system/
|
||||
* @type file
|
||||
*
|
||||
* @param Show Custom Splash
|
||||
* @desc "Made with MV"のスプラッシュ画面を表示できる/できないようにします。
|
||||
* OFF - false ON - true
|
||||
* デフォルト: OFF
|
||||
* @default false
|
||||
*
|
||||
* @param Custom Image
|
||||
* @desc "Made with MV"を表示する際に使用する画像
|
||||
* デフォルト:
|
||||
* @default
|
||||
* @require 1
|
||||
* @dir img/system/
|
||||
* @type file
|
||||
*
|
||||
* @param Fade Out Time
|
||||
* @desc フェードアウトに要する時間(フレーム数)
|
||||
* デフォルト: 120
|
||||
* @default 120
|
||||
*
|
||||
* @param Fade In Time
|
||||
* @desc フェードインに要する時間(フレーム数)
|
||||
* デフォルト: 120
|
||||
* @default 120
|
||||
*
|
||||
* @param Wait Time
|
||||
* @desc フェードインからフェードアウトまでに要する時間(フレーム数)
|
||||
* デフォルト: 160
|
||||
* @default 160
|
||||
*
|
||||
*/
|
||||
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;
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Scene_Splash
|
||||
//
|
||||
// This is a constructor, implementation is done in the inner scope.
|
||||
|
||||
function Scene_Splash() {
|
||||
this.initialize.apply(this, arguments);
|
||||
}
|
||||
|
||||
(function() {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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_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);
|
||||
}
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// 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();
|
||||
}
|
||||
} else {
|
||||
if (this._mvFadeOut == true) {
|
||||
this.gotoTitleOrTest();
|
||||
}
|
||||
}
|
||||
|
||||
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');
|
||||
}
|
||||
};
|
||||
|
||||
})();
|
||||
91
js/plugins/SimpleMsgSideView.js
Normal file
91
js/plugins/SimpleMsgSideView.js
Normal file
@@ -0,0 +1,91 @@
|
||||
//=============================================================================
|
||||
// SimpleMsgSideView.js
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @plugindesc at sideview battle, only display item/skill names.
|
||||
* @author Sasuke KANNAZUKI
|
||||
*
|
||||
* @param displayAttack
|
||||
* @desc Whether to display normal attack. 1:yes 0:no
|
||||
* @default 0
|
||||
*
|
||||
* @param position
|
||||
* @desc Skill name display position. 0:left, 1:center
|
||||
* @default 1
|
||||
*
|
||||
* @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.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @plugindesc サイドビューバトルで技/アイテムの名前のみ表示します。
|
||||
* @author 神無月サスケ
|
||||
*
|
||||
* @param displayAttack
|
||||
* @desc 通常攻撃も表示するか (1:する 0:しない)
|
||||
* @default 0
|
||||
*
|
||||
* @param position
|
||||
* @desc 技名を表示する位置 (0:左寄せ, 1:中央)
|
||||
* @default 1
|
||||
*
|
||||
* @help このプラグインには、プラグインコマンドはありません。
|
||||
*
|
||||
* ログを表示せず、技名のみを表示することで、戦闘のテンポが若干高速になります。
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
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
|
||||
}
|
||||
_Window_BattleLog_addText.call(this, text);
|
||||
};
|
||||
|
||||
// for sideview battle only
|
||||
Window_BattleLog.prototype.addItemNameText = function(itemName) {
|
||||
this._lines.push(itemName);
|
||||
this.refresh();
|
||||
this.wait();
|
||||
};
|
||||
|
||||
var _Window_BattleLog_displayAction =
|
||||
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
|
||||
} else {
|
||||
this.push('wait');
|
||||
}
|
||||
return;
|
||||
}
|
||||
_Window_BattleLog_displayAction.call(this, subject, item);
|
||||
};
|
||||
|
||||
// to put skill/item name at center
|
||||
var _Window_BattleLog_drawLineText = Window_BattleLog.prototype.drawLineText;
|
||||
Window_BattleLog.prototype.drawLineText = function(index) {
|
||||
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');
|
||||
return;
|
||||
}
|
||||
_Window_BattleLog_drawLineText.call(this, index);
|
||||
};
|
||||
|
||||
})();
|
||||
72
js/plugins/TitleCommandPosition.js
Normal file
72
js/plugins/TitleCommandPosition.js
Normal file
@@ -0,0 +1,72 @@
|
||||
//=============================================================================
|
||||
// TitleCommandPosition.js
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @plugindesc Changes the position of the title command window.
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @param Offset X
|
||||
* @desc The offset value for the x coordinate.
|
||||
* @default 0
|
||||
*
|
||||
* @param Offset Y
|
||||
* @desc The offset value for the y coordinate.
|
||||
* @default 0
|
||||
*
|
||||
* @param Width
|
||||
* @desc The width of the command window.
|
||||
* @default 240
|
||||
*
|
||||
* @param Background
|
||||
* @desc The background type. 0: Normal, 1: Dim, 2: Transparent
|
||||
* @default 0
|
||||
*
|
||||
* @help This plugin does not provide plugin commands.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @plugindesc タイトルコマンドウィンドウの位置を変更します。
|
||||
* @author Yoji Ojima
|
||||
*
|
||||
* @param Offset X
|
||||
* @desc X座標のオフセット値です。
|
||||
* @default 0
|
||||
*
|
||||
* @param Offset Y
|
||||
* @desc Y座標のオフセット値です。
|
||||
* @default 0
|
||||
*
|
||||
* @param Width
|
||||
* @desc コマンドウィンドウの幅です。
|
||||
* @default 240
|
||||
*
|
||||
* @param Background
|
||||
* @desc 背景タイプです。0: 通常、1: 暗くする、2: 透明
|
||||
* @default 0
|
||||
*
|
||||
* @help このプラグインには、プラグインコマンドはありません。
|
||||
*/
|
||||
|
||||
(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 _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;
|
||||
};
|
||||
|
||||
})();
|
||||
83
js/plugins/WeaponSkill.js
Normal file
83
js/plugins/WeaponSkill.js
Normal file
@@ -0,0 +1,83 @@
|
||||
//=============================================================================
|
||||
// WeaponSkill.js
|
||||
//=============================================================================
|
||||
|
||||
/*:
|
||||
* @plugindesc Change skill id of attack for each weapon.
|
||||
* @author Sasuke KANNAZUKI
|
||||
*
|
||||
* @help This plugin does not provide plugin commands.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* Check Points:
|
||||
* - When multiple weapons are equipped, the skill id of the weapon
|
||||
* held in the dominant hand (previously defined) is used.
|
||||
* - It is most favorable for "skill type" to be "none"(=0),
|
||||
* otherwise you cannot attack when your skill is blocked.
|
||||
*
|
||||
* Usage examples of this plugin:
|
||||
* - 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.
|
||||
*/
|
||||
|
||||
/*:ja
|
||||
* @plugindesc 武器ごとに通常攻撃のスキルIDを変更します。
|
||||
* @author 神無月サスケ
|
||||
*
|
||||
* @help このプラグインにはプラグインコマンドはありません。
|
||||
*
|
||||
* 武器の「メモ」欄に、<skill_id:3> と書いた場合、
|
||||
* 通常攻撃の際、3番のスキルが発動します。
|
||||
* ※特に記述がなければ、通常通り1番のスキルが採用されます。
|
||||
*
|
||||
* チェックポイント:
|
||||
* - 二刀流の場合、利き腕(先に定義された方)に持っているスキルIDが採用されます。
|
||||
* - スキルタイプは「なし」にするのが望ましいです。
|
||||
* さもなくば、技などを封じられたとき、攻撃が出来なくなります。
|
||||
*
|
||||
* 想定される用途:
|
||||
* - 全体攻撃可能な武器
|
||||
* - 2回攻撃、3回攻撃する武器
|
||||
* - 回復魔法をスキルに指定した場合、
|
||||
* 「攻撃」を選んだ際、味方の選択が出来、その仲間を回復します
|
||||
* - 防御コマンドなどと同等になる武器も実現可能です。
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
//
|
||||
// set skill id for attack.
|
||||
//
|
||||
Game_Actor.prototype.attackSkillId = function() {
|
||||
var normalId = Game_BattlerBase.prototype.attackSkillId.call(this);
|
||||
if(this.hasNoWeapons()){
|
||||
return normalId;
|
||||
}
|
||||
var weapon = this.weapons()[0]; // at plural weapon, one's first skill.
|
||||
var id = weapon.meta.skill_id;
|
||||
return id ? Number(id) : normalId;
|
||||
};
|
||||
|
||||
//
|
||||
// for command at battle
|
||||
//
|
||||
var _Scene_Battle_commandAttack = Scene_Battle.prototype.commandAttack;
|
||||
Scene_Battle.prototype.commandAttack = function() {
|
||||
BattleManager.inputtingAction().setAttack();
|
||||
// normal attack weapon (or other single attack weapon)
|
||||
var action = BattleManager.inputtingAction();
|
||||
if(action.needsSelection() && action.isForOpponent()){
|
||||
_Scene_Battle_commandAttack.call(this);
|
||||
return;
|
||||
}
|
||||
// special skill weapon
|
||||
this.onSelectAction();
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
9321
js/rpg_core.js
Normal file
9321
js/rpg_core.js
Normal file
File diff suppressed because it is too large
Load Diff
2839
js/rpg_managers.js
Normal file
2839
js/rpg_managers.js
Normal file
File diff suppressed because it is too large
Load Diff
10641
js/rpg_objects.js
Normal file
10641
js/rpg_objects.js
Normal file
File diff suppressed because it is too large
Load Diff
2689
js/rpg_scenes.js
Normal file
2689
js/rpg_scenes.js
Normal file
File diff suppressed because it is too large
Load Diff
2691
js/rpg_sprites.js
Normal file
2691
js/rpg_sprites.js
Normal file
File diff suppressed because it is too large
Load Diff
6024
js/rpg_windows.js
Normal file
6024
js/rpg_windows.js
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user