internal void OnSceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, object[] args) { Scene scene = info.SceneContext.CustomData as Scene; if (null != scene) { scene.StorySystem.SendMessage(msgId, args); } }
protected void SceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, params object[] args) { if (null != OnSceneLogicSendStoryMessage) { OnSceneLogicSendStoryMessage(info, msgId, args); } }
public override void Execute(SceneLogicInfo info, long deltaTime) { if (null == info || info.IsLogicFinished || info.IsLogicPaused) { return; } info.Time += deltaTime; if (info.Time > 1000) { TimeoutLogicInfo data = info.LogicDatas.GetData <TimeoutLogicInfo>(); if (null == data) { data = new TimeoutLogicInfo(); info.LogicDatas.AddData <TimeoutLogicInfo>(data); SceneLogicConfig sc = info.SceneLogicConfig; if (null != sc) { data.m_Timeout = long.Parse(sc.m_Params[0]); } } data.m_CurTime += info.Time; info.Time = 0; //执行逻辑 if (null != data && !data.m_IsTriggered && data.m_CurTime >= data.m_Timeout) { data.m_IsTriggered = true; SceneLogicSendStoryMessage(info, "timeout:" + info.ConfigId, data.m_Timeout); } } }
public override void Execute(SceneLogicInfo info, long deltaTime) { if (null == info || info.IsLogicFinished || info.IsLogicPaused) { return; } info.Time += deltaTime; if (info.Time >= 1000) { info.Time = 0; SandClockLogicInfo data = info.LogicDatas.GetData <SandClockLogicInfo>(); if (null == data) { data = new SandClockLogicInfo(); info.LogicDatas.AddData <SandClockLogicInfo>(data); } //执行逻辑 DateTime time = DateTime.Now; if (null != data && (time.Hour != data.m_LastHour || time.Minute != data.m_LastMinute)) { data.m_LastHour = time.Hour; data.m_LastMinute = time.Minute; SceneLogicSendStoryMessage(info, "sandclock:" + info.ConfigId, time.Day, (int)time.DayOfWeek, time.Hour, time.Minute); } } }
private void RecycleSceneLogicInfo(SceneLogicInfo logicInfo) { if (null != logicInfo && m_UnusedSceneLogicInfos.Count < m_SceneLogicInfoPoolSize) { logicInfo.Reset(); m_UnusedSceneLogicInfos.Enqueue(logicInfo); } }
public void DestroySceneLogicByConfigId(int configId) { SceneLogicInfo info = m_SceneLogicInfoMgr.GetSceneLogicInfoByConfigId(configId); if (null != info) { m_SceneLogicInfoMgr.RemoveSceneLogicInfo(info.GetId()); } }
public SceneLogicInfo DelayAddSceneLogicInfo(int id, SceneLogicConfig cfg) { SceneLogicInfo info = NewSceneLogicInfo(id); info.SceneContext = m_SceneContext; info.SceneLogicConfig = cfg; m_DelayAdd.Add(info); return(info); }
public SceneLogicInfo AddSceneLogicInfo(int id, SceneLogicConfig cfg) { SceneLogicInfo info = NewSceneLogicInfo(id); info.SceneContext = m_SceneContext; info.SceneLogicConfig = cfg; m_SceneLogicInfos.AddLast(info.GetId(), info); return(info); }
public SceneLogicInfo DelayAddSceneLogicInfo(int logicId) { SceneLogicInfo info = NewSceneLogicInfo(); info.SceneContext = m_SceneContext; info.SceneLogicConfig = new SceneLogicConfig(); info.SceneLogicConfig.m_LogicId = logicId; m_DelayAdd.Add(info); return(info); }
public SceneLogicInfo AddSceneLogicInfo(int logicId) { SceneLogicInfo info = NewSceneLogicInfo(); info.SceneContext = m_SceneContext; info.SceneLogicConfig = new SceneLogicConfig(); info.SceneLogicConfig.m_LogicId = logicId; m_SceneLogicInfos.AddLast(info.GetId(), info); return(info); }
public void RemoveSceneLogicInfo(int id) { SceneLogicInfo info = GetSceneLogicInfo(id); if (null != info) { m_SceneLogicInfos.Remove(id); info.SceneContext = null; RecycleSceneLogicInfo(info); } }
public SceneLogicInfo CreateSceneLogic(int infoId, int configId, int logicId, params string[] args) { SceneLogicConfig cfg = new SceneLogicConfig(); cfg.m_ConfigId = configId; cfg.m_LogicId = logicId; cfg.m_Params = args; SceneLogicInfo logicInfo = m_SceneLogicInfoMgr.AddSceneLogicInfo(infoId, cfg); return(logicInfo); }
static public int get_ConfigId(IntPtr l) { try { GameFramework.SceneLogicInfo self = (GameFramework.SceneLogicInfo)checkSelf(l); pushValue(l, true); pushValue(l, self.ConfigId); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int Reset(IntPtr l) { try { GameFramework.SceneLogicInfo self = (GameFramework.SceneLogicInfo)checkSelf(l); self.Reset(); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int GetId(IntPtr l) { try { GameFramework.SceneLogicInfo self = (GameFramework.SceneLogicInfo)checkSelf(l); var ret = self.GetId(); pushValue(l, true); pushValue(l, ret); return(2); } catch (Exception e) { return(error(l, e)); } }
static public int set_DataId(IntPtr l) { try { GameFramework.SceneLogicInfo self = (GameFramework.SceneLogicInfo)checkSelf(l); int v; checkType(l, 2, out v); self.DataId = v; pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
static public int InitId(IntPtr l) { try { GameFramework.SceneLogicInfo self = (GameFramework.SceneLogicInfo)checkSelf(l); System.Int32 a1; checkType(l, 2, out a1); self.InitId(a1); pushValue(l, true); return(1); } catch (Exception e) { return(error(l, e)); } }
public SceneLogicInfo GetSceneLogicInfoByConfigId(int id) { SceneLogicInfo ret = null; for (LinkedListNode <SceneLogicInfo> linkNode = m_SceneLogicInfos.FirstNode; null != linkNode; linkNode = linkNode.Next) { SceneLogicInfo info = linkNode.Value; if (info.ConfigId == id) { ret = info; break; } } return(ret); }
static public int constructor(IntPtr l) { try { GameFramework.SceneLogicInfo o; System.Int32 a1; checkType(l, 2, out a1); o = new GameFramework.SceneLogicInfo(a1); pushValue(l, true); pushValue(l, o); return(2); } catch (Exception e) { return(error(l, e)); } }
public int CreateSceneLogic(int configId, int logicId, params string[] args) { int id = 0; SceneLogicConfig cfg = new SceneLogicConfig(); cfg.m_ConfigId = configId; cfg.m_LogicId = logicId; cfg.m_Params = args; SceneLogicInfo logicInfo = m_SceneLogicInfoMgr.AddSceneLogicInfo(cfg); if (null != logicInfo) { id = logicInfo.GetId(); } return(id); }
private SceneLogicInfo NewSceneLogicInfo(int id) { SceneLogicInfo info = null; if (m_UnusedSceneLogicInfos.Count > 0) { info = m_UnusedSceneLogicInfos.Dequeue(); info.Reset(); info.InitId(id); } else { info = new SceneLogicInfo(id); } return(info); }
public SceneLogicInfo AddSceneLogicInfo(int id, int logicId) { SceneLogicInfo info = NewSceneLogicInfo(id); info.SceneContext = m_SceneContext; info.SceneLogicConfig = new SceneLogicConfig(); info.SceneLogicConfig.m_LogicId = logicId; SceneLogicInfo oldInfo; if (m_SceneLogicInfos.TryGetValue(id, out oldInfo)) { LogSystem.Error("AddSceneLogicInfo error, Id={0} was exist, LogicId={1}, NewLogicId={2}", id, oldInfo.LogicId, logicId); } m_SceneLogicInfos.AddLast(info.GetId(), info); return(info); }
public override void Execute(SceneLogicInfo info, long deltaTime) { if (null == info || info.IsLogicFinished || info.IsLogicPaused) return; info.Time += deltaTime; if (info.Time >= 1000) { info.Time = 0; SandClockLogicInfo data = info.LogicDatas.GetData<SandClockLogicInfo>(); if (null == data) { data = new SandClockLogicInfo(); info.LogicDatas.AddData<SandClockLogicInfo>(data); } //执行逻辑 DateTime time = DateTime.Now; if (null != data && (time.Hour != data.m_LastHour || time.Minute != data.m_LastMinute)) { data.m_LastHour = time.Hour; data.m_LastMinute = time.Minute; SceneLogicSendStoryMessage(info, "sandclock:" + info.ConfigId, time.Day, (int)time.DayOfWeek, time.Hour, time.Minute); } } }
public void Tick() { if (null == m_SceneLogicInfoMgr) { return; } if (0 == m_LastTickTime) { m_LastTickTime = TimeUtility.GetLocalMilliseconds(); } else { long delta = TimeUtility.GetLocalMilliseconds() - m_LastTickTime; m_LastTickTime = TimeUtility.GetLocalMilliseconds(); for (LinkedListNode <SceneLogicInfo> node = m_SceneLogicInfoMgr.SceneLogicInfos.FirstNode; null != node; node = node.Next) { SceneLogicInfo info = node.Value; if (null != info) { ISceneLogic logic = SceneLogicManager.Instance.GetSceneLogic(info.LogicId); if (null != logic) { logic.Execute(info, delta); } if (info.IsLogicFinished) { m_SceneLogicInfos.Add(info); } } } for (int i = 0; i < m_SceneLogicInfos.Count; i++) { m_SceneLogicInfoMgr.RemoveSceneLogicInfo(m_SceneLogicInfos[i].GetId()); } m_SceneLogicInfos.Clear(); m_SceneLogicInfoMgr.ExecuteDelayAdd(); } }
public override void Execute(SceneLogicInfo info, long deltaTime) { if (null == info || info.IsLogicFinished || info.IsLogicPaused) return; info.Time += deltaTime; if (info.Time > 1000) { TimeoutLogicInfo data = info.LogicDatas.GetData<TimeoutLogicInfo>(); if (null == data) { data = new TimeoutLogicInfo(); info.LogicDatas.AddData<TimeoutLogicInfo>(data); SceneLogicConfig sc = info.SceneLogicConfig; if (null != sc) { data.m_Timeout = long.Parse(sc.m_Params[0]); } } data.m_CurTime += info.Time; info.Time = 0; //执行逻辑 if (null != data && !data.m_IsTriggered && data.m_CurTime >= data.m_Timeout) { data.m_IsTriggered = true; SceneLogicSendStoryMessage(info, "timeout:" + info.ConfigId, data.m_Timeout); } } }
internal SceneLogicInfo GetSceneLogicInfo(int id) { SceneLogicInfo info = m_SceneLogicInfoManager.GetSceneLogicInfo(id); return(info); }
internal void OnSceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, object[] args) { GfxStorySystem.Instance.SendMessage(msgId, args); }
public SceneLogicInfo GetSceneLogicInfoByConfigId(int configId) { SceneLogicInfo info = m_SceneLogicInfoMgr.GetSceneLogicInfoByConfigId(configId); return(info); }
public SceneLogicInfo GetSceneLogicInfo(int id) { SceneLogicInfo info = m_SceneLogicInfoMgr.GetSceneLogicInfo(id); return(info); }
public abstract void Execute(SceneLogicInfo info, long deltaTime);
internal SceneLogicInfo GetSceneLogicInfoByConfigId(int configId) { SceneLogicInfo info = m_SceneLogicInfoManager.GetSceneLogicInfoByConfigId(configId); return(info); }
private SceneLogicInfo NewSceneLogicInfo(int id) { SceneLogicInfo info = null; if (m_UnusedSceneLogicInfos.Count > 0) { info = m_UnusedSceneLogicInfos.Dequeue(); info.Reset(); info.InitId(id); } else { info = new SceneLogicInfo(id); } return info; }