查看: 5618|回复: 19

[有事请教] 想在插件中加一个变量

[复制链接]
梦石
0
星屑
9064
在线时间
1933 小时
注册时间
2016-6-19
回帖
329
发表于 2019-2-1 13:57:33 | 显示全部楼层 |阅读模式

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

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

×
如题,不知在正则表达式后边加变量是否会出错

        var notetagsLoaded = false;
        var _DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
        DataManager.isDatabaseLoaded = function() {
            if(!_DataManager_isDatabaseLoaded.call(this)) return false;
            if(!notetagsLoaded) {
                    for(var i = 1; i < $dataActors.length; i++) {
                            if($dataActors.note.match(/<Menu\s*Bust\s*:\s*(.*)\s*>/im)) {
                                    $dataActors.ams_bs_bust = RegExp.$1 + $gameVariables.value(100 + i);
                            }
                            if($dataActors.note.match(/<Menu\s*Bust\s*X\s*:\s*(.*)\s*>/im)) {
                                    $dataActors.ams_bs_x = parseInt(RegExp.$1);
                            }
                            if($dataActors.note.match(/<Menu\s*Bust\s*Y\s*:\s*(.*)\s*>/im)) {
                                    $dataActors.ams_bs_y = parseInt(RegExp.$1);
                            }
                    }
                    notetagsLoaded = true;
            }
            return true;
        };

这样做会爆出Cannot read property 'value' of null,但在插件中其他地方加变量则不会,希望能帮忙解惑。

梦石
1
星屑
23371
在线时间
9572 小时
注册时间
2012-6-19
回帖
7021

开拓者短篇九导演组冠军

发表于 2019-2-1 14:38:02 | 显示全部楼层
猜测是 $gameVariables 还未初始化

  1. if ($gameVariables){
  2.   $dataActors.ams_bs_bust = RegExp.$1 + $gameVariables.value(100 + i);
  3. }else{
  4.   $dataActors.ams_bs_bust = RegExp.$1
  5. }
复制代码

点评

是的,刚刚也想到这点,我这就去试下~  发表于 2019-2-1 14:39
回复

使用道具 举报

梦石
0
星屑
9064
在线时间
1933 小时
注册时间
2016-6-19
回帖
329
 楼主| 发表于 2019-2-1 14:50:48 | 显示全部楼层
本帖最后由 康姆图帕帕 于 2019-2-1 14:58 编辑
喵呜喵5 发表于 2019-2-1 14:38
猜测是 $gameVariables 还未初始化


汗,这回根本不报错了,似乎是因为 if($dataActors.note.match(/<Menu\s*Bust\s*:\s*(.*)\s*>/im)) 这条不知怎么失效了,导致 $dataActors.ams_bs_bust 没被赋值

------------------------------------------------
等等,我搞错了个地方
------------------------------------------------
不行了 ,这条变量的if用处不大,因为即使后面载入了Game_Variables,也不会回来再判断一次。虽然能够防止报错,但别想把变量的值赋给$dataActors.ams_bs_bust
回复

使用道具 举报

梦石
1
星屑
23371
在线时间
9572 小时
注册时间
2012-6-19
回帖
7021

开拓者短篇九导演组冠军

发表于 2019-2-1 16:19:03 | 显示全部楼层
那就简单了啊,把这代码删了

进入游戏后直接
  1. $dataActors.ams_bs_bust = $dataActors.ams_bs_bust + $gameVariables.value(100 + i)
复制代码
回复

使用道具 举报

梦石
0
星屑
9064
在线时间
1933 小时
注册时间
2016-6-19
回帖
329
 楼主| 发表于 2019-2-1 17:26:38 | 显示全部楼层
本帖最后由 康姆图帕帕 于 2019-2-1 18:07 编辑
喵呜喵5 发表于 2019-2-1 16:19
那就简单了啊,把这代码删了

进入游戏后直接


呃,怎样使这条脚本重复使用呢?
因为只有变量 100+i 是需要控制的,前面的 $dataActors.ams_bs_bust 不随变量变化,而重复上面这条脚本会在 $dataActors.ams_bs_bust 后面无限添加变量字符...
然后file01,file02,file03就都变成了file0000...000n
自己想了半天想不到方法,只好再来求助了

-------------------------------------

都解决了,最终达成了想要的效果,谢过大侠了~
回复

使用道具 举报

梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2019-2-1 21:07:10 | 显示全部楼层
为什么你要给$dataActors这数据库设变量啊。
修改数据库不是好办法
而且重启游戏就没了
你在游戏里用$gameVariables不行吗
回复

使用道具 举报

梦石
0
星屑
9064
在线时间
1933 小时
注册时间
2016-6-19
回帖
329
 楼主| 发表于 2019-2-1 22:35:56 | 显示全部楼层
本帖最后由 康姆图帕帕 于 2019-2-1 22:44 编辑
yang1zhi 发表于 2019-2-1 21:07
为什么你要给$dataActors这数据库设变量啊。
修改数据库不是好办法
而且重启游戏就没了


其实是SRD的一个菜单插件,在角色的note区里加参数来显示半身绘。
但是它的参数写得挺死的,每个角色固定用一个绘图,所以我想加入变量来接管图片的调用
p.s.这个插件是依次加载每个$dataActor.note,然后用的loadbitmap(),就很难受

---------------------------
至于重启的话,我试试那个加载游戏后运行公共事件的插件,应该就能解决了~

点评

嗯,大概可以在$gameActors里加个actorBustImage吧,不过本人实力所限实在没信心XD  发表于 2019-2-2 07:29
你可以加到角色身上,不建议直接修改数据库。数据库是用来开发的,不适合做游戏内变化。  发表于 2019-2-1 22:54
回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2019-2-1 23:29:42 | 显示全部楼层
本帖最后由 soulsaga 于 2019-2-1 23:36 编辑

我觉得脚本发错了..应该不是在这里改..这里根本是开始游戏前的..建议从菜单着手..

点评

你可以发下脚本看看吗..  发表于 2019-2-2 09:30
所以我觉得SRD这个参数写得有些死了,它就是读取的$dataActor.note,后面紧跟着的就是loadBitmap,我也只能望洋兴叹- -  发表于 2019-2-2 07:32
回复 1 0

使用道具 举报

梦石
0
星屑
9064
在线时间
1933 小时
注册时间
2016-6-19
回帖
329
 楼主| 发表于 2019-2-2 10:55:47 | 显示全部楼层
