/// <summary> /// Refreshes and redraws the StarSystem /// </summary> public void RefreshStarSystem() { // We only want to refresh a system when we have a valid GLCanvas: if (m_GLCanvas == null) { return; } else if (m_GLCanvas.Loaded == false) { return; } // Now we test to see if we have already loaded this system or if it the current one: if (m_oCurrentSceen == null) { // we have an invalid current system, creat a new one!! CreateNewSystemSceen(); return; // we dont need to do anything else, CreateNewSystemSceen took care of it all for us. } else if (m_oCurrentSceen.SceenID != m_oCurrnetSystem.Id) { // check if we have created it previously: bool bSceenFound = false; foreach (Sceen oSceen in m_lSystemSceens) { if (oSceen.SceenID == m_oCurrnetSystem.Id) { // switch our current sceen and break the loop: SetCurrentSceen(oSceen); bSceenFound = true; break; } } // check to see if we found it: if (bSceenFound == false) { // we didn't, so crest it: CreateNewSystemSceen(); return; // we dont need to do anything else, CreateNewSystemSceen took care of it all for us. } } // As we are refreshing the current system or one previosle turned into a sceen, we do the below: // Change cursor to wait Cursor.Current = Cursors.WaitCursor; // Do things like update orbits and taskgroups here. m_oCurrentSceen.Refresh(); // Change Cursor Back to default. Cursor.Current = Cursors.Default; }
/// <summary> /// Function to advance time for all buttons. /// </summary> /// <param name="TickValue"></param> private void AdvanceTime(int TickValue) { int elapsed = GameState.SE.SubpulseHandler(GameState.Instance.Factions, GameState.RNG, TickValue); TimeSpan TS = new TimeSpan(0, 0, elapsed); GameState.Instance.GameDateTime = GameState.Instance.GameDateTime.Add(TS); int Seconds = GameState.Instance.GameDateTime.Second + (GameState.Instance.GameDateTime.Minute * 60) + (GameState.Instance.GameDateTime.Hour * 3600) + (GameState.Instance.GameDateTime.DayOfYear * 86400) - 86400; /// <summary> /// Put the date time somewhere. /// </summary> #warning don't really need this debug info m_oControlsPanel.TabText = "SystemMap.cs Kludge(239): " + GameState.Instance.GameDateTime.ToString() + " " + Seconds.ToString() + " " + GameState.Instance.CurrentSecond.ToString() + " " + GameState.Instance.LastTimestep; MainFormReference.Text = "Pulsar4X - " + GameState.Instance.GameDateTime.ToString(); m_oCurrentSceen.Refresh(); }
/// <summary> /// Creats a new sceen for the currently selected star system. /// </summary> private void CreateNewSystemSceen() { // Change cursor to wait Cursor.Current = Cursors.WaitCursor; // create new sceen root node: Sceen oNewSceen = new Sceen(m_oCurrnetSystem, m_oGLCanvas.DefaultEffect, this); //oNewSceen.SceenID = m_oCurrnetSystem.Id; m_lSystemSceens.Add(oNewSceen); // set sceen to current: SetCurrentSceen(oNewSceen); FitZoom(oNewSceen.SceenSize.X / 1.8); oNewSceen.DefaultZoomScaler = m_oCurrentSceen.ZoomSclaer; oNewSceen.Refresh(); // force refresh. // Change Cursor Back to default. Cursor.Current = Cursors.Default; }