Beispiel #1
0
 private void OnClickNewWorld(MyGuiControlButton sender)
 {
     if (MyFakes.ENABLE_TUTORIAL_PROMPT && MySandboxGame.Config.NeedShowTutorialQuestion)
     {
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(buttonType : MyMessageBoxButtonsType.YES_NO,
                                                              messageText : MyTexts.Get(MySpaceTexts.MessageBoxTextTutorialQuestion),
                                                              messageCaption : MyTexts.Get(MySpaceTexts.MessageBoxCaptionVideoTutorial),
                                                              callback : delegate(MyGuiScreenMessageBox.ResultEnum val)
         {
             if (val == MyGuiScreenMessageBox.ResultEnum.YES)
             {
                 MyGuiSandbox.OpenUrlWithFallback(MySteamConstants.URL_GUIDE_DEFAULT, "Steam Guide");
             }
             else
             {
                 MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen <MyGuiScreenStartSandbox>());
             }
         }));
         MySandboxGame.Config.NeedShowTutorialQuestion = false;
         MySandboxGame.Config.Save();
     }
     else
     {
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen <MyGuiScreenStartSandbox>());
     }
 }
Beispiel #2
0
 public void SetTrue()
 {
     IsTrue = true;
     if (WwwLink != null && WwwLink.Length > 0)
     {
         MyGuiSandbox.OpenUrlWithFallback(WwwLink, "Scenario info");
     }
 }
Beispiel #3
0
        public static void LoadMultiplayerScenarioWorld(MyObjectBuilder_World world, MyMultiplayerBase multiplayerSession)
        {
            Debug.Assert(MySession.Static != null);

            MyLog.Default.WriteLine("LoadMultiplayerScenarioWorld() - Start");

            if (world.Checkpoint.BriefingVideo != null && world.Checkpoint.BriefingVideo.Length > 0)
            {
                MyGuiSandbox.OpenUrlWithFallback(world.Checkpoint.BriefingVideo, "Scenario briefing video", true);
            }

            if (!MySteamWorkshop.CheckLocalModsAllowed(world.Checkpoint.Mods, false))
            {
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                           messageCaption : MyTexts.Get(MyCommonTexts.MessageBoxCaptionError),
                                           messageText : MyTexts.Get(MyCommonTexts.DialogTextLocalModsDisabledInMultiplayer),
                                           buttonType : MyMessageBoxButtonsType.OK,
                                           callback : delegate(MyGuiScreenMessageBox.ResultEnum result) { MySessionLoader.UnloadAndExitToMenu(); }));
                MyLog.Default.WriteLine("LoadMultiplayerScenarioWorld() - End");
                return;
            }

            MySteamWorkshop.DownloadModsAsync(world.Checkpoint.Mods,
                                              onFinishedCallback : delegate(bool success, string mismatchMods)
            {
                if (success)
                {
                    CheckMismatchmods(mismatchMods, callback : delegate(ResultEnum val)
                    {
                        MyScreenManager.CloseAllScreensNowExcept(null);
                        MyGuiSandbox.Update(MyEngineConstants.UPDATE_STEP_SIZE_IN_MILLISECONDS);

                        StartLoading(delegate
                        {
                            MySession.Static.LoadMultiplayerWorld(world, multiplayerSession);
                            if (ScenarioWorldLoaded != null)
                            {
                                ScenarioWorldLoaded();
                            }
                        });
                    });
                }
                else
                {
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                               messageCaption : MyTexts.Get(MyCommonTexts.MessageBoxCaptionError),
                                               messageText : MyTexts.Get(MyCommonTexts.DialogTextDownloadModsFailed),
                                               buttonType : MyMessageBoxButtonsType.OK,
                                               callback : delegate(MyGuiScreenMessageBox.ResultEnum result) { MySessionLoader.UnloadAndExitToMenu(); }));
                }
                MyLog.Default.WriteLine("LoadMultiplayerScenarioWorld() - End");
            },
                                              onCancelledCallback : delegate()
            {
                MySessionLoader.UnloadAndExitToMenu();
            });
        }
        private static void OnVideoMessageBox(MyGuiScreenMessageBox.ResultEnum result)
        {
            if (result == MyGuiScreenMessageBox.ResultEnum.YES)
                MyGuiSandbox.OpenUrlWithFallback(m_checkpointData.Value.Checkpoint.BriefingVideo, "Scenario briefing video", true);

            var checkpointData = m_checkpointData.Value;
            m_checkpointData = null;
            LoadMission(checkpointData);
        }
Beispiel #5
0
 public void SetTrue()
 {
     IsTrue = true;
     if (WwwLink != null && WwwLink.Length > 0)
     {
         MyGuiSandbox.OpenUrlWithFallback(WwwLink, "Scenario info", true);
     }
     if (NextMission != null && NextMission.Length > 0 && MySession.Static.IsScenario)
     {
         MyScenarioSystem.LoadNextScenario(NextMission);
     }
 }
