From ffbf527892660faf266458a756a58698bc3497c0 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sat, 4 Jul 2020 20:11:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=B9=B3=E6=BB=91=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E9=95=9C=E5=A4=B4=E6=8F=92=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/table/plugins.comment.js | 6 -- project/plugins.js | 120 ------------------------------- 2 files changed, 126 deletions(-) diff --git a/_server/table/plugins.comment.js b/_server/table/plugins.comment.js index e19c11ff..c9e37646 100644 --- a/_server/table/plugins.comment.js +++ b/_server/table/plugins.comment.js @@ -75,12 +75,6 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_range": "typeof(thiseval)=='string' || thiseval==null", "_data": "物品分类插件" }, - "smoothCamera": { - "_leaf": true, - "_type": "textarea", - "_range": "typeof(thiseval)=='string' || thiseval==null", - "_data": "平滑移动镜头" - }, } if (obj[key]) return obj[key]; return { diff --git a/project/plugins.js b/project/plugins.js index c47994b6..95168369 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -1258,125 +1258,5 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = return true; }, 100); -}, - "smoothCamera": function () { - // 此插件开启后,大地图的瞬间移动将开启平滑镜头移动,避免突兀感 - // 插件作者:老黄鸡 - - // 是否启用本插件,默认不启用 - var __enable = false; - if (!__enable) return; - - this.Camera = function () { - - // 下面这个变量决定本插件的开关 - // 你可以在游戏中使用core.setFlag('smoothCamera',false)来关闭本插件的功能 - // 同时也可以core.setFlag('smoothCamera',true)重新开启 - // 此项默认为true - // - this.__switchName = 'smoothCamera'; - - // 初始化成员变量 - this._cameraNeedRefresh = true; - this._nowOffsetX = 0; - this._nowOffsetY = 0; - this._targetOffsetX = 0; - this._targetOffsetY = 0; - this._currentFloorId = null; - - // 重置镜头,在楼层变更时使用 - this.resetCamera = function () { - this._targetOffsetX = core.bigmap.offsetX; - this._targetOffsetY = core.bigmap.offsetY; - this._nowOffsetX = this._targetOffsetX; - this._nowOffsetY = this._targetOffsetY; - this._cameraNeedRefresh = true; - }; - - // 设置焦点坐标,目前没有用 - this.setTarget = function (x, y) { - this._targetOffsetX = x; - this._targetOffsetY = y; - }; - - // 请求镜头更新 - this.requestCameraUpdate = function () { - this._cameraNeedRefresh = true; - }; - - // 更新焦点坐标,目前仅根据大地图偏移决定 - this.updateTargetPosition = function () { - this._targetOffsetX = core.bigmap.offsetX; - this._targetOffsetY = core.bigmap.offsetY; - }; - - // 更新额外的刷新条件,即镜头未指向焦点时 - this.updateRefreshFlag = function () { - if (this._nowOffsetX != this._targetOffsetX || this._nowOffsetY != this._targetOffsetY) { - this._cameraNeedRefresh = true; - } - }; - - // 判断是否禁止了弹性滚动 - this.canDirectMove = function () { - return !core.getFlag(this.__switchName, true); - }; - - // 更新镜头坐标 - this.updateCameraPosition = function () { - if (this._cameraNeedRefresh) { - this._cameraNeedRefresh = false; - var disX = this._targetOffsetX - this._nowOffsetX; - var disY = this._targetOffsetY - this._nowOffsetY; - if (Math.abs(disX) <= 2 && Math.abs(disY) <= 2 || this.canDirectMove()) { - this._nowOffsetX = this._targetOffsetX; - this._nowOffsetY = this._targetOffsetY; - } else { - this._nowOffsetX += disX / 10; - this._nowOffsetY += disY / 10; - } - var x = -Math.floor(this._nowOffsetX); - var y = -Math.floor(this._nowOffsetY); - core.bigmap.canvas.forEach(function (cn) { - core.control.setGameCanvasTranslate(cn, x, y); - }); - core.relocateCanvas('route', core.status.automaticRoute.offsetX + x, core.status.automaticRoute.offsetY + y); - core.setGameCanvasTranslate('hero', x + this._targetOffsetX, y + this._targetOffsetY); - } - }; - - // 更新逻辑主体 - this.update = function () { - this.updateTargetPosition(); - this.updateRefreshFlag(); - this.updateCameraPosition(); - }; - }; - - // 创建摄像机对象 - this.camera = new this.Camera(); - - // 帧事件 更新摄像机 - this.updateCameraEx = function () { - this.camera.update(); - }; - - core.control._drawHero_updateViewport = function () { - core.control.updateViewport(); - } - - // 代理原本的镜头事件 - core.control.updateViewport = function () { - core.plugin.camera.requestCameraUpdate(); - }; - - // 更变楼层的行为追加,重置镜头 - core.events.changingFloor = function (floorId, heroLoc) { - this.eventdata.changingFloor(floorId, heroLoc); - core.plugin.camera.resetCamera(); - }; - - // 注册帧事件 - core.registerAnimationFrame('smoothCameraFlash', true, this.updateCameraEx.bind(this)); } } \ No newline at end of file