| 
 1206| 6
 | [有事请教] 请问如何在变量改变时自动为另一个变量赋值 | 
| 
10星屑 
 最佳答案Game_Variables.prototype.setValue = function(variableId, value) {
    if (variableId > 0 && variableId < $dataSystem.variables.length) {
        if (typeof value === 'number') {
            value = Math.floor(value);
        }
        this._data[variableId] = value;
        if (variableId === 114) this._data[514] = value * 2 - 1; // 本行为新增内容
        this.onChange();
    } // 本行为 rpg_objec ... | ||
| 比较健康 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 
 | ||
| 比较健康 | ||
| 
 点评
当然可以了,注意到onChange()是最后执行的啊~ 
 | ||
| 比较健康 | ||
站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作
GMT+8, 2025-10-31 10:28
Powered by Discuz! X3.1
© 2001-2013 Comsenz Inc.