Esempio n. 1
0
		public WindowView(GeeUIMain GeeUI, View rootView, Vector2 position)
			: base(GeeUI, rootView)
		{
			Position.Value = position;
			NinePatchNormal = GeeUIMain.NinePatchWindowUnselected;
			NinePatchSelected = GeeUIMain.NinePatchWindowSelected;
		}
Esempio n. 2
0
 public PanelView(GeeUIMain GeeUI, View rootView, Vector2 position)
     : base(GeeUI, rootView)
 {
     SelectedNinepatch   = GeeUIMain.NinePatchPanelSelected;
     UnselectedNinepatch = GeeUIMain.NinePatchPanelUnselected;
     Position.Value      = position;
 }
Esempio n. 3
0
 public WindowView(GeeUIMain GeeUI, View rootView, Vector2 position)
     : base(GeeUI, rootView)
 {
     Position.Value    = position;
     NinePatchNormal   = GeeUIMain.NinePatchWindowUnselected;
     NinePatchSelected = GeeUIMain.NinePatchWindowSelected;
 }
Esempio n. 4
0
		public PanelView(GeeUIMain GeeUI, View rootView, Vector2 position)
			: base(GeeUI, rootView)
		{
			SelectedNinepatch = GeeUIMain.NinePatchPanelSelected;
			UnselectedNinepatch = GeeUIMain.NinePatchPanelUnselected;
			Position.Value = position;
		}
Esempio n. 5
0
		public ImageView(GeeUIMain GeeUI, View rootView, Texture2D texture)
			: base(GeeUI, rootView)
        {
            Texture = texture;
			Width.Value = texture.Width;
			Height.Value = texture.Height;
        }
Esempio n. 6
0
 public ImageView(GeeUIMain GeeUI, View rootView, Texture2D texture)
     : base(GeeUI, rootView)
 {
     Texture      = texture;
     Width.Value  = texture.Width;
     Height.Value = texture.Height;
 }
Esempio n. 7
0
        public ToolTip(GeeUIMain theGeeUI, View parentView, View linkedTo, string text)
            : base(theGeeUI, parentView)
        {
            this.Patch = GeeUIMain.NinePatchPanelUnselected;

            ToolTipText.Value = text;
            TextView          = new TextView(theGeeUI, this, text, Vector2.Zero);
            this.ChildrenLayouts.Add(new ExpandToFitLayout());
            this.ChildrenLayouts.Add(new VerticalViewLayout(0, false));

            this.realParent = linkedTo;

            if (this.realParent != null)
            {
                this.Add(new NotifyBinding(this.CheckActive, this.realParent.Active, this.realParent.Attached));
            }

            this.Add(new NotifyBinding(this.CheckActive, this.Active));

            this.AnchorPoint.Value = new Vector2(0f, 1f);
            this.Position.Value    = InputManager.GetMousePosV();

            this.Add(new NotifyBinding(CheckActive, this.Active, realParent.Active));
            this.AnimateIn();
        }
Esempio n. 8
0
 public View(GeeUIMain geeUi, View parent)
     : this(geeUi)
 {
     if (parent != null)
     {
         parent.Children.Add(this);
     }
 }
Esempio n. 9
0
        public CheckBoxView(GeeUIMain GeeUI, View rootView, Vector2 position, string label)
            : base(GeeUI, rootView)
        {
            Position.Value          = position;
            this.numChildrenAllowed = 1;

            new TextView(GeeUI, this, label, Vector2.Zero);
        }
Esempio n. 10
0
		public CheckBoxView(GeeUIMain GeeUI, View rootView, Vector2 position, string label)
			: base(GeeUI, rootView)
		{
			Position.Value = position;
			this.numChildrenAllowed = 1;

			new TextView(GeeUI, this, label, Vector2.Zero);
		}
Esempio n. 11
0
		public ListView(GeeUIMain GeeUI, View rootView)
			: base(GeeUI, rootView)
		{
			this.Add(new NotifyBinding(delegate()
			{
				this.recomputeOffset(0);
			}, this.ChildrenBoundBox, this.Width, this.Height));
		}
Esempio n. 12
0
 public ListView(GeeUIMain GeeUI, View rootView)
     : base(GeeUI, rootView)
 {
     this.Add(new NotifyBinding(delegate()
     {
         this.recomputeOffset(0);
     }, this.ChildrenBoundBox, this.Width, this.Height));
 }
Esempio n. 13
0
        public TabHost(GeeUIMain GeeUI, View rootView, Vector2 position)
            : base(GeeUI, rootView)
        {
            Position.Value   = position;
            TabContainerView = new TabContainer(GeeUI, this);
            TabContainerView.ChildrenLayouts.Add(new HorizontalViewLayout(1, true));

            GeeUI.OnKeyPressedHandler += keyPressedHandler;
        }
