Beispiel #1
0
        private void dropDown_DorpDownEvent(object sender, bool isDown)
        {
            DropDownBox box = sender as DropDownBox;
            int         row = Grid.GetRow(box);

            _panelParent.RowDefinitions[row].Height = new GridLength(box.Height);
        }
Beispiel #2
0
        private void PropertyBoxUpdated(object sender, DataTransferEventArgs e)
        {
            DropDownBox src = e.Source as DropDownBox;

            if (src == null)
            {
                return;
            }
            FilterTree tree = src.DataContext as FilterTree;

            if (tree == null)
            {
                return;
            }
            string oldProperty = src.SelectedValue as string;

            if (oldProperty == null)
            {
                return;
            }
            string newProperty = tree.GetChild(0).GetChild(0).Text;

            if (oldProperty != newProperty && newProperty != null)
            {
                UpdateExpression(tree, oldProperty, newProperty);
            }
        }
Beispiel #3
0
        private void table_PreviewDrop(object sender, string text, string tableName)
        {
            DropDownBox tb = sender as DropDownBox;

            tb.SelectText = "";
            string       param = "";
            PropertyInfo prop  = tb.Tag as PropertyInfo;

            //NodeBase node = null;
            if (tableName != "" && _View.DragItem.TableName == tableName)
            {
                string id = text;
                prop.SetValue(_selectedObject, Convert.ChangeType(id, prop.PropertyType));
            }
            else if (text.LastIndexOf(".") != -1)
            {
                string extention = System.IO.Path.GetExtension(text);
                param = text.Replace(extention, "");
            }
            else
            {
                param = text;
            }

            //if (tableName == StoryImageJson.TAB_NAME)
            //{
            //    node = TableManager.CreateNode(tableName, param) as StoryImage;
            //    ((StoryImage)node).Path = param;
            //}
            //prop.SetValue(_selectedObject, Convert.ChangeType(node.ID, prop.PropertyType));
            //tb.ReplaceNewTextBox(node.ID.ToString());

            (sender as DropDownBox).Background = Brushes.White;
        }
Beispiel #4
0
        public AddViewDialog(AspMvcProject project)
        {
            this.project = project;
            this.Build();

            dataClassCombo = new DropDownBox();

            int w, h;

            Gtk.Icon.SizeLookup(Gtk.IconSize.Menu, out w, out h);
            dataClassCombo.DefaultIconHeight = Math.Max(h, 16);
            dataClassCombo.DefaultIconWidth  = Math.Max(w, 16);
            dataClassAlignment.Add(dataClassCombo);
            dataClassAlignment.QueueResize();
            dataClassCombo.ShowAll();

            provider = project.LanguageBinding.GetCodeDomProvider();

            ContentPlaceHolders = new List <string> ();
            string siteMaster = project.VirtualToLocalPath("~/Views/Shared/Site.master", null);

            if (project.Files.GetFile(siteMaster) != null)
            {
                masterEntry.Text = "~/Views/Shared/Site.master";
            }

            loadedTemplateList = project.GetCodeTemplates("AddView");
            bool foundEmptyTemplate = false;
            int  templateIndex      = 0;

            foreach (string file in loadedTemplateList)
            {
                string name = PP.GetFileNameWithoutExtension(file);
                templateCombo.AppendText(name);
                if (!foundEmptyTemplate)
                {
                    if (name == "Empty")
                    {
                        templateCombo.Active = templateIndex;
                        foundEmptyTemplate   = true;
                    }
                    else
                    {
                        templateIndex++;
                    }
                }
            }

            if (!foundEmptyTemplate)
            {
                throw new Exception("The Empty.tt template is missing.");
            }

            primaryPlaceholderCombo.Model = primaryPlaceholderStore;

            UpdateTypePanelSensitivity(null, null);
            UpdateMasterPanelSensitivity(null, null);
            Validate();
        }
Beispiel #5
0
        private void dropDown_DropDownSelected(object sender, string selectText)
        {
            DropDownBox ddb = sender as DropDownBox;
            string      num = selectText;

            (ddb.Tag as PropertyInfo).SetValue(_selectedObject, Convert.ToInt32(num));
            int row = Grid.GetRow(ddb);

            _panelParent.RowDefinitions[row].Height = new GridLength(ddb.Height);
        }
Beispiel #6
0
        private void dropDown_PreviewKeyUp(object sender, KeyEventArgs e)
        {
            DropDownBox ddb = sender as DropDownBox;

            if (e.Key == Key.Enter)
            {
                string num = ddb.SelectText;
                (ddb.Tag as PropertyInfo).SetValue(_selectedObject, Convert.ToInt32(num));
            }
        }
Beispiel #7
0
        public void updateDiffs()
        {
            List <string> temp = new List <string>();

            foreach (KeyValuePair <int, Chart> c in currentSong.Charts)
            {
                temp.Add(c.Value.Name);
            }
            diffs = new DropDownBox(game, temp, new Rectangle(100, 150, 150, 35));
            updateScoreLabels(0);
            diffs.selected += new Action <int>(diffs_selected);
        }
