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

Project1

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

[有事请教] 求问这两个JS插件脚本怎么调用

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1103
在线时间
103 小时
注册时间
2017-7-9
帖子
233

开拓者

跳转到指定楼层
1
发表于 2019-2-18 19:34:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x

  1. /*--------------------------------------------------------------------------
  2.   
  3.   キャラチップの見た目をオリジナルエフェクトに変更します。
  4.   エフェクトは巨大な魔物のようなものにするのが一般的です。
  5.   通常のキャラチップのように-a、-b、-cを用意します。
  6.   -aは敵、-bは同盟、-cは待機です。
  7.   
  8.   使用方法:
  9.   クラスの条件表示のキーワードにanimationを設定します。
  10.   クラスのカスタムパラメータに
  11.   {animationId: 0}のように設定します。
  12.   
  13.   作成者:
  14.   サファイアソフト
  15.   http://srpgstudio.com/
  16.   
  17.   更新履歴:
  18.   2018/08/26 公開
  19.   
  20. --------------------------------------------------------------------------*/

  21. (function() {

  22. var alias1 = CustomCharChipGroup._configureCustomCharChip;
  23. CustomCharChipGroup._configureCustomCharChip = function(groupArray) {
  24.         alias1.call(this, groupArray);
  25.         groupArray.push(CustomCharChip.Anime);
  26. };

  27. CustomCharChip.Anime = defineObject(BaseCustomCharChip,
  28. {
  29.         _dynamicAnime: null,
  30.         _animeData: null,
  31.        
  32.         initialize: function() {
  33.                 // マップ上での描画とメニュー上での描画でオブジェクトを変更する
  34.                 this._dynamicAnime = createObject(DynamicAnimeEx);
  35.                 this._animeSimple = createObject(NonBattleAnimeSimple);
  36.         },
  37.        
  38.         setupCustomCharChip: function(unit) {
  39.                 var pos;
  40.                 var anime = this._getTargetAnime(unit);
  41.                
  42.                 if (anime === null) {
  43.                         return;
  44.                 }
  45.                
  46.                 pos = LayoutControl.getMapAnimationPos(0, 0, anime);
  47.                 this._dynamicAnime.startDynamicAnime(anime, pos.x, pos.y);
  48.                 this._dynamicAnime.setLoopMode(true);
  49.                 this._dynamicAnime.getAnimeMotion().lockSound();
  50.                
  51.                 this._animeData = anime;
  52.         },
  53.        
  54.         moveCustomCharChip: function() {
  55.                 if (this._animeData === null) {
  56.                         return;
  57.                 }
  58.                
  59.                 this._dynamicAnime.moveDynamicAnime();
  60.                
  61.                 return MoveResult.CONTINUE;
  62.         },
  63.        
  64.         drawCustomCharChip: function(cpData) {
  65.                 if (this._animeData === null) {
  66.                         return;
  67.                 }
  68.                
  69.                 this._setDynamicAnimeColor(cpData);
  70.                 this._dynamicAnime.drawDynamicAnime(cpData.xPixel, cpData.yPixel);
  71.                 this._drawInfo(cpData.xPixel, cpData.yPixel, cpData);
  72.         },
  73.        
  74.         drawMenuCharChip: function(cpData) {
  75.                 var frameIndex;
  76.                 var x = cpData.xPixel;
  77.                 var y = cpData.yPixel;
  78.                
  79.                 if (this._animeData === null) {
  80.                         return;
  81.                 }
  82.                
  83.                 if (cpData.unit.getDirection() === DirectionType.NULL) {
  84.                         x += this._getMenuOffsetX();
  85.                         y += this._getMenuOffsetY();
  86.                         frameIndex = this._dynamicAnime.getAnimeMotion().getFrameIndex();
  87.                         this._dynamicAnime.getAnimeMotion().setFrameIndex(this._getFrameIndex(), false);
  88.                 }
  89.                
  90.                 this._setDynamicAnimeColor(cpData);
  91.                 this._dynamicAnime.drawDynamicAnime(x, y);
  92.                 this._drawInfo(x, y, cpData);
  93.                
  94.                 if (cpData.unit.getDirection() === DirectionType.NULL) {
  95.                         this._dynamicAnime.getAnimeMotion().setFrameIndex(frameIndex, false);
  96.                 }
  97.         },
  98.        
  99.         getKeyword: function() {
  100.                 return 'animation';
  101.         },
  102.        
  103.         _setDynamicAnimeColor: function(cpData) {
  104.                 var colorIndex = cpData.unit.getUnitType();
  105.                
  106.                 if (cpData.unit.isWait()) {
  107.                         colorIndex = 3;
  108.                 }
  109.                
  110.                 this._dynamicAnime.getAnimeMotion().getAnimeRenderParam().motionColorIndex = colorIndex;
  111.         },
  112.        
  113.         _drawInfo: function(x, y, cpData) {
  114.                 // HPゲージを描画する位置を決定する。
  115.                 // エフェクトによって最適な位置は異なる。
  116.                 this._drawHpGauge(x, y + 10, cpData);
  117.                 this._drawStateIcon(x, y - 20, cpData);
  118.         },
  119.        
  120.         _getTargetAnime: function(unit) {
  121.                 var id = this._getOriginalAnimeId(unit);
  122.                 var list = root.getBaseData().getEffectAnimationList(false);
  123.                
  124.                 return list.getDataFromId(id);
  125.         },
  126.        
  127.         _getOriginalAnimeId: function(unit) {
  128.                 if (unit.getClass().custom.animationId === 'undefined') {
  129.                         return 0;
  130.                 }
  131.                
  132.                 return unit.getClass().custom.animationId;
  133.         },
  134.        
  135.         _getMenuOffsetX: function() {
  136.                 // メニュー上での描画位置を決定する。
  137.                 // エフェクトによって最適な位置は異なる。
  138.                 return 0;
  139.         },
  140.        
  141.         _getMenuOffsetY: function() {
  142.                 return 0;
  143.         },
  144.        
  145.         _getFrameIndex: function() {
  146.                 // ユニットメニューではエフェクトはアニメーションしないので、どのフレームを表示するか指定する
  147.                 return 0;
  148.         },
  149.        
  150.         _getSpriteIndex: function() {
  151.                 return 0;
  152.         }
  153. }
  154. );

  155. var DynamicAnimeEx = defineObject(DynamicAnime,
  156. {
  157.         drawDynamicAnime: function(xPixel, yPixel) {
  158.                 if (this._motion === null) {
  159.                         return;
  160.                 }
  161.                
  162.                 this._motion.setSpriteOffset(xPixel, yPixel);
  163.                 this._motion.drawMotion(0, 0);
  164.         }
  165. }
  166. );

  167. })();
