Ejemplo n.º 1
0
 public ChunkCache(Game game)
     : base(game)
 {
     m_logger = MainEngine.GetEngineInstance().GetLogger("ChunkCache");
     Debug.Assert(game != null);
     var graphicsDevice = game.GraphicsDevice;
     Debug.Assert(ViewRange < CacheRange);
     Debug.Assert(graphicsDevice != null);
     Blocks = new Block[CacheSizeInBlocks * CacheSizeInBlocks * CacheSizeInBlocks];
     m_lightingEngine = new CellularLighting<Block>(Blocks, BlockIndexByWorldPosition, Chunk.SizeInBlocks, GetChunkByWorldPosition);
     m_vertexBuilder = new VertexBuilder<Block>(Blocks, BlockIndexByWorldPosition, graphicsDevice);
     m_chunkStorage = new SparseArray3D<Chunk>(CacheRange * 2 + 1, CacheRange * 2 + 1);
     m_cacheCenterPosition = new Vector4();
     m_eventSinkImpl = new EventSinkImpl ();
     m_eventSinkImpl.AddHandler<Vector3Args>(EventConstants.PlayerPositionUpdated, OnUpdateCachePosition);
     m_startUpState = StartUpState.NotStarted;
     m_processingQueue = new Queue<Chunk>();
     m_EditQueue = new ConcurrentQueue<WorldEdit>();
     #if DEBUG
     StateStatistics = new Dictionary<ChunkState, int> // init. the debug stastics.
                                {
                                    {ChunkState.AwaitingGenerate, 0},
                                    {ChunkState.Generating, 0},
                                    {ChunkState.AwaitingLighting, 0},
                                    {ChunkState.Lighting, 0},
                                    {ChunkState.AwaitingBuild, 0},
                                    {ChunkState.Building, 0},
                                    {ChunkState.Ready, 0},
                                    {ChunkState.AwaitingRemoval, 0},
                                };
     #endif
 }
        public GameManagerAppWorker(string[] args)
            : base(new GameManagerConversationFactory())
        {
            GameInfo = new GameInfo();

            StartUpState = new StartUpState(this, args);
            TempState    = new TempState(this);
            currentState = StartUpState;
        }
Ejemplo n.º 3
0
 public void SetStartUpState(StartUpState ss)
 {
     if (ss == StartUpState.Add)
     {
         RK.SetValue("WinScreen", Application.ExecutablePath);
     }
     else if (ss == StartUpState.Delete)
     {
         RK.DeleteValue("WinScreen", false);
     }
 }
 public static bool Prefix(StartUpState __instance, LegalScreen ___mLegalScreen, ref StartUpState.State ___mState)
 {
     if (___mState != StartUpState.State.SplashSequence)
     {
         return(false);
     }
     if (UIManager.instance.IsScreenSetLoaded(UIManager.ScreenSet.StartUp) && SceneManager.instance.HasSceneSetLoaded(SceneSet.SceneSetType.Core))
     {
         App.instance.StartCoroutine(Initialise(___mLegalScreen));
         ___mState = StartUpState.State.LoadNavigationAndDialogs;
     }
     return(false);
 }
Ejemplo n.º 5
0
 public void Update()
 {
     if (m_startingRendezVous)
     {
         StartUpState startUpState = (StartUpState)RendezVousInvokes.LegacyRendezVousGetStartUpState();
         if (startUpState == StartUpState.SUCCESSFUL)
         {
             m_startingRendezVous = false;
             LegacyLogic.Instance.TrackingManager.TrackGameStart("China");
         }
         else if (startUpState == StartUpState.FAILURE)
         {
             m_startingRendezVous = false;
         }
     }
 }
Ejemplo n.º 6
0
 internal void InitialiseWith(StartUpState startUp)
 => _currentState = startUp;
