Example #1
0
        }   // end of OnCancel()

        #endregion

        #region Internal

        private void UpdateInvertAxis()
        {
            PlayerIndex lastTouched = GamePadInput.RealToLogical(GamePadInput.LastTouched);

            if (lastTouched != touched)
            {
                string gamerTag = GamePadInput.GetGamerTag(lastTouched);

                invertYAxis.Check = XmlOptionsData.GetInvertYAxis(gamerTag,
                                                                  GamePadInput.InvertYAxis(lastTouched));
                invertYAxis.Label = Strings.Localize("optionsParams.invertYAxis") + gamerTag;

                invertXAxis.Check = XmlOptionsData.GetInvertXAxis(gamerTag,
                                                                  GamePadInput.InvertXAxis(lastTouched));
                invertXAxis.Label = Strings.Localize("optionsParams.invertXAxis") + gamerTag;

                invertCamY.Check = XmlOptionsData.GetInvertCamY(gamerTag,
                                                                GamePadInput.InvertCamY());
                invertCamY.Label = Strings.Localize("optionsParams.invertCamY") + gamerTag;

                invertCamX.Check = XmlOptionsData.GetInvertCamX(gamerTag,
                                                                GamePadInput.InvertCamX());
                invertCamX.Label = Strings.Localize("optionsParams.invertCamX") + gamerTag;

                grid.Dirty = true;

                touched = lastTouched;
            }
        }
Example #2
0
        }   // end of HandleTouchInput()

        private void HandleMouseInput(Vector2 hit)
        {
            if (hitBoxA.LeftPressed(hit))
            {
                // Disable this hint for this session.
                if (curHint.ShowOnce)
                {
                    curHint.Disabled = true;
                }

                Deactivate();
            }
            else if (hitBoxB.LeftPressed(hit))
            {
                // Disable this hint until reset by user.
                XmlOptionsData.SetHintAsDisabled(curHint.ID);

                // Disable this hint for this session.
                if (curHint.ShowOnce)
                {
                    curHint.Disabled = true;
                }

                Deactivate();
            }
            else if (upBox.LeftPressed(hit))
            {
                ScrollDown();
            }
            else if (downBox.LeftPressed(hit))
            {
                ScrollUp();
            }

            // Check for hover and adjust text color to match.
            Color newColor;

            newColor = hitBoxA.Contains(hit) ? hoverTextColor : lightTextColor;
            if (newColor != labelATargetColor)
            {
                labelATargetColor = newColor;
                Vector3 curColor  = new Vector3(labelAColor.R / 255.0f, labelAColor.G / 255.0f, labelAColor.B / 255.0f);
                Vector3 destColor = new Vector3(newColor.R / 255.0f, newColor.G / 255.0f, newColor.B / 255.0f);

                TwitchManager.Set <Vector3> set = delegate(Vector3 value, Object param)
                {
                    labelAColor.R = (byte)(value.X * 255.0f + 0.5f);
                    labelAColor.G = (byte)(value.Y * 255.0f + 0.5f);
                    labelAColor.B = (byte)(value.Z * 255.0f + 0.5f);
                };
                TwitchManager.CreateTwitch <Vector3>(curColor, destColor, set, 0.1f, TwitchCurve.Shape.EaseOut);
            }

            newColor = hitBoxB.Contains(hit) ? hoverTextColor : lightTextColor;
            if (newColor != labelBTargetColor)
            {
                labelBTargetColor = newColor;
                Vector3 curColor  = new Vector3(labelBColor.R / 255.0f, labelBColor.G / 255.0f, labelBColor.B / 255.0f);
                Vector3 destColor = new Vector3(newColor.R / 255.0f, newColor.G / 255.0f, newColor.B / 255.0f);

                TwitchManager.Set <Vector3> set = delegate(Vector3 value, Object param)
                {
                    labelBColor.R = (byte)(value.X * 255.0f + 0.5f);
                    labelBColor.G = (byte)(value.Y * 255.0f + 0.5f);
                    labelBColor.B = (byte)(value.Z * 255.0f + 0.5f);
                };
                TwitchManager.CreateTwitch <Vector3>(curColor, destColor, set, 0.1f, TwitchCurve.Shape.EaseOut);
            }
        }   // end of HandleMouseInput()
Example #3
0
        private void HandleTouchInput(TouchContact touch, Vector2 hit)
        {
            if (hitBoxA.Touched(touch, hit))
            {
                // Disable this hint for this session.
                if (curHint.ShowOnce)
                {
                    curHint.Disabled = true;
                }

                Deactivate();
            }
            else if (hitBoxB.Touched(touch, hit))
            {
                // Disable this hint until reset by user.
                XmlOptionsData.SetHintAsDisabled(curHint.ID);

                // Disable this hint for this session.
                if (curHint.ShowOnce)
                {
                    curHint.Disabled = true;
                }

                Deactivate();
            }
            else if (upBox.Touched(touch, hit))
            {
                ScrollDown();
            }
            else if (downBox.Touched(touch, hit))
            {
                ScrollUp();
            }
            else
            {
                // Touch is active, but none of the buttons were hit so assume user is trying to scroll text.
                if (touch.phase == TouchPhase.Began)
                {
                    prevTouchY = touch.position.Y;
                }
                if (touch.phase == TouchPhase.Moved)
                {
                    // Note we calc the delta ourselves since the TouchInput code
                    // may return the TouchContact for multiple frames.
                    float delta = touch.position.Y - prevTouchY;

                    // Adjust for screen / rt ratio.
                    Vector2 ratio = TouchInput.GetWinRTRatio(camera);
                    delta /= ratio.Y;

                    accumulatedTouchInput += delta;
                    prevTouchY             = touch.position.Y;
                    if (accumulatedTouchInput > blob.TotalSpacing / 2)
                    {
                        accumulatedTouchInput -= blob.TotalSpacing;
                        ScrollDown();
                    }
                    else if (accumulatedTouchInput < -blob.TotalSpacing / 2)
                    {
                        accumulatedTouchInput += blob.TotalSpacing;
                        ScrollUp();
                    }
                }
            }

            // Check for hover and adjust text color to match.
            Color newColor;

            newColor = hitBoxA.Contains(hit) ? hoverTextColor : lightTextColor;
            if (newColor != labelATargetColor)
            {
                labelATargetColor = newColor;
                Vector3 curColor  = new Vector3(labelAColor.R / 255.0f, labelAColor.G / 255.0f, labelAColor.B / 255.0f);
                Vector3 destColor = new Vector3(newColor.R / 255.0f, newColor.G / 255.0f, newColor.B / 255.0f);

                TwitchManager.Set <Vector3> set = delegate(Vector3 value, Object param)
                {
                    labelAColor.R = (byte)(value.X * 255.0f + 0.5f);
                    labelAColor.G = (byte)(value.Y * 255.0f + 0.5f);
                    labelAColor.B = (byte)(value.Z * 255.0f + 0.5f);
                };
                TwitchManager.CreateTwitch <Vector3>(curColor, destColor, set, 0.1f, TwitchCurve.Shape.EaseOut);
            }

            newColor = hitBoxB.Contains(hit) ? hoverTextColor : lightTextColor;
            if (newColor != labelBTargetColor)
            {
                labelBTargetColor = newColor;
                Vector3 curColor  = new Vector3(labelBColor.R / 255.0f, labelBColor.G / 255.0f, labelBColor.B / 255.0f);
                Vector3 destColor = new Vector3(newColor.R / 255.0f, newColor.G / 255.0f, newColor.B / 255.0f);

                TwitchManager.Set <Vector3> set = delegate(Vector3 value, Object param)
                {
                    labelBColor.R = (byte)(value.X * 255.0f + 0.5f);
                    labelBColor.G = (byte)(value.Y * 255.0f + 0.5f);
                    labelBColor.B = (byte)(value.Z * 255.0f + 0.5f);
                };
                TwitchManager.CreateTwitch <Vector3>(curColor, destColor, set, 0.1f, TwitchCurve.Shape.EaseOut);
            }
        }   // end of HandleTouchInput()
