void AddLoginScreen()
 {
     if (MySteam.IsActive)
     {
         //MyGuiManager.BackToMainMenu();
     }
     else
     {
         MyGuiManager.AddScreen(new MyGuiScreenLogin(m_playerName, m_password, m_openAfterSuccessfulLogin));
     }
 }
 public void OnLogoutMessageBoxCallback(MyGuiScreenMessageBoxCallbackEnum callbackReturn)
 {
     if (callbackReturn == MyGuiScreenMessageBoxCallbackEnum.YES)
     {
         MyConfig.Username = "";
         MyConfig.Password = "";
         MyConfig.LastLoginWasSuccessful = false;
         MyConfig.Save();
         MyGuiManager.AddScreen(new MyGuiScreenLogoutProgress(OnLogoutProgressClosed));
     }
 }
 private void OnLoadSector(MyGuiControlButton sender)
 {
     MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.EditorLoadSectorMessage, MyTextsWrapperEnum.LoadSector, MyTextsWrapperEnum.Yes, MyTextsWrapperEnum.No,
                                                      mbReturn =>
     {
         if (mbReturn == MyGuiScreenMessageBoxCallbackEnum.YES)
         {
             MyEditor.Static.PerformContextMenuAction(MyGuiContextMenuItemActionType.LOAD_SECTOR);
         }
     }));
 }
 private void OnEditProperties(MyGuiControlButton sender)
 {
     if (MyEditorGizmo.SelectedEntities.Count > 0)
     {
         MyGuiManager.AddScreen(new MyGuiScreenEditorEditProperties(MyEditorGizmo.SelectedEntities));
     }
     else if (MyEditor.Static.GetEditedPrefabContainer() != null)
     {
         MyGuiManager.AddScreen(new MyGuiScreenEditorEditProperties(MyEditor.Static.GetEditedPrefabContainer()));
     }
 }
Exemple #5
0
        private void DisplayErrorMessage()
        {
            foreach (StringBuilder errorMessage in m_errorMessages)
            {
                MyMwcUtils.AppendStringBuilder(m_errorMessage, errorMessage);
                m_errorMessage.AppendLine();
            }
            StringBuilder caption = MyTextsWrapper.Get(m_errorMessages.Count > 1 ? MyTextsWrapperEnum.CaptionPropertiesAreNotValid : MyTextsWrapperEnum.CaptionPropertyIsNotValid);

            MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, m_errorMessage, caption, MyTextsWrapperEnum.Ok, null));
        }
Exemple #6
0
 protected override void OnOkClick(MyGuiControlButton sender)
 {
     if (!string.IsNullOrEmpty(m_nameTextbox.Text) && m_myGuiScreenEditorGroups.ChangeGroupName(m_group, m_nameTextbox.Text))
     {
         base.OnOkClick(sender);
     }
     else
     {
         MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.EditorGroupsNameUsedText, MyTextsWrapperEnum.EditorGroupsNameUsedCaption, MyTextsWrapperEnum.Ok, null));
     }
 }
 private void OnClearVoxelHands(MyGuiControlButton btn)
 {
     MyGuiManager.AddScreen(
         new MyGuiScreenMessageBox(
             MyMessageBoxType.MESSAGE,
             MyTextsWrapperEnum.ClearVoxelHandsWarning,
             MyTextsWrapperEnum.Warning,
             MyTextsWrapperEnum.Ok,
             MyTextsWrapperEnum.Cancel,
             ClearVoxelHands));
 }
        public void Start()
        {
            MyGuiManager.AddScreen(this);

            if (Background && BackgroundNotification.HasValue)
            {
                var notification = new MyHudNotification.MyNotification(BackgroundNotification.Value);
                MyHudNotification.AddNotification(notification);
                this.Closed += (screen) => notification.Disappear();
            }
        }
Exemple #9
0
        protected void HandleSectorServiceError(Exception exception, MyMasterServiceClient client)
        {
            // abort connection (reconnect will restore connection after few seconds
            client.Abort();
            MyMwcLog.WriteLine(exception); // log exception

            // Show error dialog and go to main menu
            MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.PleaseTryAgain, MyTextsWrapperEnum.MessageBoxNetworkErrorCaption, MyTextsWrapperEnum.Ok, null));
            CloseScreen();
            MyGuiManager.BackToMainMenu();
        }
        private void ShowRetryDialog(Exception exception)
        {
            var messageBoxCaption = MyTextsWrapper.Get(RetryCaptionText);
            var messageBoxMessage = MyTextsWrapper.Get(RetryMessageText);

            Vector2 buttonSize = new Vector2(MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.X * 2.4f, MyGuiConstants.MESSAGE_BOX_BUTTON_SIZE.Y);

            m_retryScreen = new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyMessageBoxButtonsType.YES_NO, messageBoxMessage, messageBoxCaption, null, RetryButtonText,
                                                      RetryCancelText, (callbackReturn) => MessageBoxCallback(exception, callbackReturn), false, buttonSize);

            MyGuiManager.AddScreen(m_retryScreen);
        }