Esempio n. 14
0
		public ButtonView(GeeUIMain GeeUI, View rootview, View contentView, Vector2 position)
			: base(GeeUI, rootview)
		{
			NinePatchNormal = GeeUIMain.NinePatchBtnDefault;
			NinePatchHover = GeeUIMain.NinePatchBtnHover;
			NinePatchClicked = GeeUIMain.NinePatchBtnClicked;
			Position.Value = position;
			ButtonContentview = contentView;
		}
Esempio n. 15
0
 public ButtonView(GeeUIMain GeeUI, View rootview, View contentView, Vector2 position)
     : base(GeeUI, rootview)
 {
     NinePatchNormal   = GeeUIMain.NinePatchBtnDefault;
     NinePatchHover    = GeeUIMain.NinePatchBtnHover;
     NinePatchClicked  = GeeUIMain.NinePatchBtnClicked;
     Position.Value    = position;
     ButtonContentview = contentView;
 }
Esempio n. 16
0
		public TabHost(GeeUIMain GeeUI, View rootView, Vector2 position)
			: base(GeeUI, rootView)
		{
			Position.Value = position;
			TabContainerView = new TabContainer(GeeUI, this);
			TabContainerView.ChildrenLayouts.Add(new HorizontalViewLayout(1, true));

			GeeUI.OnKeyPressedHandler += keyPressedHandler;
		}
Esempio n. 17
0
		public TextView(GeeUIMain GeeUI, View rootView, string text, Vector2 position)
			: base(GeeUI, rootView)
		{
			Text.Value = text;
			Position.Value = position;
			TextColor = GeeUI.TextColorDefault;

			Text.AddBinding(new NotifyBinding(HandleResize, Text));
			if(AutoSize.Value) HandleResize();
		}
Esempio n. 18
0
        public SliderView(GeeUIMain GeeUI, View rootView, Vector2 position, int min, int max)
            : base(GeeUI, rootView)
        {
            SliderRange    = GeeUIMain.NinePatchSliderRange;
            SliderDefault  = GeeUIMain.TextureSliderDefault;
            SliderSelected = GeeUIMain.TextureSliderSelected;

            _min = min;
            _max = max;

            Position.Value = position;
        }
Esempio n. 19
0
		public SliderView(GeeUIMain GeeUI, View rootView, Vector2 position, int min, int max)
			: base(GeeUI, rootView)
		{
			SliderRange = GeeUIMain.NinePatchSliderRange;
			SliderDefault = GeeUIMain.TextureSliderDefault;
			SliderSelected = GeeUIMain.TextureSliderSelected;

			_min = min;
			_max = max;

			Position.Value = position;
		}
Esempio n. 20
0
		public ButtonView(GeeUIMain GeeUI, View rootView, string text, Vector2 position)
			: base(GeeUI, rootView)
		{
			NinePatchNormal = GeeUIMain.NinePatchBtnDefault;
			NinePatchHover = GeeUIMain.NinePatchBtnHover;
			NinePatchClicked = GeeUIMain.NinePatchBtnClicked;
			Position.Value = position;

			//Make the TextView for the text
			var textV = new TextView(this.ParentGeeUI, this, text, new Vector2(0, 0)) {TextJustification = TextJustification.Left};
			Width.Value = (textV.Width.Value = (int)GeeUIMain.Font.MeasureString(text).X) + NinePatchNormal.LeftWidth + NinePatchNormal.RightWidth;
			Height.Value = (textV.Height.Value = (int)GeeUIMain.Font.MeasureString(text).Y) + NinePatchNormal.TopHeight + NinePatchNormal.BottomHeight;
		}
Esempio n. 21
0
        public TextView(GeeUIMain GeeUI, View rootView, string text, Vector2 position)
            : base(GeeUI, rootView)
        {
            Text.Value     = text;
            Position.Value = position;
            TextColor      = GeeUI.TextColorDefault;

            Text.AddBinding(new NotifyBinding(HandleResize, Text));
            if (AutoSize.Value)
            {
                HandleResize();
            }
        }
Esempio n. 22
0
		public TabView(GeeUIMain GeeUI, View rootView, Vector2 position)
			: base(GeeUI, rootView)
		{
			Position.Value = position;
			this.numChildrenAllowed = 1;

			NinePatchDefault = GeeUIMain.NinePatchTabDefault;
			NinePatchSelected = GeeUIMain.NinePatchTabSelected;

			// HACK
			this.Height.Value = (int)(25.0f * GeeUI.Main.FontMultiplier);

			new TextView(GeeUI, this, "", Vector2.Zero) {  };
		}
Esempio n. 23
0
        public TabView(GeeUIMain GeeUI, View rootView, Vector2 position)
            : base(GeeUI, rootView)
        {
            Position.Value          = position;
            this.numChildrenAllowed = 1;

            NinePatchDefault  = GeeUIMain.NinePatchTabDefault;
            NinePatchSelected = GeeUIMain.NinePatchTabSelected;

            // HACK
            this.Height.Value = (int)(25.0f * GeeUI.Main.FontMultiplier);

            new TextView(GeeUI, this, "", Vector2.Zero)
            {
            };
        }
