add vfx stuff handling

This commit is contained in:
Stanley Dimant
2023-04-20 10:45:30 +02:00
parent 2667a0b5d9
commit 890e7558c4
6 changed files with 119 additions and 17 deletions

View File

@@ -108,16 +108,18 @@ public class DrawGroupPair : DrawPairBase
var soundsDisabled = _fullInfoDto.GroupUserPermissions.IsDisableSounds();
var animDisabled = _fullInfoDto.GroupUserPermissions.IsDisableAnimations();
var vfxDisabled = _fullInfoDto.GroupUserPermissions.IsDisableVFX();
var individualSoundsDisabled = (_pair.UserPair?.OwnPermissions.IsDisableSounds() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableSounds() ?? false);
var individualAnimDisabled = (_pair.UserPair?.OwnPermissions.IsDisableAnimations() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableAnimations() ?? false);
var individualVFXDisabled = (_pair.UserPair?.OwnPermissions.IsDisableVFX() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableVFX() ?? false);
bool showInfo = (individualAnimDisabled || individualSoundsDisabled || animDisabled || soundsDisabled);
bool showPlus = _pair.UserPair == null;
bool showBars = (userIsOwner || (userIsModerator && !entryIsMod && !entryIsOwner)) || !_pair.IsPaused;
var spacing = ImGui.GetStyle().ItemSpacing.X;
var permIcon = (individualAnimDisabled || individualSoundsDisabled) ? FontAwesomeIcon.ExclamationTriangle
: ((soundsDisabled || animDisabled) ? FontAwesomeIcon.InfoCircle : FontAwesomeIcon.None);
var permIcon = (individualAnimDisabled || individualSoundsDisabled || individualVFXDisabled) ? FontAwesomeIcon.ExclamationTriangle
: ((soundsDisabled || animDisabled || vfxDisabled) ? FontAwesomeIcon.InfoCircle : FontAwesomeIcon.None);
var infoIconWidth = UiSharedService.GetIconSize(permIcon).X;
var plusButtonWidth = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Plus).X;
var barButtonWidth = UiSharedService.GetIconButtonSize(FontAwesomeIcon.Bars).X;
@@ -162,6 +164,17 @@ public class DrawGroupPair : DrawPairBase
ImGui.Text("You: " + (_pair.UserPair!.OwnPermissions.IsDisableAnimations() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableAnimations() ? "Disabled" : "Enabled"));
}
if (individualVFXDisabled)
{
var userVFXText = "VFX sync disabled with " + _pair.UserData.AliasOrUID;
UiSharedService.FontText(FontAwesomeIcon.Circle.ToIconString(), UiBuilder.IconFont);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.Text(userVFXText);
ImGui.NewLine();
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.Text("You: " + (_pair.UserPair!.OwnPermissions.IsDisableVFX() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableVFX() ? "Disabled" : "Enabled"));
}
ImGui.EndTooltip();
}
ImGui.SameLine();
@@ -192,6 +205,14 @@ public class DrawGroupPair : DrawPairBase
ImGui.Text(userAnimText);
}
if (vfxDisabled)
{
var userVFXText = "VFX sync disabled by " + _pair.UserData.AliasOrUID;
UiSharedService.FontText(FontAwesomeIcon.Circle.ToIconString(), UiBuilder.IconFont);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.Text(userVFXText);
}
ImGui.EndTooltip();
}
ImGui.SameLine();

View File