Exemple #11
0
 public void OnNewGameClick(MyGuiControlButton sender)
 {
     if (MyClientServer.LoggedPlayer.HasAnyCheckpoints)
     {
         MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.MessageAreYouSureYouWantStartNewStory,
                                                          MyTextsWrapperEnum.TitleStartNewStory, MyTextsWrapperEnum.Ok, MyTextsWrapperEnum.Cancel, StartNewStoryMessageBoxCallback));
     }
     else
     {
         StartNewStory();
     }
 }
Exemple #12
0
 //
 public bool IsValidPositionInput(Vector3 position)
 {
     if (position != MyEditorGizmo.GetSelectedObjectsCenter())
     {
         return(true);
     }
     else
     {
         MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.InvalidPositionCoordinates, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
         return(false);
     }
 }
Exemple #13
0
        private void OnRenameButtonClick(MyGuiControlButton sender)
        {
            var selectedItem = m_templatesListbox.GetSelectedItem();

            if (selectedItem != null)
            {
                var selectedType = (MyMwcObjectBuilder_SmallShip_TypesEnum)m_shipTypeCombobox.GetSelectedKey();
                m_selectedTemplate = MySmallShipTemplates.GetTemplate(selectedType, selectedItem.Value);

                MyGuiManager.AddScreen(new MyGuiScreenInputString(NameForRenameChosen, MyTextsWrapperEnum.NewTemplateName, m_selectedTemplate.Name));
            }
        }
Exemple #14
0
        private void OnAddObjects(MyGuiControlButton sender)
        {
            var group = GetFocusedGroup();

            if (group != null)
            {
                if (!group.AddObjects(MyEditorGizmo.SelectedEntities))
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, new StringBuilder("Can't add objects. Objects must be in same container."), new StringBuilder("Add Objects Error"), MyTextsWrapperEnum.Ok, null));
                }
            }
        }
 public void TravelToSectorCallback()
 {
     MyGuiManager.AddScreen(new MyGuiScreenStartSessionProgress(
                                MyMwcStartSessionRequestTypeEnum.SANDBOX_OWN,
                                MyTextsWrapperEnum.StartGameInProgressPleaseWait,
                                new MyMwcSectorIdentifier(
                                    MyMwcSectorTypeEnum.STORY, MyClientServer.LoggedPlayer.GetUserId(),
                                    m_sectorToTravel, null),
                                MyGameplayDifficultyEnum.EASY,
                                null,
                                null));
 }
 public void Run()
 {
     MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);
     try
     {
         StartNewGame();
     }
     catch (MyDataCorruptedException e)
     {
         MyMwcLog.WriteLine(e);
         MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.LocalDataCorrupted, MyTextsWrapperEnum.Error, OnErrorClose));
     }
 }
Exemple #17
0
 public static void Show(
     MyTextsWrapperEnum text,
     MyTextsWrapperEnum caption = MyTextsWrapperEnum.Blank,
     MyMessageBoxType type      = MyMessageBoxType.MESSAGE)
 {
     MyGuiManager.AddScreen(
         new MyGuiScreenMessageBox(
             type,
             text,
             caption,
             MyTextsWrapperEnum.Ok,
             null));
 }
Exemple #18
0
 protected override void OnOkClick(MyGuiControlButton sender)
 {
     if (!string.IsNullOrEmpty(m_nameTextbox.Text) /* all OK */)
     {
         m_renameHandler(m_oldName, m_nameTextbox.Text, this);
         base.OnOkClick(sender);
     }
     else
     {
         // TODO: change texts
         MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
     }
 }
Exemple #19
0
 public void OnSearchClick(MyGuiControlButton sender)
 {
     if (m_findPlayerName != null && m_findPlayerName.Text != null && m_findPlayerName.Text.Length > 0)
     {
         MyGuiManager.AddScreen(new MyGuiScreenSelectSandboxProgress(MyMwcSelectSectorRequestTypeEnum.FIND_BY_PLAYER_NAME, MyTextsWrapperEnum.LoadingPleaseWait,
                                                                     this, m_findPlayerName.Text, AddSectorsResponse));
     }
     else
     {
         MyGuiManager.AddScreen(new MyGuiScreenSelectSandboxProgress(MyMwcSelectSectorRequestTypeEnum.STORY, MyTextsWrapperEnum.LoadingPleaseWait,
                                                                     this, null, AddSectorsResponse));
     }
 }
 private void LoadMarks(bool forceReload)
 {
     if (SectorCache == null || forceReload) // Load sectors, after successful load, add marks
     {
         SectorCache = new List <MyMwcSectorIdentifier>();
         var progressScreen = new MyGuiScreenLoadSectorIdentifiersProgress(MyMwcSectorTypeEnum.STORY, true, SectorIdentifiersLoaded);
         MyGuiManager.AddScreen(progressScreen);
     }
     else
     {
         AddMarks(); // Add marks now
     }
 }
        public override bool CloseScreen()
        {
            bool ret = base.CloseScreen();

            if (ret == true && m_screenToLoad != null)
            {
                //  Screen is loaded so now we can add it to other thread
                MyGuiManager.AddScreen(m_screenToLoad);
                m_screenToLoad = null;
            }

            return(ret);
        }