Beispiel #6
0
        private void OnBrowseWorkshopClick(MyGuiControlButton obj)
        {
            MyGuiSandbox.OpenUrlWithFallback(MySteamConstants.URL_BROWSE_WORKSHOP_WORLDS, "Steam Workshop");

            //if (!MySteam.IsOverlayEnabled)
            //{
            //    // message box
            //    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(MyMessageBoxStyleEnum.Error, MyMessageBoxButtonsType.OK,
            //        MyTexts.Get(MySpaceTexts.SteamOverlayDisabledText), MyTexts.Get(MySpaceTexts.SteamOverlayDisabledCaption)));
            //}
            //else
            //{
            //    MySteam.OpenOverlayUrl(MySteamConstants.URL_BROWSE_WORKSHOP_WORLDS);
            //}
        }
Beispiel #7
0
 private void ShowCurrentNews()
 {
     if (m_newsControl == null)
     {
         return;
     }
     MyNewsLink[] newsLinks = m_newsControl.NewsLinks;
     if (newsLinks != null && newsLinks.Length != 0)
     {
         MyNewsLink myNewsLink = m_newsControl.NewsLinks[0];
         if (!string.IsNullOrEmpty(myNewsLink.Link))
         {
             MyGuiSandbox.OpenUrlWithFallback(myNewsLink.Link, myNewsLink.Text);
         }
     }
 }
Beispiel #8
0
 void OnOpenInWorkshop(MyGuiControlButton button)
 {
     if (m_publishedItemId != null)
     {
         string url = string.Format("http://steamcommunity.com/sharedfiles/filedetails/?id={0}", m_publishedItemId);
         MyGuiSandbox.OpenUrlWithFallback(url, "Steam Workshop");
     }
     else
     {
         MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                    buttonType: MyMessageBoxButtonsType.OK,
                                    styleEnum: MyMessageBoxStyleEnum.Error,
                                    messageCaption: new StringBuilder("Invalid workshop id"),
                                    messageText: new StringBuilder("")
                                    ));
     }
 }
Beispiel #9
0
        private void OnOpenInWorkshopClick(MyGuiControlButton obj)
        {
            if (m_selectedRow == null)
            {
                return;
            }

            var mod = m_selectedRow.UserData;

            if (mod == null)
            {
                return;
            }

            string url = string.Format(MySteamConstants.URL_WORKSHOP_VIEW_ITEM_FORMAT, ((MyObjectBuilder_Checkpoint.ModItem)mod).PublishedFileId);

            MyGuiSandbox.OpenUrlWithFallback(url, "Steam Workshop");
        }
Beispiel #10
0
        private void OnOpenInWorkshopClick(MyGuiControlButton obj)
        {
            var selectedRow = m_worldsTable.SelectedRow;

            if (selectedRow == null)
            {
                return;
            }

            var world = (MySteamWorkshop.SubscribedItem)selectedRow.UserData;

            if (world == null)
            {
                return;
            }

            string url = string.Format(MySteamConstants.URL_WORKSHOP_VIEW_ITEM_FORMAT, world.PublishedFileId);

            MyGuiSandbox.OpenUrlWithFallback(url, "Steam Workshop");
        }
