diff --git a/Assets/Resources/UI/Prefab/Panel/Mobile/EditUserPanel.prefab b/Assets/Resources/UI/Prefab/Panel/Mobile/EditUserPanel.prefab index 8b30e036..073f726c 100644 --- a/Assets/Resources/UI/Prefab/Panel/Mobile/EditUserPanel.prefab +++ b/Assets/Resources/UI/Prefab/Panel/Mobile/EditUserPanel.prefab @@ -5425,7 +5425,7 @@ PrefabInstance: - target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2, type: 3} propertyPath: m_AnchoredPosition.x - value: 0 + value: 20 objectReference: {fileID: 0} - target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2, type: 3} diff --git a/Assets/Scenes/Test.unity b/Assets/Scenes/Test.unity index 7eed30de..b3fd39b8 100644 --- a/Assets/Scenes/Test.unity +++ b/Assets/Scenes/Test.unity @@ -348,7 +348,6 @@ GameObject: - component: {fileID: 1223993130} - component: {fileID: 1223993132} - component: {fileID: 1223993131} - - component: {fileID: 1223993133} m_Layer: 5 m_Name: RawImage m_TagString: Untagged @@ -409,19 +408,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1223993129} m_CullTransparentMesh: 0 ---- !u!114 &1223993133 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1223993129} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 17cb27f144f572748a0f161b829b3e2c, type: 3} - m_Name: - m_EditorClassIdentifier: - image: {fileID: 0} --- !u!1 &1362042230 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/App.cs b/Assets/Scripts/App.cs index df53ac40..ead70a7c 100644 --- a/Assets/Scripts/App.cs +++ b/Assets/Scripts/App.cs @@ -13,7 +13,7 @@ using System; public static class App { - public static string Host = "http://192.168.0.101:5085/"; + public static string Host = "http://192.168.0.101:5084/"; public static string AppVersion = Application.version; diff --git a/Assets/Scripts/UI/Prefab/Panel/EditUserController.cs b/Assets/Scripts/UI/Prefab/Panel/EditUserController.cs index e25d08c9..edeeffa9 100644 --- a/Assets/Scripts/UI/Prefab/Panel/EditUserController.cs +++ b/Assets/Scripts/UI/Prefab/Panel/EditUserController.cs @@ -47,46 +47,67 @@ public class EditUserController : PFUIPanel, INativeOnMobileImageSelect Transform linkContainer; Dictionary dict; + Transform panel; + float? panelTop = null; + UIGradient g1, g2; protected override void Awake() { Debug.Log(Utils.GetIP(Utils.ADDRESSFAM.IPv4)); userApi = new UserApi(); #if !(UNITY_ANDROID || UNITY_IOS) - var panel = this.transform.Find("Panel"); + panel = this.transform.Find("Panel"); #else - var panel = this.transform.Find("Panel/MainPanel"); - float? panelTop = null; - UIGradient g1 = transform.Find("Panel/Btn1").GetComponent() - , g2 = transform.Find("Panel/Btn2").GetComponent(); + panel = this.transform.Find("Panel/MainPanel"); + panelTop = null; + g1 = transform.Find("Panel/Btn1").GetComponent(); + g2 = transform.Find("Panel/Btn2").GetComponent(); + if (!panelTop.HasValue) panelTop = panel.localPosition.y; UIManager.AddEvent(transform.Find("Panel/Btn1").gameObject, EventTriggerType.PointerClick, b => { - if (!panelTop.HasValue) panelTop = transform.localPosition.y+185; - panel.DOLocalMoveY(panelTop.Value, 0.3f); - g1.color1 = Utils.HexToColorHtml("#F93086"); - g1.color2 = Utils.HexToColorHtml("#ff7485"); - g2.color1 = Utils.HexToColorHtml("#353543"); - g2.color2 = Utils.HexToColorHtml("#474759"); - //.color1 = Utils.HexToColorHtml() + setMobilePanelPosition(true); }); UIManager.AddEvent(transform.Find("Panel/Btn2").gameObject, EventTriggerType.PointerClick, b => { - if (!panelTop.HasValue) panelTop = transform.localPosition.y+185; - panel.DOLocalMoveY(panelTop.Value + 370, 0.3f); - g2.color1 = Utils.HexToColorHtml("#F93086"); - g2.color2 = Utils.HexToColorHtml("#ff7485"); - g1.color1 = Utils.HexToColorHtml("#353543"); - g1.color2 = Utils.HexToColorHtml("#474759"); + setMobilePanelPosition(false); }); + Debug.Log(panel.localPosition); TKPanRecognizer pan = new TKPanRecognizer(); var delta = Vector3.zero; + var rect = this.transform.Find("Panel").GetComponent(); + var startLocation = Vector2.zero; pan.gestureRecognizedEvent += (r) => { - delta = pan.deltaTranslation; - delta.x = 0; - delta.z = 0; - panel.transform.position += delta; - //Debug.Log("pan recognizer fired: " + image.transform.position); + //Debug.Log(UIManager.Instance.MainCanvas); + //Debug.Log(this.transform.Find("Panel").GetComponent().bounds.size + startLocation = r.startTouchLocation(); + if (rect.isPointInTransfrom(startLocation)) + { + delta = pan.deltaTranslation; + delta.x = 0; + delta.z = 0; + panel.transform.position += delta; + } + //Debug.Log("pan recognizer fired: " + panel.transform.localPosition); }; + pan.gestureCompleteEvent += (r) => + { + if (rect.isPointInTransfrom(startLocation)) + { + Debug.Log("运行动画"); + if (panel.localPosition.y < 185f + 370f / 2f) + { + setMobilePanelPosition(true); + } + else + { + setMobilePanelPosition(false); + } + } + //if (!panelTop.HasValue) panelTop = transform.localPosition.y + 185; + //Debug.Log($"{panel.localPosition.y},{panelTop}"); + //Debug.Log(r.deltaTranslation); + }; + TouchKit.addGestureRecognizer(pan); #endif mID = panel.Find("IDNumber").Find("input").Find("Text").GetComponent(); mSexDropdown = panel.Find("SexDropdown").GetComponent(); @@ -299,7 +320,28 @@ public class EditUserController : PFUIPanel, INativeOnMobileImageSelect } - + void setMobilePanelPosition(bool flag) + { + if(flag) + { + if (!panelTop.HasValue) panelTop = panel.localPosition.y; + panel.DOLocalMoveY(panelTop.Value, 0.3f); + g1.color1 = Utils.HexToColorHtml("#F93086"); + g1.color2 = Utils.HexToColorHtml("#ff7485"); + g2.color1 = Utils.HexToColorHtml("#353543"); + g2.color2 = Utils.HexToColorHtml("#474759"); + //.color1 = Utils.HexToColorHtml() + } + else + { + if (!panelTop.HasValue) panelTop = panel.localPosition.y; + panel.DOLocalMoveY(panelTop.Value + 370, 0.3f); + g2.color1 = Utils.HexToColorHtml("#F93086"); + g2.color2 = Utils.HexToColorHtml("#ff7485"); + g1.color1 = Utils.HexToColorHtml("#353543"); + g1.color2 = Utils.HexToColorHtml("#474759"); + } + } void SetDayDropdown() { //Debug.Log(mDayDropdown.SelectedItem); diff --git a/Assets/Scripts/UIManager.cs b/Assets/Scripts/UIManager.cs index bc869c15..edc5e161 100644 --- a/Assets/Scripts/UIManager.cs +++ b/Assets/Scripts/UIManager.cs @@ -32,7 +32,17 @@ public class UIManager : MonoBehaviour this.mMainPanel = value; } } - + public Canvas MainCanvas + { + get + { + if (mMainPanel) + { + return mMainPanel.transform.parent.GetComponent(); + } + return null; + } + } public GameObject Root; private HomeController mHomePanel; diff --git a/Assets/Scripts/Utils/Utils.cs b/Assets/Scripts/Utils/Utils.cs index 594690eb..7d771358 100644 --- a/Assets/Scripts/Utils/Utils.cs +++ b/Assets/Scripts/Utils/Utils.cs @@ -76,7 +76,15 @@ namespace Assets.Scripts } return output; } - + public static bool isPointInTransfrom(this RectTransform rect,Vector2 point) + { + var MainCanvas = UIManager.Instance.MainCanvas; + if (!MainCanvas) return false; + var size = rect.sizeDelta * MainCanvas.transform.localScale; + var sPoint = new Vector2(rect.position.x - rect.pivot.x * size.x, rect.position.y - rect.pivot.y * size.y); + var ePoint = new Vector2(rect.position.x + (1 - rect.pivot.x) * size.x, rect.position.y + (1 - rect.pivot.y) * size.y); + return point.x >= sPoint.x && point.x <= ePoint.x && point.y >= sPoint.y && point.y <= ePoint.y; + } public static bool isLowIPhone() { var info = SystemInfo.deviceModel; diff --git a/Assets/TestTK.cs b/Assets/TestTK.cs deleted file mode 100644 index d556d721..00000000 --- a/Assets/TestTK.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UI; - -public class TestTK : MonoBehaviour -{ - public RawImage image; - private Vector3 delta = Vector3.zero; - - void Start() - { - image = GetComponent(); - TKPanRecognizer pan = new TKPanRecognizer(); - pan.gestureRecognizedEvent += (r) => - { - delta = pan.deltaTranslation; - delta.y = 0; - delta.z = 0; - image.transform.position += delta; - Debug.Log("pan recognizer fired: " + image.transform.position); - }; - TouchKit.addGestureRecognizer(pan); - - TKPinchRecognizer pinch = new TKPinchRecognizer(); - pinch.gestureRecognizedEvent += (r) => - { - image.transform.localScale += Vector3.one * pinch.deltaScale; - Debug.Log("pinch recognizer fired: " + r); - }; - TouchKit.addGestureRecognizer(pinch); - } -} diff --git a/Assets/TestTK.cs.meta b/Assets/TestTK.cs.meta deleted file mode 100644 index fcbf8108..00000000 --- a/Assets/TestTK.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 17cb27f144f572748a0f161b829b3e2c -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: