Ejemplo n.º 1
0
 public override void Enter(object[] parameters)
 {
     if (ScreensManager.PreviousScreen != ScreensManager.FindScreen <Screen>("HelpTopic") && ScreensManager.PreviousScreen != ScreensManager.FindScreen <Screen>("Recipaedia") && ScreensManager.PreviousScreen != ScreensManager.FindScreen <Screen>("Bestiary"))
     {
         m_previousScreen = ScreensManager.PreviousScreen;
     }
 }
Ejemplo n.º 2
0
 public override void Update()
 {
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen(ScreensManager.PreviousScreen);
     }
 }
Ejemplo n.º 3
0
 public override void Update()
 {
     if (m_performanceButton.IsClicked)
     {
         ScreensManager.SwitchScreen("SettingsPerformance");
     }
     if (m_graphicsButton.IsClicked)
     {
         ScreensManager.SwitchScreen("SettingsGraphics");
     }
     if (m_uiButton.IsClicked)
     {
         ScreensManager.SwitchScreen("SettingsUi");
     }
     if (m_compatibilityButton.IsClicked)
     {
         ScreensManager.SwitchScreen("SettingsCompatibility");
     }
     if (m_audioButton.IsClicked)
     {
         ScreensManager.SwitchScreen("SettingsAudio");
     }
     if (m_controlsButton.IsClicked)
     {
         ScreensManager.SwitchScreen("SettingsControls");
     }
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen(m_previousScreen);
         m_previousScreen = null;
     }
 }
 public override void Update()
 {
     if (m_virtualRealityButton.IsClicked)
     {
         if (SettingsManager.UseVr)
         {
             SettingsManager.UseVr = false;
             VrManager.StopVr();
         }
         else
         {
             SettingsManager.UseVr = true;
             VrManager.StartVr();
         }
     }
     if (m_brightnessSlider.IsSliding)
     {
         SettingsManager.Brightness = m_brightnessSlider.Value;
     }
     m_virtualRealityButton.IsEnabled = VrManager.IsVrAvailable;
     m_virtualRealityButton.Text      = (SettingsManager.UseVr ? "Enabled" : "Disabled");
     m_brightnessSlider.Value         = SettingsManager.Brightness;
     m_brightnessSlider.Text          = MathUtils.Round(SettingsManager.Brightness * 10f).ToString();
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen(ScreensManager.PreviousScreen);
     }
 }
Ejemplo n.º 5
0
        public GameLoadingScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/GameLoadingScreen");

            LoadContents(this, node);
            m_stateMachine.AddState("WaitingForFadeIn", null, delegate
            {
                if (!ScreensManager.IsAnimating)
                {
                    if (string.IsNullOrEmpty(m_worldSnapshotName))
                    {
                        m_stateMachine.TransitionTo("Loading");
                    }
                    else
                    {
                        m_stateMachine.TransitionTo("RestoringSnapshot");
                    }
                }
            }, null);
            m_stateMachine.AddState("Loading", null, delegate
            {
                ContainerWidget gamesWidget = ScreensManager.FindScreen <GameScreen>("Game").Children.Find <ContainerWidget>("GamesWidget");
                GameManager.LoadProject(m_worldInfo, gamesWidget);
                ScreensManager.SwitchScreen("Game");
            }, null);
            m_stateMachine.AddState("RestoringSnapshot", null, delegate
            {
                GameManager.DisposeProject();
                WorldsManager.RestoreWorldFromSnapshot(m_worldInfo.DirectoryName, m_worldSnapshotName);
                m_stateMachine.TransitionTo("Loading");
            }, null);
        }
