编辑页面手势应用
This commit is contained in:
1 parent
fd8f419f09
commit
cad2e92fd2
8 files changed
+88
-86
No files matched your search
@@ -47,46 +47,67 @@ public class EditUserController : PFUIPanel, INativeOnMobileImageSelect
|
||||
Transform linkContainer;
|
||||
Dictionary<string, Selectable> 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<UIGradient>()
|
||||
, g2 = transform.Find("Panel/Btn2").GetComponent<UIGradient>();
|
||||
panel = this.transform.Find("Panel/MainPanel");
|
||||
panelTop = null;
|
||||
g1 = transform.Find("Panel/Btn1").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 =>
|
||||
{
|
||||
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<RectTransform>();
|
||||
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<Collider>().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<Text>();
|
||||
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()
|
||||
{
|
||||
//Debug.Log(mDayDropdown.SelectedItem);
|
||||
|
||||
Reference in new issue
Block a user