예제 #1
0
        protected override bool IsOptionSelected(int index, ButtonHolder holder)
        {
            string option = holder.Value;

            // music volume
            if (option.StartsWith("Music volume: "))
            {
                return(EngineConfig.MusicVolume == int.Parse(option.Substring("Music volume: ".Length)));
            }

            // sound volume
            if (option.StartsWith("Sound volume: "))
            {
                return(EngineConfig.SoundVolume == int.Parse(option.Substring("Sound volume: ".Length)));
            }


            FreeSL.FSL_SOUND_SYSTEM selected = FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM;
            foreach (FreeSL.FSL_SOUND_SYSTEM el in soundSystems.Keys)
            {
                if (option.Equals(soundSystems[el]))
                {
                    selected = el;
                }
            }

            // sound system
            if (selected == EngineConfig.SoundSystem)
            {
                return(true);
            }


            return(false);
        }
예제 #2
0
        protected override void ProcessOptionSelection(ButtonHolder holder)
        {
            /*
             * this.gameEventListener.MinimizeWindow();
             * Thread.Sleep(500);
             *
             * string directory = System.Environment.CurrentDirectory;
             *
             * var pinfo = new ProcessStartInfo();
             * pinfo.FileName = Path.Combine(directory,"bik/1.exe");
             * pinfo.CreateNoWindow = true;
             *
             * Process movieProcess = Process.Start(pinfo);
             * movieProcess.WaitForExit();
             *
             * this.gameEventListener.MaximizeWindow();
             */
            string selected = holder.Value;

            if (LanguageResources.GetString(LanguageKey.High).Equals(selected))
            {
                EngineConfig.Difficulty = EngineConfig.DifficultyLevel.Hard;
            }
            else if (LanguageResources.GetString(LanguageKey.Medium).Equals(selected))
            {
                EngineConfig.Difficulty = EngineConfig.DifficultyLevel.Medium;
            }
            else if (LanguageResources.GetString(LanguageKey.Low).Equals(selected))
            {
                EngineConfig.Difficulty = EngineConfig.DifficultyLevel.Easy;
            }

            EngineConfig.SaveEngineConfig();
            RecreateGUI();
        }
예제 #3
0
        protected override void ProcessOptionSelection(ButtonHolder holder)
        {
            PlayClickSound();
            uint levelNo = uint.Parse(holder.Value.Substring(LanguageResources.GetString(LanguageKey.Level).Length));

            gameEventListener.StartGame(levelNo, EngineConfig.CurrentPlayerPlaneType);
        }
예제 #4
0
        protected override bool IsOptionSelected(int index, ButtonHolder holder)
        {
            string option = holder.Value;

            if (LanguageResources.GetString(LanguageKey.None).Equals(option))
            {
                return(EngineConfig.ShadowsQuality == EngineConfig.ShadowsQualityTypes.None);
            }
            else
            if (LanguageResources.GetString(LanguageKey.Low).Equals(option))
            {
                return(EngineConfig.ShadowsQuality == EngineConfig.ShadowsQualityTypes.Low);
            }
            else
            if (LanguageResources.GetString(LanguageKey.Medium).Equals(option))
            {
                return(EngineConfig.ShadowsQuality == EngineConfig.ShadowsQualityTypes.Medium);
            }
            else
            if (LanguageResources.GetString(LanguageKey.High).Equals(option))
            {
                return(EngineConfig.ShadowsQuality == EngineConfig.ShadowsQualityTypes.High);
            }
            return(false);
        }
예제 #5
0
 protected override void ProcessOptionSelection(ButtonHolder holder)
 {
     //EngineConfig.InverseKeys = "Yes".Equals(selected);
     EngineConfig.InverseKeys = LanguageResources.GetString(LanguageKey.Yes).Equals(holder.Value);
     EngineConfig.SaveEngineConfig();
     RecreateGUI();
 }
