MV实时更新的时间插件 - RPG Maker MV 红狼游戏中心 
查看: 13526|回复: 4
打印 上一主题 下一主题

[插件分享] MV实时更新的时间插件

[复制链接]

4

主题

0

精华

1

好友

版主

Rank: 24Rank: 24Rank: 24Rank: 24Rank: 24Rank: 24

贡献度
0 点
知名度
22 点
存在感
177 次
游戏票
188.00 张
支持票
7 张
帖子
34
精华
0
在线时间
28 小时
跳转到指定楼层
楼主
发表于 2016-6-2 21:32:56 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
今天在当当和瓢虫的帮助下写了这个插件,算是学习js的第一步吧!写好了拿出来跟大家分享一下,看有没有同样需要使用的小伙伴!

使用效果:


代码:
Scene_Map.prototype.start = function() {
    Scene_MenuBase.prototype.start.call(this);
    SceneManager.clearStack();
    if (this._transfer) {
        this.fadeInForTransfer();
        this._mapNameWindow.open();
        this._ningjingWindow.open();
        $gameMap.autoplay();
    } else if (this.needsFadeIn()) {
        this.startFadeIn(this.fadeSpeed(), false);
    }
    this.menuCalling = false;
};

Scene_Map.prototype.stop = function() {
    Scene_MenuBase.prototype.stop.call(this);
    $gamePlayer.straighten();
    this._mapNameWindow.close();
    this._ningjingWindow.close();
    if (this.needsSlowFadeOut()) {
        this.startFadeOut(this.slowFadeSpeed(), false);
    } else if (SceneManager.isNextScene(Scene_Map)) {
        this.fadeOutForTransfer();
    } else if (SceneManager.isNextScene(Scene_Battle)) {
        this.launchBattle();
    }
};
Scene_Map.prototype.terminate = function() {
    Scene_MenuBase.prototype.terminate.call(this);
    if (!SceneManager.isNextScene(Scene_Battle)) {
        this._spriteset.update();
        this._mapNameWindow.hide();
        this._ningjingWindow.hide();
        SceneManager.snapForBackground();
    }
    $gameScreen.clearZoom();
};
Scene_Map.prototype.createDisplayObjects = function() {
    this.createSpriteset();
    this.createMapNameWindow();
    this.createNingJingWindow();
    this.createWindowLayer();
    this.createAllWindows();
};
Scene_Map.prototype.createNingJingWindow = function(){
    this._ningjingWindow = new Window_Testing(550,580,260,40);
    this.addChild(this._ningjingWindow);
};

Scene_Map.prototype.callMenu = function() {
    SoundManager.playOk();
    SceneManager.push(Scene_Menu);
    Window_MenuCommand.initCommandPosition();
    $gameTemp.clearDestination();
    this._ningjingWindow.hide();
    this._mapNameWindow.hide();
    this._waitCount = 2;
};
Scene_Map.prototype.launchBattle = function() {
    BattleManager.saveBgmAndBgs();
    this.stopAudioOnBattleStart();
    SoundManager.playBattleStart();
    this.startEncounterEffect();
    this._ningjingWindow.hide();
    this._mapNameWindow.hide();
};

function Window_Testing() {
    this.initialize.apply(this, arguments);
}
Window_Testing.prototype = Object.create(Window_Base.prototype);
Window_Testing.prototype.initialize = function(x, y, width, height) {
    Window_Base.prototype.initialize.call(this, x, y, width, height);
    this.contents.fontSize = 20;
}

Window_Testing.prototype.standardPadding = function() {
    return 8;
};

Window_Testing.prototype.update = function() {
    Window_Base.prototype.update.call(this);
    var textW = 270;
    var textH = 0;
    this.contents.clear();
    this.drawText($gameVariables.value(1) + "年", -180, -6, textW, 'right');
    textH += this.lineHeight();
    this.drawText($gameVariables.value(2) + "月", -130, -6, textW, 'right');
    textH += this.lineHeight();
    this.drawText($gameVariables.value(3) + "日", -80, -6, textW, 'right');
    textH += this.lineHeight();
    this.drawText($gameVariables.value(4) + "时", -30, -6, textW, 'right');
    textH += this.lineHeight();
};


使用了一个公共时间和一个场景时间来操作时间进位



或许可以把这两个也并入到插件里去?
再次感谢当当和瓢虫!

本帖子中包含更多资源

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

x

评分

参与人数 1游戏票 +20 收起 理由
RegHorace + 20 不错呦

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏

4

主题

0

精华

1

好友

版主

Rank: 24Rank: 24Rank: 24Rank: 24Rank: 24Rank: 24

贡献度
0 点
知名度
22 点
存在感
177 次
游戏票
188.00 张
支持票
7 张
帖子
34
精华
0
在线时间
28 小时
沙发
 楼主| 发表于 2016-6-2 23:06:00 | 只看该作者
在瓢虫和当当的帮助下,又把这个插件改进了
现在已经不需要在游戏中添加时间来操作时间进位和开启
全部都并入到脚本中去啦!

脚本:
Scene_Map.prototype.start = function() {
    Scene_MenuBase.prototype.start.call(this);
    SceneManager.clearStack();
    if (this._transfer) {
        this.fadeInForTransfer();
        this._mapNameWindow.open();
        this._ningjingWindow.open();
        $gameMap.autoplay();
    } else if (this.needsFadeIn()) {
        this.startFadeIn(this.fadeSpeed(), false);
    }
    this.menuCalling = false;
};

