Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

Add version defines to UniRx.asmdef #487

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions Assets/Plugins/UniRx/Scripts/UniRx.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,31 @@
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": []
}
"versionDefines": [
{
"name": "com.unity.modules.animation",
"expression": "",
"define": "UNIRX_ANIMATION_SUPPORT"
},
{
"name": "com.unity.modules.physics",
"expression": "",
"define": "UNIRX_PHYSICS_SUPPORT"
},
{
"name": "com.unity.modules.physics2d",
"expression": "",
"define": "UNIRX_PHYSICS2D_SUPPORT"
},
{
"name": "com.unity.modules.unitywebrequestwww",
"expression": "",
"define": "UNIRX_WWW_SUPPORT"
},
{
"name": "com.unity.ugui",
"expression": "",
"define": "UNIRX_UGUI_SUPPORT"
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ void ConsumeEnumerator(IEnumerator routine)
}

var type = current.GetType();
#if !UNITY_2019_1_OR_NEWER || UNIRX_WWW_SUPPORT
#if UNITY_2018_3_OR_NEWER
#pragma warning disable CS0618
#endif
Expand All @@ -126,10 +127,12 @@ void ConsumeEnumerator(IEnumerator routine)
editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitWWW(www, routine)), null);
return;
}
else
#if UNITY_2018_3_OR_NEWER
#pragma warning restore CS0618
#endif
else if (type == typeof(AsyncOperation))
#endif
if (type == typeof(AsyncOperation))
{
var asyncOperation = (AsyncOperation)current;
editorQueueWorker.Enqueue(_ => ConsumeEnumerator(UnwrapWaitAsyncOperation(asyncOperation, routine)), null);
Expand Down Expand Up @@ -162,6 +165,7 @@ void ConsumeEnumerator(IEnumerator routine)
}
}

#if !UNITY_2019_1_OR_NEWER || UNIRX_WWW_SUPPORT
#if UNITY_2018_3_OR_NEWER
#pragma warning disable CS0618
#endif
Expand All @@ -175,6 +179,7 @@ IEnumerator UnwrapWaitWWW(WWW www, IEnumerator continuation)
}
#if UNITY_2018_3_OR_NEWER
#pragma warning restore CS0618
#endif
#endif

