using Assets.Scripts; using Assets.Scripts.Apis; using Assets.Scripts.Apis.Models; using Assets.Scripts.Mobile.Interface; using Assets.Scripts.UI.Control; using Assets.Scripts.UI.UIEffect; using DG.Tweening; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Runtime.InteropServices; using System.Threading.Tasks; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.SceneManagement; using UnityEngine.UI; public class EditUserController : PFUIPanel, INativeOnMobileImageSelect { private Button mSaveButton; private PFUIDropdown mSexDropdown; private PFUIDropdown mDayDropdown; private PFUIDropdown mMonthDropdown; private PFUIDropdown mYearDropdown; private PFUIDropdown mConutryDropdown; private PFUIDropdown mUnitDropdown; private Text mID; private PFUIInputField mNickName; private PFUIInputField mFTP; private PFUIInputField mWeight; private PFUIInputField mHeight; private PFUIInputField mMHR; private PFUIInputField mBW; private PFUIInputField mWD; private PFUIInputField mName; private PFUIInputField mPhone; private PFUIInputField mAddr; private RawImage mHeadImage; private UserApi userApi; private Button mCancelButton; private Button mBackButton; private Button mSwitchButton; PfUIButton mChangeAvatar; Transform linkContainer; Dictionary dict; Transform panel; float? panelTop = null; UIGradient g1, g2; TKPanRecognizer pan; protected override void Awake() { Debug.Log(Utils.GetIP(Utils.ADDRESSFAM.IPv4)); userApi = new UserApi(); #if !(UNITY_ANDROID || UNITY_IOS) panel = this.transform.Find("Panel"); pan = new TKPanRecognizer(); #else 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 => { setMobilePanelPosition(true); }); UIManager.AddEvent(transform.Find("Panel/Btn2").gameObject, EventTriggerType.PointerClick, b => { setMobilePanelPosition(false); }); Debug.Log(panel.localPosition); pan = new TKPanRecognizer(); var delta = Vector3.zero; var rect = this.transform.Find("Panel").GetComponent(); var startLocation = Vector2.zero; pan.gestureRecognizedEvent += (r) => { //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(); mSexDropdown = panel.Find("SexDropdown").GetComponent(); mYearDropdown = panel.Find("YearDropdown").GetComponent(); mMonthDropdown = panel.Find("MonthDropdown").GetComponent(); mDayDropdown = panel.Find("DayDropdown").GetComponent(); mUnitDropdown = panel.Find("UnitDropdown").GetComponent(); mSaveButton = this.transform.Find("SaveButton").GetComponent