复制代码

  1. /*--------------------------------------------------------------------------
  2.   
  3.   キャラチップの見た目を画像(クリスタル)に変更します。
  4.   
  5.   使用方法:
  6.   クラスの条件表示のキーワードにcrystalを設定します。
  7.   
  8.   作成者:
  9.   サファイアソフト
  10.   http://srpgstudio.com/
  11.   
  12.   更新履歴:
  13.   2018/08/26 公開
  14.   
  15. --------------------------------------------------------------------------*/

  16. (function() {

  17. var alias1 = CustomCharChipGroup._configureCustomCharChip;
  18. CustomCharChipGroup._configureCustomCharChip = function(groupArray) {
  19.         alias1.call(this, groupArray);
  20.         groupArray.push(CustomCharChip.Crystal);
  21. };

  22. CustomCharChip.Crystal = defineObject(BaseCustomCharChip,
  23. {
  24.         drawCustomCharChip: function(cpData) {
  25.                 this._drawChip(cpData, true);
  26.         },
  27.        
  28.         drawMenuCharChip: function(cpData) {
  29.                 this._drawChip(cpData, false);
  30.         },
  31.        
  32.         getKeyword: function() {
  33.                 return 'crystal';
  34.         },
  35.        
  36.         _drawChip: function(cpData, isInfo) {
  37.                 var pic = this._getPicture(cpData);
  38.                 var xSrc = this._getSrcX(cpData);
  39.                 var ySrc = this._getSrcY(cpData);
  40.                 var width = this._getWidth();
  41.                 var height = this._getHeight();
  42.                 var pos = this._getPos(cpData);
  43.                
  44.                 if (pic === null) {
  45.                         return;
  46.                 }
  47.                
  48.                 pic.setAlpha(cpData.alpha);
  49.                 pic.drawStretchParts(pos.x, pos.y, width, height, xSrc, ySrc, width, height);
  50.                
  51.                 if (isInfo) {
  52.                         this._drawInfo(pos.x, pos.y, cpData);
  53.                 }
  54.         },
  55.        
  56.         _drawInfo: function(x, y, cpData) {
  57.                 this._drawHpGauge(x + 25, y + 35, cpData);
  58.                 this._drawStateIcon(x + 25, y + 15, cpData);
  59.         },
  60.        
  61.         _getPicture: function(cpData) {
  62.                 var handle = root.queryGraphicsHandle('battlecrystal');
  63.                 return GraphicsRenderer.getGraphics(handle, GraphicsType.PICTURE);
  64.         },
  65.        
  66.         _getPos: function(cpData) {
  67.                 var pos = createPos();
  68.                
  69.                 pos.x = cpData.xPixel - Math.floor(this._getWidth() / 2) + 16;
  70.                 pos.y = cpData.yPixel - Math.floor(this._getHeight() / 2) + 16;
  71.                
  72.                 return pos;
  73.         },
  74.        
  75.         _getSrcX: function(cpData) {
  76.                 if (cpData.isWait) {
  77.                         return 3 * this._getWidth();
  78.                 }
  79.                
  80.                 return cpData.unitType * this._getWidth();
  81.         },
  82.        
  83.         _getSrcY: function(cpData) {
  84.                 return 0;
  85.         },
  86.        
  87.         _getWidth: function() {
  88.                 return 84;
  89.         },
  90.        
  91.         _getHeight: function() {
  92.                 return 84;
  93.         }
  94. }
  95. );

  96. })();
复制代码
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-26 00:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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