Esempio n. 24
0
        public ButtonView(GeeUIMain GeeUI, View rootView, string text, Vector2 position)
            : base(GeeUI, rootView)
        {
            NinePatchNormal  = GeeUIMain.NinePatchBtnDefault;
            NinePatchHover   = GeeUIMain.NinePatchBtnHover;
            NinePatchClicked = GeeUIMain.NinePatchBtnClicked;
            Position.Value   = position;

            //Make the TextView for the text
            var textV = new TextView(this.ParentGeeUI, this, text, new Vector2(0, 0))
            {
                TextJustification = TextJustification.Left
            };

            Width.Value  = (textV.Width.Value = (int)GeeUIMain.Font.MeasureString(text).X) + NinePatchNormal.LeftWidth + NinePatchNormal.RightWidth;
            Height.Value = (textV.Height.Value = (int)GeeUIMain.Font.MeasureString(text).Y) + NinePatchNormal.TopHeight + NinePatchNormal.BottomHeight;
        }
Esempio n. 25
0
        public TextFieldView(GeeUIMain GeeUI, View rootView, Vector2 position)
            : base(GeeUI, rootView)
        {
            NinePatchDefault   = GeeUIMain.NinePatchTextFieldDefault;
            NinePatchSelected  = GeeUIMain.NinePatchTextFieldSelected;
            NinePatchRegexGood = GeeUIMain.NinePatchTextFieldRight;
            NinePatchRegexBad  = GeeUIMain.NinePatchTextFieldWrong;

            Position.Value = position;

            GeeUI.OnKeyPressedHandler  += keyPressedHandler;
            GeeUI.OnKeyReleasedHandler += keyReleasedHandler;

            TextColor = GeeUI.TextColorDefault;

            ContentMustBeScissored.Value = true;

            //Text = new Property<string>();
            //Text.Get = () => MultiLine ? Text.Value : Text.Value.Replace("\n", "");
        }
Esempio n. 26
0
		public ToolTip(GeeUIMain theGeeUI, View parentView, View linkedTo, string text)
			: base(theGeeUI, parentView)
		{
			this.Patch = GeeUIMain.NinePatchPanelUnselected;

			ToolTipText.Value = text;
			TextView = new TextView(theGeeUI, this, text, Vector2.Zero);
			this.ChildrenLayouts.Add(new ExpandToFitLayout());
			this.ChildrenLayouts.Add(new VerticalViewLayout(0, false));

			this.realParent = linkedTo;

			if (this.realParent != null)
				this.Add(new NotifyBinding(this.CheckActive, this.realParent.Active, this.realParent.Attached));
			
			this.Add(new NotifyBinding(this.CheckActive, this.Active));

			this.AnchorPoint.Value = new Vector2(0f, 1f);
			this.Position.Value = InputManager.GetMousePosV();

			this.Add(new NotifyBinding(CheckActive, this.Active, realParent.Active));
			this.AnimateIn();
		}
Esempio n. 27
0
        public DropDownView(GeeUIMain theGeeUI, View parentView, Vector2 position)
            : base(theGeeUI, parentView)
        {
            this.numChildrenAllowed          = 1;
            ParentGeeUI.OnKeyPressedHandler += this.keyPressedHandler;
            var button = new ButtonView(theGeeUI, this, "", Vector2.Zero);

            button.Add(new Binding <int>(this.Width, button.Width));
            button.Add(new Binding <int>(this.Height, button.Height));
            button.OnMouseClick += delegate(object sender, EventArgs e)
            {
                ToggleDropDown();
                this.FilterView.TemporarilyIgnoreMouseClickAway = true;
            };

            button.OnMouseClickAway += delegate(object sender, EventArgs args)
            {
                HideDropDown();
            };

            button.OnMouseRightClick += (sender, args) =>
            {
                if (AllowRightClickExecute)
                {
                    ExecuteLast();
                }
            };

            button.Name = "button";

            this.DropDownPanelView = new PanelView(theGeeUI, theGeeUI.RootView, Vector2.Zero);
            DropDownPanelView.ChildrenLayouts.Add(new VerticalViewLayout(2, false));
            this.DropDownPanelView.SelectedNinepatch = this.DropDownPanelView.UnselectedNinepatch = GeeUIMain.NinePatchDropDown;

            FilterView = new TextFieldView(theGeeUI, DropDownPanelView, Vector2.Zero);

            // HACK
            FilterView.Height.Value = (int)(20 * theGeeUI.Main.MainFontMultiplier);

            FilterView.MultiLine = false;
            FilterView.Add(new Binding <int>(FilterView.Width, x => x - 8, DropDownPanelView.Width));
            FilterView.OnTextChanged = () =>
            {
                if (FilterView.Active && DropDownPanelView.Active && AllowFilterText)
                {
                    Refilter();
                }
            };

            DropDownListView = new ListView(theGeeUI, DropDownPanelView);
            DropDownListView.ChildrenLayouts.Add(new VerticalViewLayout(1, false));
            DropDownListView.ScrollMultiplier = 20;
            DropDownListView.Add(new Binding <int, Rectangle>(DropDownListView.Width, x => Math.Max(200, x.Width), DropDownListView.ChildrenBoundBox));
            DropDownListView.Add(new Binding <int, Rectangle>(DropDownListView.Height, x => x.Height, DropDownListView.ChildrenBoundBox));

            DropDownPanelView.Add(new Binding <int>(DropDownPanelView.Width, DropDownListView.Width));

            DropDownListView.Name = "DropList";
            DropDownPanelView.Add(new Binding <int>(DropDownPanelView.Height, (i1) => i1 + 2 + ((AllowFilterText && FilterView.Active) ? FilterView.BoundBox.Height : 0), DropDownListView.Height));

            DropDownPanelView.Active.Value = false;

            this.Add(new SetBinding <string>(this.Label, delegate(string value)
            {
                ((ButtonView)FindFirstChildByName("button")).Text = value;
            }));
        }
