Esempio n. 1
0
        public void Initialize(ScreenManager screenManager, PixelizerRenderer renderer)
        {
            _renderer      = renderer;
            _screenManager = screenManager;

            screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None);

            baseList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions);
            screenCanvas.AddElement(baseList);

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "return", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject = this,
                ButtonMethod = this.GetType().GetMethod("MainMenu")
            });


            baseList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 35), "Random points", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ToggleObject = renderer,
                ToggleField  = renderer.GetType().GetField("Random"),
                Toggle       = (bool)renderer.GetType().GetField("Random").GetValue(renderer)
            });

            baseList.AddElement(_splitChance = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Split Chance: " + renderer.SplitChance, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 0, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = renderer.GetType().GetField("SplitChance"),
                SliderValue  = (float)renderer.GetType().GetField("SplitChance").GetValue(renderer)
            });

            baseList.AddElement(_endChance = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "End Chance: " + renderer.EndChance, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 0, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = renderer.GetType().GetField("EndChance"),
                SliderValue  = (float)renderer.GetType().GetField("EndChance").GetValue(renderer)
            });

            baseList.AddElement(_scale = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Scale: " + renderer.Scale, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 35), 0, 3, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = renderer.GetType().GetField("Scale"),
                SliderValue  = (int)renderer.GetType().GetField("Scale").GetValue(renderer)
            });

            baseList.AddElement(new GUIColorPicker(Vector2.Zero, new Vector2(200, 200), Color.Gray, GUIRenderer.MonospaceFont)
            {
                ReferenceObject = renderer,
                ReferenceField  = renderer.GetType().GetField("LineColor")
            });

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 55), "Click to add effect ", GUIRenderer.MonospaceFont, Color.Gray, Color.White));

            baseList.ParentResized(screenCanvas.Dimensions);
        }
Esempio n. 2
0
        public void Initialize(ScreenManager screenManager, RadialBlurRenderer renderer)
        {
            _renderer      = renderer;
            _screenManager = screenManager;

            screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None);

            baseList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions);
            screenCanvas.AddElement(baseList);

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "return", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject = this,
                ButtonMethod = typeof(RadialBlurGUILogic).GetMethod("MainMenu")
            });

            GuiTextBlockLoadDialog textureLoader;

            baseList.AddElement(textureLoader = new GuiTextBlockLoadDialog(Vector2.Zero, new Vector2(200, 35), "image: ", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D, GUIRenderer.MonospaceFont, Color.Gray, Color.White)
                                );


            baseList.AddElement(_intensityBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Intensity: " + renderer.BlurIntensity, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 0, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(RadialBlurRenderer).GetField("BlurIntensity"),
                SliderValue  = (float)typeof(RadialBlurRenderer).GetField("BlurIntensity").GetValue(renderer)
            });

            baseList.AddElement(_samplesBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Samples: " + renderer.BlurSamples, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 35), 1, 64, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(RadialBlurRenderer).GetField("BlurSamples"),
                SliderValue  = (int)typeof(RadialBlurRenderer).GetField("BlurSamples").GetValue(renderer)
            });

            baseList.AddElement(_passBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Passes: " + renderer.BlurPasses, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 35), 1, 3, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(RadialBlurRenderer).GetField("BlurPasses"),
                SliderValue  = (int)typeof(RadialBlurRenderer).GetField("BlurPasses").GetValue(renderer)
            });

            baseList.AddElement(new GUIBlock(Vector2.Zero, new Vector2(200, 25), Color.DimGray));

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 55), "Click to freeze center point ", GUIRenderer.MonospaceFont, Color.Gray, Color.White));

            renderer._backgroundTextureLoader = textureLoader;

            baseList.ParentResized(screenCanvas.Dimensions);
        }
Esempio n. 3
0
        public void Initialize(ScreenManager screenManager)
        {
            _screenManager = screenManager;

            screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None);

            baseList = new GUIList(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.Center, screenCanvas.Dimensions);
            screenCanvas.AddElement(baseList);

            //baseList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 35), "debug info", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            //{
            //    ToggleField = typeof(GameSettings).GetField("ui_debug"),
            //    Toggle = (bool)typeof(GameSettings).GetField("ui_debug").GetValue(null)
            //});

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Radial Blur", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.RadialBlur }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Pixelizer", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.Pixelizer }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Bokeh", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.Bokeh }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Particle Physics", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.ParticlePhysics }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "SSS (WIP)", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.Subsurface }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "FourierTransform (WIP)", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchState"),
                ButtonMethodArgs = new object[] { ScreenManager.ScreenStates.FourierTransform }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "Exit", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject = this,
                ButtonMethod = GetType().GetMethod("ExitProgram")
            });

            baseList.ParentResized(screenCanvas.Dimensions);
        }
Esempio n. 4
0
 public GameGUI(GameGraphics graphics)
     : base(graphics)
 {
     testList       = new GUIList();
     testList.align = GUIList.Align.RIGHT;
 }
