Compare commits
6 Commits
cake-attem
...
1.11.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f383c3ebe | ||
|
|
5dfd859542 | ||
|
|
beb737b267 | ||
|
|
68c0bf1334 | ||
|
|
05daa59e40 | ||
|
|
c3a6f2c88d |
182
.gitea/lightless-tag-and-release.yml
Normal file
182
.gitea/lightless-tag-and-release.yml
Normal file
@@ -0,0 +1,182 @@
|
||||
name: Tag and Release Lightless
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
|
||||
env:
|
||||
PLUGIN_NAME: LightlessSync
|
||||
DOTNET_VERSION: 9.x
|
||||
|
||||
jobs:
|
||||
tag-and-release:
|
||||
runs-on: ubuntu-22.04
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
steps:
|
||||
- name: Checkout Lightless
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: true
|
||||
|
||||
- name: Setup .NET 9 SDK
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x
|
||||
|
||||
- name: Download Dalamud
|
||||
run: |
|
||||
cd /
|
||||
mkdir -p root/.xlcore/dalamud/Hooks/dev
|
||||
curl -O https://goatcorp.github.io/dalamud-distrib/stg/latest.zip
|
||||
unzip latest.zip -d /root/.xlcore/dalamud/Hooks/dev
|
||||
|
||||
- name: Lets Build Lightless!
|
||||
run: |
|
||||
dotnet restore
|
||||
dotnet build --configuration Release --no-restore
|
||||
dotnet publish --configuration Release --no-build
|
||||
|
||||
- name: Get version
|
||||
id: package_version
|
||||
uses: KageKirin/get-csproj-version@v0
|
||||
with:
|
||||
file: LightlessSync/LightlessSync.csproj
|
||||
|
||||
- name: Display version
|
||||
run: |
|
||||
echo "Version: ${{ steps.package_version.outputs.version }}"
|
||||
|
||||
- name: Prepare Lightless Client
|
||||
run: |
|
||||
PUBLISH_PATH="/workspace/Lightless-Sync/LightlessClient/LightlessSync/bin/x64/Release/publish/"
|
||||
if [ -d "$PUBLISH_PATH" ]; then
|
||||
rm -rf "$PUBLISH_PATH"
|
||||
echo "Removed $PUBLISH_PATH"
|
||||
else
|
||||
echo "$PUBLISH_PATH does not exist, nothing to remove."
|
||||
fi
|
||||
|
||||
mkdir -p output
|
||||
(cd /workspace/Lightless-Sync/LightlessClient/LightlessSync/bin/x64/Release/ && zip -r $OLDPWD/output/LightlessClient.zip *)
|
||||
|
||||
- name: Create Git tag if not exists
|
||||
run: |
|
||||
tag="${{ steps.package_version.outputs.version }}"
|
||||
git fetch --tags
|
||||
if ! git tag -l "$tag" | grep -q "$tag"; then
|
||||
echo "Tag $tag does not exist. Creating and pushing..."
|
||||
git config user.name "GitHub Action"
|
||||
git config user.email "action@github.com"
|
||||
git tag "$tag"
|
||||
git push origin "$tag"
|
||||
else
|
||||
echo "Tag $tag already exists. Skipping tag creation."
|
||||
fi
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
run: |
|
||||
echo "=== Searching for existing release ${{ steps.package_version.outputs.version }}==="
|
||||
|
||||
release_id=$(curl -s -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
"https://git.lightless-sync.org/api/v1/repos/${GITHUB_REPOSITORY}/releases/tags/${{ steps.package_version.outputs.version }}" | jq -r .id)
|
||||
|
||||
if [ "$release_id" != "null" ]; then
|
||||
echo "=== Deleting existing release ${{ steps.package_version.outputs.version }}==="
|
||||
curl -X DELETE -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
"https://git.lightless-sync.org/api/v1/repos/${GITHUB_REPOSITORY}/releases/$release_id"
|
||||
fi
|
||||
|
||||
echo "=== Creating new release ${{ steps.package_version.outputs.version }}==="
|
||||
response=$(
|
||||
curl --fail-with-body -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-d '{
|
||||
"tag_name": "${{ steps.package_version.outputs.version }}",
|
||||
"name": "${{ steps.package_version.outputs.version }}",
|
||||
"draft": false,
|
||||
"prerelease": false
|
||||
}' \
|
||||
"https://git.lightless-sync.org/api/v1/repos/${GITHUB_REPOSITORY}/releases"
|
||||
)
|
||||
|
||||
release_id=$(echo "$response" | jq -r .id)
|
||||
echo "release_id=$release_id" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Upload Assets to release
|
||||
run: |
|
||||
curl --fail-with-body -s -X POST \
|
||||
-H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \
|
||||
-F "attachment=@output/LightlessClient.zip" \
|
||||
"https://git.lightless-sync.org/api/v1/repos/${GITHUB_REPOSITORY}/releases/${{ steps.create_release.outputs.release_id }}/assets"
|
||||
|
||||
- name: Clone plugin hosting repo
|
||||
run: |
|
||||
mkdir LightlessSyncRepo
|
||||
cd LightlessSyncRepo
|
||||
git clone https://git.lightless-sync.org/${{ gitea.repository_owner }}/LightlessSync.git
|
||||
env:
|
||||
GIT_TERMINAL_PROMPT: 0
|
||||
|
||||
- name: Update plogonmaster.json with version
|
||||
env:
|
||||
VERSION: ${{ steps.package_version.outputs.version }}
|
||||
run: |
|
||||
set -e
|
||||
|
||||
pluginJsonPath="${PLUGIN_NAME}/bin/x64/Release/${PLUGIN_NAME}.json"
|
||||
repoJsonPath="LightlessSyncRepo/LightlessSync/plogonmaster.json"
|
||||
version="${VERSION}"
|
||||
downloadUrl="https://git.lightless-sync.org/${{ gitea.repository_owner }}/LightlessClient/releases/download/$version/LightlessClient.zip"
|
||||
|
||||
# Read plugin JSON
|
||||
pluginJson=$(cat "$pluginJsonPath")
|
||||
internalName=$(jq -r '.InternalName' <<< "$pluginJson")
|
||||
dalamudApiLevel=$(jq -r '.DalamudApiLevel' <<< "$pluginJson")
|
||||
|
||||
# Read repo JSON (force array if not already)
|
||||
repoJsonRaw=$(cat "$repoJsonPath")
|
||||
if echo "$repoJsonRaw" | jq 'type' | grep -q '"array"'; then
|
||||
repoJson="$repoJsonRaw"
|
||||
else
|
||||
repoJson="[$repoJsonRaw]"
|
||||
fi
|
||||
|
||||
# Update matching plugin entry
|
||||
updatedRepoJson=$(jq \
|
||||
--arg internalName "$internalName" \
|
||||
--arg dalamudApiLevel "$dalamudApiLevel" \
|
||||
--arg version "$version" \
|
||||
--arg downloadUrl "$downloadUrl" \
|
||||
'
|
||||
map(
|
||||
if .InternalName == $internalName
|
||||
then
|
||||
.DalamudApiLevel = $dalamudApiLevel
|
||||
| .AssemblyVersion = $version
|
||||
| .DownloadLinkInstall = $downloadUrl
|
||||
| .DownloadLinkTesting = $downloadUrl
|
||||
| .DownloadLinkUpdate = $downloadUrl
|
||||
else
|
||||
.
|
||||
end
|
||||
)
|
||||
' <<< "$repoJson")
|
||||
|
||||
# Write back to file
|
||||
echo "$updatedRepoJson" > "$repoJsonPath"
|
||||
# Output the content of the file
|
||||
cat "$repoJsonPath"
|
||||
|
||||
- name: Commit and push to LightlessSync
|
||||
run: |
|
||||
cd LightlessSyncRepo/LightlessSync
|
||||
git config user.name "github-actions"
|
||||
git config user.email "github-actions@github.com"
|
||||
git add .
|
||||
git diff-index --quiet HEAD || git commit -m "Update ${{ env.PLUGIN_NAME }} to ${{ steps.package_version.outputs.version }}"
|
||||
git push https://x-access-token:${{ secrets.AUTOMATION_TOKEN }}@git.lightless-sync.org/${{ gitea.repository_owner }}/LightlessSync.git HEAD:main
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Authors></Authors>
|
||||
<Company></Company>
|
||||
<Version>1.11.4</Version>
|
||||
<Version>1.11.5</Version>
|
||||
<Description></Description>
|
||||
<Copyright></Copyright>
|
||||
<PackageProjectUrl>https://github.com/Light-Public-Syncshells/LightlessClient</PackageProjectUrl>
|
||||
|
||||
@@ -72,8 +72,8 @@ public class Pair
|
||||
Name = openProfileSeString,
|
||||
OnClicked = (a) => _mediator.Publish(new ProfileOpenStandaloneMessage(this)),
|
||||
UseDefaultPrefix = false,
|
||||
PrefixChar = 'M',
|
||||
PrefixColor = 526
|
||||
PrefixChar = 'L',
|
||||
PrefixColor = 708
|
||||
});
|
||||
|
||||
args.AddMenuItem(new MenuItem()
|
||||
@@ -81,8 +81,8 @@ public class Pair
|
||||
Name = reapplyDataSeString,
|
||||
OnClicked = (a) => ApplyLastReceivedData(forced: true),
|
||||
UseDefaultPrefix = false,
|
||||
PrefixChar = 'M',
|
||||
PrefixColor = 526
|
||||
PrefixChar = 'L',
|
||||
PrefixColor = 708
|
||||
});
|
||||
|
||||
args.AddMenuItem(new MenuItem()
|
||||
@@ -90,8 +90,8 @@ public class Pair
|
||||
Name = changePermissions,
|
||||
OnClicked = (a) => _mediator.Publish(new OpenPermissionWindow(this)),
|
||||
UseDefaultPrefix = false,
|
||||
PrefixChar = 'M',
|
||||
PrefixColor = 526
|
||||
PrefixChar = 'L',
|
||||
PrefixColor = 708
|
||||
});
|
||||
|
||||
args.AddMenuItem(new MenuItem()
|
||||
@@ -99,8 +99,8 @@ public class Pair
|
||||
Name = cyclePauseState,
|
||||
OnClicked = (a) => _mediator.Publish(new CyclePauseMessage(UserData)),
|
||||
UseDefaultPrefix = false,
|
||||
PrefixChar = 'M',
|
||||
PrefixColor = 526
|
||||
PrefixChar = 'L',
|
||||
PrefixColor = 708
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -130,6 +130,7 @@ public sealed class Plugin : IDalamudPlugin
|
||||
s.GetRequiredService<CharaDataManager>(),
|
||||
s.GetRequiredService<LightlessMediator>()));
|
||||
collection.AddSingleton<SelectPairForTagUi>();
|
||||
collection.AddSingleton<RenameTagUi>();
|
||||
collection.AddSingleton((s) => new EventAggregator(pluginInterface.ConfigDirectory.FullName,
|
||||
s.GetRequiredService<ILogger<EventAggregator>>(), s.GetRequiredService<LightlessMediator>()));
|
||||
collection.AddSingleton((s) => new DalamudUtilService(s.GetRequiredService<ILogger<DalamudUtilService>>(),
|
||||
|
||||
@@ -38,6 +38,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
private readonly PairManager _pairManager;
|
||||
private readonly SelectTagForPairUi _selectGroupForPairUi;
|
||||
private readonly SelectPairForTagUi _selectPairsForGroupUi;
|
||||
private readonly RenameTagUi _renameTagUi;
|
||||
private readonly IpcManager _ipcManager;
|
||||
private readonly ServerConfigurationManager _serverManager;
|
||||
private readonly TopTabMenu _tabMenu;
|
||||
@@ -56,7 +57,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
|
||||
public CompactUi(ILogger<CompactUi> logger, UiSharedService uiShared, LightlessConfigService configService, ApiController apiController, PairManager pairManager,
|
||||
ServerConfigurationManager serverManager, LightlessMediator mediator, FileUploadManager fileTransferManager,
|
||||
TagHandler tagHandler, DrawEntityFactory drawEntityFactory, SelectTagForPairUi selectTagForPairUi, SelectPairForTagUi selectPairForTagUi,
|
||||
TagHandler tagHandler, DrawEntityFactory drawEntityFactory, SelectTagForPairUi selectTagForPairUi, SelectPairForTagUi selectPairForTagUi, RenameTagUi renameTagUi,
|
||||
PerformanceCollectorService performanceCollectorService, IpcManager ipcManager)
|
||||
: base(logger, mediator, "###LightlessSyncMainUI", performanceCollectorService)
|
||||
{
|
||||
@@ -70,6 +71,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
_drawEntityFactory = drawEntityFactory;
|
||||
_selectGroupForPairUi = selectTagForPairUi;
|
||||
_selectPairsForGroupUi = selectPairForTagUi;
|
||||
_renameTagUi = renameTagUi;
|
||||
_ipcManager = ipcManager;
|
||||
_tabMenu = new TopTabMenu(Mediator, _apiController, _pairManager, _uiSharedService);
|
||||
|
||||
@@ -149,10 +151,10 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
var uidTextSize = ImGui.CalcTextSize(unsupported);
|
||||
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionMax().X + ImGui.GetWindowContentRegionMin().X) / 2 - uidTextSize.X / 2);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, unsupported);
|
||||
ImGui.TextColored(UIColors.Get("DimRed"), unsupported);
|
||||
}
|
||||
UiSharedService.ColorTextWrapped($"Your Lightless Sync installation is out of date, the current version is {ver.Major}.{ver.Minor}.{ver.Build}. " +
|
||||
$"It is highly recommended to keep Lightless Sync up to date. Open /xlplugins and update the plugin.", ImGuiColors.DalamudRed);
|
||||
$"It is highly recommended to keep Lightless Sync up to date. Open /xlplugins and update the plugin.", UIColors.Get("DimRed"));
|
||||
}
|
||||
|
||||
if (!_ipcManager.Initialized)
|
||||
@@ -164,12 +166,12 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
var uidTextSize = ImGui.CalcTextSize(unsupported);
|
||||
ImGui.SetCursorPosX((ImGui.GetWindowContentRegionMax().X + ImGui.GetWindowContentRegionMin().X) / 2 - uidTextSize.X / 2);
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, unsupported);
|
||||
ImGui.TextColored(UIColors.Get("DimRed"), unsupported);
|
||||
}
|
||||
var penumAvailable = _ipcManager.Penumbra.APIAvailable;
|
||||
var glamAvailable = _ipcManager.Glamourer.APIAvailable;
|
||||
|
||||
UiSharedService.ColorTextWrapped($"One or more Plugins essential for Lightless operation are unavailable. Enable or update following plugins:", ImGuiColors.DalamudRed);
|
||||
UiSharedService.ColorTextWrapped($"One or more Plugins essential for Lightless operation are unavailable. Enable or update following plugins:", UIColors.Get("DimRed"));
|
||||
using var indent = ImRaii.PushIndent(10f);
|
||||
if (!penumAvailable)
|
||||
{
|
||||
@@ -185,7 +187,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
}
|
||||
|
||||
using (ImRaii.PushId("header")) DrawUIDHeader();
|
||||
ImGui.Separator();
|
||||
_uiSharedService.ColoredSeparator(UIColors.Get("LightlessPurple"), 2f);
|
||||
using (ImRaii.PushId("serverstatus")) DrawServerStatus();
|
||||
ImGui.Separator();
|
||||
|
||||
@@ -198,6 +200,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
using (ImRaii.PushId("transfers")) DrawTransfers();
|
||||
_transferPartHeight = ImGui.GetCursorPosY() - pairlistEnd - ImGui.GetTextLineHeight();
|
||||
using (ImRaii.PushId("group-user-popup")) _selectPairsForGroupUi.Draw(_pairManager.DirectPairs);
|
||||
using (ImRaii.PushId("group-user-edit")) _renameTagUi.Draw(_pairManager.DirectPairs);
|
||||
using (ImRaii.PushId("grouping-popup")) _selectGroupForPairUi.Draw();
|
||||
}
|
||||
|
||||
@@ -284,7 +287,7 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
else
|
||||
{
|
||||
ImGui.AlignTextToFramePadding();
|
||||
ImGui.TextColored(ImGuiColors.DalamudRed, "Not connected to any server");
|
||||
ImGui.TextColored(UIColors.Get("DimRed"), "Not connected to any server");
|
||||
}
|
||||
|
||||
if (printShard)
|
||||
@@ -587,21 +590,21 @@ public class CompactUi : WindowMediatorSubscriberBase
|
||||
{
|
||||
return _apiController.ServerState switch
|
||||
{
|
||||
ServerState.Connecting => ImGuiColors.DalamudYellow,
|
||||
ServerState.Reconnecting => ImGuiColors.DalamudRed,
|
||||
ServerState.Connecting => UIColors.Get("LightlessYellow"),
|
||||
ServerState.Reconnecting => UIColors.Get("DimRed"),
|
||||
ServerState.Connected => UIColors.Get("LightlessPurple"),
|
||||
ServerState.Disconnected => ImGuiColors.DalamudYellow,
|
||||
ServerState.Disconnecting => ImGuiColors.DalamudYellow,
|
||||
ServerState.Unauthorized => ImGuiColors.DalamudRed,
|
||||
ServerState.VersionMisMatch => ImGuiColors.DalamudRed,
|
||||
ServerState.Offline => ImGuiColors.DalamudRed,
|
||||
ServerState.RateLimited => ImGuiColors.DalamudYellow,
|
||||
ServerState.NoSecretKey => ImGuiColors.DalamudYellow,
|
||||
ServerState.MultiChara => ImGuiColors.DalamudYellow,
|
||||
ServerState.OAuthMisconfigured => ImGuiColors.DalamudRed,
|
||||
ServerState.OAuthLoginTokenStale => ImGuiColors.DalamudRed,
|
||||
ServerState.NoAutoLogon => ImGuiColors.DalamudYellow,
|
||||
_ => ImGuiColors.DalamudRed
|
||||
ServerState.Disconnected => UIColors.Get("LightlessYellow"),
|
||||
ServerState.Disconnecting => UIColors.Get("LightlessYellow"),
|
||||
ServerState.Unauthorized => UIColors.Get("DimRed"),
|
||||
ServerState.VersionMisMatch => UIColors.Get("DimRed"),
|
||||
ServerState.Offline => UIColors.Get("DimRed"),
|
||||
ServerState.RateLimited => UIColors.Get("LightlessYellow"),
|
||||
ServerState.NoSecretKey => UIColors.Get("LightlessYellow"),
|
||||
ServerState.MultiChara => UIColors.Get("LightlessYellow"),
|
||||
ServerState.OAuthMisconfigured => UIColors.Get("DimRed"),
|
||||
ServerState.OAuthLoginTokenStale => UIColors.Get("DimRed"),
|
||||
ServerState.NoAutoLogon => UIColors.Get("LightlessYellow"),
|
||||
_ => UIColors.Get("DimRed")
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -13,13 +13,15 @@ public class DrawFolderTag : DrawFolderBase
|
||||
{
|
||||
private readonly ApiController _apiController;
|
||||
private readonly SelectPairForTagUi _selectPairForTagUi;
|
||||
private readonly RenameTagUi _renameTagUi;
|
||||
|
||||
public DrawFolderTag(string id, IImmutableList<DrawUserPair> drawPairs, IImmutableList<Pair> allPairs,
|
||||
TagHandler tagHandler, ApiController apiController, SelectPairForTagUi selectPairForTagUi, UiSharedService uiSharedService)
|
||||
TagHandler tagHandler, ApiController apiController, SelectPairForTagUi selectPairForTagUi, RenameTagUi renameTagUi, UiSharedService uiSharedService)
|
||||
: base(id, drawPairs, allPairs, tagHandler, uiSharedService)
|
||||
{
|
||||
_apiController = apiController;
|
||||
_selectPairForTagUi = selectPairForTagUi;
|
||||
_renameTagUi = renameTagUi;
|
||||
}
|
||||
|
||||
protected override bool RenderIfEmpty => _id switch
|
||||
@@ -100,12 +102,15 @@ public class DrawFolderTag : DrawFolderBase
|
||||
protected override void DrawMenu(float menuWidth)
|
||||
{
|
||||
ImGui.TextUnformatted("Group Menu");
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Users, "Select Pairs", menuWidth, true))
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Users, "Select Pairs", menuWidth, isInPopup: true))
|
||||
{
|
||||
_selectPairForTagUi.Open(_id);
|
||||
}
|
||||
UiSharedService.AttachToolTip("Select Individual Pairs for this Pair Group");
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Pair Group", menuWidth, true) && UiSharedService.CtrlPressed())
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Edit, "Rename Pair Group", menuWidth, isInPopup: true))
|
||||
{
|
||||
_renameTagUi.Open(_id);
|
||||
}
|
||||
if (_uiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Delete Pair Group", menuWidth, isInPopup: true) && UiSharedService.CtrlPressed())
|
||||
{
|
||||
_tagHandler.RemoveTag(_id);
|
||||
}
|
||||
|
||||
93
LightlessSync/UI/Components/RenameTagUi.cs
Normal file
93
LightlessSync/UI/Components/RenameTagUi.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using Dalamud.Bindings.ImGui;
|
||||
using Dalamud.Interface.Utility;
|
||||
using Dalamud.Interface.Utility.Raii;
|
||||
using LightlessSync.PlayerData.Pairs;
|
||||
using LightlessSync.UI.Handlers;
|
||||
|
||||
using System.Numerics;
|
||||
|
||||
namespace LightlessSync.UI.Components;
|
||||
|
||||
public class RenameTagUi
|
||||
{
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly UiSharedService _uiSharedService;
|
||||
private string _desiredName = string.Empty;
|
||||
private bool _opened = false;
|
||||
private HashSet<string> _peopleInGroup = new(StringComparer.Ordinal);
|
||||
private bool _show = false;
|
||||
private string _tag = string.Empty;
|
||||
|
||||
public RenameTagUi(TagHandler tagHandler, UiSharedService uiSharedService)
|
||||
{
|
||||
_tagHandler = tagHandler;
|
||||
_uiSharedService = uiSharedService;
|
||||
}
|
||||
|
||||
public void Draw(List<Pair> pairs)
|
||||
{
|
||||
var workHeight = ImGui.GetMainViewport().WorkSize.Y / ImGuiHelpers.GlobalScale;
|
||||
var minSize = new Vector2(300, workHeight < 110 ? workHeight : 110) * ImGuiHelpers.GlobalScale;
|
||||
var maxSize = new Vector2(300, 110) * ImGuiHelpers.GlobalScale;
|
||||
|
||||
var popupName = $"Renaming Group {_tag}";
|
||||
|
||||
if (!_show)
|
||||
{
|
||||
_opened = false;
|
||||
}
|
||||
|
||||
if (_show && !_opened)
|
||||
{
|
||||
ImGui.SetNextWindowSize(minSize);
|
||||
UiSharedService.CenterNextWindow(minSize.X, minSize.Y, ImGuiCond.Always);
|
||||
ImGui.OpenPopup(popupName);
|
||||
_opened = true;
|
||||
}
|
||||
|
||||
ImGui.SetNextWindowSizeConstraints(minSize, maxSize);
|
||||
if (ImGui.BeginPopupModal(popupName, ref _show, ImGuiWindowFlags.Popup | ImGuiWindowFlags.Modal))
|
||||
{
|
||||
ImGui.TextUnformatted($"Renaming {_tag}");
|
||||
|
||||
ImGui.InputTextWithHint("##desiredname", "Enter new group name", ref _desiredName, 255, ImGuiInputTextFlags.None);
|
||||
using (ImRaii.Disabled(string.IsNullOrEmpty(_desiredName)))
|
||||
{
|
||||
if (_uiSharedService.IconTextButton(Dalamud.Interface.FontAwesomeIcon.Plus, "Rename Group"))
|
||||
{
|
||||
RenameTag(pairs, _tag, _desiredName);
|
||||
_show = false;
|
||||
}
|
||||
}
|
||||
ImGui.EndPopup();
|
||||
}
|
||||
else
|
||||
{
|
||||
_show = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void Open(string tag)
|
||||
{
|
||||
_peopleInGroup = _tagHandler.GetOtherUidsForTag(tag);
|
||||
_tag = tag;
|
||||
_desiredName = "";
|
||||
_show = true;
|
||||
}
|
||||
public void RenameTag(List<Pair> pairs, string oldTag, string newTag)
|
||||
{
|
||||
//Removal of old tag
|
||||
_tagHandler.RemoveTag(oldTag);
|
||||
|
||||
//Creation of new tag and adding of old group pairs in new one.
|
||||
_tagHandler.AddTag(newTag);
|
||||
foreach (Pair pair in pairs)
|
||||
{
|
||||
var isInTag = _peopleInGroup.Contains(pair.UserData.UID);
|
||||
if (isInTag)
|
||||
{
|
||||
_tagHandler.AddTagToPairedUid(pair.UserData.UID, newTag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,11 +23,12 @@ public class DrawEntityFactory
|
||||
private readonly PlayerPerformanceConfigService _playerPerformanceConfigService;
|
||||
private readonly CharaDataManager _charaDataManager;
|
||||
private readonly SelectTagForPairUi _selectTagForPairUi;
|
||||
private readonly RenameTagUi _renameTagUi;
|
||||
private readonly TagHandler _tagHandler;
|
||||
private readonly IdDisplayHandler _uidDisplayHandler;
|
||||
|
||||
public DrawEntityFactory(ILogger<DrawEntityFactory> logger, ApiController apiController, IdDisplayHandler uidDisplayHandler,
|
||||
SelectTagForPairUi selectTagForPairUi, LightlessMediator mediator,
|
||||
SelectTagForPairUi selectTagForPairUi, RenameTagUi renameTagUi, LightlessMediator mediator,
|
||||
TagHandler tagHandler, SelectPairForTagUi selectPairForTagUi,
|
||||
ServerConfigurationManager serverConfigurationManager, UiSharedService uiSharedService,
|
||||
PlayerPerformanceConfigService playerPerformanceConfigService, CharaDataManager charaDataManager)
|
||||
@@ -36,6 +37,7 @@ public class DrawEntityFactory
|
||||
_apiController = apiController;
|
||||
_uidDisplayHandler = uidDisplayHandler;
|
||||
_selectTagForPairUi = selectTagForPairUi;
|
||||
_renameTagUi = renameTagUi;
|
||||
_mediator = mediator;
|
||||
_tagHandler = tagHandler;
|
||||
_selectPairForTagUi = selectPairForTagUi;
|
||||
@@ -58,8 +60,8 @@ public class DrawEntityFactory
|
||||
Dictionary<Pair, List<GroupFullInfoDto>> filteredPairs,
|
||||
IImmutableList<Pair> allPairs)
|
||||
{
|
||||
return new(tag, filteredPairs.Select(u => CreateDrawPair(tag, u.Key, u.Value, null)).ToImmutableList(),
|
||||
allPairs, _tagHandler, _apiController, _selectPairForTagUi, _uiSharedService);
|
||||
return new(tag, filteredPairs.Select(u => CreateDrawPair(tag, u.Key, u.Value, currentGroup: null)).ToImmutableList(),
|
||||
allPairs, _tagHandler, _apiController, _selectPairForTagUi, _renameTagUi, _uiSharedService);
|
||||
}
|
||||
|
||||
public DrawUserPair CreateDrawPair(string id, Pair user, List<GroupFullInfoDto> groups, GroupFullInfoDto? currentGroup)
|
||||
|
||||
@@ -102,7 +102,7 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
_ownPermissions.SetDisableAnimations(disableAnimations);
|
||||
}
|
||||
_uiSharedService.DrawHelpText("Disabling sounds will remove all animations synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
_uiSharedService.DrawHelpText("Disabling animations will remove all animations synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user disabling animation sync will stop animation sync on both sides.");
|
||||
using (ImRaii.PushIndent(indentSize, false))
|
||||
{
|
||||
@@ -116,7 +116,7 @@ public class PermissionWindowUI : WindowMediatorSubscriberBase
|
||||
{
|
||||
_ownPermissions.SetDisableVFX(disableVfx);
|
||||
}
|
||||
_uiSharedService.DrawHelpText("Disabling sounds will remove all VFX synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
_uiSharedService.DrawHelpText("Disabling VFX will remove all VFX synced with this user on both sides." + UiSharedService.TooltipSeparator
|
||||
+ "Note: this is bidirectional, either user disabling VFX sync will stop VFX sync on both sides.");
|
||||
using (ImRaii.PushIndent(indentSize, false))
|
||||
{
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,9 +8,10 @@ namespace LightlessSync.UI
|
||||
private static readonly Dictionary<string, string> HexColors = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ "LightlessPurple", "#ad8af5" },
|
||||
{ "LightlessBlue", "#64c7e8" },
|
||||
{ "PairBlue", "#4e98b1" },
|
||||
{ "DimRed", "#bd0000" },
|
||||
{ "LightlessBlue", "#a6c2ff" },
|
||||
{ "LightlessYellow", "#ffe97a" },
|
||||
{ "PairBlue", "#88a2db" },
|
||||
{ "DimRed", "#d44444" },
|
||||
};
|
||||
|
||||
public static Vector4 Get(string name)
|
||||
|
||||
@@ -114,6 +114,15 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
SizePx = 35
|
||||
}));
|
||||
});
|
||||
|
||||
MediumFont = _pluginInterface.UiBuilder.FontAtlas.NewDelegateFontHandle(e =>
|
||||
{
|
||||
e.OnPreBuild(tk => tk.AddDalamudAssetFont(Dalamud.DalamudAsset.NotoSansJpMedium, new()
|
||||
{
|
||||
SizePx = 22,
|
||||
}));
|
||||
});
|
||||
|
||||
GameFont = _pluginInterface.UiBuilder.FontAtlas.NewGameFontHandle(new(GameFontFamilyAndSize.Axis12));
|
||||
IconFont = _pluginInterface.UiBuilder.IconFontFixedWidthHandle;
|
||||
}
|
||||
@@ -133,6 +142,8 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
public string PlayerName => _dalamudUtil.GetPlayerName();
|
||||
|
||||
public IFontHandle UidFont { get; init; }
|
||||
public IFontHandle MediumFont { get; init; }
|
||||
|
||||
public Dictionary<ushort, string> WorldData => _dalamudUtil.WorldData.Value;
|
||||
public uint WorldId => _dalamudUtil.GetHomeWorldId();
|
||||
|
||||
@@ -434,6 +445,79 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
FontText(text, UidFont, color);
|
||||
}
|
||||
|
||||
public void UnderlinedBigText(
|
||||
string text,
|
||||
Vector4? textColor = null,
|
||||
Vector4? underlineColor = null,
|
||||
float underlineThickness = 2f)
|
||||
{
|
||||
using var font = UidFont.Push();
|
||||
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
var textSize = ImGui.CalcTextSize(text);
|
||||
var pos = ImGui.GetCursorScreenPos();
|
||||
var text_color = textColor ?? ImGuiColors.DalamudWhite;
|
||||
var line_color = underlineColor ?? text_color;
|
||||
|
||||
ImGui.PushStyleColor(ImGuiCol.Text, text_color);
|
||||
ImGui.TextUnformatted(text);
|
||||
ImGui.PopStyleColor();
|
||||
|
||||
var lineY = pos.Y + textSize.Y + 2f;
|
||||
drawList.AddLine(
|
||||
new Vector2(pos.X, lineY),
|
||||
new Vector2(pos.X + textSize.X, lineY),
|
||||
ImGui.GetColorU32(line_color),
|
||||
underlineThickness * ImGuiHelpers.GlobalScale
|
||||
);
|
||||
}
|
||||
|
||||
public void ColoredSeparator(Vector4? color = null, float thickness = 1f, float indent = 0f)
|
||||
{
|
||||
var drawList = ImGui.GetWindowDrawList();
|
||||
var min = ImGui.GetCursorScreenPos();
|
||||
var max = new Vector2(min.X + ImGui.GetContentRegionAvail().X, min.Y);
|
||||
|
||||
min.X += indent;
|
||||
max.X -= indent;
|
||||
|
||||
drawList.AddLine(
|
||||
min,
|
||||
new Vector2(max.X, min.Y),
|
||||
ImGui.GetColorU32(color ?? ImGuiColors.DalamudGrey),
|
||||
thickness * ImGuiHelpers.GlobalScale
|
||||
);
|
||||
|
||||
ImGui.Dummy(new Vector2(0, thickness * ImGuiHelpers.GlobalScale));
|
||||
}
|
||||
|
||||
public void MediumText(string text, Vector4? color = null)
|
||||
{
|
||||
FontText(text, MediumFont, color);
|
||||
}
|
||||
|
||||
public bool MediumTreeNode(string label, Vector4? textColor = null, float lineWidth = 2f, ImGuiTreeNodeFlags flags = ImGuiTreeNodeFlags.SpanAvailWidth)
|
||||
{
|
||||
using var font = MediumFont.Push();
|
||||
var lineColor = textColor ?? ImGuiColors.DalamudWhite;
|
||||
|
||||
var textSize = ImGui.CalcTextSize(label);
|
||||
var cursorScreen = ImGui.GetCursorScreenPos();
|
||||
var cursorLocal = ImGui.GetCursorPos();
|
||||
|
||||
ImGui.GetWindowDrawList().AddLine(
|
||||
new Vector2(cursorScreen.X, cursorScreen.Y),
|
||||
new Vector2(cursorScreen.X, cursorScreen.Y + textSize.Y),
|
||||
ImGui.GetColorU32(lineColor),
|
||||
lineWidth * ImGuiHelpers.GlobalScale
|
||||
);
|
||||
|
||||
ImGui.SetCursorPosX(cursorLocal.X + 6f);
|
||||
using var color = ImRaii.PushColor(ImGuiCol.Text, lineColor);
|
||||
|
||||
return ImGui.TreeNodeEx(label, flags);
|
||||
}
|
||||
|
||||
public void BooleanToColoredIcon(bool value, bool inline = true)
|
||||
{
|
||||
using var colorgreen = ImRaii.PushColor(ImGuiCol.Text, UIColors.Get("LightlessBlue"), value);
|
||||
@@ -1085,6 +1169,7 @@ public partial class UiSharedService : DisposableMediatorSubscriberBase
|
||||
|
||||
UidFont.Dispose();
|
||||
GameFont.Dispose();
|
||||
MediumFont.Dispose();
|
||||
}
|
||||
|
||||
private static void CenterWindow(float width, float height, ImGuiCond cond = ImGuiCond.None)
|
||||
|
||||
Reference in New Issue
Block a user