Esempio n. 28
0
File: Main.cs Progetto: kleril/Lemma
		protected override void LoadContent()
		{
			this.MapContent = new ContentManager(this.Services);
			this.MapContent.RootDirectory = this.Content.RootDirectory;

			GeeUIMain.Font = this.Content.Load<SpriteFont>(this.Font);

			if (this.firstLoadContentCall)
			{
				this.firstLoadContentCall = false;

				if (!Directory.Exists(this.MapDirectory))
					Directory.CreateDirectory(this.MapDirectory);
				string challengeDirectory = Path.Combine(this.MapDirectory, "Challenge");
				if (!Directory.Exists(challengeDirectory))
					Directory.CreateDirectory(challengeDirectory);

#if VR
				if (this.VR)
				{
					this.vrLeftMesh.Load(this, Ovr.Eye.Left, this.vrLeftFov);
					this.vrRightMesh.Load(this, Ovr.Eye.Right, this.vrRightFov);
					new CommandBinding(this.ReloadedContent, (Action)this.vrLeftMesh.Reload);
					new CommandBinding(this.ReloadedContent, (Action)this.vrRightMesh.Reload);
					this.reallocateVrTargets();

					this.vrCamera = new Camera();
					this.AddComponent(this.vrCamera);
				}
#endif

				this.GraphicsDevice.PresentationParameters.PresentationInterval = PresentInterval.Immediate;
				this.GeeUI = new GeeUIMain();
				this.AddComponent(GeeUI);

				this.ConsoleUI = new ConsoleUI();
				this.AddComponent(ConsoleUI);

				this.Console = new Console.Console();
				this.AddComponent(Console);

				Lemma.Console.Console.BindType(null, this);
				Lemma.Console.Console.BindType(null, Console);

				// Initialize Wwise
				AkGlobalSoundEngineInitializer initializer = new AkGlobalSoundEngineInitializer(Path.Combine(this.Content.RootDirectory, "Wwise"));
				this.AddComponent(initializer);

				this.Listener = new AkListener();
				this.Listener.Add(new Binding<Vector3>(this.Listener.Position, this.Camera.Position));
				this.Listener.Add(new Binding<Vector3>(this.Listener.Forward, this.Camera.Forward));
				this.Listener.Add(new Binding<Vector3>(this.Listener.Up, this.Camera.Up));
				this.AddComponent(this.Listener);

				// Create the renderer.
				this.LightingManager = new LightingManager();
				this.AddComponent(this.LightingManager);
				this.Renderer = new Renderer(this, true, true, true, true, true);

				this.AddComponent(this.Renderer);
				this.Renderer.ReallocateBuffers(this.ScreenSize);

				this.renderParameters = new RenderParameters
				{
					Camera = this.Camera,
					IsMainRender = true
				};

				// Load strings
				this.Strings.Load(Path.Combine(this.Content.RootDirectory, "Strings.xlsx"));

				this.UI = new UIRenderer();
				this.UI.GeeUI = this.GeeUI;
				this.AddComponent(this.UI);

				PCInput input = new PCInput();
				this.AddComponent(input);

				Lemma.Console.Console.BindType(null, input);
				Lemma.Console.Console.BindType(null, UI);
				Lemma.Console.Console.BindType(null, Renderer);
				Lemma.Console.Console.BindType(null, LightingManager);

				input.Add(new CommandBinding(input.GetChord(new PCInput.Chord { Modifier = Keys.LeftAlt, Key = Keys.S }), delegate()
				{
					// High-resolution screenshot
					bool originalModelsVisible = Editor.EditorModelsVisible;
					Editor.EditorModelsVisible.Value = false;
					Screenshot s = new Screenshot();
					this.AddComponent(s);
					s.Take(new Point(4096, 2304), delegate()
					{
						string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
						string path;
						int i = 0;
						do
						{
							path = Path.Combine(desktop, string.Format("lemma-screen{0}.png", i));
							i++;
						}
						while (File.Exists(path));

						Screenshot.SavePng(s.Buffer, path);

						Editor.EditorModelsVisible.Value = originalModelsVisible;

						s.Delete.Execute();
					});
				}));

				this.performanceMonitor = new ListContainer();
				this.performanceMonitor.Add(new Binding<Vector2, Point>(performanceMonitor.Position, x => new Vector2(x.X, 0), this.ScreenSize));
				this.performanceMonitor.AnchorPoint.Value = new Vector2(1, 0);
				this.performanceMonitor.Visible.Value = false;
				this.performanceMonitor.Name.Value = "PerformanceMonitor";
				this.UI.Root.Children.Add(this.performanceMonitor);

				Action<string, Property<double>> addTimer = delegate(string label, Property<double> property)
				{
					TextElement text = new TextElement();
					text.FontFile.Value = this.Font;
					text.Add(new Binding<string, double>(text.Text, x => label + ": " + (x * 1000.0).ToString("F") + "ms", property));
					this.performanceMonitor.Children.Add(text);
				};

				Action<string, Property<int>> addCounter = delegate(string label, Property<int> property)
				{
					TextElement text = new TextElement();
					text.FontFile.Value = this.Font;
					text.Add(new Binding<string, int>(text.Text, x => label + ": " + x.ToString(), property));
					this.performanceMonitor.Children.Add(text);
				};

				TextElement frameRateText = new TextElement();
				frameRateText.FontFile.Value = this.Font;
				frameRateText.Add(new Binding<string, float>(frameRateText.Text, x => "FPS: " + x.ToString("0"), this.frameRate));
				this.performanceMonitor.Children.Add(frameRateText);

				addTimer("Physics", this.physicsTime);
				addTimer("Update", this.updateTime);
				addTimer("Render", this.renderTime);
				addCounter("Draw calls", this.drawCalls);
				addCounter("Triangles", this.triangles);
				addCounter("Working set", this.workingSet);

				Lemma.Console.Console.AddConCommand(new ConCommand("perf", "Toggle the performance monitor", delegate(ConCommand.ArgCollection args)
				{
					this.performanceMonitor.Visible.Value = !this.performanceMonitor.Visible;
				}));

				try
				{
					IEnumerable<string> globalStaticScripts = Directory.GetFiles(Path.Combine(this.Content.RootDirectory, "GlobalStaticScripts"), "*", SearchOption.AllDirectories).Select(x => Path.Combine("..\\GlobalStaticScripts", Path.GetFileNameWithoutExtension(x)));
					foreach (string scriptName in globalStaticScripts)
						this.executeStaticScript(scriptName);
				}
				catch (IOException)
				{

				}

				this.UIFactory = new UIFactory();
				this.AddComponent(this.UIFactory);
				this.AddComponent(this.Menu); // Have to do this here so the menu's Awake can use all our loaded stuff

				this.Spawner = new Spawner();
				this.AddComponent(this.Spawner);

				this.UI.IsMouseVisible.Value = true;

				AKRESULT akresult = AkBankLoader.LoadBank("SFX_Bank_01.bnk");
				if (akresult != AKRESULT.AK_Success)
					Log.d(string.Format("Failed to load main sound bank: {0}", akresult));

#if ANALYTICS
				this.SessionRecorder = new Session.Recorder(this);

				this.SessionRecorder.Add("Position", delegate()
				{
					Entity p = PlayerFactory.Instance;
					if (p != null && p.Active)
						return p.Get<Transform>().Position;
					else
						return Vector3.Zero;
				});

				this.SessionRecorder.Add("Health", delegate()
				{
					Entity p = PlayerFactory.Instance;
					if (p != null && p.Active)
						return p.Get<Player>().Health;
					else
						return 0.0f;
				});

				this.SessionRecorder.Add("Framerate", delegate()
				{
					return this.frameRate;
				});

				this.SessionRecorder.Add("WorkingSet", delegate()
				{
					return this.workingSet;
				});
				this.AddComponent(this.SessionRecorder);
				this.SessionRecorder.Add(new Binding<bool, Config.RecordAnalytics>(this.SessionRecorder.EnableUpload, x => x == Config.RecordAnalytics.On, this.Settings.Analytics));
#endif

				this.DefaultLighting();

				new SetBinding<float>(this.Settings.SoundEffectVolume, delegate(float value)
				{
					AkSoundEngine.SetRTPCValue(AK.GAME_PARAMETERS.VOLUME_SFX, MathHelper.Clamp(value, 0.0f, 1.0f));
				});

				new SetBinding<float>(this.Settings.MusicVolume, delegate(float value)
				{
					AkSoundEngine.SetRTPCValue(AK.GAME_PARAMETERS.VOLUME_MUSIC, MathHelper.Clamp(value, 0.0f, 1.0f));
				});

				new TwoWayBinding<LightingManager.DynamicShadowSetting>(this.Settings.DynamicShadows, this.LightingManager.DynamicShadows);
				new TwoWayBinding<float>(this.Settings.MotionBlurAmount, this.Renderer.MotionBlurAmount);
				new TwoWayBinding<float>(this.Settings.Gamma, this.Renderer.Gamma);
				new TwoWayBinding<bool>(this.Settings.Bloom, this.Renderer.EnableBloom);
				new TwoWayBinding<bool>(this.Settings.SSAO, this.Renderer.EnableSSAO);
				new Binding<float>(this.Camera.FieldOfView, this.Settings.FieldOfView);

				foreach (string file in Directory.GetFiles(this.MapDirectory, "*.xlsx", SearchOption.TopDirectoryOnly))
					this.Strings.Load(file);

				new Binding<string, Config.Lang>(this.Strings.Language, x => x.ToString(), this.Settings.Language);
				new NotifyBinding(this.SaveSettings, this.Settings.Language);

				new CommandBinding(this.MapLoaded, delegate()
				{
					this.Renderer.BlurAmount.Value = 0.0f;
					this.Renderer.Tint.Value = new Vector3(1.0f);
				});

#if VR
				if (this.VR)
				{
					Action loadVrEffect = delegate()
					{
						this.vrEffect = this.Content.Load<Effect>("Effects\\Oculus");
					};
					loadVrEffect();
					new CommandBinding(this.ReloadedContent, loadVrEffect);

					this.UI.Add(new Binding<Point>(this.UI.RenderTargetSize, this.ScreenSize));

					this.VRUI = new Lemma.Components.ModelNonPostProcessed();
					this.VRUI.MapContent = false;
					this.VRUI.DrawOrder.Value = 100000; // On top of everything
					this.VRUI.Filename.Value = "Models\\plane";
					this.VRUI.EffectFile.Value = "Effects\\VirtualUI";
					this.VRUI.Add(new Binding<Microsoft.Xna.Framework.Graphics.RenderTarget2D>(this.VRUI.GetRenderTarget2DParameter("Diffuse" + Lemma.Components.Model.SamplerPostfix), this.UI.RenderTarget));
					this.VRUI.Add(new Binding<Matrix>(this.VRUI.Transform, delegate()
					{
						Matrix rot = this.Camera.RotationMatrix;
						Matrix mat = Matrix.Identity;
						mat.Forward = rot.Right;
						mat.Right = rot.Forward;
						mat.Up = rot.Up;
						mat *= Matrix.CreateScale(7);
						mat.Translation = this.Camera.Position + rot.Forward * 4.0f;
						return mat;
					}, this.Camera.Position, this.Camera.RotationMatrix));
					this.AddComponent(this.VRUI);

					this.UI.Setup3D(this.VRUI.Transform);
				}
#endif

#if ANALYTICS
				bool editorLastEnabled = this.EditorEnabled;
				new CommandBinding<string>(this.LoadingMap, delegate(string newMap)
				{
					if (this.MapFile.Value != null && !editorLastEnabled)
					{
						this.SessionRecorder.RecordEvent("ChangedMap", newMap);
						if (!this.IsChallengeMap(this.MapFile) && this.MapFile.Value != Main.MenuMap)
							this.SaveAnalytics();
					}
					this.SessionRecorder.Reset();
					editorLastEnabled = this.EditorEnabled;
				});
#endif
				new CommandBinding<string>(this.LoadingMap, delegate(string newMap)
				{
					this.CancelScheduledSave();
				});

#if !DEVELOPMENT
				IO.MapLoader.Load(this, MenuMap);
				this.Menu.Show(initial: true);
#endif

#if ANALYTICS
				if (this.Settings.Analytics.Value == Config.RecordAnalytics.Ask)
				{
					this.Menu.ShowDialog("\\analytics prompt", "\\enable analytics", delegate()
					{
						this.Settings.Analytics.Value = Config.RecordAnalytics.On;
					},
					"\\disable analytics", delegate()
					{
						this.Settings.Analytics.Value = Config.RecordAnalytics.Off;
					});
				}
#endif

#if VR
				if (this.oculusNotFound)
					this.Menu.HideMessage(null, this.Menu.ShowMessage(null, "Error: no Oculus found."), 6.0f);

				if (this.VR)
				{
					this.Menu.EnableInput(false);
					Container vrMsg = this.Menu.BuildMessage("\\vr message", 300.0f);
					vrMsg.AnchorPoint.Value = new Vector2(0.5f, 0.5f);
					vrMsg.Add(new Binding<Vector2, Point>(vrMsg.Position, x => new Vector2(x.X * 0.5f, x.Y * 0.5f), this.ScreenSize));
					this.UI.Root.Children.Add(vrMsg);
					input.Bind(this.Settings.RecenterVRPose, PCInput.InputState.Down, this.VRHmd.RecenterPose);
					input.Bind(this.Settings.RecenterVRPose, PCInput.InputState.Down, delegate()
					{
						if (vrMsg != null)
						{
							vrMsg.Delete.Execute();
							vrMsg = null;
						}
						this.Menu.EnableInput(true);
					});
				}
				else
#endif
				{
					input.Bind(this.Settings.ToggleFullscreen, PCInput.InputState.Down, delegate()
					{
						if (this.Settings.Fullscreen) // Already fullscreen. Go to windowed mode.
							this.ExitFullscreen();
						else // In windowed mode. Go to fullscreen.
							this.EnterFullscreen();
					});
				}

				input.Bind(this.Settings.QuickSave, PCInput.InputState.Down, delegate()
				{
					this.SaveWithNotification(true);
				});
			}
			else
			{
				this.ReloadingContent.Execute();
				foreach (IGraphicsComponent c in this.graphicsComponents)
					c.LoadContent(true);
				this.ReloadedContent.Execute();
			}

			this.GraphicsDevice.RasterizerState = new RasterizerState { MultiSampleAntiAlias = false };

			if (this.spriteBatch != null)
				this.spriteBatch.Dispose();
			this.spriteBatch = new SpriteBatch(this.GraphicsDevice);
		}