예제 #6
0
 protected override void ProcessOptionSelection(ButtonHolder holder)
 {
     if (!Root.Singleton.RenderSystem.GetConfigOptions()[C_ANTIALIASING].currentValue.Equals(holder.Value))
     {
         Root.Singleton.RenderSystem.SetConfigOption(C_ANTIALIASING, holder.Value);
         OptionsScreen.restartRequired = true;
     }
     Root.Singleton.SaveConfig();
 }
예제 #7
0
        protected override bool IsOptionSelected(int index, ButtonHolder holder)
        {
            string curr = Root.Singleton.RenderSystem.GetConfigOptions()[C_VSYNC].currentValue;

            if (curr.Equals("Yes"))
            {
                return(LanguageResources.GetString(LanguageKey.Yes).Equals(holder.Value));
            }
            else
            {
                return(LanguageResources.GetString(LanguageKey.No).Equals(holder.Value));
            }
        }
예제 #8
0
        protected override void ProcessOptionSelection(ButtonHolder holder)
        {
            bool restart = false;

            EngineConfig.ShadowsQualityTypes old = EngineConfig.ShadowsQuality;
            if (LanguageResources.GetString(LanguageKey.None).Equals(holder.Value))
            {
                EngineConfig.ShadowsQuality = EngineConfig.ShadowsQualityTypes.None;
                if (old > 0)
                {
                    restart = true;
                }
            }
            else
            if (LanguageResources.GetString(LanguageKey.Low).Equals(holder.Value))
            {
                EngineConfig.ShadowsQuality = EngineConfig.ShadowsQualityTypes.Low;
                if (old == 0)
                {
                    restart = true;
                }
            }
            else
            if (LanguageResources.GetString(LanguageKey.Medium).Equals(holder.Value))
            {
                EngineConfig.ShadowsQuality = EngineConfig.ShadowsQualityTypes.Medium;
                if (old == 0)
                {
                    restart = true;
                }
            }
            else
            if (LanguageResources.GetString(LanguageKey.High).Equals(holder.Value))
            {
                EngineConfig.ShadowsQuality = EngineConfig.ShadowsQualityTypes.High;
                if (old == 0)
                {
                    restart = true;
                }
            }

            EngineConfig.SaveEngineConfig();

            if (restart && EngineConfig.UseHydrax)
            {
                OptionsScreen.restartRequired = true;
            }
            RecreateGUI();
        }
예제 #9
0
        protected override void ProcessOptionSelection(ButtonHolder holder)
        {
            if (!EngineConfig.IsEnhancedVersion && enhancedMissionsMap[holder])
            {
                gameEventListener.GotoEnhancedVersionScreen(holder.Option);
                return;
            }

            LevelInfo info = levelInfoMap[holder];

            if (File.Exists(info.Filename))
            {
                gameEventListener.StartGame(info, EngineConfig.CurrentPlayerPlaneType);
            }
        }
예제 #10
0
 protected override void ProcessOptionSelection(ButtonHolder holder)
 {
     if (!Root.Singleton.RenderSystem.GetConfigOptions()[C_VSYNC].currentValue.Equals(holder.Value))
     {
         if (LanguageResources.GetString(LanguageKey.Yes).Equals(holder.Value))
         {
             Root.Singleton.RenderSystem.SetConfigOption(C_VSYNC, "Yes");
         }
         else
         {
             Root.Singleton.RenderSystem.SetConfigOption(C_VSYNC, "No");
         }
         OptionsScreen.restartRequired = true;
     }
     Root.Singleton.SaveConfig();
 }
예제 #11
0
 protected override void ProcessOptionSelection(ButtonHolder holder)
 {
     foreach (KeyValuePair <string, string> lang in LanguageManager.AvailableLanguages)
     {
         if (lang.Key.Equals(holder.Value))
         {
             LanguageManager.SetLanguage(lang.Value);
             if (EngineConfig.LanguageDebugMode)
             {
                 gameEventListener.GotoLanguageDebugScreen(holder.Option);
             }
             //EngineConfig.SaveEngineConfig();
             break;
         }
     }
 }
