编辑页面手势应用
This commit is contained in:
parent
fd8f419f09
commit
cad2e92fd2
@ -5425,7 +5425,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: 0
|
value: 20
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
- target: {fileID: 5329299856310536127, guid: 6b94e789d6585a04dbdc04c8a7cf97b2,
|
||||||
type: 3}
|
type: 3}
|
||||||
|
|||||||
@ -348,7 +348,6 @@ GameObject:
|
|||||||
- component: {fileID: 1223993130}
|
- component: {fileID: 1223993130}
|
||||||
- component: {fileID: 1223993132}
|
- component: {fileID: 1223993132}
|
||||||
- component: {fileID: 1223993131}
|
- component: {fileID: 1223993131}
|
||||||
- component: {fileID: 1223993133}
|
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: RawImage
|
m_Name: RawImage
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -409,19 +408,6 @@ CanvasRenderer:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1223993129}
|
m_GameObject: {fileID: 1223993129}
|
||||||
m_CullTransparentMesh: 0
|
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
|
--- !u!1 &1362042230
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@ -13,7 +13,7 @@ using System;
|
|||||||
|
|
||||||
public static class App
|
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;
|
public static string AppVersion = Application.version;
|
||||||
|
|
||||||
|
|||||||
@ -47,46 +47,67 @@ public class EditUserController : PFUIPanel, INativeOnMobileImageSelect
|
|||||||
Transform linkContainer;
|
Transform linkContainer;
|
||||||
Dictionary<string, Selectable> dict;
|
Dictionary<string, Selectable> dict;
|
||||||
|
|
||||||
|
Transform panel;
|
||||||
|
float? panelTop = null;
|
||||||
|
UIGradient g1, g2;
|
||||||
protected override void Awake()
|
protected override void Awake()
|
||||||
{
|
{
|
||||||
Debug.Log(Utils.GetIP(Utils.ADDRESSFAM.IPv4));
|
Debug.Log(Utils.GetIP(Utils.ADDRESSFAM.IPv4));
|
||||||
userApi = new UserApi();
|
userApi = new UserApi();
|
||||||
#if !(UNITY_ANDROID || UNITY_IOS)
|
#if !(UNITY_ANDROID || UNITY_IOS)
|
||||||
var panel = this.transform.Find("Panel");
|
panel = this.transform.Find("Panel");
|
||||||
#else
|
#else
|
||||||
var panel = this.transform.Find("Panel/MainPanel");
|
panel = this.transform.Find("Panel/MainPanel");
|
||||||
float? panelTop = null;
|
panelTop = null;
|
||||||
UIGradient g1 = transform.Find("Panel/Btn1").GetComponent<UIGradient>()
|
g1 = transform.Find("Panel/Btn1").GetComponent<UIGradient>();
|
||||||
, g2 = transform.Find("Panel/Btn2").GetComponent<UIGradient>();
|
g2 = transform.Find("Panel/Btn2").GetComponent<UIGradient>();
|
||||||
|
if (!panelTop.HasValue) panelTop = panel.localPosition.y;
|
||||||
UIManager.AddEvent(transform.Find("Panel/Btn1").gameObject, EventTriggerType.PointerClick, b =>
|
UIManager.AddEvent(transform.Find("Panel/Btn1").gameObject, EventTriggerType.PointerClick, b =>
|
||||||
{
|
{
|
||||||
if (!panelTop.HasValue) panelTop = transform.localPosition.y+185;
|
setMobilePanelPosition(true);
|
||||||
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()
|
|
||||||
});
|
});
|
||||||
UIManager.AddEvent(transform.Find("Panel/Btn2").gameObject, EventTriggerType.PointerClick, b =>
|
UIManager.AddEvent(transform.Find("Panel/Btn2").gameObject, EventTriggerType.PointerClick, b =>
|
||||||
{
|
{
|
||||||
if (!panelTop.HasValue) panelTop = transform.localPosition.y+185;
|
setMobilePanelPosition(false);
|
||||||
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");
|
|
||||||
});
|
});
|
||||||
|
Debug.Log(panel.localPosition);
|
||||||
TKPanRecognizer pan = new TKPanRecognizer();
|
TKPanRecognizer pan = new TKPanRecognizer();
|
||||||
var delta = Vector3.zero;
|
var delta = Vector3.zero;
|
||||||
|
var rect = this.transform.Find("Panel").GetComponent<RectTransform>();
|
||||||
|
var startLocation = Vector2.zero;
|
||||||
pan.gestureRecognizedEvent += (r) =>
|
pan.gestureRecognizedEvent += (r) =>
|
||||||
{
|
{
|
||||||
delta = pan.deltaTranslation;
|
//Debug.Log(UIManager.Instance.MainCanvas);
|
||||||
delta.x = 0;
|
//Debug.Log(this.transform.Find("Panel").GetComponent<Collider>().bounds.size
|
||||||
delta.z = 0;
|
startLocation = r.startTouchLocation();
|
||||||
panel.transform.position += delta;
|
if (rect.isPointInTransfrom(startLocation))
|
||||||
//Debug.Log("pan recognizer fired: " + image.transform.position);
|
{
|
||||||
|
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
|
#endif
|
||||||
mID = panel.Find("IDNumber").Find("input").Find("Text").GetComponent<Text>();
|
mID = panel.Find("IDNumber").Find("input").Find("Text").GetComponent<Text>();
|
||||||
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
|
mSexDropdown = panel.Find("SexDropdown").GetComponent<PFUIDropdown>();
|
||||||
@ -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()
|
void SetDayDropdown()
|
||||||
{
|
{
|
||||||
//Debug.Log(mDayDropdown.SelectedItem);
|
//Debug.Log(mDayDropdown.SelectedItem);
|
||||||
|
|||||||
@ -32,7 +32,17 @@ public class UIManager : MonoBehaviour
|
|||||||
this.mMainPanel = value;
|
this.mMainPanel = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public Canvas MainCanvas
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (mMainPanel)
|
||||||
|
{
|
||||||
|
return mMainPanel.transform.parent.GetComponent<Canvas>();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
public GameObject Root;
|
public GameObject Root;
|
||||||
|
|
||||||
private HomeController mHomePanel;
|
private HomeController mHomePanel;
|
||||||
|
|||||||
@ -76,7 +76,15 @@ namespace Assets.Scripts
|
|||||||
}
|
}
|
||||||
return output;
|
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()
|
public static bool isLowIPhone()
|
||||||
{
|
{
|
||||||
var info = SystemInfo.deviceModel;
|
var info = SystemInfo.deviceModel;
|
||||||
|
|||||||
@ -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<RawImage>();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
fileFormatVersion: 2
|
|
||||||
guid: 17cb27f144f572748a0f161b829b3e2c
|
|
||||||
MonoImporter:
|
|
||||||
externalObjects: {}
|
|
||||||
serializedVersion: 2
|
|
||||||
defaultReferences: []
|
|
||||||
executionOrder: 0
|
|
||||||
icon: {instanceID: 0}
|
|
||||||
userData:
|
|
||||||
assetBundleName:
|
|
||||||
assetBundleVariant:
|
|
||||||
Loading…
x
Reference in New Issue
Block a user