internal void RefreshDisplay() { pa.ClearSprites(false); const int height = 17; int currentHeight = 0; bool editor = false; for (int i = 1; i < BindingManager.BindingNames.Length; i++) { string na = BindingManager.BindingNames[i]; //Check for skip flag if (na.StartsWith(@"__")) { continue; } bool header = na[0] == '_'; if (header) { na = na.Substring(1); } pText naText = new pText(na, header ? 16 : 14, new Vector2(0, currentHeight), new Vector2(402, height), header ? 0.97f : 0.98f, true, Color.White, false); pa.ContentSpriteManager.Add(naText); naText.BackgroundColour = Color.Black; if (header) { naText.TextColour = Color.YellowGreen; naText.TextAlignment = TextAlignment.Centre; } else { naText.BorderWidth = 2; naText.BorderColour = Color.LightGray; naText.HandleInput = true; naText.OnHover += delegate { naText.BackgroundColour = Color.Gray; naText.TextColour = Color.Black; naText.TextChanged = true; }; naText.OnHoverLost += delegate { naText.BackgroundColour = Color.Black; naText.TextColour = Color.White; naText.TextChanged = true; }; string name = na; Bindings b = (Bindings)i; naText.OnClick += delegate { startBinding(b, name); }; naText.ClickRequiresConfirmation = true; naText.TextAlignment = TextAlignment.LeftFixed; pText naText2 = new pText(BindingManager.NiceName((Bindings)i), 12, new Vector2(300, currentHeight + 1), new Vector2(100, height - 2), 1, true, Color.Gold, false); naText2.BackgroundColour = new Color(0, 0, 0, 160); naText2.BorderWidth = 2; naText2.BorderColour = Color.LightGray; naText2.TextAlignment = TextAlignment.Centre; pa.ContentSpriteManager.Add(naText2); } currentHeight += height; } pText reset = new pText(LocalisationManager.GetString(OsuString.Options_ResetAllBindings), 14, new Vector2(0, currentHeight), new Vector2(402, height), 0.98f, true, Color.White, false); reset.BorderColour = Color.LightGray; reset.BackgroundColour = Color.Black; reset.TextColour = Color.White; reset.HandleInput = true; reset.OnHover += delegate { reset.BackgroundColour = Color.Red; reset.TextChanged = true; }; reset.OnHoverLost += delegate { reset.BackgroundColour = Color.Black; reset.TextChanged = true; }; reset.OnClick += delegate { //pDialogConfirmation d = new pDialogConfirmation(LocalisationManager.GetString(OsuString.Options_ResetAllBindings_Confirm), delegate //{ BindingManager.Initialize(true); RefreshDisplay(); pa.ScrollToPosition(0, -0.99f); //}, null); //GameBase.ShowDialog(d); }; reset.TextAlignment = TextAlignment.Centre; currentHeight += height; pa.ContentSpriteManager.Add(reset); pa.SetContentDimensions(new Vector2(510, currentHeight)); }
private void UpdateEventList() { eventList.Update(); if (eventListDragging != null) { eventListDragging.Position = eventListDragging.InitialPosition + (MouseManager.MousePosition - eventListDraggingStart) / GameBase.WindowManager.Ratio; foreach (pSprite p in eventList.ContentSpriteManager.SpriteList.FindAll(t => t.TagNumeric > 0)) { pText pt = p as pText; if (eventListDragging == p || (pt != null && pt.Text == @"Background")) { continue; } if (p.InitialPosition.Y > eventListDragging.Position.Y - eventDrawHeight / 2) { if (p.Position == p.InitialPosition) { p.MoveTo(p.InitialPosition + new Vector2(0, eventDrawHeight), 80); } } else if (p.InitialPosition.Y < eventListDragging.Position.Y) { if (p.Position != p.InitialPosition) { p.MoveTo(p.InitialPosition, 80); } } } } if (EventListUpdateRequired) { eventList.ClearSprites(); eventListDictionary.Clear(); float y = 0; float drawDepth = 0.5f; float scale = DpiHelper.DPI(GameBase.Form) / 96.0f; for (int i = 0; i < eventManager.storyLayerSprites.Length; i++) { bool layerIsEnabled = eventManager.storyLayerEnabled[i]; List <Event> l = eventManager.storyLayerSprites[i]; StoryLayer layer = (StoryLayer)i; pText pt = new pText(layer.ToString(), 8 * scale, new Vector2(0, y), drawDepth, true, layerIsEnabled ? Color.Orange : Color.LightGray); pt.TextRenderSpecific = false; pt.TextAa = false; pt.TextShadow = true; pt.TagNumeric = 1; pt.HandleInput = true; pt.OnHover += delegate { if (selectedEvent != null) { pt.TextBold = true; pt.TextChanged = true; } }; pt.OnHoverLost += delegate { pt.TextBold = false; pt.TextChanged = true; }; pt.OnClick += delegate { if (selectedEvent != null) { moveEventToLayer(selectedEvent, layer); } else { ToggleLayer(layer); } }; eventList.ContentSpriteManager.Add(pt); if (eventDrawHeight == 0) { eventDrawHeight = (pt.MeasureText().Y + 4 * scale) / GameBase.WindowManager.Ratio; } y += eventDrawHeight; drawDepth += 0.0001f; if (!layerIsEnabled) { continue; //don't display the events if this layer is hidden. } foreach (Event e in l) { if (e.Sprite == null) { continue; } pText pt1 = new pText(e.Filename.Length >= 4 ? e.Filename.Remove(e.Filename.Length - 4) : e.Filename + @" ", 8 * scale, new Vector2(2, y), drawDepth, true, Color.White); pt1.TextRenderSpecific = false; pt1.TextAa = false; pt1.HandleInput = true; pt1.TextShadow = true; pt1.Tag = e; pt1.TagNumeric = 2; pt1.OnHover += delegate { pt1.BackgroundColour = new Color(92, 92, 92); pt1.TextChanged = true; }; pt1.OnHoverLost += delegate { pt1.BackgroundColour = Color.TransparentWhite; pt1.TextChanged = true; }; if (e == selectedEvent) { pt1.TextBold = true; pt1.TextUnderline = true; } Event e1 = e; pt1.OnClick += delegate { if (editor.CurrentMode != EditorModes.Design) { return; } if ((!e1.Sprite.IsVisible || MouseManager.DoubleClick) && e1.Sprite.Transformations.Count > 0) { AudioEngine.SeekTo(e1.Sprite.Transformations[0].Time1); } SetSelectedEvent(e1, false); }; eventList.ContentSpriteManager.Add(pt1); y += (pt1.MeasureText().Y + 4 * scale) / GameBase.WindowManager.Ratio; eventListDictionary.Add(e, pt1); drawDepth += 0.0001f; } } eventList.SetContentDimensions(new Vector2(66, y)); EventListUpdateRequired = false; } }