static public int GetMessageTriggerTime(IntPtr l) { try { StorySystem.StoryInstance self = (StorySystem.StoryInstance)checkSelf(l); System.String a1; checkType(l, 2, out a1); var ret = self.GetMessageTriggerTime(a1); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
protected override bool ExecCommand(StoryInstance instance, long delta) { bool ret = false; Scene scene = instance.Context as Scene; if (null != scene) { if (m_StartTime <= 0) { long startTime = GameFramework.TimeUtility.GetLocalMilliseconds(); m_StartTime = startTime; } bool triggered = false; for (int i = 0; i < m_MsgIds.Count; i++) { long time = instance.GetMessageTriggerTime(m_MsgIds[i].Value); if (time > m_StartTime) { triggered = true; break; } } if (triggered) { string varName = m_SetVar.Value; object varVal = m_SetVal.Value; instance.SetVariable(varName, varVal); } else { int timeout = m_TimeoutVal.Value; int curTime = m_CurTime; m_CurTime += (int)delta; if (timeout <= 0 || curTime <= timeout) { ret = true; } else { string varName = m_TimeoutSetVar.Value; object varVal = m_TimeoutSetVal.Value; instance.SetVariable(varName, varVal); } } } return ret; }