Ejemplo n.º 1
0
        private void Start()
        {
            // Subscribe to compass event
            OnlineMapsLocationService.instance.OnCompassChanged += OnCompassChanged;

            cameraOrbit = OnlineMapsCameraOrbit.instance;
        }
Ejemplo n.º 2
0
    protected virtual void CacheSerializedProperties()
    {
        if (serializedObject == null)
        {
            return;
        }
        pCreateMarkerInUserPosition = serializedObject.FindProperty("createMarkerInUserPosition");
        pMarkerType               = serializedObject.FindProperty("markerType");
        pMarker3DPrefab           = serializedObject.FindProperty("marker3DPrefab");
        pMarker3DSizeType         = serializedObject.FindProperty("marker3DSizeType");
        pMarker2DTexture          = serializedObject.FindProperty("marker2DTexture");
        pMarker2DAlign            = serializedObject.FindProperty("marker2DAlign");
        pMarkerScale              = serializedObject.FindProperty("markerScale");
        pMarkerTooltip            = serializedObject.FindProperty("markerTooltip");
        pUseCompassForMarker      = serializedObject.FindProperty("useCompassForMarker");
        pUseGPSEmulator           = serializedObject.FindProperty("useGPSEmulator");
        pDisableEmulatorInPublish = serializedObject.FindProperty("disableEmulatorInPublish");
        pEmulatorPosition         = serializedObject.FindProperty("emulatorPosition");
        pEmulatorCompass          = serializedObject.FindProperty("emulatorCompass");
        pCompassThreshold         = serializedObject.FindProperty("compassThreshold");
        pFindLocationByIP         = serializedObject.FindProperty("findLocationByIP");
        pUpdatePosition           = serializedObject.FindProperty("updatePosition");
        pAutoStopUpdateOnInput    = serializedObject.FindProperty("autoStopUpdateOnInput");
        pRestoreAfter             = serializedObject.FindProperty("restoreAfter");
        pLerpCompassValue         = serializedObject.FindProperty("lerpCompassValue");
        pRotateCameraByCompass    = serializedObject.FindProperty("rotateCameraByCompass");

        cameraOrbit = (target as OnlineMapsLocationServiceBase).GetComponent <OnlineMapsCameraOrbit>();
    }
Ejemplo n.º 3
0
    private void Start()
    {
        map         = GetComponent <OnlineMaps>();
        control     = map.control;
        cameraOrbit = GetComponent <OnlineMapsCameraOrbit>();

        ResizeMap();
    }
Ejemplo n.º 4
0
        private void Start()
        {
            cameraOrbit = OnlineMapsCameraOrbit.instance;

            // Create a new marker.
            marker = OnlineMapsMarkerManager.CreateItem(new Vector2(), "Player");

            // Subscribe to UpdateBefore event.
            OnlineMaps.instance.OnUpdateBefore += OnUpdateBefore;
        }
Ejemplo n.º 5
0
 private void OnEnable()
 {
     _instance = this;
     map       = GetComponent <OnlineMaps>();
     if (map == null)
     {
         map = FindObjectOfType <OnlineMaps>();
     }
     control = map.control as OnlineMapsControlBaseDynamicMesh;
 }
Ejemplo n.º 6
0
    private void Start()
    {
        map         = GetComponent <OnlineMaps>();
        cameraOrbit = GetComponent <OnlineMapsCameraOrbit>();

        double lng, lat;

        map.GetPosition(out lng, out lat);
        map.projection.CoordinatesToTile(lng, lat, map.zoom, out tileX, out tileY);
        map.OnChangePosition += OnChangePosition;
    }
Ejemplo n.º 7
0
        private void Start()
        {
            cameraOrbit = OnlineMapsCameraOrbit.instance;

            if (cameraOrbit == null)
            {
                Debug.LogWarning("UI Compass requires Online Maps Camera Orbit.");
                Destroy(gameObject);
                return;
            }

            cameraOrbit.OnCameraControl += OnCameraControl;
        }
Ejemplo n.º 8
0
    private void Start()
    {
        control           = OnlineMapsControlBase.instance;
        control.allowZoom = false;

        cameraOrbit = GetComponent <OnlineMapsCameraOrbit>();

        if (cameraOrbit != null)
        {
            speed             = cameraOrbit.speed;
            cameraOrbit.speed = Vector2.zero;
        }

        gesture.Transformed += GestureOnTransformed;
    }
    private void UpdateCameraRotation()
    {
        OnlineMapsCameraOrbit co = OnlineMapsCameraOrbit.instance;

        if (co == null)
        {
            return;
        }

        float value = co.rotation.y;

        float off  = value - trueHeading;
        float step = 360 * Mathf.Sign(off);

        int i = 10;

        while (Mathf.Abs(off) > 180 && i > 0)
        {
            off   -= step;
            value += step;
            i--;
        }

        if (trueHeading - value > 180)
        {
            value += 360;
        }
        else if (trueHeading - value < -180)
        {
            value -= 360;
        }

        if (!(Math.Abs(trueHeading - value) >= float.Epsilon))
        {
            return;
        }

        if (!lerpCompassValue || Mathf.Abs(trueHeading - value) < 0.003f)
        {
            value = trueHeading;
        }
        else
        {
            value = Mathf.Lerp(value, trueHeading, 0.02f);
        }

        co.rotation = new Vector2(co.rotation.x, value);
    }