Esempio n. 5
0
        /// <summary>
        /// Creates the GUI for the default editor
        /// </summary>
        /// <param name="sceneLogicCamera"></param>
        private void CreateGUI(Camera sceneLogicCamera)
        {
            GuiCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_screenwidth, GameSettings.g_screenheight));

            defaultStyle = new GUIStyle(
                dimensionsStyle: new Vector2(200,35),
                textFontStyle: _assets.MonospaceFont,
                blockColorStyle: Color.Gray, 
                textColorStyle: Color.White,
                sliderColorStyle: Color.White,
                guiAlignmentStyle: GUIStyle.GUIAlignment.None,
                textAlignmentStyle: GUIStyle.TextAlignment.Left,
                textButtonAlignmentStyle: GUIStyle.TextAlignment.Center,
                textBorderStyle: new Vector2(10, 1),
                parentDimensionsStyle: GuiCanvas.Dimensions);

            //Editor gizmo control!
            GuiCanvas.AddElement(_leftSideList = new GUIList(Vector2.Zero, defaultStyle));

            _leftSideList.AddElement(_gizmoTranslation = new GUITextBlockButton(defaultStyle, "Translate (T)")
            {
                ButtonObject = this,
                ButtonMethod = GetType().GetMethod("ChangeGizmoMode"),
                ButtonMethodArgs = new object[]{ EditorLogic.GizmoModes.Translation },
            });
            _leftSideList.AddElement(_gizmoRotation = new GUITextBlockButton(defaultStyle, "Rotate (R)")
            {
                ButtonObject = this,
                ButtonMethod = GetType().GetMethod("ChangeGizmoMode"),
                ButtonMethodArgs = new object[] { EditorLogic.GizmoModes.Rotation },
            });
            _leftSideList.AddElement(_gizmoScale = new GUITextBlockButton(defaultStyle, "Scale (Z)")
            {
                ButtonObject = this,
                ButtonMethod = GetType().GetMethod("ChangeGizmoMode"),
                ButtonMethodArgs = new object[] { EditorLogic.GizmoModes.Scale },
            });
            _leftSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Local: ")
            {
               ToggleField = typeof(GameStats).GetField("e_LocalTransformation"),
                Toggle = GameStats.e_LocalTransformation
            });
            _leftSideList.Alignment = GUIStyle.GUIAlignment.BottomLeft;

            ChangeGizmoMode(EditorLogic.GizmoModes.Translation);

            //Editor options
            GuiCanvas.AddElement(_rightSideList = new GuiListToggleScroll(new Vector2(-20,0), defaultStyle));

            GUITextBlock helperText = new GUITextBlock(new Vector2(0, 100), new Vector2(300, 200), CreateHelperText(), defaultStyle.TextFontStyle, new Color(Color.DimGray, 0.2f), Color.White, GUIStyle.TextAlignment.Left, new Vector2(10, 1)) {IsHidden = true};
            GuiCanvas.AddElement(helperText);

            _rightSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Enable Editor")
            {
                ToggleField = typeof(GameStats).GetField("e_EnableSelection"),
                Toggle = GameStats.e_EnableSelection
            });

            _rightSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Highlight Meshes")
            {
                ToggleField = typeof(GameSettings).GetField("e_drawoutlines"),
                Toggle = GameSettings.e_drawoutlines
            });

            _rightSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Show Controls")
            {
                ToggleProperty = typeof(GUITextBlock).GetProperty("IsVisible"),
                ToggleObject = helperText,
                Toggle = helperText.IsVisible
            });

            _rightSideList.AddElement(new GUITextBlockToggle(defaultStyle, "Default Material")
            {
                ToggleField = typeof(GameSettings).GetField("d_defaultmaterial"),
                Toggle = GameSettings.d_defaultmaterial
            });

            _rightSideList.AddElement(new GuiSliderFloatText(defaultStyle, 0.1f, 3/*(float) (Math.PI - 0.1)*/, 2, "Field Of View: ")
            {
                SliderObject = sceneLogicCamera,
                SliderProperty = typeof(Camera).GetProperty("FieldOfView"),
                SliderValue = sceneLogicCamera.FieldOfView
            });

            //_rightSideList.AddElement(new GuiDropList(defaultStyle, "Show: ")
            //{
            //});

            _rightSideList.AddElement(new GUITextBlock(defaultStyle, "Selection") { BlockColor = Color.DimGray, Dimensions = new Vector2(200, 10), TextAlignment = GUIStyle.TextAlignment.Center });

            GuiListToggle _selectionList = new GuiListToggle(Vector2.Zero, defaultStyle);
            _objectDescriptionList = new GUIList(Vector2.Zero, defaultStyle);

            _objectDescriptionList.AddElement(_objectDescriptionName = new GUITextBlock(defaultStyle, "objDescName"));
            _objectDescriptionList.AddElement(_objectDescriptionPos = new GUITextBlock(defaultStyle, "objDescName"));
            _objectDescriptionList.AddElement(_objectButton1 = new GUITextBlockButton(defaultStyle, "objButton1") {IsHidden = true});
            _objectDescriptionList.AddElement(_objectToggle0 = new GUITextBlockToggle(defaultStyle, "objToggle0") { IsHidden = true });
            _objectDescriptionList.AddElement(_objectToggle1 = new GUITextBlockToggle(defaultStyle, "objToggle1") { IsHidden = true });
            _objectDescriptionList.AddElement(_objectToggle2 = new GUITextBlockToggle(defaultStyle, "objToggle2") { IsHidden = true });
            _objectDescriptionList.AddElement(_objectToggle3 = new GUITextBlockToggle(defaultStyle, "objToggle3") { IsHidden = true });
            _objectDescriptionList.AddElement(_objectSlider0 = new GuiSliderFloatText(defaultStyle, 0,1,2,"objToggle1") { IsHidden = true });
            _objectDescriptionList.AddElement(_objectSlider1 = new GuiSliderFloatText(defaultStyle, 0, 1, 2, "objToggle2") { IsHidden = true });
            _objectDescriptionList.AddElement(_objectSlider2 = new GuiSliderIntText(defaultStyle, 0, 10, 1, "objToggle3") { IsHidden = true });
            _objectDescriptionList.AddElement(_objectColorPicker1 = new GUIColorPicker(defaultStyle) { IsHidden = true });

            _selectionList.AddElement(_objectDescriptionList);
            _rightSideList.AddElement(_selectionList);

            /////////////////////////////////////////////////////////////////
            //Options
            /////////////////////////////////////////////////////////////////
            
            _rightSideList.AddElement(new GUITextBlock(defaultStyle, "Options") {BlockColor = Color.DimGray, Dimensions = new Vector2(200,10), TextAlignment = GUIStyle.TextAlignment.Center});

            GuiListToggle optionList = new GuiListToggle(Vector2.Zero, defaultStyle);
            _rightSideList.AddElement(optionList);

            /////////////////////////////////////////////////////////////////
            //SDF
            /////////////////////////////////////////////////////////////////
            /// 
            optionList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 10), "SDF",
                defaultStyle.TextFontStyle, Color.DarkSlateGray, Color.White, GUIStyle.TextAlignment.Center,
                Vector2.Zero));

            GuiListToggle sdfList = new GuiListToggle(Vector2.Zero, defaultStyle) { ToggleBlockColor = Color.DarkSlateGray, IsToggled = false };
            optionList.AddElement(sdfList);

            sdfList.AddElement(new GUITextBlockToggle(defaultStyle, "Draw SDF")
            {
                ToggleField = typeof(GameSettings).GetField("sdf_drawdistance"),
                Toggle = GameSettings.sdf_drawdistance
            });

            sdfList.AddElement(new GUITextBlockToggle(defaultStyle, "Draw SDF volume")
            {
                ToggleField = typeof(GameSettings).GetField("sdf_drawvolume"),
                Toggle = GameSettings.sdf_drawvolume
            });

            /////////////////////////////////////////////////////////////////
            //Post Processing
            /////////////////////////////////////////////////////////////////

            optionList.AddElement(new GUITextBlock(defaultStyle, "PostProcessing") { BlockColor = Color.DarkSlateGray, Dimensions = new Vector2(200, 10), TextAlignment = GUIStyle.TextAlignment.Center });

            GuiListToggle postprocessingList = new GuiListToggle(Vector2.Zero, defaultStyle) {ToggleBlockColor = Color.DarkSlateGray, IsToggled = false};
            optionList.AddElement(postprocessingList);

            postprocessingList.AddElement(new GUITextBlockToggle(defaultStyle, "Temporal AA")
            {
                ToggleField = typeof(GameSettings).GetField("g_taa"),
                Toggle = GameSettings.g_taa
            });

            postprocessingList.AddElement(new GUITextBlockToggle(defaultStyle, "Tonemap TAA")
            {
                ToggleField = typeof(GameSettings).GetField("g_taa_tonemapped"),
                Toggle = GameSettings.g_taa_tonemapped
            });

            postprocessingList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 4, 2, "WhitePoint: ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("WhitePoint"),
                SliderValue = GameSettings.WhitePoint
            });

            postprocessingList.AddElement(new GuiSliderFloatText(defaultStyle, -8, 8, 2, "Exposure: ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("Exposure"),
                SliderValue = GameSettings.Exposure
            });

            postprocessingList.AddElement(new GuiSliderFloatText(defaultStyle, -1, 1, 2, "S-Curve: ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("SCurveStrength"),
                SliderValue = GameSettings.SCurveStrength
            });

            postprocessingList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 1, 2, "Chr. Abb.: ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("ChromaticAbberationStrength"),
                SliderValue = GameSettings.ChromaticAbberationStrength
            });

            postprocessingList.AddElement(new GUITextBlockToggle(defaultStyle, "Color Grading")
            {
                ToggleField = typeof(GameSettings).GetField("g_ColorGrading"),
                Toggle = GameSettings.g_ColorGrading
            });

            /////////////////////////////////////////////////////////////////
            //SSR
            /////////////////////////////////////////////////////////////////

            optionList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 10), "Screen Space Reflections",
                defaultStyle.TextFontStyle, Color.DarkSlateGray, Color.White, GUIStyle.TextAlignment.Center,
                Vector2.Zero));

            GuiListToggle ssrList = new GuiListToggle(Vector2.Zero, defaultStyle) { ToggleBlockColor = Color.DarkSlateGray, IsToggled = false };
            optionList.AddElement(ssrList);

            ssrList.AddElement(new GUITextBlockToggle(defaultStyle, "Enable SSR")
            {
                ToggleProperty = typeof(GameSettings).GetProperty("g_SSReflection"),
                Toggle = GameSettings.g_SSReflection
            });

            ssrList.AddElement(new GUITextBlockToggle(defaultStyle, "Stochastic distr.")
            {
                ToggleProperty = typeof(GameSettings).GetProperty("g_SSReflectionTaa"),
                Toggle = GameSettings.g_SSReflectionTaa
            });

            ssrList.AddElement(new GUITextBlockToggle(defaultStyle, "Temporal Noise")
            {
                ToggleField = typeof(GameSettings).GetField("g_SSReflectionNoise"),
                Toggle = GameSettings.g_SSReflectionNoise
            });

            ssrList.AddElement(new GUITextBlockToggle(defaultStyle, "Firefly Reduction")
            {
                ToggleProperty = typeof(GameSettings).GetProperty("g_SSReflection_FireflyReduction"),
                Toggle = GameSettings.g_SSReflection_FireflyReduction
            });

            ssrList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 5, 2, "Firefly Threshold ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("g_SSReflection_FireflyThreshold"),
                SliderValue = GameSettings.g_SSReflection_FireflyThreshold
            });

            ssrList.AddElement(new GuiSliderIntText(defaultStyle, 1, 100, 1, "Samples: ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("g_SSReflections_Samples"),
                SliderValue = GameSettings.g_SSReflections_Samples
            });

            ssrList.AddElement(new GuiSliderIntText(defaultStyle, 1, 100, 1, "Search Samples: ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("g_SSReflections_RefinementSamples"),
                SliderValue = GameSettings.g_SSReflections_RefinementSamples
            });

            /////////////////////////////////////////////////////////////////
            //SSAO
            /////////////////////////////////////////////////////////////////
            /// 
            optionList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 10), "Ambient Occlusion",
                defaultStyle.TextFontStyle, Color.DarkSlateGray, Color.White, GUIStyle.TextAlignment.Center,
                Vector2.Zero));

            GuiListToggle ssaoList = new GuiListToggle(Vector2.Zero, defaultStyle) { ToggleBlockColor = Color.DarkSlateGray, IsToggled = false };
            optionList.AddElement(ssaoList);

            ssaoList.AddElement(new GUITextBlockToggle(defaultStyle, "Enable SSAO")
            {
                ToggleProperty = typeof(GameSettings).GetProperty("g_ssao_draw"),
                Toggle = GameSettings.g_ssao_draw
            });

            ssaoList.AddElement(new GUITextBlockToggle(defaultStyle, "SSAO Blur: ")
            {
                ToggleField = typeof(GameSettings).GetField("g_ssao_blur"),
                Toggle = GameSettings.g_ssao_blur
            });

            ssaoList.AddElement(new GuiSliderIntText(defaultStyle, 1, 32, 1, "SSAO Samples: ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("g_ssao_samples"),
                SliderValue = GameSettings.g_ssao_samples
            });

            ssaoList.AddElement(new GuiSliderFloatText(defaultStyle, 1, 100, 2, "Sample Radius: ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("g_ssao_radius"),
                SliderValue = GameSettings.g_ssao_radius
            });

            ssaoList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 4, 1, "SSAO Strength: ")
            {
                SliderProperty = typeof(GameSettings).GetProperty("g_ssao_strength"),
                SliderValue = GameSettings.g_ssao_strength
            });

            /////////////////////////////////////////////////////////////////
            //Bloom
            /////////////////////////////////////////////////////////////////
            /// 
            optionList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 10), "Bloom",
                defaultStyle.TextFontStyle, Color.DarkSlateGray, Color.White, GUIStyle.TextAlignment.Center,
                Vector2.Zero));

            GuiListToggle bloomList = new GuiListToggle(Vector2.Zero, defaultStyle) { ToggleBlockColor = Color.DarkSlateGray, IsToggled = false };
            optionList.AddElement(bloomList);

            bloomList.AddElement(new GUITextBlockToggle(defaultStyle, "Enable Bloom")
            {
                ToggleField = typeof(GameSettings).GetField("g_BloomEnable"),
                Toggle = GameSettings.g_BloomEnable
            });

            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 4, 1, "Threshold: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomThreshold"),
                SliderValue = GameSettings.g_BloomThreshold
            });

            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP0 Radius: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomRadius1"),
                SliderValue = GameSettings.g_BloomRadius1
            });

            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP0 Strength: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomStrength1"),
                SliderValue = GameSettings.g_BloomStrength1
            });


            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP1 Radius: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomRadius2"),
                SliderValue = GameSettings.g_BloomRadius2
            });

            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP1 Strength: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomStrength2"),
                SliderValue = GameSettings.g_BloomStrength2
            });

            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP2 Radius: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomRadius3"),
                SliderValue = GameSettings.g_BloomRadius3
            });

            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP2 Strength: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomStrength3"),
                SliderValue = GameSettings.g_BloomStrength3
            });

            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP3 Radius: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomRadius4"),
                SliderValue = GameSettings.g_BloomRadius4
            });

            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP3 Strength: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomStrength4"),
                SliderValue = GameSettings.g_BloomStrength4
            });


            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP4 Radius: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomRadius5"),
                SliderValue = GameSettings.g_BloomRadius5
            });

            bloomList.AddElement(new GuiSliderFloatText(defaultStyle, 0, 8, 1, "MIP4 Strength: ")
            {
                SliderField = typeof(GameSettings).GetField("g_BloomStrength5"),
                SliderValue = GameSettings.g_BloomStrength5
            });

            _rightSideList.Alignment = GUIStyle.GUIAlignment.TopRight;
        }