Example #4
0
        }   // end of c'tor

        public void Update(Camera camera)
        {
            if (Active)
            {
                GamePadInput pad = GamePadInput.GetGamePad0();

                if (Actions.Select.WasPressed)
                {
                    Actions.Select.ClearAllWasPressedState();

                    // Disable this hint for this session.
                    if (curHint.ShowOnce)
                    {
                        curHint.Disabled = true;
                    }

                    Deactivate();
                }
                if (Actions.X.WasPressed)
                {
                    Actions.X.ClearAllWasPressedState();

                    // Disable this hint until reset by user.
                    XmlOptionsData.SetHintAsDisabled(curHint.ID);

                    // Disable this hint for this session.
                    if (curHint.ShowOnce)
                    {
                        curHint.Disabled = true;
                    }

                    Deactivate();
                }

                // We need to be able to slip out to the mini-hub here since
                // continuous, repeated calls to ScrollableModalHint can lock the
                // user out of control.
                if (Actions.MiniHub.WasPressed)
                {
                    Actions.MiniHub.ClearAllWasPressedState();

                    Deactivate();
                    InGame.inGame.SwitchToMiniHub();
                }

                // We need to be able to slip out to the tool menu here since
                // continuous, repeated calls to ScrollableModalHint can lock the
                // user out of control.
                if (Actions.ToolMenu.WasPressed)
                {
                    Actions.ToolMenu.ClearAllWasPressedState();

                    Deactivate();
                    if (InGame.inGame.State == InGame.States.Active)
                    {
                        InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu;
                    }
                }

                // Scroll text???
                if (blob.NumLines != 0)
                {
                    int scroll = MouseInput.ScrollWheel - MouseInput.PrevScrollWheel;

                    if (Actions.Up.WasPressedOrRepeat || scroll > 0)
                    {
                        ScrollDown();
                    }

                    if (Actions.Down.WasPressedOrRepeat || scroll < 0)
                    {
                        ScrollUp();
                    }

                    // If we're not shutting down...
                    if (Active)
                    {
                    }   // end if not shutting down.
                }

                // We should be on top and owning all input
                // focus so don't let anthing trickle down.
                GamePadInput.ClearAllWasPressedState();

                // Disable the help overlay's tool icon because in some situations
                // it can overlap the text making it unreadable.
                HelpOverlay.ToolIcon = null;

                // If active we need to pre-render the text to the 1k rendertarget since
                // changing render targets on the Xbox forces a resolve.
                PreRender();

                // If we're rendering this into a 1280x720 rt we need a matching camera to calc mouse hits.
                if (useBackgroundThumbnail)
                {
                    camera            = new PerspectiveUICamera();
                    camera.Resolution = new Point(1280, 720);
                }

                if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch)
                {
                    for (int i = 0; i < TouchInput.TouchCount; i++)
                    {
                        TouchContact touch = TouchInput.GetTouchContactByIndex(i);

                        Vector2 touchHit = touch.position;

                        // Adjust for position and scaling of final rendering.
                        touchHit -= renderPosition;
                        touchHit /= renderScale;

                        if (useRtCoords)
                        {
                            touchHit = ScreenWarp.ScreenToRT(touch.position);
                        }
                        HandleTouchInput(touch, touchHit);
                    }
                }
                else if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse)
                {
                    Vector2 hit = MouseInput.PositionVec;

                    // Adjust for position and scaling of final rendering.
                    hit -= renderPosition;
                    hit /= renderScale;

                    if (useRtCoords)
                    {
                        hit = MouseInput.GetMouseInRtCoords();
                    }
                    HandleMouseInput(hit);
                }
            } // end if active.
        }     // end of Update()