Esempio n. 29
0
		public TextFieldView(GeeUIMain GeeUI, View rootView, Vector2 position)
			: base(GeeUI, rootView)
		{
			NinePatchDefault = GeeUIMain.NinePatchTextFieldDefault;
			NinePatchSelected = GeeUIMain.NinePatchTextFieldSelected;
			NinePatchRegexGood = GeeUIMain.NinePatchTextFieldRight;
			NinePatchRegexBad = GeeUIMain.NinePatchTextFieldWrong;

			Position.Value = position;

			GeeUI.OnKeyPressedHandler += keyPressedHandler;
			GeeUI.OnKeyReleasedHandler += keyReleasedHandler;

			TextColor = GeeUI.TextColorDefault;

			ContentMustBeScissored.Value = true;

			//Text = new Property<string>();
			//Text.Get = () => MultiLine ? Text.Value : Text.Value.Replace("\n", "");
		}
Esempio n. 30
0
 public TabContainer(GeeUIMain GeeUI, View rootView)
     : base(GeeUI, rootView)
 {
     Position.Value = Vector2.Zero;
 }
Esempio n. 31
0
 public EmptyView(GeeUIMain GeeUI, View rootView)
     : base(GeeUI, rootView)
 {
 }
Esempio n. 32
0
		public DropDownView(GeeUIMain theGeeUI, View parentView, Vector2 position)
			: base(theGeeUI, parentView)
		{
			this.numChildrenAllowed = 1;
			ParentGeeUI.OnKeyPressedHandler += this.keyPressedHandler;
			var button = new ButtonView(theGeeUI, this, "", Vector2.Zero);
			button.Add(new Binding<int>(this.Width, button.Width));
			button.Add(new Binding<int>(this.Height, button.Height));
			button.OnMouseClick += delegate(object sender, EventArgs e)
			{
				ToggleDropDown();
				button.TemporarilyIgnoreMouseClickAway = true;
				this.FilterView.TemporarilyIgnoreMouseClickAway = true;
			};

			button.OnMouseClickAway += delegate(object sender, EventArgs args)
			{
				HideDropDown();
			};

			button.OnMouseRightClick += (sender, args) =>
			{
				if (AllowRightClickExecute)
					ExecuteLast();
			};

			button.Name = "button";

			this.DropDownPanelView = new PanelView(theGeeUI, theGeeUI.RootView, Vector2.Zero);
			DropDownPanelView.ChildrenLayouts.Add(new VerticalViewLayout(2, false));
			this.DropDownPanelView.SelectedNinepatch = this.DropDownPanelView.UnselectedNinepatch = GeeUIMain.NinePatchDropDown;

			FilterView = new TextFieldView(theGeeUI, DropDownPanelView, Vector2.Zero);

			// HACK
			FilterView.Height.Value = (int)(20 * theGeeUI.Main.FontMultiplier);

			FilterView.MultiLine = false;
			FilterView.AllowTab = false;
			FilterView.Add(new Binding<int>(FilterView.Width, x => x - 8, DropDownPanelView.Width));
			FilterView.OnTextChanged = () =>
			{
				if (FilterView.Active && DropDownPanelView.Active && AllowFilterText)
				{
					Refilter();
				}
			};

			DropDownListView = new ListView(theGeeUI, DropDownPanelView);
			DropDownListView.ChildrenLayouts.Add(new VerticalViewLayout(1, false));
			DropDownListView.ScrollMultiplier = 20;
			DropDownListView.Add(new Binding<int, Rectangle>(DropDownListView.Width, x => Math.Max(200, x.Width), DropDownListView.ChildrenBoundBox));
			DropDownListView.Add(new Binding<int, Rectangle>(DropDownListView.Height, x => x.Height, DropDownListView.ChildrenBoundBox));

			DropDownPanelView.Add(new Binding<int>(DropDownPanelView.Width, DropDownListView.Width));

			DropDownListView.Name = "DropList";
			DropDownPanelView.Add(new Binding<int>(DropDownPanelView.Height, (i1) => i1 + 2 + ((AllowFilterText && FilterView.Active) ? FilterView.BoundBox.Height : 0), DropDownListView.Height));

			DropDownPanelView.Active.Value = false;

			this.Add(new SetBinding<string>(this.Label, delegate(string value)
			{
				((ButtonView)FindFirstChildByName("button")).Text = value;
			}));
		}
