private void Awake() { Highlighted = false; HighlightBorder.SetActive(false); UpArrow.SetActive(false); DownArrow.SetActive(false); }
public override void Highlight() { Highlighted = !Highlighted; HighlightBorder.SetActive(Highlighted); UpArrow.SetActive(Highlighted); DownArrow.SetActive(Highlighted); }
public void Highlight() { Highlighted = !Highlighted; HighlightBorder.SetActive(Highlighted); UpArrow.SetActive(Highlighted); DownArrow.SetActive(Highlighted); FinishIndicator.SetActive(Highlighted); }
public override void draw(SpriteBatch b) { Draw(b); if (_currentRow < _maxRow) { DownArrow.draw(b); } if (_currentRow > 0) { UpArrow.draw(b); } drawMouse(b); }
/// <summary> /// Initializes a new instance of the <see cref="ComboBox"/> class. /// </summary> /// <param name="parent">Parent control.</param> public ComboBox(ControlBase parent) : base(parent) { m_Button = new Button(this); m_Button.Alignment = Alignment.Left | Alignment.CenterV; m_Button.Text = String.Empty; m_Button.TextPadding = Padding.Three; m_Button.Clicked += OnClicked; m_DownArrow = new DownArrow(this); IsTabable = true; KeyboardInputEnabled = true; }
private void OnSelected() { if (ContainsNoText && _wasEmptyBeforeFrame && Backspace.Down()) { RemoveLastTag(); } if (_autocompleteContainer.childCount > 0 && DownArrow.Down()) { // Dirty trick to fix skipping over first button Input.ResetInputAxes(); Select(_autocompleteContainer.GetChild(0).GetComponent <Button>().gameObject); } }
public void CursorDown() { if (isConstructed) { if (CurrentMenu != null) { DownArrow.Blink(3); CurrentOption = CurrentMenu.SelectNextItem(); } } else { throw new InvalidOperationException("Please call the End() method before operating the OSD menu"); } }
public override void receiveLeftClick(int x, int y, bool playSound = true) { base.receiveLeftClick(x, y, true); if (UpArrow.containsPoint(x, y) && _currentRow > 0) { Game1.playSound("coin"); _currentRow--; UpArrow.scale = UpArrow.baseScale; } if (DownArrow.containsPoint(x, y) && _currentRow < _maxRow) { Game1.playSound("coin"); _currentRow++; DownArrow.scale = DownArrow.baseScale; } Refresh(); }
/// <summary> /// Initializes a new instance of the <see cref="ComboBox" /> class. /// </summary> /// <param name="parent">Parent control.</param> public ComboBox(Base parent, string name = "") : base(parent, name) { SetSize(100, 20); mMenu = new Menu(this); mMenu.IsHidden = true; mMenu.IconMarginDisabled = true; mMenu.IsTabable = false; var arrow = new DownArrow(this); mButton = arrow; Alignment = Pos.Left | Pos.CenterV; Text = String.Empty; Margin = new Margin(3, 0, 0, 0); IsTabable = true; KeyboardInputEnabled = true; }
/// <summary> /// Initializes a new instance of the <see cref="ComboBox"/> class. /// </summary> /// <param name="parent">Parent control.</param> public ComboBox(Control parent) : base(parent) { SetSize(100, 20); m_Menu = new Menu(this); m_Menu.IsHidden = true; m_Menu.IconMarginDisabled = true; m_Menu.IsTabable = false; DownArrow arrow = new DownArrow(this); m_Button = arrow; Alignment = Pos.Left | Pos.CenterV; Text = String.Empty; Margin = new Margin(3, 0, 0, 0); IsTabable = true; KeyboardInputEnabled = true; }
public void draw(SpriteBatch sprite_batch) { Vector2 int_offset = new Vector2((int)Offset.X, (int)Offset.Y); sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); Black_Fill.draw(sprite_batch); sprite_batch.End(); //sprite_batch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend); //@Debug sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); if (PanTimer > 0 || (Fading_In ? FadeTimer == 0 : Active)) { for (int i = 0; i <= Index; i++) { Text[i].draw_multicolored(sprite_batch, int_offset); } UpArrow.draw(sprite_batch); DownArrow.draw(sprite_batch); } sprite_batch.End(); }
public void ListNotes(List <FNFSong.FNFNote> notes) { try { if (Form1.pnlField.InvokeRequired) { Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Clear(); }); } foreach (FNFSong.FNFNote n in notes) { double newcurrentY = Math.Floor(remapToRange(float.Parse(n.Time.ToString()), 0, (float)16 * stepCrochet, 0, Form1.pnlField.Height)) % Form1.pnlField.Height; switch (n.Type) { case FNFSong.NoteType.Left: case FNFSong.NoteType.RLeft: LeftArrow arrow = new LeftArrow(); arrow.Location = new Point(0, (int)newcurrentY); if (n.Length > 0) { HeldPart h = new HeldPart(n); h.Location = new Point(arrow.Location.X + (arrow.Width / 2) - 6, (int)newcurrentY); if (Form1.pnlField.InvokeRequired) { Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Add(h); h.SendToBack(); }); } } if (Form1.pnlField.InvokeRequired) { Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Add(arrow); arrow.BringToFront(); }); } break; case FNFSong.NoteType.Down: case FNFSong.NoteType.RDown: DownArrow dArrow = new DownArrow(); dArrow.Location = new Point(32, (int)newcurrentY); if (n.Length > 0) { HeldPart h = new HeldPart(n); h.Location = new Point(dArrow.Location.X + (dArrow.Width / 2) - 6, (int)newcurrentY); if (Form1.pnlField.InvokeRequired) { Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Add(h); h.SendToBack(); }); } } if (Form1.pnlField.InvokeRequired) { Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Add(dArrow); dArrow.BringToFront(); }); } break; case FNFSong.NoteType.Up: case FNFSong.NoteType.RUp: UpArrow uArrow = new UpArrow(); uArrow.Location = new Point(64, (int)newcurrentY); if (n.Length > 0) { HeldPart h = new HeldPart(n); h.Location = new Point(uArrow.Location.X + (uArrow.Width / 2) - 6, (int)newcurrentY); if (Form1.pnlField.InvokeRequired) { Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Add(h); h.SendToBack(); }); } } if (Form1.pnlField.InvokeRequired) { Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Add(uArrow); uArrow.BringToFront(); }); } break; case FNFSong.NoteType.Right: case FNFSong.NoteType.RRight: RightArrow rArrow = new RightArrow(); rArrow.Location = new Point(96, (int)newcurrentY); if (n.Length > 0) { HeldPart h = new HeldPart(n); h.Location = new Point(rArrow.Location.X + (rArrow.Width / 2) - 6, (int)newcurrentY); if (Form1.pnlField.InvokeRequired) { Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Add(h); h.SendToBack(); }); } } if (Form1.pnlField.InvokeRequired) { Form1.pnlField.BeginInvoke((MethodInvoker) delegate { Form1.pnlField.Controls.Add(rArrow); rArrow.BringToFront(); }); } break; } } } catch (Exception e) { Form1.WriteToConsole("Failed to render notes.\n" + e); } }
public void update() { UpArrow.update(); DownArrow.update(); float max_speed; if (Input.ControlScheme == ControlSchemes.Buttons) { max_speed = (Global.Input.speed_up_input() ? 2 : 1) * Config.CONVO_BACKLOG_MAX_SCROLL_SPEED; } else if (Input.ControlScheme == ControlSchemes.Mouse) { max_speed = 5f * Config.CONVO_BACKLOG_MAX_SCROLL_SPEED; } else { max_speed = Config.WINDOW_HEIGHT; } // Pan out if (PanTimer > 0 && !Fading_In) { PanTimer--; int pan = Config.CONVO_BACKLOG_PAN_OUT_TIME - PanTimer; // Set full alpha if the pan is over int alpha = 255; if (PanTimer > 0) { alpha = Math.Min(255, PanTimer * 256 / Config.CONVO_BACKLOG_PAN_OUT_TIME); } Color tint = new Color(alpha, alpha, alpha, alpha); foreach (var text in Text) { text.draw_offset = new Vector2( -(int)Math.Pow(pan, 1.8f), 0); text.tint = tint; } } else if (FadeTimer > 0) { FadeTimer--; Black_Fill.tint = new Color(0, 0, 0, ((Fading_In ? (Config.CONVO_BACKLOG_FADE_TIME - FadeTimer) : FadeTimer) * Config.CONVO_BACKLOG_BG_OPACITY) / Config.CONVO_BACKLOG_FADE_TIME); } // Pan in else if (PanTimer > 0) { PanTimer--; int pan = Config.CONVO_BACKLOG_PAN_IN_TIME - PanTimer; int alpha = Math.Min(255, pan * 256 / Config.CONVO_BACKLOG_PAN_IN_TIME); Color tint = new Color(alpha, alpha, alpha, alpha); foreach (var text in Text) { text.draw_offset = new Vector2( -(int)Math.Pow(PanTimer, 1.8f), 0); text.tint = tint; } } if (FadeTimer == 0 && PanTimer == 0) { Fading_In = false; } if (ready) { update_input(max_speed); } Scroll_Speed = MathHelper.Clamp(Scroll_Speed, -max_speed, max_speed); Offset.Y = MathHelper.Clamp(Offset.Y + Scroll_Speed, this.min_offset, this.max_offset); UpArrow.visible = Offset.Y > this.min_offset; DownArrow.visible = Offset.Y < this.max_offset; }
private void update_input(float max_speed) { if (Active) { if (Global.Input.pressed(Inputs.Up)) { if (Scroll_Speed > 0) { Scroll_Speed = 0; } if (Scroll_Speed > -max_speed) { Scroll_Speed--; } return; } else if (Global.Input.pressed(Inputs.Down)) { if (Scroll_Speed < 0) { Scroll_Speed = 0; } if (Scroll_Speed < max_speed) { Scroll_Speed++; } return; } else if (Global.Input.mouseScroll < 0) { Scroll_Speed += max_speed / 5; ScrollWheel = true; return; } else if (Global.Input.mouseScroll > 0) { Scroll_Speed += -max_speed / 5; ScrollWheel = true; return; } else if (Input.ControlScheme == ControlSchemes.Mouse && UpArrow.MouseOver()) { Scroll_Speed = -Config.CONVO_BACKLOG_MAX_SCROLL_SPEED; ScrollWheel = false; return; } else if (Input.ControlScheme == ControlSchemes.Mouse && DownArrow.MouseOver()) { Scroll_Speed = Config.CONVO_BACKLOG_MAX_SCROLL_SPEED; ScrollWheel = false; return; } else if (Global.Input.gesture_triggered(TouchGestures.VerticalDrag)) { Scroll_Speed = -(int)Global.Input.verticalDragVector.Y; return; } } if (Scroll_Speed != 0) { if (Input.ControlScheme == ControlSchemes.Buttons) { Scroll_Speed = (float)Additional_Math.double_closer( Scroll_Speed, 0, 1); } else if (Input.ControlScheme == ControlSchemes.Mouse) { if (ScrollWheel) { Scroll_Speed *= (float)Math.Pow( Config.CONVO_BACKLOG_TOUCH_SCROLL_FRICTION, 2f); } else { Scroll_Speed = (float)Additional_Math.double_closer( Scroll_Speed, 0, 1); } } else { Scroll_Speed *= Config.CONVO_BACKLOG_TOUCH_SCROLL_FRICTION; } if (Math.Abs(Scroll_Speed) < 0.1f) { Scroll_Speed = 0; ScrollWheel = false; } } }
private void LoadGameObjects(IList<string> lines) { Rows = lines.Count; _gameObjects = new GameObjectBase[Rows][]; for (var row = 0; row < Rows; row++) { Columns = lines[row].Length; _gameObjects[row] = new GameObjectBase[Columns]; for (var column = 0; column < Columns; column++) { switch (lines[row][column]) { case '#': _gameObjects[row][column] = Brick.LoadBrick(lines[row][column], row, column); break; case 'p': Thakur.Row = column; Thakur.Column = row; break; case 'G': _gameObjects[row][column] = new Paisa(row, column); break; case 'E': _gameObjects[row][column] = new Taaqat(row, column); break; case 'M': _gameObjects[row][column] = new Mout(row, column); break; case '8': _gameObjects[row][column] = new UpArrow(row, column); break; case '2': _gameObjects[row][column] = new DownArrow(row, column); break; case '4': _gameObjects[row][column] = new LeftArrow(row, column); break; case '6': _gameObjects[row][column] = new RightArrow(row, column); break; case 'd': _gameObjects[row][column] = new SabzDirwaaza(row, column); _dirwaazay.Add((DirwaazaBase)_gameObjects[row][column]); break; case 'c': _gameObjects[row][column] = new SabzChaabi(row, column); _chaabiyaan.Add((ChaabiBase)_gameObjects[row][column]); break; case 't': _gameObjects[row][column] = new SabzTaala(row, column); _taalay.Add((TaalaBase)_gameObjects[row][column]); break; case 'D': _gameObjects[row][column] = new LaalDirwaaza(row, column); _dirwaazay.Add((DirwaazaBase)_gameObjects[row][column]); break; case 'C': _gameObjects[row][column] = new LaalChaabi(row, column); _chaabiyaan.Add((ChaabiBase)_gameObjects[row][column]); break; case 'T': _gameObjects[row][column] = new LaalTaala(row, column); _taalay.Add((TaalaBase)_gameObjects[row][column]); break; case 'V': _gameObjects[row][column] = new Victory(row, column); break; case 'N': _gameObjects[row][column] = new NextBoard(row, column); break; } } } }
public override void performHoverAction(int x, int y) { base.performHoverAction(x, y); UpArrow.scale = UpArrow.containsPoint(x, y) ? Math.Min(UpArrow.scale + 0.02f, UpArrow.baseScale + 0.1f) : Math.Max(UpArrow.scale - 0.02f, UpArrow.baseScale); DownArrow.scale = DownArrow.containsPoint(x, y) ? Math.Min(DownArrow.scale + 0.02f, DownArrow.baseScale + 0.1f) : Math.Max(DownArrow.scale - 0.02f, DownArrow.baseScale); }
// Update is called once per frame void Update() { if (!end) { if (!GlobalAudioSrc.Instance.audioSrc.isPlaying) { time += Time.deltaTime; if (time >= MsgInterval) { PlayVoice(); } } else { time = 0; } if (Vr_Player.transform.localPosition.z > 0.5f && !FrontPoint) { FrontPoint = true; time = 0; UpArrow.SetActive(false); DownArrow.SetActive(true); } if (FrontPoint && !BackPoint && Vr_Player.transform.localPosition.z == 0) { BackPoint = true; time = 0; DownArrow.SetActive(false); } if (Input.GetAxisRaw("Vertical") > 0) { time = 0; StopVoice(); Rocker.localRotation = Quaternion.Euler(new Vector3(0, 0, -15)); Vr_Player.transform.localPosition += new Vector3(0, 0, Time.deltaTime); Vr_Player.transform.localPosition = new Vector3(Vr_Player.transform.localPosition.x, Vr_Player.transform.localPosition.y, Mathf.Clamp(Vr_Player.transform.localPosition.z, 0, 5)); } else if (Input.GetAxisRaw("Vertical") < 0) { time = 0; StopVoice(); Rocker.localRotation = Quaternion.Euler(new Vector3(0, 0, 15)); Vr_Player.transform.localPosition -= new Vector3(0, 0, Time.deltaTime); Vr_Player.transform.localPosition = new Vector3(Vr_Player.transform.localPosition.x, Vr_Player.transform.localPosition.y, Mathf.Clamp(Vr_Player.transform.localPosition.z, 0, 5)); } else { Rocker.localRotation = Quaternion.Euler(new Vector3(0, 0, 0)); } if (FrontPoint == true && BackPoint == true) { time = 0; Rocker.localRotation = Quaternion.Euler(new Vector3(0, 0, 0)); anim.enabled = true; anim.SetTrigger("WellDone"); end = true; } } }