查看: 9596|回复: 6

[已经过期] 求脚本DMV_MapMenuButtons.js的范例啊

[复制链接]

世界坑化协会

梦石
0
星屑
9565
在线时间
1592 小时
注册时间
2007-3-13
回帖
5263

极短26参与极短25参与极短23参与极短21参与开拓者贵宾第一届化妆舞会最佳服饰奖

发表于 2015-11-18 23:30:59 | 显示全部楼层 |阅读模式

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

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

×

http://www.dekyde.com/dmv-mapbuttons

我照着上面弄了事件循环,结果是undefined is not function,搞不懂啊,苦手了,求范例

15-11-03-04-38-19-83078.zip

2.94 KB, 下载次数: 189

忍卷NINMAKI游戏DEMO上线了~♪  点我下载  ☚
梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-11-18 23:45:48 | 显示全部楼层
本帖最后由 tseyik 于 2015-11-19 00:01 编辑

有没有安DMV_Core
所有DMV_xxx都要先安DMV_Core
https://raw.githubusercontent.com/Dekita/DMV/master/DMV_Core.js

点评

https://raw.githubusercontent.com/mv-secret-team/MVCommons/master/MVCommons.js  发表于 2015-11-23 18:56
MVCommons有没有安?  发表于 2015-11-23 18:56
安装了呢,所以不知道原因,最好有个实现了范例了  发表于 2015-11-19 10:44
回复

使用道具 举报

世界坑化协会

梦石
0
星屑
9565
在线时间
1592 小时
注册时间
2007-3-13
回帖
5263

极短26参与极短25参与极短23参与极短21参与开拓者贵宾第一届化妆舞会最佳服饰奖

 楼主| 发表于 2015-11-20 16:30:41 | 显示全部楼层
趁周末顶一下,再没人就下架了
忍卷NINMAKI游戏DEMO上线了~♪  点我下载  ☚
回复

使用道具 举报

梦石
0
星屑
60
在线时间
81 小时
注册时间
2015-4-19
回帖
57
发表于 2015-11-20 16:38:16 | 显示全部楼层
tseyik 发表于 2015-11-18 23:45
有没有安DMV_Core
所有DMV_xxx都要先安DMV_Core
https://raw.githubusercontent.com/Dekita/DMV/master/DMV ...

大哥可以帮忙吧这个脚本里的“全体成员自动”功能删除吗?单体自动的留着,谢谢了
回复

使用道具 举报

梦石
0
星屑
60
在线时间
81 小时
注册时间
2015-4-19
回帖
57
发表于 2015-11-20 16:39:11 | 显示全部楼层
本帖最后由 余烬之中 于 2015-11-23 14:37 编辑
tseyik 发表于 2015-11-18 23:45
有没有安DMV_Core
所有DMV_xxx都要先安DMV_Core
https://raw.githubusercontent.com/Dekita/DMV/master/DMV ...


[pre lang="javascript" line="1"]/**
* Created by Gilles on 01.11.2015.
* @email: gill.es86@gmail.com
*/

/*:
* @plugindesc Allows Auto Attack in Battle. The players will always choose the enemy with the lowest hp
* @author Gilles Meyer
*
* @param Auto Attack Text Party
* @desc The text which will appear in the Party command Menu
* @default Auto Attack
*
* @param Auto Attack Text Actor
* @desc The text which will appear in the Actor command Menu
* @default Auto Attack
*
*
*
*/