Esempio n. 6
0
        public void Initialize(MainLogic mainLogic)
        {
            defaultStyle = new GUIStyle(
                dimensionsStyle: new Vector2(200, 25),
                textFontStyle: GUIRenderer.MonospaceFont,
                blockColorStyle: Color.Gray,
                textColorStyle: Color.White,
                sliderColorStyle: Color.Black,
                guiAlignmentStyle: GUIStyle.GUIAlignment.None,
                textAlignmentStyle: GUIStyle.TextAlignment.Left,
                textButtonAlignmentStyle: GUIStyle.TextAlignment.Center,
                textBorderStyle: new Vector2(10, 1),
                parentDimensionsStyle: new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight));

            screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight));

            GUIList animationList = new GUIList(Vector2.Zero, new Vector2(200, 70), 0, GUIStyle.GUIAlignment.BottomLeft, screenCanvas.Dimensions);

            animationList.AddElement(new GUITextBlockButton(defaultStyle, "play animation")
            {
                ButtonObject = this,
                ButtonMethod = GetType().GetMethod("PlayAnimation"),
            });
            animationList.AddElement(new GUITextBlockToggle(defaultStyle, "Update Animation")
            {
                ToggleField = typeof(GameSettings).GetField("m_updateAnimation"),
                Toggle      = (bool)typeof(GameSettings).GetField("m_updateAnimation").GetValue(null)
            });

            screenCanvas.AddElement(animationList);

            // MAIN LIST ON THE RIGHT
            baseList = new GuiListToggleScroll(new Vector2(-20, 0), new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions);
            screenCanvas.AddElement(baseList);


            baseList.AddElement(new GUITextBlockToggle(defaultStyle, "debug info")
            {
                ToggleField = typeof(GameSettings).GetField("ui_debug"),
                Toggle      = (bool)typeof(GameSettings).GetField("ui_debug").GetValue(null)
            });

            //Size of the model
            baseList.AddElement(_sizeBlock = new GUITextBlock(defaultStyle, "Size: " + GameSettings.m_size)
            {
                Dimensions = new Vector2(200, 25)
            });
            baseList.AddElement(new GuiSliderFloat(defaultStyle, -2, 4)
            {
                SliderField = typeof(GameSettings).GetField("m_size"),
                SliderValue = (float)typeof(GameSettings).GetField("m_size").GetValue(null)
            });

            //Basic default orientation buttons, these have slightly different sizes than "default"
            baseList.AddElement(new GUITextBlockButton(defaultStyle, "Center Model")
            {
                ButtonObject = mainLogic,
                ButtonMethod = mainLogic.GetType().GetMethod("CenterModel"),
            });

            baseList.AddElement(new GUITextBlockToggle(defaultStyle, "Orientation: Y")
            {
                ToggleField = typeof(GameSettings).GetField("m_orientationy"),
                Toggle      = (bool)typeof(GameSettings).GetField("m_orientationy").GetValue(null),
            });
            baseList.AddElement(new GUITextBlockToggle(defaultStyle, "Linear Lighting")
            {
                ToggleField = typeof(GameSettings).GetField("r_UseLinear"),
                Toggle      = (bool)typeof(GameSettings).GetField("r_UseLinear").GetValue(null),
            });

            //Main model loader and other loaders
            GuiTextBlockLoadDialog modelLoader;

            baseList.AddElement(modelLoader = new GuiTextBlockLoadDialog(defaultStyle, "Model:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Model)
                                );
            mainLogic.modelLoader = modelLoader;

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Textures", GUIRenderer.MonospaceFont, Color.DimGray, Color.White, GUIStyle.TextAlignment.Center));
            GuiListToggle textureList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.None, screenCanvas.Dimensions);

            {
                GuiTextBlockLoadDialog albedoLoader;
                textureList.AddElement(
                    albedoLoader =
                        new GuiTextBlockLoadDialog(defaultStyle, "Albedo:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D));
                mainLogic.albedoLoader = albedoLoader;

                GuiTextBlockLoadDialog normalLoader;
                textureList.AddElement(
                    normalLoader =
                        new GuiTextBlockLoadDialog(defaultStyle, "Normal:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D));
                mainLogic.normalLoader = normalLoader;

                GuiTextBlockLoadDialog roughnessLoader;
                textureList.AddElement(
                    roughnessLoader =
                        new GuiTextBlockLoadDialog(defaultStyle, "Roughness:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D));
                mainLogic.roughnessLoader = roughnessLoader;

                GuiTextBlockLoadDialog metallicLoader;
                textureList.AddElement(
                    metallicLoader =
                        new GuiTextBlockLoadDialog(defaultStyle, "Metallic:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D));
                mainLogic.metallicLoader = metallicLoader;

                GuiTextBlockLoadDialog bumpLoader;
                textureList.AddElement(
                    bumpLoader =
                        new GuiTextBlockLoadDialog(defaultStyle, "Heightmap:", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D));
                mainLogic.bumpLoader = bumpLoader;
            }
            baseList.AddElement(textureList);
            textureList.IsToggled = false;

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Default Values", GUIRenderer.MonospaceFont, Color.DimGray, Color.White, GUIStyle.TextAlignment.Center));
            GuiListToggle colorList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.None, screenCanvas.Dimensions);

            {
                colorList.AddElement(new GUIColorPicker(defaultStyle)
                {
                    ReferenceField  = typeof(GameSettings).GetField("bgColor"),
                    ReferenceObject = (Color)typeof(GameSettings).GetField("bgColor").GetValue(null)
                });

                colorList.AddElement(
                    _roughnessBlock =
                        new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Roughness: " + GameSettings.m_roughness,
                                         GUIRenderer.MonospaceFont, Color.Gray, Color.White));
                colorList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0, 1, Color.Gray, Color.Black)
                {
                    SliderField = typeof(GameSettings).GetField("m_roughness"),
                    SliderValue = (float)typeof(GameSettings).GetField("m_roughness").GetValue(null)
                });

                colorList.AddElement(
                    _metallicBlock =
                        new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Metallic: " + GameSettings.m_metallic,
                                         GUIRenderer.MonospaceFont, Color.Gray, Color.White));
                colorList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0, 1, Color.Gray, Color.Black)
                {
                    SliderField = typeof(GameSettings).GetField("m_metallic"),
                    SliderValue = (float)typeof(GameSettings).GetField("m_metallic").GetValue(null)
                });
            }
            colorList.IsToggled = false;
            baseList.AddElement(colorList);

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Bump Mapping", GUIRenderer.MonospaceFont, Color.DimGray, Color.White, GUIStyle.TextAlignment.Center));
            GuiListToggle parallaxList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.None, screenCanvas.Dimensions);

            {
                parallaxList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 40), "Parallax OcclusionMapping", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
                {
                    ToggleField = typeof(GameSettings).GetField("r_UsePOM"),
                    Toggle      = (bool)typeof(GameSettings).GetField("r_UsePOM").GetValue(null)
                });

                parallaxList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "POM Cutoff", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
                {
                    ToggleField = typeof(GameSettings).GetField("r_POMCutoff"),
                    Toggle      = (bool)typeof(GameSettings).GetField("r_POMCutoff").GetValue(null)
                });

                parallaxList.AddElement(
                    _pomBlock =
                        new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Bump Scale: " + GameSettings.pomScale,
                                         GUIRenderer.MonospaceFont, Color.Gray, Color.White));
                parallaxList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), -0.7f, 0.7f, Color.Gray, Color.Black)
                {
                    SliderField = typeof(GameSettings).GetField("pomScale"),
                    SliderValue = (float)typeof(GameSettings).GetField("pomScale").GetValue(null)
                });

                parallaxList.AddElement(
                    _pomQualityBlock =
                        new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "POM Quality: " + GameSettings.r_POMQuality,
                                         GUIRenderer.MonospaceFont, Color.Gray, Color.White));
                parallaxList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0.5f, 3, Color.Gray, Color.Black)
                {
                    SliderField = typeof(GameSettings).GetField("r_POMQuality"),
                    SliderValue = (float)typeof(GameSettings).GetField("r_POMQuality").GetValue(null)
                });
            }
            parallaxList.IsToggled = false;
            baseList.AddElement(parallaxList);

            //AO

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Ambient Occlusion", GUIRenderer.MonospaceFont, Color.DimGray, Color.White, GUIStyle.TextAlignment.Center));
            GuiListToggle aoList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.None, screenCanvas.Dimensions);

            {
                aoList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "Enable AO", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
                {
                    ToggleField = typeof(GameSettings).GetField("ao_Enable"),
                    Toggle      = (bool)typeof(GameSettings).GetField("ao_Enable").GetValue(null)
                });

                aoList.AddElement(
                    _aoRadiiBlock =
                        new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "AO Radius: " + GameSettings.ao_Radii,
                                         GUIRenderer.MonospaceFont, Color.Gray, Color.White));
                aoList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0, 8, Color.Gray, Color.Black)
                {
                    SliderField = typeof(GameSettings).GetField("ao_Radii"),
                    SliderValue = (float)typeof(GameSettings).GetField("ao_Radii").GetValue(null)
                });

                aoList.AddElement(
                    _aoSamplesBlock =
                        new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "AO Samples ppx: " + GameSettings.ao_Samples,
                                         GUIRenderer.MonospaceFont, Color.Gray, Color.White));

                aoList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 25), 0, 64, 2, Color.Gray, Color.Black)
                {
                    SliderField = typeof(GameSettings).GetField("ao_Samples"),
                    SliderValue = (int)typeof(GameSettings).GetField("ao_Samples").GetValue(null)
                });

                aoList.AddElement(
                    _aoStrengthBlock =
                        new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "AO Strength: " + GameSettings.ao_Strength,
                                         GUIRenderer.MonospaceFont, Color.Gray, Color.White));

                aoList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 25), 0, 4, Color.Gray, Color.Black)
                {
                    SliderField = typeof(GameSettings).GetField("ao_Strength"),
                    SliderValue = (float)typeof(GameSettings).GetField("ao_Strength").GetValue(null)
                });

                aoList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "Blur AO", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
                {
                    ToggleField = typeof(GameSettings).GetField("ao_UseBlur"),
                    Toggle      = (bool)typeof(GameSettings).GetField("ao_UseBlur").GetValue(null)
                });

                aoList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "Half resolution", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
                {
                    ToggleField = typeof(GameSettings).GetField("ao_HalfRes"),
                    Toggle      = (bool)typeof(GameSettings).GetField("ao_HalfRes").GetValue(null)
                });
            }
            aoList.IsToggled = false;

            baseList.AddElement(aoList);

            UpdateResolution();
        }