IEnumerator UnwrapWaitAsyncOperation(AsyncOperation asyncOperation, IEnumerator continuation)
Expand Down Expand Up @@ -680,4 +685,4 @@ public static IObservable<Unit> OnApplicationQuitAsObservable()
return Instance.onApplicationQuit ?? (Instance.onApplicationQuit = new Subject<Unit>());
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,14 @@ public static partial class Observable
{
readonly static HashSet<Type> YieldInstructionTypes = new HashSet<Type>
{
#if !UNITY_2019_1_OR_NEWER || UNIRX_WWW_SUPPORT
#if UNITY_2018_3_OR_NEWER
#pragma warning disable CS0618
#endif
typeof(WWW),
#if UNITY_2018_3_OR_NEWER
#pragma warning restore CS0618
#endif
#endif
typeof(WaitForEndOfFrame),
typeof(WaitForFixedUpdate),
Expand Down
14 changes: 9 additions & 5 deletions Assets/Plugins/UniRx/Scripts/UnityEngineBridge/ObservableWWW.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#if !UNITY_2019_1_OR_NEWER || UNIRX_WWW_SUPPORT

using System;
using System.Collections;
using UnityEngine;
Expand All @@ -16,10 +18,10 @@ namespace UniRx
#if !(UNITY_METRO || UNITY_WP8) && (UNITY_4_4 || UNITY_4_3 || UNITY_4_2 || UNITY_4_1 || UNITY_4_0_1 || UNITY_4_0 || UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_2 || UNITY_3_1 || UNITY_3_0_0 || UNITY_3_0 || UNITY_2_6_1 || UNITY_2_6)
// Fallback for Unity versions below 4.5
using Hash = System.Collections.Hashtable;
using HashEntry = System.Collections.DictionaryEntry;
using HashEntry = System.Collections.DictionaryEntry;
#else
// Unity 4.5 release notes:
// WWW: deprecated 'WWW(string url, byte[] postData, Hashtable headers)',
// Unity 4.5 release notes:
// WWW: deprecated 'WWW(string url, byte[] postData, Hashtable headers)',
// use 'public WWW(string url, byte[] postData, Dictionary<string, string> headers)' instead.
using Hash = System.Collections.Generic.Dictionary<string, string>;
using HashEntry = System.Collections.Generic.KeyValuePair<string, string>;
Expand Down Expand Up @@ -408,7 +410,7 @@ public WWWErrorException(WWW www, string text)
this.RawErrorMessage = www.error;
this.ResponseHeaders = www.responseHeaders;
this.HasResponse = false;
this.Text = text;
this.Text = text;

var splitted = RawErrorMessage.Split(' ', ':');
if (splitted.Length != 0)
Expand Down Expand Up @@ -439,4 +441,6 @@ public override string ToString()

#if UNITY_2018_3_OR_NEWER
#pragma warning restore CS0618
#endif
#endif

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public static System.Runtime.CompilerServices.TaskAwaiter<T> GetAwaiter<T>(this
#if !UniRxLibrary

// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

/// <summary>
/// Bind ReactiveCommand to button's interactable and onClick.
Expand Down Expand Up @@ -440,7 +440,7 @@ public static System.Runtime.CompilerServices.TaskAwaiter<T> GetAwaiter<T>(this
#if !UniRxLibrary

// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

/// <summary>
/// Bind AsyncRaectiveCommand to button's interactable and onClick.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System; // require keep for Windows Universal App
#if !UNITY_2019_1_OR_NEWER || UNIRX_ANIMATION_SUPPORT

using System; // require keep for Windows Universal App
using UnityEngine;

namespace UniRx.Triggers
Expand Down Expand Up @@ -46,4 +48,6 @@ protected override void RaiseOnCompletedOnDestroy()
}
}
}
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System; // require keep for Windows Universal App
#if !UNITY_2019_1_OR_NEWER || UNIRX_PHYSICS2D_SUPPORT

using System; // require keep for Windows Universal App
using UnityEngine;

namespace UniRx.Triggers
Expand Down Expand Up @@ -64,4 +66,6 @@ protected override void RaiseOnCompletedOnDestroy()
}
}
}
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System; // require keep for Windows Universal App
#if !UNITY_2019_1_OR_NEWER || UNIRX_PHYSICS_SUPPORT

using System; // require keep for Windows Universal App
using UnityEngine;

namespace UniRx.Triggers
Expand Down Expand Up @@ -64,4 +66,6 @@ protected override void RaiseOnCompletedOnDestroy()
}
}
}
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -356,4 +356,4 @@ protected override void RaiseOnCompletedOnDestroy()
}
}

#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System; // require keep for Windows Universal App
#if !UNITY_2019_1_OR_NEWER || UNIRX_PHYSICS_SUPPORT

using System; // require keep for Windows Universal App
using UnityEngine;

namespace UniRx.Triggers
Expand All @@ -17,8 +19,8 @@ public IObservable<float> OnJointBreakAsObservable()
{
return onJointBreak ?? (onJointBreak = new Subject<float>());
}


Subject<Joint2D> onJointBreak2D;

void OnJointBreak2D(Joint2D brokenJoint)
Expand All @@ -30,7 +32,7 @@ public IObservable<Joint2D> OnJointBreak2DAsObservable()
{
return onJointBreak2D ?? (onJointBreak2D = new Subject<Joint2D>());
}


protected override void RaiseOnCompletedOnDestroy()
{
Expand All @@ -44,4 +46,6 @@ protected override void RaiseOnCompletedOnDestroy()
}
}
}
}
}

#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// for uGUI(from 4.6)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5)
#if !(UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5) && (!UNITY_2019_1_OR_NEWER || UNIRX_UGUI_SUPPORT)

using System; // require keep for Windows Universal App
using UnityEngine;
Expand Down Expand Up @@ -33,4 +33,4 @@ protected override void RaiseOnCompletedOnDestroy()
}


#endif
#endif
Loading