(function() {


  var parameters = PluginManager.parameters('AutoBattlePlugin');
  var autoAttackPartyText = String(parameters['Auto Attack Text Party'] || "自动");
  var autoAttackActorText = String(parameters['Auto Attack Text Actor'] || "自动");

  var getEnemyWithLowestHP = function(enemies) {
    var enemyIndex = 0;
    for(var i=1; i < enemies.length; i++) {
      if(enemies.hp < enemies[enemyIndex].hp || enemies[enemyIndex].hp == 0) {
        enemyIndex = i;
      }
    }
    return enemyIndex;
  };

  
  Scene_Battle.prototype.commandAutoFight = function() {
    this.selectNextCommand();
    do {
      this.commandAutoAttack.apply(this, arguments);
    } while(BattleManager.isInputting());
    this._actorCommandWindow.deactivate();
  };

  Scene_Battle.prototype.commandAutoAttack = function() {
    BattleManager.inputtingAction().setAttack();
    var enemyIndex = getEnemyWithLowestHP(this._enemyWindow._enemies);
    var action = BattleManager.inputtingAction();
    action.setTarget(enemyIndex);
    this.selectNextCommand();
  };


  // ## Autofight for Party
  Window_PartyCommand.prototype.makeCommandList = function() {
    this.addCommand(TextManager.fight,  'fight');
    // Needs rework
    this.addCommand(autoAttackPartyText,  'autofight');
    this.addCommand(TextManager.escape, 'escape', BattleManager.canEscape());
  };

  var _Scene_Battle_createPartyCommandWindow = Scene_Battle.prototype.createPartyCommandWindow;
  Scene_Battle.prototype.createPartyCommandWindow = function() {
    _Scene_Battle_createPartyCommandWindow.apply(this, arguments);
    this._partyCommandWindow.setHandler('autofight',  this.commandAutoFight.bind(this));
  };


  // ## Autofight for each Actor
  var Scene_Battle_createActorCommandWindow = Scene_Battle.prototype.createActorCommandWindow;
  Scene_Battle.prototype.createActorCommandWindow = function() {
    Scene_Battle_createActorCommandWindow.call(this,arguments);
    this._actorCommandWindow.setHandler('autoattack', this.commandAutoAttack.bind(this));
  };

  var _Window_ActorCommand_makeCommandList = Window_ActorCommand.prototype.makeCommandList;
  Window_ActorCommand.prototype.makeCommandList = function() {
    if(this._actor) {
      this.addCommand(autoAttackActorText, 'autoattack', this._actor.canAttack());
    }
    _Window_ActorCommand_makeCommandList.call(this, arguments);
  };


})();
[/pre]

评分

参与人数 1星屑 -10 收起 理由
余烬之中 -10 在别人的主题帖下发问+不必要的连贴.

查看全部评分

回复

使用道具 举报

世界坑化协会

梦石
0
星屑
9565
在线时间
1592 小时
注册时间
2007-3-13
回帖
5263

极短26参与极短25参与极短23参与极短21参与开拓者贵宾第一届化妆舞会最佳服饰奖

 楼主| 发表于 2015-11-23 14:14:05 | 显示全部楼层
还是没人,BZ帮结贴吧

点评

应该收到了  发表于 2015-11-23 15:01
第一次操作悬赏帖..已经收到了退款吧 =w=  发表于 2015-11-23 14:40
忍卷NINMAKI游戏DEMO上线了~♪  点我下载  ☚
回复

使用道具 举报

梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2015-11-23 15:51:26 | 显示全部楼层
本帖最后由 tseyik 于 2015-11-23 16:03 编辑

PictureCallCommon
Image001.png
Image005.png
Image002.png