Beispiel #8
0
        // HACK ALERT: We exploit the point when value in datacontext have been changed but UI did not update yet
        private void StringOperatorUpdated(object sender, DataTransferEventArgs e)
        {
            DropDownBox src = e.Source as DropDownBox;

            if (src == null)
            {
                return;
            }
            FilterTree tree = src.DataContext as FilterTree;

            if (tree == null)
            {
                return;
            }
            int newType = tree.Children[0].Type;
            int oldType = StringExprTypePicker.ConvertBack(src.SelectedIndex);

            if (newType != StringPatternLexer.COMPLEX && oldType == StringPatternLexer.COMPLEX)
            {
                StringTree constTree = tree.Children[0].GetChild(1) as StringTree;
                if (constTree != null)
                {
                    constTree.Text = Filter.Escape(constTree.Text);
                    MarkNodeAsUpdated(constTree);
                }
            }
            else if (newType == StringPatternLexer.COMPLEX && oldType != StringPatternLexer.COMPLEX)
            {
                StringTree constTree = tree.Children[0].GetChild(1) as StringTree;
                if (constTree != null)
                {
                    switch (oldType)
                    {
                    case StringPatternLexer.IS:
                        constTree.Text = "%" + constTree.Text + "%";
                        break;

                    case StringPatternLexer.BEGINS:
                        constTree.Text = constTree.Text + "%";
                        break;

                    case StringPatternLexer.ENDS:
                        constTree.Text = "%" + constTree.Text;
                        break;
                    }
                }
                MarkNodeAsUpdated(constTree);
            }
            MarkNodeAsUpdated((FilterTree)tree.Children[0]);
        }
Beispiel #9
0
		protected override void CreateComponents ()
		{
			this.editors = new [] { new TextEditor (), new TextEditor ()};
			DiffEditor.Document.ReadOnly = true;
			
			originalComboBox = new DropDownBox ();
			originalComboBox.WindowRequestFunc = CreateComboBoxSelector;
			originalComboBox.Text = "Local";
			originalComboBox.Tag = editors[1];
			
			diffComboBox = new DropDownBox ();
			diffComboBox.WindowRequestFunc = CreateComboBoxSelector;
			diffComboBox.Text = "Base";
			diffComboBox.Tag = editors[0];
			
			this.headerWidgets = new [] { diffComboBox, originalComboBox };
		}
Beispiel #10
0
        private DropDownBox createDropDownBox(int row)
        {
            DropDownBox box = new DropDownBox();

            box.Margin          = new Thickness(0, 2, 2, 0);
            box.BorderThickness = new Thickness(0);
            Grid.SetColumn(box, 0);
            Grid.SetColumnSpan(box, 2);
            Grid.SetRow(box, _panelParent.RowDefinitions.Count - 1);
            var template = (ControlTemplate)_View.Resources["validationErrorTemplate"];

            Validation.SetErrorTemplate(box, template);
            Panel.SetZIndex(box, 20);
            _panelParent.Children.Add(box);

            return(box);
        }
Beispiel #11
0
		protected override void CreateComponents ()
		{
			this.editors = new [] {
				new MonoTextEditor (new TextDocument (), CommonTextEditorOptions.Instance),
				new MonoTextEditor (new TextDocument (), CommonTextEditorOptions.Instance),
			};

			if (!viewOnly) {
				originalComboBox = new DropDownBox ();
				originalComboBox.WindowRequestFunc = CreateComboBoxSelector;
				originalComboBox.Text = "Local";
				originalComboBox.Tag = editors[1];
			
				diffComboBox = new DropDownBox ();
				diffComboBox.WindowRequestFunc = CreateComboBoxSelector;
				diffComboBox.Text = "Base";
				diffComboBox.Tag = editors[0];
			
				this.headerWidgets = new [] { diffComboBox, originalComboBox };
			}
		}
		protected override void CreateComponents ()
		{
			this.editors = new [] {
				new MonoTextEditor (new TextDocument (), CommonTextEditorOptions.Instance),
				new MonoTextEditor (new TextDocument (), CommonTextEditorOptions.Instance),
			};

			if (!viewOnly) {
				originalComboBox = new DropDownBox ();
				originalComboBox.WindowRequestFunc = CreateComboBoxSelector;
				originalComboBox.Text = GettextCatalog.GetString ("Loading…");
				originalComboBox.Sensitive = false;
				originalComboBox.Tag = editors[1];
			
				diffComboBox = new DropDownBox ();
				diffComboBox.WindowRequestFunc = CreateComboBoxSelector;
				diffComboBox.Text = GettextCatalog.GetString ("Loading…");
				diffComboBox.Sensitive = false;
				diffComboBox.Tag = editors[0];
			
				this.headerWidgets = new [] { diffComboBox, originalComboBox };
			}
		}
        /// <summary>
        /// Physically displays the completion list on the screen.
        /// </summary>
        /// <param name="hostBlock"></param>
        /// <returns>true if successfully shown, false otherwise.</returns>
        public bool ShowCompletionList(Block hostBlock)
        {
            if (this.Visible)
            {
                return(true);
            }
            Param.CheckNotNull(hostBlock, "hostBlock");
            this.HostBlock = hostBlock;

            bool shouldCancel = RaiseBeforeShowingCompletionList(hostBlock);

            if (shouldCancel)
            {
                return(false);
            }

            DropDownBox.CurrentList = this;

            DropDownBox.StartAddingItems();
            FillItems(DropDownBox);
            DropDownBox.FinishAddingItems();

            if (DropDownBox.Count == 0)
            {
                return(false);
            }

            HostBlock.MyControl.DisplayCompletionList();

//			string e = Timer.ElapsedSince(l);
//			if (this.HostBlock.Root != null)
//			{
//				this.HostBlock.Root.ShowStatus(e);
//			}
            return(true);
        }