@@ -80,8 +80,9 @@ public class DrawUserPair : DrawPairBase
{
var individualSoundsDisabled = (_pair.UserPair?.OwnPermissions.IsDisableSounds() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableSounds() ?? false);
var individualAnimDisabled = (_pair.UserPair?.OwnPermissions.IsDisableAnimations() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableAnimations() ?? false);
var individualVFXDisabled = (_pair.UserPair?.OwnPermissions.IsDisableVFX() ?? false) || (_pair.UserPair?.OtherPermissions.IsDisableVFX() ?? false);
if (individualAnimDisabled || individualSoundsDisabled)
if (individualAnimDisabled || individualSoundsDisabled || individualVFXDisabled)
{
var infoIconPosDist = windowEndX - barButtonSize.X - spacingX - pauseIconSize.X - spacingX;
var icon = FontAwesomeIcon.ExclamationTriangle;
@@ -121,6 +122,17 @@ public class DrawUserPair : DrawPairBase
ImGui.Text("You: " + (_pair.UserPair!.OwnPermissions.IsDisableAnimations() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableAnimations() ? "Disabled" : "Enabled"));
}
if (individualVFXDisabled)
{
var userVFXText = "VFX sync disabled with " + _pair.UserData.AliasOrUID;
UiSharedService.FontText(FontAwesomeIcon.Circle.ToIconString(), UiBuilder.IconFont);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.Text(userVFXText);
ImGui.NewLine();
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.Text("You: " + (_pair.UserPair!.OwnPermissions.IsDisableVFX() ? "Disabled" : "Enabled") + ", They: " + (_pair.UserPair!.OtherPermissions.IsDisableVFX() ? "Disabled" : "Enabled"));
}
ImGui.EndTooltip();
}
}
@@ -216,6 +228,16 @@ public class DrawUserPair : DrawPairBase
_ = _apiController.UserSetPairPermissions(new UserPermissionsDto(entry.UserData, permissions));
}
var isDisableVFX = entry.UserPair!.OwnPermissions.IsDisableVFX();
string disableVFXText = isDisableAnims ? "Enable VFX sync" : "Disable VFX sync";
var disableVFXIcon = isDisableAnims ? FontAwesomeIcon.Sun : FontAwesomeIcon.Circle;
if (UiSharedService.IconTextButton(disableVFXIcon, disableVFXText))
{
var permissions = entry.UserPair.OwnPermissions;
permissions.SetDisableVFX(!isDisableVFX);
_ = _apiController.UserSetPairPermissions(new UserPermissionsDto(entry.UserData, permissions));
}
if (UiSharedService.IconTextButton(FontAwesomeIcon.Trash, "Unpair Permanently") && UiSharedService.CtrlPressed())
{
_ = _apiController.UserRemovePair(new(entry.UserData));

View File

@@ -465,17 +465,21 @@ internal sealed class GroupPanel
bool invitesEnabled = !groupDto.GroupPermissions.IsDisableInvites();
var soundsDisabled = groupDto.GroupPermissions.IsDisableSounds();
var animDisabled = groupDto.GroupPermissions.IsDisableAnimations();
var vfxDisabled = groupDto.GroupPermissions.IsDisableVFX();
var userSoundsDisabled = groupDto.GroupUserPermissions.IsDisableSounds();
var userAnimDisabled = groupDto.GroupUserPermissions.IsDisableAnimations();
var userVFXDisabled = groupDto.GroupUserPermissions.IsDisableVFX();
bool showInfoIcon = !invitesEnabled || soundsDisabled || animDisabled || userSoundsDisabled || userAnimDisabled;
bool showInfoIcon = !invitesEnabled || soundsDisabled || animDisabled || vfxDisabled || userSoundsDisabled || userAnimDisabled || userVFXDisabled;
var lockedIcon = invitesEnabled ? FontAwesomeIcon.LockOpen : FontAwesomeIcon.Lock;
var animIcon = animDisabled ? FontAwesomeIcon.Stop : FontAwesomeIcon.Running;
var soundsIcon = soundsDisabled ? FontAwesomeIcon.VolumeOff : FontAwesomeIcon.VolumeUp;
var vfxIcon = vfxDisabled ? FontAwesomeIcon.Circle : FontAwesomeIcon.Sun;
var userAnimIcon = userAnimDisabled ? FontAwesomeIcon.Stop : FontAwesomeIcon.Running;
var userSoundsIcon = userSoundsDisabled ? FontAwesomeIcon.VolumeOff : FontAwesomeIcon.VolumeUp;
var userVFXIcon = userVFXDisabled ? FontAwesomeIcon.Circle : FontAwesomeIcon.Sun;
var iconSize = UiSharedService.GetIconSize(infoIcon);
var diffLockUnlockIcons = showInfoIcon ? (UiSharedService.GetIconSize(infoIcon).X - iconSize.X) / 2 : 0;
@@ -489,7 +493,7 @@ internal sealed class GroupPanel
if (ImGui.IsItemHovered())
{
ImGui.BeginTooltip();
if (!invitesEnabled || soundsDisabled || animDisabled)
if (!invitesEnabled || soundsDisabled || animDisabled || vfxDisabled)
{
ImGui.Text("Syncshell permissions");
@@ -516,11 +520,19 @@ internal sealed class GroupPanel
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.Text(animText);
}
if (vfxDisabled)
{
var vfxText = "VFX sync disabled through owner";
UiSharedService.FontText(vfxIcon.ToIconString(), UiBuilder.IconFont);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.Text(vfxText);
}
}
if (userSoundsDisabled || userAnimDisabled)
if (userSoundsDisabled || userAnimDisabled || userVFXDisabled)
{
if (!invitesEnabled || soundsDisabled || animDisabled)
if (!invitesEnabled || soundsDisabled || animDisabled || vfxDisabled)
ImGui.Separator();
ImGui.Text("Your permissions");
@@ -541,7 +553,15 @@ internal sealed class GroupPanel
ImGui.Text(userAnimText);
}
if (!invitesEnabled || soundsDisabled || animDisabled)
if (userVFXDisabled)
{
var userVFXText = "VFX sync disabled through you";
UiSharedService.FontText(userVFXIcon.ToIconString(), UiBuilder.IconFont);
ImGui.SameLine(40 * ImGuiHelpers.GlobalScale);
ImGui.Text(userVFXText);
}
if (!invitesEnabled || soundsDisabled || animDisabled || vfxDisabled)
UiSharedService.TextWrapped("Note that syncshell permissions for disabling take precedence over your own set permissions");
}
ImGui.EndTooltip();
@@ -605,6 +625,20 @@ internal sealed class GroupPanel
+ Environment.NewLine + "Note: this setting can be forcefully overridden to 'disabled' through the syncshell owner."
+ Environment.NewLine + "Note: this setting does not apply to individual pairs that are also in the syncshell.");
var vfxText = userVFXDisabled ? "Enable VFX sync" : "Disable VFX sync";
if (UiSharedService.IconTextButton(userAnimIcon, vfxText))
{
ImGui.CloseCurrentPopup();
var perm = groupDto.GroupUserPermissions;
perm.SetDisableVFX(!perm.IsDisableVFX());
_ = ApiController.GroupChangeIndividualPermissionState(new(groupDto.Group, new UserData(ApiController.UID), perm));
}
UiSharedService.AttachToolTip("Sets your allowance for VFX synchronization for users of this syncshell."
+ Environment.NewLine + "Disabling the synchronization will stop applying VFX modifications for users of this syncshell."
+ Environment.NewLine + "Note: this setting might also affect animation synchronization to some degree"
+ Environment.NewLine + "Note: this setting can be forcefully overridden to 'disabled' through the syncshell owner."
+ Environment.NewLine + "Note: this setting does not apply to individual pairs that are also in the syncshell.");
if (isOwner || groupDto.GroupUserInfo.IsModerator())
{
ImGui.Separator();
@@ -662,6 +696,18 @@ internal sealed class GroupPanel
+ "Note: users that are individually paired with others in the syncshell will ignore this setting." + Environment.NewLine
+ "Note: if the synchronization is enabled, users can individually override this setting to disabled.");
var groupVFXText = vfxDisabled ? "Enable syncshell VFX sync" : "Disable syncshell VFX sync";
if (UiSharedService.IconTextButton(vfxIcon, groupVFXText))
{
ImGui.CloseCurrentPopup();
var perm = groupDto.GroupPermissions;
perm.SetDisableVFX(!perm.IsDisableVFX());
_ = ApiController.GroupChangeGroupPermissionState(new(groupDto.Group, perm));
}
UiSharedService.AttachToolTip("Sets syncshell-wide allowance for VFX synchronization for all users." + Environment.NewLine
+ "Note: users that are individually paired with others in the syncshell will ignore this setting." + Environment.NewLine
+ "Note: if the synchronization is enabled, users can individually override this setting to disabled.");
if (UiSharedService.IconTextButton(FontAwesomeIcon.Envelope, "Single one-time invite"))
{
ImGui.CloseCurrentPopup();