예제 #12
0
        protected override void ProcessOptionSelection(ButtonHolder holder)
        {
            string jid;

            if (holder.Option.id.Equals(resetButtonID))
            {
                KeyMap.Instance.BackToDefaults(joysticks);
                KeyMap.Instance.Value = KeyMap.Instance.Value;
                //FrameWorkStaticHelper.SetCurrentJoystickIndex(0);

                for (int i = 0; i < FrameWorkStaticHelper.GetNumberOfAvailableJoysticks(); i++)
                {
                    jid = joysticks[i].Vendor() + "_" + joysticks[i].ID;

                    if (jid.Equals(KeyMap.Instance.CurrentJoystick))
                    {
                        FrameWorkStaticHelper.SetCurrentJoystickIndex(i);
                        break;
                    }
                }
                joystickChangerHelper.UpdateCurrentJoystick();
                this.RecreateGUI();
                return;
            }

            bool restart = false;

            string[] opts = holder.Value.Split(new string[] { "ID=" }, System.StringSplitOptions.RemoveEmptyEntries);

            jid = opts[1];

            KeyMap.Instance.CurrentJoystick = jid;
            KeyMap.Instance.Value           = KeyMap.Instance.Value;

            for (int i = 0; i < joysticks.Count; i++)
            {
                if (jid.Equals(joysticks[i].Vendor() + "_" + joysticks[i].ID))
                {
                    FrameWorkStaticHelper.SetCurrentJoystickIndex(i);
                    joystickChangerHelper.UpdateCurrentJoystick();

                    this.RecreateGUI();
                    break;
                }
            }
        }
예제 #13
0
        protected override void ProcessOptionSelection(ButtonHolder holder)
        {
            bool old = EngineConfig.UseHydrax;

            EngineConfig.UseHydrax = LanguageResources.GetString(LanguageKey.Yes).Equals(holder.Value);
            EngineConfig.SaveEngineConfig();
            // restart potrzebny gdy cienie sa wlaczone

            if (old != EngineConfig.UseHydrax)
            {
                this.forceRebuild = true;
                if (EngineConfig.ShadowsQuality > 0)
                {
                    OptionsScreen.restartRequired = true;
                }
                RecreateGUI();
            }
        }
예제 #14
0
        protected override bool IsOptionSelected(int index, ButtonHolder holder)
        {
            string option = holder.Value;

            if (holder.Option.id.Equals(resetButtonID))
            {
                return(false);
            }

            if (FrameWorkStaticHelper.GetNumberOfAvailableJoysticks() == 1 && index == 0)
            {
                return(true);
            }

            string[] opts = option.Split(new string[] { "ID=" }, System.StringSplitOptions.RemoveEmptyEntries);
            string   jid  = opts[1];

            return(jid.Equals(KeyMap.Instance.CurrentJoystick));
        }
예제 #15
0
        protected override bool IsOptionSelected(int index, ButtonHolder holder)
        {
            string option = holder.Value;

            if (EngineConfig.Difficulty == EngineConfig.DifficultyLevel.Hard)
            {
                return(LanguageResources.GetString(LanguageKey.High).Equals(option));
            }
            else if (EngineConfig.Difficulty == EngineConfig.DifficultyLevel.Medium)
            {
                return(LanguageResources.GetString(LanguageKey.Medium).Equals(option));
            }
            else if (EngineConfig.Difficulty == EngineConfig.DifficultyLevel.Easy)
            {
                return(LanguageResources.GetString(LanguageKey.Low).Equals(option));
            }

            return(false);
        }
예제 #16
0
 protected override bool IsOptionSelected(int index, ButtonHolder holder)
 {
     return(EngineConfig.UseHydrax == LanguageResources.GetString(LanguageKey.Yes).Equals(holder.Value));
 }