本帖最后由 康姆图帕帕 于 2019-2-2 10:59 编辑
soulsaga 发表于 2019-2-1 23:29
我觉得脚本发错了..应该不是在这里改..这里根本是开始游戏前的..建议从菜单着手.. ...

  1. /*:
  2. * @plugindesc Alternative Menu Screen Bust and Icons. Shows busts for the Actor and Icons for the commands! WOWOWOWOWOW!!!
  3. * @author SumRndmDde
  4. *
  5. * @param Item Icon
  6. * @desc The icon index of the icon used for the "Item" choice.
  7. * Right-click and press "IconSet Viewer".
  8. * @default 176
  9. *
  10. * @param Skill Icon
  11. * @desc The icon index of the icon used for the "Skill" choice.
  12. * Right-click and press "IconSet Viewer".
  13. * @default 64
  14. *
  15. * @param Equip Icon
  16. * @desc The icon index of the icon used for the "Equip" choice.
  17. * Right-click and press "IconSet Viewer".
  18. * @default 96
  19. *
  20. * @param Status Icon
  21. * @desc The icon index of the icon used for the "Status" choice.
  22. * Right-click and press "IconSet Viewer".
  23. * @default 87
  24. *
  25. * @param Formation Icon
  26. * @desc The icon index of the icon used for the "Formation" choice.
  27. * Right-click and press "IconSet Viewer".
  28. * @default 82
  29. *
  30. * @param Options Icon
  31. * @desc The icon index of the icon used for the "Options" choice.
  32. * Right-click and press "IconSet Viewer".
  33. * @default 83
  34. *
  35. * @param Save Icon
  36. * @desc The icon index of the icon used for the "Save" choice.
  37. * Right-click and press "IconSet Viewer".
  38. * @default 225
  39. *
  40. * @param Game End Icon
  41. * @desc The icon index of the icon used for the "Game End" choice.
  42. * Right-click and press "IconSet Viewer".
  43. * @default 245
  44. *
  45. * @param == Bust Position ==
  46. * @default
  47. *
  48. * @param Bust X Pos
  49. * @desc By default, the busts are positioned at (0, 0). Using this Parameter, all the busts' default X positions can be set.
  50. * @default 0
  51. *
  52. * @param Bust Y Pos
  53. * @desc By default, the busts are positioned at (0, 0). Using this Parameter, all the busts' default X positions can be set.
  54. * @default 0
  55. *
  56. * @param == Bust Window ==
  57. * @default
  58. *
  59. * @param Status Background
  60. * @desc The RGBA color for the background of the information for each Actor.
  61. * @default rgba(0, 0, 0, 0.6)
  62. *
  63. * @param Show TP?
  64. * @desc Set this to 'true', and TP bars will be shown in the menu.
  65. * @default false
  66. *
  67. * @param == Icon Window ==
  68. * @default
  69. *
  70. * @param Icon Window X
  71. * @desc The X position of the command (icons) window.
  72. * Can be Number or JavaScript evaluation.
  73. * @default (Graphics.boxWidth / 2) - (this._commandWindow.width / 2)
  74. *
  75. * @param Icon Window Y
  76. * @desc The Y position of the command (icons) window.
  77. * Can be Number or JavaScript evaluation.
  78. * @default this._commandLabel.y + this._commandLabel.height
  79. *
  80. * @param Standard Padding
  81. * @desc The amount of space around the border of the window.
  82. * Default is 12.
  83. * @default 12
  84. *
  85. * @param Icon Padding
  86. * @desc The amount of space around the icon, but still highlighed.
  87. * Default is 12.
  88. * @default 12
  89. *
  90. * @param Icon X Position
  91. * @desc The X position of each icon in the "button".
  92. * Default is 0.
  93. * @default 0
  94. *
  95. * @param Icon Y Position
  96. * @desc The Y position of each icon in the "button".
  97. * Default is 6.
  98. * @default 6
  99. *
  100. * @param == Label Window ==
  101. * @default
  102. *
  103. * @param Label Window X
  104. * @desc The X position of the label window.
  105. * Can be Number or JavaScript evaluation.
  106. * @default (Graphics.boxWidth / 2) - (this._commandLabel.width / 2)
  107. *
  108. * @param Label Window Y
  109. * @desc The Y position of the label window.
  110. * Can be Number or JavaScript evaluation.
  111. * @default 0
  112. *
  113. * @param Label Alignment
  114. * @desc The alignment of the label text.
  115. * Choices are: Left, Right, or Center
  116. * @default Center
  117. *
  118. * @param == Gold Window ==
  119. * @default
  120. *
  121. * @param Gold Window X
  122. * @desc This is the x position of the HP Window.
  123. * Can be a Number or JavaScript eval.
  124. * @default 0
  125. *
  126. * @param Gold Window Y
  127. * @desc This is the x position of the HP Window.
  128. * Can be a Number or JavaScript eval.
  129. * @default Graphics.boxHeight - this._goldWindow.height
  130. *
  131. * @param == Custom Commands ==
  132. * @default
  133. *
  134. * @param Command Symbol 1
  135. * @desc The symbol of the command that will have Command Icon 1.
  136. * The order it's listed in the Parameters is irrelevant.
  137. * @default
  138. *
  139. * @param Command Icon 1
  140. * @desc The icon of the command that will have Command Icon 1.
  141. * The order it's listed in the Parameters is irrelevant.
  142. * @default
  143. *
  144. * @param Command Symbol 2
  145. * @desc The symbol of the command that will have Command Icon 2.
  146. * The order it's listed in the Parameters is irrelevant.
  147. * @default
  148. *
  149. * @param Command Icon 2
  150. * @desc The icon of the command that will have Command Icon 2.
  151. * The order it's listed in the Parameters is irrelevant.
  152. * @default
  153. *
  154. * @param Command Symbol 3
  155. * @desc The symbol of the command that will have Command Icon 3.
  156. * The order it's listed in the Parameters is irrelevant.
  157. * @default
  158. *
  159. * @param Command Icon 3
  160. * @desc The icon of the command that will have Command Icon 3.
  161. * The order it's listed in the Parameters is irrelevant.
  162. * @default
  163. *
  164. * @param Command Symbol 4
  165. * @desc The symbol of the command that will have Command Icon 4.
  166. * The order it's listed in the Parameters is irrelevant.
  167. * @default
  168. *
  169. * @param Command Icon 4
  170. * @desc The icon of the command that will have Command Icon 4.
  171. * The order it's listed in the Parameters is irrelevant.
  172. * @default
  173. *
  174. * @param Command Symbol 5
  175. * @desc The symbol of the command that will have Command Icon 5.
  176. * The order it's listed in the Parameters is irrelevant.
  177. * @default
  178. *
  179. * @param Command Icon 5
  180. * @desc The icon of the command that will have Command Icon 5.
  181. * The order it's listed in the Parameters is irrelevant.
  182. * @default
  183. *
  184. * @param Command Symbol 6
  185. * @desc The symbol of the command that will have Command Icon 6.
  186. * The order it's listed in the Parameters is irrelevant.
  187. * @default
  188. *
  189. * @param Command Icon 6
  190. * @desc The icon of the command that will have Command Icon 6.
  191. * The order it's listed in the Parameters is irrelevant.
  192. * @default
  193. *
  194. * @param Command Symbol 7
  195. * @desc The symbol of the command that will have Command Icon 7.
  196. * The order it's listed in the Parameters is irrelevant.
  197. * @default
  198. *
  199. * @param Command Icon 7
  200. * @desc The icon of the command that will have Command Icon 7.
  201. * The order it's listed in the Parameters is irrelevant.
  202. * @default
  203. *
  204. * @param Command Symbol 8
  205. * @desc The symbol of the command that will have Command Icon 8.
  206. * The order it's listed in the Parameters is irrelevant.
  207. * @default
  208. *
  209. * @param Command Icon 8
  210. * @desc The icon of the command that will have Command Icon 8.
  211. * The order it's listed in the Parameters is irrelevant.
  212. * @default
  213. *
  214. * @param Command Symbol 9
  215. * @desc The symbol of the command that will have Command Icon 9.
  216. * The order it's listed in the Parameters is irrelevant.
  217. * @default
  218. *
  219. * @param Command Icon 9
  220. * @desc The icon of the command that will have Command Icon 9.
  221. * The order it's listed in the Parameters is irrelevant.
  222. * @default
  223. *
  224. * @param Command Symbol 10
  225. * @desc The symbol of the command that will have Command Icon 10.
  226. * The order it's listed in the Parameters is irrelevant.
  227. * @default
  228. *
  229. * @param Command Icon 10
  230. * @desc The icon of the command that will have Command Icon 10.
  231. * The order it's listed in the Parameters is irrelevant.
  232. * @default
  233. *
  234. * @param Command Symbol 11
  235. * @desc The symbol of the command that will have Command Icon 11.
  236. * The order it's listed in the Parameters is irrelevant.
  237. * @default
  238. *
  239. * @param Command Icon 11
  240. * @desc The icon of the command that will have Command Icon 11.
  241. * The order it's listed in the Parameters is irrelevant.
  242. * @default
  243. *
  244. * @param Command Symbol 12
  245. * @desc The symbol of the command that will have Command Icon 12.
  246. * The order it's listed in the Parameters is irrelevant.
  247. * @default
  248. *
  249. * @param Command Icon 12
  250. * @desc The icon of the command that will have Command Icon 12.
  251. * The order it's listed in the Parameters is irrelevant.
  252. * @default
  253. *
  254. * @param Command Symbol 13
  255. * @desc The symbol of the command that will have Command Icon 13.
  256. * The order it's listed in the Parameters is irrelevant.
  257. * @default
  258. *
  259. * @param Command Icon 13
  260. * @desc The icon of the command that will have Command Icon 13.
  261. * The order it's listed in the Parameters is irrelevant.
  262. * @default
  263. *
  264. * @param Command Symbol 14
  265. * @desc The symbol of the command that will have Command Icon 14.
  266. * The order it's listed in the Parameters is irrelevant.
  267. * @default
  268. *
  269. * @param Command Icon 14
  270. * @desc The icon of the command that will have Command Icon 14.
  271. * The order it's listed in the Parameters is irrelevant.
  272. * @default
  273. *
  274. * @param Command Symbol 15
  275. * @desc The symbol of the command that will have Command Icon 15.
  276. * The order it's listed in the Parameters is irrelevant.
  277. * @default
  278. *
  279. * @param Command Icon 15
  280. * @desc The icon of the command that will have Command Icon 15.
  281. * The order it's listed in the Parameters is irrelevant.
  282. * @default
  283. *
  284. * @param Command Symbol 16
  285. * @desc The symbol of the command that will have Command Icon 16.
  286. * The order it's listed in the Parameters is irrelevant.
  287. * @default
  288. *
  289. * @param Command Icon 16
  290. * @desc The icon of the command that will have Command Icon 16.
  291. * The order it's listed in the Parameters is irrelevant.
  292. * @default
  293. *
  294. * @param Command Symbol 17
  295. * @desc The symbol of the command that will have Command Icon 17.
  296. * The order it's listed in the Parameters is irrelevant.
  297. * @default
  298. *
  299. * @param Command Icon 17
  300. * @desc The icon of the command that will have Command Icon 17.
  301. * The order it's listed in the Parameters is irrelevant.
  302. * @default
  303. *
  304. * @param Command Symbol 18
  305. * @desc The symbol of the command that will have Command Icon 18.
  306. * The order it's listed in the Parameters is irrelevant.
  307. * @default
  308. *
  309. * @param Command Icon 18
  310. * @desc The icon of the command that will have Command Icon 18.
  311. * The order it's listed in the Parameters is irrelevant.
  312. * @default
  313. *
  314. * @param Command Symbol 19
  315. * @desc The symbol of the command that will have Command Icon 19.
  316. * The order it's listed in the Parameters is irrelevant.
  317. * @default
  318. *
  319. * @param Command Icon 19
  320. * @desc The icon of the command that will have Command Icon 19.
  321. * The order it's listed in the Parameters is irrelevant.
  322. * @default
  323. *
  324. * @param Command Symbol 20
  325. * @desc The symbol of the command that will have Command Icon 20.
  326. * The order it's listed in the Parameters is irrelevant.
  327. * @default
  328. *
  329. * @param Command Icon 20
  330. * @desc The icon of the command that will have Command Icon 20.
  331. * The order it's listed in the Parameters is irrelevant.
  332. * @default
  333. *
  334. * @help
  335. *
  336. *
  337. * Alternative Menu Screen: Bust + Icons
  338. * Version 1.01
  339. * SumRndmDde
  340. *
  341. *
  342. * This is a combination of the Bust and Icon menus.
  343. *
  344. * The command window now uses Icons and the Actor Window uses Busts.
  345. *
  346. * Use the Parameters to manipualte the positions and other aspects
  347. * of the Windows.
  348. *
  349. *
  350. * ==========================================================================
  351. *  How to Set Up Bust Images
  352. * ==========================================================================
  353. *
  354. * In order to set the Bust Image for each Actor,
  355. * use the following Notetags in the Notebox of the Actor:
  356. *
  357. *  <Menu Bust: filename>
  358. *
  359. * Input the filename of the image file you wish to use
  360. * for this Actor's Bust Image.
  361. *
  362. * The image MUST be stored in:
  363. * img/SumRndmDde/menu
  364. *
  365. *
  366. * ==========================================================================
  367. *  How to Set Custom Offsets for Bust Images
  368. * ==========================================================================
  369. *
  370. * The following are optional notetags.
  371. * Use the following to set the X and Y of the Bust (inside Actor Note):
  372. *
  373. *  <Menu Bust X: number>
  374. *  <Menu Bust Y: number>
  375. *
  376. * By default, the bust image is set to the coordinates in the Parameters,
  377. * but these Notetags can set the specific bust image of the Actor to a
  378. * different position if it looks a little off center.
  379. *
  380. *
  381. * ==========================================================================
  382. * How to Set Icons
  383. * ==========================================================================
  384. *
  385. * You can manipulate the Icons used by using the Parameters at the top
  386. * of the list.
  387. *
  388. * You should definitely use "Iconset Viewer" to find the Icon you wish
  389. * to use.
  390. *
  391. *
  392. * ==========================================================================
  393. *  Setting up Icons for Custom Commands
  394. * ==========================================================================
  395. *
  396. * At the very bottom of the Parameter list, there are places available
  397. * for inputting Icons for custom commands.
  398. *
  399. * You need to first provide the "symbol" of the command.
  400. * (A symbol is usually a word. For example, the symbol for the Debug
  401. * Command added by Yanfly's Main Menu Manager is "debug" (without quotes))
  402. *
  403. * Then, after you have done so, you can place the Icon Index in the
  404. * proceeding Parameter.
  405. *
  406. * If you're using Yanfly's Main Menu Manager, you can find a command's
  407. * symbol in the Parameter section it's help in.
  408. *
  409. *
  410. * On the other hand, if you have a Plugin that adds a command without
  411. * telling you the symbol for it, leave a comment on the YouTube video
  412. * or Forum post linking me to the Plugin; I'll help ya. ~
  413. *
  414. *
  415. * ==========================================================================
  416. *  End of Help File
  417. * ==========================================================================
  418. *
  419. * Welcome to the bottom of the Help file.
  420. *
  421. *
  422. * Thanks for reading!
  423. * If you have questions, or if you enjoyed this Plugin, please check
  424. * out my YouTube channel!
  425. *
  426. * [url]https://www.youtube.com/c/SumRndmDde[/url]
  427. *
  428. *
  429. * Until next time,
  430. *   ~ SumRndmDde
  431. */

  432. var Imported = Imported || {};

  433. (function() {

  434.         var icons = {};
  435.         icons['item'] = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Item Icon']);
  436.         icons['skill'] = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Skill Icon']);
  437.         icons['equip'] = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Equip Icon']);
  438.         icons['status'] = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Status Icon']);
  439.         icons['formation'] = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Formation Icon']);
  440.         icons['options'] = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Options Icon']);
  441.         icons['save'] = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Save Icon']);
  442.         icons['gameEnd'] = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Game End Icon']);

  443.         for(var i = 1; i <= 20; i++) {
  444.                 var sym = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Command Symbol ' + i]);
  445.                 if(sym.trim().length > 0) {
  446.                         icons[sym] = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Command Icon ' + i]);
  447.                 }
  448.         }

  449.         var bustX = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Bust X Pos']);
  450.         var bustY = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Bust Y Pos']);
  451.         var sBack = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Status Background']);
  452.         var tp = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Show TP?']).trim().toLowerCase() === 'true';
  453.         var col = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Max Columns']);
  454.         var row = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Visible Rows']);
  455.         var _x = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Icon Window X']);
  456.         var _y = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Icon Window Y']);
  457.         var _stand = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Standard Padding']);
  458.         var _icon = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Icon Padding']);
  459.         var _iconX = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Icon X Position']);
  460.         var _iconY = Number(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Icon Y Position']);
  461.         var _labelX = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Label Window X']);
  462.         var _labelY = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Label Window Y']);
  463.         var _labelAlign = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Label Alignment']).toLowerCase();
  464.         var goldX = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Gold Window X']);
  465.         var goldY = String(PluginManager.parameters('SRD_AltMenuScreen_BustIcons')['Gold Window Y']);

  466.         var notetagsLoaded = false;
  467.         var _DataManager_isDatabaseLoaded = DataManager.isDatabaseLoaded;
  468.         DataManager.isDatabaseLoaded = function() {
  469.             if(!_DataManager_isDatabaseLoaded.call(this)) return false;
  470.             if(!notetagsLoaded) {
  471.                     for(var i = 1; i < $dataActors.length; i++) {
  472.                             if($dataActors[i].note.match(/<Menu\s*Bust\s*:\s*(.*)\s*>/im)) {
  473.                                     $dataActors[i].ams_bs_bust = RegExp.$1;
  474.                             }
  475.                             if($dataActors[i].note.match(/<Menu\s*Bust\s*X\s*:\s*(.*)\s*>/im)) {
  476.                                     $dataActors[i].ams_bs_x = parseInt(RegExp.$1);
  477.                             }
  478.                             if($dataActors[i].note.match(/<Menu\s*Bust\s*Y\s*:\s*(.*)\s*>/im)) {
  479.                                     $dataActors[i].ams_bs_y = parseInt(RegExp.$1);
  480.                             }
  481.                     }
  482.                     notetagsLoaded = true;
  483.             }
  484.             return true;
  485.         };
  486.         if(!ImageManager.loadSumRndmDdeMB) {
  487.                 ImageManager.loadSumRndmDdeMB = function(filename, hue) {
  488.                         return this.loadBitmap('img/SumRndmDde/menu/', filename, hue, true);
  489.             };
  490.         }
  491.         var _Scene_Menu_create = Scene_Menu.prototype.create;
  492.         Scene_Menu.prototype.create = function() {
  493.             _Scene_Menu_create.call(this);
  494.             this._windowLayer.removeChild(this._goldWindow);
  495.             this.addWindow(this._goldWindow);
  496.             this._windowLayer.removeChild(this._commandWindow);
  497.             this.addWindow(this._commandWindow);
  498.             this._commandLabel = new Window_CommandLabel(0, 0, this._commandWindow);
  499.             this.addWindow(this._commandLabel);
  500.             this._statusWindow.x = 0;
  501.                 this._statusWindow.y = 0;
  502.                 this._commandLabel.x = eval(_labelX);
  503.             this._commandLabel.y = eval(_labelY);
  504.                 this._commandWindow.x = eval(_x);
  505.                 this._commandWindow.y = eval(_y);
  506.                 this._goldWindow.x = eval(goldX);
  507.             this._goldWindow.y = eval(goldY);
  508.         };
  509.         Scene_Menu.prototype.createStatusWindow = function() {
  510.             this._statusWindow = new Window_MenuStatus(0, 0);
  511.             this.addWindow(this._statusWindow);
  512.         };
  513.         Window_MenuCommand.prototype.windowWidth = function() {
  514.             return ((this.maxItems() * (this.itemWidth() + (this.textPadding() * 2))) +
  515.                     (this.standardPadding() * 2)) - (this.textPadding() * 2);
  516.         };
  517.         Window_MenuCommand.prototype.windowHeight = function() {
  518.             return this.itemHeight() + (this.standardPadding() * 2);
  519.         };
  520.         Window_MenuCommand.prototype.standardPadding = function() {
  521.             return _stand;
  522.         };
  523.         Window_MenuCommand.prototype.iconPadding = function() {
  524.             return _icon;
  525.         };
  526.         Window_MenuCommand.prototype.maxCols = function() {
  527.             return this.maxItems();
  528.         };
  529.         Window_MenuCommand.prototype.numVisibleRows = function() {
  530.             return 1;
  531.         };
  532.         Window_MenuCommand.prototype.itemWidth = function() {
  533.             return Window_Base._iconWidth + this.iconPadding();
  534.         };
  535.         Window_MenuCommand.prototype.itemHeight = function() {
  536.             return Window_Base._iconHeight + this.iconPadding();
  537.         };
  538.         Window_MenuCommand.prototype.drawItem = function(index) {
  539.             var rect = this.itemRectForText(index);
  540.             var align = this.itemTextAlign();
  541.             var symbol = this.commandSymbol(index);
  542.             var enabled = this.isCommandEnabled(index);
  543.             this.resetTextColor();
  544.                 var bitmap = ImageManager.loadSystem('IconSet');
  545.             var pw = Window_Base._iconWidth;
  546.             var ph = Window_Base._iconHeight;
  547.             var sx = icons[symbol] % 16 * pw;
  548.             var sy = Math.floor(icons[symbol] / 16) * ph;
  549.             if(!enabled) this.contents.paintOpacity = 100;
  550.             this.contents.blt(bitmap, sx, sy, pw, ph, rect.x + _iconX, rect.y + _iconY);
  551.             if(!enabled) this.contents.paintOpacity = 255;
  552.         };
  553.         var _Window_MenuStatus_loadImages = Window_MenuStatus.prototype.loadImages;
  554.         Window_MenuStatus.prototype.loadImages = function() {
  555.             _Window_MenuStatus_loadImages.call(this);
  556.             $gameParty.members().forEach(function(actor) {
  557.                     if(actor.actor().ams_bs_bust) {
  558.                         ImageManager.loadSumRndmDdeMB(actor.actor().ams_bs_bust);
  559.                 }
  560.             }, this);
  561.         };
  562.         Window_MenuStatus.prototype.windowWidth = function() {
  563.                 return Graphics.boxWidth;
  564.         };
  565.         Window_MenuStatus.prototype.windowHeight = function() {
  566.             return Graphics.boxHeight;
  567.         };
  568.         Window_MenuStatus.prototype.numVisibleRows = function() {
  569.                 return 1;
  570.         };
  571.         Window_MenuStatus.prototype.maxCols = function() {
  572.             return 4;
  573.         };
  574.         Window_MenuStatus.prototype.drawItem = function(index) {
  575.             this.drawItemBackground(index);
  576.             this.drawItemImage(index);
  577.             this.drawItemStatus(index);
  578.         };
  579.         Window_MenuStatus.prototype.drawItemImage = function(index) {
  580.             var actor = $gameParty.members()[index];
  581.             var rect = this.itemRect(index);
  582.             this.changePaintOpacity(actor.isBattleMember());
  583.             var x = actor.actor().ams_bs_x || bustX;
  584.             var y = actor.actor().ams_bs_y || bustY;
  585.             this.drawBust(actor, rect, x, y);
  586.             this.changePaintOpacity(true);
  587.         };
  588.         Window_MenuStatus.prototype.drawItemStatus = function(index) {
  589.             var actor = $gameParty.members()[index];
  590.             var rect = this.itemRect(index);
  591.             var lineHeight = this.lineHeight();
  592.             var x = rect.x + 12;
  593.             var y = rect.y + rect.height / 2;
  594.             if(tp) y -= lineHeight;
  595.             var boxHeight = (tp) ? lineHeight * 7 : lineHeight * 6;
  596.             this.contents.fillRect(rect.x, y, this.itemWidth(), boxHeight, sBack);
  597.             this.drawActorName(actor, x, y + lineHeight * 5);
  598.             this.drawActorNickname(actor, x, y + lineHeight * 6);
  599.             this.drawActorIcons(actor, x, y + lineHeight * 2);
  600.             this.drawActorClass(actor, x, y + lineHeight * 7);
  601.             if(tp) {
  602.                     this.drawActorTp(actor, x, y + lineHeight * 6, this.itemWidth() - 24);
  603.             }
  604.         };
  605.         Window_MenuStatus.prototype.drawBust = function(actor, rect, xOff, yOff) {
  606.             var bitmap = ImageManager.loadSumRndmDdeMB(actor.actor().ams_bs_bust);
  607.             var sx = bitmap.width / 2 - this.itemWidth() / 2;
  608.             this.contents.blt(bitmap, sx, 0, this.itemWidth(), bitmap.height, rect.x + xOff, (rect.height - bitmap.height) + yOff);
  609.         };
  610.         var _Window_MenuStatus_deselect = Window_MenuStatus.prototype.deselect;
  611.         Window_MenuStatus.prototype.deselect = function() {
  612.             _Window_MenuStatus_deselect.call(this);
  613.             this._index = 0;
  614.         };
  615.         function Window_CommandLabel() {
  616.             this.initialize.apply(this, arguments);
  617.         }
  618.         Window_CommandLabel.prototype = Object.create(Window_Base.prototype);
  619.         Window_CommandLabel.prototype.constructor = Window_CommandLabel;
  620.         Window_CommandLabel.prototype.initialize = function(x, y, win) {
  621.             var width = this.windowWidth();
  622.             var height = this.windowHeight();
  623.             Window_Base.prototype.initialize.call(this, x, y, width, height);
  624.             this._commandWindow = win;
  625.             this._value = "";
  626.             this.refresh();
  627.         };
  628.         Window_CommandLabel.prototype.windowWidth = function() {
  629.             return 240;
  630.         };
  631.         Window_CommandLabel.prototype.windowHeight = function() {
  632.             return this.fittingHeight(1);
  633.         };
  634.         Window_CommandLabel.prototype.refresh = function() {
  635.                 if(this._value != this._commandWindow.currentData().symbol) {
  636.                         this._value = this._commandWindow.currentData().symbol;
  637.                     var width = this.contents.width - this.textPadding() * 2;
  638.                     this.contents.clear();
  639.                     this.drawText(this._commandWindow.currentData().name, this.textPadding(), 0, width, _labelAlign);
  640.                 }
  641.         };
  642.         var _Window_CommandLabel_update = Window_CommandLabel.prototype.update;
  643.         Window_CommandLabel.prototype.update = function() {
  644.             if(this._commandWindow) this.refresh();
  645.             _Window_CommandLabel_update.call(this);
  646.         };
  647.         Window_CommandLabel.prototype.open = function() {
  648.             this.refresh();
  649.             Window_Base.prototype.open.call(this);
  650.         };
  651.         if(Imported.YEP_MainMenuManager) {
  652.                 Scene_Menu.prototype.resizeGoldWindow = function() {};
  653.         }
  654. })();
复制代码


------------------------------------
目前我已经把对插件的修改都撤销了,每次更换立绘时,先将 $dataActors[id].ams_bs_bust 的末尾变量去除,再重新加上新变量,用着还行。
回复

使用道具 举报

梦石
0
星屑
39336
在线时间
11161 小时
注册时间
2009-3-15
回帖
4768
发表于 2019-2-2 11:28:51 | 显示全部楼层
本帖最后由 soulsaga 于 2019-2-2 11:32 编辑

611行开始是菜单立绘显示?
这里可以用变量控制么
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部