chore: initial commit

This commit is contained in:
2026-05-08 11:04:00 +08:00
commit f55d2a57c3
6278 changed files with 866081 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: a191453c9f5a69348a9014eb1f7a35d7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,78 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 72c972a1271fae14a92c46848763b4c0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,53 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 6ad38ecaccfcdc04d886cb21721bfa60
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,54 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: c771cf4cdbab1ff43a08d35743880364
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 6f494035fcb1bd449ba11daf0b0280f2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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 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")]
[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,11 @@
fileFormatVersion: 2
guid: 755aedfb494d0004cacdb9dddcb170b0
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 1c32b4600f4e8964ea69bf0c126763e2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 10a07c80400c0ab45a2f60fcda5d5013
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,35 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 8e1c231ece781884ba12b20110efeb03
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: ff1bc0ee84c11704b9fdeae5c51f6a76
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

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 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")]
[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,11 @@
fileFormatVersion: 2
guid: 6b08364980f6e884695f3959f374f6ad
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,33 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 0585acb66fc8f9d40a59342095941c09
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,67 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 1beb22790c538de4180c96ef7cbd68a6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,32 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 413dbb3ab27b9eb40a8bc94473c0565c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 20a16824553d34440a2d4a0aef9f6305
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,41 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 0e932172a6c02a94c9cc24b921edb17e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
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")]
[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,11 @@
fileFormatVersion: 2
guid: 3ec5758e2d9e3f14abd3e218d26005d4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: