protected override int FrameMethod(List <CharAnimFrame> frames) { return(CharSheet.TrueFrame(frames, Math.Min(ActionTime.Ticks, FrameTick.FrameToTick(AnimReturnTime)), true)); }
protected void UpdatePickerPos() { PrevTick = GraphicsManager.TotalFrameTick % (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME); cursorPos = new Loc(GraphicsManager.ScreenWidth / 2 - MaxLength / 2 + Text.GetTextLength() - 2, Bounds.Y + TitledStripMenu.TITLE_OFFSET * 2 + LINE_SPACE); }
protected virtual void UpdateKeys(InputManager input) { if (input.JustPressed(FrameInput.InputType.Confirm)) { if (MultiSelect.Max > 0) { List <int> slots = new List <int>(); for (int ii = 0; ii < Choices.Count; ii++) { if (Choices[ii].Selected) { slots.Add(ii); } } if (slots.Count >= MultiSelect.Min) { if (slots.Count > 0) { GameManager.Instance.SE("Menu/Confirm"); ChoseMultiIndex(slots); } else { Choices[CurrentChoice].OnConfirm(); } } else { GameManager.Instance.SE("Menu/Cancel"); } } else { Choices[CurrentChoice].OnConfirm(); } } else if (input.JustPressed(FrameInput.InputType.Menu)) { GameManager.Instance.SE("Menu/Cancel"); MenuPressed(); } else if (input.JustPressed(FrameInput.InputType.Cancel)) { GameManager.Instance.SE("Menu/Cancel"); Canceled(); } else if (MultiSelect.Max > 0 && input.JustPressed(FrameInput.InputType.SelectItems)) { int spaceLeft = MultiSelect.Max - 1 - selectedTotal; if (spaceLeft > 0 || Choices[CurrentChoice].Selected) { Choices[CurrentChoice].OnSelect(!Choices[CurrentChoice].Selected); if (Choices[CurrentChoice].Selected) { selectedTotal++; } else { selectedTotal--; } } else { GameManager.Instance.SE("Menu/Cancel"); } } else { bool moved = false; if (Choices.Count > 1) { if (IsInputting(input, Dir8.Down, Dir8.DownLeft, Dir8.DownRight)) { moved = true; CurrentChoice = (CurrentChoice + 1) % Choices.Count; } else if (IsInputting(input, Dir8.Up, Dir8.UpLeft, Dir8.UpRight)) { moved = true; CurrentChoice = (CurrentChoice + Choices.Count - 1) % Choices.Count; } if (moved) { GameManager.Instance.SE("Menu/Select"); PrevTick = GraphicsManager.TotalFrameTick % (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME); } } } }
public void Draw(SpriteBatch spriteBatch) { if (!Visible) { return; } Text.Draw(spriteBatch, new Loc()); //when text is paused and waiting for input, flash a tick at the end TextPause textPause = getCurrentTextPause(); if (textPause != null && textPause.Time == 0) { //text needs a "GetTextProgress" method, which returns the end loc of the string as its currently shown. //the coordinates are relative to the string's position Loc loc = Text.GetTextProgress() + Text.Start; if ((GraphicsManager.TotalFrameTick / (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME / 2)) % 2 == 0) { GraphicsManager.Cursor.DrawTile(spriteBatch, new Vector2(loc.X + 2, loc.Y), 0, 0); } } //draw down-tick if (HoldTime == -1 && CurrentFadeTime >= FADE_TIME && Text.Finished && (GraphicsManager.TotalFrameTick / (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME / 2)) % 2 == 0) { Loc end = Text.GetTextProgress(); GraphicsManager.Cursor.DrawTile(spriteBatch, new Vector2(GraphicsManager.ScreenWidth / 2 - 5, GraphicsManager.ScreenHeight / 2 + end.Y + 16), 1, 0); } }
public void Initialize() { PrevTick = GraphicsManager.TotalFrameTick % (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME); }
protected long UpdateTick(FrameTick elapsedTime, int speed) { long add = (speed * GraphicsManager.TileSize * elapsedTime.Ticks + leftoverTick) / FrameTick.FrameToTick(GraphicsManager.MAX_FPS); leftoverTick = (speed * GraphicsManager.TileSize * elapsedTime.Ticks + leftoverTick) % FrameTick.FrameToTick(GraphicsManager.MAX_FPS); return(add); }
protected override void UpdateKeys(InputManager input) { bool moved = false; if (TotalChoices.Length > 1) { if (IsInputting(input, Dir8.Left)) { SetPage((CurrentPage + TotalChoices.Length - 1) % TotalChoices.Length); moved = true; } else if (IsInputting(input, Dir8.Right)) { SetPage((CurrentPage + 1) % TotalChoices.Length); moved = true; } } if (moved) { GameManager.Instance.SE("Menu/Skip"); PrevTick = GraphicsManager.TotalFrameTick % (ulong)FrameTick.FrameToTick(CURSOR_FLASH_TIME); } else if (input.JustPressed(FrameInput.InputType.Confirm)) { if (MultiSelect.Max > 0) { List <int> slots = new List <int>(); for (int ii = 0; ii < TotalChoices.Length; ii++) { for (int jj = 0; jj < TotalChoices[ii].Length; jj++) { if (TotalChoices[ii][jj].Selected) { slots.Add(ii * SpacesPerPage + jj); } } } if (slots.Count >= MultiSelect.Min) { if (slots.Count > 0) { GameManager.Instance.SE("Menu/Confirm"); ChoseMultiIndex(slots); } else { Choices[CurrentChoice].OnConfirm(); } } else { GameManager.Instance.SE("Menu/Cancel"); } } else { Choices[CurrentChoice].OnConfirm(); } } else { base.UpdateKeys(input); } }
protected override int FrameMethod(List <CharAnimFrame> frames) { return(CharSheet.FractionFrame(frames, ActionTime.Ticks, FrameTick.FrameToTick(AnimTotalTime), true)); }