查看: 3286|回复: 3

[原创发布] 通用(狂野)游戏加速代码

[复制链接]
梦石
0
星屑
3486
在线时间
294 小时
注册时间
2020-1-27
回帖
180
发表于 2020-2-29 11:59:17 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 zths 于 2020-2-29 13:06 编辑

对付没有加速跳过的游戏的神器。(针对玩家)
对所有状态生效:包括但不限于 行走 战斗 对话
原理是加倍调用Scene 和 Window 的 update方法。。
理论上对各种插件的游戏均能有效兼容。。

使用方法是 下面代码丢到index.html里。
然后在游戏里按下ctrl即可加速

配置:updateMainMultiply_Multiply  是加倍数 默认1
updateMainMultiply_MultiplyActiveKey  是 激活KeyCode 默认17(Ctrl)
AlwaysMulti  是 总是加速 默认 false
pauseSence 是 暂停游戏 默认 false(俺寻思单独没用)。。。。

由于每秒调用10次 可能会对性能有影响?(应该不会)

[pre lang="html"]<script>
keys = {};
function isKeyPressed(kc){
        if(typeof(kc) == "undefined"){
                return false
        }
        return keys[kc] === true
}
if(typeof(handleWkd) == "undefined"){
    handleWkd = true
    jQuery(window).on("keydown",function(ev) {
        keys[ev.keyCode] = true;
    });
    jQuery(window).on("keyup",function(ev) {
        keys[ev.keyCode] = false;
    });
}
AlwaysMulti = false
pauseSence = false
updateMainMultiply_Multiply = 1
updateMainMultiply_MultiplyActiveKey  = 17
function SceneHook(){
    if(typeof updateMainMultiply_Multiply === "undefined"){updateMainMultiply_Multiply = 1;}
    if(typeof AlwaysMulti === "undefined"){AlwaysMulti = false;}
    if(typeof pauseSence === "undefined"){pauseSence = false;}
    if(typeof SceneManager === "undefined"){return;}
    if(typeof SceneManager._scene === "undefined"){return;}
        if(typeof SceneManager._scene.update === "undefined"){return;}
    if(typeof SceneManager._scene.updateBk === "undefined"){
        SceneManager._scene.updateBk = SceneManager._scene.update
    }
    SceneManager._scene.update = function(){
                if(pauseSence){return;}
        if(isKeyPressed(updateMainMultiply_MultiplyActiveKey) || AlwaysMulti){
            for(var i=0;i<updateMainMultiply_Multiply;i++){
                this.updateBk.apply(this,arguments);
            }
        }
        return this.updateBk.apply(this,arguments);
    }
        if(typeof SceneManager._scene._windowLayer === "undefined"){return;}
        if(typeof SceneManager._scene._windowLayer.children === "undefined"){return;}
        if(typeof SceneManager._scene._windowLayer.children.length === "undefined"){return;}
    for(var i=0;i<SceneManager._scene._windowLayer.children.length;i++){
        if(
            SceneManager._scene._windowLayer.children
            && typeof SceneManager._scene._windowLayer.children.update !== "undefined"
            && typeof SceneManager._scene._windowLayer.children.updateBk === "undefined"
        ){
            SceneManager._scene._windowLayer.children.updateBk = SceneManager._scene._windowLayer.children.update
        }
        SceneManager._scene._windowLayer.children.update = function(){
                        if(pauseSence){return;}
            if(isKeyPressed(updateMainMultiply_MultiplyActiveKey) || AlwaysMulti){
                for(var i=0;i<updateMainMultiply_Multiply;i++){
                    this.updateBk.apply(this,arguments);
                }
            }
            return this.updateBk.apply(this,arguments);
        }
    }
}
if(typeof SceneHookInv !== "undefined"){
    clearInterval(SceneHookInv);
}
SceneHookInv = setInterval(SceneHook,100);</script>[/pre]
梦石
0
星屑
25359
在线时间
1136 小时
注册时间
2019-3-5
回帖
1303
发表于 2020-3-3 18:28:48 | 显示全部楼层
约等于变数齿轮?
回复

使用道具 举报

梦石
0
星屑
15295
在线时间
720 小时
注册时间
2011-7-16
回帖
1373

开拓者

发表于 2020-3-3 18:51:31 | 显示全部楼层
牛,好东西呀,会不会手机发烫?
RMMV网络插件,开源免费,内含服务器端,无需强制登录,云数据,弹幕,云存档,排名,兑换码,版本检测,可自由上架下架删除。q群399090587
免打包运行MV游戏,云游戏,安卓App雷神游戏厅,在线玩游戏,上传下载游戏
开源游戏:重装机兵之重装归来【RMMV制作】全球首款按照美剧分季分集的方式发布的游戏
体素画 -- MV画3D像素图的画板
RMMV显示3D模型和场景的插件
RMMV显示spine骨骼动画的插件
RMMV秘密通道插件
突破敌群数量上限8个的插件
在rmmv中显示gif动态图片的插件
一款可以在mv游戏界面的任意位置显示任意文字的插件
RMMV Toast 插件 带物品得失提示,可以设置开启关闭 兼容yep itemcore
制作一个改名卡道具插件、调整标题页面菜单的插件、在标题页面之前显示大段文字的插件、标题页面显示版本号的插件
物品得失自动提示自动上色自动换行插件
我的Q群 663889472
另外,我的插件、范例、游戏都在这里
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部