设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2855|回复: 3
打印 上一主题 下一主题

[已经过期] 能否让这个虚拟按键插件在游戏中途才开启?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
18 小时
注册时间
2015-8-3
帖子
12
跳转到指定楼层
1
发表于 2016-2-28 11:02:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 余烬之中 于 2016-8-4 12:02 编辑

就是在刚进游戏时先不显示
JAVASCRIPT 代码复制
  1. //=============================================================================
  2. // UCHU_MobileOperation.js
  3. // Version: 1.0.0
  4. //=============================================================================
  5.  
  6. /*:
  7. @plugindesc
  8. スマホ操作用プラグイン。横持ち/縦持ちに対応した仮想ボタン、
  9. タッチ操作の方法を追加拡張し、スマホプレイを快適にします。
  10. @author
  11. uchuzine
  12. @help
  13. UCHU_MobileOperation (Version: 1.0.0)
  14. ------------------------------------------------------------------------------
  15. ■特徴
  16. ------------------------------------------------------------------------------
  17. プラグイン作成にあたり、por Masked氏のMBS_MobileDirPad.jsを参考にしています。
  18.  
  19. ○本プラグインの特徴
  20. ・ゲーム画面外(黒帯部分)にボタンを設置するため、プレイ画面に干渉しにくい
  21. ・パッドやボタンは個別に表示/非表示の切り替えが可能
  22. ・ボタンの基準点を画面四隅のいずれかに指定でき、縦持ち操作に対応可能
  23. ・方向パッドの操作性を重視し、タッチ判定領域、斜め方向の感度など調整可能
  24.  (詳細は下記の説明を参照)
  25. ・方向パッドによる移動と、デフォルトの目的地タッチによる移動を併用可能
  26. ・特定のタッチ操作、ジェスチャーによるボタン操作の拡張
  27.  
  28. これらを利用し、
  29.  
  30. ・仮想十字キーは使わずに、MENUボタンと決定ボタンのみ使用
  31. ・ボタンは全て使用せず、画面長押しでオート連打、画面外タッチでメニュー呼出
  32.  
  33. といった使い方もできます。
  34.  
  35. ------------------------------------------------------------------------------
  36. ■一部のパラメータの説明
  37. ------------------------------------------------------------------------------
  38. ▼ DPad OpelationRange(方向パッド作動領域)‥‥
  39. 方向パッド画像の表示サイズに対する、タッチ判定領域の大きさを倍率で指定します。
  40. 数値を上げても見た目は変わりませんが、画像の中心から外側に判定が広がります。
  41. 例)
  42. 「1」のとき‥‥画像のサイズがタッチ判定の大きさになる(画像の内接円の中のみ)
  43. 「2」のとき‥‥タッチ判定の大きさが縦横2倍になる(画像の外側に50%ずつ広がる)
  44.  
  45. 数値を上げることで操作ミスを防ぎ、操作性を上げることができますが
  46. 上げ過ぎて他のボタン等に重なってしまわないように注意してください。
  47.  
  48. ▼ DPad DiagonalRange(方向パッドの斜め方向範囲)‥‥
  49. 方向の判定は、パッド画像の対角線を境界線にして上下左右に分けていますが、
  50. この数値を上げると、対角線上をタッチしたときにその両側の方向がオンになり
  51. (「右」+「上」など)、8方向判定ができるようになります。
  52. 8方向移動のプラグインを使用している時などは、この数値を設定してください。
  53.  
  54. 数値の大きさが斜め判定角度の広さとなり、「0~1」の範囲で指定します
  55. 例)
  56. 「0」のとき‥‥上下左右の4方向のみ入力可能。
  57. 「0.5」のとき‥均等8分割の8方向入力が可能。
  58. 「1」のとき‥‥「右上」「右下」「左上」「左下」の4方向入力。
  59.  
  60. 数値を上げるほど、「上を押すつもりが右上になっていた」等のミスが起こるため
  61. 4方向で問題ない場合は、「0」を指定すると操作ミスが最小限になります。
  62.  
  63. ------------------------------------------------------------------------------
  64. ■パッド、ボタン画像について
  65. ------------------------------------------------------------------------------
  66. ・画像ファイルは任意のサイズで作成可能ですが、縦横比1:1で作成してください。
  67.  表示の際は、「DPad Size」で指定したpixel数にリサイズされます。
  68.  ボタン画像も同様です。
  69. ・方向パッドのグラフィックの中心が画像の中心になるようにしてください。
  70.  
  71.  
  72.  
  73. @param ---PC Option---
  74. @default
  75.  
  76. @param PC BtnDisplay
  77. @desc PCで実行時も、仮想ボタンを表示する:true しない:false
  78. 初期値:false
  79. @default false
  80.  
  81. @param PC TouchExtend
  82. @desc PCで実行時も、タッチの操作拡張を有効にする:true しない:false
  83. 初期値:true;
  84. @default true
  85.  
  86. @param ---File Path---
  87. @default
  88.  
  89. @param DPad Image
  90. @desc 方向パッド画像のファイルパス
  91. @default ./img/system/DirPad.png
  92.  
  93. @param ActionBtn Image
  94. @desc 決定ボタン画像のファイルパス
  95. @default ./img/system/ActionButton.png
  96.  
  97. @param CancelBtn Image
  98. @desc キャンセル(メニュー)ボタン画像のファイルパス
  99. @default ./img/system/CancelButton.png
  100.  
  101. @param ---Button Customize---
  102. @default
  103.  
  104. @param Button Opacity
  105. @desc ボタンの不透明度(0~1) 初期値:0.7
  106. @default 0.7
  107.  
  108. @param Vertical BtnZoom
  109. @desc スマホ縦持ちで表示したときの全ボタンの拡大率
  110. 初期値:1.7
  111. @default 1.7
  112.  
  113. @param Tablet BtnZoom
  114. @desc タブレット横持ちで表示したときの全ボタンの拡大率
  115. 初期値:0.8
  116. @default 0.8
  117.  
  118. @param TabVertical BtnZoom
  119. @desc タブレット縦持ちで表示したときの全ボタンの拡大率
  120. 初期値:1.1
  121. @default 1.1
  122.  
  123. @param HideButton OnMessage
  124. @desc 画面下部にメッセージ表示時、仮想ボタンの表示順位をゲーム画面の下に下げる:true そのまま:false
  125. 初期値:true
  126. @default true
  127.  
  128. @param DPad Visible
  129. @desc 方向パッドを表示する:true しない:false  初期値:true
  130. @default true
  131.  
  132. @param DPad Size
  133. @desc 方向パッドの大きさ(px)。 初期値:200
  134. @default 200
  135.  
  136. @param DPad Margin
  137. @desc 方向パッド画像の位置。画面端からの隙間の大きさで指定。
  138.  (左からの幅; 下からの幅) 初期値:10; 10
  139. @default 10; 10
  140.  
  141. @param DPad Orientation
  142. @desc 方向パッドの基準位置を、左下以外に変えたい場合。
  143. left か right; top か bottom で指定。 初期値:left; bottom
  144. @default left; bottom
  145.  
  146. @param DPad OpelationRange
  147. @desc 方向パッド画像に対する、タッチの作動範囲(倍率、1~)
  148. 画像の外側にタッチ判定を広げ、操作ミスを防ぐ。初期値:1.3
  149. @default 1.3
  150.  
  151. @param DPad DiagonalRange
  152. @desc 方向パッド斜め方向の判定の広さ(0~1)。斜めに入りやすくする程、操作がブレやすくなる。4方向でよい場合は0に。初期値:0.3;
  153. @default 0.3
  154.  
  155. @param ActionBtn Visible
  156. @desc 決定ボタンを表示する:true しない:false  初期値:true
  157. @default true
  158.  
  159. @param ActionBtn Size
  160. @desc 決定ボタンの大きさ(px)。 初期値:100
  161. @default 100
  162.  
  163. @param ActionBtn Margin
  164. @desc 決定ボタンの位置。画面端からの隙間の大きさで指定。
  165.  (右からの幅; 下からの幅) 初期値:10; 90
  166. @default 10; 90
  167.  
  168. @param ActionBtn Orientation
  169. @desc 決定ボタンの基準位置を、右下以外に変えたい場合。
  170. left か right; top か bottom で指定。 初期値:right; bottom
  171. @default right; bottom
  172.  
  173. @param CancelBtn Visible
  174. @desc キャンセル(メニュー)ボタンを表示する:true しない:false
  175. 初期値:true
  176. @default true
  177.  
  178. @param CancelBtn Size
  179. @desc キャンセルボタンの大きさ(px)。 初期値:100
  180. @default 100
  181.  
  182. @param CancelBtn Margin
  183. @desc キャンセルボタンの位置。画面端からの隙間の大きさで指定。
  184.  (右からの幅; 下からの幅) 初期値:110; 10
  185. @default 110; 10
  186.  
  187. @param CancelBtn Orientation
  188. @desc キャンセルボタンの基準位置を、右下以外に変えたい場合。
  189. left か right; top か bottomで指定。 初期値:right; bottom
  190. @default right; bottom
  191.  
  192.  
  193. @param ---TouchInput Extend---
  194. @default
  195.  
  196. @param Flick PageUp-PageDown
  197. @desc 画面上を左右にフリックすると、PageUp/PageDown操作になる。
  198. ステータス画面でキャラを切り替えたい時などに。初期値:true
  199. @default true
  200.  
  201. @param HoldCanvas ActionBtn
  202. @desc 画面を長押しすると、決定ボタンを押した状態になる。
  203. 初期値:true
  204. @default true
  205.  
  206. @param OutCanvas CancelBtn
  207. @desc ゲーム画面外の黒帯部分全体が、キャンセルボタン扱いになる。
  208. 初期値:false
  209. @default false
  210.  
  211. @param OutCanvas ActionBtn
  212. @desc ゲーム画面外の黒帯部分全体が、決定ボタン扱いになる。
  213. 初期値:false
  214. @default false
  215. */
  216.  
  217. var Imported = Imported || {};
  218. Imported.UCHU_MobileOperation = "1.0.0";
  219.  
  220. var UCHU_MobileOperation = {};
  221.  
  222. (function() {
  223.     "use strict";
  224.  
  225.         //-----------------------------------------------------------------------------
  226.         // Setup
  227.  
  228.         var Parameters = PluginManager.parameters('UCHU_MobileOperation');
  229.         var PRM = PRM || {};
  230.  
  231.         PRM.url=[];
  232.         PRM.visible=[];
  233.         PRM.size=[];
  234.         PRM.pos=[];
  235.         PRM.spot=[];
  236.  
  237.         PRM.pcBtn = Boolean(Parameters["PC BtnDisplay"] === 'true' || false);
  238.         PRM.pcExt = Boolean(Parameters["PC TouchExtend"] === 'true' || false);
  239.         PRM.url[0] = String(Parameters["DPad Image"]);
  240.         PRM.url[1] = String(Parameters["ActionBtn Image"]);
  241.         PRM.url[2] = String(Parameters["CancelBtn Image"]);
  242.         PRM.opacity = Number(Parameters["Button Opacity"]);
  243.         PRM.vZoom = Number(Parameters["Vertical BtnZoom"]);
  244.         PRM.tabZoom = Number(Parameters["Tablet BtnZoom"]);
  245.         PRM.tabvZoom = Number(Parameters["TabVertical BtnZoom"]);
  246.         PRM.hideBtn = Boolean(Parameters["HideButton OnMessage"] === 'true' || false);
  247.         PRM.visible[0] = Boolean(Parameters["DPad Visible"] === 'true' || false);
  248.         PRM.size[0] = Number(Parameters["DPad Size"]);
  249.         PRM.pos[0] =Parameters["DPad Margin"].split(";");
  250.         PRM.spot[0] = Parameters["DPad Orientation"].split(";");
  251.         PRM.pad_scale = Number(Parameters["DPad OpelationRange"]);
  252.         PRM.pad_dia = Math.max(0,Math.min(1,(1-Number(Parameters["DPad DiagonalRange"]))));
  253.         PRM.visible[1] = Boolean(Parameters["ActionBtn Visible"] === 'true' || false);
  254.         PRM.size[1] = Number(Parameters["ActionBtn Size"]);
  255.         PRM.pos[1] = Parameters["ActionBtn Margin"].split(";");
  256.         PRM.spot[1] = Parameters["ActionBtn Orientation"].split(";");
  257.         PRM.visible[2] = Boolean(Parameters["CancelBtn Visible"] === 'true' || false);
  258.         PRM.size[2] = Number(Parameters["CancelBtn Size"]);
  259.         PRM.pos[2] = Parameters["CancelBtn Margin"].split(";");
  260.         PRM.spot[2] = Parameters["CancelBtn Orientation"].split(";");
  261.         PRM.flickpage = Boolean(Parameters["Flick PageUp-PageDown"] === 'true' || false);
  262.         PRM.holdaction = Boolean(Parameters["HoldCanvas ActionBtn"] === 'true' || false);
  263.         PRM.outcansel = Boolean(Parameters["OutCanvas CancelBtn"] === 'true' || false);
  264.         PRM.outaction = Boolean(Parameters["OutCanvas ActionBtn"] === 'true' || false);
  265.  
  266.         var btn_id=["DirPad","ok","escape"];
  267.         var current_zoom=1;       
  268.         var st_x = 0;
  269.         var st_y = 0;
  270.         var pad_range=PRM.size[0]*PRM.pad_scale;
  271.         var pad_size=pad_range*current_zoom/2;
  272.         var Btn_ready=false;
  273.         var Btn_hide=false;
  274.         var PressBtn=false;
  275.         var dirx=0;
  276.         var diry=0;
  277.         var autofire=false;
  278.         var hvzoom=[1, PRM.vZoom];
  279.         var ua = (function(u){
  280.           return {
  281.             Tablet:(u.indexOf("windows") != -1 && u.indexOf("touch") != -1) || u.indexOf("ipad") != -1 || (u.indexOf("android") != -1 && u.indexOf("mobile") == -1) || (u.indexOf("firefox") != -1 && u.indexOf("tablet") != -1) || u.indexOf("kindle") != -1 || u.indexOf("silk") != -1 || u.indexOf("playbook") != -1
  282.           };
  283.         })(window.navigator.userAgent.toLowerCase());
  284.  
  285.         if(ua.Tablet){
  286.                 hvzoom=[PRM.tabZoom, PRM.tabvZoom];
  287.         }
  288.         if (!Utils.isMobileDevice() && !PRM.pcBtn) {PRM.visible[0]=PRM.visible[1]=PRM.visible[2]=false;}
  289.  
  290.         //-----------------------------------------------------------------------------
  291.         // Locate_DirPad
  292.  
  293.         function Locate_DirPad() {
  294.                 this.initialize.apply(this, arguments);
  295.         }
  296.  
  297.  
  298.         Locate_DirPad.prototype.initialize = function() {
  299.                 var img = new Image();
  300.                 var url = PRM.url[0];
  301.                 img.onerror = function() {Graphics.printError('DirPad Image was Not Found:',url);};
  302.                 img.src = url;
  303.                 img = null;
  304.                 this.Div = document.createElement("div");
  305.                 this.Div.id = 'Dirpad';
  306.                 this.Div.style.position = 'fixed';
  307.                 this.Div.style[PRM.spot[0][0].replace(/\s+/g, "")] = String(PRM.pos[0][0]-(pad_range-PRM.size[0])/2)+'px';
  308.                 this.Div.style[PRM.spot[0][1].replace(/\s+/g, "")] = String(PRM.pos[0][1]-(pad_range-PRM.size[0])/2)+'px';
  309.                 this.Div.style.width = pad_range+'px';
  310.                 this.Div.style.height = pad_range+'px';
  311.                 this.Div.style.opacity = PRM.opacity;
  312.                 this.Div.style.zIndex = '4';
  313.                 this.Div.style.userSelect="none";
  314.                 this.Div.style["-webkit-tap-highlight-color"]="rgba(0,0,0,0)";
  315.                 this.Div.style.background = 'url('+PRM.url[0]+') 50% 50% / '+String(Math.round(PRM.size[0]/pad_range*100))+'% no-repeat';
  316.  
  317.                 if(!Utils.isMobileDevice() && PRM.pcBtn){
  318.                         this.Div.addEventListener('mousedown', function(e) {
  319.                           dirope(e.layerX,e.layerY);PressBtn=true;
  320.                         }, false);
  321.                         this.Div.addEventListener('mouseover', function(e) {
  322.                           if(TouchInput.isPressed()){dirope(e.layerX,e.layerY);PressBtn=true;}
  323.                         }, false);
  324.                         this.Div.addEventListener('mousemove', function(e) {
  325.                           if(TouchInput.isPressed()){dirope(e.layerX,e.layerY);PressBtn=true;}
  326.                         }, false);
  327.                         this.Div.addEventListener('mouseup', function(e) {
  328.                                 disope();PressBtn=false;
  329.                         }, false);
  330.                         this.Div.addEventListener('mouseout', function(e) {
  331.                                 disope();PressBtn=false;
  332.                         }, false);       
  333.                 }
  334.                 this.Div.addEventListener('touchstart', function(e) {
  335.                         PressBtn=true;
  336.                         dirope(e.touches[0].clientX-dirx, e.touches[0].clientY-diry);
  337.                 }, false);
  338.                 this.Div.addEventListener('touchmove', function(e) {
  339.                         dirope(e.touches[0].clientX-dirx, e.touches[0].clientY-diry);
  340.                         PressBtn=true;
  341.                 }, false);
  342.                 this.Div.addEventListener('touchend', function(event) {
  343.                         disope();PressBtn=false;
  344.                 }, false);
  345.                         document.body.appendChild(this.Div);
  346.         };
  347.  
  348.         function dirope(xx,yy) {
  349.                 var touchx=(xx-pad_size)/pad_size;
  350.                 var touchy=(yy-pad_size)/pad_size;
  351.                 if(Math.sqrt(touchx*touchx+touchy*touchy)>1){disope();
  352.                 }else{
  353.                         if(touchx>Math.abs(touchy)*PRM.pad_dia){Input._currentState['right']=true;Input._currentState['left']=false;}
  354.                         else if(touchx<-Math.abs(touchy)*PRM.pad_dia){Input._currentState['left']=true;Input._currentState['right']=false;}
  355.                         else{Input._currentState['left']=false;Input._currentState['right']=false;}
  356.                         if(touchy>Math.abs(touchx)*PRM.pad_dia){Input._currentState['down']=true;Input._currentState['up']=false;}
  357.                         else if(touchy<-Math.abs(touchx)*PRM.pad_dia){Input._currentState['up']=true;Input._currentState['down']=false;}
  358.                         else{Input._currentState['up']=false;Input._currentState['down']=false;}
  359.                 }
  360.         }
  361.         function disope() {
  362.                 Input._currentState['up']=false;
  363.                 Input._currentState['down']=false;
  364.                 Input._currentState['left']=false;
  365.                 Input._currentState['right']=false;
  366.         }
  367.  
  368.         //-----------------------------------------------------------------------------
  369.         // Locate_Button
  370.  
  371.         function Locate_Button() {
  372.                 this.initialize.apply(this, arguments);
  373.         }
  374.         Locate_Button.prototype.initialize = function(type) {
  375.                 var img = new Image();
  376.                 var url = PRM.url[type];
  377.                 img.onerror = function() {Graphics.printError('Button Image was Not Found:',url);};
  378.                 img.src = url;
  379.                 img = null;
  380.                 this.Div = document.createElement("div");
  381.                 this.Div.id = btn_id[type]+'Btn';
  382.                 this.Div.style.position = 'fixed';
  383.                 this.Div.style[PRM.spot[type][0].replace(/\s+/g, "")] = PRM.pos[type][0]+'px';
  384.                 this.Div.style[PRM.spot[type][1].replace(/\s+/g, "")] = PRM.pos[type][1]+'px';
  385.                 this.Div.style.width = PRM.size[type]+'px';
  386.                 this.Div.style.height = PRM.size[type]+'px';
  387.                 this.Div.style.opacity = PRM.opacity;
  388.                 this.Div.style.zIndex = '4';
  389.                 this.Div.style.userSelect="none";
  390.                 this.Div.style.background = 'url('+PRM.url[type]+') 0 0 / cover no-repeat';
  391.  
  392.                 if(!Utils.isMobileDevice() && PRM.pcBtn){
  393.                         this.Div.addEventListener('mousedown', function(e) {
  394.                                 Input._currentState[btn_id[type]] = true;PressBtn=true;
  395.                         }, false);
  396.                         this.Div.addEventListener('mouseover', function(e) {
  397.                           if(TouchInput.isPressed()){Input._currentState[btn_id[type]] = true;PressBtn=true;return false;}
  398.                         }, false);
  399.                         this.Div.addEventListener('mouseup', function(e) {
  400.                           Input._currentState[btn_id[type]] = false;PressBtn=false;
  401.                         }, false);
  402.                         this.Div.addEventListener('mouseout', function(e) {
  403.                           Input._currentState[btn_id[type]] = false;PressBtn=false;
  404.                         }, false);
  405.                 }
  406.  
  407.                 this.Div.addEventListener('touchstart', function(e) {
  408.                         Input._currentState[btn_id[type]] = true;PressBtn=true;
  409.                 }, false);
  410.                 this.Div.addEventListener('touchend', function(e) {
  411.                         Input._currentState[btn_id[type]] = false;PressBtn=false;
  412.                 }, false);
  413.  
  414.                 document.body.appendChild(this.Div);
  415.         };       
  416.  
  417.         //-----------------------------------------------------------------------------
  418.         // Replace function
  419.  
  420.         var Scene_Base_start = Scene_Base.prototype.start;
  421.         Scene_Base.prototype.start = function() {
  422.                 Scene_Base_start.apply(this, arguments);
  423.             if (Utils.isMobileDevice() || PRM.pcBtn) {
  424.                         if(!Btn_ready){
  425.                                 Btn_ready=true;
  426.                                 if(PRM.visible[0]){this.DirPad = new Locate_DirPad();}
  427.                                 if(PRM.visible[1]){this.okButton = new Locate_Button(1);}
  428.                                 if(PRM.visible[2]){this.canselButton = new Locate_Button(2);}
  429.                                 Graphics._updateRealScale();
  430.                                 document.documentElement.style["-webkit-user-select"]="none";
  431.                                 document.addEventListener("touchmove", function(evt) {evt.preventDefault();}, false);
  432.                         }
  433.                 }
  434.         };
  435.  
  436.         if(PRM.visible[0] || PRM.visible[1] || PRM.visible[2]){
  437.  
  438.                 var Game_Temp_setDestination = Game_Temp.prototype.setDestination;
  439.                 Game_Temp.prototype.setDestination = function(x, y) {
  440.                         Game_Temp_setDestination.apply(this, arguments);
  441.                         if(PressBtn){
  442.                                 this._destinationX = null;
  443.                                 this._destinationY = null;
  444.                         }
  445.                 };
  446.  
  447.                 var Graphics_updateRealScale = Graphics._updateRealScale;
  448.                 Graphics._updateRealScale = function() {
  449.                         Graphics_updateRealScale.apply(this, arguments);
  450.                         if (this._stretchEnabled) {
  451.                                 if(document.getElementById("Dirpad")){
  452.                                 if(window.innerWidth<window.innerHeight){current_zoom=hvzoom[1];}else{current_zoom=hvzoom[0];}
  453.                                         pad_size=pad_range*current_zoom/2;
  454.                                         if(PRM.visible[0]){
  455.                                                 document.getElementById("Dirpad").style.zoom=current_zoom;
  456.                                                 dirx=document.getElementById("Dirpad").offsetLeft*current_zoom;
  457.                                                 diry=document.getElementById("Dirpad").offsetTop*current_zoom;
  458.                                         }
  459.                                         if(PRM.visible[1]){document.getElementById("okBtn").style.zoom=current_zoom;}
  460.                                         if(PRM.visible[2]){document.getElementById("escapeBtn").style.zoom=current_zoom;}
  461.                                 }
  462.                         }
  463.                 };
  464.         }
  465.  
  466.         //-----------------------------------------------------------------------------
  467.         // Option
  468.  
  469.         if(PRM.hideBtn){
  470.                 Scene_Base.prototype.hideUserInterface = function() {
  471.                         if (Utils.isMobileDevice() || PRM.pcBtn) {Btn_hide=true;
  472.                                 if(PRM.visible[0]){document.getElementById("Dirpad").style.zIndex = '0';}
  473.                                 if(PRM.visible[1]){document.getElementById("okBtn").style.zIndex = '0';}
  474.                                 if(PRM.visible[2]){document.getElementById("escapeBtn").style.zIndex = '0';}
  475.                         }
  476.                 };
  477.                 Scene_Base.prototype.showUserInterface = function() {
  478.                         if (Utils.isMobileDevice() && !Btn_hide || PRM.pcBtn && !Btn_hide) {
  479.                                 if(PRM.visible[0]){document.getElementById("Dirpad").style.zIndex = '4';}
  480.                                 if(PRM.visible[1]){document.getElementById("okBtn").style.zIndex = '4';}
  481.                                 if(PRM.visible[2]){document.getElementById("escapeBtn").style.zIndex = '4';}
  482.                         }
  483.                 };
  484.  
  485.                 var Scene_Map_createMessageWindows = Scene_Map.prototype.createMessageWindow;
  486.                 var Scene_Map_processMapTouch = Scene_Map.prototype.processMapTouch;
  487.                 var Scene_Map_terminate = Scene_Map.prototype.terminate;
  488.  
  489.                 Scene_Map.prototype.createMessageWindow = function() {
  490.                         Scene_Map_createMessageWindows.call(this);
  491.                         var oldStartMessage = this._messageWindow.startMessage;
  492.                         var oldTerminateMessage = this._messageWindow.terminateMessage;
  493.                         var scene = this;
  494.  
  495.                         this._messageWindow.startMessage = function() {       
  496.                                 oldStartMessage.apply(this, arguments);
  497.                                 if($gameMessage.positionType()==2){
  498.                                         scene.hideUserInterface();
  499.                                 }
  500.                         };
  501.                         Window_Message.prototype.terminateMessage = function() {
  502.                                 oldTerminateMessage.apply(this, arguments);
  503.                                 Btn_hide=false;
  504.                                 setTimeout("Scene_Base.prototype.showUserInterface();", 200);
  505.                         };
  506.                 };
  507.  
  508.                 var Scene_Battle_createMessageWindow = Scene_Battle.prototype.createMessageWindow;
  509.                 Scene_Battle.prototype.createMessageWindow = function() {
  510.                         Scene_Battle_createMessageWindow.call(this);
  511.                         var oldStartMessage = this._messageWindow.startMessage;
  512.                         var oldTerminateMessage = this._messageWindow.terminateMessage;
  513.                         var scene = this;
  514.                         this._messageWindow.startMessage = function() {
  515.                                 oldStartMessage.apply(this, arguments);
  516.                                 if($gameMessage.positionType()==2){
  517.                                         scene.hideUserInterface();
  518.                                 }
  519.                         };
  520.                         Window_Message.prototype.terminateMessage = function() {
  521.                                 oldTerminateMessage.apply(this, arguments);
  522.                                 Btn_hide=false;
  523.                                 setTimeout("Scene_Base.prototype.showUserInterface();", 200);
  524.                         };
  525.                 };
  526.         }
  527.  
  528.         if(Utils.isMobileDevice() || PRM.pcExt){
  529.  
  530.                 if(PRM.holdaction){
  531.                         var TouchInput_update = TouchInput.update;
  532.                         TouchInput.update = function() {
  533.                                 TouchInput_update.apply(this, arguments);
  534.                                 if (this.isPressed()) {
  535.                                         if(PRM.holdaction && this._pressedTime==24 && !PressBtn){Input._currentState['ok']=true;autofire=true;}
  536.                                 }else if(autofire){
  537.                                         autofire=false;
  538.                                         Input._currentState['ok']=false;
  539.                                 }
  540.                         };
  541.                 }
  542.  
  543.                 if(PRM.flickpage || PRM.outcansel || PRM.outaction){
  544.                         TouchInput._endRequest= function(type) {
  545.                                 Input._currentState[type]=false;
  546.                         }
  547.                         if(Utils.isMobileDevice()){
  548.                                 var TouchInput_onTouchStart = TouchInput._onTouchStart;
  549.                                 TouchInput._onTouchStart = function(event) {
  550.                                     TouchInput_onTouchStart.apply(this, arguments);
  551.                                         var touch = event.changedTouches[0];
  552.                                         st_x = Graphics.pageToCanvasX(touch.pageX);
  553.                                         st_y = Graphics.pageToCanvasY(touch.pageY);
  554.                                     if(!PressBtn){
  555.                                                 if(st_x<0 || st_y<0 || st_x>Graphics.boxWidth || st_y>Graphics.boxHeight){
  556.                                                         if(PRM.outcansel){Input._currentState['escape']=true;setTimeout("TouchInput._endRequest('escape');", 100);}
  557.                                                         if(PRM.outaction){Input._currentState['ok']=true;setTimeout("TouchInput._endRequest('ok');", 100);}
  558.                                                 }
  559.                                         }
  560.                                 };
  561.                         }else{
  562.                                 var TouchInput_onLeftButtonDown = TouchInput._onLeftButtonDown;
  563.                                 TouchInput._onLeftButtonDown = function(event) {
  564.                                         TouchInput_onLeftButtonDown.apply(this, arguments);
  565.                                         st_x = Graphics.pageToCanvasX(event.pageX);
  566.                                         st_y = Graphics.pageToCanvasY(event.pageY);
  567.                                         if(!PressBtn){
  568.                                                 if(st_x<0 || st_y<0 || st_x>Graphics.boxWidth || st_y>Graphics.boxHeight){
  569.                                                         if(PRM.outcansel){Input._currentState['escape']=true;setTimeout("TouchInput._endRequest('escape');", 100);}
  570.                                                         if(PRM.outaction){Input._currentState['ok']=true;setTimeout("TouchInput._endRequest('ok');", 100);}
  571.                                                 }
  572.                                         }
  573.                                 };
  574.                         }
  575.                 }
  576.  
  577.                 if(PRM.flickpage){
  578.  
  579.                         var TouchInput_onMove = TouchInput._onMove;
  580.                         TouchInput._onMove = function(x, y) {
  581.                                 TouchInput_onMove.apply(this, arguments);
  582.                                 if((st_x-x)<-50 && Math.abs(st_y-y)<100 ){st_y=9999;Input._currentState['pageup']=true;setTimeout("TouchInput._endRequest('pageup');", 100);}
  583.                                 if((st_x-x)>50 && Math.abs(st_y-y)<100 ){st_y=9999;Input._currentState['pagedown']=true;setTimeout("TouchInput._endRequest('pagedown');", 100);}
  584.                         }
  585.                 }
  586.         }       
  587. })();

