查看: 8112|回复: 26

[原创发布] 【移植】MV版 多功能 "即时消息推送" (BUG已修复)

[复制链接]
梦石
0
星屑
1821
在线时间
2528 小时
注册时间
2010-10-12
回帖
1336

开拓者

发表于 2016-4-7 09:53:53 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 刺夜之枪 于 2017-5-26 12:24 编辑

QQ图片20160406185833.jpg
QQ截图20160406184530.png
QQ截图20160406184539.png
QQ截图20160406184856.png

本脚本移植自英顺的马甲的XP脚本"即时消息推送"  
在下仅仅是翻译成MV版并且二次加工。
这个脚本是个很便利的推送脚本,可以自由设置窗口显示的位置。
可以发送不同大小,颜色的推送(目前版本)

点击在Github上查看
在github上查看以保持最新更新

更新日志:

1.1 - [2017-5-26] (最新)
    修复调出菜单后信息栏不再显示的BUG
    Fixed bug: after calling menu, the notification window will no longer display

1.0 - [2016-4-6]
    正式发布
    Release

@英顺的马甲




  1. //=============================================================================
  2. // Mount Blade Battle System Engine Plugins - Instant Message Plugins
  3. // MBBS_InstantMessage.js
  4. //=============================================================================
  5. /*:
  6. * @plugindesc v1.1 Instant Message Plugins
  7.    群战系统MV插件系列之 - 即时消息系统 【XP移植】
  8. * @author Chivalry Studio Plugins / Ivan

  9. * @param ---Notification---
  10. * @default

  11. * @param MaxLimit
  12. * @desc 最多显示多少条消息
  13. * Default: 12
  14. * @default 12
  15. * @param Delay
  16. * @desc 显示多少秒后才消失(单位秒)
  17. * Default: 3
  18. * @default 3
  19. * @param DisappearSpeed
  20. * @desc 消失速度 (越大越快);
  21. * Default: 5
  22. * @default 5
  23. * @param InitialX
  24. * @desc 初始位置X坐标(显示区域左上角X坐标)
  25. * Default: 0
  26. * @default 0
  27. * @param InitialY
  28. * @desc 初始位置Y坐标(显示区域左上角Y坐标)
  29. * Default: 312
  30. * @default 312
  31. * @param Width
  32. * @desc 显示区域宽度
  33. * Default: 272
  34. * @default 272
  35. * @param Height
  36. * @desc 显示区域高度
  37. * Default: 312
  38. * @default 312

  39. * @param ---Font Data---
  40. * @default
  41. * @param FontFace
  42. * @desc 字体名
  43. * Default: GameFont
  44. * @default GameFont
  45. * @param FontSize
  46. * @desc 字体大小
  47. * Default: 28
  48. * @default 28
  49. * @param TextColor
  50. * @desc 字体颜色
  51. * Default: #ffffff
  52. * @default #ffffff

  53. * @help
  54. * --------------------------------------------------------------------------------
  55. * Free for non commercial use.
  56. * Version 1.1
  57. * --------------------------------------------------------------------------------
  58. * Mount Blade Battle System Engine Plugins - Instant Message Plugins
  59.   群战系统MV插件系列之 - 即时消息系统 【移植】
  60.   本系统原为XP即时消息系统脚本 by: 英顺的马甲
  61.   在下觉得这个系统写的很好,于是将这个系统翻译成了MV版本。
  62.   在下并非原作者,在下是编辑者。
  63.    
  64. * --------------------------------------------------------------------------------
  65. * How to use: 使用方法
  66. * --------------------------------------------------------------------------------

  67.     mes (String) the Message.             [Required]
  68.     必填,字符串。想要发送的消息
  69.     color (String) for example: '#ffff00' [Optional]
  70.     选填,字符串,字体颜色。默认为系统颜色
  71.     size (Number) font Size.              [Optional]
  72.     选填,数字,字体大小。默认为系统字体大小
  73.     Notification.post(msg, color, size);
  74.     发一条消息。

  75.     x: (Number) 移动目的地X坐标  [Required]
  76.     y: (Number) 移动目的地Y坐标  [Required]
  77.     width: (Number) 移动后宽度   [Required]
  78.     height:(Number) 移动后高度   [Required]
  79.     Notification.move(x,y,width,height);
  80.     移动消息显示区域到x,y,width, height

  81.     Notification.clear();
  82.     清空消息

  83.     Notification.show();
  84.     开启消息显示

  85.     Notification.hide();
  86.     关闭消息显示

  87.     Notification.pause();
  88.     暂停消息显示

  89.     Notification.restore();
  90.     恢复消息显示

  91. * --------------------------------------------------------------------------------
  92. * Version History
  93. * --------------------------------------------------------------------------------
  94. *
  95. * 1.1 - [2017-5-26]
  96. *    修复调出菜单后信息栏不再显示的BUG
  97. *    Fixed bug: after calling menu, the notification window will no longer display
  98. *
  99. * 1.0 - [2016-4-6]
  100. *    正式发布
  101. *    Release
  102. *
  103. */

  104. var Imported = Imported || {};
  105. Imported.MBBS_InstantMessage = true;
  106. var MBBS_MV = MBBS_MV || {};
  107. MBBS_MV.InstantMessage = MBBS_MV.InstantMessage || {};

  108. //=============================================================================
  109. // Parameter Variables
  110. //=============================================================================
  111. MBBS_MV.Parameters = PluginManager.parameters('MBBS_InstantMessage');
  112. MBBS_MV.Param = MBBS_MV.Param || {};
  113. //notification data
  114. MBBS_MV.Param.MaxLimit          = Number(MBBS_MV.Parameters['MaxLimit']);
  115. MBBS_MV.Param.Delay             = Number(MBBS_MV.Parameters['Delay']);
  116. MBBS_MV.Param.DisappearSpeed    = Number(MBBS_MV.Parameters['DisappearSpeed']);
  117. MBBS_MV.Param.InitialX          = Number(MBBS_MV.Parameters['InitialX']);
  118. MBBS_MV.Param.InitialY          = Number(MBBS_MV.Parameters['InitialY']);
  119. MBBS_MV.Param.Width             = Number(MBBS_MV.Parameters['Width']);
  120. MBBS_MV.Param.Height            = Number(MBBS_MV.Parameters['Height']);
  121. //font data
  122. MBBS_MV.Param.FontFace          = String(MBBS_MV.Parameters['FontFace']);
  123. MBBS_MV.Param.FontSize          = Number(MBBS_MV.Parameters['FontSize']);
  124. MBBS_MV.Param.TextColor         = String(MBBS_MV.Parameters['TextColor']);

  125. //=============================================================================
  126. // Plugin commands -- Game_Interpreter
  127. //=============================================================================
  128. // MBBS_MV.InstantMessage.Game_Interpreter_pluginCommand =
  129. // Game_Interpreter.prototype.pluginCommand;
  130. // Game_Interpreter.prototype.pluginCommand = function(command, args) {
  131. //     MBBS_MV.InstantMessage.Game_Interpreter_pluginCommand.call(this, command, args);
  132. //     if (command == "") {}


  133. // };
  134. //=============================================================================
  135. // Notification
  136. //=============================================================================
  137. function Notification() {
  138.     throw new Error('This is a static class');
  139. };

  140. Notification.FRAME_PER_SECOND = 60;

  141. Notification.initMember = function() {
  142.     this._msg = null;
  143.     this._limit          = MBBS_MV.Param.MaxLimit;
  144.     this._delay          = MBBS_MV.Param.Delay;
  145.     this._disappearSpeed = MBBS_MV.Param.DisappearSpeed;
  146.     this._opacity = 0;
  147.     this._pause = false;
  148.     this._count = this._delay * this.FRAME_PER_SECOND;
  149.     this._sprite = new Sprite();
  150.     this._sprite.bitmap = new Bitmap(1,1);
  151.     this._sprite.z = 99999;
  152.     this._hasInitalized = false;
  153. };

  154. Notification.initialize = function() {
  155.     this._hasInitalized = true;
  156.     Notification.move(
  157.         MBBS_MV.Param.InitialX,
  158.         MBBS_MV.Param.InitialY,
  159.         MBBS_MV.Param.Width,
  160.         MBBS_MV.Param.Height
  161.         );
  162. }

  163. Object.defineProperty(Notification, 'opacity', {
  164.     get: function() {
  165.         return this._opacity;
  166.     },
  167.     set: function(opacity) {
  168.         this._opacity = opacity;
  169.         this._sprite.opacity = opacity;
  170.     },
  171.     configurable: true
  172. });

  173. Notification.setFont = function(fontFace,fontSize,textColor) {
  174.     this._sprite.bitmap.fontFace           = fontFace;
  175.     this._sprite.bitmap.fontSize           = fontSize;
  176.     this._sprite.bitmap.textColor          = textColor;
  177. };

  178. Notification.move = function(x,y,width,height) {
  179.     this._sprite.x = x;
  180.     this._sprite.y = y;
  181.     this._sprite.z = 99999;
  182.     this._sprite.bitmap = new Bitmap(width, height);
  183.     this.refresh();
  184. };

  185. Notification.refresh = function () {
  186.     SceneManager._scene.addChild(this._sprite);
  187.     if ($gameSystem != null) {
  188.         this.redraw();
  189.     }
  190. };

  191. Notification.setLimit = function(max){
  192.     this._limit = max;
  193. };

  194. Notification.post = function(msg, color, size) {
  195.     if (this._pause) {
  196.         return;
  197.     }
  198.     if (!this._hasInitalized) {
  199.         this.initialize();
  200.     }
  201.     // creating message node and push it to $gameSystem.notifications
  202.     var node = new Notification_Message(msg.slice(0), color,size);
  203.     $gameSystem.notifications.push(node);
  204.     // shift when reach max display
  205.     while($gameSystem.notifications.length > this._limit){
  206.         $gameSystem.notifications.shift();
  207.     }
  208.     if ($gameSystem != null) {
  209.         this.redraw();
  210.     }
  211.     //reset counter to and to display the message
  212.     this._count = this._delay * this.FRAME_PER_SECOND;
  213.     this.opacity = 255;

  214. };

  215. Notification.clear = function () {
  216.     $gameSystem.notifications = [];
  217.     this.redraw();
  218. };
  219. /**
  220. *   Draw the nodes stored in the gameSystem Array
  221. */
  222. Notification.redraw = function () {
  223.     var b = this._sprite.bitmap;
  224.     b.clear();
  225.     var b2 = new Bitmap(b.width,Graphics.boxHeight);
  226.     var y = b.height;
  227.     var self = this;
  228.     $gameSystem.notifications.slice().reverse().slice(0,this._limit).forEach(function(n) {
  229.         var x = 0;
  230.         var y2 = 0;
  231.         var h = n.size;
  232.         b2.textColor = n.color;
  233.         b2.fontSize = n.size;
  234.        n.msg.split('').forEach(function(char) {
  235.             if (x + b2.measureTextWidth(char) > b2.width) {
  236.                 x = 0;
  237.                 y2 += h;
  238.             }
  239.             b2.drawText(char,x,y2,b2.width,h,'left');
  240.             x += b2.measureTextWidth(char) + 2;
  241.         });
  242.         y -= (y2+h);
  243.         b.blt(b2, 0, 0, b2.width, y2 + h, 0 , y, b2.width, y2 + h);
  244.         b2.clear();
  245.         y -= 4;
  246.     });
  247. };

  248. Notification.update = function () {
  249.     if (this._count > 0) {
  250.         this._count -= 1;
  251.         return;
  252.     }
  253.     if (this.opacity > 0) {
  254.         this.opacity -= this._disappearSpeed;
  255.     }
  256. };

  257. Notification.show = function () {
  258.     this._sprite.visible = true;
  259.     this.refresh();
  260. };

  261. Notification.hide = function () {
  262.     this._sprite.visible = false;
  263. };

  264. Notification.pause = function () {
  265.     this._pause = true;
  266. };

  267. Notification.restore = function () {
  268.     this._pause = false;
  269. };

  270. Notification.setDelay = function (delay) {
  271.     this._delay = delay;
  272. };
  273. //=============================================================================
  274. // Notification Message
  275. //=============================================================================
  276. function Notification_Message() {
  277.     this.initialize.apply(this, arguments);
  278. }

  279. Notification_Message.prototype.initialize = function(msg, color,size) {
  280.     this._msg = msg == null ? '' : msg;
  281.     this._color = color;
  282.     this._size = size;
  283.     if (color == null) {
  284.         this._color = MBBS_MV.Param.TextColor;
  285.     }
  286.     if (size == null) {
  287.         this._size = MBBS_MV.Param.FontSize;
  288.     }
  289. };

  290. Object.defineProperties(Notification_Message.prototype, {
  291.     msg:        { get: function() { return this._msg;       }, configurable: true},
  292.     color:      { get: function() { return this._color;     }, configurable: true},
  293.     size:       { get: function() { return this._size;      }, configurable: true},
  294. });

  295. //=============================================================================
  296. // Game_System
  297. //=============================================================================
  298. MBBS_MV.InstantMessage.Game_System_initialize = Game_System.prototype.initialize;
  299. Game_System.prototype.initialize = function() {
  300.     MBBS_MV.InstantMessage.Game_System_initialize.call(this);
  301.     this._notifications = [];
  302. };

  303. Object.defineProperty(Game_System.prototype, 'notifications', {
  304.     get: function() {
  305.         return this._notifications;
  306.     },
  307.     set: function(arr) {
  308.         this._notifications = [];
  309.     },
  310.     configurable: true
  311. });

  312. //=============================================================================
  313. // Scene_Map
  314. //=============================================================================
  315. MBBS_MV.InstantMessage.Scene_Map_update = Scene_Map.prototype.update;
  316. Scene_Map.prototype.update = function() {
  317.     MBBS_MV.InstantMessage.Scene_Map_update.call(this);
  318.     Notification.update();
  319. };

  320. MBBS_MV.InstantMessage.Scene_Map_start = Scene_Map.prototype.start;
  321. Scene_Map.prototype.start = function() {
  322.     MBBS_MV.InstantMessage.Scene_Map_start.call(this);
  323.     Notification.show();
  324. };

  325. MBBS_MV.InstantMessage.Scene_Map_stop = Scene_Map.prototype.stop;
  326. Scene_Map.prototype.stop = function() {
  327.     MBBS_MV.InstantMessage.Scene_Map_stop.call(this);
  328.     Notification.hide();
  329. };
  330. //=============================================================================
  331. // Scene_EFS_Battle
  332. //=============================================================================
  333. if (Imported.MBBS_MV) {

  334.     MBBS_MV.InstantMessage.Scene_EFS_Battle_update = Scene_EFS_Battle.prototype.update;
  335.     Scene_EFS_Battle.prototype.update = function() {
  336.         MBBS_MV.InstantMessage.Scene_EFS_Battle_update.call(this);
  337.         Notification.update();
  338.     };

  339.     MBBS_MV.InstantMessage.Scene_EFS_Battle_start = Scene_EFS_Battle.prototype.start;
  340.     Scene_EFS_Battle.prototype.start = function() {
  341.         MBBS_MV.InstantMessage.Scene_EFS_Battle_start.call(this);
  342.         Notification.show();
  343.     };

  344.     MBBS_MV.InstantMessage.Scene_EFS_Battle_stop = Scene_EFS_Battle.prototype.stop;
  345.     Scene_EFS_Battle.prototype.stop = function() {
  346.         MBBS_MV.InstantMessage.Scene_EFS_Battle_stop.call(this);
  347.         Notification.hide();
  348.     };
  349. }

  350. // ======================================================================
  351. // Game_Temp
  352. // ======================================================================
  353. MBBS_MV.InstantMessage.Game_Temp_initialize = Game_Temp.prototype.initialize;
  354. Game_Temp.prototype.initialize = function() {
  355.     MBBS_MV.InstantMessage.Game_Temp_initialize.call(this);
  356.     Notification.initMember();
  357. };

  358. //=============================================================================
  359. // End of File
  360. //=============================================================================