Beispiel #11
0
        public void OnBattleClick(MyGuiControlButton sender)
        {
            if (MySteam.IsOnline)
            {
                if (MyFakes.ENABLE_TUTORIAL_PROMPT && MySandboxGame.Config.NeedShowBattleTutorialQuestion)
                {
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(buttonType : MyMessageBoxButtonsType.YES_NO,
                                                                         messageText : MyTexts.Get(MySpaceTexts.MessageBoxTextTutorialQuestion),
                                                                         messageCaption : MyTexts.Get(MyCommonTexts.MessageBoxCaptionVideoTutorial),
                                                                         callback : delegate(MyGuiScreenMessageBox.ResultEnum val)
                    {
                        if (val == MyGuiScreenMessageBox.ResultEnum.YES)
                        {
                            MyGuiSandbox.OpenUrlWithFallback(MySteamConstants.URL_GUIDE_BATTLE, "Steam Guide");
                        }
                        else
                        {
                            MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.BattleScreen));
                        }
                    }));

                    MySandboxGame.Config.NeedShowBattleTutorialQuestion = false;
                    MySandboxGame.Config.Save();
                }
                else
                {
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateScreen(MyPerGameSettings.GUI.BattleScreen));
                }
            }
            else
            {
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                           buttonType: MyMessageBoxButtonsType.OK,
                                           messageCaption: MyTexts.Get(MyCommonTexts.MessageBoxCaptionError),
                                           messageText: MyTexts.Get(MyCommonTexts.SteamIsOfflinePleaseRestart)
                                           ));
            }
        }
 private void OnBrowseWorkshopClick(MyGuiControlButton obj)
 {
     MyGuiSandbox.OpenUrlWithFallback(MySteamConstants.URL_BROWSE_WORKSHOP_SCENARIOS, "Steam Workshop");
 }
 private void OnSteamGuideClick(MyGuiControlButton sender)
 {
     MyGuiSandbox.OpenUrlWithFallback(MySteamConstants.URL_GUIDE_DEFAULT, "Steam Guide");
 }
        void OnOpenInWorkshop(MyGuiControlButton button)
        {
            string url = string.Format("http://steamcommunity.com/sharedfiles/filedetails/?id={0}", m_selectedItem.SteamItem.PublishedFileId);

            MyGuiSandbox.OpenUrlWithFallback(url, "Steam Workshop");
        }
 void OnOpenWorkshop(MyGuiControlButton button)
 {
     MyGuiSandbox.OpenUrlWithFallback(MySteamConstants.URL_BROWSE_WORKSHOP_INGAMESCRIPTS, "Steam Workshop");
 }
 void HelpButtonClicked(MyGuiControlButton button)
 {
     MyGuiSandbox.OpenUrlWithFallback(MySteamConstants.URL_BROWSE_WORKSHOP_INGAMESCRIPTS_HELP, "Steam Workshop");
 }
        public static void LoadMission(string sessionPath, bool multiplayer, MyOnlineModeEnum onlineMode, short maxPlayers)
        {
            MyLog.Default.WriteLine("LoadSession() - Start");
            MyLog.Default.WriteLine(sessionPath);

            ulong checkpointSizeInBytes;
            var   checkpoint = MyLocalCache.LoadCheckpoint(sessionPath, out checkpointSizeInBytes);

            checkpoint.Settings.OnlineMode       = onlineMode;
            checkpoint.Settings.MaxPlayers       = maxPlayers;
            checkpoint.Settings.Scenario         = true;
            checkpoint.Settings.GameMode         = MyGameModeEnum.Survival;
            checkpoint.Settings.ScenarioEditMode = false;

            if (!MySession.IsCompatibleVersion(checkpoint))
            {
                MyLog.Default.WriteLine(MyTexts.Get(MySpaceTexts.DialogTextIncompatibleWorldVersion).ToString());
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                           messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError),
                                           messageText: MyTexts.Get(MySpaceTexts.DialogTextIncompatibleWorldVersion),
                                           buttonType: MyMessageBoxButtonsType.OK));
                MyLog.Default.WriteLine("LoadSession() - End");
                return;
            }

            if (checkpoint.BriefingVideo != null && checkpoint.BriefingVideo.Length > 0)
            {
                MyGuiSandbox.OpenUrlWithFallback(checkpoint.BriefingVideo, "Scenario briefing video");
            }

            if (!MySteamWorkshop.CheckLocalModsAllowed(checkpoint.Mods, checkpoint.Settings.OnlineMode == MyOnlineModeEnum.OFFLINE))
            {
                MyLog.Default.WriteLine(MyTexts.Get(MySpaceTexts.DialogTextLocalModsDisabledInMultiplayer).ToString());
                MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                           messageCaption: MyTexts.Get(MySpaceTexts.MessageBoxCaptionError),
                                           messageText: MyTexts.Get(MySpaceTexts.DialogTextLocalModsDisabledInMultiplayer),
                                           buttonType: MyMessageBoxButtonsType.OK));
                MyLog.Default.WriteLine("LoadSession() - End");
                return;
            }


            MySteamWorkshop.DownloadModsAsync(checkpoint.Mods, delegate(bool success)
            {
                if (success || (checkpoint.Settings.OnlineMode == MyOnlineModeEnum.OFFLINE) && MySteamWorkshop.CanRunOffline(checkpoint.Mods))
                {
                    //Sandbox.Audio.MyAudio.Static.Mute = true;

                    MyScreenManager.CloseAllScreensNowExcept(null);
                    MyGuiSandbox.Update(MyEngineConstants.UPDATE_STEP_SIZE_IN_MILLISECONDS);

                    // May be called from gameplay, so we must make sure we unload the current game
                    if (MySession.Static != null)
                    {
                        MySession.Static.Unload();
                        MySession.Static = null;
                    }

                    //seed 0 has special meaning - please randomize at mission start. New seed will be saved and game will run with it ever since.
                    //  if you use this, YOU CANNOT HAVE ANY PROCEDURAL ASTEROIDS ALREADY SAVED
                    if (checkpoint.Settings.ProceduralSeed == 0)
                    {
                        checkpoint.Settings.ProceduralSeed = MyRandom.Instance.Next();
                    }

                    MyGuiScreenGamePlay.StartLoading(delegate
                    {
                        checkpoint.Settings.Scenario = true;
                        MySession.LoadMission(sessionPath, checkpoint, checkpointSizeInBytes);
                    });
                }
                else
                {
                    MyLog.Default.WriteLine(MyTexts.Get(MySpaceTexts.DialogTextDownloadModsFailed).ToString());
                    MyGuiSandbox.AddScreen(MyGuiSandbox.CreateMessageBox(
                                               messageCaption : MyTexts.Get(MySpaceTexts.MessageBoxCaptionError),
                                               messageText : MyTexts.Get(MySpaceTexts.DialogTextDownloadModsFailed),
                                               buttonType : MyMessageBoxButtonsType.OK, callback : delegate(MyGuiScreenMessageBox.ResultEnum result)
                    {
                        if (MyFakes.QUICK_LAUNCH != null)
                        {
                            MyGuiScreenMainMenu.ReturnToMainMenu();
                        }
                    }));
                }
                MyLog.Default.WriteLine("LoadSession() - End");
            });
        }