protected void InitializeCaret(LyricEditorMode mode) { caretContainer.Clear(); // create preview and real caret addCaret(false); addCaret(true); void addCaret(bool isPreview) { var caret = createCaret(mode); if (caret == null) { return; } caret.Hide(); if (caret is IDrawableCaret drawableCaret) { drawableCaret.Preview = isPreview; } caretContainer.Add(caret); }
static Drawable createCaret(LyricEditorMode mode) { switch (mode) { case LyricEditorMode.View: return(null); case LyricEditorMode.Manage: return(new DrawableLyricSplitterCaret()); case LyricEditorMode.Typing: return(new DrawableLyricInputCaret()); case LyricEditorMode.Language: case LyricEditorMode.EditRubyRomaji: return(null); case LyricEditorMode.CreateTimeTag: return(new DrawableTimeTagEditCaret()); case LyricEditorMode.RecordTimeTag: return(new DrawableTimeTagRecordCaret()); case LyricEditorMode.AdjustTimeTag: case LyricEditorMode.CreateNote: case LyricEditorMode.CreateNotePosition: case LyricEditorMode.AdjustNote: case LyricEditorMode.Layout: case LyricEditorMode.Singer: return(null); default: throw new IndexOutOfRangeException(nameof(mode)); } }
private static float getBaseHue(LyricEditorMode mode) { switch (mode) { case LyricEditorMode.View: return(182 / 360f); // miku blue case LyricEditorMode.Manage: return(50 / 360f); // yellow case LyricEditorMode.Typing: case LyricEditorMode.Language: case LyricEditorMode.EditRubyRomaji: return(333 / 360f); // pink case LyricEditorMode.CreateTimeTag: case LyricEditorMode.RecordTimeTag: case LyricEditorMode.AdjustTimeTag: return(33 / 360f); // orange case LyricEditorMode.CreateNote: case LyricEditorMode.CreateNotePosition: case LyricEditorMode.AdjustNote: return(203 / 360f); // blue case LyricEditorMode.Layout: case LyricEditorMode.Singer: return(271 / 360f); // purple default: throw new ArgumentException($@"{mode} colour scheme does not provide a hue value in {nameof(getBaseHue)}."); } }
public EditModeButton(LyricEditorMode mode) { Mode = mode; RelativeSizeAxes = Axes.X; Content.CornerRadius = 15; base.Action = () => Action.Invoke(mode); }
protected void CreateBadge(LyricEditorMode mode) { subInfoContainer.Clear(); var subInfo = createSubInfo(); if (subInfo == null) { return; } subInfo.Margin = new MarginPadding { Right = 15 }; subInfo.Anchor = Anchor.TopRight; subInfo.Origin = Anchor.TopRight; subInfoContainer.Add(subInfo); Drawable createSubInfo() { switch (mode) { case LyricEditorMode.View: case LyricEditorMode.Manage: case LyricEditorMode.Typing: return(null); case LyricEditorMode.Language: return(new LanguageInfo(Lyric)); case LyricEditorMode.EditRubyRomaji: return(null); case LyricEditorMode.CreateTimeTag: case LyricEditorMode.RecordTimeTag: case LyricEditorMode.AdjustTimeTag: return(new TimeTagInfo(Lyric)); case LyricEditorMode.CreateNote: case LyricEditorMode.CreateNotePosition: case LyricEditorMode.AdjustNote: return(null); case LyricEditorMode.Layout: return(new LayoutInfo(Lyric)); case LyricEditorMode.Singer: return(new SingerInfo(Lyric)); default: throw new IndexOutOfRangeException(nameof(mode)); } } }
static Drawable createBlueprintContainer(LyricEditorMode mode, Lyric lyric) { switch (mode) { case LyricEditorMode.EditRubyRomaji: return(new RubyRomajiBlueprintContainer(lyric)); case LyricEditorMode.AdjustTimeTag: return(new TimeTagBlueprintContainer(lyric)); default: return(null); } }
protected void InitializeBlueprint(LyricEditorMode mode) { // remove all exist blueprint container RemoveAll(x => x is RubyRomajiBlueprintContainer || x is TimeTagBlueprintContainer); // create preview and real caret var blueprintContainer = createBlueprintContainer(mode, Lyric); if (blueprintContainer == null) { return; } AddInternal(blueprintContainer);
public void ResetPosition(LyricEditorMode mode) { var lyric = BindableCaretPosition.Value?.Lyric; if (algorithm != null) { if (lyric != null) { BindableCaretPosition.Value = algorithm.CallMethod <ICaretPosition, Lyric>("MoveToTarget", lyric); BindableHoverCaretPosition.Value = algorithm.CallMethod <ICaretPosition, Lyric>("MoveToTarget", lyric); } else { BindableCaretPosition.Value = algorithm.CallMethod <ICaretPosition>("MoveToFirst"); BindableHoverCaretPosition.Value = algorithm.CallMethod <ICaretPosition>("MoveToFirst"); } } else { BindableCaretPosition.Value = null; BindableHoverCaretPosition.Value = null; } }
public Color4 Colour4(LyricEditorMode mode) => getColour(mode, 0.4f, 0.3f);
public Color4 Background6(LyricEditorMode mode) => getColour(mode, 0.1f, 0.1f);
private Color4 getColour(LyricEditorMode mode, float saturation, float lightness) => Color4.FromHsl(new Vector4(getBaseHue(mode), saturation, lightness, 1));
public Color4 Dark6(LyricEditorMode mode) => getColour(mode, 0.2f, 0.1f);
public Color4 Foreground1(LyricEditorMode mode) => getColour(mode, 0.1f, 0.6f);
public Color4 Content2(LyricEditorMode mode) => getColour(mode, 0.4f, 0.9f);
public Color4 Light4(LyricEditorMode mode) => getColour(mode, 0.4f, 0.5f);
public Color4 Content1(LyricEditorMode mode) => getColour(mode, 0.4f, 1);
internal void SwitchLyricEditorMode(LyricEditorMode mode) { // todo : will cause text update because has ScheduleAfterChildren in lyric editor. LyricEditor.Mode = mode; Navigation.State = NavigationState.Working; }
public Color4 Colour1(LyricEditorMode mode) => getColour(mode, 1, 0.7f);
public Color4 Colour3(LyricEditorMode mode) => getColour(mode, 0.6f, 0.5f);
public Color4 Colour2(LyricEditorMode mode) => getColour(mode, 0.8f, 0.6f);
public Color4 Highlight1(LyricEditorMode mode) => getColour(mode, 1, 0.7f);
private bool isTrigger(LyricEditorMode mode) => mode == LyricEditorMode.RecordTimeTag;