private void RenderTargetInfoUI(GUIStyle sty, GUIStyle but)
        {
            windowPos = new Rect(windowPos.x, windowPos.y, 10, 10);
            GUILayout.BeginVertical();
            if (GUILayout.Button("Back", but))
            {
                Mode = UIMode.TARGET_SELECTION;
                core.setTarget();
            }

            //align planes data
            GUILayout.Label("Time to AN : " + part.vessel.orbit.GetTimeToRelAN(core.targetOrbit()).ToString("F2"), sty);
            GUILayout.Label("Time to DN : " + part.vessel.orbit.GetTimeToRelDN(core.targetOrbit()).ToString("F2"), sty);
            GUILayout.Label("Relative Inclination :" + (core.targetOrbit().inclination - vesselState.orbitInclination).ToString("F2"), sty);

            //rendevous data
            if (core.distanceFromTarget() > 10000)
            {
                GUILayout.Label("Distance: " + (core.distanceFromTarget() / 1000).ToString("F1") + "km", GUILayout.Width(300));
            }
            else
            {
                GUILayout.Label("Distance: " + core.distanceFromTarget().ToString("F1") + "m", GUILayout.Width(300));
            }
            GUILayout.Label("Relative Velocity: " + core.relativeVelocityToTarget().magnitude.ToString("F2"));
            GUILayout.EndVertical();
        }
 private void RenderOffUI(GUIStyle sty, GUIStyle but)
 {
     if (GUILayout.Button("OPEN", but, GUILayout.ExpandWidth(true)))
     {
         Mode = UIMode.TARGET_SELECTION;
     }
 }
        private void RenderSelectedUI(GUIStyle sty, GUIStyle but)
        {
            if (core.targetType == MechJebCore.TargetType.VESSEL)
            {
                if (!CheckVessel())
                {
                    _flyByWire = false;
                    Mode       = UIMode.TARGET_SELECTION;
                }
            }

            if (GUILayout.Button((FlightGlobals.Vessels[_selectedVesselIndex].vesselName), but, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = false;
                Mode       = UIMode.TARGET_SELECTION;
                core.setTarget();
            }
            if (GUILayout.Button("Align Planes", but, GUILayout.ExpandWidth(true)))
            {
                Mode = UIMode.ALIGN;
            }
            if (GUILayout.Button("Sync Orbits", but, GUILayout.ExpandWidth(true)))
            {
                Mode = UIMode.SYNC;
            }
            if (GUILayout.Button("Rendezvous", but, GUILayout.ExpandWidth(true)))
            {
                Mode = UIMode.RENDEZVOUS;
            }
        }
Exemplo n.º 4
0
    public void SetUIMode(UIMode newmode)
    {
        mode = newmode;
        WelcomeUIContainer.SetActive(false);
        GameInfoContainer.SetActive(false);
        GameListContainer.SetActive(false);
        ConnectingContainer.SetActive(false);
        PasswordContainer.SetActive(false);
        switch (newmode)
        {
        case UIMode.Welcome:
            WelcomeUIContainer.SetActive(true);
            break;

        case UIMode.AskForGameInfo:
            GameInfoContainer.SetActive(true);
            break;

        case UIMode.DisplayGames:
            GameListContainer.SetActive(true);
            break;

        case UIMode.Connecting:
            ConnectingContainer.SetActive(true);
            break;

        case UIMode.AskForPassword:
            PasswordContainer.SetActive(true);
            break;
        }
    }
        public void SetUIMode(UIMode uiMode)
        {
            if (this.currentUIMode != uiMode)
            {
                this.currentUIMode = uiMode;
                switch (uiMode)
                {
                case UIMode.Localization_Unlocalized:
                    DeactiveAll();
                    localizationButtons.SetActive(false);
                    mapThumbnail.gameObject.SetActive(true);
                    break;

                case UIMode.Localization_Localized:
                    DeactiveAll();
                    localizationButtons.SetActive(true);
                    break;

                default:
                    DeactiveAll();
                    localizationButtons.SetActive(false);
                    mapThumbnail.gameObject.SetActive(true);
                    break;
                }
            }
            UpdateBottomBanner();
        }
Exemplo n.º 6
0
 public void SetUIMode(UIMode uiMode)
 {
     foreach (MapBuilding building in _spawnedMapBuildingList)
     {
         building.Drag.Active = uiMode == UIMode.Build;
     }
 }
Exemplo n.º 7
0
        public void SetUIMode(UIMode uiMode)
        {
            if (this.currentUIMode != uiMode)
            {
                this.currentUIMode = uiMode;
                switch (uiMode)
                {
                case UIMode.Init:
                    DeactiveAll();
                    continuosNewActivityButton.SetActive(true);
                    saveMapButton.SetActive(true);
                    break;

                case UIMode.SavingMap:     //do not show any element when saving map
                    DeactiveAll();
                    break;

                default:
                    DeactiveAll();
                    continuosNewActivityButton.SetActive(true);
                    saveMapButton.SetActive(true);
                    break;
                }
            }

            UpdateBottomBanner();
        }
Exemplo n.º 8
0
		internal static UIDialogResult ShowDialog(UIMode uiMode, SerializableException exception, Report report)
		{
			if (uiMode == UIMode.Minimal)
			{
				// Do not interact with the user
				Console.WriteLine(Environment.NewLine + Settings.Resources.UI_Console_Minimal_Message);
				return new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send);
			}
			else if (uiMode == UIMode.Normal)
			{
				// ToDo: Create normal console UI
				Console.WriteLine(Environment.NewLine + Settings.Resources.UI_Console_Normal_Message);
				return new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send);
			}
			else if (uiMode == UIMode.Full)
			{
				// ToDo: Create full console UI
				Console.WriteLine(Environment.NewLine + Settings.Resources.UI_Console_Full_Message);
				return new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send);
			}
			else
			{
				throw NBugConfigurationException.Create(() => Settings.UIMode, "Parameter supplied for settings property is invalid.");
			}
		}