Esempio n. 33
0
		public EmptyView(GeeUIMain GeeUI, View rootView)
			: base(GeeUI, rootView)
		{
		}
Esempio n. 34
0
		public View(GeeUIMain geeUi, View parent)
			: this(geeUi)
		{
			if (parent != null)
				parent.Children.Add(this);
		}
Esempio n. 35
0
		internal View(GeeUIMain theGeeUI)
		{
			ParentGeeUI = theGeeUI;

			this.Add(new SetBinding<bool>(this.Attached, delegate(bool value)
			{
				for (int i = 0; i < this.Children.Count; i++)
					this.Children[i].Attached.Value = value;
			}));

			this.Add(new SetBinding<View>(this.ParentView, delegate(View v)
			{
				if (v == null)
				{
					this.Attached.Value = false;
					this.ParentGeeUI.PotentiallyDetached(this);
				}
				else
					this.Attached.Value = v.Attached;
			}));

			this.Add(new NotifyBinding(delegate()
			{
				View parent = this.ParentView;
				if (parent != null)
					parent.dirty = true;
			}, this.Position, this.Active, this.Width, this.Height));

			this.Children.ItemAdded += delegate(int index, View child)
			{
				if (this.numChildrenAllowed != -1 && this.Children.Length > this.numChildrenAllowed)
					throw new Exception("GeeUI view exceeded max number of allowed children");

				child.RemoveFromParent();
				child.ParentView.Value = this;
				child.ParentGeeUI = ParentGeeUI;
				this.dirty = true;
			};

			this.Children.ItemRemoved += delegate(int index, View child)
			{
				child.ParentView.Value = null;
				this.dirty = true;
			};

			this.Children.Clearing += delegate()
			{
				for (int i = 0; i < this.Children.Count; i++)
					this.Children[i].ParentView.Value = null;
				this.dirty = true;
			};

			this.Children.ItemChanged += delegate(int index, View old, View newValue)
			{
				old.ParentView.Value = null;
				newValue.ParentView.Value = this;
				this.dirty = true;
			};
		}