Esempio n. 7
0
        public void Initialize(ScreenManager screenManager, BokehRenderer renderer)
        {
            _renderer      = renderer;
            _screenManager = screenManager;

            screenCanvas = new GUICanvas(Vector2.Zero, new Vector2(GameSettings.g_ScreenWidth, GameSettings.g_ScreenHeight), 0, GUIStyle.GUIAlignment.None);

            baseList = new GuiListToggle(Vector2.Zero, new Vector2(200, 30), 0, GUIStyle.GUIAlignment.TopRight, screenCanvas.Dimensions);
            screenCanvas.AddElement(baseList);

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 35), "return", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject = this,
                ButtonMethod = this.GetType().GetMethod("MainMenu")
            });

            GuiTextBlockLoadDialog textureLoader;

            baseList.AddElement(textureLoader = new GuiTextBlockLoadDialog(Vector2.Zero, new Vector2(200, 35), "image: ", _guiContentLoader, GuiTextBlockLoadDialog.ContentType.Texture2D, GUIRenderer.MonospaceFont, Color.Gray, Color.White)
                                );


            baseList.AddElement(_sizeBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Intensity: " + renderer.BokehSize, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 2, 20, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(BokehRenderer).GetField("BokehSize"),
                SliderValue  = (float)typeof(BokehRenderer).GetField("BokehSize").GetValue(renderer)
            });

            baseList.AddElement(_brightnessBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Brightness: " + renderer.Brightness, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderFloat(Vector2.Zero, new Vector2(200, 35), 0.1f, 3, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = typeof(BokehRenderer).GetField("Brightness"),
                SliderValue  = (float)typeof(BokehRenderer).GetField("Brightness").GetValue(renderer)
            });

            baseList.AddElement(_downsizeBlock = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Scale: " + renderer.Downsize, GUIRenderer.MonospaceFont, Color.Gray, Color.White));
            baseList.AddElement(new GuiSliderInt(Vector2.Zero, new Vector2(200, 35), 1, 3, 1, Color.Gray, Color.White)
            {
                SliderObject = renderer,
                SliderField  = renderer.GetType().GetField("Downsize"),
                SliderValue  = (int)renderer.GetType().GetField("Downsize").GetValue(renderer)
            });

            baseList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "32-bit precision", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ToggleObject = renderer,
                ToggleField  = renderer.GetType().GetField("FullPrecision"),
                Toggle       = renderer.FullPrecision,
            });

            baseList.AddElement(new GUITextBlockToggle(Vector2.Zero, new Vector2(200, 25), "Dynamic Scaling", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ToggleObject = renderer,
                ToggleField  = renderer.GetType().GetField("DynamicScaling"),
                Toggle       = renderer.DynamicScaling,
            });

            baseList.AddElement(new GUIBlock(Vector2.Zero, new Vector2(200, 25), Color.DimGray));

            baseList.AddElement(new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "Bokeh Shape: ", GUIRenderer.MonospaceFont, Color.Gray, Color.White));

            //Radio list
            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 25), "Pentagon", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchShape"),
                ButtonMethodArgs = new object[] { BokehRenderer.BokehShapes.Pentagon }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 25), "Hexagon", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchShape"),
                ButtonMethodArgs = new object[] { BokehRenderer.BokehShapes.Hexagon }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 25), "Circle", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchShape"),
                ButtonMethodArgs = new object[] { BokehRenderer.BokehShapes.Circle }
            });

            baseList.AddElement(new GUITextBlockButton(Vector2.Zero, new Vector2(200, 25), "Star", GUIRenderer.MonospaceFont, Color.Gray, Color.White)
            {
                ButtonObject     = this,
                ButtonMethod     = GetType().GetMethod("SwitchShape"),
                ButtonMethodArgs = new object[] { BokehRenderer.BokehShapes.Star }
            });

            baseList.AddElement(new GUIBlock(Vector2.Zero, new Vector2(200, 25), Color.DimGray));

            baseList.AddElement(_polyCount = new GUITextBlock(Vector2.Zero, new Vector2(200, 25), "PolyCount: ", GUIRenderer.MonospaceFont, Color.DimGray, Color.White));


            renderer._backgroundTextureLoader = textureLoader;

            baseList.ParentResized(screenCanvas.Dimensions);
        }
    private void SetUp()
    {
        //		selectRules = new GUIList(new Rect(100,50,180,25));
        //		selectRules.AddElement("Consumed towers");
        //		selectRules.AddElement("Persistent towers");

        selectBoard = new GUIList(new Rect((int)(Screen.width/4),100,(int)(Screen.width/2),(int)(Screen.height*0.08)));
        selectBoard.AddElement("Square Board");
        selectBoard.AddElement("Large Square Board");
        selectBoard.AddElement("Circle Board");
        selectBoard.AddElement("Donut Board");

        selectTowers = new GUIList(new Rect((int)(Screen.width/4),20,(int)(Screen.width/2),(int)(Screen.height*0.08)));
        selectTowers.AddElement("All towers");
        selectTowers.AddElement("Straight only");

        selectGameTime.position.y = 180;
        selectGameTime.position.x = 0;
        selectGameTime.enable = false; //spill uten tid er default
        Stats.SetDefaultSettings();
    }
 private void SetUp()
 {
     selectRules = new GUIList(new Rect(100,50,180,25));
     selectRules.AddElement("Consumed towers");
     selectRules.AddElement("Persistent towers");
     selectTowers = new GUIList(new Rect(100,100,180,25));
     selectTowers.AddElement("All towers");
     selectTowers.AddElement("Straight only");
     selectGameTime.position.y = 180;
     selectGameTime.position.x = 0;
     selectGameTime.enable = false; //spill uten tid er default
     Stats.SetDefaultSettings();
 }
    //bool actionListIsOpened = false;

    void Start()
    {
        intManager = GetComponent <InteractionManager> ();
        if (intManager == null)
        {
            throw new UnityException("No interaction manager found for UI");
        }

        guiItems = new Dictionary <string, GUIItem> ();

        // Creating canvas
        if (canvasPrefab == null)
        {
            throw new UnityException("No Canvas prefab found");
        }
        else
        {
            canvas = Instantiate(canvasPrefab).GetComponent <Canvas> ();
        }

        // Adding hands panel
        if (guiHandsPanelPrefab == null)
        {
            throw new UnityException("No Hands panel prefab found");
        }
        else
        {
            handsPanel = Instantiate(guiHandsPanelPrefab).GetComponent <Image> ();
            handsPanel.transform.SetParent(canvas.transform, false);
            GUIItem leftHand = GameObject.FindWithTag("Left Hand Image").GetComponent <GUIItem>();
            guiItems.Add("left hand", leftHand);
            //leftHand.enabled = false;
            GUIItem rightHand = GameObject.FindWithTag("Right Hand Image").GetComponent <GUIItem>();
            guiItems.Add("right hand", rightHand);
            //rightHand.enabled = false;
            if (leftHand == null || rightHand == null)
            {
                throw new UnityException("No left/right hand GUIInteractable component detected in Hands Panel prefab");
            }
        }

        // Adding accessories panel
        if (guiAccessoriesPanelPrefab == null)
        {
            throw new UnityException("No accessories panel prefab found");
        }
        else
        {
            accessoriesPanel = Instantiate(guiAccessoriesPanelPrefab).GetComponent <Image> ();
            accessoriesPanel.transform.SetParent(canvas.transform, false);
            beltImage             = GameObject.FindWithTag("Belt Image").GetComponent <Image>();
            beltImage.enabled     = false;
            backpackImage         = GameObject.FindWithTag("Backpack Image").GetComponent <Image>();
            backpackImage.enabled = false;
            if (beltImage == null || backpackImage == null)
            {
                throw new UnityException("No belt/backpack image detected in Accessories Panel prefab");
            }
        }

        // Adding action list panel
        if (actionListPrefab == null)
        {
            throw new UnityException("No Action List prefab found");
        }
        actionList = Instantiate(actionListPrefab).GetComponent <GUIList> ();
        actionList.transform.SetParent(canvas.transform, false);
        if (actionList == null)
        {
            throw new UnityException("GUIList component not found in action list prefab");
        }
        actionList.SetManager(this);
        //actionList.Hide (true);
    }