Exemplo n.º 9
0
 public UIData(string uname, string path, string cname, UIMode umode)
 {
     uiName        = uname;
     prefabPath    = path;
     componentName = cname;
     uiMode        = umode;
 }
Exemplo n.º 10
0
		internal static UIDialogResult ShowDialog(UIMode uiMode, SerializableException exception, Report report)
		{
			if (uiMode == UIMode.Minimal)
			{
				return new Minimal().ShowDialog(report);
			}
			else if (uiMode == UIMode.Normal)
			{
				using (var ui = new Normal())
				{
					return ui.ShowDialog(report);
				}
			}
			else if (uiMode == UIMode.Full)
			{
				using (var ui = new Full())
				{
					return ui.ShowDialog(exception, report);
				}
			}
			else
			{
				throw NBugConfigurationException.Create(() => Settings.UIMode, "Parameter supplied for settings property is invalid.");
			}
		}
Exemplo n.º 11
0
        public void SetUIMode(UIMode uiMode)
        {
            if (this.currentUIMode != uiMode)
            {
                this.currentUIMode = uiMode;
                switch (uiMode)
                {
                case UIMode.Initializing:
                    DeactiveAll();
                    break;

                case UIMode.Inititialized:
                    DeactiveAll();
                    newActivityButton.SetActive(true);
                    searchActivityButton.SetActive(true);
                    break;

                default:
                    DeactiveAll();
                    newActivityButton.SetActive(true);
                    searchActivityButton.SetActive(true);
                    break;
                }
            }

            UpdateBottomBanner();
        }
Exemplo n.º 12
0
 private void SetUIMode(UIMode uiMode)
 {
     if (uiMode == UIMode.Default)
     {
         background.sprite = null;
         camera.position   = cameraPosDefault;
         uiCanvas.SetActive(true);
         messageCanvas.SetActive(true);
     }
     else if (uiMode == UIMode.StageSelect)
     {
         background.sprite = backgroundSprite;
         camera.position   = cameraPosStageSelect;
         uiCanvas.SetActive(false);
         messageCanvas.SetActive(false);
         background.gameObject.SetActive(true);
         titleField.SetActive(false);
     }
     else if (uiMode == UIMode.Title)
     {
         background.sprite = null;
         camera.position   = cameraPosDefault;
         uiCanvas.SetActive(false);
         messageCanvas.SetActive(false);
         background.gameObject.SetActive(false);
         titleField.SetActive(true);
     }
 }
Exemplo n.º 13
0
    public void ToggleMode(UIMode mode)
    {
        switch (mode)
        {
        case UIMode.Game:
            if (Menu != null)
            {
                Menu.SetActive(false);
            }
            DeathScreen.SetActive(false);
            GameHUD.SetActive(true);
            break;

        case UIMode.Death:
            DeathScreen.SetActive(true);
            GameHUD.SetActive(false);
            break;

        case UIMode.Menu:
            if (Menu != null)
            {
                Menu.SetActive(true);
            }
            GameHUD.SetActive(false);
            break;

        case UIMode.None:
            if (Menu != null)
            {
                Menu.SetActive(false);
            }
            GameHUD.SetActive(false);
            break;
        }
    }
        public void SetUIMode(UIMode uiMode)
        {
            if (this.currentUIMode != uiMode)
            {
                this.currentUIMode = uiMode;
                switch (uiMode)
                {
                case UIMode.ActivitySetting_NoActivitySeleted:
                    DeactiveAll();
                    confirmActivitySettingButton.SetActive(false);
                    break;

                case UIMode.ActivitySetting_ActivitySelected:
                    DeactiveAll();
                    confirmActivitySettingButton.SetActive(true);
                    break;

                default:
                    DeactiveAll();
                    confirmActivitySettingButton.SetActive(false);
                    break;
                }
            }

            UpdateBottomBanner();
        }
Exemplo n.º 15
0
 internal static UIDialogResult ShowDialog(UIMode uiMode, SerializableException exception, Report report)
 {
     if (uiMode == UIMode.Minimal)
     {
         // Do not interact with the user
         Console.WriteLine(Environment.NewLine + Settings.Resources.UI_Console_Minimal_Message);
         return(new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));
     }
     else if (uiMode == UIMode.Normal)
     {
         // ToDo: Create normal console UI
         Console.WriteLine(Environment.NewLine + Settings.Resources.UI_Console_Normal_Message);
         return(new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));
     }
     else if (uiMode == UIMode.Full)
     {
         // ToDo: Create full console UI
         Console.WriteLine(Environment.NewLine + Settings.Resources.UI_Console_Full_Message);
         return(new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.Send));
     }
     else
     {
         throw NBugConfigurationException.Create(() => Settings.UIMode, "Parameter supplied for settings property is invalid.");
     }
 }
Exemplo n.º 16
0
 internal static UIDialogResult ShowDialog(UIMode uiMode, SerializableException exception, Report report)
 {
     if (uiMode == UIMode.Minimal)
     {
         // ToDo:  Create WPF dialogs
         return(new Minimal().ShowDialog(report));
     }
     if (uiMode == UIMode.Normal)
     {
         // ToDo:  Create WPF dialogs
         using (var ui = new Normal())
         {
             return(ui.ShowDialog(report));
         }
     }
     if (uiMode == UIMode.Full)
     {
         // ToDo:  Create WPF dialogs
         using (var ui = new Full())
         {
             return(ui.ShowDialog(exception, report));
         }
     }
     throw NBugConfigurationException.Create(() => Settings.UIMode,
                                             "Parameter supplied for settings property is invalid.");
 }