Exemple #22
0
        public override void OnOkClick(MyGuiControlButton sender)
        {
            if (m_respawnPoint.Checked && m_respawnPointCombo.GetSelectedKey() == (int)MyMwcObjectBuilder_FactionEnum.None)
            {
                MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.PleaseSelectValidFaction, MyTextsWrapperEnum.InvalidFaction, MyTextsWrapperEnum.Ok, null));
                return;
            }

            base.OnOkClick(sender);
            DummyPoint.Activate(m_activatedCheckbox.Checked, false);
            // close all opened screens except gameplay
            MyGuiManager.CloseAllScreensExcept(MyGuiScreenGamePlay.Static);
        }
Exemple #23
0
        private void OnSelectGroup(MyGuiControlButton sender)
        {
            var group = GetFocusedGroup();

            if (group != null && group.GetCount() > 0)
            {
                var container = group.GetContainer();
                if (MyEditor.Static.IsEditingPrefabContainer() && MyEditor.Static.GetEditedPrefabContainer() == container)
                {
                    MyEditorGizmo.AddEntitiesToSelection(group.GetEntities());
                }
                else
                {
                    var editorState   = MyEditor.GetCurrentState();
                    var contextHelper = MyGuiContextMenuHelpers.GetEditorContextMenuHelper(editorState);

                    // If exit/enter to prefab container available
                    if (container != null &&
                        (editorState == MyEditorStateEnum.NOTHING_SELECTED ||
                         contextHelper.IsActionTypeAvailable(MyGuiContextMenuItemActionType.ENTER_PREFAB_CONTAINER) ||
                         contextHelper.IsActionTypeAvailable(MyGuiContextMenuItemActionType.EXIT_EDITING_MODE)))
                    {
                        // Switch to group container
                        if (MyEditor.Static.IsEditingPrefabContainer())
                        {
                            MyEditor.Static.ExitActivePrefabContainer();
                        }
                        MyEditor.Static.EditPrefabContainer(container);

                        if (MyEditor.Static.IsEditingPrefabContainer() && MyEditor.Static.GetEditedPrefabContainer() == container)
                        {
                            MyEditorGizmo.AddEntitiesToSelection(group.GetEntities());
                        }
                    }
                    else if (container == null)
                    {
                        if (MyEditor.Static.IsEditingPrefabContainer())
                        {
                            MyEditor.Static.ExitActivePrefabContainer();
                        }
                        MyEditorGizmo.ClearSelection();
                        MyEditorGizmo.AddEntitiesToSelection(group.GetEntities());
                    }
                    else
                    {
                        MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, new StringBuilder("Can't select group."), new StringBuilder("Select Group Error"), MyTextsWrapperEnum.Ok, null));
                    }
                }
            }
        }
 private void StartUse()
 {
     m_inUse = true;
     if (m_requiredTime == 0)
     {
         FinishUse();
         return;
     }
     else
     {
         m_useProgress.Reset();
         MyGuiManager.AddScreen(m_useProgress);
     }
 }
Exemple #25
0
        public void OnOkClick(MyGuiControlButton sender)
        {
            MyTextsWrapperEnum?errorMessage = ValidateInput();

            if (errorMessage.HasValue)
            {
                MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, errorMessage.Value,
                                                                 MyTextsWrapperEnum.MessageBoxCaptionError, MyTextsWrapperEnum.Ok, null));
            }
            else
            {
                MyGuiScreenRegisterProgress registerProgressScreen = new MyGuiScreenRegisterProgress(m_usernameTextbox.Text, m_passwordTextbox.Text, m_emailTextbox.Text, m_sendNewslettersCheckbox.Checked, m_openAfterSuccesfullRegistration, this);
                MyGuiManager.AddScreen(registerProgressScreen);
            }
        }
