查看: 3117|回复: 2

[有事请教] mog的动态漂浮文字插件换地图之后文字就消失了

[复制链接]
梦石
0
星屑
2383
在线时间
392 小时
注册时间
2010-8-7
回帖
80
发表于 2019-9-15 13:42:29 | 显示全部楼层 |阅读模式

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

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

×
插件内容如下
不知道是遇到了bug还是本来就是这么设定的……
如果本来就是这样设定的,有没有什么类似的插件能实现类似的效果但是换地图的时候文字不会消失呢?
  1. //=============================================================================
  2. // MOG_AnimatedText.js
  3. //=============================================================================

  4. /*:
  5. * @plugindesc (v1.3)[v1.0]  画面 - 动态漂浮文字
  6. * @author Moghunter (Drill_up翻译)
  7. *
  8. * @param 偏移-漂浮文字 X
  9. * @desc 以执行插件指令的点为基准,x轴方向平移,单位像素。(可为负数)(该设置将偏移所有的)
  10. * @default 0
  11. *
  12. * @param 偏移-漂浮文字 Y
  13. * @desc 以执行插件指令的点为基准,y轴方向平移,单位像素。(可为负数)(该设置将偏移所有的)
  14. * @default 0
  15. *
  16. * @help  
  17. * =============================================================================
  18. * +++ MOG - Animated Text (1.3) +++
  19. * By Moghunter
  20. * [url]https://atelierrgss.wordpress.com/[/url]
  21. * =============================================================================
  22. * 在画面上显示一段动态的漂浮文字。(战斗中,地图中都可以使用。)
  23. * 漂浮文字是贴在玩家的镜头上面的,而不是地图上。
  24. *
  25. * -----------------------------------------------------------------------------
  26. * ----激活条件
  27. * 出现一段漂浮文字,需要使用下面的插件指令:(注意,冒号左右都有空格)
  28. *
  29. * 插件指令:infotext : A1 : A2 : A3 : A4 : A5 : A6 : A7 : A8 : A9 : A10
  30. *
  31. * 参数A1: id编号
  32. *          如果指令执行了重复的id编号,那么前一个效果的立刻消失。
  33. * 参数A2: 显示模式
  34. *          0 - 淡入淡出,1 - 缩放, 2 - 翻转
  35. *          3 - 上下出现,4 - 震动, 5 - 剧烈缩放
  36. *          6 - 波浪缩放,7 - 旋涡, 8 - 摇晃,    9 - 随机
  37. * 参数A3: 漂浮文字 X坐标
  38. *          x轴方向平移,单位像素。0表示贴在最左边。
  39. * 参数A4: 漂浮文字 Y坐标
  40. *          y轴方向平移,单位像素。0表示贴在最上面。
  41. * 参数A5: 字体大小
  42. * 参数A6: 持续时间
  43. *          文字出现后的持续时间。90表示90帧后文字消失。(1秒60帧)
  44. * 参数A7: 出现速度
  45. *          0表示文字全部直接显示,10表示文字每10帧出现一个。
  46. *          (值越高,出现速度越慢)
  47. * 参数A8: 字体颜色
  48. *          填入字体颜色对应的数字,0表示白色。
  49. * 参数A9: 排布方式
  50. *          0 - 横向排布,1 - 纵向排布
  51. * 参数A10:输出的文本
  52. *
  53. * 注意:横向排布中,因为中文字符占两个字符宽度,所以中文之间要加空格,
  54. * 不然会挤在一起。(纵向排布不需要加。)
  55. *
  56. * 示例:
  57. * 插件指令:infotext : 1 : 4 : 200 : 200 : 20 : 120 : 10 : 0 : 0 : 升 级 !
  58. * 插件指令:infotext : 9 : 6 : 350 : 150 : 30 : 160 : 10 : 0 : 0 : World
  59. *
  60. * -----------------------------------------------------------------------------
  61. * ----可选设定
  62. * 如果某个正在漂浮的文字需要立即消失,可以使用下面指令:
  63. *
  64. * 插件指令:clearinfotext : A1
  65. *
  66. * 参数A1是对应的漂浮文字的编号。
  67. */

  68. //=============================================================================
  69. // ** PLUGIN PARAMETERS
  70. //=============================================================================
  71.   var Imported = Imported || {};
  72.   Imported.MOG_AnimatedText = true;
  73.   var Moghunter = Moghunter || {};

  74.    Moghunter.parameters = PluginManager.parameters('MOG_AnimatedText');
  75.     Moghunter.infoText_LetterSpaceX = Number(Moghunter.parameters['偏移-漂浮文字 X'] || 0);
  76.         Moghunter.infoText_LetterSpaceY = Number(Moghunter.parameters['偏移-漂浮文字 Y'] || 0);
  77.        
  78. //=============================================================================
  79. // ** Game_Interpreter
  80. //=============================================================================       

  81. //==============================
  82. // * PluginCommand
  83. //==============================
  84. var _mog_infoText_pluginCommand = Game_Interpreter.prototype.pluginCommand
  85. Game_Interpreter.prototype.pluginCommand = function(command, args) {
  86.     _mog_infoText_pluginCommand.call(this,command, args);
  87.     if (command === "infotext")  {
  88.                 $gameSystem._infoTextDataRefresh = true;
  89.                 mode = Number(args[3]);
  90.                 var x = Number(args[5]);
  91.                 var y = Number(args[7]);
  92.                 var fsize = Number(args[9]);
  93.                 var dur = Number(args[11]);
  94.                 var speed = Number(args[13]);
  95.                 var color = Number(args[15]);
  96.                 var pos = Number(args[17]);
  97.                 var text = ""
  98.                 for (i = 19; i < args.length; i++){text += args[i] + " "};
  99.                 $gameSystem._infoTextData[Number(args[1])] = [true,mode,x,y,fsize,dur,text,null,speed,pos,color];
  100.         } else if (command === "clearinfotext")  {
  101.                 $gameSystem._infoTextDataRefresh = true;
  102.                 $gameSystem._infoTextData[Number(args[1])] = null;
  103.         };       
  104.         return true;
  105. };
  106.        
  107. //=============================================================================
  108. // ** Game System
  109. //=============================================================================

  110. //==============================
  111. // * Initialize
  112. //==============================
  113. var _mog_infoText_Gsys_initialize = Game_System.prototype.initialize;
  114. Game_System.prototype.initialize = function() {
  115.     _mog_infoText_Gsys_initialize.call(this);
  116.         this._infoTextData = [];
  117.         this._infoTextDataRefresh = false;
  118.         this._infoTextMapId = 0;
  119. };

  120. //=============================================================================
  121. // ** Spriteset Base
  122. //=============================================================================

  123. //==============================
  124. // * Initialize
  125. //==============================
  126. var _mog_infoText_sprBase_initialize = Spriteset_Base.prototype.initialize;
  127. Spriteset_Base.prototype.initialize = function() {
  128.     _mog_infoText_sprBase_initialize.call(this);
  129.     this.createInfoTextField();
  130. };

  131. //==============================
  132. // * Update
  133. //==============================
  134. var _mog_infoText_sprBase_update = Spriteset_Base.prototype.update;
  135. Spriteset_Base.prototype.update = function() {
  136.     _mog_infoText_sprBase_update.call(this);
  137.         if ($gameSystem._infoTextDataRefresh) {this.refreshInfoText()};
  138. };

  139. //==============================
  140. // * Refresh Info Text
  141. //==============================
  142. Spriteset_Base.prototype.refreshInfoText = function() {
  143.     $gameSystem._infoTextDataRefresh = false;
  144.         for (i = 0; i < $gameSystem._infoTextData.length; i++){
  145.                  if ($gameSystem._infoTextData[i] && !this._infoText[i]) {this.createInfoText(i)};
  146.         };
  147.         for (i = 0; i < this._infoText.length; i++){
  148.        if (!$gameSystem._infoTextData[i] && this._infoText[i]) {this.disposeInfoText(i)};
  149.         };
  150. };

  151. //==============================
  152. // * dispose Info Text
  153. //==============================
  154. Spriteset_Base.prototype.disposeInfoText = function(i) {
  155.      this._infoText[i].disposeLetters();
  156.          this._infoTextField.removeChild(this._infoText[i]);
  157.          this._infoText[i] = null;
  158.          $gameSystem._infoTextData[i] = null;
  159. };

  160. //==============================
  161. // * create Info Text Field
  162. //==============================
  163. Spriteset_Base.prototype.createInfoTextField = function() {
  164.      this._infoTextField = new Sprite();
  165.          this.addChild(this._infoTextField);
  166.          this._infoText = [];
  167.          if (this.needReloadInfoText()) {this.refreshInfoText()
  168.          } else {
  169.                 $gameSystem._infoTextData = [];
  170.                 $gameSystem._infoTextDataRefresh = false;                 
  171.          };
  172.          $gameSystem._infoTextMapId = $gameMap._mapId;
  173. };

  174. //==============================
  175. // * need Reload Info Text
  176. //==============================
  177. Spriteset_Base.prototype.needReloadInfoText = function() {
  178.     if ($gameSystem._infoTextMapId != $gameMap._mapId) {return false};
  179.         if (SceneManager._scene.constructor.name === "Scene_Battle") {return false};
  180.         return true;
  181. };

  182. //==============================
  183. // * create Info Text
  184. //==============================
  185. Spriteset_Base.prototype.createInfoText = function(i) {
  186.         this._infoText[i] = new InfoText(i);
  187.         this._infoTextField.addChild(this._infoText[i]);
  188. };

  189. //==============================
  190. // * Record Info Text Data
  191. //==============================
  192. Spriteset_Base.prototype.recordInfoTextData = function() {
  193.     if (this._infoText) {
  194.                 for (e = 0; e < this._infoText.length; e++){
  195.                         if (this._infoText[e] && this._infoText[e]._letters) {this._infoText[e].recordInfoData()};
  196.                 };
  197.         };
  198. };

  199. //=============================================================================
  200. // ** Scene Map
  201. //=============================================================================

  202. //==============================
  203. // * Terminate
  204. //==============================
  205. var _mog_infoText_scMap_terminate = Scene_Map.prototype.terminate;
  206. Scene_Map.prototype.terminate = function() {
  207.     _mog_infoText_scMap_terminate.call(this);
  208.         if (this._spriteset) {this._spriteset.recordInfoTextData()};
  209. };

  210. //=============================================================================
  211. // * Info Text
  212. //=============================================================================
  213. function InfoText() {
  214.     this.initialize.apply(this, arguments);
  215. };

  216. InfoText.prototype = Object.create(Sprite.prototype);
  217. InfoText.prototype.constructor = InfoText;

  218. //==============================
  219. // * Initialize
  220. //==============================
  221. InfoText.prototype.initialize = function(id) {
  222.     Sprite.prototype.initialize.call(this);         
  223.         this._id = id;
  224.         this._windowskin = ImageManager.loadSystem('Window');
  225. };

  226. //==============================
  227. // * record Info Data
  228. //==============================
  229. InfoText.prototype.recordInfoData = function() {
  230.           if (!$gameSystem._infoTextData[this._id]) {return};
  231.       $gameSystem._infoTextData[this._id][7] = [];
  232.           for (i = 0; i < this._letters.length; i++){
  233.                   $gameSystem._infoTextData[this._id][7][i] = {};
  234.               $gameSystem._infoTextData[this._id][7][i].x = this._letters[i].x;
  235.                   $gameSystem._infoTextData[this._id][7][i].y = this._letters[i].y;
  236.                   $gameSystem._infoTextData[this._id][7][i].opacity = this._letters[i].opacity;
  237.                   $gameSystem._infoTextData[this._id][7][i].scaleX = this._letters[i].scale.x;
  238.                   $gameSystem._infoTextData[this._id][7][i].scaleY = this._letters[i].scale.y;
  239.                   $gameSystem._infoTextData[this._id][7][i].rotation = this._letters[i].rotation;
  240.           $gameSystem._infoTextData[this._id][7][i].org = this._letters[i].org;
  241.                   $gameSystem._infoTextData[this._id][7][i].index = this._letters[i].index;
  242.                   $gameSystem._infoTextData[this._id][7][i].d = this._letters[i].d;
  243.                   $gameSystem._infoTextData[this._id][7][i].l = this._letters[i].l;
  244.                   $gameSystem._infoTextData[this._id][7][i].w = this._letters[i].w;
  245.                   $gameSystem._infoTextData[this._id][7][i].w2 = this._letters[i].w2;
  246.                   $gameSystem._infoTextData[this._id][7][i].phase = this._letters[i].phase;
  247.                   $gameSystem._infoTextData[this._id][7][i].itemMax = this._letters[i].itemMax;
  248.                   $gameSystem._infoTextData[this._id][7][i].ani = this._letters[i].ani;
  249.                   $gameSystem._infoTextData[this._id][7][i].pos = this._letters[i].pos;
  250.                   $gameSystem._infoTextData[this._id][7][i].color = this._letters[i].color;
  251.           };
  252. };

  253. //==============================
  254. // * Load Info Data
  255. //==============================
  256. InfoText.prototype.loadInfoData = function() {
  257.           for (i = 0; i < $gameSystem._infoTextData[this._id][7].length; i++){
  258.               this._letters[i].x = $gameSystem._infoTextData[this._id][7][i].x;
  259.                   this._letters[i].y = $gameSystem._infoTextData[this._id][7][i].y;
  260.                   this._letters[i].opacity = $gameSystem._infoTextData[this._id][7][i].opacity;
  261.                   this._letters[i].scale.x = $gameSystem._infoTextData[this._id][7][i].scaleX;
  262.                   this._letters[i].scale.y = $gameSystem._infoTextData[this._id][7][i].scaleY;
  263.                   this._letters[i].rotation = $gameSystem._infoTextData[this._id][7][i].rotation;
  264.           this._letters[i].org = $gameSystem._infoTextData[this._id][7][i].org;
  265.                   this._letters[i].index = $gameSystem._infoTextData[this._id][7][i].index;
  266.                   this._letters[i].d = $gameSystem._infoTextData[this._id][7][i].d;
  267.                   this._letters[i].l = $gameSystem._infoTextData[this._id][7][i].l;
  268.                   this._letters[i].w = $gameSystem._infoTextData[this._id][7][i].w;
  269.                   this._letters[i].w2 = $gameSystem._infoTextData[this._id][7][i].w2;
  270.                   this._letters[i].phase = $gameSystem._infoTextData[this._id][7][i].phase;
  271.                   this._letters[i].itemMax = $gameSystem._infoTextData[this._id][7][i].itemMax;
  272.                   this._letters[i].ani = $gameSystem._infoTextData[this._id][7][i].ani;
  273.                   this._letters[i].pos = $gameSystem._infoTextData[this._id][7][i].pos;
  274.                   this._letters[i].color = $gameSystem._infoTextData[this._id][7][i].color;
  275.           };
  276.           $gameSystem._infoTextData[this._id][7] = null;
  277. };

  278. //==============================
  279. // * data
  280. //==============================
  281. InfoText.prototype.data = function() {
  282.     return $gameSystem._infoTextData[this._id]
  283. };

  284. //==============================
  285. // * Mode
  286. //==============================
  287. InfoText.prototype.mode = function() {
  288.     return this.data()[1];
  289. };

  290. //==============================
  291. // * Pos X
  292. //==============================
  293. InfoText.prototype.posX = function() {
  294.     return this.data()[2];
  295. };

  296. //==============================
  297. // * Pos Y
  298. //==============================
  299. InfoText.prototype.posY = function() {
  300.     return this.data()[3];
  301. };

  302. //==============================
  303. // * fontsize
  304. //==============================
  305. InfoText.prototype.fontsz = function() {
  306.     return Math.abs(this.data()[4]);
  307. };

  308. //==============================
  309. // * Duration
  310. //==============================
  311. InfoText.prototype.duration = function() {
  312.     return this.data()[5];
  313. };

  314. //==============================
  315. // * Text
  316. //==============================
  317. InfoText.prototype.text = function() {
  318.     return this.data()[6];
  319. };

  320. //==============================
  321. // * Letter Space
  322. //==============================
  323. InfoText.prototype.letterSpace = function() {
  324.         if (this.pos() === 0) {
  325.             return Moghunter.infoText_LetterSpaceX + Math.floor(this.fontsz() / 2);
  326.         } else {
  327.             return Moghunter.infoText_LetterSpaceY + Math.floor(this.fontsz());
  328.         };
  329. };

  330. //==============================
  331. // * Lag Time
  332. //==============================
  333. InfoText.prototype.lagTime = function() {
  334.         return this.data()[8];
  335. };

  336. //==============================
  337. // * Pos
  338. //==============================
  339. InfoText.prototype.pos = function() {
  340.         return this.data()[9];
  341. };

  342. //==============================
  343. // * Font Color
  344. //==============================
  345. InfoText.prototype.fontColor = function() {
  346.         return this.data()[10];
  347. };

  348. //==============================
  349. // * need Refresh Text
  350. //==============================
  351. InfoText.prototype.needRefreshText = function() {
  352.         if (!$gameSystem._infoTextData[this._id]) {return false}
  353.         if ($gameSystem._infoTextData[this._id][0]) {return true};
  354.         if ($gameSystem._infoTextData[this._id][7]) {return true};
  355.         return false;
  356. };

  357. //==============================
  358. // * need Dispose
  359. //==============================
  360. InfoText.prototype.needDispose = function(sprite) {
  361.         if (sprite.phase != 2) {return false};
  362.         if (sprite.w2 > 0) {return false};
  363.         if (sprite.opacity > 0) {return false};
  364.         return true;
  365. };

  366. //==============================
  367. // * disposse Letters
  368. //==============================
  369. InfoText.prototype.disposeLetters = function() {
  370.         if (!this._letters) {return;}
  371.         for (i = 0; i < this._letters.length; i++){
  372.                 this.removeChild(this._letters[i])
  373.         };       
  374.         this._letters = null;
  375. };

  376. //==============================
  377. // * Refresh Text
  378. //==============================
  379. InfoText.prototype.refreshText = function() {
  380.         $gameSystem._infoTextData[this._id][0] = false;
  381.         if (this._letters) {this.disposeLetters()};
  382.         var lt = this.text().toString().split("");
  383.         if ($gameSystem._infoTextData[this._id][1] < 0 || lt.length === 0) {return};
  384.         this._letters = [];
  385.         var dir = this.pos() === 0 ? 0 : 1;
  386.         this._tf = 0;
  387.         for (i = 0; i < lt.length; i++){
  388.                  this._letters[i] = new Sprite(new Bitmap(this.fontsz() + 20,this.fontsz() + 20));
  389.          this.setBaseParameters(i,dir,lt[i],lt.length);
  390.                  this._letters[i].bitmap.drawText(lt[i],0,0, this._letters[i].bitmap.width, this._letters[i].bitmap.height,"center");
  391.                  this.setEffects(i);
  392.                  this.addChild(this._letters[i]);
  393.                  dir = dir === 0 ? 1 : 0;
  394.         };
  395.         for (i = 0; i < this._letters.length; i++){
  396.                  this._letters[i].itemMax = this._letters.length - this._tf;
  397.         };
  398.         this._tf = 0;
  399.         if ($gameSystem._infoTextData[this._id][7]) {this.loadInfoData()};
  400. };

  401. //==============================
  402. // * Text Color
  403. //==============================
  404. InfoText.prototype.textColor = function(n) {
  405.     var px = 96 + (n % 8) * 12 + 6;
  406.     var py = 144 + Math.floor(n / 8) * 12 + 6;
  407.     return this._windowskin.getPixel(px, py);
  408. };

  409. //==============================
  410. // * set Base Parameters
  411. //==============================
  412. InfoText.prototype.setBaseParameters = function(i,dir,letter,itemMax) {
  413.                  this._letters[i].bitmap.fontSize = this.fontsz();
  414.                  this._letters[i].bitmap.textColor = this.textColor(this.fontColor());
  415.                  this._letters[i].anchor.x = 0.5;
  416.                  this._letters[i].anchor.y = 0.5;
  417.                  this._letters[i].opacity = 0;
  418.                  if (this.pos() === 0) {
  419.                      this._letters[i].x = this.posX() + (this.letterSpace() * i);
  420.                          this._letters[i].y = this.posY();
  421.                  } else {
  422.                      this._letters[i].x = this.posX();
  423.                          this._letters[i].y = this.posY() + (this.letterSpace() * i);
  424.                  };
  425.          this._letters[i].org = [this._letters[i].x,this._letters[i].y];                 
  426.                  this._letters[i].index = i;
  427.          this._letters[i].scaleX = 1.00;
  428.                  this._letters[i].scaleY = 1.00;                 
  429.                  this._letters[i].d = dir;
  430.              this._letters[i].l = letter;
  431.                  this._letters[i].w = 0;
  432.                  this._letters[i].w2 = 0;
  433.                  this._letters[i].phase = 0;
  434.                  this._letters[i].ani = [0,0,0];
  435.                  this._letters[i].itemMax = itemMax;
  436.                  this._letters[i].pos = this.pos();
  437.                  this._letters[i].color = 0;
  438. };

  439. //==============================
  440. // * set Effects
  441. //==============================
  442. InfoText.prototype.setEffects = function(i) {
  443.          if (this.mode() === 1) {
  444.                  this.setZoomEffect(i);
  445.          } else if (this.mode() === 2) {
  446.                  this.setZoom2Effect(i);
  447.          } else if (this.mode() === 3) {
  448.                  this.setWipeEffect(i);
  449.          } else if (this.mode() === 4) {
  450.                  this.setShakeEffect(i);
  451.          } else if (this.mode() === 5) {
  452.                  this.setZoom3Effect(i);
  453.          } else if (this.mode() === 6) {
  454.                  this.setWaveEffect(i);
  455.          } else if (this.mode() === 7) {
  456.                  this.setRotationEffect(i);       
  457.          } else if (this.mode() === 8) {
  458.                  this.setSwingEffect(i);
  459.          } else if (this.mode() === 9) {
  460.                  this.setRandomEffect(i);                                   
  461.          } else {
  462.                  this.setFadeEffect(i);
  463.          };
  464.          if (this._letters[i].l === " ") {this._tf += 1};
  465.          this._letters[i].w = Math.floor(this.lagTime() * (i - this._tf));
  466. };

  467. //==============================
  468. // * set Zoom Effects
  469. //==============================
  470. InfoText.prototype.setZoomEffect = function(i) {
  471.      this._letters[i].scale.x = 2.00;
  472.          this._letters[i].scale.y = 2.00;
  473. };

  474. //==============================
  475. // * set Zoom 2 Effects
  476. //==============================
  477. InfoText.prototype.setZoom2Effect = function(i) {
  478.      this._letters[i].scale.x = -1.00;
  479.          this._letters[i].scale.y = 2.00;
  480. };

  481. //==============================
  482. // * set Zoom 3 Effects
  483. //==============================
  484. InfoText.prototype.setZoom3Effect = function(i) {
  485.      this._letters[i].scale.x = 4.00;
  486.          this._letters[i].scale.y = 4.00;
  487. };

  488. //==============================
  489. // * set Wave Effect
  490. //==============================
  491. InfoText.prototype.setWaveEffect = function(i) {
  492. };

  493. //==============================
  494. // * set Rotation Effect
  495. //==============================
  496. InfoText.prototype.setRotationEffect = function(i) {
  497.      this._letters[i].scale.x = 0.10;
  498.          this._letters[i].scale.y = 0.10;       
  499. };

  500. //==============================
  501. // * set Swing Effect
  502. //==============================
  503. InfoText.prototype.setSwingEffect = function(i) {
  504. };

  505. //==============================
  506. // * set Zoom Wipe Effects
  507. //==============================
  508. InfoText.prototype.setWipeEffect = function(i) {
  509.      var np = this._letters[i].d === 0 ? this.fontsz() + 20 : -(this.fontsz() + 20);
  510.          if (this.pos() === 0) {
  511.              this._letters[i].y += np;
  512.          } else {
  513.                  this._letters[i].x += np;
  514.          };
  515. };

  516. //==============================
  517. // * set Shake Effects
  518. //==============================
  519. InfoText.prototype.setShakeEffect = function(i) {
  520. };

  521. //==============================
  522. // * set Effects
  523. //==============================
  524. InfoText.prototype.setFadeEffect = function(i) {         
  525. };

  526. //==============================
  527. // * set Random
  528. //==============================
  529. InfoText.prototype.setRandomEffect = function(i) {         
  530.      var rz = Math.randomInt(70) * 0.010;
  531.      this._letters[i].scale.x = 0.70 + rz;
  532.      this._letters[i].scale.y = this._letters[i].scale.x;
  533.          var rr = Math.randomInt(40) * 0.010;
  534.          this._letters[i].rotation = this._letters[i].d === 0 ? rr : -rr;
  535. };

  536. //==============================
  537. // * need Phase 1
  538. //==============================
  539. InfoText.prototype.needPhase1 = function(sprite) {
  540.     if (sprite.opacity < 255) {return false};
  541.         if (sprite.scale.x != 1.00) {return false};
  542.         if (sprite.scale.y != 1.00) {return false};
  543.         if (sprite.x != sprite.org[0]) {return false};
  544.         if (sprite.y != sprite.org[1]) {return false};
  545.         return true;
  546. };

  547. //==============================
  548. // * clear Parameter
  549. //==============================
  550. InfoText.prototype.clearParameter = function(sprite) {
  551.     sprite.opacity = 255;
  552.         sprite.scale.x = 1.00;
  553.         sprite.scale.y = 1.00;
  554.         sprite.x = sprite.org[0];
  555.         sprite.y = sprite.org[1];
  556. };

  557. //==============================
  558. // * set Phase 1
  559. //==============================
  560. InfoText.prototype.setPhase1 = function(sprite) {
  561.         sprite.w2 = (sprite.itemMax * this.lagTime()) + this.duration();
  562.         sprite.phase = 1;
  563. };

  564. //==============================
  565. // * set Phase 2
  566. //==============================
  567. InfoText.prototype.setPhase2 = function(sprite) {
  568.     sprite.w2 = (sprite.itemMax * this.lagTime());
  569.         sprite.phase = 2;
  570. };

  571. //==============================
  572. // * update Zoom 1 Start
  573. //==============================
  574. InfoText.prototype.updateZoomStart = function(sprite) {
  575.            sprite.opacity += 4;
  576.      if (sprite.scale.x > 1.00) {sprite.scale.x -= 0.04;
  577.              if (sprite.scale.x <= 1.00) {sprite.scale.x = 1.00};
  578.          };
  579.          sprite.scale.y = sprite.scale.x;
  580.          if (this.needPhase1(sprite)) {this.setPhase1(sprite)};
  581. };

  582. //==============================
  583. // * update Zoom 2 Start
  584. //==============================
  585. InfoText.prototype.updateZoom2Start = function(sprite) {
  586.            sprite.opacity += 4;
  587.      if (sprite.scale.x < 1.00) {sprite.scale.x += 0.02;
  588.              if (sprite.scale.x >= 1.00) {sprite.scale.x = 1.00};
  589.          };         
  590.      if (sprite.scale.y > 1.00) {sprite.scale.y -= 0.02;
  591.              if (sprite.scale.y <= 1.00) {sprite.scale.y = 1.00};
  592.          };
  593.          if (this.needPhase1(sprite)) {this.setPhase1(sprite)};
  594. };

  595. //==============================
  596. // * update Zoom 3 Start
  597. //==============================
  598. InfoText.prototype.updateZoom3Start = function(sprite) {
  599.            sprite.opacity += 20;
  600.      if (sprite.scale.x > 1.00) {sprite.scale.x -= 0.2;
  601.              if (sprite.scale.x <= 1.00) {
  602.                          sprite.scale.x = 1.00;
  603.                          sprite.ani[2] = 1;
  604.                  };
  605.          };
  606.          sprite.scale.y = sprite.scale.x;
  607.          if (sprite.ani[2] === 1) {
  608.                  sprite.ani[1]++;
  609.                  this.updateShakeEffect(sprite);                 
  610.                  if (sprite.ani[1] > 12) {
  611.                      this.clearParameter(sprite);
  612.                          sprite.ani[2] = 2;
  613.                          this.setPhase1(sprite)
  614.                  };                 
  615.          };
  616. };

  617. //==============================
  618. // * update Wave Start
  619. //==============================
  620. InfoText.prototype.updateWaveStart = function(sprite) {
  621.            sprite.opacity += 4;
  622.          this.updateWaveEffect(sprite);
  623.          if (this.needPhase1(sprite)) {this.setPhase1(sprite)};
  624. };

  625. //==============================
  626. // * update Rotation Start
  627. //==============================
  628. InfoText.prototype.updateRotationStart = function(sprite) {
  629.            sprite.opacity += 20;
  630.          this.updateRotationEffect(sprite);
  631.          if (sprite.scale.x < 1.00) {
  632.                  sprite.scale.x += 0.02;
  633.                  if (sprite.scale.x > 1.00) {sprite.scale.x = 1.00};
  634.          };
  635.          sprite.scale.y = sprite.scale.x;
  636.          if (sprite.rotation === 0 && this.needPhase1(sprite)) {this.setPhase1(sprite)};
  637. };

  638. //==============================
  639. // * update Swing Start
  640. //==============================
  641. InfoText.prototype.updateSwingStart = function(sprite) {
  642.            sprite.opacity += 4;
  643.          this.updateSwingEffect(sprite);
  644.          if (this.needPhase1(sprite)) {this.setPhase1(sprite)};
  645. };

  646. //==============================
  647. // * update Fade Start
  648. //==============================
  649. InfoText.prototype.updateWipeStart = function(sprite) {
  650.            sprite.opacity += 4;
  651.          if (this.pos() === 0) {
  652.                  if (sprite.y > sprite.org[1]) {
  653.                          sprite.y -= 1.5;
  654.                          if (sprite.y < sprite.org[1]) {sprite.y = sprite.org[1]};
  655.                  } else if (sprite.y < sprite.org[1]) {
  656.                          sprite.y += 1.5;
  657.                          if (sprite.y > sprite.org[1]) {sprite.y = sprite.org[1]};                 
  658.                  };
  659.          } else {
  660.                  if (sprite.x > sprite.org[0]) {
  661.                          sprite.x -= 1.5;
  662.                          if (sprite.x < sprite.org[0]) {sprite.x = sprite.org[0]};
  663.                  } else if (sprite.x < sprite.org[0]) {
  664.                          sprite.x += 1.5;
  665.                          if (sprite.x > sprite.org[0]) {sprite.x = sprite.org[0]};                 
  666.                  };                 
  667.          };
  668.          if (this.needPhase1(sprite)) {this.setPhase1(sprite)};
  669. };

  670. //==============================
  671. // * update Shake Start
  672. //==============================
  673. InfoText.prototype.updateShakeStart = function(sprite) {
  674.            sprite.opacity += 255;
  675.          if (this.needPhase1(sprite)) {this.setPhase1(sprite)};
  676. };

  677. //==============================
  678. // * update Fade Start
  679. //==============================
  680. InfoText.prototype.updateFadeStart = function(sprite) {
  681.            sprite.opacity += 4;
  682.          if (this.needPhase1(sprite)) {this.setPhase1(sprite)};
  683. };

  684. //==============================
  685. // * update Random
  686. //==============================
  687. InfoText.prototype.updateRandomStart = function(sprite) {
  688.            sprite.opacity += 4;
  689.          if (sprite.opacity >= 255) {this.setPhase1(sprite)};
  690. };

  691. //==============================
  692. // * update Shake effect
  693. //==============================
  694. InfoText.prototype.updateShakeEffect = function(sprite) {
  695.            sprite.ani[0]++;
  696.          if (sprite.ani[0] < 3) {return};
  697.          sprite.ani[0] = 0;
  698.          sprite.x = Math.randomInt(6) - 3 + sprite.org[0];  
  699.          sprite.y = Math.randomInt(6) - 3 + sprite.org[1];
  700. };

  701. //==============================
  702. // * update Wave effect
  703. //==============================
  704. InfoText.prototype.updateWaveEffect = function(sprite) {
  705.           sprite.ani[0]++;
  706.         if (sprite.ani[0] < 30) {
  707.                  sprite.scale.x += 0.015;
  708.         } else if (sprite.ani[0] < 60) {
  709.              sprite.scale.x -= 0.015;
  710.         } else {
  711.              sprite.scale.x = 1.00;
  712.              sprite.ani[0] = 0
  713.         };
  714.         sprite.scale.y = sprite.scale.x;
  715. };


  716. //==============================
  717. // * update Swing effect
  718. //==============================
  719. InfoText.prototype.updateSwingEffect = function(sprite) {
  720.     if (sprite.ani[1] === 0) {
  721.                 sprite.rotation += 0.02;
  722.                 if (sprite.rotation > 0.40) {
  723.                     sprite.rotation = 0.40;
  724.                 sprite.ani[1] = 1;
  725.                 };
  726.         } else {
  727.                 sprite.rotation -= 0.02;
  728.                 if (sprite.rotation < -0.40) {
  729.                     sprite.rotation = -0.40;
  730.                 sprite.ani[1] = 0;
  731.                 };       
  732.     };
  733. };

  734. //==============================
  735. // * update Rotation effect
  736. //==============================
  737. InfoText.prototype.updateRotationEffect = function(sprite) {
  738.            sprite.ani[0]++;
  739.          if (sprite.ani[0] < 63) {
  740.                  sprite.rotation += 0.1
  741.          } else if (sprite.ani[0] < 120) {
  742.                  sprite.rotation = 0
  743.          } else {
  744.          sprite.rotation = 0
  745.              sprite.ani[0] = 0
  746.         };
  747. };

  748. //==============================
  749. // * update Zoom End
  750. //==============================
  751. InfoText.prototype.updateZoomEnd = function(sprite) {
  752.     sprite.scale.x += 0.01;
  753.         sprite.scale.y = sprite.scale.x;
  754.         sprite.opacity -= 5;
  755. };

  756. //==============================
  757. // * update Zoom 2 End
  758. //==============================
  759. InfoText.prototype.updateZoom2End = function(sprite) {
  760.         sprite.scale.x -= 0.05;
  761.     sprite.scale.y += 0.01;
  762.         sprite.opacity -= 5;
  763. };

  764. //==============================
  765. // * update Zoom 3 End
  766. //==============================
  767. InfoText.prototype.updateZoom3End = function(sprite) {
  768.     sprite.scale.x += 0.1;
  769.         sprite.scale.y = sprite.scale.x;
  770.         sprite.opacity -= 25;
  771. };

  772. //==============================
  773. // * update Wipe End
  774. //==============================
  775. InfoText.prototype.updateWipeEnd = function(sprite) {
  776.         var np = sprite.d === 0 ? -1.0 : +1.0;
  777.         if (this.pos() === 0) {
  778.         sprite.y += np;
  779.         } else {
  780.                 sprite.x += np;
  781.         };
  782.         sprite.opacity -= 5;
  783. };

  784. //==============================
  785. // * update Swing End
  786. //==============================
  787. InfoText.prototype.updateSwingEnd = function(sprite) {
  788.     this.updateSwingEffect(sprite);
  789.         sprite.opacity -= 5;
  790. };

  791. //==============================
  792. // * update Shake End
  793. //==============================
  794. InfoText.prototype.updateShakeEnd = function(sprite) {
  795.         this.updateShakeEffect(sprite);
  796.         sprite.opacity -= 5;
  797. };

  798. //==============================
  799. // * update Wave End
  800. //==============================
  801. InfoText.prototype.updateWaveEnd = function(sprite) {
  802.         this.updateWaveEffect(sprite);
  803.         sprite.opacity -= 5;
  804. };

  805. //==============================
  806. // * update Rotation End
  807. //==============================
  808. InfoText.prototype.updateRotationEnd = function(sprite) {
  809.         this.updateRotationEffect(sprite);
  810.         sprite.opacity -= 5;
  811.         if (sprite.scale.x > 0.10) {sprite.scale.x -= 0.03};
  812.         sprite.scale.y = sprite.scale.x;
  813. };

  814. //==============================
  815. // * update Fade End
  816. //==============================
  817. InfoText.prototype.updateFadeEnd = function(sprite) {
  818.         this.updateSwingEffect(sprite);
  819.         sprite.opacity -= 5;
  820. };

  821. //==============================
  822. // * update Random End
  823. //==============================
  824. InfoText.prototype.updateRandomEnd = function(sprite) {
  825.         sprite.opacity -= 5;
  826. };

  827. //==============================
  828. // * update Start
  829. //==============================
  830. InfoText.prototype.updateStart = function(sprite) {
  831.         if (this.mode() === 1) {
  832.         this.updateZoomStart(sprite);
  833.         } else if (this.mode() === 2) {
  834.         this.updateZoom2Start(sprite);       
  835.         } else if (this.mode() === 3) {
  836.         this.updateWipeStart(sprite);       
  837.         } else if (this.mode() === 4) {
  838.         this.updateShakeStart(sprite);
  839.         } else if (this.mode() === 5) {
  840.         this.updateZoom3Start(sprite);
  841.         } else if (this.mode() === 6) {
  842.         this.updateWaveStart(sprite);       
  843.         } else if (this.mode() === 7) {
  844.         this.updateRotationStart(sprite);
  845.         } else if (this.mode() === 8) {
  846.         this.updateSwingStart(sprite);
  847.         } else if (this.mode() === 9) {
  848.         this.updateRandomStart(sprite);                               
  849.         } else {
  850.                 this.updateFadeStart(sprite);
  851.         };
  852. };

  853. //==============================
  854. // * update Wait
  855. //==============================
  856. InfoText.prototype.updateWait = function(sprite) {
  857.         if (this.mode() === 4) {
  858.             this.updateShakeEffect(sprite);
  859.         } else if (this.mode() === 6) {
  860.                 this.updateWaveEffect(sprite);
  861.         } else if (this.mode() === 7) {
  862.                 sprite.ani[0] = 0;
  863.         } else if (this.mode() === 8) {
  864.                 this.updateSwingEffect(sprite);
  865.         };
  866.     if (sprite.w2 > 0) {sprite.w2--;       
  867.             if (sprite.w2 === 0) {this.setPhase2(sprite)};
  868.         };
  869. };

  870. //==============================
  871. // * update Fade
  872. //==============================
  873. InfoText.prototype.updateEnd = function(sprite) {
  874.         if (this.mode() === 1) {
  875.         this.updateZoomEnd(sprite);
  876.         } else if (this.mode() === 2) {
  877.         this.updateZoom2End(sprite);
  878.         } else if (this.mode() === 3) {
  879.         this.updateWipeEnd(sprite);       
  880.         } else if (this.mode() === 4) {
  881.         this.updateShakeEnd(sprite);
  882.         } else if (this.mode() === 5) {
  883.         this.updateZoom3End(sprite);
  884.         } else if (this.mode() === 6) {
  885.         this.updateWaveEnd(sprite);       
  886.         } else if (this.mode() === 7) {
  887.         this.updateRotationEnd(sprite);       
  888.         } else if (this.mode() === 8) {
  889.         this.updateSwingEnd(sprite);
  890.         } else if (this.mode() === 9) {
  891.         this.updateRandomEnd(sprite);                       
  892.         } else {
  893.             this.updateFadeEnd(sprite);       
  894.         };
  895. };

  896. //==============================
  897. // * update Sprites
  898. //==============================
  899. InfoText.prototype.updateSprites = function() {
  900.         var dispose = false;
  901.     for (i = 0; i < this._letters.length; i++){
  902.            if (this._letters[i].w > 0) {this._letters[i].w--;
  903.                    } else {
  904.                    if (this._letters[i].phase === 0) {
  905.                            this.updateStart(this._letters[i]);
  906.                    } else if (this._letters[i].phase === 1) {
  907.                            this.updateWait(this._letters[i]);
  908.                    } else {
  909.                            this.updateEnd(this._letters[i]);
  910.                            if (this.needDispose(this._letters[i])) {
  911.                                    dispose = true;
  912.                            } else {
  913.                                    dispose = false;
  914.                            };
  915.                    };
  916.            };
  917.         };             
  918.         if (dispose) {this.disposeLetters()};
  919. };

  920. //==============================
  921. // * update
  922. //==============================
  923. InfoText.prototype.update = function() {
  924.     Sprite.prototype.update.call(this);       
  925.         if (!this.data()) {
  926.         if (this._letters) {this.disposeLetters()};
  927.                 return;
  928.         };
  929.         if (this.needRefreshText()) {this.refreshText()};
  930.         if (this._letters) {this.updateSprites()};
  931. };
复制代码
梦石
0
星屑
3930
在线时间
1198 小时
注册时间
2016-8-9
回帖
2355

开拓者

发表于 2019-9-15 19:26:43 | 显示全部楼层
没做实验,感觉应该是切地图就会消失的,如果楼主需要的是一个动态漂浮文字长期浮动于画面的话,建议使用mog另一个序列帧动态图片的插件,做一套循环动画的字挂在画面即可,mog官方demo有演示
酸酸甜甜就④哇噢
回复 1 0

使用道具 举报

梦石
0
星屑
2383
在线时间
392 小时
注册时间
2010-8-7
回帖
80
 楼主| 发表于 2019-9-15 21:26:34 | 显示全部楼层
白嫩白嫩的 发表于 2019-9-15 19:26
没做实验,感觉应该是切地图就会消失的,如果楼主需要的是一个动态漂浮文字长期浮动于画面的话,建议使用mo ...

我去试试看。
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部