Beispiel #14
0
		Gtk.Window CreateComboBoxSelector (DropDownBox box)
		{
			DropDownBoxListWindow window = new DropDownBoxListWindow (new ComboBoxSelector (this, box));
			return window;
		}
Beispiel #15
0
			public ComboBoxSelector (ComparisonWidget widget, DropDownBox box)
			{
				this.widget = widget;
				this.box = box;
				
			}
Beispiel #16
0
		public ComparisonWidget (VersionControlDocumentInfo info)
		{
			this.info = info;
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			leftVAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			Connect (leftVAdjustment, vAdjustment);
			
			rightVAdjustment =  new Adjustment (0, 0, 0, 0, 0, 0);
			Connect (rightVAdjustment, vAdjustment);
			
			vScrollBar = new VScrollbar (vAdjustment);
			AddChild (vScrollBar);
			vScrollBar.Hide ();
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			leftHAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			Connect (leftHAdjustment, hAdjustment);
			
			rightHAdjustment =  new Adjustment (0, 0, 0, 0, 0, 0);
			Connect (rightHAdjustment, hAdjustment);
			
			leftHScrollBar = new HScrollbar (hAdjustment);
			AddChild (leftHScrollBar);
			
			rightHScrollBar = new HScrollbar (hAdjustment);
			AddChild (rightHScrollBar);
			
			originalEditor = new TextEditor ();
			originalEditor.Caret.PositionChanged += CaretPositionChanged;
			originalEditor.FocusInEvent += EditorFocusIn;
			AddChild (originalEditor);
			originalEditor.SetScrollAdjustments (leftHAdjustment, leftVAdjustment);
			
			originalComboBox = new DropDownBox ();
			originalComboBox.WindowRequestFunc = CreateComboBoxSelector;
			originalComboBox.Text = "Local";
			originalComboBox.Tag = originalEditor;
			AddChild (originalComboBox);
			
			diffEditor = new TextEditor ();
			diffEditor.Caret.PositionChanged += CaretPositionChanged;
			diffEditor.FocusInEvent += EditorFocusIn;
			
			AddChild (diffEditor);
			diffEditor.Document.ReadOnly = true;
			diffEditor.SetScrollAdjustments (leftHAdjustment, leftVAdjustment);
			this.vAdjustment.ValueChanged += delegate {
				middleArea.QueueDraw ();
			};
			
			diffComboBox = new DropDownBox ();
			diffComboBox.WindowRequestFunc = CreateComboBoxSelector;
			diffComboBox.Text = "Base";
			diffComboBox.Tag = diffEditor;
			AddChild (diffComboBox);
			
			
			overview = new OverviewRenderer (this);
			AddChild (overview);
			
			middleArea = new MiddleArea (this);
			AddChild (middleArea);
			
			prev = new Button ();
			prev.Add (new Arrow (ArrowType.Up, ShadowType.None));
			AddChild (prev);
			prev.ShowAll ();
			prev.Clicked += delegate {
				if (this.Diff == null)
					return;
				originalEditor.GrabFocus ();
				
				int line = originalEditor.Caret.Line;
				int max  = -1, searched = -1;
				foreach (Diff.Hunk hunk in this.Diff) {
					if (hunk.Same)
						continue;
					max = System.Math.Max (hunk.Right.Start, max);
					if (hunk.Right.Start < line)
						searched = System.Math.Max (hunk.Right.Start, searched);
				}
				if (max >= 0) {
					originalEditor.Caret.Line = searched < 0 ? max : searched;
					originalEditor.CenterToCaret ();
				}
			};
			
			next = new Button ();
			next.BorderWidth = 0;
			next.Add (new Arrow (ArrowType.Down, ShadowType.None));
			next.Clicked += delegate {
				if (this.Diff == null)
					return;
				originalEditor.GrabFocus ();
				
				int line = originalEditor.Caret.Line;
				int min  = Int32.MaxValue, searched = Int32.MaxValue;
				foreach (Diff.Hunk hunk in this.Diff) {
					if (hunk.Same)
						continue;
					min = System.Math.Min (hunk.Right.Start, min);
					if (hunk.Right.Start > line)
						searched = System.Math.Min (hunk.Right.Start, searched);
				}
				if (min < Int32.MaxValue) {
					originalEditor.Caret.Line = searched == Int32.MaxValue ? min : searched;
					originalEditor.CenterToCaret ();
				}
			};
			AddChild (next);
			next.ShowAll ();
			
			this.DoubleBuffered = true;
			originalEditor.ExposeEvent += HandleLeftEditorExposeEvent;
			diffEditor.ExposeEvent += HandleRightEditorExposeEvent;
			info.Document.Editor.Document.TextReplaced += HandleInfoDocumentTextEditorDataDocumentTextReplaced;
		}
        private void SetupUserInterface()
        {
            var mainMenuSpriteMap = _spriteMapLoader.GetContent("assets/UI/title_menu_buttons.json");
            var interfaceFont     = _contentChest.Get <SpriteFont>("Fonts/InterfaceFont");
            var inputBoxFont      = _contentChest.Get <SpriteFont>("Fonts/InputBoxFont");

            var portraitTexture = _contentChest.Get <Texture2D>("portrait_background");
            var portraitImage   = new Sprite(portraitTexture);

            var nineSlice = new NineSlice(_menuButtons, new Dictionary <Segment, Rectangle>
            {
                { Segment.TopLeft, new Rectangle(1, 189, 8, 9) },
                { Segment.Top, new Rectangle(10, 189, 1, 9) },
                { Segment.TopRight, new Rectangle(12, 189, 8, 9) },
                { Segment.Right, new Rectangle(12, 199, 8, 1) },
                { Segment.BottomRight, new Rectangle(12, 201, 8, 8) },
                { Segment.Bottom, new Rectangle(10, 201, 1, 8) },
                { Segment.BottomLeft, new Rectangle(1, 201, 8, 8) },
                { Segment.Left, new Rectangle(1, 199, 8, 1) },
                { Segment.Center, new Rectangle(10, 199, 1, 1) }
            });

            var panelWidth = (int)(30 + 200 + 30 + portraitImage.Texture.Width * _buttonScale + 30);

            _panel = new Panel(nineSlice,
                               new Rectangle(
                                   (int)(_viewPortPortManager.ViewPort.Center().X - panelWidth / 2f),
                                   (int)(_viewPortPortManager.ViewPort.Center().Y - (500 + 30 + 22 * _buttonScale) / 2f), panelWidth,
                                   500), _buttonScale);

            // Back Button
            BackButton = new TexturedButton(
                mainMenuSpriteMap.CreateSpriteFromRegion("Back_Off"),
                mainMenuSpriteMap.CreateSpriteFromRegion("Back_On"),
                new Vector2(_panel.BottomLeft().X,
                            _panel.BottomLeft().Y + 10), _buttonScale);

            // Done Button
            var doneOffSprite = mainMenuSpriteMap.CreateSpriteFromRegion("Done_Off");

            DoneButton = new TexturedButton(doneOffSprite,
                                            mainMenuSpriteMap.CreateSpriteFromRegion("Done_On"),
                                            new Vector2(_panel.BottomRight().X - doneOffSprite.Source.Width * _buttonScale,
                                                        _panel.BottomLeft().Y + 10), _buttonScale);

            // Name
            var nameSectionPosition = new Vector2(_panel.Left() + 30,
                                                  _panel.Top() + 30);
            var nameTextBoxTitle = new TextBlock("Name", nameSectionPosition, interfaceFont, Color.White, Color.Black);

            NameTextBox = new TextBox(_contentChest, _keyboardDispatcher,
                                      nameSectionPosition + new Vector2(0, interfaceFont.MeasureString("Name").Y + 10),
                                      inputBoxFont, 200)
            {
                Value = _playerMaker.Name
            };
            NameTextBox.Changed += OnPlayerNameSet;

            // Pronouns
            var pronounSectionPosition = new Vector2(_panel.Left() + 30, NameTextBox.Bounds.Bottom + 10);
            var pronounTextBoxTitle    =
                new TextBlock("Pronouns", pronounSectionPosition, interfaceFont, Color.White, Color.Black);

            PronounDropDown = new DropDownBox(_contentChest, inputBoxFont,
                                              pronounSectionPosition + new Vector2(0, interfaceFont.MeasureString("Pronouns").Y + 10),
                                              _optionsManager.PronounOptions.Pronouns.Select(x =>
                                                                                             $"{x.Subjective}/{x.Objective}").ToArray(), 200);
            PronounDropDown.Hover        += OnPronounSelect;
            PronounDropDown.SelectedIndex = _playerMaker.Pronouns;

            var characterPanel = new Image(portraitImage,
                                           new Vector2(
                                               PronounDropDown.Bounds.Right + 30 +
                                               (_panel.Right() - 30 - (PronounDropDown.Bounds.Right + 30)) / 2f -
                                               portraitImage.Center.X * _buttonScale,
                                               nameTextBoxTitle.Top()), _buttonScale);

            // Character Preview
            var characterPreview = new CharacterPreview(_characterRenderer, characterPanel.Center());

            // Hair
            var hairText = new TextBlock("Hair Style",
                                         new Vector2(PronounDropDown.Left(), PronounDropDown.BottomLeft().Y + 10), interfaceFont, Color.White,
                                         Color.Black);

            PlayerHairDropDown = new DropDownBox(_contentChest, inputBoxFont,
                                                 new Vector2(hairText.Left(), hairText.BottomLeft().Y + 10),
                                                 _hair.Select(x => x.Name).ToArray(), 200);
            PlayerHairDropDown.Hover        += (newIndex) => { characterPreview.Hair = _hair[newIndex]; };
            PlayerHairDropDown.SelectedIndex = _playerMaker.Hair;

            // Head
            var headText = new TextBlock("Head Shape",
                                         PlayerHairDropDown.BottomLeft().Add(0, 10), interfaceFont, Color.White,
                                         Color.Black);
            var horizontalSelector = new HorizontalSelector(headText.BottomLeft().Add(0, 10),
                                                            _heads.Select(x => x.Name).ToArray(), 200,
                                                            mainMenuSpriteMap.CreateSpriteFromRegion("Arrow_Left"),
                                                            mainMenuSpriteMap.CreateSpriteFromRegion("Arrow_Right"),
                                                            interfaceFont, _buttonScale);

            horizontalSelector.SelectionChanged += (newIndex) => { characterPreview.Head = _heads[newIndex]; };
            horizontalSelector.SelectedIndex     = _playerMaker.Head;

            _panel.AddChild(pronounTextBoxTitle);
            _panel.AddChild(nameTextBoxTitle);
            _panel.AddChild(NameTextBox);
            _panel.AddChild(characterPanel);
            _panel.AddChild(BackButton);
            _panel.AddChild(DoneButton);
            _panel.AddChild(hairText);
            _panel.AddChild(headText);
            _panel.AddChild(horizontalSelector);
            _panel.AddChild(characterPreview);

            _panel.AddChild(PlayerHairDropDown);
            _panel.AddChild(PronounDropDown);

            _userInterface.AddWidget(_panel);

            DoneButton.OnClick += () =>
            {
                Console.WriteLine("Saving Settings");
                _playerMaker.SetHair(PlayerHairDropDown.SelectedIndex);
                _playerMaker.SetName(NameTextBox.GetValue());
                _playerMaker.SetPronouns(PronounDropDown.SelectedIndex);
            };
        }