Ejemplo n.º 6
0
        public RecipaediaScreen()
        {
            XElement node = ContentManager.Get <XElement>("Screens/RecipaediaScreen");

            LoadContents(this, node);
            m_blocksList         = Children.Find <ListPanelWidget>("BlocksList");
            m_categoryLabel      = Children.Find <LabelWidget>("Category");
            m_prevCategoryButton = Children.Find <ButtonWidget>("PreviousCategory");
            m_nextCategoryButton = Children.Find <ButtonWidget>("NextCategory");
            m_detailsButton      = Children.Find <ButtonWidget>("DetailsButton");
            m_recipesButton      = Children.Find <ButtonWidget>("RecipesButton");
            m_categories.Add(null);
            m_categories.AddRange(BlocksManager.Categories);
            m_blocksList.ItemWidgetFactory = delegate(object item)
            {
                int             value = (int)item;
                int             num   = Terrain.ExtractContents(value);
                Block           block = BlocksManager.Blocks[num];
                XElement        node2 = ContentManager.Get <XElement>("Widgets/RecipaediaItem");
                ContainerWidget obj   = (ContainerWidget)Widget.LoadWidget(this, node2, null);
                obj.Children.Find <BlockIconWidget>("RecipaediaItem.Icon").Value = value;
                obj.Children.Find <LabelWidget>("RecipaediaItem.Text").Text      = block.GetDisplayName(null, value);
                obj.Children.Find <LabelWidget>("RecipaediaItem.Details").Text   = block.GetDescription(value);
                return(obj);
            };
            m_blocksList.ItemClicked += delegate(object item)
            {
                if (m_blocksList.SelectedItem == item && item is int)
                {
                    ScreensManager.SwitchScreen("RecipaediaDescription", item, m_blocksList.Items.Cast <int>().ToList());
                }
            };
        }
