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

Project1

 找回密码
 注册会员
搜索
查看: 16866|回复: 18

[原创发布] 【插件】地图显示变量

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
9 小时
注册时间
2016-3-5
帖子
5
发表于 2016-3-12 16:16:40 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 议长 于 2016-3-12 16:21 编辑

一个非常……非常简单的插件。
在地图上新建一个透明窗口,然后通过窗口显示数字,比如你使用序号为0001:游戏开始。经过操作并设定后,屏幕上某个角落出现了0这个数字(没改变变量值的情况下),然后你再把0001的值改成了1,那个数字也会随之改变。

啊……我语文不好就不多说了……(慵懒状

JAVASCRIPT 代码复制下载
  1. //=============================================================================
  2. // TO_ShowNumberOnMap.js
  3. //=============================================================================
  4.  
  5. /*:
  6.  * @plugindesc Show variables on the screen when on the map.
  7.  * @author Truth Originem
  8.  *
  9.  * @help
  10.  *
  11.  * Plugin Command:
  12.  *  ShowVariable initialize 1 0.5 0.5 100 left 意思是建立一个变量序号为1,在屏幕
  13.  *  正中间(左上角为0,0的比例因素),最宽像素为100( *  里面的变量最多占这么大,目前
  14.  *  没写成比例),排列方式为左对齐的对象。该对象建立期初是不可见的,内容为变量内容。
  15.  *  ShowVariable show 1 显示变量序号为1的对象。
  16.  *  ShowVariable hide 1 隐藏变量序号为1的对象。
  17.  *  ShowVariable setColor 1 #FF0000 使变量序号为1的对象呈现红色(#FF0000)
  18.  */
  19.  
  20. var $dataVariables = null;
  21.  
  22. (function(){
  23.     var _Scene_Map_createAllWindows = Scene_Map.prototype.createAllWindows;
  24.     Scene_Map.prototype.createAllWindows = function ()
  25.     {
  26.         _Scene_Map_createAllWindows.call(this);
  27.         if(!$dataVariables){
  28.             $dataVariables = new Window_VariableShowTab();
  29.         }
  30.         this.addChild($dataVariables);
  31.     };
  32.  
  33.  
  34.     function Window_VariableShowTab(){
  35.         this.initialize.apply(this, arguments);
  36.     }
  37.     Window_VariableShowTab.prototype = Object.create(Window_Base.prototype);
  38.     Window_VariableShowTab.prototype.constructor = Window_VariableShowTab;
  39.  
  40.     Window_VariableShowTab.prototype.initialize = function(){
  41.         var width = Graphics.boxWidth;
  42.         var height = Graphics.boxHeight;
  43.         Window_Base.prototype.initialize.call(this, 0, 0, width, height);
  44.         this.opacity = 0;
  45.         this._data = [];
  46.     };
  47.     Window_VariableShowTab.prototype.update = function(){
  48.         this.contents.clear();
  49.         for(var i =0;i<this._data.length;i++){
  50.             var data = this._data[i];
  51.             if(data.isEnabled()){
  52.                 this.changeTextColor(data._color);
  53.                 this.drawText(data.getVariable(),data._x,data._y,data._maxWidth,data._align);
  54.                 this.resetTextColor();
  55.             }
  56.         }
  57.     };
  58.     Window_VariableShowTab.prototype.getDatas = function(){
  59.         return this._data;
  60.     };
  61.     Window_VariableShowTab.prototype.getData = function(id){
  62.         var data = null;
  63.         for(var i =0;i<this._data.length;i++){
  64.             if(this._data[i]._id == id){
  65.                 data = this._data[i];
  66.                 break;
  67.             }
  68.         }
  69.         return data;
  70.     };
  71.  
  72.     var _Game_Interpreter_pluginCommand =
  73.         Game_Interpreter.prototype.pluginCommand;
  74.     Game_Interpreter.prototype.pluginCommand = function(command, args) {
  75.         _Game_Interpreter_pluginCommand.call(this, command, args);
  76.         if (command === 'ShowVariable') {
  77.             switch (args[0]) {
  78.                 case 'initialize':
  79.                     var data = new VariableData(Number(args[1]),Number(args[2]),Number(args[3]),Number(args[4]),String(args[5]));
  80.                     $dataVariables.getDatas().push(data);
  81.                     break;
  82.                 case 'show':
  83.                     $dataVariables.getData(Number(args[1])).setEnabled(true);
  84.                     break;
  85.                 case 'hide':
  86.                     $dataVariables.getData(Number(args[1])).setEnabled(false);
  87.                     break;
  88.                 case 'setColor':
  89.                     $dataVariables.getData(Number(args[1])).setColor(String(args[2]));
  90.                     break;
  91.             }
  92.         }
  93.     };
  94.  
  95.     function VariableData(){
  96.         this.initialize.apply(this, arguments);
  97.     }
  98.     VariableData.prototype.constructor = VariableData;
  99.     VariableData.prototype.initialize = function(id,x_factor,y_factor,maxWidth,align){
  100.         this._x = Graphics.boxWidth*x_factor;
  101.         this._y = Graphics.boxHeight*y_factor;
  102.         this._maxWidth = maxWidth;
  103.         this._align = align;
  104.         this._id = id;
  105.         this._color = $dataVariables.normalColor();
  106.         this._enabled = false;
  107.     };
  108.     VariableData.prototype.getVariable = function(){
  109.         return $gameVariables.value(this._id);
  110.     };
  111.     VariableData.prototype.isEnabled = function(){
  112.         return this._enabled;
  113.     };
  114.     VariableData.prototype.setEnabled = function(enabled){
  115.         this._enabled = enabled;
  116.     };
  117.     VariableData.prototype.setColor = function(color){
  118.         this._color = color;
  119.     }
  120. })();

TO_ShowNumberOnMap.rar

1.45 KB, 下载次数: 579

评分

参与人数 5星屑 +147 梦石 +1 收起 理由
king + 12 塞糖头像
余烬之中 + 1 原创发布
翻滚牛宝宝 + 15 精品文章
夏末渐离 + 60 塞糖
夜$神 + 60 精品文章

查看全部评分

头像被屏蔽

Lv5.捕梦者 (禁止访问)

国主

梦石
29
星屑
5204
在线时间
1205 小时
注册时间
2015-6-12
帖子
800

短篇十战斗者组别亚军

发表于 2016-3-12 16:29:21 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
491 小时
注册时间
2015-1-7
帖子
124
发表于 2016-3-12 21:01:22 | 显示全部楼层
可以美化一下,比如加个底图什么的
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1232
在线时间
1017 小时
注册时间
2011-4-30
帖子
1516
发表于 2016-3-12 21:53:54 | 显示全部楼层
挺好的,不过如果能显示多个或者交替显示就好了.
以及可以添加一些文字 比如 变量1 : 0
这样
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
9 小时
注册时间
2016-3-5
帖子
5
 楼主| 发表于 2016-3-13 13:30:01 | 显示全部楼层
汪汪 发表于 2016-3-12 21:53
挺好的,不过如果能显示多个或者交替显示就好了.
以及可以添加一些文字 比如 变量1 : 0
这样  ...

嘛,这个插件实际上只是为了配合某一个游戏的一次应用而摸鱼出来的,可能以后会拓展功能吧……{:2_276:}
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4641
在线时间
112 小时
注册时间
2016-1-15
帖子
64
发表于 2017-1-31 15:35:17 | 显示全部楼层
能不能加个删除的命令,请楼主费心弄一下。
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4641
在线时间
112 小时
注册时间
2016-1-15
帖子
64
发表于 2017-2-8 15:13:58 | 显示全部楼层
稍微改动了一下,可以显示:文本+变量,这样就可以做一些屏幕提示了 MapBianliang.zip (1.55 KB, 下载次数: 606)
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
4641
在线时间
112 小时
注册时间
2016-1-15
帖子
64
发表于 2017-2-8 15:15:00 | 显示全部楼层
使用方法:ShowVariable initialize 1 0.0 0.0 200 left 战斗力:
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3336
在线时间
468 小时
注册时间
2014-2-6
帖子
258
发表于 2017-7-3 19:31:39 | 显示全部楼层
mikeyh01 发表于 2017-2-8 15:15
使用方法:ShowVariable initialize 1 0.0 0.0 200 left 战斗力:

还是什么都不显示.......求教怎么用..
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
55
在线时间
5 小时
注册时间
2017-7-16
帖子
4
发表于 2017-7-24 14:36:12 | 显示全部楼层
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-3-29 13:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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