Ejemplo n.º 7
0
 public NavigationContext(StartUpState startUpState, NavigationEvent startUpEvent)
 {
     _navigator = new Navigator();
     _navigator.InitialiseWith(startUpState);
     _navigator.NavigateTo(startUpEvent);
 }
        public void Update()
        {
            if (m_startingRendezVous)
            {
                StartUpState startUpState = (StartUpState)RendezVousInvokes.LegacyRendezVousGetStartUpState();
                if (startUpState == StartUpState.SUCCESSFUL)
                {
                    m_startingRendezVous = false;
                    String userName = GetUserName();
                    String password = GetPassword();
                    GetCDKeyList();
                    if (m_keys.Count > 0)
                    {
                        RendezVousInvokes.LegacyRendezVousLogIn(userName, password, m_keys[0]);
                        m_connectingToRendezVous = true;
                        m_unlockingKeyNr         = -1;
                    }
                }
                else if (startUpState == StartUpState.FAILURE)
                {
                    m_startingRendezVous = false;
                    m_isOfflineMode      = true;
                }
            }
            if (m_connectingToRendezVous)
            {
                if (m_unlockingKeyNr == -1)
                {
                    LogInState logInState = (LogInState)RendezVousInvokes.LegacyRendezVousGetLogInState();
                    if (logInState == LogInState.SUCCESSFUL)
                    {
                        m_unlockingKeyNr = 0;
                        RendezVousInvokes.LegacyRendezVousActivateAnyKey(m_keys[m_unlockingKeyNr]);
                    }
                    else if (logInState == LogInState.FAILURE)
                    {
                        m_isOfflineMode          = true;
                        m_connectingToRendezVous = false;
                    }
                }
                else
                {
                    EActivateKeyResult unlockPrivilegeState = GetUnlockPrivilegeState();
                    if (unlockPrivilegeState != EActivateKeyResult.ACTIVATE_WAITING)
                    {
                        m_unlockingKeyNr++;
                        if (m_unlockingKeyNr < m_keys.Count)
                        {
                            RendezVousInvokes.LegacyRendezVousActivateAnyKey(m_keys[m_unlockingKeyNr]);
                        }
                        else
                        {
                            DoneLogin();
                        }
                    }
                }
            }
            if (m_isSettingAction)
            {
                SetActionState setActionState = (SetActionState)RendezVousInvokes.LegacyRendezVousGetActionsState();
                if (setActionState == SetActionState.SUCCESSFUL)
                {
                    if (OnActionCompleted != null && m_settingActionID >= 0)
                    {
                        ActionCompletedEventArgs e = new ActionCompletedEventArgs(m_settingActionID, true);
                        OnActionCompleted(this, e);
                    }
                    m_isSettingAction = false;
                    m_settingActionID = -1;
                }
                else if (setActionState == SetActionState.FAILURE)
                {
                    if (OnActionCompleted != null && m_settingActionID >= 0)
                    {
                        ActionCompletedEventArgs e2 = new ActionCompletedEventArgs(m_settingActionID, false);
                        OnActionCompleted(this, e2);
                    }
                    m_isSettingAction = false;
                    m_settingActionID = -1;
                }
            }
            List <IntPtr> list = new List <IntPtr>();

            foreach (IntPtr intPtr in overlappedMap.Keys)
            {
                if (UplayInvokes.UPLAY_HasOverlappedOperationCompleted(intPtr))
                {
                    list.Add(intPtr);
                }
            }
            foreach (IntPtr intPtr2 in list)
            {
                overlappedMap.Remove(intPtr2);
                Marshal.FreeHGlobal(intPtr2);
            }
            list.Clear();
            if (UplayInvokes.UPLAY_Update() == 0)
            {
                m_isForceQuit = true;
            }
            UPLAY_Event uplay_Event;

            while (UplayInvokes.UPLAY_GetNextEvent(out uplay_Event))
            {
                Debug.Log("Received uplay Event! : " + uplay_Event.type);
                if (uplay_Event.type == UPLAY_EventType.UPLAY_Event_UserAccountSharing)
                {
                    m_isRendezVousConnected = false;
                    m_isOfflineMode         = true;
                }
            }
        }
Ejemplo n.º 9
0
 public override void Update(GameTime gameTime)
 {
     if (m_startUpState == StartUpState.Started)
     {
         /*if (count++ > 100 && m_EditQueue.Count == 0)
         {
             count = 0;
             if (add)
             {
                 m_EditQueue.Enqueue(new WorldEdit(new Vector3Int(-25, 68, 10), WorldEdit.WorldEditType.AddLight, new Vector3Byte(255, 255, 255)));
             }
             else
             {
                 m_EditQueue.Enqueue(new WorldEdit(new Vector3Int(-25, 68, 10), WorldEdit.WorldEditType.RemoveLight));
             }
             add = !add;
             m_cachePositionUpdated = true;
         }*/
     }
     if (m_startUpState != StartUpState.AwaitingStart)
     {
         return;
     }
     m_startUpState = StartUpState.Starting;
     Task.Run(() =>
     {
         RecacheChunks();
         //Parallel.ForEach(m_chunkStorage.Values.ToList(), ProcessChunkInCacheRange);
         foreach (var chunk in m_chunkStorage)
         {
             ProcessChunkInCacheRange(chunk.Value);
         }
       //              PageManager.Instance.DebugFlushPageDirectory();
         var cacheThread = new Thread(CacheThread) { IsBackground = true };
         cacheThread.Start();
         m_startUpState = StartUpState.Started;
     });
 }
Ejemplo n.º 10
0
 public void OnUpdateCachePosition(int x, int y, int z)
 {
     if (x == (int) m_cacheCenterPosition.X && y == (int) m_cacheCenterPosition.Y &&
         z == (int) m_cacheCenterPosition.Z)
     {
         return;
     }
     m_cachePositionUpdated = true;
     m_cacheCenterPosition.X = x;
     m_cacheCenterPosition.Y = y;
     m_cacheCenterPosition.Z = z;
     UpdateBoundingBoxes();
     if (m_startUpState == StartUpState.NotStarted)
     {
         m_startUpState = StartUpState.AwaitingStart;
     }
 }