Ejemplo n.º 7
0
 public override void Update()
 {
     if (m_windowModeButton.IsClicked)
     {
         SettingsManager.WindowMode = (WindowMode)((int)(SettingsManager.WindowMode + 1) % EnumUtils.GetEnumValues(typeof(WindowMode)).Count);
     }
     if (m_languageButton.IsClicked)
     {
         DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get(fName, 1), LanguageControl.Get(fName, 2), LanguageControl.Get("Usual", "yes"), LanguageControl.Get("Usual", "no"), delegate(MessageDialogButton button)
         {
             if (button == MessageDialogButton.Button1)
             {
                 ModsManager.modSettings.languageType = (LanguageControl.LanguageType)((int)(ModsManager.modSettings.languageType + 1) % EnumUtils.GetEnumValues(typeof(LanguageControl.LanguageType)).Count);
                 ModsManager.SaveSettings();
                 System.Environment.Exit(0);
             }
         }));
     }
     if (m_uiSizeButton.IsClicked)
     {
         SettingsManager.GuiSize = (GuiSize)((int)(SettingsManager.GuiSize + 1) % EnumUtils.GetEnumValues(typeof(GuiSize)).Count);
     }
     if (m_upsideDownButton.IsClicked)
     {
         SettingsManager.UpsideDownLayout = !SettingsManager.UpsideDownLayout;
     }
     if (m_hideMoveLookPadsButton.IsClicked)
     {
         SettingsManager.HideMoveLookPads = !SettingsManager.HideMoveLookPads;
     }
     if (m_showGuiInScreenshotsButton.IsClicked)
     {
         SettingsManager.ShowGuiInScreenshots = !SettingsManager.ShowGuiInScreenshots;
     }
     if (m_showLogoInScreenshotsButton.IsClicked)
     {
         SettingsManager.ShowLogoInScreenshots = !SettingsManager.ShowLogoInScreenshots;
     }
     if (m_screenshotSizeButton.IsClicked)
     {
         SettingsManager.ScreenshotSize = (ScreenshotSize)((int)(SettingsManager.ScreenshotSize + 1) % EnumUtils.GetEnumValues(typeof(ScreenshotSize)).Count);
     }
     if (m_communityContentModeButton.IsClicked)
     {
         SettingsManager.CommunityContentMode = (CommunityContentMode)((int)(SettingsManager.CommunityContentMode + 1) % EnumUtils.GetEnumValues(typeof(CommunityContentMode)).Count);
     }
     m_windowModeButton.Text            = LanguageControl.Get("WindowMode", SettingsManager.WindowMode.ToString());
     m_uiSizeButton.Text                = LanguageControl.Get("GuiSize", SettingsManager.GuiSize.ToString());
     m_languageButton.Text              = LanguageControl.LName();
     m_upsideDownButton.Text            = (SettingsManager.UpsideDownLayout ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no"));
     m_hideMoveLookPadsButton.Text      = (SettingsManager.HideMoveLookPads ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no"));
     m_showGuiInScreenshotsButton.Text  = (SettingsManager.ShowGuiInScreenshots ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no"));
     m_showLogoInScreenshotsButton.Text = (SettingsManager.ShowLogoInScreenshots ? LanguageControl.Get("Usual", "yes") : LanguageControl.Get("Usual", "no"));
     m_screenshotSizeButton.Text        = LanguageControl.Get("ScreenshotSize", SettingsManager.ScreenshotSize.ToString());
     m_communityContentModeButton.Text  = LanguageControl.Get("CommunityContentMode", SettingsManager.CommunityContentMode.ToString());
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen(ScreensManager.PreviousScreen);
     }
 }
Ejemplo n.º 8
0
 public override void Enter(object[] parameters)
 {
     if (ScreensManager.PreviousScreen != ScreensManager.FindScreen <Screen>("RecipaediaRecipes") && ScreensManager.PreviousScreen != ScreensManager.FindScreen <Screen>("RecipaediaDescription"))
     {
         m_previousScreen = ScreensManager.PreviousScreen;
     }
 }
Ejemplo n.º 9
0
 public override void Update()
 {
     if (m_singlethreadedTerrainUpdateButton.IsClicked)
     {
         SettingsManager.MultithreadedTerrainUpdate = !SettingsManager.MultithreadedTerrainUpdate;
         m_descriptionLabel.Text = StringsManager.GetString("Settings.Compatibility.SinglethreadedTerrainUpdate.Description");
     }
     if (m_useReducedZRangeButton.IsClicked)
     {
         SettingsManager.UseReducedZRange = !SettingsManager.UseReducedZRange;
         m_descriptionLabel.Text          = StringsManager.GetString("Settings.Compatibility.UseReducedZRange.Description");
     }
     if (m_viewGameLogButton.IsClicked)
     {
         DialogsManager.ShowDialog(null, new ViewGameLogDialog());
     }
     if (m_resetDefaultsButton.IsClicked)
     {
         SettingsManager.MultithreadedTerrainUpdate = true;
         SettingsManager.UseReducedZRange           = false;
     }
     if (m_useAudioTrackCachingButton.IsClicked)
     {
         SettingsManager.EnableAndroidAudioTrackCaching = !SettingsManager.EnableAndroidAudioTrackCaching;
     }
     m_singlethreadedTerrainUpdateButton.Text = (SettingsManager.MultithreadedTerrainUpdate ? LanguageControl.Get("Usual", "off") : LanguageControl.Get("Usual", "on"));
     m_useReducedZRangeButton.Text            = (SettingsManager.UseReducedZRange ? LanguageControl.Get("Usual", "on") : LanguageControl.Get("Usual", "off"));
     m_useAudioTrackCachingButton.Text        = (SettingsManager.EnableAndroidAudioTrackCaching? LanguageControl.Get("Usual", "on") : LanguageControl.Get("Usual", "off"));
     m_resetDefaultsButton.IsEnabled          = (!SettingsManager.MultithreadedTerrainUpdate || SettingsManager.UseReducedZRange);
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen(ScreensManager.PreviousScreen);
     }
 }
 public override void Update()
 {
     if (m_recipeIndex < m_craftingRecipes.Count)
     {
         CraftingRecipe craftingRecipe = m_craftingRecipes[m_recipeIndex];
         if (craftingRecipe.RequiredHeatLevel == 0f)
         {
             m_craftingRecipeWidget.Recipe     = craftingRecipe;
             m_craftingRecipeWidget.NameSuffix = $" (recipe #{m_recipeIndex + 1})";
             m_craftingRecipeWidget.IsVisible  = true;
             m_smeltingRecipeWidget.IsVisible  = false;
         }
         else
         {
             m_smeltingRecipeWidget.Recipe     = craftingRecipe;
             m_smeltingRecipeWidget.NameSuffix = $" (recipe #{m_recipeIndex + 1})";
             m_smeltingRecipeWidget.IsVisible  = true;
             m_craftingRecipeWidget.IsVisible  = false;
         }
     }
     m_prevRecipeButton.IsEnabled = (m_recipeIndex > 0);
     m_nextRecipeButton.IsEnabled = (m_recipeIndex < m_craftingRecipes.Count - 1);
     if (m_prevRecipeButton.IsClicked)
     {
         m_recipeIndex = MathUtils.Max(m_recipeIndex - 1, 0);
     }
     if (m_nextRecipeButton.IsClicked)
     {
         m_recipeIndex = MathUtils.Min(m_recipeIndex + 1, m_craftingRecipes.Count - 1);
     }
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen(ScreensManager.PreviousScreen);
     }
 }
Ejemplo n.º 11
0
 public override void Enter(object[] parameters)
 {
     if (ScreensManager.PreviousScreen != ScreensManager.FindScreen <Screen>("BestiaryDescription"))
     {
         m_previousScreen = ScreensManager.PreviousScreen;
     }
     m_creaturesList.SelectedItem = null;
 }