Exemplo n.º 17
0
    /// <summary>
    /// Open a new UI window
    /// </summary>
    /// <param name="name"> The name of the UI window to be opened </param>
    /// <param name="mode"> The mode to be used to open the UI window </param>
    /// <param name="args"> Extra arguments passed to UIWindow.OnOpen() </param>
    /// <returns></returns>
    public UIWindow Open(string name, UIMode mode = UIMode.Default, params object[] args)
    {
#if UNITY_EDITOR
        LogUtility.PrintLog("UI", IsInViewport(name) ? name + " is already in viewport" : "Open " + name);
#endif

        if (IsInViewport(name))
        {
            return(uiWindowsOpened[name]);
        }

        UIWindow uiWindow = Instantiate(ResourceUtility.GetUIPrefab <UIWindow>(name), transform, false);

        uiWindow.transform.SetSiblingIndex(0);

        uiWindowsOpened.Add(name, uiWindow);

        uiWindow.OnOpen(args);

        if (mode != UIMode.Permenent)
        {
            uiWindowStack.Push(name);
        }

        return(uiWindow);
    }
 internal CustomUIEventArgs(UIMode uiMode, SerializableException exception, Report report)
 {
     this.UIMode    = uiMode;
     this.Report    = report;
     this.Exception = exception;
     this.Result    = new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.DoNotSend);
 }
Exemplo n.º 19
0
        // Use this for initialization
        void Start()
        {
            animateMessage     = true;
            messageOver        = false;
            isMessageToDisplay = false;
            endMessage         = false;
            inBattle           = false;
            queueHead          = new UIQueueItem();
            activeDelt         = null;
            activeItem         = null;
            secondMoveLoaded   = -1;

            currentUI = UIMode.World;

            // Set All UI except Movement as inactive
            MessageUI.gameObject.SetActive(false);
            BattleUI.gameObject.SetActive(false);
            BagMenuUI.gameObject.SetActive(false);
            ItemsUI.gameObject.SetActive(false);
            PosseUI.gameObject.SetActive(false);
            DeltDexUI.gameObject.SetActive(false);
            fade.gameObject.SetActive(false);
            SettingsUI.SetActive(false);

            StartCoroutine(messageWorker());
        }
Exemplo n.º 20
0
    /// <summary>
    /// Open a new UI window
    /// </summary>
    /// <param name="name"> The name of the UI window to be opened </param>
    /// <param name="mode"> The mode to be used to open the UI window </param>
    /// <param name="args"> Extra arguments passed to UIWindow.OnOpen() </param>
    /// <returns></returns>
    public GUIWindow Open(string name, UIMode mode = UIMode.DEFAULT, params object[] args)
    {
#if UNITY_EDITOR
        Debug.Log(LogUtility.MakeLogStringFormat("UI", IsInViewport(name) ? name + " is already in viewport" : "Open " + name));
#endif

        if (IsInViewport(name))
        {
            return(uiWindowsOpened[name]);
        }

        GUIWindow uiWindow = Instantiate(ResourceUtility.GetGUIPrefab <GUIWindow>(name), transform, false);

        uiWindow.transform.SetAsFirstSibling();

        uiWindowsOpened.Add(name, uiWindow);

        uiWindow.OnOpen(args);

        if (mode != UIMode.PERMANENT)
        {
            uiWindowStack.Push(name);
        }

        return(uiWindow);
    }
Exemplo n.º 21
0
        public void SetUIMode(UIMode uiMode)
        {
            if (this.currentUIMode != uiMode)
            {
                this.currentUIMode = uiMode;
                switch (uiMode)
                {
                case UIMode.Mapping_PreScanning:
                    DeactiveAll();
                    preMappingInfo.SetActive(true);
                    startMappingButton.SetActive(true);
                    mappingProgressBar.SetActive(false);
                    mappingInfo.SetActive(false);
                    break;

                case UIMode.Mapping_Scanning:
                    DeactiveAll();
                    preMappingInfo.SetActive(false);
                    startMappingButton.SetActive(false);
                    mappingProgressBar.SetActive(true);
                    mappingInfo.SetActive(true);
                    break;

                default:
                    DeactiveAll();
                    preMappingInfo.SetActive(true);
                    startMappingButton.SetActive(true);
                    mappingProgressBar.SetActive(false);
                    mappingInfo.SetActive(false);
                    break;
                }
            }
            UpdateBottomBanner();
        }
Exemplo n.º 22
0
    public void UpdatePages(UIMode mode)
    {
        foreach (UIPage uIPage in pages)
        {
            if (uIPage.Mode != mode)
            {
                uIPage.Root.SetActive(false);
            }
            else
            {
                Cursor.visible = uIPage.GursorStatus;
                uIPage.Root.SetActive(true);
                if (uIPage.audio)
                {
                    MusicSource.Stop();
                    MusicSource.clip = uIPage.audio;
                    MusicSource.Play();
                }

                if (uIPage.VFX != null && uIPage.VFXNodes.Length > 0)
                {
                    SpawnVFX(uIPage.VFX, uIPage.VFXNodes);
                }
            }
        }
    }
Exemplo n.º 23
0
		internal CustomUIEventArgs(UIMode uiMode, SerializableException exception, Report report)
		{
			this.UIMode = uiMode;
			this.Report = report;
			this.Exception = exception;
			this.Result = new UIDialogResult(ExecutionFlow.BreakExecution, SendReport.DoNotSend);
		}