예제 #17
0
 protected override void ProcessOptionSelection(ButtonHolder holder)
 {
     EngineConfig.BloomEnabled = LanguageResources.GetString(LanguageKey.Yes).Equals(holder.Value);
     EngineConfig.SaveEngineConfig();
 }
예제 #18
0
        protected void EnhancedLevelsScreen_OnOptionCreated(Vector4 pos, bool selected, string optionDisplayText, uint index, int page, ButtonHolder holder)
        {
            if (holder == null)
            {
                return;
            }

            MissionType        mt;
            bool               enhancedOnly;
            List <Achievement> allAchievements;

            LevelInfo info = (LevelInfo)availableOptions.ToArray()[index];


            Level.PeekMissionDetails(info.Filename, out mt, out enhancedOnly, out allAchievements);
            enhancedMissionsMap[holder] = enhancedOnly;
            levelInfoMap[holder]        = info;

            CompletedLevelsInfo completedLevelsInfo = LoadGameUtil.Singleton.CompletedLevelsInfo;
            List <Achievement>  achievementsDone    = LoadGameUtil.Singleton.GetCompletedAchievementsForLevel(info);

            if (allAchievements != null)
            {
                LoadGameUtil.MergeAchievements(achievementsDone, allAchievements);
            }


            string filename = Level.GetMissionTypeTextureFile(mt);

            if (filename != null)
            {
                guiWindow.createStaticImage(new Vector4(Viewport.ActualWidth / 2 - GetTextVSpacing(), pos.y, GetTextVSpacing(), GetTextVSpacing()), filename, (ushort)(1000 + index));
            }

            if (enhancedOnly)
            {
                guiWindow.createStaticImage(new Vector4(Viewport.ActualWidth / 2 - 5.0f * GetTextVSpacing(), pos.y, GetTextVSpacing(), GetTextVSpacing()), "pin.png", (ushort)(1100 + index));
            }

            int i = 1;

            if (allAchievements == null)
            {
                return;
            }

            foreach (Achievement a in allAchievements)
            {
                i++;
                string image;
                image = a.IsFulfilled() ? a.GetFulfilledImageFilename() : a.GetUnFulfilledImageFilename();

                guiWindow.createStaticImage(new Vector4((Viewport.ActualWidth / 2) - i * GetTextVSpacing(), pos.y, GetTextVSpacing(), GetTextVSpacing()), image, (ushort)(2000 + index));
            }
        }
예제 #19
0
 protected override void ProcessOptionSelection(ButtonHolder holder)
 {
     EngineConfig.LowDetails = LanguageResources.GetString(LanguageKey.Low).Equals(holder.Value);
     EngineConfig.SaveEngineConfig();
     RecreateGUI();
 }
예제 #20
0
 protected abstract bool IsOptionSelected(int index, ButtonHolder holder);
예제 #21
0
 protected abstract void ProcessOptionSelection(ButtonHolder selected);