Ejemplo n.º 12
0
        public static void Run()
        {
            VrManager.WaitGetPoses();
            double realTime = Time.RealTime;

            LastFrameTime               = (float)(realTime - m_frameBeginTime);
            LastCpuFrameTime            = (float)(m_cpuEndTime - m_frameBeginTime);
            m_frameBeginTime            = realTime;
            Window.PresentationInterval = ((!VrManager.IsVrStarted) ? SettingsManager.PresentationInterval : 0);
            try
            {
                if (ExceptionManager.Error == null)
                {
                    while (m_urisToHandle.Count > 0)
                    {
                        Uri obj = m_urisToHandle[0];
                        m_urisToHandle.RemoveAt(0);
                        Program.HandleUri?.Invoke(obj);
                    }
                    PerformanceManager.Update();
                    MotdManager.Update();
                    MusicManager.Update();
                    ScreensManager.Update();
                    DialogsManager.Update();
                }
                else
                {
                    ExceptionManager.UpdateExceptionScreen();
                }
            }
            catch (Exception e)
            {
                ExceptionManager.ReportExceptionToUser(null, e);
                ScreensManager.SwitchScreen("MainMenu");
            }
            try
            {
                Display.RenderTarget = null;
                if (ExceptionManager.Error == null)
                {
                    ScreensManager.Draw();
                    PerformanceManager.Draw();
                    ScreenCaptureManager.Run();
                }
                else
                {
                    ExceptionManager.DrawExceptionScreen();
                }
                m_cpuEndTime = Time.RealTime;
            }
            catch (Exception e2)
            {
                ExceptionManager.ReportExceptionToUser(null, e2);
                ScreensManager.SwitchScreen("MainMenu");
            }
        }
Ejemplo n.º 13
0
 public static void Initialize()
 {
     Log.Information($"Survivalcraft starting up at {DateTime.Now}, Version={VersionsManager.Version}, BuildConfiguration={VersionsManager.BuildConfiguration}, Platform={VersionsManager.Platform}, DeviceModel={DeviceManager.DeviceModel}, OSVersion={DeviceManager.OperatingSystemVersion}, Storage.AvailableFreeSpace={Storage.FreeSpace / 1024 / 1024}MB, ApproximateScreenDpi={ScreenResolutionManager.ApproximateScreenDpi:0.0}, ApproxScreenInches={ScreenResolutionManager.ApproximateScreenInches:0.0}, ScreenResolution={Window.Size}, ProcessorsCount={Environment.ProcessorCount}, RAM={Utilities.GetTotalAvailableMemory() / 1024 / 1024}MB, 64bit={Marshal.SizeOf<IntPtr>() == 8}");
     MarketplaceManager.Initialize();
     SettingsManager.Initialize();
     AnalyticsManager.Initialize();
     VersionsManager.Initialize();
     ExternalContentManager.Initialize();
     ContentManager.Initialize();
     ScreensManager.Initialize();
 }
Ejemplo n.º 14
0
 public void Update(float dt)
 {
     if (m_playersData.Count == 0)
     {
         ScreensManager.SwitchScreen("Player", PlayerScreen.Mode.Initial, base.Project);
     }
     foreach (PlayerData playersDatum in m_playersData)
     {
         playersDatum.Update();
     }
 }
Ejemplo n.º 15
0
 public override void Update()
 {
     try
     {
         m_stateMachine.Update();
     }
     catch (Exception e)
     {
         ScreensManager.SwitchScreen(ScreensManager.PreviousScreen);
         DialogsManager.ShowDialog(null, new MessageDialog(LanguageControl.Get(fName, 1), ExceptionManager.MakeFullErrorMessage(e), LanguageControl.Get("Usual", "ok"), null, null));
     }
 }