复制代码

点评

仔细一看才发现原来你没用插件指令的功能  发表于 2017-7-25 00:29
为什么没有@英顺的马甲 成功?谁帮我艾特一下- -  发表于 2016-4-7 10:02

评分

参与人数 3星屑 +85 赞 +2 收起 理由
众神与将军 + 1
玛尔斯 + 1
未命名 + 85 怎么可以不赞。

查看全部评分


梦石
0
星屑
502
在线时间
909 小时
注册时间
2009-10-12
回帖
1702
发表于 2016-4-7 10:40:54 | 显示全部楼层
本帖最后由 日月星辰 于 2016-4-6 20:41 编辑

@英顺的马甲

这个仿网游设置以前就觉得挺好 记得我曾经改过一个xp版本,还提供了玩家输入框,让玩家输入特定字符随时查询攻略啊,作弊码之类 考虑一起实现了吧XD
不过 lz 应该是 log 群战系统的各种信息用对吧 hh


@人要在名字后加个空格

点评

原来如此。确实,我写这个一开始为了群战log的,既然写了顺便发布吧。 玩家输入的话需要更高级的UI系统配合(一般玩家使用鼠标选择窗口)  发表于 2016-4-7 11:05
回复

使用道具 举报

梦石
0
星屑
1225
在线时间
564 小时
注册时间
2014-11-30
回帖
126
发表于 2016-4-7 21:42:51 | 显示全部楼层
日月星辰 发表于 2016-4-7 10:40
@英顺的马甲

