public void Update(long delta) { if (_currentOperate?.Update(delta) == false) { _currentOperate = null; ++_curExeOperateIndex; } }
public void GotoAddress(int address) { _curExeOperateIndex = _mapAddrOffsetIndex[address - _headerLength]; if (_currentOperate != null) { // 不在Operate.process()中调用的gotoAddress _currentOperate = null; --_curExeOperateIndex; } else { // 在Operate.process()中调用的gotoAddress // loong TODO: why? ScriptProcess.EnableExecuteScript = false; // mark 下次调用process再执行 } ScriptProcess.ScriptRunning = true; }
/// <summary> /// 触发地图事件,场景切换,NPC对话,开宝箱等 /// 返回是否成功触发 /// </summary> /// <param name="eventId">事件ID</param> /// <returns></returns> public bool TriggerEvent(int eventId) { if (eventId > _eventIndex.Count) { Stop(); return(false); } int index = _eventIndex[eventId - 1]; if (index != -1) { _curExeOperateIndex = index; _currentOperate = null; Start(); return(true); } Stop(); return(false); }
public void Process() { if (_currentOperate == null) { while (_curExeOperateIndex < _commands.Count && ScriptProcess.EnableExecuteScript) { var cmd = _commands[_curExeOperateIndex]; _currentOperate = cmd.Process(); if (_currentOperate != null) { // 执行 update draw return; } if (!ScriptProcess.EnableExecuteScript) { ScriptProcess.EnableExecuteScript = true; return; } ++_curExeOperateIndex; } // 正常情况不回执行到这里,脚本最后一句是callback } }