Scene_Map.prototype.stop = function() {
    Scene_MenuBase.prototype.stop.call(this);
    $gamePlayer.straighten();
    this._mapNameWindow.close();
    this._ningjingWindow.close();
    if (this.needsSlowFadeOut()) {
        this.startFadeOut(this.slowFadeSpeed(), false);
    } else if (SceneManager.isNextScene(Scene_Map)) {
        this.fadeOutForTransfer();
    } else if (SceneManager.isNextScene(Scene_Battle)) {
        this.launchBattle();
    }
};
Scene_Map.prototype.terminate = function() {
    Scene_MenuBase.prototype.terminate.call(this);
    if (!SceneManager.isNextScene(Scene_Battle)) {
        this._spriteset.update();
        this._mapNameWindow.hide();
        this._ningjingWindow.hide();
        SceneManager.snapForBackground();
    }
    $gameScreen.clearZoom();
};
Scene_Map.prototype.createDisplayObjects = function() {
    this.createSpriteset();
    this.createMapNameWindow();
    this.createNingJingWindow();
    this.createWindowLayer();
    this.createAllWindows();
};
Scene_Map.prototype.createNingJingWindow = function(){
    this._ningjingWindow = new Window_Testing(550,580,260,40);
    this.addChild(this._ningjingWindow);
};

Scene_Map.prototype.callMenu = function() {
    SoundManager.playOk();
    SceneManager.push(Scene_Menu);
    Window_MenuCommand.initCommandPosition();
    $gameTemp.clearDestination();
    this._ningjingWindow.hide();
    this._mapNameWindow.hide();
    this._waitCount = 2;
};
Scene_Map.prototype.launchBattle = function() {
    BattleManager.saveBgmAndBgs();
    this.stopAudioOnBattleStart();
    SoundManager.playBattleStart();
    this.startEncounterEffect();
    this._ningjingWindow.hide();
    this._mapNameWindow.hide();
};

function Window_Testing() {
    this.initialize.apply(this, arguments);
}
Window_Testing.prototype = Object.create(Window_Base.prototype);
Window_Testing.prototype.initialize = function(x, y, width, height) {
    Window_Base.prototype.initialize.call(this, x, y, width, height);
    this.contents.fontSize = 20;
}

Window_Testing.prototype.standardPadding = function() {
    return 8;
};

Window_Testing.prototype.update = function() {
    Window_Base.prototype.update.call(this);
               
        if ($gameVariables.value(1)==0){
                $gameVariables._data[1]=1
                $gameVariables._data[2]=1
                $gameVariables._data[3]=1
                $gameVariables._data[4]=1
        }else if($gameVariables.value(5)>=4){
                $gameVariables._data[5]-=4
                $gameVariables._data[4]+=1
        }else if($gameVariables.value(4)>=25){
                $gameVariables._data[4]-=24
                $gameVariables._data[3]+=1
        }else if($gameVariables.value(3)>=31){
                $gameVariables._data[3]-=30
                $gameVariables._data[2]+=1
        }else if($gameVariables.value(2)>=13){
                $gameVariables._data[2]-=12
                $gameVariables._data[1]+=1
        }
    var textW = 270;
    var textH = 0;
    this.contents.clear();
    this.drawText($gameVariables.value(1) + "年", -180, -6, textW, 'right');
    textH += this.lineHeight();
    this.drawText($gameVariables.value(2) + "月", -130, -6, textW, 'right');
    textH += this.lineHeight();
    this.drawText($gameVariables.value(3) + "日", -80, -6, textW, 'right');
    textH += this.lineHeight();
    this.drawText($gameVariables.value(4) + "时", -30, -6, textW, 'right');
    textH += this.lineHeight();
};

评分

参与人数 1游戏票 +20 收起 理由
像素蜗牛 + 20 赞一个!

查看全部评分

12

主题

0

精华

21

好友

管理员

通往异世界的梦想

Rank: 32Rank: 32Rank: 32Rank: 32Rank: 32Rank: 32Rank: 32Rank: 32

贡献度
0 点
知名度
436 点
存在感
1261 次
游戏票
260.00 张
支持票
0 张
帖子
110
精华
0
在线时间
883 小时
QQ
板凳
发表于 2016-6-6 17:53:11 | 只看该作者
请上传一下文件,后面会改版网站,加入插件演示和下载的模块

点评

好的,最近一直没上来呢……  详情 回复 发表于 2016-8-11 11:45
想要创造世界吗?想让你创造的世界给别人看看吗?
红狼帮你实现梦想!无需编程,业余人士也可在线制作出精品游戏大作!

4

主题

0

精华

1

好友

版主

Rank: 24Rank: 24Rank: 24Rank: 24Rank: 24Rank: 24

贡献度
0 点
知名度
22 点
存在感
177 次
游戏票
188.00 张
支持票
7 张
帖子
34
精华
0
在线时间
28 小时
地板
 楼主| 发表于 2016-8-11 11:45:20 | 只看该作者
kds 发表于 2016-6-6 17:53
请上传一下文件,后面会改版网站,加入插件演示和下载的模块

好的,最近一直没上来呢……

0

主题

0

精华

0

好友

初入红狼

Rank: 1

贡献度
0 点
知名度
0 点
存在感
47 次
游戏票
0.00 张
支持票
0 张
帖子
26
精华
0
在线时间
1 小时
5#
发表于 2018-7-24 01:15:49 | 只看该作者
感谢楼主,这边受益匪浅
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋| 红狼游戏中心  

Copyright © 2015-2099 kdsrpg All Rights Reserved.

Powered by Discuz! X3.2( 赣ICP备14010678号 )

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