查看: 3769|回复: 4

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

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

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

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

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

三言两语不太说得清……我刚刚入门Js,正在学做插件。然后今天我看到一个类似官方madeWithMv的插件
[pre lang="javascript"]Scene_Boot.prototype.start = function() {
    Scene_Base.prototype.start.call(this);
    SoundManager.preloadImportantSounds();
    if (DataManager.isBattleTest()) {
        DataManager.setupBattleTest();
        SceneManager.goto(Scene_Battle);
    } else if (DataManager.isEventTest()) {
        DataManager.setupEventTest();
        SceneManager.goto(Scene_Map);
    } else {
        this.checkPlayerLocation();
        DataManager.setupNewGame();
        SceneManager.goto(Scene_Splash);
        Window_TitleCommand.initCommandPosition();
    }
    this.updateDocumentTitle();
};

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

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

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

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

    this._wait = 0;
    this.logo=new Sprite();
    this.logo.bitmap=ImageManager.loadSystem("MyLogo");
    this.addChild(this.logo);
};

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

    this.logo.anchor.x=0.5;
    this.logo.anchor.y=0.5;
    this.logo.x=Graphics.width/2;
    this.logo.y=Graphics.height/2;
};

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

    this._wait = this._wait || 0;
    if (this._wait >= 0) {
        if (this._wait >= 90) {
            SceneManager.goto(Scene_Title);
            this._wait = -1
        } else {
            this._wait++;
        }
    }
    Scene_Base.prototype.update.call(this);
};

Scene_Splash.prototype.stop = function() {
    Scene_Base.prototype.stop.call(this);
    this.fadeOutAll();
};

Scene_Splash.prototype.terminate = function() {
    Scene_Base.prototype.terminate.call(this);
    AudioManager.stopAll();
};[/pre]
这里面的复写和对象之类的我都能理解,但是为什么插件里只是改了对象的属性,没有触发啊?(如果我的问题很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.

在本版发帖返回顶部