Added Feel plugin

This commit is contained in:
journaliciouz
2025-12-11 14:49:16 +01:00
parent 97dce4aaf6
commit 1942a531d4
2820 changed files with 257786 additions and 9 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 45ecfa47ab5e26f459c0b53c2db0d2d3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,92 @@
using System;
using System.Collections;
using System.Collections.Generic;
using MoreMountains.Feedbacks;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UIElements;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback is a base for UI Toolkit feedbacks
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback is a base for UI Toolkit feedbacks")]
public class MMF_UIToolkit : MMF_Feedback
{
/// a static bool used to disable all feedbacks of this type at once
public static bool FeedbackTypeAuthorized = true;
/// sets the inspector color for this feedback
#if UNITY_EDITOR
public override Color FeedbackColor { get { return MMFeedbacksInspectorColors.UIColor; } }
public override bool EvaluateRequiresSetup() { return (TargetDocument == null); }
public override string RequiredTargetText { get { return TargetDocument != null ? TargetDocument.name : ""; } }
public override string RequiresSetupText { get { return "This feedback requires a target UI Document, set one in the TargetDocument field below"; } }
#endif
public override bool HasAutomatedTargetAcquisition => true;
protected override void AutomateTargetAcquisition() => TargetDocument = FindAutomatedTarget<UIDocument>();
public enum QueryModes { Name, Class }
[MMFInspectorGroup("Target", true, 54, true)]
/// the UI document on which to make modifications
[Tooltip("the UI document on which to make modifications")]
public UIDocument TargetDocument;
/// the way to perform the query, either via element name or via class
[Tooltip("the way to perform the query, either via element name or via class")]
public QueryModes QueryMode = QueryModes.Name;
/// the query to perform (replace this with your own element name or class)
[Tooltip("the query to perform (replace this with your own element name or class)")]
public string Query = "ButtonA";
/// whether to mark the UI document dirty after the operation. Set this to true when making a change that requires a repaint such as when using generateVisualContent to render a mesh and the mesh data has now changed.
[Tooltip("whether to mark the UI document dirty after the operation. Set this to true when making a change that requires a repaint such as when using generateVisualContent to render a mesh and the mesh data has now changed.")]
public bool MarkDirty = false;
protected List<VisualElement> _visualElements = new List<VisualElement>();
/// <summary>
/// On init we turn the Image off if needed
/// </summary>
/// <param name="owner"></param>
protected override void CustomInitialization(MMF_Player owner)
{
base.CustomInitialization(owner);
PerformQuery();
}
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1)
{
}
/// <summary>
/// Performs the query and sets _visualElements with the result
/// </summary>
protected virtual void PerformQuery()
{
if (TargetDocument == null)
{
Debug.LogWarning("[UI Toolkit] The UI Toolkit feedback on "+Owner.name+" doesn't have a TargetDocument, it won't work. You need to specify one in its inspector.");
return;
}
switch (QueryMode)
{
case QueryModes.Name:
_visualElements = TargetDocument.rootVisualElement.Query(Query).ToList();
break;
case QueryModes.Class:
_visualElements = TargetDocument.rootVisualElement.Query(className: Query).ToList();
break;
}
}
protected virtual void HandleMarkDirty(VisualElement element)
{
if (MarkDirty)
{
element.MarkDirtyRepaint();
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 26da15f4b3a68a54295a67aede05e70b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Base/MMF_UIToolkit.cs
uploadId: 830868

View File

@@ -0,0 +1,97 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UIElements;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// A base feedback to set a bool on a target UI Document
/// </summary>
[AddComponentMenu("")]
public class MMF_UIToolkitBoolBase : MMF_UIToolkit
{
/// the duration of this feedback is the duration of the color transition, or 0 if instant
public override float FeedbackDuration { get { return 0f; }}
public override bool HasCustomInspectors => true;
protected bool _initialValue;
/// <summary>
/// On init we store our initial value
/// </summary>
/// <param name="owner"></param>
protected override void CustomInitialization(MMF_Player owner)
{
base.CustomInitialization(owner);
if ((_visualElements == null) || (_visualElements.Count == 0))
{
return;
}
_initialValue = GetInitialValue();
}
/// <summary>
/// On Play we change our text's alpha
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
if ((_visualElements == null) || (_visualElements.Count == 0))
{
return;
}
SetValue();
}
/// <summary>
/// Stops the animation if needed
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
IsPlaying = false;
}
protected virtual void SetValue()
{
}
protected virtual void SetValue(bool newValue)
{
}
protected virtual bool GetInitialValue()
{
return false;
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
SetValue(_initialValue);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 267821bdecaf2b14993cc3df8c285df5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Base/MMF_UIToolkitBoolBase.cs
uploadId: 830868

View File

@@ -0,0 +1,244 @@
using System.Collections;
using MoreMountains.Feedbacks;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UIElements;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// A base feedback to set a color on a target UI Document
/// </summary>
[AddComponentMenu("")]
public class MMF_UIToolkitColorBase : MMF_UIToolkit
{
/// the duration of this feedback is whatever value's been defined for it
public override float FeedbackDuration { get { return (Mode == Modes.Instant) ? 0f : ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasChannel => true;
/// the possible modes for this feedback
public enum Modes { OverTime, Instant }
[MMFInspectorGroup("Color", true, 55, true)]
/// whether the feedback should affect the Image instantly or over a period of time
[Tooltip("whether the feedback should affect the Image instantly or over a period of time")]
public Modes Mode = Modes.OverTime;
/// how long the Image should change over time
[Tooltip("how long the Image should change over time")]
[MMFEnumCondition("Mode", (int)Modes.OverTime)]
public float Duration = 0.2f;
/// if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over
[Tooltip("if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over")]
public bool AllowAdditivePlays = false;
/// whether or not to modify the color of the image
[Tooltip("whether or not to modify the color of the image")]
public bool ModifyColor = true;
/// the colors to apply to the Image over time
[Tooltip("the colors to apply to the Image over time")]
[MMFEnumCondition("Mode", (int)Modes.OverTime)]
public Gradient ColorOverTime =
new Gradient()
{
colorKeys = new GradientColorKey[]
{
new GradientColorKey(Color.white, 0f),
new GradientColorKey(Color.red, 0.5f),
new GradientColorKey(Color.white, 1f)
},
alphaKeys = new GradientAlphaKey[]
{
new GradientAlphaKey(1f, 0f),
new GradientAlphaKey(1f, 0.5f),
new GradientAlphaKey(1f, 1f)
}
};
/// the color to move to in instant mode
[Tooltip("the color to move to in instant mode")]
[MMFEnumCondition("Mode", (int)Modes.Instant)]
public Color InstantColor;
/// if this is true, the initial color will be applied to the gradient start
[Tooltip("if this is true, the initial color will be applied to the gradient start")]
[MMFEnumCondition("Mode", (int)Modes.OverTime)]
public bool ApplyInitialColorToGradientStart = false;
/// if this is true, the initial color will be applied to the gradient end
[Tooltip("if this is true, the initial color will be applied to the gradient end")]
[MMFEnumCondition("Mode", (int)Modes.OverTime)]
public bool ApplyInitialColorToGradientEnd = false;
/// if this is true, the initial color will be applied to the gradient start and end on play
[FormerlySerializedAs("GrabInitialColorsOnPlay")]
[Tooltip("if this is true, the initial color will be applied to the gradient start and end on play")]
[MMFEnumCondition("Mode", (int)Modes.OverTime)]
public bool ApplyInitialColorsOnPlay = true;
protected Coroutine _coroutine;
protected Color _initialColor;
protected Color _initialInstantColor;
/// <summary>
/// On init we turn the Image off if needed
/// </summary>
/// <param name="owner"></param>
protected override void CustomInitialization(MMF_Player owner)
{
base.CustomInitialization(owner);
HandleApplyInitialColors();
if ((_visualElements == null) || (_visualElements.Count == 0))
{
return;
}
_initialInstantColor = GetInitialColor();
}
protected virtual void HandleApplyInitialColors()
{
var colorKeys = ColorOverTime.colorKeys;
var alphaKeys = ColorOverTime.alphaKeys;
if (ApplyInitialColorToGradientStart)
{
colorKeys[0] = new GradientColorKey(GetInitialColor(),0f);
alphaKeys[0] = new GradientAlphaKey(GetInitialColor().a,0f);
}
if (ApplyInitialColorToGradientEnd)
{
int lastIndex = ColorOverTime.colorKeys.Length - 1;
colorKeys[lastIndex] = new GradientColorKey(GetInitialColor(),1f);
alphaKeys[lastIndex] = new GradientAlphaKey(GetInitialColor().a,1f);
}
if (ApplyInitialColorToGradientEnd || ApplyInitialColorToGradientStart)
{
ColorOverTime.SetKeys(colorKeys, alphaKeys);
}
}
protected virtual void ApplyColor(Color newColor)
{
}
protected virtual Color GetInitialColor()
{
return Color.white;
}
/// <summary>
/// On Play we turn our Image on and start an over time coroutine if needed
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
if ((_visualElements == null) || (_visualElements.Count == 0))
{
return;
}
_initialColor = GetInitialColor();
if (ApplyInitialColorsOnPlay)
{
HandleApplyInitialColors();
}
switch (Mode)
{
case Modes.Instant:
if (ModifyColor)
{
if (NormalPlayDirection)
{
ApplyColor(InstantColor);
}
else
{
ApplyColor(_initialInstantColor);
}
}
break;
case Modes.OverTime:
if (!AllowAdditivePlays && (_coroutine != null))
{
return;
}
if (_coroutine != null) { Owner.StopCoroutine(_coroutine); }
_coroutine = Owner.StartCoroutine(ImageSequence());
break;
}
}
/// <summary>
/// This coroutine will modify the values on the Image
/// </summary>
/// <returns></returns>
protected virtual IEnumerator ImageSequence()
{
float journey = NormalPlayDirection ? 0f : FeedbackDuration;
IsPlaying = true;
while ((journey >= 0) && (journey <= FeedbackDuration) && (FeedbackDuration > 0))
{
float remappedTime = MMFeedbacksHelpers.Remap(journey, 0f, FeedbackDuration, 0f, 1f);
SetImageValues(remappedTime);
journey += NormalPlayDirection ? FeedbackDeltaTime : -FeedbackDeltaTime;
yield return null;
}
SetImageValues(FinalNormalizedTime);
IsPlaying = false;
_coroutine = null;
yield return null;
}
/// <summary>
/// Sets the various values on the sprite renderer on a specified time (between 0 and 1)
/// </summary>
/// <param name="time"></param>
protected virtual void SetImageValues(float time)
{
if (ModifyColor)
{
ApplyColor(ColorOverTime.Evaluate(time));
}
}
/// <summary>
/// Turns the sprite renderer off on stop
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
IsPlaying = false;
base.CustomStopFeedback(position, feedbacksIntensity);
_coroutine = null;
}
/// <summary>
/// On restore, we restore our initial state
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
ApplyColor(_initialColor);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: f642848870e854947bbbb090be8948d7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Base/MMF_UIToolkitColorBase.cs
uploadId: 830868

View File

@@ -0,0 +1,234 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UIElements;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// A base feedback to set a float on a target UI Document
/// </summary>
[AddComponentMenu("")]
public class MMF_UIToolkitFloatBase : MMF_UIToolkit
{
/// a static bool used to disable all feedbacks of this type at once
public enum Modes { Instant, Interpolate, ToDestination }
/// the duration of this feedback is the duration of the color transition, or 0 if instant
public override float FeedbackDuration { get { return (Mode == Modes.Instant) ? 0f : ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasCustomInspectors => true;
[MMFInspectorGroup("Value", true, 16)]
/// the selected color mode :
/// None : nothing will happen,
/// gradient : evaluates the color over time on that gradient, from left to right,
/// interpolate : lerps from the current color to the destination one
[Tooltip("the selected mode :" +
"Instant : the value will change instantly to the target one," +
"Curve : the value will be interpolated along the curve," +
"interpolate : lerps from the current value to the destination one ")]
public Modes Mode = Modes.Interpolate;
/// whether or not the value should be applied relatively to the initial value
[Tooltip("whether or not the value should be applied relatively to the initial value")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate, (int)Modes.Instant)]
public bool RelativeValue = false;
/// if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over
[Tooltip("if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over")]
public bool AllowAdditivePlays = false;
/// how long the color of the text should change over time
[Tooltip("how long the color of the text should change over time")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate, (int)Modes.ToDestination)]
public float Duration = 0.2f;
/// the value to apply when in instant mode
[Tooltip("the value to apply when in instant mode")]
[MMFEnumCondition("Mode", (int)Modes.Instant)]
public float InstantValue = 1f;
/// the curve to use when interpolating towards the destination value
[Tooltip("the curve to use when interpolating towards the destination value")]
public MMTweenType Curve = new MMTweenType(MMTween.MMTweenCurve.EaseInCubic, "", "Mode", (int)Modes.Interpolate, (int)Modes.ToDestination);
/// the value to which the curve's 0 should be remapped
[Tooltip("the value to which the curve's 0 should be remapped")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate)]
public float CurveRemapZero = 0f;
/// the value to which the curve's 1 should be remapped
[Tooltip("the value to which the curve's 1 should be remapped")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate)]
public float CurveRemapOne = 1f;
/// the value to aim towards when in ToDestination mode
[Tooltip("the value to aim towards when in ToDestination mode")]
[MMFEnumCondition("Mode", (int)Modes.ToDestination)]
public float DestinationValue = 1f;
protected float _initialValue;
protected Coroutine _coroutine;
/// <summary>
/// On init we store our initial value
/// </summary>
/// <param name="owner"></param>
protected override void CustomInitialization(MMF_Player owner)
{
base.CustomInitialization(owner);
if ((_visualElements == null) || (_visualElements.Count == 0))
{
return;
}
_initialValue = GetInitialValue();
}
/// <summary>
/// On Play we change our text's alpha
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
if ((_visualElements == null) || (_visualElements.Count == 0))
{
return;
}
if (RelativeValue)
{
_initialValue = GetInitialValue();
}
switch (Mode)
{
case Modes.Instant:
float newInstantValue = RelativeValue ? InstantValue + _initialValue : InstantValue;
if (!NormalPlayDirection)
{
newInstantValue = _initialValue;
}
SetValue(newInstantValue);
break;
case Modes.Interpolate:
if (!AllowAdditivePlays && (_coroutine != null))
{
return;
}
if (_coroutine != null) { Owner.StopCoroutine(_coroutine); }
_coroutine = Owner.StartCoroutine(ChangeValue());
break;
case Modes.ToDestination:
if (!AllowAdditivePlays && (_coroutine != null))
{
return;
}
_initialValue = GetInitialValue();
if (_coroutine != null) { Owner.StopCoroutine(_coroutine); }
_coroutine = Owner.StartCoroutine(ChangeValue());
break;
}
}
/// <summary>
/// Changes the color of the text over time
/// </summary>
/// <returns></returns>
protected virtual IEnumerator ChangeValue()
{
float journey = NormalPlayDirection ? 0f : FeedbackDuration;
IsPlaying = true;
while ((journey >= 0) && (journey <= FeedbackDuration) && (FeedbackDuration > 0))
{
float remappedTime = MMFeedbacksHelpers.Remap(journey, 0f, FeedbackDuration, 0f, 1f);
ApplyTime(remappedTime);
journey += NormalPlayDirection ? FeedbackDeltaTime : -FeedbackDeltaTime;
yield return null;
}
ApplyTime(FinalNormalizedTime);
_coroutine = null;
IsPlaying = false;
yield break;
}
/// <summary>
/// Stops the animation if needed
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
IsPlaying = false;
if (_coroutine != null)
{
Owner.StopCoroutine(_coroutine);
_coroutine = null;
}
}
/// <summary>
/// Applies the alpha change
/// </summary>
/// <param name="time"></param>
protected virtual void ApplyTime(float time)
{
float newValue = 0f;
if (Mode == Modes.Interpolate)
{
float startValue = RelativeValue ? CurveRemapZero + _initialValue : CurveRemapZero;
float endValue = RelativeValue ? CurveRemapOne + _initialValue : CurveRemapOne;
newValue = MMTween.Tween(time, 0f, 1f, startValue, endValue, Curve);
}
else if (Mode == Modes.ToDestination)
{
newValue = MMTween.Tween(time, 0f, 1f, _initialValue, DestinationValue, Curve);
}
SetValue(newValue);
}
protected virtual void SetValue(float newValue)
{
}
protected virtual float GetInitialValue()
{
return 0f;
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
SetValue(_initialValue);
}
/// <summary>
/// On Validate, we init our curves conditions if needed
/// </summary>
public override void OnValidate()
{
base.OnValidate();
if (string.IsNullOrEmpty(Curve.EnumConditionPropertyName))
{
Curve.EnumConditionPropertyName = "Mode";
Curve.EnumConditions = new bool[32];
Curve.EnumConditions[(int)Modes.Interpolate] = true;
Curve.EnumConditions[(int)Modes.ToDestination] = true;
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 889e935e9689c09488cc64807a889d5e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Base/MMF_UIToolkitFloatBase.cs
uploadId: 830868

View File

@@ -0,0 +1,284 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UIElements;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// A base feedback to set a vector2 on a target UI Document
/// </summary>
[AddComponentMenu("")]
public class MMF_UIToolkitVector2Base : MMF_UIToolkit
{
/// a static bool used to disable all feedbacks of this type at once
public enum Modes { Instant, Interpolate, ToDestination }
/// the duration of this feedback is the duration of the color transition, or 0 if instant
public override float FeedbackDuration { get { return (Mode == Modes.Instant) ? 0f : ApplyTimeMultiplier(Duration); } set { Duration = value; } }
public override bool HasCustomInspectors => true;
[MMFInspectorGroup("Value", true, 16)]
/// the selected color mode :
/// None : nothing will happen,
/// gradient : evaluates the color over time on that gradient, from left to right,
/// interpolate : lerps from the current color to the destination one
[Tooltip("the selected mode :" +
"Instant : the value will change instantly to the target one," +
"Curve : the value will be interpolated along the curve," +
"interpolate : lerps from the current value to the destination one ")]
public Modes Mode = Modes.Interpolate;
/// whether or not the value should be applied relatively to the initial value
[Tooltip("whether or not the value should be applied relatively to the initial value")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate, (int)Modes.Instant)]
public bool RelativeValues = false;
/// if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over
[Tooltip("if this is true, calling that feedback will trigger it, even if it's in progress. If it's false, it'll prevent any new Play until the current one is over")]
public bool AllowAdditivePlays = false;
/// how long the color of the text should change over time
[Tooltip("how long the color of the text should change over time")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate, (int)Modes.ToDestination)]
public float Duration = 0.2f;
/// the value to apply when in instant mode
[Tooltip("the value to apply when in instant mode")]
[MMFEnumCondition("Mode", (int)Modes.Instant)]
public Vector2 InstantValue = new Vector2(1f, 1f);
[Header("X")]
/// whether or not to animate the x value
[Tooltip("whether or not to animate the x value")]
public bool AnimateX = true;
/// the curve to use when interpolating towards the destination value
[Tooltip("the curve to use when interpolating towards the destination value")]
public MMTweenType CurveX = new MMTweenType(MMTween.MMTweenCurve.EaseInCubic, "", "Mode", (int)Modes.Interpolate, (int)Modes.ToDestination);
/// the value to which the curve's 0 should be remapped
[Tooltip("the value to which the curve's 0 should be remapped")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate)]
public float CurveRemapZeroX = 0f;
/// the value to which the curve's 1 should be remapped
[Tooltip("the value to which the curve's 1 should be remapped")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate)]
public float CurveRemapOneX = 1f;
/// the value to aim towards when in ToDestination mode
[Tooltip("the value to aim towards when in ToDestination mode")]
[MMFEnumCondition("Mode", (int)Modes.ToDestination)]
public float DestinationValueX = 1f;
[Header("Y")]
/// whether or not to animate the y value
[Tooltip("whether or not to animate the y value")]
public bool AnimateY = true;
/// the curve to use when interpolating towards the destination value
[Tooltip("the curve to use when interpolating towards the destination value")]
public MMTweenType CurveY = new MMTweenType(MMTween.MMTweenCurve.EaseInCubic, "", "Mode", (int)Modes.Interpolate, (int)Modes.ToDestination);
/// the value to which the curve's 0 should be remapped
[Tooltip("the value to which the curve's 0 should be remapped")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate)]
public float CurveRemapZeroY = 0f;
/// the value to which the curve's 1 should be remapped
[Tooltip("the value to which the curve's 1 should be remapped")]
[MMFEnumCondition("Mode", (int)Modes.Interpolate)]
public float CurveRemapOneY = 1f;
/// the value to aim towards when in ToDestination mode
[Tooltip("the value to aim towards when in ToDestination mode")]
[MMFEnumCondition("Mode", (int)Modes.ToDestination)]
public float DestinationValueY = 1f;
protected Vector2 _initialValue;
protected Coroutine _coroutine;
protected Vector2 _newValue;
/// <summary>
/// On init we store our initial value
/// </summary>
/// <param name="owner"></param>
protected override void CustomInitialization(MMF_Player owner)
{
base.CustomInitialization(owner);
if ((_visualElements == null) || (_visualElements.Count == 0))
{
return;
}
_initialValue = GetInitialValue();
}
/// <summary>
/// On Play we change our text's alpha
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1.0f)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
if ((_visualElements == null) || (_visualElements.Count == 0))
{
return;
}
if (RelativeValues)
{
_initialValue = GetInitialValue();
}
switch (Mode)
{
case Modes.Instant:
Vector2 newInstantValue = RelativeValues ? InstantValue + _initialValue : InstantValue;
if (!NormalPlayDirection)
{
newInstantValue = _initialValue;
}
SetValue(newInstantValue);
break;
case Modes.Interpolate:
if (!AllowAdditivePlays && (_coroutine != null))
{
return;
}
if (_coroutine != null) { Owner.StopCoroutine(_coroutine); }
_coroutine = Owner.StartCoroutine(ChangeValue());
break;
case Modes.ToDestination:
if (!AllowAdditivePlays && (_coroutine != null))
{
return;
}
_initialValue = GetInitialValue();
if (_coroutine != null) { Owner.StopCoroutine(_coroutine); }
_coroutine = Owner.StartCoroutine(ChangeValue());
break;
}
}
/// <summary>
/// Changes the color of the text over time
/// </summary>
/// <returns></returns>
protected virtual IEnumerator ChangeValue()
{
float journey = NormalPlayDirection ? 0f : FeedbackDuration;
IsPlaying = true;
while ((journey >= 0) && (journey <= FeedbackDuration) && (FeedbackDuration > 0))
{
float remappedTime = MMFeedbacksHelpers.Remap(journey, 0f, FeedbackDuration, 0f, 1f);
ApplyTime(remappedTime);
journey += NormalPlayDirection ? FeedbackDeltaTime : -FeedbackDeltaTime;
yield return null;
}
ApplyTime(FinalNormalizedTime);
_coroutine = null;
IsPlaying = false;
yield break;
}
/// <summary>
/// Stops the animation if needed
/// </summary>
/// <param name="position"></param>
/// <param name="feedbacksIntensity"></param>
protected override void CustomStopFeedback(Vector3 position, float feedbacksIntensity = 1)
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
base.CustomStopFeedback(position, feedbacksIntensity);
IsPlaying = false;
if (_coroutine != null)
{
Owner.StopCoroutine(_coroutine);
_coroutine = null;
}
}
/// <summary>
/// Applies the alpha change
/// </summary>
/// <param name="time"></param>
protected virtual void ApplyTime(float time)
{
_newValue.x = _initialValue.x;
_newValue.y = _initialValue.y;
if (Mode == Modes.Interpolate)
{
if (AnimateX)
{
float startValueX = RelativeValues ? CurveRemapZeroX + _initialValue.x : CurveRemapZeroX;
float endValueX = RelativeValues ? CurveRemapOneX + _initialValue.x : CurveRemapOneX;
_newValue.x = MMTween.Tween(time, 0f, 1f, startValueX, endValueX, CurveX);
}
if (AnimateY)
{
float startValueY = RelativeValues ? CurveRemapZeroY + _initialValue.y : CurveRemapZeroY;
float endValueY = RelativeValues ? CurveRemapOneY + _initialValue.y : CurveRemapOneY;
_newValue.y = MMTween.Tween(time, 0f, 1f, startValueY, endValueY, CurveY);
}
}
else if (Mode == Modes.ToDestination)
{
if (AnimateX)
{
_newValue.x = MMTween.Tween(time, 0f, 1f, _initialValue.x, DestinationValueX, CurveX);
}
if (AnimateY)
{
_newValue.y = MMTween.Tween(time, 0f, 1f, _initialValue.y, DestinationValueY, CurveY);
}
}
SetValue(_newValue);
}
protected virtual void SetValue(Vector2 newValue)
{
}
protected virtual Vector2 GetInitialValue()
{
return Vector2.zero;
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
SetValue(_initialValue);
}
/// <summary>
/// On Validate, we init our curves conditions if needed
/// </summary>
public override void OnValidate()
{
base.OnValidate();
if (string.IsNullOrEmpty(CurveX.EnumConditionPropertyName))
{
CurveX.EnumConditionPropertyName = "Mode";
CurveX.EnumConditions = new bool[32];
CurveX.EnumConditions[(int)Modes.Interpolate] = true;
CurveX.EnumConditions[(int)Modes.ToDestination] = true;
CurveY.EnumConditions = new bool[32];
CurveY.EnumConditionPropertyName = "Mode";
CurveY.EnumConditions[(int)Modes.Interpolate] = true;
CurveY.EnumConditions[(int)Modes.ToDestination] = true;
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 2ac2960c7e2121849bdf55de52559dd9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Base/MMF_UIToolkitVector2Base.cs
uploadId: 830868

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 89ff2eae561a5ac4392fc023b51034c5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
using System.Collections;
using MoreMountains.Feedbacks;
using UnityEngine;
using UnityEngine.Scripting.APIUpdating;
using UnityEngine.UIElements;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the background color of an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the background color of an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Background Color")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitBackgroundColor : MMF_UIToolkitColorBase
{
protected override void ApplyColor(Color newColor)
{
foreach (VisualElement element in _visualElements)
{
element.style.backgroundColor = newColor;
HandleMarkDirty(element);
}
}
protected override Color GetInitialColor()
{
return _visualElements[0].resolvedStyle.backgroundColor;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: a191453c9f5a69348a9014eb1f7a35d7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitBackgroundColor.cs
uploadId: 830868

View File

@@ -0,0 +1,79 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the border color of an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the border color of an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Border Color")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitBorderColor : MMF_UIToolkitColorBase
{
[MMFInspectorGroup("Borders", true, 55, true)]
/// whether or not the feedback should modify the color of the left border
[Tooltip("whether or not the feedback should modify the color of the left border")]
public bool BorderLeft = true;
/// whether or not the feedback should modify the color of the right border
[Tooltip("whether or not the feedback should modify the color of the right border")]
public bool BorderRight = true;
/// whether or not the feedback should modify the color of the bottom border
[Tooltip("whether or not the feedback should modify the color of the bottom border")]
public bool BorderBottom = true;
/// whether or not the feedback should modify the color of the top border
[Tooltip("whether or not the feedback should modify the color of the top border")]
public bool BorderTop = true;
protected override void ApplyColor(Color newColor)
{
foreach (VisualElement element in _visualElements)
{
if (BorderLeft)
{
element.style.borderLeftColor = newColor;
}
if (BorderRight)
{
element.style.borderRightColor = newColor;
}
if (BorderBottom)
{
element.style.borderBottomColor = newColor;
}
if (BorderTop)
{
element.style.borderTopColor = newColor;
}
HandleMarkDirty(element);
}
}
protected override Color GetInitialColor()
{
if (BorderLeft)
{
return _visualElements[0].resolvedStyle.borderLeftColor;
}
if (BorderRight)
{
return _visualElements[0].resolvedStyle.borderRightColor;
}
if (BorderBottom)
{
return _visualElements[0].resolvedStyle.borderBottomColor;
}
if (BorderTop)
{
return _visualElements[0].resolvedStyle.borderTopColor;
}
return Color.black;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 72c972a1271fae14a92c46848763b4c0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitBorderColor.cs
uploadId: 830868

View File

@@ -0,0 +1,54 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the border radius of an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the border radius of an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Border Radius")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitBorderRadius : MMF_UIToolkitFloatBase
{
/// whether to modify the bottom left border radius or not
[Tooltip("whether to modify the bottom left border radius or not")]
public bool BottomLeft = true;
/// whether to modify the bottom right border radius or not
[Tooltip("whether to modify the bottom right border radius or not")]
public bool BottomRight = true;
/// whether to modify the top left border radius or not
[Tooltip("whether to modify the top left border radius or not")]
public bool TopLeft = true;
/// whether to modify the top right border radius or not
[Tooltip("whether to modify the top right border radius or not")]
public bool TopRight = true;
protected override void SetValue(float newValue)
{
foreach (VisualElement element in _visualElements)
{
if (BottomLeft) element.style.borderBottomLeftRadius = newValue;
if (BottomRight) element.style.borderBottomRightRadius = newValue;
if (TopLeft) element.style.borderTopLeftRadius = newValue;
if (TopRight) element.style.borderTopRightRadius = newValue;
HandleMarkDirty(element);
}
}
protected override float GetInitialValue()
{
if (BottomLeft) return _visualElements[0].resolvedStyle.borderBottomLeftRadius;
if (BottomRight) return _visualElements[0].resolvedStyle.borderBottomRightRadius;
if (TopLeft) return _visualElements[0].resolvedStyle.borderTopLeftRadius;
if (TopRight) return _visualElements[0].resolvedStyle.borderTopRightRadius;
return _visualElements[0].resolvedStyle.borderBottomLeftRadius;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6ad38ecaccfcdc04d886cb21721bfa60
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitBorderRadius.cs
uploadId: 830868

View File

@@ -0,0 +1,55 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.Serialization;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the border width of an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the border width of an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Border Width")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitBorderWidth : MMF_UIToolkitFloatBase
{
/// whether to modify the left border width or not
[Tooltip("whether to modify the left border width or not")]
public bool Left = true;
/// whether to modify the right border width or not
[Tooltip("whether to modify the right border width or not")]
public bool Right = true;
/// whether to modify the top border width or not
[Tooltip("whether to modify the top border width or not")]
public bool Top = true;
/// whether to modify the bottom border width or not
[Tooltip("whether to modify the bottom border width or not")]
public bool Bottom = true;
protected override void SetValue(float newValue)
{
foreach (VisualElement element in _visualElements)
{
if (Left) element.style.borderLeftWidth = newValue;
if (Right) element.style.borderRightWidth = newValue;
if (Bottom) element.style.borderBottomWidth = newValue;
if (Top) element.style.borderTopWidth = newValue;
HandleMarkDirty(element);
}
}
protected override float GetInitialValue()
{
if (Left) return _visualElements[0].resolvedStyle.borderLeftWidth;
if (Right) return _visualElements[0].resolvedStyle.borderRightWidth;
if (Bottom) return _visualElements[0].resolvedStyle.borderBottomWidth;
if (Top) return _visualElements[0].resolvedStyle.borderTopWidth;
return _visualElements[0].resolvedStyle.borderLeftWidth;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: c771cf4cdbab1ff43a08d35743880364
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitBorderWidth.cs
uploadId: 830868

View File

@@ -0,0 +1,62 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the class of an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the class of an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Class")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitClass : MMF_UIToolkit
{
public enum Modes { AddToClassList, EnableInClassList, ToggleInClassList, RemoveFromClassList, ClearClassList}
[Header("Class Manipulation")]
/// whether to add, enable, toggle, remove or clear the class list
[Tooltip("whether to add, enable, toggle, remove or clear the class list")]
public Modes Mode = Modes.AddToClassList;
/// the name of the class to add, enable, toggle or remove
[Tooltip("the name of the class to add, enable, toggle or remove")]
[MMFEnumCondition("Mode", (int)Modes.AddToClassList, (int)Modes.EnableInClassList, (int)Modes.ToggleInClassList, (int)Modes.RemoveFromClassList)]
public string ClassName = "";
/// in EnableInClassList mode, whether to enable or disable the class
[Tooltip("in EnableInClassList mode, whether to enable or disable the class")]
[MMFEnumCondition("Mode", (int)Modes.EnableInClassList)]
public bool Enable = true;
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1)
{
foreach (VisualElement element in _visualElements)
{
switch (Mode)
{
case Modes.AddToClassList:
element.AddToClassList(ClassName);
break;
case Modes.EnableInClassList:
element.EnableInClassList(ClassName, Enable);
break;
case Modes.ToggleInClassList:
element.ToggleInClassList(ClassName);
break;
case Modes.RemoveFromClassList:
element.RemoveFromClassList(ClassName);
break;
case Modes.ClearClassList:
element.ClearClassList();
break;
}
HandleMarkDirty(element);
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6f494035fcb1bd449ba11daf0b0280f2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitClass.cs
uploadId: 830868

View File

@@ -0,0 +1,35 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the font size of an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the font size of an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Font Size")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitFontSize : MMF_UIToolkitFloatBase
{
protected override void SetValue(float newValue)
{
foreach (VisualElement element in _visualElements)
{
int newSize = Mathf.FloorToInt(newValue);
element.style.fontSize = newSize;
HandleMarkDirty(element);
}
}
protected override float GetInitialValue()
{
return _visualElements[0].resolvedStyle.fontSize;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 755aedfb494d0004cacdb9dddcb170b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitFontSize.cs
uploadId: 830868

View File

@@ -0,0 +1,33 @@
using System.Collections;
using MoreMountains.Feedbacks;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the image tint of an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the image tint of an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Image Tint")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitImageTint : MMF_UIToolkitColorBase
{
protected override void ApplyColor(Color newColor)
{
foreach (VisualElement element in _visualElements)
{
element.style.unityBackgroundImageTintColor = newColor;
HandleMarkDirty(element);
}
}
protected override Color GetInitialColor()
{
return _visualElements[0].resolvedStyle.unityBackgroundImageTintColor;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 1c32b4600f4e8964ea69bf0c126763e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitImageTint.cs
uploadId: 830868

View File

@@ -0,0 +1,33 @@
using System.Collections;
using MoreMountains.Feedbacks;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the opacity of an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the opacity of an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Opacity")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitOpacity : MMF_UIToolkitFloatBase
{
protected override void SetValue(float newValue)
{
foreach (VisualElement element in _visualElements)
{
element.style.opacity = newValue;
HandleMarkDirty(element);
}
}
protected override float GetInitialValue()
{
return _visualElements[0].resolvedStyle.opacity;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 10a07c80400c0ab45a2f60fcda5d5013
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitOpacity.cs
uploadId: 830868

View File

@@ -0,0 +1,36 @@
using System.Collections;
using MoreMountains.Feedbacks;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you rotate an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you rotate an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Rotate")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitRotate : MMF_UIToolkitFloatBase
{
protected StyleRotate _styleRotate;
protected override void SetValue(float newValue)
{
foreach (VisualElement element in _visualElements)
{
_styleRotate = new Rotate(newValue);
element.style.rotate = _styleRotate;
HandleMarkDirty(element);
}
}
protected override float GetInitialValue()
{
return _visualElements[0].resolvedStyle.rotate.angle.value;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 8e1c231ece781884ba12b20110efeb03
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitRotate.cs
uploadId: 830868

View File

@@ -0,0 +1,34 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you scale an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you scale an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Scale")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitScale : MMF_UIToolkitVector2Base
{
protected override void SetValue(Vector2 newValue)
{
foreach (VisualElement element in _visualElements)
{
element.style.scale = new StyleScale(new Scale(newValue));
HandleMarkDirty(element);
}
}
protected override Vector2 GetInitialValue()
{
return _visualElements[0].resolvedStyle.scale.value;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: ff1bc0ee84c11704b9fdeae5c51f6a76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitScale.cs
uploadId: 830868

View File

@@ -0,0 +1,35 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the size an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the size an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Size")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitSize : MMF_UIToolkitVector2Base
{
protected override void SetValue(Vector2 newValue)
{
foreach (VisualElement element in _visualElements)
{
element.style.width = newValue.x;
element.style.height = newValue.y;
HandleMarkDirty(element);
}
}
protected override Vector2 GetInitialValue()
{
return new Vector2(_visualElements[0].resolvedStyle.width, _visualElements[0].resolvedStyle.height);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 6b08364980f6e884695f3959f374f6ad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitSize.cs
uploadId: 830868

View File

@@ -0,0 +1,34 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the stylesheet on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the stylesheet on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Stylesheet")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitStylesheet : MMF_UIToolkit
{
[Header("Stylesheet")]
/// the new stylesheet to apply to the document
[Tooltip("the new stylesheet to apply to the document")]
public StyleSheet NewStylesheet;
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1)
{
foreach (VisualElement element in _visualElements)
{
element.styleSheets.Add(NewStylesheet);
HandleMarkDirty(element);
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 0585acb66fc8f9d40a59342095941c09
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitStylesheet.cs
uploadId: 830868

View File

@@ -0,0 +1,68 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the text an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the text an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Text")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitText : MMF_UIToolkit
{
[Header("Text")]
/// the new text to set on the target object(s)
[Tooltip("the new text to set on the target object(s)")]
public string NewText = "";
protected string _initialText;
protected override void CustomPlayFeedback(Vector3 position, float feedbacksIntensity = 1)
{
SetValue(NewText);
}
protected virtual void SetValue(string newValue)
{
foreach (VisualElement element in _visualElements)
{
(element as TextElement).text = newValue;
HandleMarkDirty(element);
}
}
protected override void CustomInitialization(MMF_Player owner)
{
base.CustomInitialization(owner);
if ((_visualElements == null) || (_visualElements.Count == 0))
{
return;
}
_initialText = GetInitialValue();
}
protected virtual string GetInitialValue()
{
return (_visualElements[0] as TextElement).text;
}
/// <summary>
/// On restore, we put our object back at its initial position
/// </summary>
protected override void CustomRestoreInitialValues()
{
if (!Active || !FeedbackTypeAuthorized)
{
return;
}
SetValue(_initialText);
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 1beb22790c538de4180c96ef7cbd68a6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitText.cs
uploadId: 830868

View File

@@ -0,0 +1,33 @@
using System.Collections;
using MoreMountains.Feedbacks;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the text color an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the text color an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Text Color")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitTextColor : MMF_UIToolkitColorBase
{
protected override void ApplyColor(Color newColor)
{
foreach (VisualElement element in _visualElements)
{
element.style.color = newColor;
HandleMarkDirty(element);
}
}
protected override Color GetInitialColor()
{
return _visualElements[0].resolvedStyle.color;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 413dbb3ab27b9eb40a8bc94473c0565c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitTextColor.cs
uploadId: 830868

View File

@@ -0,0 +1,42 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you change the transform origin an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you change the transform origin an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Transform Origin")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitTransformOrigin : MMF_UIToolkitVector2Base
{
[Header("Units")]
/// how to interpret the x value
[Tooltip("how to interpret the x value")]
public LengthUnit LengthUnitX = LengthUnit.Pixel;
/// how to interpret the y value
[Tooltip("how to interpret the y value")]
public LengthUnit LengthUnitY = LengthUnit.Pixel;
protected override void SetValue(Vector2 newValue)
{
foreach (VisualElement element in _visualElements)
{
element.style.transformOrigin = new StyleTransformOrigin(new TransformOrigin(new Length(newValue.x, LengthUnitX), new Length(newValue.y, LengthUnitY)));
HandleMarkDirty(element);
}
}
protected override Vector2 GetInitialValue()
{
return _visualElements[0].resolvedStyle.transformOrigin;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 20a16824553d34440a2d4a0aef9f6305
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitTransformOrigin.cs
uploadId: 830868

View File

@@ -0,0 +1,42 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you translate an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you translate an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Translate")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitTranslate : MMF_UIToolkitVector2Base
{
[Header("Units")]
/// how to interpret the x value
[Tooltip("how to interpret the x value")]
public LengthUnit LengthUnitX = LengthUnit.Pixel;
/// how to interpret the y value
[Tooltip("how to interpret the y value")]
public LengthUnit LengthUnitY = LengthUnit.Pixel;
protected override void SetValue(Vector2 newValue)
{
foreach (VisualElement element in _visualElements)
{
element.style.translate = new StyleTranslate(new Translate(new Length(newValue.x, LengthUnitX), new Length(newValue.y, LengthUnitY)));
HandleMarkDirty(element);
}
}
protected override Vector2 GetInitialValue()
{
return _visualElements[0].resolvedStyle.translate;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 0e932172a6c02a94c9cc24b921edb17e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitTranslate.cs
uploadId: 830868

View File

@@ -0,0 +1,62 @@
using System.Collections;
using MoreMountains.Feedbacks;
using MoreMountains.Tools;
using UnityEngine;
using UnityEngine.UIElements;
using UnityEngine.Scripting.APIUpdating;
namespace MoreMountains.FeedbacksForThirdParty
{
/// <summary>
/// This feedback will let you set the visibility of an element on a target UI Document
/// </summary>
[AddComponentMenu("")]
[FeedbackHelp("This feedback will let you set the visibility of an element on a target UI Document")]
[System.Serializable]
[FeedbackPath("UI Toolkit/UITK Visible")]
[MovedFrom(false, null, "MoreMountains.Feedbacks.UIToolkit")]
public class MMF_UIToolkitVisible : MMF_UIToolkitBoolBase
{
public enum Modes { Set, Toggle }
[Header("Visible")]
/// the selected mode (set : sets the object visible or not, toggle : toggles the object's visibility)
[Tooltip("the selected mode (set : sets the object visible or not, toggle : toggles the object's visibility)")]
public Modes Mode = Modes.Set;
/// whether to set the object visible (true) or not
[Tooltip("whether to set the object visible (true) or not")]
[MMFEnumCondition("Mode", (int)Modes.Set)]
public bool Visible = false;
protected override void SetValue()
{
foreach (VisualElement element in _visualElements)
{
switch (Mode)
{
case Modes.Set:
element.visible = Visible;
break;
case Modes.Toggle:
element.visible = !element.visible;
break;
}
HandleMarkDirty(element);
}
}
protected override void SetValue(bool newValue)
{
foreach (VisualElement element in _visualElements)
{
element.visible = newValue;
HandleMarkDirty(element);
}
}
protected override bool GetInitialValue()
{
return _visualElements[0].visible;
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 3ec5758e2d9e3f14abd3e218d26005d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/Feedbacks/MMF_UIToolkitVisible.cs
uploadId: 830868

View File

@@ -0,0 +1,3 @@
{
"reference": "GUID:4a1cb1490dc4df8409b2580d6b44e75e"
}

View File

@@ -0,0 +1,14 @@
fileFormatVersion: 2
guid: 6acf6d4477d762d4d9d58016b9ff1c1d
AssemblyDefinitionReferenceImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 183370
packageName: Feel
packageVersion: 5.9.1
assetPath: Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/UIToolkit/MoreMountains.Feedbacks.UIToolkit.asmref
uploadId: 830868