Beispiel #18
0
        public override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            panel.Colour              = new OpenTK.Graphics.Color4(0.3f, 0.3f, 0.3f, 0.0f);
            dim.Colour                = new OpenTK.Graphics.Color4(0.0f, 0.0f, 0.0f, 0.0f);
            fsw.EnableRaisingEvents   = true;
            fsw.IncludeSubdirectories = true;
            fsw.Created              += new FileSystemEventHandler(fsw_Created);
            fsw.Changed              += new FileSystemEventHandler(fsw_Created);
            fsw.Deleted              += new FileSystemEventHandler(fsw_Deleted);
            fsw.Error += new ErrorEventHandler(fsw_Error);
            fsw.InternalBufferSize = 61440; //lets handle large changes ;D
            SongLibrary.cacheSongInfo();
            game.KeyPress   += new EventHandler <OpenTK.KeyPressEventArgs>(game_KeyPress);
            bgoverlay.Colour = new OpenTK.Graphics.Color4(0.0f, 0.0f, 0.0f, 0.5f);
            searchLabel      = new Label(game, new Point(0, 700), "");
            searchLabel.TextTexture.Shadow = true;
            searchInfoL = new Label(game, new Point(0, 700), "type to begin search..");
            //searchInfoL.TextTexture.Shadow = true;
            searchInfoL.TextTexture.Colour = Color.White;

            onlineToggle = new ToggleButton(game, new Rectangle(Utils.getMX(780), 130, 50, 40), "O", delegate(int data)
            {
                Config.LocalScores = !Config.LocalScores;
                updateScoreLabels(0);
            });

            prevPage = new Button(game, new Rectangle(Utils.getMX(835), 130, 50, 40), "<<", delegate(int data)
            {
                if (displayScores != null && scoreDisplayPage > 0)
                {
                    scoreDisplayPage--;
                    updateScoreLabels(scoreDisplayPage);
                }
            });
            nextPage = new Button(game, new Rectangle(Utils.getMX(890), 130, 50, 40), ">>", delegate(int data)
            {
                if (displayScores != null && displayScores.Count > 0) //if count was 0 maxpage would be -1
                {
                    int maxpage = displayScores.Count / 8;
                    if (displayScores.Count % 8 > 0) //if there's a remainder that means theres some extra scores to display so need new page
                    {
                        maxpage++;
                    }
                    maxpage--; //remember, scoredisplaypage is 0 based!
                    if (scoreDisplayPage < maxpage)
                    {
                        scoreDisplayPage++;
                        updateScoreLabels(scoreDisplayPage);

                        /*if (scoreDisplayPage == maxpage) //finish later, faulty to have in a place like this
                         * {
                         *  nextPage.Visible = false;
                         *  nextPage.Enabled = false;
                         * }*/
                    }
                }
            });
            if (!Config.LocalScores)
            {
                ((ToggleButton)onlineToggle).toggle();
            }
            UIComponents.Add(prevPage);
            UIComponents.Add(nextPage);
            UIComponents.Add(onlineToggle);
            calibrateButton = new Button(game, new Rectangle(70, 768 - 170, 200, 50), "Calibrate offset", delegate(int data)
            {
                int tIndex = 0;
                for (int x = 0; x < currentSong.Charts.Count; x++)
                {
                    if (currentSong.Charts[x].Name.Equals(diffs.BaseText.Line))
                    {
                        tIndex = x;
                    }
                }
                IngameScreen temp = (IngameScreen)game.screens["ingameScreen"];
                try
                {
                    uint flags = 0;
                    flags      = flags | (uint)(nfB.Selected ? 1 : 0);
                    flags      = flags | (uint)(autoB.Selected ? 2 : 0);
                    flags      = flags | (uint)(mirB.Selected ? 4 : 0);
                    flags      = flags | (uint)(hdB.Selected ? 8 : 0);
                    temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex, new Mods()
                    {
                        Speed  = dtB.Selected ? 1.5 : 1.0,
                        Flags  = flags,
                        Scroll = Config.PlaySpeed
                    }, null, IngameScreen.PlayType.PLAY);
                    Music.stop();
                    Game.setScreen(game.screens["ingameScreen"]);
                    temp.Calibrate = true;
                    game.Title     = "Pulse | " + currentSong.Artist + " - " + currentSong.SongName + " [" + currentSong.Charts[tIndex].Name + "]";
                }
                catch (Exception ex)
                {
                    ErrorLog.log(ex);
                }
            });
            calibrateButton.Visible = false;
            calibrateButton.Enabled = false;
            //   int backpos = Config.ResWidth - 244;//Config.WideScreen? (int)((780d/1024d) * game.Width) : 780;
            backLabel = new Button(game, new Rectangle(Utils.getMX(780), 10, 220, 50), "Back", delegate(int data)
            {
                Game.setScreen(game.screens["menuScreen"]);
            });
            help = new Button(game, new Rectangle(Utils.getMX(780), 130, 220, 50), "Help", delegate(int data)
            {
                new EditorHelp().ShowDialog();
                Game.resetStates();
            });
            UIComponents.Add(help);

            newSongb = new Button(game, new Rectangle(Utils.getMX(780), 70, 220, 50), "New Song", delegate(int data)
            {
                new NewSong().ShowDialog();
                Game.resetStates();
            });
            //   UIComponents.Add(searchLabel);
            UIComponents.Add(backLabel);
            UIComponents.Add(newSongb);
            #region obsolete

            /*difficultyTexts[0] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0));
             * difficultyTexts[0].Update("3key");
             * difficultyTexts[0].Shadow = true;
             * difficultyTexts[1] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0));
             * difficultyTexts[1].Update("4key");
             * difficultyTexts[1].Shadow = true;
             * difficultyTexts[2] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0));
             * difficultyTexts[2].Update("6key");
             * difficultyTexts[2].Shadow = true;
             * difficultyTexts[3] = new Text(Config.ClientSize, new Size(300, 33), new Point(0, 0));
             * difficultyTexts[3].Update("7key");
             * difficultyTexts[3].Shadow = true;*/
            #endregion
            refresh();
            index = 0;
            for (int x = 0; x < songNameList.Count; x++)
            {
                if (songNameList[x].Info.SongName.Equals(Game.M.CurrentSong.SongName) && songNameList[x].Info.Dir.Equals(Game.M.CurrentSong.Dir))
                {
                    index = x;
                }
            }
            changeSong();
            selectionTexture        = new Rect(new Rectangle(2, 250, 548, 28));
            sel2                    = new Rect(new Rectangle(0, 249, 552, 30));
            searchBox               = new Rect(new Rectangle(0, 700, Config.ResWidth, 30));
            searchBox.Colour        = new OpenTK.Graphics.Color4(0.27f, 0.509f, 0.705f, .8f);
            cover                   = new Rect(new Rectangle(Config.ResWidth - 300, 0, 300, 768));
            cover.Colour            = new OpenTK.Graphics.Color4(1f, 1f, 1f, .7f);
            scorebg                 = new Rect(new Rectangle((int)(Config.ResWidth - 324), 180, 295, 600), Skin.skindict["scoreback"]);
            sel2.Colour             = new OpenTK.Graphics.Color4(0.0f, 0.0f, 0.0f, 1.0f);
            selectionTexture.Colour = new OpenTK.Graphics.Color4(0.25f, 0.0f, 1.0f, 1.0f);
            background              = new Rect(new Rectangle(0, 0, Config.ResWidth, 768));

            currentSong = SongLibrary.loadSong(songNameList[index].Info);
            string bgString = "";
            if (currentSong.FileVersion == 0)
            {
                bgString = currentSong.BgName;
            }
            else
            {
                bgString = currentSong.Charts[0].BgName;
            }
            background.useTexture("songs\\" + currentSong.Dir + "\\" + bgString);

            music                 = AudioManager.loadFromFile("songs\\" + currentSong.Dir + "\\" + currentSong.FileName);
            Music.Volume          = 0.0f;
            targetVolume          = Config.Volume / 100.0f;
            changed               = true;
            Music.PositionAsMilli = (long)Game.M.Music.PositionAsMilli;
            Music.play(false, true);
            if (play)
            {
                game.Title       = "Pulse | Play Selection";
                newSongb.Enabled = false;
                newSongb.Visible = false;
                help.Enabled     = false;
                help.Visible     = false;
            }
            else
            {
                game.Title       = "Pulse | Edit Selection";
                newSongb.Enabled = true;
                newSongb.Visible = true;
            }
            updateDiffs();
            updateScoreLabels(0);
            //   changeSong();
            //   index = 0;
            for (int x = 0; x < songNameList.Count; x++)
            {
                // if (songNameList[x].textData.Location.Y != 246 + ((x - index) * 33) && !songNameList[x].textData.Moving)
                //  {
                songNameList[x].select.Bounds = new Rectangle(0, 246 + ((x - index) * 90), songNameList[x].select.Bounds.Width, songNameList[x].select.Bounds.Height);
                //  Console.WriteLine(songNameList[x].textData.Position.
                //
            }
            //Console.WriteLine("why");
            List <string> t = new List <String>();
            t.Add(" ");
            diffs           = new DropDownBox(game, t, new Rectangle(70, 120, 150, 35));
            diffs.selected += new Action <int>(diffs_selected);
            string tempS = "";
            if (play)
            {
                tempS = "Play";
            }
            else
            {
                tempS = "Edit";
            }
            playButton = new Button(game, new Rectangle(290 + 220, 768 - 170, 200, 50), tempS, delegate(int data)
            {
                if (pickDiff)
                {
                    int tIndex = 0;
                    for (int x = 0; x < currentSong.Charts.Count; x++)
                    {
                        if (currentSong.Charts[x].Name.Equals(diffs.BaseText.Line))
                        {
                            tIndex = x;
                        }
                    }

                    /*if (Config.AutoPlay && play)
                     * {
                     *  ReplayScreen temp = (ReplayScreen)game.screens["replayScreen"];
                     *  try
                     *  {
                     *      temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex);
                     *      Game.M.setSong(songNameList[index].Info);
                     *      Game.M.play();
                     *      Music.stop();
                     *      Game.setScreen(game.screens["replayScreen"]);
                     *      game.Title = "Pulse | Watch replay | " + currentSong.Artist + " - " + currentSong.SongName + " [" + currentSong.Charts[tIndex].Name + "]";
                     *  }
                     *  catch { }
                     * }
                     * else */if (play)
                    {
                        IngameScreen temp = (IngameScreen)game.screens["ingameScreen"];
                        try
                        {
                            IngameScreen.PlayType te = IngameScreen.PlayType.PLAY;
                            if (autoB.Selected)
                            {
                                te = IngameScreen.PlayType.AUTO;
                            }
                            uint flags = 0;
                            flags      = flags | (uint)(nfB.Selected ? 1 : 0);
                            flags      = flags | (uint)(autoB.Selected ? 2 : 0);
                            flags      = flags | (uint)(mirB.Selected ? 4 : 0);
                            flags      = flags | (uint)(hdB.Selected ? 8 : 0);
                            temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex, new Mods()
                            {
                                Speed  = dtB.Selected ? 1.5 : 1.0,
                                Flags  = flags,
                                Scroll = Config.PlaySpeed
                            }, null, te);
                            Game.M.setSong(ref songNameList[index].Info);
                            Game.M.play();
                            Music.stop();
                            temp.Calibrate = false;
                            Game.setScreen(game.screens["ingameScreen"]);
                            game.Title = "Pulse | " + currentSong.Artist + " - " + currentSong.SongName + " [" + currentSong.Charts[tIndex].Name + "]";
                            scoreDisplayText.Clear();
                            scoreDisplayPage = 1;
                        }
                        catch (Exception ex)
                        {
                            ErrorLog.log(ex);
                        }
                    }
                    else if (!play)
                    {
                        EditorScreen temp = (EditorScreen)game.screens["editScreen"];
                        try
                        {
                            temp.loadSong(SongLibrary.loadSong(songNameList[index].Info), tIndex);
                            Game.M.setSong(ref songNameList[index].Info);
                            Game.M.play();
                            Music.stop();
                            Game.setScreen(game.screens["editScreen"]);
                        }
                        catch (KeyNotFoundException)
                        {
                        }
                        game.Title = "Pulse|Editor|" + currentSong.Artist + "-" + currentSong.SongName + "[" + currentSong.Charts[tIndex].Name + "]";
                    }
                }
            });
            autoB = new ToggleButton(game, new Rectangle(874 - 480, 120, 100, 40), "Auto", delegate(int data)
            {
                Config.AutoPlay = autoB.Selected;
            });
            dtB = new ToggleButton(game, new Rectangle(874 - 370, 120, 100, 40), "DT", delegate(int data)
            {
                Config.Dt = dtB.Selected;
                if (Config.Dt)
                {
                    Config.Ht = false;
                    if (htB.Selected)
                    {
                        htB.toggle();
                    }
                }
            });
            htB = new ToggleButton(game, new Rectangle(874 - 260, 120, 100, 40), "HT", delegate(int data)
            {
                Config.Ht = htB.Selected;
                if (Config.Ht)
                {
                    Config.Dt = false;
                    if (dtB.Selected)
                    {
                        dtB.toggle();
                    }
                }
            });
            mirB = new ToggleButton(game, new Rectangle(874 - 480, 170, 100, 40), "Mirror", delegate(int data)
            {
                Config.Mirror = mirB.Selected;
            });
            hdB = new ToggleButton(game, new Rectangle(874 - 370, 170, 100, 40), "HD", delegate(int data)
            {
                Config.Hidden = hdB.Selected;
            });
            nfB = new ToggleButton(game, new Rectangle(874 - 260, 170, 100, 40), "No fail", delegate(int data)
            {
                Config.NoFail = nfB.Selected;
            });
            closeSel = new Button(game, new Rectangle(290, 768 - 170, 200, 50), "Close", delegate(int data)
            {
                notPickDiffs();
            });
            rateLabel = new Label(game, new Point(874 - 460, 370), "Scroll speed: " + Config.PlaySpeed);
            rateDrag  = new Dragbar(game, new Point(874 - 460, 400), 300, false, delegate(int d)
            {
                double temp      = rateDrag.getPercentScrolled();
                int x            = (int)(temp / 10);
                Config.PlaySpeed = ((float)x / 2) + 0.5f;
                rateLabel.Text   = "Scroll speed: " + Config.PlaySpeed;
            });
            rateDrag.setPos(rateDrag.Bounds.X + (int)(Config.PlaySpeed * 20) + rateDrag.Bounds.Width / 10);
            game.Mouse.Move += new EventHandler <MouseMoveEventArgs>(Mouse_Move);
        }
