-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to apply designs to player with doubl click.
- Loading branch information
1 parent
64c1f75
commit bfe50f4
Showing
5 changed files
with
80 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using Glamourer.Designs; | ||
using Glamourer.Interop; | ||
using Glamourer.Interop.Structs; | ||
using Glamourer.State; | ||
using OtterGui.Services; | ||
using Penumbra.GameData.Actors; | ||
|
||
namespace Glamourer.Services; | ||
|
||
public sealed class DesignApplier(StateManager stateManager, ObjectManager objects) : IService | ||
{ | ||
public void ApplyToPlayer(DesignBase design) | ||
{ | ||
var (player, data) = objects.PlayerData; | ||
if (!data.Valid) | ||
return; | ||
|
||
if (!stateManager.GetOrCreate(player, data.Objects[0], out var state)) | ||
return; | ||
|
||
stateManager.ApplyDesign(state, design, ApplySettings.ManualWithLinks); | ||
} | ||
|
||
public void ApplyToTarget(DesignBase design) | ||
{ | ||
var (player, data) = objects.TargetData; | ||
if (!data.Valid) | ||
return; | ||
|
||
if (!stateManager.GetOrCreate(player, data.Objects[0], out var state)) | ||
return; | ||
|
||
stateManager.ApplyDesign(state, design, ApplySettings.ManualWithLinks); | ||
} | ||
|
||
public void Apply(ActorIdentifier actor, DesignBase design) | ||
{ | ||
objects.Update(); | ||
Apply(actor, objects.TryGetValue(actor, out var d) ? d : ActorData.Invalid, design, ApplySettings.ManualWithLinks); | ||
} | ||
|
||
public void Apply(ActorIdentifier actor, DesignBase design, ApplySettings settings) | ||
{ | ||
objects.Update(); | ||
Apply(actor, objects.TryGetValue(actor, out var d) ? d : ActorData.Invalid, design, settings); | ||
} | ||
|
||
public void Apply(ActorIdentifier actor, ActorData data, DesignBase design) | ||
=> Apply(actor, data, design, ApplySettings.ManualWithLinks); | ||
|
||
public void Apply(ActorIdentifier actor, ActorData data, DesignBase design, ApplySettings settings) | ||
{ | ||
if (!actor.IsValid || !data.Valid) | ||
return; | ||
|
||
if (!stateManager.GetOrCreate(actor, data.Objects[0], out var state)) | ||
return; | ||
|
||
stateManager.ApplyDesign(state, design, ApplySettings.ManualWithLinks); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters