private void Awake() { _instance = this; if (objConfig == null) { objConfig = Resources.Load <TextAsset>("ObjConfig/ObjConfig"); } string str = objConfig.ToString(); jsonObj = JsonUtility.FromJson <JsonObj>(str); }
// Update is called once per frame void Update() { if (Input.touchCount > 0 && !InfoShow.IsOpen()) { foreach (Touch touch in Input.touches) { switch (touch.phase) { case TouchPhase.Began: isSwipe = true; fingerStartTime = Time.time; fingerStartPos = touch.position; break; case TouchPhase.Canceled: isSwipe = false; break; case TouchPhase.Ended: float gestureTime = Time.time - fingerStartTime; float gestureDist = (touch.position - fingerStartPos).magnitude; if (isSwipe && gestureTime < maxSwipeTime && gestureDist > minSwipeDist) { Vector2 direction = touch.position - fingerStartPos; Vector2 swipeType = Vector2.zero; if (Mathf.Abs(direction.x) > Mathf.Abs(direction.y)) { swipeType = Vector2.right * Mathf.Sign(direction.x); } else { swipeType = Vector2.up * Mathf.Sign(direction.y); } RocketBuy rocketBuy = GetComponent <RocketBuy>(); MapBuy mapBuy = GetComponent <MapBuy>(); if (swipeType.x != 0.0f) { if (swipeType.x < 0.0f) { if (Application.loadedLevelName == "BuyRocket") { rocketBuy.ScrollRight(); } else if (Application.loadedLevelName == "BuyMap") { mapBuy.ScrollRight(); } } else { if (Application.loadedLevelName == "BuyRocket") { rocketBuy.ScrollLeft(); } else if (Application.loadedLevelName == "BuyMap") { mapBuy.ScrollLeft(); } } } } break; } } } }
void Awake() { instance = this; }
private void Form1_FormClosed(object sender, FormClosedEventArgs e) { RegUtil.SetFormPos(this); InfoShow.Dispose(); }