加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 1101340379 于 2025-5-11 21:59 编辑
用deepseek进行了多次尝试,现已兼容SAN_AnalogMove 3.1.5版本。
直接在Ryusa_FootstepSE插件的代码底部进行替换。
把Ryusa_FootstepSE插件放置在下方。
// Sanshiro 的 Analog Move 兼容补丁 //----------------------------------------------------------------------------- if (Imported.SAN_AnalogMove && Ryusa_Footstep_SE._analogmove_patch) { // 保存原始方法 var _Game_Player_updateAnalogMove = Game_Player.prototype.updateAnalogMove; // 重写updateAnalogMove方法 Game_Player.prototype.updateAnalogMove = function() { _Game_Player_updateAnalogMove.call(this); if (!Ryusa_Footstep_SE.enable() || !this.canMove()) return; // 初始化计数器 this._footstepCounter = this._footstepCounter || 0; // 获取移动距离 var movedDistance = this._mover ? this._mover.distanceMoved() : 0; movedDistance = Math.max(0, Math.min(movedDistance, 1)); // 限制在0-1之间 // 如果正在移动 if (this.isMoving() && movedDistance > 0) { // 更新步数计数器 this._footstepCounter += movedDistance; // 根据是否冲刺决定步频 var stepThreshold = this.isDashing() ? (1 / Ryusa_Footstep_SE._dashing_hotfix) : (1 / Ryusa_Footstep_SE._walking_hotfix); // 当累计步数超过阈值时播放声音 while (this._footstepCounter >= stepThreshold) { Ryusa_Footstep_SE.play(); this._footstepCounter -= stepThreshold; } } else { this._footstepCounter = 0; } }; // 确保计数器初始化 var _Game_Player_initMembers = Game_Player.prototype.initMembers; Game_Player.prototype.initMembers = function() { _Game_Player_initMembers.call(this); this._footstepCounter = 0; }; }
// Sanshiro 的 Analog Move 兼容补丁
//-----------------------------------------------------------------------------
if (Imported.SAN_AnalogMove && Ryusa_Footstep_SE._analogmove_patch) {
// 保存原始方法
var _Game_Player_updateAnalogMove = Game_Player.prototype.updateAnalogMove;
// 重写updateAnalogMove方法
Game_Player.prototype.updateAnalogMove = function() {
_Game_Player_updateAnalogMove.call(this);
if (!Ryusa_Footstep_SE.enable() || !this.canMove()) return;
// 初始化计数器
this._footstepCounter = this._footstepCounter || 0;
// 获取移动距离
var movedDistance = this._mover ? this._mover.distanceMoved() : 0;
movedDistance = Math.max(0, Math.min(movedDistance, 1)); // 限制在0-1之间
// 如果正在移动
if (this.isMoving() && movedDistance > 0) {
// 更新步数计数器
this._footstepCounter += movedDistance;
// 根据是否冲刺决定步频
var stepThreshold = this.isDashing() ?
(1 / Ryusa_Footstep_SE._dashing_hotfix) :
(1 / Ryusa_Footstep_SE._walking_hotfix);
// 当累计步数超过阈值时播放声音
while (this._footstepCounter >= stepThreshold) {
Ryusa_Footstep_SE.play();
this._footstepCounter -= stepThreshold;
}
} else {
this._footstepCounter = 0;
}
};
// 确保计数器初始化
var _Game_Player_initMembers = Game_Player.prototype.initMembers;
Game_Player.prototype.initMembers = function() {
_Game_Player_initMembers.call(this);
this._footstepCounter = 0;
};
}
|