这个仿网游设置以前就觉得挺好 记得我曾经改过一个xp版本,还提供了玩家输入框,让玩家输入 ...

楼主能不能做成你的群战系统那样呢,获得道具装备等等用推送显示,特别是战斗中的即时动作,伤害等等,也用推送,包括胜利后的奖励显示,完全放下MV的窗口显示就好了,想等你的插件

点评

获得道具装备等等自动发推送的功能还没加,马上就加。 其次群战系统MV正在制作中  发表于 2016-4-8 01:16
回复

使用道具 举报

梦石
0
星屑
50
在线时间
42 小时
注册时间
2015-10-21
回帖
8
发表于 2016-4-12 09:24:57 | 显示全部楼层
请问你签名的哪个游戏有没有网站群啥的 我特别感兴趣.本人也说设计工作者会手绘,前端代码也懂一点 可否进群?

点评

143529290  发表于 2016-4-12 09:38
回复

使用道具 举报

梦石
0
星屑
963
在线时间
319 小时
注册时间
2011-8-31
回帖
86

RM创作大赛01参赛者

发表于 2016-4-13 12:47:25 | 显示全部楼层
汇报一个BUG:把这个脚本写在公共事件里的话,第一次执行这个公共事件,会正常显示消息,但第二次执行这个事件就不会再显示消息了。