Esempio n. 36
0
		public TabContainer(GeeUIMain GeeUI, View rootView)
			: base(GeeUI, rootView)
		{
			Position.Value = Vector2.Zero;
		}
Esempio n. 37
0
        internal View(GeeUIMain theGeeUI)
        {
            ParentGeeUI = theGeeUI;

            this.Add(new SetBinding <bool>(this.Attached, delegate(bool value)
            {
                for (int i = 0; i < this.Children.Count; i++)
                {
                    this.Children[i].Attached.Value = value;
                }
            }));

            this.Add(new SetBinding <View>(this.ParentView, delegate(View v)
            {
                if (v == null)
                {
                    this.Attached.Value = false;
                    this.ParentGeeUI.PotentiallyDetached(this);
                }
                else
                {
                    this.Attached.Value = v.Attached;
                }
            }));

            this.Add(new NotifyBinding(delegate()
            {
                View parent = this.ParentView;
                if (parent != null)
                {
                    parent.dirty = true;
                }
            }, this.Position, this.Active, this.Width, this.Height));

            this.Children.ItemAdded += delegate(int index, View child)
            {
                if (this.numChildrenAllowed != -1 && this.Children.Length > this.numChildrenAllowed)
                {
                    throw new Exception("GeeUI view exceeded max number of allowed children");
                }

                child.RemoveFromParent();
                child.ParentView.Value = this;
                child.ParentGeeUI      = ParentGeeUI;
                this.dirty             = true;
            };

            this.Children.ItemRemoved += delegate(int index, View child)
            {
                child.ParentView.Value = null;
                this.dirty             = true;
            };

            this.Children.Clearing += delegate()
            {
                for (int i = 0; i < this.Children.Count; i++)
                {
                    this.Children[i].ParentView.Value = null;
                }
                this.dirty = true;
            };

            this.Children.ItemChanged += delegate(int index, View old, View newValue)
            {
                old.ParentView.Value      = null;
                newValue.ParentView.Value = this;
                this.dirty = true;
            };
        }