Image006.png
Image003.png
Image004.png
Image0010..png
[fold=ChangeMapTouchPolicy]//=============================================================================// ChangeMapTouchPolicy.js// ----------------------------------------------------------------------------// Copyright (c) 2015 Triacontane// This plugin is released under the MIT License.// http://opensource.org/licenses/mit-license.php// ----------------------------------------------------------------------------// Version// 1.0.0 2015/11/18 初版// ----------------------------------------------------------------------------// [Blog]   : http://triacontane.blogspot.jp/// [Twitter]: https://twitter.com/triacontane/// [GitHub] : https://github.com/triacontane// ... ==================/*: * @plugindesc Plugin that change policy of 'map touch' * @author triacontane * * @param initPolicyLevel * @desc Initial value of policy level * @default 3 * * @help Plugin that change policy of 'map touch' * There are four stages * *  1 : 'map touch' become invalid *  2 : 'map touch' become simple(move one step) *  3 : 'map touch' become normal(default policy) *  4 : 'map touch' become excessive(auto track to pointer) * * Plugin Command *  CHANGE_MTP [policy level] : change policy of 'map touch' *  ex:CHANGE_MTP 3 * * This plugin is released under the MIT License. *//*:ja * @plugindesc マップタッチ仕様変更プラグイン * @author トリアコンタン *  * @param 仕様レベル初期値 * @desc 初期状態でのマップタッチの仕様レベル * @default 3 *  * @help マップをタッチした際の移動の仕方を4種類から変更できます。 * パラメータの「仕様レベル初期値」を設定してください。 * 1 : 無効「マップをタッチしてもプレイヤーは動きません」 * 2 : 簡易「マップをタッチするとプレイヤーが一マスだけ動きます」 *   (指定位置へは移動しません。タッチし続けると移動を続けます) * 3 : 通常「マップをタッチするとその位置へプレイヤーが動きます」 *   (もともとの仕様です) * 4 : 過剰「一度でもマップクリックすると以後、プレイヤーがポインタを追跡します」 *   (もう一度クリックすると移動を止めます) * * プラグインコマンド詳細 *   イベントコマンド「プラグインコマンド」から実行。 *   (引数の間は半角スペースで区切る) * *  CHANGE_MTP [仕様レベル] : マップタッチの仕様レベルを変更します。 *  例:CHANGE_MTP 3 * * 利用規約: *  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) *  についても制限はありません。 *  ただし、ヘッダのライセンス表示は残してください。 */(function () {    var pluginName = 'ChangeMapTouchPolicy';    //=============================================================================    // PluginManager    //  多言語とnullに対応したパラメータの取得を行います。    //  このコードは自動生成され、全てのプラグインで同じものが使用されます。    //=============================================================================    PluginManager.getParamString = function(pluginName, paramEngName, paramJpgName) {        var value = this.getParamOther(pluginName, paramEngName, paramJpgName);        return value == null ? '' : value;    };    PluginManager.getParamNumber = function(pluginName, paramEngName, paramJpgName, min, max) {        var value = this.getParamOther(pluginName, paramEngName, paramJpgName);        if (arguments.length <= 3) min = -Infinity;        if (arguments.length <= 4) max = Infinity;        return (parseInt(value, 10) || 0).clamp(min, max);    };    PluginManager.getParamBoolean = function(pluginName, paramEngName, paramJpgName) {        var value = this.getParamOther(pluginName, paramEngName, paramJpgName);        return (value || '').toUpperCase() == 'ON';    };    PluginManager.getParamOther = function(pluginName, paramEngName, paramJpgName) {        var value = this.parameters(pluginName)[paramEngName];        if (value == null) value = this.parameters(pluginName)[paramJpgName];        return value;    };    PluginManager.getCommandName = function(command) {        return (command || '').toUpperCase();    };    PluginManager.checkCommandName = function(command, value) {        return this.getCommandName(command) === value;    };    PluginManager.getArgString = function(index, args) {        return args[index] || '';    };    PluginManager.getArgNumber = function(index, args, min, max) {        if (arguments.length <= 2) min = -Infinity;        if (arguments.length <= 3) max = Infinity;        return (parseInt(args[index], 10) || 0).clamp(min, max);    };    //=============================================================================    // Game_Interpreter    //  プラグインコマンド[CHANGE_MTP]などを追加定義します。    //=============================================================================    var _Game_Interpreter_pluginCommand      = Game_Interpreter.prototype.pluginCommand;    Game_Interpreter.prototype.pluginCommand = function (command, args) {        _Game_Interpreter_pluginCommand.call(this, command, args);        if (PluginManager.checkCommandName(command, 'CHANGE_MTP')) {            $gameSystem._mapTouchPolicy = PluginManager.getArgNumber(0, args, 1, 4);        }    };    //=============================================================================    // Game_Temp    //  移動開始フラグを追加定義します。    //=============================================================================    var _Game_Temp_initialize = Game_Temp.prototype.initialize;    Game_Temp.prototype.initialize = function() {        _Game_Temp_initialize.call(this);        this._moveStart = false;    };    //=============================================================================    // Game_System    //  仕様レベルの初期値を追加定義します。    //=============================================================================    var _Game_System_initialize = Game_System.prototype.initialize;    Game_System.prototype.initialize = function() {        _Game_System_initialize.call(this);        this._mapTouchPolicy = PluginManager.getParamNumber(pluginName, 'initPolicyLevel', '仕様レベル初期値', 1, 4);    };    //=============================================================================    // Scene_Map    //  仕様レベルによってマップタッチの挙動を変更します。    //=============================================================================    var _Scene_Map_isMapTouchOk = Scene_Map.prototype.isMapTouchOk;    Scene_Map.prototype.isMapTouchOk = function() {        var result = $gameSystem._mapTouchPolicy !== 1 && _Scene_Map_isMapTouchOk.call(this);        if (!result) $gameTemp._moveStart = false;        return result;    };    var _Scene_Map_processMapTouch = Scene_Map.prototype.processMapTouch;    Scene_Map.prototype.processMapTouch = function() {        switch ($gameSystem._mapTouchPolicy) {            case 2:                this.processMapTouchLevel2();                break;            case 3:                _Scene_Map_processMapTouch.call(this);                break;            case 4:                this.processMapTouchLevel4();                break;        }    };    Scene_Map.prototype.processMapTouchLevel2 = function() {        if (TouchInput.isTriggered() || ($gameTemp._moveStart && TouchInput.isPressed())) {            var px = $gamePlayer.x;            var py = $gamePlayer.y;            var deltaX = $gameMap.deltaX($gameMap.canvasToMapX(TouchInput.x), px);            var deltaY = $gameMap.deltaY($gameMap.canvasToMapY(TouchInput.y), py);            var d = 0;            if (Math.abs(deltaX) < Math.abs(deltaY)) {                if (deltaY > 0) d = 2;                if (deltaY < 0) d = 8;            } else {                if (deltaX > 0) d = 6;                if (deltaX < 0) d = 4;            }            if (d === 0) return;            if (!$gamePlayer.isMapPassable(px, py, d)) {                if (Math.abs(deltaX) < Math.abs(deltaY)) {                    if (deltaX > 0) d = 6;                    if (deltaX < 0) d = 4;                } else {                    if (deltaY > 0) d = 2;                    if (deltaY < 0) d = 8;                }            }            if (d === 0) return;            if ($gamePlayer.isMapPassable(px, py, d)) {                switch (d) {                    case 2:                        py++;                        break;                    case 4:                        px--;                        break;                    case 6:                        px++;                        break;                    case 8:                        py--;                        break;                }                $gameTemp.setDestination(px, py);                $gameTemp._moveStart = true;            }        }    };    Scene_Map.prototype.processMapTouchLevel4 = function() {        var x = $gameMap.canvasToMapX(TouchInput.x);        var y = $gameMap.canvasToMapY(TouchInput.y);        if (TouchInput.isTriggered()) $gameTemp._moveStart = !$gameTemp._moveStart;        if ($gameTemp._moveStart) {            $gameTemp.setDestination(x, y);        } else {            $gameTemp.clearDestination();        }    };    //=============================================================================    // TouchInput    //  ポインタ移動時にマウス位置の記録を常に行うように元の処理を上書き    //=============================================================================    TouchInput._onMouseMove = function(event) {        var x = Graphics.pageToCanvasX(event.pageX);        var y = Graphics.pageToCanvasY(event.pageY);        this._onMove(x, y);    }})();[/fold]
[fold=PictureCallCommon]//=============================================================================// PictureCallCommon.js// ----------------------------------------------------------------------------// Copyright (c) 2015 Triacontane// This plugin is released under the MIT License.// http://opensource.org/licenses/mit-license.php// ----------------------------------------------------------------------------// Version// 1.1.0 2015/11/23 コモンイベントを呼び出した対象のピクチャ番号を特定する機能を追加//                  設定で透明色を考慮する機能を追加//                  トリガーとして「右クリック」や「長押し」を追加// 1.0.0 2015/11/14 初版// ----------------------------------------------------------------------------// [Blog]   : http://triacontane.blogspot.jp/// [Twitter]: https://twitter.com/triacontane/// [GitHub] : https://github.com/triacontane// ... ==================/*:ja * @plugindesc ピクチャのボタン化プラグイン * @author トリアコンタン * * @param 透明色を考慮 * @desc クリックされた箇所が透明色だった場合は、クリックを無効にする。 * @default OFF * * @param ピクチャ番号の変数番号 * @desc コモンイベント呼び出し時にピクチャ番号を格納するゲーム変数の番号 * @default 0 * * @help ピクチャをクリックすると、指定したコモンイベントが * 呼び出されるようになるプラグインコマンドを提供します。 * このプラグインを利用すれば、javascriptの知識がなくても * 誰でも簡単にクリックやタッチを主体にしたゲームを作れます。 * * 注意! * 一度関連づけたピクチャとコモンイベントはピクチャを消去しても有効です。 * ピクチャが存在しなければどこをクリックしても反応しませんが、 * 同じ番号で再度、ピクチャの表示を行うと反応するようになります。 * * プラグインコマンド詳細 *  イベントコマンド「プラグインコマンド」から実行。 *  (引数の間は半角スペースで区切る) * *  P_CALL_CE [ピクチャ番号] [コモンイベントID] [トリガー]: *      ピクチャがクリックされたときに呼び出されるコモンイベントを関連づけます。 *    トリガーは以下の通りです。(省略すると 1 になります) *    1 : クリックした場合 *      2 : 右クリックした場合 *      3 : 長押しした場合 *      4 : マウスを重ねた場合 *      5 : マウスを放した場合 * *  P_CALL_CE_REMOVE [ピクチャ番号] : *      ピクチャとコモンイベントの関連づけを解除します。 *      全てのトリガーが削除対象です。 * * 利用規約: *  作者に無断で改変、再配布が可能で、利用形態(商用、18禁利用等) *  についても制限はありません。 *  ただし、ヘッダのライセンス表示は残してください。 *//*: * @plugindesc Clickable picture plugin * @author triacontane * * @param TransparentConsideration * @desc if click position is transparent, click is disabled. * @default OFF * * @param GameVariablePictureNum * @desc Game variable number that stores the picture number when common event called. * @default 0 *  * @help When clicked picture, call common event. * * Plugin Command * *  P_CALL_CE [Picture number] [Common event ID] [Trigger]: *      When picture was clicked, assign common event id. *    Trigger are As below(if omit, It is specified to 1) *    1 : Left click *      2 : Right click *      3 : Long click *      4 : Mouse over *      5 : Mouse out * *  P_CALL_CE_REMOVE [Picture number] : *      break relation from picture to common event. * *  This plugin is released under the MIT License. */(function () {    var pluginName = 'PictureCallCommon';    //=============================================================================    // PluginManager    //  多言語とnullに対応したパラメータの取得を行います。    //  このコードは自動生成され、全てのプラグインで同じものが使用されます。    //=============================================================================    PluginManager.getParamBoolean = function(pluginName, paramEngName, paramJpgName) {        var value = this.getParamOther(pluginName, paramEngName, paramJpgName);        return (value || '').toUpperCase() == 'ON';    };    PluginManager.getParamOther = function(pluginName, paramEngName, paramJpgName) {        var value = this.parameters(pluginName)[paramEngName];        if (value == null) value = this.parameters(pluginName)[paramJpgName];        return value;    };    PluginManager.getCommandName = function(command) {        return (command || '').toUpperCase();    };    PluginManager.checkCommandName = function(command, value) {        return this.getCommandName(command) === value;    };    PluginManager.getArgString = function(index, args) {        return args[index] || '';    };    PluginManager.getArgNumber = function(index, args, min, max) {        if (arguments.length <= 2) min = -Infinity;        if (arguments.length <= 3) max = Infinity;        return (parseInt(args[index], 10) || 0).clamp(min, max);    };    //=============================================================================    // Game_Interpreter    //  プラグインコマンド[P_CALL_CE]などを追加定義します。    //=============================================================================    var _Game_Interpreter_pluginCommand      = Game_Interpreter.prototype.pluginCommand;    Game_Interpreter.prototype.pluginCommand = function (command, args) {        _Game_Interpreter_pluginCommand.call(this, command, args);        var pictureId;        var commonId;        var trigger;        switch (PluginManager.getCommandName(command)) {            case 'P_CALL_CE' :                pictureId = PluginManager.getArgNumber(0, args, 1, 100);                commonId  = PluginManager.getArgNumber(1, args, 1, 100);                trigger   = PluginManager.getArgNumber(2, args, 1, 8);                $gameScreen.setPictureCallCommon(pictureId, commonId, trigger);                break;            case 'P_CALL_CE_REMOVE' :                pictureId = PluginManager.getArgNumber(0, args, 1, 100);                $gameScreen.setPictureRemoveCommon(pictureId);                break;        }    };    //=============================================================================    // Game_Temp    //  呼び出し予定のコモンイベントIDのフィールドを追加定義します。    //=============================================================================    var _Game_Temp_initialize = Game_Temp.prototype.initialize;    Game_Temp.prototype.initialize = function() {        _Game_Temp_initialize.call(this);        this._pictureCommonId = 0;        this._pictureNum = 0;    };    //=============================================================================    // Game_Map    //  ピクチャがタッチされたときのコモンイベント呼び出し処理を追加定義します。    //=============================================================================    var _Game_Map_setupStartingEvent = Game_Map.prototype.setupStartingEvent;    Game_Map.prototype.setupStartingEvent = function() {        var result = _Game_Map_setupStartingEvent.call(this);        return result || this.setupPictureCommonEvent();    };    Game_Map.prototype.setupPictureCommonEvent = function() {        var commonId = $gameTemp._pictureCommonId;        var event    = $dataCommonEvents[commonId];        var result   = false;        if (commonId > 0 && !this.isEventRunning() && event) {            var gameValueNum = PluginManager.getParamNumber(pluginName,                'GameVariablePictureNum', 'ピクチャ番号の変数番号', 0, 5000);            if (gameValueNum !== 0) $gameVariables.setValue(gameValueNum, $gameTemp._pictureNum);            this._interpreter.setup(event.list);            result = true;        }        $gameTemp._pictureCommonId = 0;        $gameTemp._pictureNum = 0;        return result;    };    //=============================================================================    // Game_Troop    //  ピクチャがタッチされたときのコモンイベント呼び出し処理を追加定義します。    //=============================================================================    Game_Troop.prototype.setupPictureCommonEvent = function() {        var commonId = $gameTemp._pictureCommonId;        var event = $dataCommonEvents[commonId];        if (commonId > 0 && !this.isEventRunning() && event) {            this._interpreter.setup(event.list);            $gameTemp._pictureCommonId = 0;            return true;        }        return false;    };    //=============================================================================    // Game_Screen    //  ピクチャに対応するコモンイベント呼び出し用のID配列を追加定義します。    //=============================================================================    var _Game_Screen_initialize = Game_Screen.prototype.initialize;    Game_Screen.prototype.initialize = function() {        _Game_Screen_initialize.call(this);        this._pictureCidArray = [];    };    Game_Screen.prototype.setPictureCallCommon = function(pictureId, commonId, trigger) {        var realPictureId = this.realPictureId(pictureId);        if (this._pictureCidArray[realPictureId] == null) this._pictureCidArray[realPictureId] = [];        this._pictureCidArray[realPictureId][trigger] = commonId;    };    Game_Screen.prototype.setPictureRemoveCommon = function(pictureId) {        var realPictureId = this.realPictureId(pictureId);        this._pictureCidArray[realPictureId] = [];    };    //=============================================================================    // Scene_Map    //  ピクチャのタッチ状態からのコモンイベント呼び出し予約を追加定義します。    //=============================================================================    var _Scene_Map_update = Scene_Map.prototype.update;    Scene_Map.prototype.update = function() {        if (!$gameMap.isEventRunning()) this.updateTouchPictures();        _Scene_Map_update.call(this);    };    Scene_Map.prototype.updateTouchPictures = function() {        this._spriteset.callTouchPictures();    };    var _Scene_Map_isMapTouchOk = Scene_Map.prototype.isMapTouchOk;    Scene_Map.prototype.isMapTouchOk = function() {        return _Scene_Map_isMapTouchOk.call(this) && $gameTemp._pictureCommonId === 0;    };    //=============================================================================    // Scene_Battle    //  ピクチャのタッチ状態からのコモンイベント呼び出し予約を追加定義します。    //=============================================================================    var _Scene_Battle_update = Scene_Battle.prototype.update;    Scene_Battle.prototype.update = function() {        this.updateTouchPictures();        $gameTroop.setupPictureCommonEvent();        _Scene_Battle_update.call(this);    };    Scene_Battle.prototype.updateTouchPictures = function() {        this._spriteset.callTouchPictures();    };    //=============================================================================    // Spriteset_Base    //  ピクチャのタッチ状態からのコモンイベント呼び出し予約を追加定義します。    //=============================================================================    Spriteset_Base.prototype.callTouchPictures = function() {        this._pictureContainer.children.forEach(function(picture) {            picture.callTouch();        }, this);    };    //=============================================================================    // Sprite_Picture    //  ピクチャのタッチ状態からのコモンイベント呼び出し予約を追加定義します。    //=============================================================================    var _Sprite_Picture_initialize = Sprite_Picture.prototype.initialize;    Sprite_Picture.prototype.initialize = function(pictureId) {        _Sprite_Picture_initialize.call(this, pictureId);        this._triggerHandler    = [];        this._triggerHandler[1]        = this.isTriggered.bind(this);        this._triggerHandler[2]        = this.isCancelled.bind(this);        this._triggerHandler[3]        = this.isLongPressed.bind(this);        this._triggerHandler[4]        = this.isOnFocus.bind(this);        this._triggerHandler[5]        = this.isOutFocus.bind(this);        this._triggerHandler[6]        = this.isReleased.bind(this);        this._triggerHandler[7]        = this.isRepeated.bind(this);        this._triggerHandler[8]        = this.isPressed.bind(this);        this._onMouse                  = false;        this._outMouse                 = false;        this._wasOnMouse               = false;        this._transparentConsideration =            PluginManager.getParamBoolean(pluginName, 'TransparentConsideration', '透明色を考慮');    };    var _Sprite_update = Sprite_Picture.prototype.update;    Sprite_Picture.prototype.update = function() {        _Sprite_update.call(this);        this._onMouse  = false;        this._outMouse = false;        if (TouchInput.isMoved()) {            if (this.isTouchPosInRect() && this.isNotTransparent()) {                if (!this._wasOnMouse) {                    this._onMouse    = true;                    this._wasOnMouse = true;                }            } else {                if (this._wasOnMouse) {                    this._outMouse   = true;                    this._wasOnMouse = false;                }            }        }    };    Sprite_Picture.prototype.callTouch = function() {        var commandIds = $gameScreen._pictureCidArray[$gameScreen.realPictureId(this._pictureId)];        if (commandIds == null) return;        for (var i = 1; i <= this._triggerHandler.length; i++) {            if (commandIds != null && this._triggerHandler() && (i === 5 || i === 4 || this.isNotTransparent())) {                $gameTemp._pictureCommonId = commandIds;                $gameTemp._pictureNum = this._pictureId;            }        }    };    Sprite_Picture.prototype.isNotTransparent = function () {        if (!this._transparentConsideration) return true;        var bx = (TouchInput.x - this.x) / this.scale.x + this.anchor.x * this.width;        var by = (TouchInput.y - this.y) / this.scale.y + this.anchor.y * this.height;        var alpha = this.bitmap.getAlphaPixel(bx, by);        return alpha !== 0;    };    //=============================================================================    // Sprite_Picture    //  タッチ操作を可能にする共通部分    //=============================================================================    Sprite_Picture.prototype.screenWidth = function() {        return (this.width || 0) * this.scale.x;    };    Sprite_Picture.prototype.screenHeight = function() {        return (this.height || 0) * this.scale.y;    };    Sprite_Picture.prototype.screenX = function() {        return (this.x || 0) - this.anchor.x * this.screenWidth();    };    Sprite_Picture.prototype.screenY = function() {        return (this.y || 0) - this.anchor.y * this.screenHeight();    };    Sprite_Picture.prototype.minX = function() {        var width = this.screenWidth();        return Math.min(this.screenX(), this.screenX() + width);    };    Sprite_Picture.prototype.minY = function() {        var height = this.screenHeight();        return Math.min(this.screenY(), this.screenY() + height);    };    Sprite_Picture.prototype.maxX = function() {        var width = this.screenWidth();        return Math.max(this.screenX(), this.screenX() + width);    };    Sprite_Picture.prototype.maxY = function() {        var height = this.screenHeight();        return Math.max(this.screenY(), this.screenY() + height);    };    Sprite_Picture.prototype.isTouchPosInRect = function () {        var tx = TouchInput.x;        var ty = TouchInput.y;        return (tx >= this.minX() && tx <= this.maxX() &&                ty >= this.minY() && ty <= this.maxY());    };    Sprite_Picture.prototype.isTouchable = function() {        return this.bitmap != null && this.visible && this.scale.x !== 0 && this.scale.y !== 0;    };    Sprite_Picture.prototype.isTriggered = function() {        return this.isTouchEvent(TouchInput.isTriggered());    };    Sprite_Picture.prototype.isCancelled = function() {        return this.isTouchEvent(TouchInput.isCancelled());    };    Sprite_Picture.prototype.isLongPressed = function() {        return this.isTouchEvent(TouchInput.isLongPressed());    };    Sprite_Picture.prototype.isPressed = function() {        return this.isTouchEvent(TouchInput.isPressed());    };    Sprite_Picture.prototype.isReleased = function() {        return this.isTouchEvent(TouchInput.isReleased());    };    Sprite_Picture.prototype.isRepeated = function() {        return this.isTouchEvent(TouchInput.isRepeated());    };    Sprite_Picture.prototype.isOnFocus = function() {        return this._onMouse;    };    Sprite_Picture.prototype.isOutFocus = function() {        return this._outMouse;    };    Sprite_Picture.prototype.isTouchEvent = function(triggerResult) {        return this.isTouchable && triggerResult && this.isTouchPosInRect();    };    //=============================================================================    // TouchInput    //  ポインタ移動時にマウス位置の記録を常に行うように元の処理を上書き    //=============================================================================    TouchInput._onMouseMove = function(event) {        var x = Graphics.pageToCanvasX(event.pageX);        var y = Graphics.pageToCanvasY(event.pageY);        this._onMove(x, y);    }})();[/fold]

点评

等一下这脚本框里面惊人的格式是怎么回事囧!  发表于 2015-11-24 19:53

评分

参与人数 1星屑 +266 收起 理由
余烬之中 + 266 其实楼主选择直接结贴了囧

查看全部评分

回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部