Ejemplo n.º 16
0
        public override void Update()
        {
            if (!m_loadingStarted)
            {
                m_loadingStarted = true;
            }
            else
            {
                if (m_loadingFinished)
                {
                    return;
                }
                double realTime = Time.RealTime;
                while (!m_pauseLoading && m_index < m_loadActions.Count)
                {
                    try
                    {
                        m_loadActions[m_index++]();
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Loading error. Reason: " + ex.Message);
                        if (!m_loadingErrorsSuppressed)
                        {
                            m_pauseLoading = true;
                            DialogsManager.ShowDialog(ScreensManager.RootWidget, new MessageDialog("Loading Error", ExceptionManager.MakeFullErrorMessage(ex), LanguageControl.Get("Usual", "ok"), "Suppress", delegate(MessageDialogButton b)
                            {
                                switch (b)
                                {
                                case MessageDialogButton.Button1:
                                    m_pauseLoading = false;
                                    break;

                                case MessageDialogButton.Button2:
                                    m_loadingErrorsSuppressed = true;
                                    break;
                                }
                            }));
                        }
                    }
                    if (Time.RealTime - realTime > 0.1)
                    {
                        break;
                    }
                }
                if (m_index >= m_loadActions.Count)
                {
                    m_loadingFinished = true;
                    AudioManager.PlaySound("Audio/UI/ButtonClick", 1f, 0f, 0f);
                    ScreensManager.SwitchScreen("MainMenu");
                }
            }
        }
Ejemplo n.º 17
0
 public override void Update()
 {
     m_helpButton.IsVisible = !(ScreensManager.CurrentScreen is HelpScreen);
     if (m_okButton.IsClicked || base.Input.Cancel || base.Input.IsPadButtonDownOnce(GamePadButton.Start))
     {
         DialogsManager.HideDialog(this);
     }
     if (m_helpButton.IsClicked)
     {
         DialogsManager.HideDialog(this);
         ScreensManager.SwitchScreen("Help");
     }
 }
Ejemplo n.º 18
0
        public override void Update()
        {
            if (m_listCategoryIndex != m_categoryIndex)
            {
                PopulateBlocksList();
            }
            string arg = m_categories[m_categoryIndex] ?? LanguageControl.Get("BlocksManager", "All Blocks");

            m_categoryLabel.Text           = $"{arg} ({m_blocksList.Items.Count})";
            m_prevCategoryButton.IsEnabled = (m_categoryIndex > 0);
            m_nextCategoryButton.IsEnabled = (m_categoryIndex < m_categories.Count - 1);
            int?value = null;
            int num   = 0;

            if (m_blocksList.SelectedItem is int)
            {
                value = (int)m_blocksList.SelectedItem;
                num   = CraftingRecipesManager.Recipes.Count((CraftingRecipe r) => r.ResultValue == value);
            }
            if (num > 0)
            {
                m_recipesButton.Text      = string.Format("{0} {1}", num, (num == 1) ? LanguageControl.Get(fName, 1) : LanguageControl.Get(fName, 2));
                m_recipesButton.IsEnabled = true;
            }
            else
            {
                m_recipesButton.Text      = LanguageControl.Get(fName, 3);
                m_recipesButton.IsEnabled = false;
            }
            m_detailsButton.IsEnabled = value.HasValue;
            if (m_prevCategoryButton.IsClicked || base.Input.Left)
            {
                m_categoryIndex = MathUtils.Max(m_categoryIndex - 1, 0);
            }
            if (m_nextCategoryButton.IsClicked || base.Input.Right)
            {
                m_categoryIndex = MathUtils.Min(m_categoryIndex + 1, m_categories.Count - 1);
            }
            if (value.HasValue && m_detailsButton.IsClicked)
            {
                ScreensManager.SwitchScreen("RecipaediaDescription", value.Value, m_blocksList.Items.Cast <int>().ToList());
            }
            if (value.HasValue && m_recipesButton.IsClicked)
            {
                ScreensManager.SwitchScreen("RecipaediaRecipes", value.Value);
            }
            if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
            {
                ScreensManager.SwitchScreen(m_previousScreen);
            }
        }
Ejemplo n.º 19
0
 public override void Update()
 {
     if (Children.Find <ButtonWidget>("Buy").IsClicked)
     {
         AnalyticsManager.LogEvent("[NagScreen] Clicked buy button");
         MarketplaceManager.ShowMarketplace();
         ScreensManager.SwitchScreen("MainMenu");
     }
     if (Children.Find <ButtonWidget>("Quit").IsClicked || base.Input.Back)
     {
         AnalyticsManager.LogEvent("[NagScreen] Clicked quit button");
         Window.Close();
     }
 }
Ejemplo n.º 20
0
 public override void Update()
 {
     if (m_recipaediaButton.IsClicked)
     {
         ScreensManager.SwitchScreen("Recipaedia");
     }
     if (m_bestiaryButton.IsClicked)
     {
         ScreensManager.SwitchScreen("Bestiary");
     }
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen(m_previousScreen);
     }
 }