예제 #22
0
        protected virtual void LayoutOptions(List <object> availableOptions, Window window, Callback cc)
        {
            // trzeba stworzyc siatke opcji
            // w jednej kolumnie nie powinno byc wiecej niz C_MAX_OPTIONS opcji

            int  size     = availableOptions.Count;
            uint posIndex = 0;

            options = new List <ButtonHolder>();
            uint j = 0;

            for (j = 0;
                 j < C_MAX_OPTIONS &&
                 availableOptions.Count > j + C_MAX_OPTIONS * currentScreen;
                 j++)
            {
                int    index = (int)j + C_MAX_OPTIONS * currentScreen;
                String option;

                if (availableOptions[index] == null)
                {
                    continue;
                }
                posIndex++;
                option = availableOptions[index].ToString();
                Vector4 pos = GetOptionPos(j, window);



                if (option.StartsWith("__"))
                {
                    guiWindow.createStaticText(
                        pos,
                        GetOptionDisplayText(option));
                    if (OnOptionCreated != null)
                    {
                        OnOptionCreated(pos, false, option, (uint)index, currentScreen, null);
                    }
                    continue;
                }



                Button button = guiWindow.createButton(
                    pos,
                    "",
                    GetOptionDisplayText(option), cc, j);
                ButtonHolder holder = new ButtonHolder(button, option);

                bool selected = IsOptionSelected((int)j, holder);

                if (selected)
                {
                    button.mmn             = "bgui.selected.button";
                    button.mma             = "bgui.selected.button.active";
                    button.mO.MaterialName = button.mmn;
                }
                else
                {
                    button.mmn             = "bgui.button";
                    button.mma             = "bgui.button.active";
                    button.mO.MaterialName = button.mmn;
                }



                options.Add(holder);
                if (OnOptionCreated != null)
                {
                    OnOptionCreated(pos, selected, option, (uint)index, currentScreen, holder);
                }
            }
            uint totalOptions    = (uint)options.Count;
            uint lastOptButton   = posIndex;
            uint exitButtonIndex = lastOptButton;

            if (currentScreen != 0)
            {
                prevButton = guiWindow.createButton
                             (
                    new Vector4(
                        window.w / 8,
                        (lastOptButton + 2) * GetTextVSpacing(),
                        3 * window.w / 8,
                        GetTextVSpacing()),
                    "bgui.button",
                    LanguageResources.GetString(LanguageKey.Previous),
                    cc,
                    j + 1
                             );
                totalOptions++;
                exitButtonIndex = lastOptButton + 1;
            }
            else
            {
                prevButton = null;
            }

            if (currentScreen < ((1.00f * availableOptions.Count) / C_MAX_OPTIONS) - 1)
            {
                nextButton = guiWindow.createButton
                             (
                    new Vector4(
                        window.w / 2,
                        (lastOptButton + 2) * GetTextVSpacing(),
                        3 * window.w / 8,
                        GetTextVSpacing()),
                    "bgui.button",
                    LanguageResources.GetString(LanguageKey.Next),
                    cc,
                    prevButton == null ? (j + 1) : (j + 2)
                             );
                totalOptions++;
                exitButtonIndex = lastOptButton + 1;
            }
            else
            {
                nextButton = null;
            }

            exitButton = guiWindow.createButton
                         (
                new Vector4(
                    window.w / 3,
                    (exitButtonIndex + 2) * GetTextVSpacing(),
                    window.w / 3,
                    GetTextVSpacing()),
                "bgui.button",
                LanguageResources.GetString(LanguageKey.Back),
                cc,
                totalOptions
                         );
            totalOptions++;


            // Skopiuj przyciski to tablicy buttons, tak aby dzia³a³a obs³uga klawiatury
            initButtons((int)totalOptions);

            int k = 0;

            for (k = 0; k < options.Count; k++)
            {
                buttons[k] = options[k].Option;
            }

            if (prevButton != null && nextButton != null)
            {
                buttons[k]     = prevButton;
                buttons[k + 1] = nextButton;
            }
            else if (prevButton != null)
            {
                buttons[k] = prevButton;
            }
            else if (nextButton != null)
            {
                buttons[k] = nextButton;
            }

            buttons[totalOptions - 1] = exitButton;
            selectButton(currentButton);
            backButtonIndex = (int)totalOptions - 1;
            if (showRestartRequiredMessage)
            {
                guiWindow.createStaticTextAutoSplit(new Vector4(GetMargin().x, exitButton.Y + 2 * GetTextVSpacing(), window.w - GetMargin().x *2, GetTextVSpacing() * 2), LanguageResources.GetString(LanguageKey.ChangeOptionMessage1) + " " + LanguageResources.GetString(LanguageKey.ChangeOptionMessage2));

                /*
                 *    guiWindow.createStaticText(
                 *        new Vector4(GetMargin().x, exitButton.Y + 1 * GetTextVSpacing(), window.w / 2, GetTextVSpacing()),
                 *            );
                 *        guiWindow.createStaticText(
                 *        new Vector4(GetMargin().x, exitButton.Y + 2 * GetTextVSpacing(), window.w / 2, GetTextVSpacing()),
                 *            );*/
            }
        }