点评

在下简单测试了一下,没有问题啊。麻烦你具体说一下当时的情况吧,比如公共事件怎么设置的怎么触发的。  发表于 2016-4-13 13:03
回复

使用道具 举报

梦石
0
星屑
347
在线时间
160 小时
注册时间
2015-7-3
回帖
148
发表于 2017-5-12 11:28:10 | 显示全部楼层
话说能不能在消息里带图片?
想做个主角在做自己事情时NPC在旁边讲话不影响主角本身行动。。。

点评

这个版本没有这个功能,如果有需要可以加一个。这个消息弹框是完全不影响主角行动的,大可放心。  发表于 2017-5-14 05:06
回复

使用道具 举报

梦石
0
星屑
105
在线时间
121 小时
注册时间
2016-8-25
回帖
26
发表于 2017-5-25 20:56:46 | 显示全部楼层
大神你好,请问为什么本来可以显示的,一旦呼出菜单就不再显示了?

点评

谢谢你的反馈!鄙人居然一直没有发现这个BUG,等我明天有空就修复一下。  发表于 2017-5-26 12:55
回复

使用道具 举报

梦石
0
星屑
1821
在线时间
2528 小时
注册时间
2010-10-12
回帖
1336

开拓者

 楼主| 发表于 2017-5-27 04:27:02 | 显示全部楼层
yi8xuan 发表于 2017-5-25 04:56
大神你好,请问为什么本来可以显示的,一旦呼出菜单就不再显示了?

已经修复BUG,谢谢你的反馈,请查看主楼

回复

使用道具 举报

梦石
0
星屑
105
在线时间
121 小时
注册时间
2016-8-25
回帖
26
发表于 2017-5-27 04:32:30 | 显示全部楼层
刺夜之枪 发表于 2017-5-27 04:27
已经修复BUG,谢谢你的反馈,请查看主楼

辛苦楼主了,这个推送功能很简洁,相当喜欢

评分

参与人数 1星屑 +6 收起 理由
刺夜之枪 + 6 谢谢,对于推送功能如果还有什么需求的话可.

查看全部评分

回复

使用道具 举报

梦石
0
星屑
15309
在线时间
720 小时
注册时间
2011-7-16
回帖
1373

开拓者

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

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部