Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions FantasyPlayer.Mock/FantasyPlayer.Mock.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<Content Include="cimgui.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="cimgui.pdb">
<Content Include="cimgui.pdb" Condition="Exists('cimgui.pdb')">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="cimgui.so">
Expand All @@ -94,7 +94,7 @@
<Content Include="cimguizmo.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="cimguizmo.pdb">
<Content Include="cimguizmo.pdb" Condition="Exists('cimguizmo.pdb')">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="cimguizmo.so">
Expand All @@ -103,7 +103,7 @@
<Content Include="cimplot.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="cimplot.pdb">
<Content Include="cimplot.pdb" Condition="Exists('cimplot.pdb')">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="cimplot.so">
Expand Down
3 changes: 0 additions & 3 deletions FantasyPlayer.Mock/MockPlugin.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using Dalamud.Interface.Windowing;

namespace FantasyPlayer.Mock;

using Autofac;
using DalaMock.Core.Mocks;
using DalaMock.Core.Windows;
using DalaMock.Shared.Interfaces;
using Dalamud.Plugin;
using Dalamud.Plugin.Services;

public class MockPlugin : Plugin
{
Expand Down
7 changes: 7 additions & 0 deletions FantasyPlayer.Spotify/FantasyPlayer.Spotify.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,20 @@
<Copyright>Copyright © 2020</Copyright>
<Deterministic>false</Deterministic>
<OutputPath>bin\$(Configuration)\</OutputPath>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="EmbedIO" Version="3.5.2" />
<PackageReference Include="SpotifyAPI.Web" Version="7.2.1" />
Expand Down
24 changes: 24 additions & 0 deletions FantasyPlayer.sln
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18
VisualStudioVersion = 18.5.11619.145 insiders
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FantasyPlayer.Spotify", "FantasyPlayer.Spotify\FantasyPlayer.Spotify.csproj", "{64E9DE35-E1B3-467B-8AD5-E36BAB2A3F27}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FantasyPlayer", "FantasyPlayer\FantasyPlayer.csproj", "{7C8F3B5E-12F3-43F5-9080-B58471ABB7A1}"
Expand All @@ -11,24 +14,45 @@ EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{64E9DE35-E1B3-467B-8AD5-E36BAB2A3F27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{64E9DE35-E1B3-467B-8AD5-E36BAB2A3F27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{64E9DE35-E1B3-467B-8AD5-E36BAB2A3F27}.Debug|x64.ActiveCfg = Debug|x64
{64E9DE35-E1B3-467B-8AD5-E36BAB2A3F27}.Debug|x64.Build.0 = Debug|x64
{64E9DE35-E1B3-467B-8AD5-E36BAB2A3F27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{64E9DE35-E1B3-467B-8AD5-E36BAB2A3F27}.Release|Any CPU.Build.0 = Release|Any CPU
{64E9DE35-E1B3-467B-8AD5-E36BAB2A3F27}.Release|x64.ActiveCfg = Release|x64
{64E9DE35-E1B3-467B-8AD5-E36BAB2A3F27}.Release|x64.Build.0 = Release|x64
{7C8F3B5E-12F3-43F5-9080-B58471ABB7A1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C8F3B5E-12F3-43F5-9080-B58471ABB7A1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C8F3B5E-12F3-43F5-9080-B58471ABB7A1}.Debug|x64.ActiveCfg = Debug|x64
{7C8F3B5E-12F3-43F5-9080-B58471ABB7A1}.Debug|x64.Build.0 = Debug|x64
{7C8F3B5E-12F3-43F5-9080-B58471ABB7A1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C8F3B5E-12F3-43F5-9080-B58471ABB7A1}.Release|Any CPU.Build.0 = Release|Any CPU
{7C8F3B5E-12F3-43F5-9080-B58471ABB7A1}.Release|x64.ActiveCfg = Release|x64
{7C8F3B5E-12F3-43F5-9080-B58471ABB7A1}.Release|x64.Build.0 = Release|x64
{DFFAFA7A-9860-473E-BBD7-D39ACE6ED7EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DFFAFA7A-9860-473E-BBD7-D39ACE6ED7EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DFFAFA7A-9860-473E-BBD7-D39ACE6ED7EB}.Debug|x64.ActiveCfg = Debug|x64
{DFFAFA7A-9860-473E-BBD7-D39ACE6ED7EB}.Debug|x64.Build.0 = Debug|x64
{DFFAFA7A-9860-473E-BBD7-D39ACE6ED7EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DFFAFA7A-9860-473E-BBD7-D39ACE6ED7EB}.Release|Any CPU.Build.0 = Release|Any CPU
{DFFAFA7A-9860-473E-BBD7-D39ACE6ED7EB}.Release|x64.ActiveCfg = Release|x64
{DFFAFA7A-9860-473E-BBD7-D39ACE6ED7EB}.Release|x64.Build.0 = Release|x64
{668953BC-B270-43F7-952B-706ABFDD6DEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{668953BC-B270-43F7-952B-706ABFDD6DEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{668953BC-B270-43F7-952B-706ABFDD6DEC}.Debug|x64.ActiveCfg = Debug|x64
{668953BC-B270-43F7-952B-706ABFDD6DEC}.Debug|x64.Build.0 = Debug|x64
{668953BC-B270-43F7-952B-706ABFDD6DEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{668953BC-B270-43F7-952B-706ABFDD6DEC}.Release|Any CPU.Build.0 = Release|Any CPU
{668953BC-B270-43F7-952B-706ABFDD6DEC}.Release|x64.ActiveCfg = Release|x64
{668953BC-B270-43F7-952B-706ABFDD6DEC}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
4 changes: 3 additions & 1 deletion FantasyPlayer/Config/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class Configuration : IPluginConfiguration, INotifyPropertyChanged
private bool isDirty;
public bool IsDirty
{
get => isDirty || PlayerSettings.IsDirty || SpotifySettings.IsDirty || AutoPlaySettings.IsDirty;
get => isDirty || PlayerSettings.IsDirty || SpotifySettings.IsDirty || AutoPlaySettings.IsDirty || LyricsSettings.IsDirty;
set => SetField(ref isDirty, value, false);
}

Expand All @@ -24,6 +24,7 @@ public void MarkClean()
PlayerSettings.MarkClean();
SpotifySettings.MarkClean();
AutoPlaySettings.MarkClean();
LyricsSettings.MarkClean();
}
private bool displayChatMessages;
private bool configShown;
Expand All @@ -32,6 +33,7 @@ public void MarkClean()
public PlayerSettings PlayerSettings { get; set; } = new PlayerSettings();
public SpotifySettings SpotifySettings { get; set; } = new SpotifySettings();
public AutoPlaySettings AutoPlaySettings { get; set; } = new AutoPlaySettings();
public LyricsSettings LyricsSettings { get; set; } = new LyricsSettings();

public bool DisplayChatMessages
{
Expand Down
77 changes: 77 additions & 0 deletions FantasyPlayer/Config/LyricsSettings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
using Dalamud.Game.Text;

namespace FantasyPlayer.Config
{
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;

public enum LyricDisplayMode
{
Chat = 0,
FlyText = 1,
}

public class LyricsSettings : INotifyPropertyChanged
{
private bool isDirty;
public bool IsDirty
{
get => isDirty;
private set => SetField(ref isDirty, value, false);
}

public void MarkClean()
{
IsDirty = false;
}

private bool enableLyrics;
public bool EnableLyrics
{
get => enableLyrics;
set => SetField(ref enableLyrics, value);
}

private LyricDisplayMode displayMode = LyricDisplayMode.Chat;
public LyricDisplayMode DisplayMode
{
get => displayMode;
set => SetField(ref displayMode, value);
}

private XivChatType chatType = XivChatType.Echo;
public XivChatType ChatType
{
get => chatType;
set => SetField(ref chatType, value);
}

private uint flyTextColor = 0xFF60D71E;
public uint FlyTextColor
{
get => flyTextColor;
set => SetField(ref flyTextColor, value);
}

public event PropertyChangedEventHandler? PropertyChanged;

protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

protected bool SetField<T>(ref T field, T value, bool markDirty = true, [CallerMemberName] string? propertyName = null)
{
if (EqualityComparer<T>.Default.Equals(field, value)) return false;
field = value;
OnPropertyChanged(propertyName);
if (markDirty)
{
IsDirty = true;
}

return true;
}
}
}
53 changes: 53 additions & 0 deletions FantasyPlayer/Interface/Window/SettingsWindow.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Dalamud.Bindings.ImGui;
using System;
using System.Numerics;
using AllaganLib.Shared.Extensions;
using Dalamud.Interface;
Expand Down Expand Up @@ -262,7 +263,59 @@ private void MainWindow()
}
}

if (ImGui.CollapsingHeader("Lyrics Settings"))
{
var enableLyrics = _configuration.LyricsSettings.EnableLyrics;
if (ImGui.Checkbox("Enable Lyrics", ref enableLyrics))
{
_configuration.LyricsSettings.EnableLyrics = enableLyrics;
}

var displayModeIndex = (int)_configuration.LyricsSettings.DisplayMode;
string[] displayModes = { "Chat", "Flytext" };
if (ImGui.Combo("Lyric Display Mode", ref displayModeIndex, displayModes, displayModes.Length))
{
_configuration.LyricsSettings.DisplayMode = (Config.LyricDisplayMode)displayModeIndex;
}

if (_configuration.LyricsSettings.DisplayMode == Config.LyricDisplayMode.Chat)
{
if (Widget.DrawChatTypeSelector("Lyrics chat output channel",
"To which chat channel should the lyrics be printed?",
_configuration.LyricsSettings.ChatType,
type => { _configuration.LyricsSettings.ChatType = type; }))
{
}
}
else
{
var lyricColor = AbgrToVector4(_configuration.LyricsSettings.FlyTextColor);
if (ImGui.ColorEdit4("Flytext Color", ref lyricColor))
{
_configuration.LyricsSettings.FlyTextColor = Vector4ToAbgr(lyricColor);
}
}
}

ImGui.Separator();
}

private static Vector4 AbgrToVector4(uint abgr)
{
var r = (abgr & 0xFF) / 255f;
var g = ((abgr >> 8) & 0xFF) / 255f;
var b = ((abgr >> 16) & 0xFF) / 255f;
var a = ((abgr >> 24) & 0xFF) / 255f;
return new Vector4(r, g, b, a);
}

private static uint Vector4ToAbgr(Vector4 color)
{
var r = (uint)Math.Clamp(color.X * 255f, 0f, 255f);
var g = (uint)Math.Clamp(color.Y * 255f, 0f, 255f);
var b = (uint)Math.Clamp(color.Z * 255f, 0f, 255f);
var a = (uint)Math.Clamp(color.W * 255f, 0f, 255f);
return (a << 24) | (b << 16) | (g << 8) | r;
}
}
}
25 changes: 25 additions & 0 deletions FantasyPlayer/Lyrics/LrcLibResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System.Text.Json.Serialization;

namespace FantasyPlayer.Lyrics
{
public class LrcLibResponse
{
[JsonPropertyName("id")]
public int Id { get; set; }

[JsonPropertyName("trackName")]
public string? TrackName { get; set; }

[JsonPropertyName("artistName")]
public string? ArtistName { get; set; }

[JsonPropertyName("albumName")]
public string? AlbumName { get; set; }

[JsonPropertyName("duration")]
public double Duration { get; set; }

[JsonPropertyName("syncedLyrics")]
public string? SyncedLyrics { get; set; }
}
}
Loading