Ejemplo n.º 10
0
    private void Start()
    {
        control     = OnlineMapsControlBase.instance;
        cameraOrbit = OnlineMapsCameraOrbit.instance;

        scaleGesture = new ScaleGestureRecognizer();
        scaleGesture.StateUpdated += ScaleGestureCallback;
        FingersScript.Instance.AddGesture(scaleGesture);

        if (cameraOrbit != null)
        {
            rotateGesture = new RotateGestureRecognizer();
            rotateGesture.StateUpdated += RotateGestureCallback;
            FingersScript.Instance.AddGesture(rotateGesture);
        }
    }
Ejemplo n.º 11
0
    private void Start()
    {
        control           = OnlineMapsControlBase.instance;
        control.allowZoom = false;

        EasyTouch.On_Pinch += EasyTouchOnOnPinch;

        cameraOrbit = GetComponent <OnlineMapsCameraOrbit>();
        if (cameraOrbit != null)
        {
            speed                      = cameraOrbit.speed;
            cameraOrbit.speed          = Vector2.zero;
            EasyTouch.On_Drag2Fingers += EasyTouchOnOnDrag2Fingers;
            EasyTouch.On_Twist        += EasyTouchOnOnTwist;
        }
    }
Ejemplo n.º 12
0
    private void Start()
    {
        if (gesture == null)
        {
            Debug.LogWarning("Online Maps TouchScript Connector / Gesture cannot be null");
            Destroy(this);
            return;
        }

        control           = OnlineMapsControlBase.instance;
        control.allowZoom = false;

        dmControl = control as OnlineMapsControlBaseDynamicMesh;

        cameraOrbit = GetComponent <OnlineMapsCameraOrbit>();

        if (cameraOrbit != null)
        {
            speed             = cameraOrbit.speed;
            cameraOrbit.speed = Vector2.zero;
        }

        gesture.Transformed += GestureOnTransformed;
    }
Ejemplo n.º 13
0
 private void OnEnable()
 {
     connector   = target as OnlineMapsFingersTouchGesturesConnector;
     cameraOrbit = connector.GetComponent <OnlineMapsCameraOrbit>();
 }
    private void ResizeMap()
    {
        screenWidth  = Screen.width;
        screenHeight = Screen.height;

        int width  = screenWidth / 256 * 256;
        int height = screenHeight / 256 * 256;

        if (halfSize)
        {
            width  /= 2;
            height /= 2;
        }

        if (screenWidth % 256 != 0)
        {
            width += 256;
        }
        if (screenHeight % 256 != 0)
        {
            height += 256;
        }

        int viewWidth  = width;
        int viewHeight = height;

        if (halfSize)
        {
            viewWidth  *= 2;
            viewHeight *= 2;
        }

        if (OnlineMapsControlBase.instance.resultIsTexture)
        {
            OnlineMapsUtils.Destroy(OnlineMapsControlBase.instance.activeTexture);
            if (OnlineMapsUIImageControl.instance != null)
            {
                OnlineMapsUtils.Destroy(GetComponent <Image>().sprite);
            }
            else if (OnlineMapsSpriteRendererControl.instance != null)
            {
                OnlineMapsUtils.Destroy(GetComponent <SpriteRenderer>().sprite);
            }

            Texture2D texture = new Texture2D(width, height, TextureFormat.RGB24, false);
            OnlineMaps.instance.SetTexture(texture);

            if (OnlineMapsUIRawImageControl.instance != null)
            {
                RectTransform rt = transform as RectTransform;
                rt.sizeDelta = new Vector2(viewWidth, viewHeight);
            }
            else if (OnlineMapsUIImageControl.instance != null)
            {
                RectTransform rt = transform as RectTransform;
                rt.sizeDelta = new Vector2(viewWidth, viewHeight);
            }
            else if (OnlineMapsSpriteRendererControl.instance != null)
            {
                GetComponent <BoxCollider>().size = new Vector3(viewWidth / 100f, viewHeight / 100f, 0.2f);
            }

            OnlineMaps.instance.RedrawImmediately();
        }
        else if (OnlineMapsTileSetControl.instance != null)
        {
            OnlineMapsTileSetControl.instance.Resize(width, height, viewWidth, viewHeight);
            if (OnlineMapsTileSetControl.instance.activeCamera.orthographic)
            {
                OnlineMapsTileSetControl.instance.activeCamera.orthographicSize = viewHeight / 2f;
            }
            else
            {
                OnlineMapsCameraOrbit cameraOrbit = GetComponent <OnlineMapsCameraOrbit>();
                if (cameraOrbit != null)
                {
                    cameraOrbit.distance = viewHeight * 0.8f;
                }
            }
        }
    }
 private void OnEnable()
 {
     connector   = target as OnlineMapsTouchScriptConnector;
     cameraOrbit = connector.GetComponent <OnlineMapsCameraOrbit>();
 }
Ejemplo n.º 16
0
 private void Start()
 {
     cameraOrbit = OnlineMapsCameraOrbit.instance;
 }
Ejemplo n.º 17
0
 private void OnEnable()
 {
     _instance = this;
 }