Beispiel #19
0
        public TestState()
            : base()
        {
            //*
            ScrollPanel scrollPanel = new ScrollPanel(10, 400, 400, 400, Panel.BarMode.Close_Drag, this);

            scrollPanel.SetScrollDimensions(1000, 1000);

            TextBox textBox = new TextBox(10, 10, 290, 310, this);

            scrollPanel.AddControl(textBox);

            Button button = new Button("Button", 420, 10, 80, 32, this);

            button.OnTrigger += ButtonPress;
            scrollPanel.AddControl(button);

            TextField textField = new TextField(420, 52, 100, 32, this);

            scrollPanel.AddControl(textField);

            NumberControl numberControl = new NumberControl(420, 94, this);

            numberControl.SetMinimum(10);
            numberControl.SetMaximum(20);
            scrollPanel.AddControl(numberControl);

            RadioButton radioButton = new RadioButton(520, 100, this);

            scrollPanel.AddControl(radioButton);

            string[] items = new string[]
            {
                "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10", "Item 11"
            };
            DropDownBox dropDownBox = new DropDownBox(420, 146, 120, items, this);

            scrollPanel.AddControl(dropDownBox);

            string[] menuOptions = new string[]
            {
                "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10"
            };
            DropDownMenu dropDownMenu = new DropDownMenu(560, 146, 120, "Test Menu", menuOptions, this);

            scrollPanel.AddControl(dropDownMenu);

            ListBox listBox = new ListBox(310, 10, 100, 200, 10, this);

            scrollPanel.AddControl(listBox);

            string[] radioItems = new string[]
            {
                "option 1", "option 2", "option 3"
            };
            RadioControl radioControl = new RadioControl(550, 10, radioItems, this);

            scrollPanel.AddControl(radioControl);

            Label label = new Label(550, 80, 100, 60, this);

            label.SetText("A label." + '\n' + "Line 2.");
            scrollPanel.AddControl(label);

            this.AddControl(scrollPanel);

            string message = "";

            for (int i = 0; i < 20; i++)
            {
                message += "this is a message box" + '\n';
            }
            MessageBox messageBox = new MessageBox(message, this);

            this.AddControl(messageBox);

            Entity entity = Entity.CreateInstance(this.EntityManager, Vector3.Zero);

            this.EntityManager.AddEntity(entity);

            Entity entity2 = Entity.CreateInstance(this.EntityManager, new Vector3(400, 600, 0));

            spriteComponent = new SpriteComponent(entity2);
            spriteComponent.SetXFrames(3);
            spriteComponent.Transform.Parent = entity.GetTransform();
            //spriteComponent.SetTexture(Assets.GetTexture("sprite.png"));
            //spriteComponent.SetSpriteCenter(SpriteComponent.SpriteCenter.Top);

            //*/

            Entity particleEntity            = Entity.CreateInstance(this.EntityManager, new Vector3(400, 400, 0));
            ParticleEmitterData particleData = new ParticleEmitterData();

            particleData.EmitterShape    = PaticleEmitterShape.Rectangle;
            particleData.ParticleTexture = "smoke.png";
            particleData.EmissionRate    = 1000;
            particleData.AngleMin        = 0;
            particleData.AngleMax        = 360;
            particleData.OffsetMin       = 10;
            particleData.OffsetMax       = 120;
            particleData.StartVelocity   = 10;
            particleData.EndVelocity     = 100;
            particleData.StartScale      = 3;
            particleData.EndScale        = 50;
            particleData.RotationSpeed   = 45f;
            particleData.StartColour     = Color4.White;
            particleData.EndColour       = Color4.Transparent;
            //particleData.EndColour.A = 0f;
            particleData.MaxLife = 5;

            new ParticleEmitterComponent(particleEntity, particleData);
            this.EntityManager.AddEntity(particleEntity);
        }