Example #5
0
        private void InitGrid()
        {
            grid                     = new UIGrid(OnSelect, OnCancel, new Point(1, 10), "OptionsMenuGrid");
            grid.LocalMatrix         = Matrix.CreateTranslation(0.25f / 96.0f, 0.25f / 96.0f, 0.0f);
            grid.RenderEndsIn        = true;
            grid.UseMouseScrollWheel = true;

            // Create a blob of common parameters.
            UIGridElement.ParamBlob blob = new UIGridElement.ParamBlob();
            //blob.width = 5.0f;
            //blob.height = 1.0f;
            blob.width            = 512.0f / 96.0f;
            blob.height           = blob.width / 5.0f;
            blob.edgeSize         = 0.06f;
            blob.Font             = UI2D.Shared.GetGameFont24Bold;
            blob.textColor        = Color.White;
            blob.dropShadowColor  = Color.Black;
            blob.useDropShadow    = true;
            blob.invertDropShadow = false;
            blob.unselectedColor  = new Color(new Vector3(4, 100, 90) / 255.0f);
            blob.selectedColor    = new Color(new Vector3(5, 180, 160) / 255.0f);
            blob.normalMapName    = @"Slant0Smoothed5NormalMap";
            blob.justify          = UIGridModularCheckboxElement.Justification.Left;


            //
            // Create elements here.
            //

            int index = 0;

            {
                showToolTips         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.showToolTips"));
                showToolTips.OnCheck = delegate() { XmlOptionsData.ShowToolTips = true; };
                showToolTips.OnClear = delegate() { XmlOptionsData.ShowToolTips = false; };
                showToolTips.HelpID  = "ShowToolTips";
                // Add to grid.
                grid.Add(showToolTips, 0, index++);
            }

            {
                showHints         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.showHints"));
                showHints.OnCheck = delegate() { XmlOptionsData.ShowHints = true; };
                showHints.OnClear = delegate() { XmlOptionsData.ShowHints = false; };
                showHints.HelpID  = "ShowHints";
                // Add to grid.
                grid.Add(showHints, 0, index++);
            }

            {
                restoreDisabledHints         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.restoreDisabledHints"));
                restoreDisabledHints.OnCheck = delegate() { XmlOptionsData.RestoreDisabledHints(); };
                restoreDisabledHints.OnClear = delegate() { restoreDisabledHints.Check = true; };
                restoreDisabledHints.HelpID  = "RestoreDisabledHints";
                // Add to grid.
                grid.Add(restoreDisabledHints, 0, index++);
            }

            {
                showFramerate         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.showFramerate"));
                showFramerate.OnCheck = delegate() { XmlOptionsData.ShowFramerate = true; };
                showFramerate.OnClear = delegate() { XmlOptionsData.ShowFramerate = false; };
                showFramerate.HelpID  = "ShowFramerate";
                // Add to grid.
                grid.Add(showFramerate, 0, index++);
            }

            /*
             * {
             *  helpLevel = new UIGridModularRadioBoxElement(blob, Strings.Localize("optionsParams.helpLevel"));
             *  helpLevel.AddText(Strings.Localize("optionsParams.lowHelp"));
             *  helpLevel.AddText(Strings.Localize("optionsParams.midHelp"));
             *  helpLevel.AddText(Strings.Localize("optionsParams.highHelp"));
             *  helpLevel.CurIndex = XmlOptionsData.HelpLevel;
             *  helpLevel.OnChange = delegate(UIGridModularRadioBoxElement.ListEntry entry)
             *  {
             *      XmlOptionsData.HelpLevel = helpLevel.CurIndex;
             *  };
             *  helpLevel.HelpID = "HelpOverlayAmount";
             *  // Add to grid.
             *  grid.Add(helpLevel, 0, index++);
             * }
             */

            {
                float oldWidth = blob.width;
                blob.width += 0.5f;
                language    = new UIGridModularRadioBoxElement(blob, Strings.Localize("optionsParams.language"));
                blob.width  = oldWidth;
                IEnumerable <LocalizationResourceManager.SupportedLanguage> langs = LocalizationResourceManager.SupportedLanguages;

                // Copy to a List so we can sort.
                List <LocalizationResourceManager.SupportedLanguage> languageList = new List <LocalizationResourceManager.SupportedLanguage>();
                foreach (LocalizationResourceManager.SupportedLanguage lang in langs)
                {
                    languageList.Add(lang);
                }
                languageList.Sort(LanguageSortComp);

                // Add the sorted languages to the UI element.
                foreach (LocalizationResourceManager.SupportedLanguage lang in languageList)
                {
#if NETFX_CORE
                    if (lang.NameInEnglish.Equals("hebrew", StringComparison.OrdinalIgnoreCase))
#else
                    if (lang.NameInEnglish.Equals("hebrew", StringComparison.InvariantCultureIgnoreCase))
#endif
                    {
                        // RtoL code seems to have trouble with NSM characters 0x05b0 and 0x05b4.
                        // Strip them out.
                        string native = "";
                        char[] a      = lang.NameInNative.ToCharArray();
                        foreach (char c in a)
                        {
                            if (c != 0x05b0 && c != 0x05b4)
                            {
                                native += c;
                            }
                        }

                        language.AddText(lang.NameInEnglish + " : " + native, lang.Language);
                    }
                    else
                    {
                        language.AddText(lang.NameInEnglish + " : " + lang.NameInNative, lang.Language);
                    }
                }
                language.NumColumns = 2;
                language.SetValueByKey(XmlOptionsData.Language);

                language.OnChange = delegate(UIGridModularRadioBoxElement.ListEntry entry)
                {
                    // Note we can only get away with this since the language won't change for real until restart.
                    XmlOptionsData.Language = language.CurKey;
                };
                language.HelpID = "Language";
                // Add to grid.
                grid.Add(language, 0, index++);
            }

            {
                modalToolMenu         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.ModalToolMenu"));
                modalToolMenu.OnCheck = delegate() { XmlOptionsData.ModalToolMenu = true; };
                modalToolMenu.OnClear = delegate() { XmlOptionsData.ModalToolMenu = false; };
                modalToolMenu.HelpID  = "ModalToolMenu";
                // Add to grid.
                grid.Add(modalToolMenu, 0, index++);
            }

            #region Stick Inverting
            {
                invertYAxis         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.invertYAxis"));
                invertYAxis.OnCheck = delegate()
                {
                    PlayerIndex lastTouched = GamePadInput.RealToLogical(GamePadInput.LastTouched);
                    GamePadInput.SetInvertYAxis(lastTouched, true);
                };
                invertYAxis.OnClear = delegate()
                {
                    PlayerIndex lastTouched = GamePadInput.RealToLogical(GamePadInput.LastTouched);
                    GamePadInput.SetInvertYAxis(lastTouched, false);
                };
                invertYAxis.HelpID = "InvertYAxis";
                grid.Add(invertYAxis, 0, index++);
            }

            {
                invertXAxis         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.invertXAxis"));
                invertXAxis.OnCheck = delegate()
                {
                    PlayerIndex lastTouched = GamePadInput.RealToLogical(GamePadInput.LastTouched);
                    GamePadInput.SetInvertXAxis(lastTouched, true);
                };
                invertXAxis.OnClear = delegate()
                {
                    PlayerIndex lastTouched = GamePadInput.RealToLogical(GamePadInput.LastTouched);
                    GamePadInput.SetInvertXAxis(lastTouched, false);
                };
                invertXAxis.HelpID = "InvertXAxis";
                grid.Add(invertXAxis, 0, index++);
            }
            {
                invertCamY         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.invertCamY"));
                invertCamY.OnCheck = delegate()
                {
                    PlayerIndex lastTouched = GamePadInput.RealToLogical(GamePadInput.LastTouched);
                    GamePadInput.SetInvertCamY(lastTouched, true);
                };
                invertCamY.OnClear = delegate()
                {
                    PlayerIndex lastTouched = GamePadInput.RealToLogical(GamePadInput.LastTouched);
                    GamePadInput.SetInvertCamY(lastTouched, false);
                };
                invertCamY.HelpID = "InvertCamY";
                grid.Add(invertCamY, 0, index++);
            }

            {
                invertCamX         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.invertCamX"));
                invertCamX.OnCheck = delegate()
                {
                    PlayerIndex lastTouched = GamePadInput.RealToLogical(GamePadInput.LastTouched);
                    GamePadInput.SetInvertCamX(lastTouched, true);
                };
                invertCamX.OnClear = delegate()
                {
                    PlayerIndex lastTouched = GamePadInput.RealToLogical(GamePadInput.LastTouched);
                    GamePadInput.SetInvertCamX(lastTouched, false);
                };
                invertCamX.HelpID = "InvertCamX";
                grid.Add(invertCamX, 0, index++);
            }
            #endregion Stick Inverting

            #region Terrain Edit Speed
            {
                // Restore default.
                blob.height                        = blob.width / 5.0f;
                terrainSpeed                       = new UIGridModularFloatSliderElement(blob, Strings.Localize("optionsParams.terrainSpeed"));
                terrainSpeed.MinValue              = 0.25f;
                terrainSpeed.MaxValue              = 4.0f;
                terrainSpeed.IncrementByAmount     = 0.25f;
                terrainSpeed.NumberOfDecimalPlaces = 2;
                terrainSpeed.OnChange              = delegate(float speed) { XmlOptionsData.TerrainSpeed = speed; };
                terrainSpeed.HelpID                = "TerrainSpeed";
                grid.Add(terrainSpeed, 0, index++);
            }
            #endregion Terrain Edit Speed

            #region Audio Volumes
            {
                // Restore default.
                blob.height                    = blob.width / 5.0f;
                uiVolume                       = new UIGridModularFloatSliderElement(blob, Strings.Localize("optionsParams.uiVolume"));
                uiVolume.MinValue              = 0.0f;
                uiVolume.MaxValue              = 100.0f;
                uiVolume.IncrementByAmount     = 5.0f;
                uiVolume.NumberOfDecimalPlaces = 0;
                uiVolume.OnChange              = delegate(float volume) { XmlOptionsData.UIVolume = volume * 0.01f; };
                uiVolume.HelpID                = "UIVolume";
                grid.Add(uiVolume, 0, index++);
            }
            {
                foleyVolume                       = new UIGridModularFloatSliderElement(blob, Strings.Localize("optionsParams.foleyVolume"));
                foleyVolume.MinValue              = 0.0f;
                foleyVolume.MaxValue              = 100.0f;
                foleyVolume.IncrementByAmount     = 5.0f;
                foleyVolume.NumberOfDecimalPlaces = 0;
                foleyVolume.OnChange              = delegate(float volume) { XmlOptionsData.FoleyVolume = volume * 0.01f; };
                foleyVolume.HelpID                = "EffectsVolume";
                grid.Add(foleyVolume, 0, index++);
            }
            {
                musicVolume                       = new UIGridModularFloatSliderElement(blob, Strings.Localize("optionsParams.musicVolume"));
                musicVolume.MinValue              = 0.0f;
                musicVolume.MaxValue              = 100.0f;
                musicVolume.IncrementByAmount     = 5.0f;
                musicVolume.NumberOfDecimalPlaces = 0;
                musicVolume.OnChange              = delegate(float volume) { XmlOptionsData.MusicVolume = volume * 0.01f; };
                musicVolume.HelpID                = "MusicVolume";
                grid.Add(musicVolume, 0, index++);
            }
            #endregion Audio Volumes

            #region Privacy Settings
            {
                checkForUpdates         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.checkForUpdates"));
                checkForUpdates.OnCheck = delegate() { XmlOptionsData.CheckForUpdates = true; };
                checkForUpdates.OnClear = delegate() { XmlOptionsData.CheckForUpdates = false; };
                checkForUpdates.HelpID  = "CheckForUpdates";
                // Add to grid.
                grid.Add(checkForUpdates, 0, index++);
            }
            {
                sendInstrumentation         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.sendInstrumentation"));
                sendInstrumentation.OnCheck = delegate() { XmlOptionsData.SendInstrumentation = true; };
                sendInstrumentation.OnClear = delegate() { XmlOptionsData.SendInstrumentation = false; };
                sendInstrumentation.HelpID  = "SendInstrumentation";
                // Add to grid.
                grid.Add(sendInstrumentation, 0, index++);
            }
            {
                UIGridModularButtonElement.UIButtonElementEvent onA = delegate()
                {
                    Process.Start(Program2.SiteOptions.KGLUrl + @"/EULA#code_of_conduct");
                };

                showCodeOfConduct        = new UIGridModularButtonElement(blob, Strings.Localize("optionsParams.viewCodeOfConduct"), Strings.Localize("optionsParams.viewButtonLabel"), onA, null, null);
                showCodeOfConduct.HelpID = "ShowCodeOfConduct";
                grid.Add(showCodeOfConduct, 0, index++);
            }
            {
                UIGridModularButtonElement.UIButtonElementEvent onA = delegate()
                {
                    Process.Start(Program2.SiteOptions.KGLUrl + @"/privacy");
                };

                showPrivacyStatement        = new UIGridModularButtonElement(blob, Strings.Localize("optionsParams.viewPrivacyStatement"), Strings.Localize("optionsParams.viewButtonLabel"), onA, null, null);
                showPrivacyStatement.HelpID = "ShowPrivacyStatement";
                grid.Add(showPrivacyStatement, 0, index++);
            }
            {
                UIGridModularButtonElement.UIButtonElementEvent onA = delegate()
                {
                    Process.Start(Program2.SiteOptions.KGLUrl + @"/EULA#eula");
                };

                showEULA        = new UIGridModularButtonElement(blob, Strings.Localize("optionsParams.viewEULA"), Strings.Localize("optionsParams.viewButtonLabel"), onA, null, null);
                showEULA.HelpID = "ShowEULA";
                grid.Add(showEULA, 0, index++);
            }
            #endregion

            #region ShowIntroVideo
            {
                showIntroVideo         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.showIntroVideo"));
                showIntroVideo.OnCheck = delegate() { XmlOptionsData.ShowIntroVideo = true; };
                showIntroVideo.OnClear = delegate() { XmlOptionsData.ShowIntroVideo = false; };
                showIntroVideo.HelpID  = "ShowIntroVideo";
                // Add to grid.
                grid.Add(showIntroVideo, 0, index++);
            }
            #endregion

            #region ShowTutorialDebug
            {
                showTutorialDebug         = new UIGridModularCheckboxElement(blob, Strings.Localize("optionsParams.showTutorialDebug"));
                showTutorialDebug.OnCheck = delegate() { XmlOptionsData.ShowTutorialDebug = true; };
                showTutorialDebug.OnClear = delegate() { XmlOptionsData.ShowTutorialDebug = false; };
                showTutorialDebug.HelpID  = "ShowTutorialDebug";
                // Add to grid.
                grid.Add(showTutorialDebug, 0, index++);
            }
            #endregion


            showVersion        = new UIGridModularButtonElement(blob, Strings.Localize("shareHub.appName") + " (" + Program2.ThisVersion.ToString() + ", " + Program2.SiteOptions.Product + ")", null, null, null, null);
            showVersion.HelpID = "Version";
            grid.Add(showVersion, 0, index++);


            //
            // Set grid properties.
            //
            grid.Spacing     = new Vector2(0.0f, 0.1f); // The first number doesn't really matter since we're doing a 1d column.
            grid.Scrolling   = true;
            grid.Wrap        = false;
            grid.LocalMatrix = Matrix.Identity;

            // Loop over al the elements in the grid.  For any that have
            // help, set the flag so they display Y button for help.
            for (int i = 0; i < grid.ActualDimensions.Y; i++)
            {
                UIGridElement e        = grid.Get(0, i);
                string        helpID   = e.HelpID;
                string        helpText = TweakScreenHelp.GetHelp(helpID);
                if (helpText != null)
                {
                    e.ShowHelpButton = true;
                }
            }
        }   // end of InitGrid