Exemplo n.º 24
0
		internal void ShowDialog(UIMode uiMode, UIProvider uiProvider)
		{
			var exception =
				new SerializableException(new ArgumentException("Argument exception preview.", new Exception("Inner exception for argument exception.")));
			var report = new Report(exception);

			var consoleOut = new StringWriter();
			Console.SetOut(consoleOut);

			if (uiProvider == UIProvider.Console)
			{
				ConsoleUI.ShowDialog(uiMode, exception, report);
				this.consoleOutputTextBox.Text = consoleOut.ToString();
				this.ShowDialog();
			}
			else if (uiProvider == UIProvider.WinForms)
			{
				WinFormsUI.ShowDialog(uiMode, exception, report);
				this.Close();
			}
			else if (uiProvider == UIProvider.WPF)
			{
				WPFUI.ShowDialog(uiMode, exception, report);
				this.Close();
			}
			else if (uiProvider == UIProvider.Custom)
			{
				CustomUI.ShowDialog(uiMode, exception, report);
				this.Close();
			}
			else
			{
				throw new ArgumentException("Parameter supplied for UIProvider argument is invalid.");
			}
		}
        private void RenderSyncUI(GUIStyle sty, GUIStyle but)
        {
            if (!CheckVessel())
            {
                _flyByWire = false;
                Mode       = UIMode.SELECTED;
            }

            if (GUILayout.Button("Sync Orbits", but, GUILayout.ExpandWidth(true)))
            {
                Mode       = UIMode.SELECTED;
                _flyByWire = false;
            }

            GUILayout.EndVertical();

            GUILayout.BeginHorizontal();
            for (int i = 0; i < NumberOfPredictedSyncPoints; i++)
            {
                if (i != (int)SyncMode)
                {
                    continue;
                }

                if (GUILayout.Button(SyncMode.ToString(), but, GUILayout.ExpandWidth(true)))
                {
                    if (i == NumberOfPredictedSyncPoints - 1)
                    {
                        SyncMode = 0;
                    }
                    else
                    {
                        SyncMode = SyncMode + 1;
                    }
                }
                //GUILayout.Box(SyncMode.ToString(),but);
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginVertical();

            GUILayout.Box("Orbit		ShipToR		TgtToR ", GUILayout.ExpandWidth(true));
            for (int i = 0; i < 4; i++)
            {
                GUILayout.Box(_syncString[i]);
            }

            GUILayout.Label("Closest Approach on Orbit " + _closestApproachOrbit.ToString(), sty);
            GUILayout.Label("Min Separation (sec) : " + _minimumPredictedTimeFromTarget.ToString("f1"), sty);

            if (automation == true)
            {
                if (GUILayout.Button(_autoPhaser ? _autoPhaserState.ToString() : "Auto Sync", but, GUILayout.ExpandWidth(true)))
                {
                    _autoPhaser      = !_autoPhaser;
                    _autoPhaserState = AutoPhaserState.Step1WaitForTargetApsis;
                }
            }
        }
Exemplo n.º 26
0
 private void SELECT_CANCEL_BUTTON_Click(object sender, EventArgs e)
 {
     if (this.UIModeVar == UIMode.QuestionIsRight)
     {
         GlobalVar.GlobalListPageInformations = null;
         this.SelectedInformationBuffer       = null;
         UIModeVar = UIMode.NotSelected;
     }
 }
Exemplo n.º 27
0
 public void HideItems()
 {
     Items.DOFade(0f, .2f).SetEase(Ease.OutSine).OnComplete(() =>
     {
         Items.gameObject.SetActive(true);
         submitBtn.gameObject.SetActive(false);
     });
     curUIMode = UIMode.Off;
 }
 protected SendStatistics(Session session, GhostVRConnector ghostVRConnector)
 {
     logger = ghostVRConnector.logger;
     InitializeComponent();
     close.Click  += (s, e) => Close();
     cancel.Click += (s, e) => Close();
     uiMode        = UIMode.loading;
     ghostVRConnector.VideoSession(session, SessionSendSuccess, SessionSendFailure);
 }
Exemplo n.º 29
0
        protected void lnkSave_Click(object sender, EventArgs e)
        {
            var dt = GetEmailSetting();

            new AdministrationDAC().SaveEmailSettings(dt);
            lblStatus.Text    = "Saved - " + DateTime.Now;
            lblStatus.Visible = true;
            Mode = UIMode.View;
        }
Exemplo n.º 30
0
 public void StartTrainerBattle(NPCInteraction trainer, bool isGymLeader)
 {
     playerMovement.StopMoving();
     StartMessage(null, fade.fadeOutToBlack());
     StartMessage(null, null, () => BattleUI.SetActiveIfChanged(true));
     StartMessage(null, null, () => battleManager.StartTrainerBattle(trainer, isGymLeader));
     StartMessage(null, fade.fadeInSceneChange(), null);
     currentUI = UIMode.Battle;
     inBattle  = true;
 }
Exemplo n.º 31
0
 public void StartWildBattle(DeltemonClass wildDelt)
 {
     playerMovement.StopMoving();
     StartMessage(null, fade.fadeOutToBlack());
     StartMessage(null, null, () => BattleUI.SetActiveIfChanged(true));
     StartMessage(null, null, () => BattleManager.Inst.StartWildBattle(wildDelt));
     StartMessage(null, fade.fadeInSceneChange(), null);
     currentUI = UIMode.Battle;
     inBattle  = true;
 }
Exemplo n.º 32
0
        public WTUIPage(UIType type, UIMode mod, UICollider col)
        {
            this.type     = type;
            this.mode     = mod;
            this.collider = col;
            this.name     = this.GetType().ToString();


            WTUIBind.Bind();
        }
Exemplo n.º 33
0
        public TTUIPage(UIType type, UIMode mod, UICollider col)
        {
            this.type = type;
            this.mode = mod;
            this.collider = col;
            this.name = this.GetType().ToString();

            //bind special delegate .
            TTUIBind.Bind();
        }
        private void SwitchUIMode(UIMode mode)
        {
            switch (mode)
            {
            case UIMode.Compact:
                foreach (var window in Application.Current.Windows)
                {
                    if (window is CompactLandscapeView)
                    {
                        ((Window)window).Close();
                    }
                }

                Application.Current.MainWindow.Hide();

                var compactView = new CompactView();
                compactView.Show();

                Settings.Instance.LastCompactMode = UIMode.Compact;
                Settings.Instance.Save();
                break;

            case UIMode.CompactLandscape:
                foreach (var window in Application.Current.Windows)
                {
                    if (window is CompactView)
                    {
                        ((Window)window).Close();
                    }
                }

                Application.Current.MainWindow.Hide();

                var compactLandscapeView = new CompactLandscapeView();
                compactLandscapeView.Show();
                Settings.Instance.LastCompactMode = UIMode.CompactLandscape;
                Settings.Instance.Save();
                break;

            default:
                foreach (var window in Application.Current.Windows)
                {
                    if (window is CompactLandscapeView || window is CompactView)
                    {
                        ((Window)window).Close();
                    }
                }

                Application.Current.MainWindow.Show();
                break;
            }

            CurrentUIMode = mode;
        }
Exemplo n.º 35
0
		internal static UIDialogResult ShowDialog(UIMode uiMode, SerializableException exception, Report report)
		{
			if (Settings.CustomUIHandle != null)
			{
				var e = new CustomUIEventArgs(uiMode, exception, report);
				Settings.CustomUIHandle.DynamicInvoke(null, e);
				return e.Result;
			}
			else
			{
				throw NBugConfigurationException.Create(() => Settings.UIMode, "Parameter supplied for settings property is invalid.");
			}
		}
 public MainWindow()
 {
     InitializeComponent();
     fadeout = Resources["titleFadeOut"] as Storyboard;
     fadeout.Completed += sb_Completed;
     fadein = Resources["titleFadeIn"] as Storyboard;
     DB.InitializeConnection();
     Quiz[] quizes;
     DB.LoadQuizes(out quizes);
     foreach (Quiz q in quizes)
     {
         List.Items.Add(new ListBoxItem() { Content = q.Description, Tag = q, });
         DB.LoadQuestions(q.ID, out currentQuizQuestions);
     }
     curMode = UIMode.Login;
     sb_Completed(this, new EventArgs());
 }
Exemplo n.º 37
0
 private void RenderOffUI(GUIStyle sty)
 {
     if (GUILayout.Button("OPEN", sty, GUILayout.ExpandWidth(true)))
     {
         Mode = UIMode.VESSELS;
     }
 }
Exemplo n.º 38
0
        private void RenderSelectedUI(GUIStyle sty, GUIStyle but)
        {
            if (core.targetType == MechJebCore.TargetType.VESSEL)
            {
                if (!CheckVessel())
                {
                    _flyByWire = false;
                    Mode = UIMode.TARGET_SELECTION;
                }
            }

            if (GUILayout.Button((FlightGlobals.Vessels[_selectedVesselIndex].vesselName), but, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = false;
                Mode = UIMode.TARGET_SELECTION;
                core.setTarget();
            }
            if (GUILayout.Button("Align Planes", but, GUILayout.ExpandWidth(true)))
            {
                Mode = UIMode.ALIGN;
            }
            if (GUILayout.Button("Sync Orbits", but, GUILayout.ExpandWidth(true)))
            {
                Mode = UIMode.SYNC;
            }
            if (GUILayout.Button("Rendezvous", but, GUILayout.ExpandWidth(true)))
            {
                Mode = UIMode.RENDEZVOUS;
            }
        }
Exemplo n.º 39
0
 private void SwitchUIMode(UIMode mode)
 {
     this.mode = mode;
     switch(mode)
     {
         case UIMode.StageSelect:
             StageSelectPanel.gameObject.SetActive(true);
             PartsSelectPanel.gameObject.SetActive(false);
             break;
         case UIMode.PartsSelect:
             StageSelectPanel.gameObject.SetActive(false);
             PartsSelectPanel.gameObject.SetActive(true);
             PlaceSelected(0);
             break;
         case UIMode.Event:
             break;
     }
 }
Exemplo n.º 40
0
 public UIModeChangedEventArgs(UIMode mode)
 {
     this.Mode = mode;
 }
Exemplo n.º 41
0
        private void SwitchUIMode(UIMode mode)
        {
            switch (mode)
            {
                case UIMode.Compact:
                    foreach (var window in Application.Current.Windows)
                    {
                        if (window is CompactLandscapeView)
                        {
                            ((Window)window).Close();
                        }
                    }

                    Application.Current.MainWindow.Hide();

                    var compactView = new CompactView();
                    compactView.Show();

                    Settings.Instance.LastCompactMode = UIMode.Compact;
                    Settings.Instance.Save();
                    break;

                case UIMode.CompactLandscape:
                    foreach (var window in Application.Current.Windows)
                    {
                        if (window is CompactView)
                        {
                            ((Window)window).Close();
                        }
                    }

                    Application.Current.MainWindow.Hide();

                    var compactLandscapeView = new CompactLandscapeView();
                    compactLandscapeView.Show();
                    Settings.Instance.LastCompactMode = UIMode.CompactLandscape;
                    Settings.Instance.Save();
                    break;

                default:
                    foreach (var window in Application.Current.Windows)
                    {
                        if (window is CompactLandscapeView || window is CompactView)
                        {
                            ((Window)window).Close();
                        }
                    }

                    Application.Current.MainWindow.Show();
                    break;
            }

            CurrentUIMode = mode;
        }
Exemplo n.º 42
0
    private void RenderVesselsUI(GUIStyle sty)
    {
        if (GUILayout.Button("HIDE", sty, GUILayout.ExpandWidth(true)))
        {
            Mode = UIMode.OFF;
        }
        GUILayout.Box("Select Target");

        //TODO: ADD BODY SUPPORT
        //create a button for each vessel, and store the location of the selected vessel

        _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.Width(300), GUILayout.Height(300));

        // Generate and sort an array of vessels by distance.
        List<Vessel> vesselList = new List<Vessel>(FlightGlobals.Vessels);
        var vdc = new VesselDistanceComparer();
        vdc.OriginVessel = vessel;

        vesselList.Sort(vdc);

        for (int i = 0; i < vesselList.Count; i++)
        {
            // Skip ourselves.
            if (vesselList[i] == vessel)
                continue;

            if (vesselList[i].LandedOrSplashed)
                continue;

            // Skip stuff around other worlds.
            if (vessel.orbit.referenceBody != vesselList[i].orbit.referenceBody)
                continue;

            // Calculate the distance.
            float d = Vector3.Distance(vesselList[i].transform.position, vessel.transform.position);

            if (GUILayout.Button((d / 1000).ToString("F1") + "km " + vesselList[i].vesselName, sty,
                                 GUILayout.ExpandWidth(true)))
            {
                Mode = UIMode.SELECTED;
                _selectedVesselInstanceId = vesselList[i].GetInstanceID();
                _selectedVesselIndex = FlightGlobals.Vessels.IndexOf(vesselList[i]);
            }
        }

        GUILayout.EndScrollView();
    }
Exemplo n.º 43
0
    private void RenderSyncUI(GUIStyle sty)
    {
        if (!CheckVessel())
        {
            _flyByWire = false;
            Mode = UIMode.SELECTED;
        }

        if (GUILayout.Button("Sync Orbits", sty, GUILayout.ExpandWidth(true)))
        {
            Mode = UIMode.SELECTED;
            _flyByWire = false;
        }

        GUILayout.EndVertical();

        GUILayout.BeginHorizontal();
        for (int i = 0; i < NumberOfPredictedSyncPoints; i++)
        {
            if (i != (int) SyncMode)
                continue;

            if (GUILayout.Button(" ", sty, GUILayout.ExpandWidth(true)))
            {
                if (i == NumberOfPredictedSyncPoints - 1) SyncMode = 0;
                else SyncMode = SyncMode + 1;
            }
            GUILayout.Box(SyncMode.ToString());
        }
        GUILayout.EndHorizontal();
        GUILayout.BeginVertical();

        GUILayout.Box("Orbit		ShipToR		TgtToR ", sty, GUILayout.ExpandWidth(true));
        for (int i = 0; i < 4; i++)
            GUILayout.Box(_syncString[i]);

        GUILayout.Box("Closest Approach on Orbit " + _closestApproachOrbit.ToString());
        GUILayout.Box("Min Separation (sec) : " + _minimumPredictedTimeFromTarget.ToString("f1"));

        if(GUILayout.Button(_autoPhaser ? _autoPhaserState.ToString() : "Auto Sync", sty, GUILayout.ExpandWidth(true)))
        {
            _autoPhaser = !_autoPhaser;
            _autoPhaserState = AutoPhaserState.Step1WaitForTargetApsis;
        }
    }
Exemplo n.º 44
0
        private void RenderTargetSelectUI(GUIStyle sty, GUIStyle but)
        {
            GUILayout.Label("Select Target", sty);
            TargetMode = (TgtMode)GUILayout.SelectionGrid((int)TargetMode, sel_texts, 3, but);
            _scrollPosition = GUILayout.BeginScrollView(_scrollPosition, GUILayout.Width(300), GUILayout.Height(300));
            List<Vessel> vesselList = new List<Vessel>(FlightGlobals.Vessels);
            List<CelestialBody> bodyList = new List<CelestialBody>(FlightGlobals.Bodies);

            switch (TargetMode)
            {
                case TgtMode.BODIES:
                    for (int i = 1; i < bodyList.Count; i++)
                    {
                        if (bodyList[i].orbit.referenceBody != this.part.vessel.orbit.referenceBody)
                            continue;
                        if (GUILayout.Button(bodyList[i].name, but, GUILayout.ExpandWidth(true)))
                        {
                            Mode = UIMode.SELECTED;
                            core.setTarget(bodyList[i]);
                        }

                    }

                    break;

                case TgtMode.DEBRIS:
                    for (int i = 0; i < vesselList.Count; i++)
                    {
                        // skip real vessels
                        if (vesselList[i].isCommandable == true)
                            continue;

                        // Skip stuff around other worlds.
                        if (part.vessel.orbit.referenceBody != vesselList[i].orbit.referenceBody)
                            continue;

                        if (GUILayout.Button(vesselList[i].vesselName, but, GUILayout.ExpandWidth(true)))
                        {
                            Mode = UIMode.SELECTED;
                            _selectedVesselInstanceId = vesselList[i].GetInstanceID();
                            _selectedVesselIndex = FlightGlobals.Vessels.IndexOf(vesselList[i]);
                            core.setTarget(vesselList[i]);
                        }
                    }

                    break;
                case TgtMode.VESSELS:
                    var vdc = new VesselDistanceComparer();

                    vdc.OriginVessel = part.vessel;

                    vesselList.Sort(vdc);

                    for (int i = 0; i < vesselList.Count; i++)
                    {
                        // Skip ourselves.
                        if (vesselList[i] == part.vessel)
                            continue;

                        if (vesselList[i].LandedOrSplashed)
                            continue;

                        // Skip stuff around other worlds.
                        if (part.vessel.orbit.referenceBody != vesselList[i].orbit.referenceBody)
                            continue;
                        //Skip Debris
                        if (vesselList[i].isCommandable == false)
                            continue;

                        // Calculate the distance.
                        float d = Vector3.Distance(vesselList[i].transform.position, part.vessel.transform.position);

                        if (GUILayout.Button((d / 1000).ToString("F1") + "km " + vesselList[i].vesselName, but,
                                             GUILayout.ExpandWidth(true)))
                        {
                            Mode = UIMode.SELECTED;
                            _selectedVesselInstanceId = vesselList[i].GetInstanceID();
                            _selectedVesselIndex = FlightGlobals.Vessels.IndexOf(vesselList[i]);
                            core.setTarget(vesselList[i]);
                        }
                    }
                    break;
            }
            GUILayout.EndScrollView();
        }
 //UI related functions
 public void SetSpellMode()
 {
     uiMode = UIMode.Spell;
 }
Exemplo n.º 46
0
    private void RenderAlignUI(GUIStyle sty)
    {
        if (!CheckVessel())
        {
            _flyByWire = false;
            Mode = UIMode.SELECTED;
        }

        if (GUILayout.Button("Align Planes", sty, GUILayout.ExpandWidth(true)))
        {
            Mode = UIMode.SELECTED;
            _flyByWire = false;
        }

        GUILayout.Box("Time to AN : " +
                      vessel.orbit.GetTimeToRelAN(FlightGlobals.Vessels[_selectedVesselIndex].orbit).ToString("F2"));
        GUILayout.Box("Time to DN : " +
                      vessel.orbit.GetTimeToRelDN(FlightGlobals.Vessels[_selectedVesselIndex].orbit).ToString("F2"));
        GUILayout.Box("Relative Inclination :" + _relativeInclination.ToString("F2"));

        if(GUILayout.Button(_autoAlign ? "ALIGNING" : "Auto-Align", sty, GUILayout.ExpandWidth(true)))
        {
            _autoAlignBurnTriggered = false;
            _autoAlign = !_autoAlign;
        }

        if (_flyByWire == false)
        {
            if (GUILayout.Button("Orbit Normal", sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.Normal;
            }

            if (GUILayout.Button("Anti Normal", sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.AntiNormal;
            }
        }

        if (_flyByWire)
        {
            if (GUILayout.Button("Disable " + PointAt.ToString(), sty, GUILayout.ExpandWidth(true)))
            {
                FlightInputHandler.SetNeutralControls();
                _flyByWire = false;
                _modeChanged = true;
            }
        }
    }
 void SwitchMode()
 {
     if (curMode == UIMode.Login)
     {
         LoginPage loginPage = contentPanel.Children[0] as LoginPage;
         curUser = loginPage.login();
         if (curUser != null)
             if (!loginPage.Wait)
                 curMode = UIMode.QuizSelection;
         else
             return;
     }
     else if (curMode == UIMode.QuizSelection)
     {
         if (List.SelectedItem != null)
         {
             curMode = UIMode.Questionary;
             currentQuiz = (List.SelectedItem as ListBoxItem).Tag as Quiz;
         }
     }
     else if (curMode == UIMode.Questionary)
     {
         curMode = UIMode.ResultsView;
     }
     else if (curMode == UIMode.ResultsView)
     {
         curMode = UIMode.QuizSelection;
     }
     fadeout.Begin();
 }
    //Picks next unit from the queue
    private void ActivateNextUnit(Queue<UnitBase> queueToJoin)
    {
        if(ActiveUnit != null && ActiveUnit.Health > 0)
            queueToJoin.Enqueue(ActiveUnit);

        ThisTurnQueue = new Queue<UnitBase>(ThisTurnQueue.OrderByDescending(unit => unit.Initiative));

        if (ThisTurnQueue.Count > 0)
        {
            ActiveUnit = ThisTurnQueue.Dequeue();
        }
        else if(WaitingQueue.Count > 0)
        {
            ActiveUnit = WaitingQueue.Dequeue();
            waitButton.SetActive(false);
            this.inWaitingTurn = true;
        }
        else
        {
            var tmpQueue = ThisTurnQueue;
            ThisTurnQueue = NextTurnQueue;
            NextTurnQueue = tmpQueue;
            this.inWaitingTurn = false;
            ActiveUnit = null;
            AllUnits.ForEach(unit => unit.UpdateAfterTurnsEnd());
            ActivateNextUnit(null);
            waitButton.SetActive(true);
        }
        uiMode = UIMode.Walk;
    }
Exemplo n.º 49
0
    private void RenderRendezvousUI(GUIStyle sty)
    {
        if (!CheckVessel())
        {
            _flyByWire = false;
            Mode = UIMode.SELECTED;
        }

        Vessel selectedVessel = FlightGlobals.Vessels[_selectedVesselIndex] as Vessel;

        //the above check should prevent a crash when the vessel we are looking for is destroyed
        //learn how to use list.exists etc...
        if (GUILayout.Button(selectedVessel.vesselName, sty, GUILayout.ExpandWidth(true)))
        {
            _flyByWire = false;
            Mode = UIMode.SELECTED;
        }

        GUILayout.Box("Distance: " + _targetDistance.ToString("F1"), GUILayout.Width(300));
        GUILayout.Box("Rel Inc : " + _relativeInclination.ToString("F3"));
        GUILayout.Box("Rel VelM: " + _relativeVelocity.magnitude.ToString("F2"));

        // Take the relative velocity and project into ship local space.
        _localRelativeVelocity = vessel.transform.worldToLocalMatrix.MultiplyVector(_relativeVelocity);
        _localRelativePosition = vessel.transform.worldToLocalMatrix.MultiplyPoint(selectedVessel.transform.position);

        if(GUILayout.Button(_killRelativeVelocity == false ? "Kill Rel Vel" : "FIRING", sty, GUILayout.ExpandWidth(true)))
            _killRelativeVelocity = !_killRelativeVelocity;

        if (GUILayout.Button(_homeOnRelativePosition == false ? "Home on Y+ 5m" : "HOMING", sty, GUILayout.ExpandWidth(true)))
            _homeOnRelativePosition = !_homeOnRelativePosition;

        GUILayout.Box("Rel Vel : " + _localRelativeVelocity.x.ToString("F2") + ", " + _localRelativeVelocity.y.ToString("F2") + ", " + _localRelativeVelocity.z.ToString("F2"));
        GUILayout.Box("Rel Pos : " + _localRelativePosition.x.ToString("F2") + ", " + _localRelativePosition.y.ToString("F2") + ", " + _localRelativePosition.z.ToString("F2"));

        if (_flyByWire == false)
        {
            GUILayout.BeginHorizontal();

            if (GUILayout.Button(ControlModeCaptions[0], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.RelativeVelocity;
                _modeChanged = true;
                _selectedFlyMode = 0;
            }

            if (GUILayout.Button(ControlModeCaptions[1], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.RelativeVelocityAway;
                _modeChanged = true;
                _selectedFlyMode = 1;
            }

            if (GUILayout.Button(ControlModeCaptions[2], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.Target;
                _modeChanged = true;
                _selectedFlyMode = 2;
            }

            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();

            if (GUILayout.Button(ControlModeCaptions[3], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.TargetAway;
                _modeChanged = true;
                _selectedFlyMode = 3;
            }

            if (GUILayout.Button(ControlModeCaptions[4], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.MatchTarget;
                _modeChanged = true;
                _selectedFlyMode = 4;
            }

            if (GUILayout.Button(ControlModeCaptions[5], sty, GUILayout.ExpandWidth(true)))
            {
                _flyByWire = true;
                PointAt = Orient.MatchTargetAway;
                _modeChanged = true;
                _selectedFlyMode = 5;
            }

            GUILayout.EndHorizontal();

        }

        if (_flyByWire)
        {
            if (GUILayout.Button("Disable " + ControlModeCaptions[_selectedFlyMode], sty, GUILayout.ExpandWidth(true)))
            {
                FlightInputHandler.SetNeutralControls();
                _flyByWire = false;
                _modeChanged = true;
            }
        }
    }
Exemplo n.º 50
0
    private void RenderSelectedUI(GUIStyle sty)
    {
        if (!CheckVessel())
        {
            _flyByWire = false;
            Mode = UIMode.SELECTED;
        }

        if (GUILayout.Button((FlightGlobals.Vessels[_selectedVesselIndex].vesselName), sty, GUILayout.ExpandWidth(true)))
        {
            _flyByWire = false;
            Mode = UIMode.VESSELS;
        }
        if (GUILayout.Button("Align Planes", sty, GUILayout.ExpandWidth(true)))
        {
            Mode = UIMode.ALIGN;
        }
        if (GUILayout.Button("Sync Orbits", sty, GUILayout.ExpandWidth(true)))
        {
            Mode = UIMode.SYNC;
        }
        if (GUILayout.Button("Rendezvous", sty, GUILayout.ExpandWidth(true)))
        {
            Mode = UIMode.RENDEZVOUS;
        }
    }
Exemplo n.º 51
0
        private void RenderTargetInfoUI(GUIStyle sty, GUIStyle but)
        {
            windowPos = new Rect(windowPos.x, windowPos.y, 10, 10);
            GUILayout.BeginVertical();
            if (GUILayout.Button("Back", but))
            {
                Mode = UIMode.TARGET_SELECTION;
                core.setTarget();
            }

            //align planes data
            GUILayout.Label("Time to AN : " + part.vessel.orbit.GetTimeToRelAN(core.targetOrbit()).ToString("F2"), sty);
            GUILayout.Label("Time to DN : " + part.vessel.orbit.GetTimeToRelDN(core.targetOrbit()).ToString("F2"), sty);
            GUILayout.Label("Relative Inclination :" + (core.targetOrbit().inclination - vesselState.orbitInclination).ToString("F2"), sty);

            //rendevous data
            if (core.distanceFromTarget() > 10000)
            {
                GUILayout.Label("Distance: " + (core.distanceFromTarget() / 1000).ToString("F1") + "km", GUILayout.Width(300));
            }
            else
            {
                GUILayout.Label("Distance: " + core.distanceFromTarget().ToString("F1") + "m", GUILayout.Width(300));
            }
            GUILayout.Label("Relative Velocity: " + core.relativeVelocityToTarget().magnitude.ToString("F2"));
            GUILayout.EndVertical();
        }
Exemplo n.º 52
0
        private void SwitchUIMode(UIMode mode)
        {
            if (mode == UIMode.Compact)
            {
                Application.Current.MainWindow.Hide();

                var compactView = new CompactView();
                compactView.Show();
            }
            else
            {
                foreach (var window in Application.Current.Windows)
                {
                    if (window is CompactView)
                    {
                        ((Window)window).Close();
                    }
                }

                Application.Current.MainWindow.Show();
            }

            CurrentUIMode = mode;
        }
Exemplo n.º 53
0
 private void RenderOffUI(GUIStyle sty, GUIStyle but)
 {
     if (GUILayout.Button("OPEN", but, GUILayout.ExpandWidth(true)))
     {
         Mode = UIMode.TARGET_SELECTION;
     }
 }