Exemple #26
0
        private void OnCreateGroup(MyGuiControlButton sender)
        {
            var generatedName = new StringBuilder(GenerateName("Group"));
            var group         = new MyObjectGroup(generatedName);

            if (group.AddObjects(MyEditorGizmo.SelectedEntities))
            {
                AddGroup(group);
                MyEditor.Static.ObjectGroups.Add(group);
            }
            else
            {
                MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.ERROR, MyTextsWrapperEnum.EditorGroupsCantCreateGroupText, MyTextsWrapperEnum.EditorGroupsCantCreateGroupCaption, MyTextsWrapperEnum.Ok, null));
            }
        }
        private void OnInventoryClick(MyGuiControlButton sender)
        {
            MyInventory inventory = new MyInventory();

            inventory.FillInventoryWithAllItems(null, 100);

            List <MySmallShipBuilderWithName> tempList = new List <MySmallShipBuilderWithName>();

            tempList.Add(new MySmallShipBuilderWithName(m_bot.GetObjectBuilder(true) as MyMwcObjectBuilder_SmallShip_Bot));

            MyGuiScreenInventory inventoryScreen = new MyGuiScreenInventory(tempList, 0, inventory.GetObjectBuilder(false), null, true);

            inventoryScreen.OnSave += OnEditBotFromScreen;
            MyGuiManager.AddScreen(inventoryScreen);
        }
 /// <summary>
 /// Removes entities(in separate thread if needed - voxelmaps)
 /// </summary>
 internal void RemoveInBackgroundThread()
 {
     // Remove in separate thread only for voxel maps
     if (ActionEntities.OfType <MyVoxelMap>().Any())
     {
         Thread thread = new Thread(new ThreadStart(this.RemoveFromScene));
         thread.Name = "RemoveFromScene";
         MyEditor.Static.StartBackgroundThread(thread);
         MyGuiManager.AddScreen(new MyGuiScreenEditorProgress(MyTextsWrapperEnum.LoadingPleaseWait, false));
     }
     else
     {
         RemoveFromScene();
     }
 }
 /// <summary>
 /// Add or create entities(in separate thread if needed - voxelmaps)
 /// </summary>
 internal void AddOrCreateInBackgroundThread()
 {
     // Perform in separate thread only for voxel maps
     if (ActionObjectBuilders.Find(a => a.ObjectBuilder is MyMwcObjectBuilder_VoxelMap) != null)
     {
         Thread thread = new Thread(new ThreadStart(this.AddOrCreate));
         thread.Name = "AddOrCreate";
         MyEditor.Static.StartBackgroundThread(thread);
         MyGuiManager.AddScreen(new MyGuiScreenEditorProgress(MyTextsWrapperEnum.LoadingPleaseWait, false));
     }
     else
     {
         AddOrCreate();
     }
 }
Exemple #30
0
        public void OnOkClick(MyGuiControlButton sender)
        {
            if (m_sectors.Count == 0)
            {
                return;
            }

            MyMwcSectorIdentifier sectorIdentifier = m_sectors[m_sectorsListbox.GetSelectedItemKey().Value];

            if (m_startSessionType == MyMwcStartSessionRequestTypeEnum.SANDBOX_FRIENDS)
            {
                //Remove 25D sectors from 2081 game and non 25D sectors from 25D game.
                if (sectorIdentifier.SectorName.ToUpper().Contains("2.5D") || sectorIdentifier.SectorName.ToUpper().Contains("2,5D"))
                {
                    if (!MyClientServer.MW25DEnabled)
                    {
                        MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.MESSAGE, MyTextsWrapperEnum.YouNeed25D, MyTextsWrapperEnum.MessageBoxCaptionFeatureDisabled, MyTextsWrapperEnum.Ok, null));
                        return;
                    }
                }
                else if (!MyClientServer.HasFullGame)
                {
                    MyGuiManager.AddScreen(new MyGuiScreenMessageBox(MyMessageBoxType.MESSAGE, MyTextsWrapperEnum.YouNeedFullGame, MyTextsWrapperEnum.MessageBoxCaptionFeatureDisabled, MyTextsWrapperEnum.Ok, null));
                    return;
                }
            }


            MyConfig.LastSandboxSector = sectorIdentifier.Position;
            MyConfig.Save();

            MyGuiManager.CloseAllScreensNowExcept(MyGuiScreenGamePlay.Static);

            if (CustomLoadAction != null)
            {
                CustomLoadAction(sectorIdentifier);
            }
            else
            {
                MyGuiManager.AddScreen(new MyGuiScreenStartSessionProgress(m_startSessionType, m_startSessionProgressText,
                                                                           sectorIdentifier,
                                                                           CommonLIB.AppCode.ObjectBuilders.MyGameplayDifficultyEnum.EASY,
                                                                           null,
                                                                           m_closeAfterSuccessfulEnter));
            }
        }