Example #6
0
        }   // end of c'tor

        public void Update(Camera camera)
        {
            if (Active)
            {
                GamePadInput pad = GamePadInput.GetGamePad0();

                if (InGame.inGame.State == InGame.States.Active && InGame.inGame.CurrentUpdateMode == InGame.UpdateMode.RunSim)
                {
                    // We need to be able to slip out to the mini-hub here since
                    // continuous, repeated calls to ModalHint can lock the
                    // user out of control.
                    if (Actions.MiniHub.WasPressed)
                    {
                        Actions.MiniHub.ClearAllWasPressedState();

                        Deactivate();
                        InGame.inGame.SwitchToMiniHub();
                    }

                    // We need to be able to slip out to the tool menu here since
                    // continuous, repeated calls to ModalHint can lock the
                    // user out of control.
                    if (Actions.ToolMenu.WasPressed)
                    {
                        Actions.ToolMenu.ClearAllWasPressedState();

                        Deactivate();
                        InGame.inGame.CurrentUpdateMode = InGame.UpdateMode.ToolMenu;
                    }
                }

                if (Actions.Select.WasPressed)
                {
                    Actions.Select.ClearAllWasPressedState();

                    // Disable this hint for this session.
                    if (curHint.ShowOnce)
                    {
                        curHint.Disabled = true;
                    }

                    Deactivate();
                }
                if (Actions.X.WasPressed)
                {
                    Actions.X.ClearAllWasPressedState();

                    // Disable this hint until reset by user.
                    XmlOptionsData.SetHintAsDisabled(curHint.ID);

                    // Disable this hint for this session.
                    if (curHint.ShowOnce)
                    {
                        curHint.Disabled = true;
                    }

                    Deactivate();
                }

                if (useBackgroundThumbnail)
                {
                    camera            = new PerspectiveUICamera();
                    camera.Resolution = new Point(1280, 720);
                }

                if (GamePadInput.ActiveMode == GamePadInput.InputMode.Touch)
                {
                    for (int i = 0; i < TouchInput.TouchCount; i++)
                    {
                        TouchContact touch = TouchInput.GetTouchContactByIndex(i);

                        Vector2 touchHit = touch.position;
                        if (useRtCoords)
                        {
                            touchHit = ScreenWarp.ScreenToRT(touch.position);
                        }
                        HandleTouchInput(touch, touchHit);
                    }
                }
                else if (GamePadInput.ActiveMode == GamePadInput.InputMode.KeyboardMouse)
                {
                    Vector2 hit = MouseInput.PositionVec;
                    if (useRtCoords)
                    {
                        hit = MouseInput.GetMouseInRtCoords();
                    }
                    HandleMouseInput(hit);
                }
            } // end if active.
        }     // end of Update()