コード例 #1
0
 internal void OnSceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, object[] args)
 {
     Scene scene = info.SceneContext.CustomData as Scene;
       if (null != scene) {
     scene.StorySystem.SendMessage(msgId, args);
       }
 }
コード例 #2
0
 protected void SceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, params object[] args)
 {
     if (null != OnSceneLogicSendStoryMessage)
     {
         OnSceneLogicSendStoryMessage(info, msgId, args);
     }
 }
コード例 #3
0
        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);
                }
            }
        }
コード例 #4
0
 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);
         }
     }
 }
コード例 #5
0
 private void RecycleSceneLogicInfo(SceneLogicInfo logicInfo)
 {
     if (null != logicInfo && m_UnusedSceneLogicInfos.Count < m_SceneLogicInfoPoolSize)
     {
         logicInfo.Reset();
         m_UnusedSceneLogicInfos.Enqueue(logicInfo);
     }
 }
コード例 #6
0
        public void DestroySceneLogicByConfigId(int configId)
        {
            SceneLogicInfo info = m_SceneLogicInfoMgr.GetSceneLogicInfoByConfigId(configId);

            if (null != info)
            {
                m_SceneLogicInfoMgr.RemoveSceneLogicInfo(info.GetId());
            }
        }
コード例 #7
0
        public SceneLogicInfo DelayAddSceneLogicInfo(int id, SceneLogicConfig cfg)
        {
            SceneLogicInfo info = NewSceneLogicInfo(id);

            info.SceneContext     = m_SceneContext;
            info.SceneLogicConfig = cfg;
            m_DelayAdd.Add(info);
            return(info);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        internal void OnSceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, object[] args)
        {
            Scene scene = info.SceneContext.CustomData as Scene;

            if (null != scene)
            {
                scene.StorySystem.SendMessage(msgId, args);
            }
        }
コード例 #10
0
        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);
        }
コード例 #11
0
        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);
        }
コード例 #12
0
        public void RemoveSceneLogicInfo(int id)
        {
            SceneLogicInfo info = GetSceneLogicInfo(id);

            if (null != info)
            {
                m_SceneLogicInfos.Remove(id);
                info.SceneContext = null;
                RecycleSceneLogicInfo(info);
            }
        }
コード例 #13
0
        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);
        }
コード例 #14
0
 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));
     }
 }
コード例 #15
0
 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));
     }
 }
コード例 #16
0
 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));
     }
 }
コード例 #17
0
 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));
     }
 }
コード例 #18
0
 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));
     }
 }
コード例 #19
0
        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);
        }
コード例 #20
0
 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));
     }
 }
コード例 #21
0
        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);
        }
コード例 #22
0
        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);
        }
コード例 #23
0
        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);
        }
コード例 #24
0
 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);
     }
       }
 }
コード例 #25
0
 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();
     }
 }
コード例 #26
0
        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);
            }
              }
        }
コード例 #27
0
        internal SceneLogicInfo GetSceneLogicInfo(int id)
        {
            SceneLogicInfo info = m_SceneLogicInfoManager.GetSceneLogicInfo(id);

            return(info);
        }
コード例 #28
0
 internal void OnSceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, object[] args)
 {
     GfxStorySystem.Instance.SendMessage(msgId, args);
 }
コード例 #29
0
        public SceneLogicInfo GetSceneLogicInfoByConfigId(int configId)
        {
            SceneLogicInfo info = m_SceneLogicInfoMgr.GetSceneLogicInfoByConfigId(configId);

            return(info);
        }
コード例 #30
0
        public SceneLogicInfo GetSceneLogicInfo(int id)
        {
            SceneLogicInfo info = m_SceneLogicInfoMgr.GetSceneLogicInfo(id);

            return(info);
        }
コード例 #31
0
 internal void OnSceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, object[] args)
 {
     GfxStorySystem.Instance.SendMessage(msgId, args);
 }
コード例 #32
0
 public abstract void Execute(SceneLogicInfo info, long deltaTime);
コード例 #33
0
 private void RecycleSceneLogicInfo(SceneLogicInfo logicInfo)
 {
     if (null != logicInfo && m_UnusedSceneLogicInfos.Count < m_SceneLogicInfoPoolSize) {
         logicInfo.Reset();
         m_UnusedSceneLogicInfos.Enqueue(logicInfo);
     }
 }
コード例 #34
0
 public abstract void Execute(SceneLogicInfo info, long deltaTime);
コード例 #35
0
 protected void SceneLogicSendStoryMessage(SceneLogicInfo info, string msgId, params object[] args)
 {
     if (null != OnSceneLogicSendStoryMessage) {
     OnSceneLogicSendStoryMessage(info, msgId, args);
       }
 }
コード例 #36
0
        internal SceneLogicInfo GetSceneLogicInfoByConfigId(int configId)
        {
            SceneLogicInfo info = m_SceneLogicInfoManager.GetSceneLogicInfoByConfigId(configId);

            return(info);
        }
コード例 #37
0
 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;
 }