Upload project files
This commit is contained in:
30
Runtime/Cloner/Helper/Converter/BoolToDisplayConvertor.cs
Normal file
30
Runtime/Cloner/Helper/Converter/BoolToDisplayConvertor.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Misaki.ArtTool
|
||||
{
|
||||
public struct BoolToDisplayConverter
|
||||
{
|
||||
public static StyleEnum<DisplayStyle> ConvertTo(bool value)
|
||||
{
|
||||
return value ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
}
|
||||
|
||||
public static bool ConvertBack(StyleEnum<DisplayStyle> value)
|
||||
{
|
||||
return value == DisplayStyle.Flex;
|
||||
}
|
||||
}
|
||||
|
||||
public struct InverseBoolToDisplayConverter
|
||||
{
|
||||
public static StyleEnum<DisplayStyle> ConvertTo(bool value)
|
||||
{
|
||||
return value ? DisplayStyle.None : DisplayStyle.Flex;
|
||||
}
|
||||
|
||||
public static bool ConvertBack(StyleEnum<DisplayStyle> value)
|
||||
{
|
||||
return value == DisplayStyle.None;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b81c44f05fc751c48826ea9ce03b7c01
|
||||
45
Runtime/Cloner/Helper/Converter/ConverterInitializer.cs
Normal file
45
Runtime/Cloner/Helper/Converter/ConverterInitializer.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Unity.Mathematics;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace Misaki.ArtTool
|
||||
{
|
||||
internal class ConverterInitializer
|
||||
{
|
||||
[InitializeOnLoadMethod]
|
||||
public static void Initialize()
|
||||
{
|
||||
var boolToDisplayGroup = new ConverterGroup("BoolToDisplayConvertor");
|
||||
|
||||
boolToDisplayGroup.AddConverter((ref bool v) => BoolToDisplayConverter.ConvertTo(v));
|
||||
boolToDisplayGroup.AddConverter((ref StyleEnum<DisplayStyle> v) => BoolToDisplayConverter.ConvertBack(v));
|
||||
|
||||
ConverterGroups.RegisterConverterGroup(boolToDisplayGroup);
|
||||
|
||||
|
||||
var inverseBoolToDisplayGroup = new ConverterGroup("InverseBoolToDisplayConverter");
|
||||
|
||||
inverseBoolToDisplayGroup.AddConverter((ref bool v) => InverseBoolToDisplayConverter.ConvertTo(v));
|
||||
inverseBoolToDisplayGroup.AddConverter((ref StyleEnum<DisplayStyle> v) => InverseBoolToDisplayConverter.ConvertBack(v));
|
||||
|
||||
ConverterGroups.RegisterConverterGroup(inverseBoolToDisplayGroup);
|
||||
|
||||
|
||||
var float2ToVector2Group = new ConverterGroup("Float2ToVector2Converter");
|
||||
|
||||
float2ToVector2Group.AddConverter((ref float2 v) => Float2ToVector2Converter.ConvertTo(v));
|
||||
float2ToVector2Group.AddConverter((ref Vector2 v) => Float2ToVector2Converter.ConvertBack(v));
|
||||
|
||||
ConverterGroups.RegisterConverterGroup(float2ToVector2Group);
|
||||
|
||||
|
||||
var float3ToVector3Group = new ConverterGroup("Float3ToVector3Converter");
|
||||
|
||||
float3ToVector3Group.AddConverter((ref float3 v) => Float3ToVector3Converter.ConvertTo(v));
|
||||
float3ToVector3Group.AddConverter((ref Vector3 v) => Float3ToVector3Converter.ConvertBack(v));
|
||||
|
||||
ConverterGroups.RegisterConverterGroup(float3ToVector3Group);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c562049c7c1eae74cabb57e558e84cd6
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace Misaki.ArtTool
|
||||
{
|
||||
public struct DistributionModeToDisplayStyleConverter
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc563d199e512194591ea87c5554c7fd
|
||||
31
Runtime/Cloner/Helper/Converter/FloatToVectorConverter.cs
Normal file
31
Runtime/Cloner/Helper/Converter/FloatToVectorConverter.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Unity.Mathematics;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Misaki.ArtTool
|
||||
{
|
||||
public struct Float2ToVector2Converter
|
||||
{
|
||||
public static Vector2 ConvertTo(float2 value)
|
||||
{
|
||||
return (Vector2)value;
|
||||
}
|
||||
|
||||
public static float2 ConvertBack(Vector2 value)
|
||||
{
|
||||
return (float2)value;
|
||||
}
|
||||
}
|
||||
|
||||
public struct Float3ToVector3Converter
|
||||
{
|
||||
public static Vector3 ConvertTo(float3 value)
|
||||
{
|
||||
return (Vector3)value;
|
||||
}
|
||||
|
||||
public static float3 ConvertBack(Vector3 value)
|
||||
{
|
||||
return (float3)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5e4440b512db4634782a08acd72568a3
|
||||
Reference in New Issue
Block a user