Ejemplo n.º 21
0
 public void ShowTopic(HelpTopic helpTopic)
 {
     if (helpTopic.Name == "Keyboard")
     {
         DialogsManager.ShowDialog(null, new KeyboardHelpDialog());
     }
     else if (helpTopic.Name == "Gamepad")
     {
         DialogsManager.ShowDialog(null, new GamepadHelpDialog());
     }
     else
     {
         ScreensManager.SwitchScreen("HelpTopic", helpTopic);
     }
 }
Ejemplo n.º 22
0
        public override void Update()
        {
            Keyboard.BackButtonQuitsApp = !MarketplaceManager.IsTrialMode;
            if (string.IsNullOrEmpty(m_versionString) || MarketplaceManager.IsTrialMode != m_versionStringTrial)
            {
                m_versionString      = string.Format("Version {0}{1}", VersionsManager.Version, MarketplaceManager.IsTrialMode ? " (Day One)" : string.Empty);
                m_versionStringTrial = MarketplaceManager.IsTrialMode;
            }
            Children.Find("Buy").IsVisible = MarketplaceManager.IsTrialMode;
            Children.Find <LabelWidget>("Version").Text = m_versionString;
            RectangleWidget rectangleWidget = Children.Find <RectangleWidget>("Logo");
            float           num             = 1f + 0.02f * MathUtils.Sin(1.5f * (float)MathUtils.Remainder(Time.FrameStartTime, 10000.0));

            rectangleWidget.RenderTransform = Matrix.CreateTranslation((0f - rectangleWidget.ActualSize.X) / 2f, (0f - rectangleWidget.ActualSize.Y) / 2f, 0f) * Matrix.CreateScale(num, num, 1f) * Matrix.CreateTranslation(rectangleWidget.ActualSize.X / 2f, rectangleWidget.ActualSize.Y / 2f, 0f);
            if (Children.Find <ButtonWidget>("Play").IsClicked)
            {
                ScreensManager.SwitchScreen("Play");
            }
            if (Children.Find <ButtonWidget>("Help").IsClicked)
            {
                ScreensManager.SwitchScreen("Help");
            }
            if (Children.Find <ButtonWidget>("Content").IsClicked)
            {
                ScreensManager.SwitchScreen("Content");
            }
            if (Children.Find <ButtonWidget>("Settings").IsClicked)
            {
                ScreensManager.SwitchScreen("Settings");
            }
            if (Children.Find <ButtonWidget>("Buy").IsClicked)
            {
                AnalyticsManager.LogEvent("[MainMenuScreen] Clicked buy button");
                MarketplaceManager.ShowMarketplace();
            }
            if ((base.Input.Back && !Keyboard.BackButtonQuitsApp) || base.Input.IsKeyDownOnce(Key.Escape))
            {
                if (MarketplaceManager.IsTrialMode)
                {
                    ScreensManager.SwitchScreen("Nag");
                }
                else
                {
                    Window.Close();
                }
            }
        }
Ejemplo n.º 23
0
        public override void Update()
        {
            if (m_recipaediaButton.IsClicked)
            {
                ScreensManager.SwitchScreen("Recipaedia");
            }
            if (m_bestiaryButton.IsClicked)
            {
                ScreensManager.SwitchScreen("Bestiary");
            }
            if (!Input.Back && !Input.Cancel && !Children.Find <ButtonWidget>("TopBar.Back", true).IsClicked)
            {
                return;
            }

            ScreensManager.SwitchScreen(m_previousScreen);
        }
Ejemplo n.º 24
0
        public override void Update()
        {
            if (m_gameModeButton.IsClicked)
            {
                IList <int> enumValues = EnumUtils.GetEnumValues(typeof(GameMode));
                m_worldSettings.GameMode = (GameMode)((enumValues.IndexOf((int)m_worldSettings.GameMode) + 1) % enumValues.Count);
                while (m_worldSettings.GameMode == GameMode.Adventure)
                {
                    m_worldSettings.GameMode = (GameMode)((enumValues.IndexOf((int)m_worldSettings.GameMode) + 1) % enumValues.Count);
                }
            }
            if (m_startingPositionButton.IsClicked)
            {
                IList <int> enumValues2 = EnumUtils.GetEnumValues(typeof(StartingPositionMode));
                m_worldSettings.StartingPositionMode = (StartingPositionMode)((enumValues2.IndexOf((int)m_worldSettings.StartingPositionMode) + 1) % enumValues2.Count);
            }
            bool flag = WorldsManager.ValidateWorldName(m_worldSettings.Name);

            m_nameTextBox.Text            = m_worldSettings.Name;
            m_seedTextBox.Text            = m_worldSettings.Seed;
            m_gameModeButton.Text         = LanguageControl.Get("GameMode", m_worldSettings.GameMode.ToString());
            m_startingPositionButton.Text = LanguageControl.Get("StartingPositionMode", m_worldSettings.StartingPositionMode.ToString());
            m_playButton.IsVisible        = flag;
            m_errorLabel.IsVisible        = !flag;
            m_blankSeedLabel.IsVisible    = (m_worldSettings.Seed.Length == 0 && !m_seedTextBox.HasFocus);
            m_descriptionLabel.Text       = StringsManager.GetString("GameMode." + m_worldSettings.GameMode.ToString() + ".Description");
            if (m_worldOptionsButton.IsClicked)
            {
                ScreensManager.SwitchScreen("WorldOptions", m_worldSettings, false);
            }
            if (m_playButton.IsClicked && WorldsManager.ValidateWorldName(m_nameTextBox.Text))
            {
                if (m_worldSettings.GameMode != 0)
                {
                    m_worldSettings.ResetOptionsForNonCreativeMode();
                }
                WorldInfo worldInfo = WorldsManager.CreateWorld(m_worldSettings);
                ScreensManager.SwitchScreen("GameLoading", worldInfo, null);
            }
            if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
            {
                ScreensManager.SwitchScreen("Play");
            }
        }
Ejemplo n.º 25
0
 public override void Update()
 {
     if (m_soundsVolumeSlider.IsSliding)
     {
         SettingsManager.SoundsVolume = m_soundsVolumeSlider.Value;
     }
     if (m_musicVolumeSlider.IsSliding)
     {
         SettingsManager.MusicVolume = m_musicVolumeSlider.Value;
     }
     m_soundsVolumeSlider.Value = SettingsManager.SoundsVolume;
     m_soundsVolumeSlider.Text  = MathUtils.Round(SettingsManager.SoundsVolume * 10f).ToString();
     m_musicVolumeSlider.Value  = SettingsManager.MusicVolume;
     m_musicVolumeSlider.Text   = MathUtils.Round(SettingsManager.MusicVolume * 10f).ToString();
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen(ScreensManager.PreviousScreen);
     }
 }
Ejemplo n.º 26
0
        public override void Update()
        {
            SubsystemGameInfo subsystemGameInfo = m_playerData.SubsystemPlayers.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true);

            m_playerModel.PlayerClass       = m_playerData.PlayerClass;
            m_playerModel.CharacterSkinName = m_playerData.CharacterSkinName;
            m_nameLabel.Text     = m_playerData.Name;
            m_detailsLabel.Text  = m_playerData.PlayerClass.ToString();
            m_detailsLabel.Text += "\n";
            LabelWidget detailsLabel = m_detailsLabel;

            detailsLabel.Text    = string.Format(LanguageControl.Get(fName, 1), detailsLabel.Text, PlayerScreen.GetDeviceDisplayName(m_playerData.InputDevice));
            m_detailsLabel.Text += "\n";
            m_detailsLabel.Text += ((m_playerData.LastSpawnTime >= 0.0) ? string.Format(LanguageControl.Get(fName, 2), $"{(subsystemGameInfo.TotalElapsedGameTime - m_playerData.LastSpawnTime) / 1200.0:N1}") : LanguageControl.Get(fName, 3));
            if (m_editButton.IsClicked)
            {
                ScreensManager.SwitchScreen("Player", PlayerScreen.Mode.Edit, m_playerData);
            }
        }
Ejemplo n.º 27
0
 public override void Update()
 {
     m_leftButtonWidget.IsEnabled  = (m_index > 0);
     m_rightButtonWidget.IsEnabled = (m_index < m_infoList.Count - 1);
     if (m_leftButtonWidget.IsClicked || base.Input.Left)
     {
         m_index = MathUtils.Max(m_index - 1, 0);
         UpdateCreatureProperties();
     }
     if (m_rightButtonWidget.IsClicked || base.Input.Right)
     {
         m_index = MathUtils.Min(m_index + 1, m_infoList.Count - 1);
         UpdateCreatureProperties();
     }
     if (base.Input.Back || base.Input.Cancel || Children.Find <ButtonWidget>("TopBar.Back").IsClicked)
     {
         ScreensManager.SwitchScreen(ScreensManager.PreviousScreen);
     }
 }
Ejemplo n.º 28
0
 public override void Update()
 {
     if (m_buyButton != null && m_buyButton.IsClicked)
     {
         AnalyticsManager.LogEvent("[TrialEndedScreen] Clicked buy button");
         MarketplaceManager.ShowMarketplace();
         ScreensManager.SwitchScreen("MainMenu");
     }
     if ((m_quitButton != null && m_quitButton.IsClicked) || base.Input.Back)
     {
         AnalyticsManager.LogEvent("[TrialEndedScreen] Clicked quit button");
         ScreensManager.SwitchScreen("MainMenu");
     }
     if (m_newWorldButton != null && m_newWorldButton.IsClicked)
     {
         AnalyticsManager.LogEvent("[TrialEndedScreen] Clicked newworld button");
         ScreensManager.SwitchScreen("NewWorld");
     }
 }
Ejemplo n.º 29
0
 public override void Update()
 {
     if (GameManager.Project != null)
     {
         double realTime = Time.RealTime;
         if (realTime - m_lastAutosaveTime > 120.0)
         {
             m_lastAutosaveTime = realTime;
             GameManager.SaveProject(waitForCompletion: false, showErrorDialog: true);
         }
         if (MarketplaceManager.IsTrialMode && GameManager.Project.FindSubsystem <SubsystemGameInfo>(throwOnError: true).TotalElapsedGameTime > 1140.0)
         {
             GameManager.SaveProject(waitForCompletion: true, showErrorDialog: false);
             GameManager.DisposeProject();
             ScreensManager.SwitchScreen("TrialEnded");
         }
         GameManager.UpdateProject();
     }
     ShowHideCursors(GameManager.Project == null || DialogsManager.HasDialogs(this) || DialogsManager.HasDialogs(base.RootWidget) || ScreensManager.CurrentScreen != this);
 }
 public override void Update()
 {
     if ((this.m_worldsListWidget.SelectedItem != null) && (WorldsManager.WorldInfos.IndexOf((WorldInfo)this.m_worldsListWidget.SelectedItem) < 0))
     {
         this.m_worldsListWidget.SelectedItem = null;
     }
     object[] objArray1 = new object[] { (int)this.m_worldsListWidget.Items.Count };
     base.ScreenWidget.Children.Find <LabelWidget>("TopBar.Label", true).Text = string.Format("Existing Worlds ({0})", (object[])objArray1);
     base.ScreenWidget.Children.Find("Play", true).IsEnabled       = (this.m_worldsListWidget.SelectedItem != null);
     base.ScreenWidget.Children.Find("Properties", true).IsEnabled = (this.m_worldsListWidget.SelectedItem != null);
     if (base.ScreenWidget.Children.Find <ButtonWidget>("Play", true).IsClicked&& (this.m_worldsListWidget.SelectedItem != null))
     {
         FrontendManager.StartFadeOutIn(delegate {
             object[] parameters = new object[2];
             parameters[0]       = this.m_worldsListWidget.SelectedItem;
             ScreensManager.SwitchScreen("GameLoading", parameters);
             this.m_worldsListWidget.SelectedItem = null;
         });
     }
     if (base.ScreenWidget.Children.Find <ButtonWidget>("NewWorld", true).IsClicked)
     {
         FrontendManager.StartFadeOutIn(delegate {
             ScreensManager.SwitchScreen("NewWorld", new object[0]);
             this.m_worldsListWidget.SelectedItem = null;
         });
     }
     if (base.ScreenWidget.Children.Find <ButtonWidget>("Properties", true).IsClicked&& (this.m_worldsListWidget.SelectedItem != null))
     {
         FrontendManager.StartFadeOutIn(delegate {
             object[] parameters = new object[] { this.m_worldsListWidget.SelectedItem };
             ScreensManager.SwitchScreen("ModifyWorld", parameters);
         });
     }
     if (InputManager.InputState.Back || base.ScreenWidget.Children.Find <ButtonWidget>("TopBar.Back", true).IsClicked)
     {
         FrontendManager.StartFadeOutIn(delegate {
             ScreensManager.SwitchScreen("MainMenu", new object[0]);
             this.m_worldsListWidget.SelectedItem = null;
         });
     }
 }