From e1260bdbc89a94535b701e8bc7938187d2a4da81 Mon Sep 17 00:00:00 2001 From: AFRA Date: Sun, 6 Jun 2021 11:08:34 +0430 Subject: [PATCH 1/6] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 37052f8..923578d 100644 --- a/README.md +++ b/README.md @@ -21,4 +21,6 @@ MIT ## Author [kiepng](https://github.com/kiepng) +## Improvement with +[kiepng](https://github.com/afraism) From e8489c01de2b1dd03045ac935880cededaae105a Mon Sep 17 00:00:00 2001 From: AFRA Date: Sun, 6 Jun 2021 11:08:51 +0430 Subject: [PATCH 2/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 923578d..5e1cb0d 100644 --- a/README.md +++ b/README.md @@ -22,5 +22,5 @@ MIT ## Author [kiepng](https://github.com/kiepng) ## Improvement with -[kiepng](https://github.com/afraism) +[AFRA](https://github.com/afraism) From 78f9b9a2bcf7d018aa94fef2973d814b653acc3c Mon Sep 17 00:00:00 2001 From: AFRA Date: Sun, 6 Jun 2021 11:09:42 +0430 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5e1cb0d..b57ece6 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,6 @@ MIT ## Author [kiepng](https://github.com/kiepng) -## Improvement with +## Improver [AFRA](https://github.com/afraism) From 811a1ffb83ed251a683a801f46869903248c37d5 Mon Sep 17 00:00:00 2001 From: AFRA Date: Sun, 6 Jun 2021 11:11:00 +0430 Subject: [PATCH 4/6] Update UIRefreshControl.cs --- .../PullToRefresh/Scripts/UIRefreshControl.cs | 26 +++++-------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/Assets/PullToRefresh/Scripts/UIRefreshControl.cs b/Assets/PullToRefresh/Scripts/UIRefreshControl.cs index 2e3ba74..61cf14b 100644 --- a/Assets/PullToRefresh/Scripts/UIRefreshControl.cs +++ b/Assets/PullToRefresh/Scripts/UIRefreshControl.cs @@ -1,4 +1,4 @@ -using System; +using System; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; @@ -30,7 +30,7 @@ namespace PullToRefresh { public class UIRefreshControl : MonoBehaviour { - [Serializable] public class RefreshControlEvent : UnityEvent {} + [Serializable] public class RefreshControlEvent : UnityEvent { } [SerializeField] private ScrollRect m_ScrollRect; [SerializeField] private float m_PullDistanceRequiredRefresh = 150f; @@ -70,11 +70,12 @@ public RefreshControlEvent OnRefresh set { m_OnRefresh = value; } } - /// + /// /// Call When Refresh is End. /// public void EndRefreshing() { + m_ScrollRect.vertical = true; m_IsPulled = false; m_IsRefreshing = false; m_LoadingAnimator.SetBool(_activityIndicatorStartLoadingName, false); @@ -90,21 +91,6 @@ private void Start() m_ScrollRect.onValueChanged.AddListener(OnScroll); } - private void LateUpdate() - { - if (!m_IsPulled) - { - return; - } - - if (!m_IsRefreshing) - { - return; - } - - m_ScrollRect.content.anchoredPosition = m_PositionStop; - } - private void OnScroll(Vector2 normalizedPosition) { var distance = m_InitialPosition - GetContentAnchoredPosition(); @@ -143,11 +129,13 @@ private void OnPull(float distance) m_LoadingAnimator.SetBool(_activityIndicatorStartLoadingName, true); } - // ドラッグした状態で必要距離に達したあとに、指を離したらリフレッシュ開始 if (m_IsPulled && !m_ScrollView.Dragging) { + m_ScrollRect.vertical = false; + m_ScrollRect.content.anchoredPosition = m_PositionStop; m_IsRefreshing = true; m_OnRefresh.Invoke(); + m_IsPulled = false; } m_Progress = 0f; From 2039c13497fecee3327aca858f4c743714646fef Mon Sep 17 00:00:00 2001 From: AFRA Date: Sun, 6 Jun 2021 15:51:34 +0430 Subject: [PATCH 5/6] Update README.md add description --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index b57ece6..a896028 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,11 @@ MIT ## Author [kiepng](https://github.com/kiepng) + ## Improver [AFRA](https://github.com/afraism) +## improvements +1. Remove *LateUpdate()* which optimized performance +2. Replacing *LateUpdate()* with a new approach that has solved the refresh stock problem. + From 107bed77e28014ed41c2e9c701385127a11fcf45 Mon Sep 17 00:00:00 2001 From: AFRA Date: Sun, 6 Jun 2021 15:52:49 +0430 Subject: [PATCH 6/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a896028..b4a1f4a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,6 @@ MIT [AFRA](https://github.com/afraism) ## improvements -1. Remove *LateUpdate()* which optimized performance -2. Replacing *LateUpdate()* with a new approach that has solved the refresh stock problem. +1. Remove `LateUpdate()` which optimized performance +2. Replacing `LateUpdate()` with a new approach that has solved the refresh stock problem.