Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
Added
- Added UniRx integration.
- Added IModifierList<T>.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.
  • Loading branch information
mackysoft committed Nov 26, 2020
1 parent 8dd8c8d commit d26e422
Show file tree
Hide file tree
Showing 46 changed files with 1,060 additions and 149 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,8 @@ crashlytics-build.properties

# Asset Store Tools
/[Aa]ssets/[Aa]ssetStoreTools.meta
/[Aa]ssets/[Aa]ssetStoreTools/
/[Aa]ssets/[Aa]ssetStoreTools/

# UniRx
/[Aa]ssets/[Pp]lugins.meta
/[Aa]ssets/[Pp]lugins/
8 changes: 8 additions & 0 deletions Assets/MackySoft/MackySoft.Modiferty/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -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
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -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);
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/MackySoft/MackySoft.Modiferty/Example.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/MackySoft/MackySoft.Modiferty/Example/Runtime.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "MackySoft.Modiferty.Example",
"references": [
"GUID:e695879245fa2de4a81d0b0f517b15c3"
],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/MackySoft/MackySoft.Modiferty/External.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Assets/MackySoft/MackySoft.Modiferty/External/UniRx.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -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
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using UnityEngine;

namespace MackySoft.Modiferty.Modifiers {

public abstract class ReactiveOperatorModifierBase<TRHS,TResult> : ReactiveModifiableProperty<TRHS>, IModifier<TResult> {

[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<T> : ReactiveOperatorModifierBase<T,T> {
protected ReactiveOperatorModifierBase () : this(default) {
}
protected ReactiveOperatorModifierBase (T baseValue) : base(baseValue) {
}
}

}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using UnityEngine;

namespace MackySoft.Modiferty {

[Serializable]
public class ReactiveSetModifier<T> : ReactiveModifiableProperty<T>, IModifier<T> {

[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();
}

}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
using System;
using MackySoft.Modiferty.Modifiers;

namespace MackySoft.Modiferty {

[Serializable]
public class ReactiveModifiableFloat : ReactiveModifiableProperty<float> {
public ReactiveModifiableFloat () : this(default) {
}

public ReactiveModifiableFloat (float initialValue) : base(initialValue) {
}
}

#region Operator Modifiers

[Serializable]
public class ReactiveAdditiveModifierFloat : ReactiveOperatorModifierBase<float> {

public ReactiveAdditiveModifierFloat () : this(default) {
}
public ReactiveAdditiveModifierFloat (float baseValue) : base(baseValue) {
}

public override float Evaluate (float value) {
return value + Evaluate();
}

}

[Serializable]
public class ReactiveSubtractiveModifierFloat : ReactiveOperatorModifierBase<float> {

public ReactiveSubtractiveModifierFloat () : this(default) {
}
public ReactiveSubtractiveModifierFloat (float baseValue) : base(baseValue) {
}

public override float Evaluate (float value) {
return value - Evaluate();
}

}

[Serializable]
public class ReactiveMultiplyModifierFloat : ReactiveOperatorModifierBase<float> {

public ReactiveMultiplyModifierFloat () : this(1f) {
}
public ReactiveMultiplyModifierFloat (float baseValue) : base(baseValue) {
}

public override float Evaluate (float value) {
return value * Evaluate();
}

}

[Serializable]
public class ReactiveDivisionModifierFloat : ReactiveOperatorModifierBase<float> {

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<float> {
public ReactiveSetModifierFloat () : this(default) {
}

public ReactiveSetModifierFloat (float baseValue) : base(baseValue) {
}
}

}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d26e422

Please sign in to comment.