예제 #23
0
 protected override bool IsOptionSelected(int index, ButtonHolder holder)
 {
     //return EngineConfig.InverseKeys == "Yes".Equals(option);
     return(EngineConfig.InverseKeys == LanguageResources.GetString(LanguageKey.Yes).Equals(holder.Value));
 }
예제 #24
0
        /*
         * public void onButtonPress(Button referer)
         * {
         *  if (screenTime > C_RESPONSE_DELAY)
         *  {
         *      PlayClickSound();
         *      if (referer == buttons[0])
         *      {
         *
         *      }
         *
         *  }
         * }*/

        protected override bool IsOptionSelected(int index, ButtonHolder holder)
        {
            return(LanguageManager.ActualLanguageName.Equals(holder.Value));
        }
예제 #25
0
        protected override void ProcessOptionSelection(ButtonHolder holder)
        {
            string selected = holder.Value;

            foreach (FreeSL.FSL_SOUND_SYSTEM el in soundSystems.Keys)
            {
                if (selected.Equals(soundSystems[el]))
                {
                    EngineConfig.SoundSystem = el;
                }
            }


            // music volume
            if (selected.StartsWith("Music volume: "))
            {
                // autoGoBack = false;
                SoundManager3D.Instance.SetMusicVolume(uint.Parse(selected.Substring("Music volume: ".Length)));
                RecreateGUI(1);
                return;
            }

            // sound volume
            if (selected.StartsWith("Sound volume: "))
            {
                //  autoGoBack = false;
                SoundManager3D.SetSoundVolume(uint.Parse(selected.Substring("Sound volume: ".Length)));
                RecreateGUI(2);
                return;
            }


            try
            {
                // CHANGE SOUND SYSTEM
                // autoGoBack = true;

                /* String currentMusicBefore = null;
                 *
                 * if(SoundManager3D.Instance.CurrentMusic!=null)
                 * {
                 *  currentMusicBefore = (String)SoundManager3D.Instance.CurrentMusic.Clone();
                 * }*/
                //  SoundManager3D.Instance.ShutDown();
                if (SoundManager3D.Instance.InitializeSound(framework.CameraListener, EngineConfig.SoundSystem))
                {
                    EngineConfig.SoundEnabled = true;
                }
                else
                {
                    // nie uda³o siê
                    EngineConfig.SoundSystem = FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM;
                }

                if (EngineConfig.SoundSystem == FreeSL.FSL_SOUND_SYSTEM.FSL_SS_NOSYSTEM)
                {
                    EngineConfig.SoundEnabled = false;
                }


                if (!EngineConfig.SoundEnabled)
                {
                    SoundManager.Instance.StopMusic();
                    SoundManager.Instance.SoundDisabled = true;
                    selectButton(0);
                }
                else
                {
                    SoundManager.Instance.SoundDisabled    = false;
                    SoundManager3D.Instance.UpdaterRunning = true;
                    SoundManager.Instance.PlayMainTheme();

                    //    SoundManager3D.Instance.PlayAmbientMusic(SoundManager3D.Instance.CurrentMusic, EngineConfig.MusicVolume);
                }
                RecreateGUI();
                EngineConfig.SaveEngineConfig();
            }
            catch (Exception ex)
            {
                LogManager.Singleton.LogMessage(LogMessageLevel.LML_NORMAL, "Exception while changing sound system: " + ex + ", stack: " + ex.StackTrace);
            }
        }
예제 #26
0
 protected override bool IsOptionSelected(int index, ButtonHolder holder)
 {
     return(false);
 }
예제 #27
0
 protected override bool IsOptionSelected(int index, ButtonHolder holder)
 {
     return
         (Root.Singleton.RenderSystem.GetConfigOptions()[C_VIDEO_MODE]
          .currentValue.Equals(holder.Value));
 }