查看: 3848|回复: 4

[有事请教] 【已解决】请教关于MV插件对本体影响的问题

[复制链接]
梦石
0
星屑
66
在线时间
10 小时
注册时间
2018-5-1
回帖
3
发表于 2019-8-21 21:05:57 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 MoonBite 于 2019-8-21 21:41 编辑

三言两语不太说得清……我刚刚入门Js,正在学做插件。然后今天我看到一个类似官方madeWithMv的插件
  1. Scene_Boot.prototype.start = function() {
  2.     Scene_Base.prototype.start.call(this);
  3.     SoundManager.preloadImportantSounds();
  4.     if (DataManager.isBattleTest()) {
  5.         DataManager.setupBattleTest();
  6.         SceneManager.goto(Scene_Battle);
  7.     } else if (DataManager.isEventTest()) {
  8.         DataManager.setupEventTest();
  9.         SceneManager.goto(Scene_Map);
  10.     } else {
  11.         this.checkPlayerLocation();
  12.         DataManager.setupNewGame();
  13.         SceneManager.goto(Scene_Splash);
  14.         Window_TitleCommand.initCommandPosition();
  15.     }
  16.     this.updateDocumentTitle();
  17. };

  18. function Scene_Splash() {
  19.     this.initialize.apply(this, arguments);
  20. }

  21. Scene_Splash.prototype = Object.create(Scene_Base.prototype);
  22. Scene_Splash.prototype.constructor = Scene_Splash;

  23. Scene_Splash.prototype.initialize = function() {
  24.     Scene_Base.prototype.initialize.call(this);
  25. };

  26. Scene_Splash.prototype.create = function() {
  27.     Scene_Base.prototype.create.call(this);

  28.     this._wait = 0;
  29.     this.logo=new Sprite();
  30.     this.logo.bitmap=ImageManager.loadSystem("MyLogo");
  31.     this.addChild(this.logo);
  32. };

  33. Scene_Splash.prototype.start = function() {
  34.     Scene_Base.prototype.start.call(this);
  35.     this.startFadeIn(this.slowFadeSpeed(), false);

  36.     this.logo.anchor.x=0.5;
  37.     this.logo.anchor.y=0.5;
  38.     this.logo.x=Graphics.width/2;
  39.     this.logo.y=Graphics.height/2;
  40. };

  41. Scene_Splash.prototype.update = function() {
  42.     if (this.isActive() && !this.isBusy() && (Input.isTriggered('ok') || TouchInput.isTriggered())) {
  43.         SceneManager.goto(Scene_Title);
  44.         return;
  45.     }

  46.     this._wait = this._wait || 0;
  47.     if (this._wait >= 0) {
  48.         if (this._wait >= 90) {
  49.             SceneManager.goto(Scene_Title);
  50.             this._wait = -1
  51.         } else {
  52.             this._wait++;
  53.         }
  54.     }
  55.     Scene_Base.prototype.update.call(this);
  56. };

  57. Scene_Splash.prototype.stop = function() {
  58.     Scene_Base.prototype.stop.call(this);
  59.     this.fadeOutAll();
  60. };

  61. Scene_Splash.prototype.terminate = function() {
  62.     Scene_Base.prototype.terminate.call(this);
  63.     AudioManager.stopAll();
  64. };
复制代码

这里面的复写和对象之类的我都能理解,但是为什么插件里只是改了对象的属性,没有触发啊?(如果我的问题很nc请见谅,但是我真的不懂)
还有就是,MV的运行机制,以及用到的对象属性,这些在哪里能查到?萌新现在一头雾水……
梦石
0
星屑
12161
在线时间
4435 小时
注册时间
2014-4-11
回帖
5616

开拓者

发表于 2019-8-21 21:15:59 | 显示全部楼层
怎么没触发了啊
第一段不就是有触发了吗
SceneManager.goto(Scene_Splash);
scene的触发就是这个啊

脚本里能查到。你多看看,多用用就懂了
回复

使用道具 举报

梦石
0
星屑
66
在线时间
10 小时
注册时间
2018-5-1
回帖
3
 楼主| 发表于 2019-8-21 21:21:03 | 显示全部楼层
yang1zhi 发表于 2019-8-21 21:15
怎么没触发了啊
第一段不就是有触发了吗
SceneManager.goto(Scene_Splash);

请问是因为 Scene_Boot的start方法是在游戏启动时执行,然后复写了之后插件就把源代码覆盖了吗

点评

拥有相同名字的函数(方法)时,这时采用的是最后面的那个函数。插件是在默认脚本后面的  发表于 2019-8-21 21:25
回复

使用道具 举报

梦石
0
星屑
66
在线时间
10 小时
注册时间
2018-5-1
回帖
3
 楼主| 发表于 2019-8-21 21:42:00 | 显示全部楼层
ok 感谢感谢
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部