GetLocalMicroseconds() public static method

public static GetLocalMicroseconds ( ) : long
return long
 internal void Tick()
 {
     try {
         int  ct      = m_SkillLogicInfos.Count;
         long curTime = TimeUtility.GetLocalMicroseconds();
         if (m_LastTickTime <= 0)
         {
             m_LastTickTime = curTime;
             return;
         }
         long delta = curTime - m_LastTickTime;
         m_LastTickTime = curTime;
         for (int ix = ct - 1; ix >= 0; --ix)
         {
             SkillLogicInfo info  = m_SkillLogicInfos[ix];
             bool           exist = m_Scene.EntityController.ExistGameObject(info.ActorId);
             if (exist)
             {
                 info.SkillInst.Tick(info.Sender, delta);
             }
             if (!exist || info.SkillInst.IsFinished)
             {
                 if (!exist)
                 {
                     info.SkillInst.OnSkillStop(info.Sender);
                 }
                 StopSkillInstance(info);
                 m_SkillLogicInfos.RemoveAt(ix);
             }
         }
     } finally {
     }
 }
示例#2
0
 internal bool Init(int room_id, int scene_type, UserPool userpool, Connector conn)
 {
     LogSys.Log(LOG_TYPE.INFO, "[0] Room.Init {0} scene {1}", room_id, scene_type);
     cur_room_id_    = room_id;
     user_pool_      = userpool;
     connector_      = conn;
     can_close_time_ = 0;
     m_ActiveScene   = m_ScenePool.NewScene();
     LogSys.Log(LOG_TYPE.INFO, "[1] Room.Init {0} scene {1}", room_id, scene_type);
     m_ActiveScene.SetRoom(this);
     //场景数据加载由加载线程执行(注:场景没有加载完成,场景状态仍然是sleep,Scene.Tick不会有实际的动作)
     SceneLoadThread.Instance.QueueAction(m_ActiveScene.LoadData, scene_type);
     m_ActiveTime = TimeUtility.GetLocalMicroseconds();
     CurrentState = RoomState.Active;
     m_CanFinish  = false;
     LogSys.Log(LOG_TYPE.DEBUG, "Room Initialize: {0}  Scene: {1}", room_id, scene_type);
     return(true);
 }
示例#3
0
        private void TickAi()
        {
            long curTime = TimeUtility.GetLocalMicroseconds();

            if (m_LastTickTimeForAi <= 0)
            {
                m_LastTickTimeForAi = curTime;
                return;
            }
            long deltaTime = curTime - m_LastTickTimeForAi;

            m_LastTickTimeForAi = curTime;

            for (int i = m_EntitiesForAi.Count - 1; i >= 0; --i)
            {
                var info = m_EntitiesForAi[i];
                if (info.GetAIEnable())
                {
                    var aiStateInfo = info.GetAiStateInfo();
                    switch (aiStateInfo.CurState)
                    {
                    case (int)PredefinedAiStateId.MoveCommand:
                        OnAiMoveCommand(info, deltaTime);
                        break;

                    case (int)PredefinedAiStateId.WaitCommand:
                        OnAiWaitCommand(info, deltaTime);
                        break;

                    case (int)PredefinedAiStateId.Idle:
                    default:
                        if (null != aiStateInfo.AiStoryInstanceInfo)
                        {
                            var storyInstance = aiStateInfo.AiStoryInstanceInfo.m_StoryInstance;
                            if (null != storyInstance)
                            {
                                storyInstance.Tick(curTime);
                            }
                        }
                        break;
                    }
                }
            }
        }
示例#4
0
 public bool Init(int room_id, int scene_type, UserPool userpool, Connector conn)
 {
     LogSys.Log(LOG_TYPE.INFO, "[0] Room.Init {0} scene {1}", room_id, scene_type);
     m_RoomId                  = room_id;
     m_UserPool                = userpool;
     m_Connector               = conn;
     m_CanCloseTime            = 0;
     m_RoomUserMgr.Connector   = conn;
     m_RoomUserMgr.RoomId      = room_id;
     m_RoomUserMgr.LocalRoomId = (int)m_LocalID;
     m_RoomUserMgr.UserPool    = userpool;
     m_RoomUserMgr.ActiveScene = m_ScenePool.NewScene();
     LogSys.Log(LOG_TYPE.INFO, "[1] Room.Init {0} scene {1}", room_id, scene_type);
     m_RoomUserMgr.ActiveScene.SetRoomUserManager(m_RoomUserMgr);
     m_RoomUserMgr.ActiveScene.Init(scene_type);
     //场景数据加载由加载线程执行(注:场景没有加载完成,场景状态仍然是sleep,Scene.Tick不会有实际的动作)
     SceneLoadThread.Instance.QueueAction(m_RoomUserMgr.ActiveScene.LoadData, scene_type);
     OnInit();
     m_ActiveTime = TimeUtility.GetLocalMicroseconds();
     CurrentState = RoomState.Active;
     m_CanFinish  = false;
     LogSys.Log(LOG_TYPE.DEBUG, "Room Initialize: {0}  Scene: {1}", room_id, scene_type);
     return(true);
 }