Lv4.逐梦者

梦石
0
星屑
5692
在线时间
1556 小时
注册时间
2011-6-14
帖子
520
2
发表于 2016-2-28 11:48:04 | 只看该作者
楼主求分享按键素材
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
2454
在线时间
409 小时
注册时间
2016-2-3
帖子
755
3
发表于 2016-5-15 15:42:12 | 只看该作者
同求              
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
14219
在线时间
718 小时
注册时间
2011-7-16
帖子
1428

开拓者

4
发表于 2018-8-27 12:10:48 | 只看该作者
这个插件看起来不错啊,加游戏里试试看
RMMV网络插件,开源免费,内含服务器端,无需强制登录,云数据,弹幕,云存档,排名,兑换码,版本检测,可自由上架下架删除。q群399090587
免打包运行MV游戏,云游戏,安卓App雷神游戏厅,在线玩游戏,上传下载游戏
开源游戏:重装机兵之重装归来【RMMV制作】全球首款按照美剧分季分集的方式发布的游戏
体素画 -- MV画3D像素图的画板
RMMV显示3D模型和场景的插件
RMMV显示spine骨骼动画的插件
RMMV秘密通道插件
突破敌群数量上限8个的插件
在rmmv中显示gif动态图片的插件
一款可以在mv游戏界面的任意位置显示任意文字的插件
RMMV Toast 插件 带物品得失提示,可以设置开启关闭 兼容yep itemcore
制作一个改名卡道具插件、调整标题页面菜单的插件、在标题页面之前显示大段文字的插件、标题页面显示版本号的插件
物品得失自动提示自动上色自动换行插件
我的Q群 663889472
另外,我的插件、范例、游戏都在这里
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-26 06:11

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表