From d26e422caced556633835fd7f725c6befd31a93a Mon Sep 17 00:00:00 2001 From: Makihiro Date: Thu, 26 Nov 2020 23:58:01 +0900 Subject: [PATCH] 1.1.0 Added - Added UniRx integration. - Added IModifierList.AddModifierAsDisposable extension method. Changes - Renamed assembly name "MackySoft.Modiferty.Runtime" to "MackySoft.Modiferty". - OperatorModifiers now inherit from ModifiableProperty. - - The Modifier(s) suffix has been applied to the extension methods defined in IModifiablePropertyExtensions. - Multiply / DivisionModifierInt now must specify the RoundingMethod. --- .gitignore | 6 +- .../MackySoft/MackySoft.Modiferty/Editor.meta | 8 + .../Editor/MackySoft.Modiferty.Editor.asmdef | 17 ++ .../MackySoft.Modiferty.Editor.asmdef.meta | 7 + .../Editor/ModifiablePropertyDrawer.cs | 16 ++ .../Editor/ModifiablePropertyDrawer.cs.meta | 11 ++ .../MackySoft.Modiferty/Example.meta | 8 + .../MackySoft.Modiferty/Example/Runtime.meta | 8 + .../Example/{Scripts => Runtime}/Character.cs | 0 .../Example/Runtime/Character.cs.meta | 11 ++ .../MackySoft.Modiferty.Example.asmdef | 15 ++ .../MackySoft.Modiferty.Example.asmdef.meta | 7 + .../MackySoft.Modiferty/External.meta | 8 + .../MackySoft.Modiferty/External/UniRx.meta | 8 + .../UniRx/MackySoft.Modiferty.UniRx.asmdef | 18 +++ .../MackySoft.Modiferty.UniRx.asmdef.meta | 7 + .../External/UniRx/Modifiers.meta | 8 + .../Modifiers/ReactiveOperatorModifierBase.cs | 30 ++++ .../ReactiveOperatorModifierBase.cs.meta | 11 ++ .../UniRx/Modifiers/ReactiveSetModifier.cs | 28 ++++ .../Modifiers/ReactiveSetModifier.cs.meta | 11 ++ .../External/UniRx/Properties.meta | 8 + .../Properties/ReactiveModifiableFloat.cs | 84 ++++++++++ .../ReactiveModifiableFloat.cs.meta | 11 ++ .../UniRx/Properties/ReactiveModifiableInt.cs | 106 +++++++++++++ .../Properties/ReactiveModifiableInt.cs.meta | 11 ++ .../UniRx/ReactiveModifiableProperty.cs | 72 +++++++++ .../UniRx/ReactiveModifiableProperty.cs.meta | 11 ++ .../External/UniRx/ReactiveModifierList.cs | 56 +++++++ .../UniRx/ReactiveModifierList.cs.meta | 11 ++ .../Runtime/IModifiablePropertyExtensions.cs | 15 +- .../MackySoft.Modiferty.Runtime.asmdef | 2 +- .../Runtime/ModifierListExtensions.cs | 40 ++++- .../Runtime/Modifiers/OperatorModifierBase.cs | 33 ++++ .../Modifiers/OperatorModifierBase.cs.meta | 11 ++ .../Runtime/Properties/ModifiableFloat.cs | 90 ++++------- .../Runtime/Properties/ModifiableInt.cs | 99 ++++++------ .../Runtime/Utilities.meta | 8 + .../Runtime/Utilities/RoundUtility.cs | 29 ++++ .../Runtime/Utilities/RoundUtility.cs.meta | 11 ++ Packages/manifest.json | 13 +- Packages/packages-lock.json | 145 ++++++++++++++++++ ProjectSettings/PackageManagerSettings.asset | 43 ++++++ ProjectSettings/ProjectSettings.asset | 45 +++--- ProjectSettings/ProjectVersion.txt | 4 +- ProjectSettings/VersionControlSettings.asset | 8 + 46 files changed, 1060 insertions(+), 149 deletions(-) create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Editor.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Editor/MackySoft.Modiferty.Editor.asmdef create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Editor/MackySoft.Modiferty.Editor.asmdef.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Editor/ModifiablePropertyDrawer.cs create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Editor/ModifiablePropertyDrawer.cs.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Example.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Example/Runtime.meta rename Assets/MackySoft/MackySoft.Modiferty/Example/{Scripts => Runtime}/Character.cs (100%) create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/Character.cs.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/MackySoft.Modiferty.Example.asmdef create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/MackySoft.Modiferty.Example.asmdef.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/MackySoft.Modiferty.UniRx.asmdef create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/MackySoft.Modiferty.UniRx.asmdef.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveOperatorModifierBase.cs create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveOperatorModifierBase.cs.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveSetModifier.cs create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveSetModifier.cs.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableFloat.cs create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableFloat.cs.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableInt.cs create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableInt.cs.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifiableProperty.cs create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifiableProperty.cs.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifierList.cs create mode 100644 Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifierList.cs.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Runtime/Modifiers/OperatorModifierBase.cs create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Runtime/Modifiers/OperatorModifierBase.cs.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities.meta create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities/RoundUtility.cs create mode 100644 Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities/RoundUtility.cs.meta create mode 100644 Packages/packages-lock.json create mode 100644 ProjectSettings/PackageManagerSettings.asset create mode 100644 ProjectSettings/VersionControlSettings.asset diff --git a/.gitignore b/.gitignore index e1635e6..a095812 100644 --- a/.gitignore +++ b/.gitignore @@ -71,4 +71,8 @@ crashlytics-build.properties # Asset Store Tools /[Aa]ssets/[Aa]ssetStoreTools.meta -/[Aa]ssets/[Aa]ssetStoreTools/ \ No newline at end of file +/[Aa]ssets/[Aa]ssetStoreTools/ + +# UniRx +/[Aa]ssets/[Pp]lugins.meta +/[Aa]ssets/[Pp]lugins/ \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/Editor.meta b/Assets/MackySoft/MackySoft.Modiferty/Editor.meta new file mode 100644 index 0000000..fac7cb0 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Editor.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a9b10a8fb3bdae249ab91c5990832f53 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/Editor/MackySoft.Modiferty.Editor.asmdef b/Assets/MackySoft/MackySoft.Modiferty/Editor/MackySoft.Modiferty.Editor.asmdef new file mode 100644 index 0000000..f63a5b6 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Editor/MackySoft.Modiferty.Editor.asmdef @@ -0,0 +1,17 @@ +{ + "name": "MackySoft.Modiferty.Editor", + "references": [ + "GUID:e695879245fa2de4a81d0b0f517b15c3" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/Editor/MackySoft.Modiferty.Editor.asmdef.meta b/Assets/MackySoft/MackySoft.Modiferty/Editor/MackySoft.Modiferty.Editor.asmdef.meta new file mode 100644 index 0000000..9149ac5 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Editor/MackySoft.Modiferty.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 40928bc94bf6c9d4ab69789b56aaff51 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/Editor/ModifiablePropertyDrawer.cs b/Assets/MackySoft/MackySoft.Modiferty/Editor/ModifiablePropertyDrawer.cs new file mode 100644 index 0000000..1e725a7 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Editor/ModifiablePropertyDrawer.cs @@ -0,0 +1,16 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; + +namespace MackySoft.Modiferty { + + [CustomPropertyDrawer(typeof(ModifieableProperty<>),true)] + [CustomPropertyDrawer(typeof(ModifiableInt))] + public class ModifiablePropertyDrawer : PropertyDrawer { + public override void OnGUI (Rect position,SerializedProperty property,GUIContent label) { + var baseValue = property.FindPropertyRelative("m_BaseValue"); + EditorGUI.PropertyField(position,baseValue,label); + } + } +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/Editor/ModifiablePropertyDrawer.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/Editor/ModifiablePropertyDrawer.cs.meta new file mode 100644 index 0000000..726ed44 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Editor/ModifiablePropertyDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 64de5e5b96a4def43beb013c76590d7d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/Example.meta b/Assets/MackySoft/MackySoft.Modiferty/Example.meta new file mode 100644 index 0000000..d2f2931 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Example.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7632978d3f6a9274383a4ca3224e9444 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime.meta b/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime.meta new file mode 100644 index 0000000..82577ed --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 76ac2027284c1734086abae3e7b83edb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/Example/Scripts/Character.cs b/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/Character.cs similarity index 100% rename from Assets/MackySoft/MackySoft.Modiferty/Example/Scripts/Character.cs rename to Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/Character.cs diff --git a/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/Character.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/Character.cs.meta new file mode 100644 index 0000000..c542efe --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/Character.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef5b4b4ea1b2e634d8a737050453d9a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/MackySoft.Modiferty.Example.asmdef b/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/MackySoft.Modiferty.Example.asmdef new file mode 100644 index 0000000..ba48d3f --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/MackySoft.Modiferty.Example.asmdef @@ -0,0 +1,15 @@ +{ + "name": "MackySoft.Modiferty.Example", + "references": [ + "GUID:e695879245fa2de4a81d0b0f517b15c3" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/MackySoft.Modiferty.Example.asmdef.meta b/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/MackySoft.Modiferty.Example.asmdef.meta new file mode 100644 index 0000000..94d603b --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Example/Runtime/MackySoft.Modiferty.Example.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: f5649f99d5c06384f9fa0d33a38bb489 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External.meta b/Assets/MackySoft/MackySoft.Modiferty/External.meta new file mode 100644 index 0000000..a17cd1b --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1de632186ba7e8640b8f6713522abfaf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx.meta new file mode 100644 index 0000000..228c5fb --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b05a9bdb45ae2ae4e9d03eb83d7ec69e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/MackySoft.Modiferty.UniRx.asmdef b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/MackySoft.Modiferty.UniRx.asmdef new file mode 100644 index 0000000..d1933b4 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/MackySoft.Modiferty.UniRx.asmdef @@ -0,0 +1,18 @@ +{ + "name": "MackySoft.Modiferty.UniRx", + "references": [ + "GUID:e695879245fa2de4a81d0b0f517b15c3", + "GUID:560b04d1a97f54a4e82edc0cbbb69285" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [ + "MODIFERTY_UNIRX" + ], + "versionDefines": [], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/MackySoft.Modiferty.UniRx.asmdef.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/MackySoft.Modiferty.UniRx.asmdef.meta new file mode 100644 index 0000000..025dbb4 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/MackySoft.Modiferty.UniRx.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: fede8c6c4e4bddd44b1db8410752c53f +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers.meta new file mode 100644 index 0000000..a1543dc --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: aaf3b70cfd3d66544a16f48b69f07e18 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveOperatorModifierBase.cs b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveOperatorModifierBase.cs new file mode 100644 index 0000000..34bf7f9 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveOperatorModifierBase.cs @@ -0,0 +1,30 @@ +using UnityEngine; + +namespace MackySoft.Modiferty.Modifiers { + + public abstract class ReactiveOperatorModifierBase : ReactiveModifiableProperty, IModifier { + + [SerializeField] + int m_Priority; + + public int Priority { + get => m_Priority; + set => m_Priority = value; + } + + protected ReactiveOperatorModifierBase () : this(default) { + } + protected ReactiveOperatorModifierBase (TRHS baseValue) : base(baseValue) { + } + + public abstract TResult Evaluate (TResult value); + } + + public abstract class ReactiveOperatorModifierBase : ReactiveOperatorModifierBase { + protected ReactiveOperatorModifierBase () : this(default) { + } + protected ReactiveOperatorModifierBase (T baseValue) : base(baseValue) { + } + } + +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveOperatorModifierBase.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveOperatorModifierBase.cs.meta new file mode 100644 index 0000000..1c104d1 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveOperatorModifierBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8fa037111b41ea5499194a87469b1540 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveSetModifier.cs b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveSetModifier.cs new file mode 100644 index 0000000..56990db --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveSetModifier.cs @@ -0,0 +1,28 @@ +using System; +using UnityEngine; + +namespace MackySoft.Modiferty { + + [Serializable] + public class ReactiveSetModifier : ReactiveModifiableProperty, IModifier { + + [SerializeField] + int m_Priority; + + public int Priority { + get => m_Priority; + set => m_Priority = value; + } + + public ReactiveSetModifier () : this(default) { + } + + public ReactiveSetModifier (T baseValue) : base(baseValue) { + } + + public T Evaluate (T value) { + return Evaluate(); + } + + } +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveSetModifier.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveSetModifier.cs.meta new file mode 100644 index 0000000..ee20e84 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Modifiers/ReactiveSetModifier.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b003abd632ad82a448d7d636fcfeb4e5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties.meta new file mode 100644 index 0000000..47b208b --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: db8ecaa3b45a7e94b87b93096c47574e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableFloat.cs b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableFloat.cs new file mode 100644 index 0000000..9a299bc --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableFloat.cs @@ -0,0 +1,84 @@ +using System; +using MackySoft.Modiferty.Modifiers; + +namespace MackySoft.Modiferty { + + [Serializable] + public class ReactiveModifiableFloat : ReactiveModifiableProperty { + public ReactiveModifiableFloat () : this(default) { + } + + public ReactiveModifiableFloat (float initialValue) : base(initialValue) { + } + } + + #region Operator Modifiers + + [Serializable] + public class ReactiveAdditiveModifierFloat : ReactiveOperatorModifierBase { + + public ReactiveAdditiveModifierFloat () : this(default) { + } + public ReactiveAdditiveModifierFloat (float baseValue) : base(baseValue) { + } + + public override float Evaluate (float value) { + return value + Evaluate(); + } + + } + + [Serializable] + public class ReactiveSubtractiveModifierFloat : ReactiveOperatorModifierBase { + + public ReactiveSubtractiveModifierFloat () : this(default) { + } + public ReactiveSubtractiveModifierFloat (float baseValue) : base(baseValue) { + } + + public override float Evaluate (float value) { + return value - Evaluate(); + } + + } + + [Serializable] + public class ReactiveMultiplyModifierFloat : ReactiveOperatorModifierBase { + + public ReactiveMultiplyModifierFloat () : this(1f) { + } + public ReactiveMultiplyModifierFloat (float baseValue) : base(baseValue) { + } + + public override float Evaluate (float value) { + return value * Evaluate(); + } + + } + + [Serializable] + public class ReactiveDivisionModifierFloat : ReactiveOperatorModifierBase { + + public ReactiveDivisionModifierFloat () : this(1f) { + } + public ReactiveDivisionModifierFloat (float baseValue) : base(baseValue) { + } + + public override float Evaluate (float value) { + return value / Evaluate(); + } + + } + + #endregion + + [Serializable] + public class ReactiveSetModifierFloat : ReactiveSetModifier { + public ReactiveSetModifierFloat () : this(default) { + } + + public ReactiveSetModifierFloat (float baseValue) : base(baseValue) { + } + } + +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableFloat.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableFloat.cs.meta new file mode 100644 index 0000000..f118590 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableFloat.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 335f201e12f1aec478ef0e90cb6c4bab +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableInt.cs b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableInt.cs new file mode 100644 index 0000000..1bbffdb --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableInt.cs @@ -0,0 +1,106 @@ +using System; +using UnityEngine; +using MackySoft.Modiferty.Modifiers; + +namespace MackySoft.Modiferty { + + [Serializable] + public class ReactiveModifiableInt : ReactiveModifiableProperty { + public ReactiveModifiableInt () : this(default) { + } + public ReactiveModifiableInt (int baseValue) : base(baseValue) { + } + } + + #region Operator Modifiers + + [Serializable] + public class ReactiveAdditiveModifierInt : ReactiveOperatorModifierBase { + + public ReactiveAdditiveModifierInt () : this(default) { + } + public ReactiveAdditiveModifierInt (int baseValue) : base(baseValue) { + } + + public override int Evaluate (int value) { + return value + Evaluate(); + } + + } + + [Serializable] + public class ReactiveSubtractiveModifierInt : ReactiveOperatorModifierBase { + + public ReactiveSubtractiveModifierInt () : this(default) { + } + public ReactiveSubtractiveModifierInt (int baseValue) : base(baseValue) { + } + + public override int Evaluate (int value) { + return value - Evaluate(); + } + + } + + [Serializable] + public class ReactiveMultiplyModifierInt : ReactiveOperatorModifierBase { + + [SerializeField] + RoundingMethod m_RoundingMethod; + + public RoundingMethod RoundingMethod { + get => m_RoundingMethod; + set => m_RoundingMethod = value; + } + + public ReactiveMultiplyModifierInt () : this(1f) { + } + public ReactiveMultiplyModifierInt (float baseValue) : base(baseValue) { + } + public ReactiveMultiplyModifierInt (float baseValue,RoundingMethod roundingMethod) : this(baseValue) { + m_RoundingMethod = roundingMethod; + } + + public override int Evaluate (int value) { + return (value * Evaluate()).RoundToInt(m_RoundingMethod); + } + + } + + [Serializable] + public class ReactiveDivisionModifierInt : ReactiveOperatorModifierBase { + + [SerializeField] + RoundingMethod m_RoundingMethod; + + public RoundingMethod RoundingMethod { + get => m_RoundingMethod; + set => m_RoundingMethod = value; + } + + public ReactiveDivisionModifierInt () : this(1f) { + } + public ReactiveDivisionModifierInt (float baseValue) : base(baseValue) { + } + public ReactiveDivisionModifierInt (float baseValue,RoundingMethod roundingMethod) : this(baseValue) { + m_RoundingMethod = roundingMethod; + } + + public override int Evaluate (int value) { + return (value / Evaluate()).RoundToInt(m_RoundingMethod); + } + + } + + #endregion + + [Serializable] + public class ReactiveSetModifierInt : ReactiveSetModifier { + public ReactiveSetModifierInt () : this(default) { + } + + public ReactiveSetModifierInt (int baseValue) : base(baseValue) { + } + } + +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableInt.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableInt.cs.meta new file mode 100644 index 0000000..1b3352c --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/Properties/ReactiveModifiableInt.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cdffeee478dd5cb42818e584014bc354 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifiableProperty.cs b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifiableProperty.cs new file mode 100644 index 0000000..13c9672 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifiableProperty.cs @@ -0,0 +1,72 @@ +using System; +using UniRx; + +namespace MackySoft.Modiferty { + + public interface IReadOnlyReactiveModifiableProperty : IReadOnlyModifiableProperty, IReadOnlyReactiveProperty { + new IReadOnlyReactiveModifierList Modifiers { get; } + } + + public interface IReactiveModifiableProperty : IReadOnlyReactiveModifiableProperty, IModifiableProperty, IReactiveProperty { + new IReactiveModifierList Modifiers { get; } + } + + [Serializable] + public class ReactiveModifiableProperty : ReactiveProperty, IReactiveModifiableProperty { + + ReactiveModifierList m_Modifiers; + + public T BaseValue { + get => base.Value; + set => base.Value = value; + } + + new T Value { + get => base.Value; + set => base.Value = value; + } + + public IReactiveModifierList Modifiers => m_Modifiers ?? (m_Modifiers = new ReactiveModifierList()); + + public bool HasModifiers => (m_Modifiers != null) && (m_Modifiers.Count > 0); + + public ReactiveModifiableProperty () : this(default) { + } + + public ReactiveModifiableProperty (T baseValue) : base(baseValue) { + } + + public T Evaluate () { + return (m_Modifiers != null) ? m_Modifiers.Evaluate(BaseValue) : BaseValue; + } + + #region Explicit implementation + + IReadOnlyReactiveModifierList IReadOnlyReactiveModifiableProperty.Modifiers => Modifiers; + + IModifierList IModifiableProperty.Modifiers => Modifiers; + + IReadOnlyModifierList IReadOnlyModifiableProperty.Modifiers => Modifiers; + + #endregion + + } + + public static class ReactiveModifiablePropertyExtensions { + + /// + /// Notify BaseValue and Modifiers changes. + /// + public static IObservable> ObserveChanged (this IReadOnlyReactiveModifiableProperty source) { + if (source == null) { + throw new ArgumentNullException(nameof(source)); + } + return Observable.Merge( + source.AsUnitObservable(), + source.Modifiers.ObserveChanged().AsUnitObservable() + ).Select(_ => source); + } + + } + +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifiableProperty.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifiableProperty.cs.meta new file mode 100644 index 0000000..a881420 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifiableProperty.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0347f3ffedb993042afa3a5fa9eee631 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifierList.cs b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifierList.cs new file mode 100644 index 0000000..486ecd8 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifierList.cs @@ -0,0 +1,56 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using UniRx; + +namespace MackySoft.Modiferty { + + public interface IReadOnlyReactiveModifierList : IReadOnlyModifierList, IReadOnlyReactiveCollection> { + + } + + public interface IReactiveModifierList : IReadOnlyReactiveModifierList, IModifierList, IReactiveCollection> { + + } + + [Serializable] + public class ReactiveModifierList : ReactiveCollection>, IReactiveModifierList { + + public ReactiveModifierList () { + } + + public ReactiveModifierList (IEnumerable> collection) : base(collection) { + } + + public ReactiveModifierList (List> list) : base(list) { + } + + public T Evaluate (T value) { + if (Count > 0) { + foreach (var modifier in Items.OrderByDescending(m => m.Priority)) { + value = modifier.Evaluate(value); + } + } + return value; + } + + } + + public static class ReactiveModifierListExtensions { + + /// + /// Notify ModifierList change. + /// + public static IObservable> ObserveChanged (this IReadOnlyReactiveModifierList source) { + if (source == null) { + throw new ArgumentNullException(nameof(source)); + } + return Observable.Merge( + source.ObserveCountChanged().AsUnitObservable(), + source.ObserveReplace().AsUnitObservable() + ).Select(_ => source); + } + + } + +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifierList.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifierList.cs.meta new file mode 100644 index 0000000..2557ff3 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/External/UniRx/ReactiveModifierList.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f1de91e9bb735b74991af106650e96f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/IModifiablePropertyExtensions.cs b/Assets/MackySoft/MackySoft.Modiferty/Runtime/IModifiablePropertyExtensions.cs index 6f1fd92..fab00c9 100644 --- a/Assets/MackySoft/MackySoft.Modiferty/Runtime/IModifiablePropertyExtensions.cs +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/IModifiablePropertyExtensions.cs @@ -1,30 +1,35 @@ -using System.Linq; +using System; +using System.Linq; namespace MackySoft.Modiferty { public static class IModifiablePropertyExtensions { - public static bool Contains (this IReadOnlyModifiableProperty source,IModifier modifier) { + public static bool ContainsModifier (this IReadOnlyModifiableProperty source,IModifier modifier) { return source.Modifiers.Contains(modifier); } /// /// Shortcut of .Add(modifier); /// - public static void Add (this IModifiableProperty source,IModifier modifier) { + public static void AddModifier (this IModifiableProperty source,IModifier modifier) { source.Modifiers.Add(modifier); } + public static IDisposable AddModifierAsDisposable (this IModifiableProperty source,IModifier modifier) { + return source.Modifiers.AddModifierAsDisposable(modifier); + } + /// /// Shortcut of .Remove(modifier); /// - public static bool Remove (this IModifiableProperty source,IModifier modifier) { + public static bool RemoveModifier (this IModifiableProperty source,IModifier modifier) { return source.Modifiers.Remove(modifier); } /// /// Shortcut of .Clear(); /// - public static void Clear (this IModifiableProperty source) { + public static void ClearModifiers (this IModifiableProperty source) { source.Modifiers.Clear(); } diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/MackySoft.Modiferty.Runtime.asmdef b/Assets/MackySoft/MackySoft.Modiferty/Runtime/MackySoft.Modiferty.Runtime.asmdef index 0319914..c148296 100644 --- a/Assets/MackySoft/MackySoft.Modiferty/Runtime/MackySoft.Modiferty.Runtime.asmdef +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/MackySoft.Modiferty.Runtime.asmdef @@ -1,5 +1,5 @@ { - "name": "MackySoft.Modiferty.Runtime", + "name": "MackySoft.Modiferty", "references": [], "includePlatforms": [], "excludePlatforms": [], diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/ModifierListExtensions.cs b/Assets/MackySoft/MackySoft.Modiferty/Runtime/ModifierListExtensions.cs index 288776d..3821b01 100644 --- a/Assets/MackySoft/MackySoft.Modiferty/Runtime/ModifierListExtensions.cs +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/ModifierListExtensions.cs @@ -36,11 +36,23 @@ public static bool TryGetModifier (this IEnumerable source return result != null; } + public static IDisposable AddModifierAsDisposable (this ICollection> source,IModifier modifier) { + if (source == null) { + throw new ArgumentNullException(nameof(source)); + } + if (modifier == null) { + throw new ArgumentNullException(nameof(modifier)); + } + + source.Add(modifier); + return new ModifierDisposable(source,modifier); + } + /// /// Remove all modifiers that match the specified type. /// /// Type of Modifier to be removed. - public static int RemoveAll (this ICollection source) where TModifier : IModifier { + public static int RemoveModifiersAll (this ICollection source) where TModifier : IModifier { int removedModifiersCount = 0; foreach (IModifier modifier in source.ToArray()) { if (modifier is TModifier result) { @@ -54,12 +66,12 @@ public static int RemoveAll (this ICollection source) wher /// /// Remove all modifiers that match the condition. /// - public static int RemoveAll (this ICollection source,Predicate match) { + public static int RemoveModifiersAll (this ICollection> source,Predicate> match) { if (match == null) { throw new ArgumentNullException(nameof(match)); } int removedModifiersCount = 0; - foreach (IModifier modifier in source.ToArray()) { + foreach (IModifier modifier in source.ToArray()) { if (match.Invoke(modifier)) { source.Remove(modifier); removedModifiersCount++; @@ -68,6 +80,28 @@ public static int RemoveAll (this ICollection source,Predicate : IDisposable { + + bool m_IsDisposed; + IModifier m_Modifier; + ICollection> m_Collection; + + public ModifierDisposable (ICollection> collection,IModifier modifier) { + m_Modifier = modifier; + m_Collection = collection; + } + + public void Dispose () { + if (!m_IsDisposed) { + m_IsDisposed = true; + m_Collection.Remove(m_Modifier); + + m_Collection = null; + m_Modifier = null; + } + } + } + } } \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/Modifiers/OperatorModifierBase.cs b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Modifiers/OperatorModifierBase.cs new file mode 100644 index 0000000..96cc0e7 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Modifiers/OperatorModifierBase.cs @@ -0,0 +1,33 @@ +using UnityEngine; + +namespace MackySoft.Modiferty.Modifiers { + + public abstract class OperatorModifierBase : ModifieableProperty, IModifier { + + [SerializeField] + int m_Priority; + + public int Priority { + get => m_Priority; + set => m_Priority = value; + } + + protected OperatorModifierBase () : this(default) { + } + + protected OperatorModifierBase (TRHS baseValue) : base(baseValue) { + } + + public abstract TResult Evaluate (TResult value); + + } + + public abstract class OperatorModifierBase : OperatorModifierBase { + protected OperatorModifierBase () : this(default) { + } + + protected OperatorModifierBase (T baseValue) : base(baseValue) { + } + } + +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/Modifiers/OperatorModifierBase.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Modifiers/OperatorModifierBase.cs.meta new file mode 100644 index 0000000..6347c1e --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Modifiers/OperatorModifierBase.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: baefa1b1f908ffb4e9148bbe42872e58 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/Properties/ModifiableFloat.cs b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Properties/ModifiableFloat.cs index e98e955..9ce04f6 100644 --- a/Assets/MackySoft/MackySoft.Modiferty/Runtime/Properties/ModifiableFloat.cs +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Properties/ModifiableFloat.cs @@ -1,10 +1,12 @@ using System; -using UnityEngine; +using MackySoft.Modiferty.Modifiers; namespace MackySoft.Modiferty { [Serializable] public class ModifiableFloat : ModifieableProperty { + public ModifiableFloat () : this(default) { + } public ModifiableFloat (float baseValue) : base(baseValue) { } } @@ -12,93 +14,59 @@ public ModifiableFloat (float baseValue) : base(baseValue) { #region Operator Modifiers [Serializable] - public class AdditiveModifierFloat : IModifier { - - [SerializeField] - float m_Amount; - - [SerializeField] - int m_Priority; + public class AdditiveModifierFloat : OperatorModifierBase { - public float Amount { get => m_Amount; set => m_Amount = value; } - - public int Priority { get => m_Priority; set => m_Priority = value; } - - public AdditiveModifierFloat (float amount) { - Amount = amount; + public AdditiveModifierFloat () : this(default) { + } + public AdditiveModifierFloat (float baseValue) : base(baseValue) { } - public float Evaluate (float value) { - return value + Amount; + public override float Evaluate (float value) { + return value + Evaluate(); } } [Serializable] - public class SubtractiveModifierFloat : IModifier { + public class SubtractiveModifierFloat : OperatorModifierBase { - [SerializeField] - float m_Amount; - - [SerializeField] - int m_Priority; - - public float Amount { get => m_Amount; set => m_Amount = value; } - - public int Priority { get => m_Priority; set => m_Priority = value; } - - public SubtractiveModifierFloat (float amount) { - Amount = amount; + public SubtractiveModifierFloat () : this(default) { + } + public SubtractiveModifierFloat (float baseValue) : base(baseValue) { } - public float Evaluate (float value) { - return value - Amount; + public override float Evaluate (float value) { + return value - Evaluate(); } + } [Serializable] - public class MultiplyModifierFloat : IModifier { + public class MultiplyModifierFloat : OperatorModifierBase { - [SerializeField] - float m_Multiply = 1; - - [SerializeField] - int m_Priority; - - public float Multiply { get => m_Multiply; set => m_Multiply = value; } - - public int Priority { get => m_Priority; set => m_Priority = value; } - - public MultiplyModifierFloat (float multiply) { - Multiply = multiply; + public MultiplyModifierFloat () : this(1f) { + } + public MultiplyModifierFloat (float baseValue) : base(baseValue) { } - public float Evaluate (float value) { - return value * Multiply; + public override float Evaluate (float value) { + return value * Evaluate(); } } [Serializable] - public class DivisionModifierFloat : IModifier { - - [SerializeField] - float m_Division = 2f; + public class DivisionModifierFloat : OperatorModifierBase { - [SerializeField] - int m_Priority; - - public float Division { get => m_Division; set => m_Division = value; } - - public int Priority { get => m_Priority; set => m_Priority = value; } - - public DivisionModifierFloat (float division) { - Division = division; + public DivisionModifierFloat () : this(1f) { + } + public DivisionModifierFloat (float baseValue) : base(baseValue) { } - public float Evaluate (float value) { - return value / m_Division; + public override float Evaluate (float value) { + return value / Evaluate(); } + } #endregion diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/Properties/ModifiableInt.cs b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Properties/ModifiableInt.cs index 8f9f4b4..98bb6eb 100644 --- a/Assets/MackySoft/MackySoft.Modiferty/Runtime/Properties/ModifiableInt.cs +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Properties/ModifiableInt.cs @@ -1,10 +1,13 @@ using System; using UnityEngine; +using MackySoft.Modiferty.Modifiers; namespace MackySoft.Modiferty { [Serializable] public class ModifiableInt : ModifieableProperty { + public ModifiableInt () : this(default) { + } public ModifiableInt (int baseValue) : base(baseValue) { } } @@ -12,92 +15,82 @@ public ModifiableInt (int baseValue) : base(baseValue) { #region Operator Modifiers [Serializable] - public class AdditiveModifierInt : IModifier { - - [SerializeField] - int m_Amount; - - [SerializeField] - int m_Priority; - - public int Amount { get => m_Amount; set => m_Amount = value; } + public class AdditiveModifierInt : OperatorModifierBase { - public int Priority { get => m_Priority; set => m_Priority = value; } + public AdditiveModifierInt () : this(default) { + } - public AdditiveModifierInt (int amount) { - Amount = amount; + public AdditiveModifierInt (int baseValue) : base(baseValue) { } - public int Evaluate (int value) { - return value + Amount; + public override int Evaluate (int value) { + return value + Evaluate(); } + } [Serializable] - public class SubtractiveModifierInt : IModifier { + public class SubtractiveModifierInt : OperatorModifierBase { - [SerializeField] - int m_Amount; - - [SerializeField] - int m_Priority; - - public int Amount { get => m_Amount; set => m_Amount = value; } - - public int Priority { get => m_Priority; set => m_Priority = value; } - - public SubtractiveModifierInt (int amount) { - Amount = amount; + public SubtractiveModifierInt () : this(default) { + } + public SubtractiveModifierInt (int baseValue) : base(baseValue) { } - public int Evaluate (int value) { - return value - Amount; + public override int Evaluate (int value) { + return value - Evaluate(); } + } [Serializable] - public class MultiplyModifierInt : IModifier { - - [SerializeField] - float m_Multiply = 1f; + public class MultiplyModifierInt : OperatorModifierBase { [SerializeField] - int m_Priority; - - public float Multiply { get => m_Multiply; set => m_Multiply = value; } + RoundingMethod m_RoundingMethod; - public int Priority { get => m_Priority; set => m_Priority = value; } + public RoundingMethod RoundingMethod { + get => m_RoundingMethod; + set => m_RoundingMethod = value; + } - public MultiplyModifierInt (float multiply) { - Multiply = multiply; + public MultiplyModifierInt () : this(1f) { + } + public MultiplyModifierInt (float baseValue) : base(baseValue) { + } + public MultiplyModifierInt (float baseValue,RoundingMethod roundingMethod) : this(baseValue) { + m_RoundingMethod = roundingMethod; } - public int Evaluate (int value) { - return Mathf.RoundToInt(value * Multiply); + public override int Evaluate (int value) { + return (value * Evaluate()).RoundToInt(m_RoundingMethod); } } [Serializable] - public class DivisionModifierInt : IModifier { + public class DivisionModifierInt : OperatorModifierBase { [SerializeField] - float m_Division = 1f; + RoundingMethod m_RoundingMethod; - [SerializeField] - int m_Priority; - - public float Division { get => m_Division; set => m_Division = value; } - - public int Priority { get => m_Priority; set => m_Priority = value; } + public RoundingMethod RoundingMethod { + get => m_RoundingMethod; + set => m_RoundingMethod = value; + } - public DivisionModifierInt (float division) { - Division = division; + public DivisionModifierInt () : this(1f) { + } + public DivisionModifierInt (float baseValue) : base(baseValue) { + } + public DivisionModifierInt (float baseValue,RoundingMethod roundingMethod) : this(baseValue) { + m_RoundingMethod = roundingMethod; } - public int Evaluate (int value) { - return Mathf.RoundToInt(value / m_Division); + public override int Evaluate (int value) { + return (value / Evaluate()).RoundToInt(m_RoundingMethod); } + } #endregion diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities.meta b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities.meta new file mode 100644 index 0000000..2184730 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 9b95506bad5ad9146985ea9ca346fed8 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities/RoundUtility.cs b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities/RoundUtility.cs new file mode 100644 index 0000000..081bd33 --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities/RoundUtility.cs @@ -0,0 +1,29 @@ +using UnityEngine; + +namespace MackySoft.Modiferty { + + public enum RoundingMethod { + Round = 0, + Floor = 1, + Ceil = 2 + } + + public static class RoundUtility { + + public static float Round (this float f,RoundingMethod method) { + if (method == RoundingMethod.Round) { + return Mathf.Round(f); + } else if (method == RoundingMethod.Floor) { + return Mathf.Floor(f); + } else { + return Mathf.Ceil(f); + } + } + + public static int RoundToInt (this float f,RoundingMethod method) { + return (int)Round(f,method); + } + + } + +} \ No newline at end of file diff --git a/Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities/RoundUtility.cs.meta b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities/RoundUtility.cs.meta new file mode 100644 index 0000000..9a08a5e --- /dev/null +++ b/Assets/MackySoft/MackySoft.Modiferty/Runtime/Utilities/RoundUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0861d17ecc90edf4aaacef868cc94529 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Packages/manifest.json b/Packages/manifest.json index a3a9511..1b241ca 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,7 +1,14 @@ { "dependencies": { - "com.unity.ide.rider": "1.1.4", - "com.unity.ide.vscode": "1.2.0", - "com.unity.test-framework": "1.1.13" + "com.unity.ide.rider": "1.2.1", + "com.unity.ide.visualstudio": "2.0.3", + "com.unity.ide.vscode": "1.2.3", + "com.unity.test-framework": "1.1.18", + "com.unity.ugui": "1.0.0", + "com.unity.modules.animation": "1.0.0", + "com.unity.modules.physics": "1.0.0", + "com.unity.modules.physics2d": "1.0.0", + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.unitywebrequestwww": "1.0.0" } } diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json new file mode 100644 index 0000000..b8c68c5 --- /dev/null +++ b/Packages/packages-lock.json @@ -0,0 +1,145 @@ +{ + "dependencies": { + "com.unity.ext.nunit": { + "version": "1.0.0", + "depth": 1, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.ide.rider": { + "version": "1.2.1", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.test-framework": "1.1.1" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ide.visualstudio": { + "version": "2.0.3", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.ide.vscode": { + "version": "1.2.3", + "depth": 0, + "source": "registry", + "dependencies": {}, + "url": "https://packages.unity.com" + }, + "com.unity.test-framework": { + "version": "1.1.18", + "depth": 0, + "source": "registry", + "dependencies": { + "com.unity.ext.nunit": "1.0.0", + "com.unity.modules.imgui": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0" + }, + "url": "https://packages.unity.com" + }, + "com.unity.ugui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.ui": "1.0.0", + "com.unity.modules.imgui": "1.0.0" + } + }, + "com.unity.modules.animation": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.assetbundle": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.audio": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.imageconversion": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.imgui": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.jsonserialize": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.physics2d": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.ui": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unitywebrequest": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": {} + }, + "com.unity.modules.unitywebrequestassetbundle": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.unitywebrequest": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestaudio": { + "version": "1.0.0", + "depth": 1, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.audio": "1.0.0" + } + }, + "com.unity.modules.unitywebrequestwww": { + "version": "1.0.0", + "depth": 0, + "source": "builtin", + "dependencies": { + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.unitywebrequestassetbundle": "1.0.0", + "com.unity.modules.unitywebrequestaudio": "1.0.0", + "com.unity.modules.audio": "1.0.0", + "com.unity.modules.assetbundle": "1.0.0", + "com.unity.modules.imageconversion": "1.0.0" + } + } + } +} diff --git a/ProjectSettings/PackageManagerSettings.asset b/ProjectSettings/PackageManagerSettings.asset new file mode 100644 index 0000000..be4a797 --- /dev/null +++ b/ProjectSettings/PackageManagerSettings.asset @@ -0,0 +1,43 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 61 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_EnablePreviewPackages: 0 + m_EnablePackageDependencies: 0 + m_AdvancedSettingsExpanded: 1 + m_ScopedRegistriesSettingsExpanded: 1 + oneTimeWarningShown: 0 + m_Registries: + - m_Id: main + m_Name: + m_Url: https://packages.unity.com + m_Scopes: [] + m_IsDefault: 1 + m_Capabilities: 7 + m_UserSelectedRegistryName: + m_UserAddingNewScopedRegistry: 0 + m_RegistryInfoDraft: + m_ErrorMessage: + m_Original: + m_Id: + m_Name: + m_Url: + m_Scopes: [] + m_IsDefault: 0 + m_Capabilities: 0 + m_Modified: 0 + m_Name: + m_Url: + m_Scopes: + - + m_SelectedScopeIndex: 0 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index 0076550..4a3d30c 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -49,6 +49,8 @@ PlayerSettings: m_StereoRenderingPath: 0 m_ActiveColorSpace: 0 m_MTRendering: 1 + mipStripping: 0 + numberOfMipsStripped: 0 m_StackTraceTypes: 010000000100000001000000010000000100000001000000 iosShowActivityIndicatorOnLoading: -1 androidShowActivityIndicatorOnLoading: -1 @@ -111,8 +113,13 @@ PlayerSettings: switchNVNShaderPoolsGranularity: 33554432 switchNVNDefaultPoolsGranularity: 16777216 switchNVNOtherPoolsGranularity: 16777216 + switchNVNMaxPublicTextureIDCount: 0 + switchNVNMaxPublicSamplerIDCount: 0 + stadiaPresentMode: 0 + stadiaTargetFramerate: 0 vulkanNumSwapchainBuffers: 3 vulkanEnableSetSRGBWrite: 0 + vulkanEnableLateAcquireNextImage: 0 m_SupportedAspectRatios: 4:3: 1 5:4: 1 @@ -180,32 +187,16 @@ PlayerSettings: StripUnusedMeshComponents: 1 VertexChannelCompressionMask: 4054 iPhoneSdkVersion: 988 - iOSTargetOSVersionString: 10.0 + iOSTargetOSVersionString: 11.0 tvOSSdkVersion: 0 tvOSRequireExtendedGameController: 0 - tvOSTargetOSVersionString: 10.0 + tvOSTargetOSVersionString: 11.0 uIPrerenderedIcon: 0 uIRequiresPersistentWiFi: 0 uIRequiresFullScreen: 1 uIStatusBarHidden: 1 uIExitOnSuspend: 0 uIStatusBarStyle: 0 - iPhoneSplashScreen: {fileID: 0} - iPhoneHighResSplashScreen: {fileID: 0} - iPhoneTallHighResSplashScreen: {fileID: 0} - iPhone47inSplashScreen: {fileID: 0} - iPhone55inPortraitSplashScreen: {fileID: 0} - iPhone55inLandscapeSplashScreen: {fileID: 0} - iPhone58inPortraitSplashScreen: {fileID: 0} - iPhone58inLandscapeSplashScreen: {fileID: 0} - iPadPortraitSplashScreen: {fileID: 0} - iPadHighResPortraitSplashScreen: {fileID: 0} - iPadLandscapeSplashScreen: {fileID: 0} - iPadHighResLandscapeSplashScreen: {fileID: 0} - iPhone65inPortraitSplashScreen: {fileID: 0} - iPhone65inLandscapeSplashScreen: {fileID: 0} - iPhone61inPortraitSplashScreen: {fileID: 0} - iPhone61inLandscapeSplashScreen: {fileID: 0} appleTVSplashScreen: {fileID: 0} appleTVSplashScreen2x: {fileID: 0} tvOSSmallIconLayers: [] @@ -242,6 +233,7 @@ PlayerSettings: metalEditorSupport: 1 metalAPIValidation: 1 iOSRenderExtraFrameOnPause: 0 + iosCopyPluginsCodeInsteadOfSymlink: 0 appleDeveloperTeamID: iOSManualSigningProvisioningProfileID: tvOSManualSigningProvisioningProfileID: @@ -271,6 +263,9 @@ PlayerSettings: height: 180 banner: {fileID: 0} androidGamepadSupportLevel: 0 + AndroidMinifyWithR8: 0 + AndroidMinifyRelease: 0 + AndroidMinifyDebug: 0 AndroidValidateAppBundleSize: 1 AndroidAppBundleSizeToValidate: 150 m_BuildTargetIcons: [] @@ -361,12 +356,14 @@ PlayerSettings: cameraUsageDescription: locationUsageDescription: microphoneUsageDescription: + switchNMETAOverride: switchNetLibKey: switchSocketMemoryPoolSize: 6144 switchSocketAllocatorPoolSize: 128 switchSocketConcurrencyLimit: 14 switchScreenResolutionBehavior: 2 switchUseCPUProfiler: 0 + switchUseGOLDLinker: 0 switchApplicationID: 0x01004b9000490000 switchNSODependencies: switchTitleNames_0: @@ -517,6 +514,7 @@ PlayerSettings: ps4ShareFilePath: ps4ShareOverlayImagePath: ps4PrivacyGuardImagePath: + ps4ExtraSceSysFile: ps4NPtitleDatPath: ps4RemotePlayKeyAssignment: -1 ps4RemotePlayKeyMappingDir: @@ -559,6 +557,8 @@ PlayerSettings: ps4disableAutoHideSplash: 0 ps4videoRecordingFeaturesUsed: 0 ps4contentSearchFeaturesUsed: 0 + ps4CompatibilityPS5: 0 + ps4GPU800MHz: 1 ps4attribEyeToEyeDistanceSettingVR: 0 ps4IncludedModules: [] ps4attribVROutputEnabled: 0 @@ -578,16 +578,20 @@ PlayerSettings: webGLAnalyzeBuildSize: 0 webGLUseEmbeddedResources: 0 webGLCompressionFormat: 1 + webGLWasmArithmeticExceptions: 0 webGLLinkerTarget: 1 webGLThreadsSupport: 0 - webGLWasmStreaming: 0 - scriptingDefineSymbols: {} + webGLDecompressionFallback: 0 + scriptingDefineSymbols: + 1: MACKYSOFT_MODIFERTY_UNIRX platformArchitecture: {} scriptingBackend: {} il2cppCompilerConfiguration: {} managedStrippingLevel: {} incrementalIl2cppBuild: {} + suppressCommonWarnings: 1 allowUnsafeCode: 0 + useDeterministicCompilation: 1 additionalIl2CppArgs: scriptingRuntimeVersion: 1 gcIncremental: 0 @@ -674,3 +678,4 @@ PlayerSettings: enableNativePlatformBackendsForNewInputSystem: 0 disableOldInputManagerSupport: 0 legacyClampBlendShapeWeights: 0 + virtualTexturingSupportEnabled: 0 diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index beea0cc..30e1111 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2019.3.13f1 -m_EditorVersionWithRevision: 2019.3.13f1 (d4ddf0d95db9) +m_EditorVersion: 2020.1.14f1 +m_EditorVersionWithRevision: 2020.1.14f1 (d81f64f5201d) diff --git a/ProjectSettings/VersionControlSettings.asset b/ProjectSettings/VersionControlSettings.asset new file mode 100644 index 0000000..dca2881 --- /dev/null +++ b/ProjectSettings/VersionControlSettings.asset @@ -0,0 +1,8 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!890905787 &1 +VersionControlSettings: + m_ObjectHideFlags: 0 + m_Mode: Visible Meta Files + m_CollabEditorSettings: + inProgressEnabled: 1