private void Start()
        {
            // Gets the current 3D control.
            OnlineMapsControlBase3D control = OnlineMapsControlBase3D.instance;

            if (control == null)
            {
                Debug.LogError("You must use the 3D control (Texture or Tileset).");
                return;
            }

            //Create a marker to show the current GPS coordinates.
            //Instead of "null", you can specify the texture desired marker.
            locationMarker = OnlineMapsMarker3DManager.CreateItem(Vector2.zero, prefab);

            //Hide handle until the coordinates are not received.
            locationMarker.enabled = false;

            // Gets Location Service Component.
            OnlineMapsLocationService ls = OnlineMapsLocationService.instance;

            if (ls == null)
            {
                Debug.LogError(
                    "Location Service not found.\nAdd Location Service Component (Component / Infinity Code / Online Maps / Plugins / Location Service).");
                return;
            }

            //Subscribe to the GPS coordinates change
            ls.OnLocationChanged += OnLocationChanged;
            ls.OnCompassChanged  += OnCompassChanged;

            //Subscribe to zoom change
            OnlineMaps.instance.OnChangeZoom += OnChangeZoom;
        }
Exemple #2
0
    private void OnEnable()
    {
        if (mapCamera != null)
        {
            mapCamera.gameObject.SetActive(true);
        }
        if (map != null)
        {
            map.gameObject.SetActive(true);
        }

        if (storesLoaded == false)
        {
            storesLoaded = true;
            MeridianApp.Instance.GetStoresCatalog(GetStoresCatalogDelegate);

            OnlineMapsLocationService locationService = OnlineMapsLocationService.instance;

            startZoom = OnlineMaps.instance.zoom;

            if (locationService != null)
            {
                locationService.OnLocationChanged += OnLocationChanged;
            }
        }
    }
Exemple #3
0
    private static void LoadLocationService(OnlineMapsXML el, OnlineMaps api)
    {
        OnlineMapsLocationService ls = api.GetComponent <OnlineMapsLocationService>();

        ls.desiredAccuracy            = el.Get <float>("DesiredAccuracy");
        ls.updatePosition             = el.Get <bool>("UpdatePosition");
        ls.createMarkerInUserPosition = el.Get <bool>("CreateMarkerInUserPosition");
        ls.restoreAfter = el.Get <int>("RestoreAfter");

        if (ls.createMarkerInUserPosition)
        {
            ls.markerType = (OnlineMapsLocationServiceMarkerType)el.Get <int>("MarkerType");

            if (ls.markerType == OnlineMapsLocationServiceMarkerType.twoD)
            {
                ls.marker2DTexture = GetObject(el.Get <int>("Marker2DTexture")) as Texture2D;
                ls.marker2DAlign   = (OnlineMapsAlign)el.Get <int>("Marker2DAlign");
            }
            else
            {
                ls.marker3DPrefab = GetObject(el.Get <int>("Marker3DPrefab")) as GameObject;
            }

            ls.markerTooltip       = el.Get <string>("MarkerTooltip");
            ls.useCompassForMarker = el.Get <bool>("UseCompassForMarker");
        }

        ls.useGPSEmulator = el.Get <bool>("UseGPSEmulator");
        if (ls.useGPSEmulator)
        {
            ls.emulatorPosition = el.Get <Vector2>("EmulatorPosition");
            ls.emulatorCompass  = el.Get <float>("EmulatorCompass");
        }
    }
 private void OnEnable()
 {
     _instance = this;
     if (api != null)
     {
         api.OnChangePosition += OnChangePosition;
     }
 }
 void Start()
 {
     if (Debug.isDebugBuild)
     {
         text     = GetComponent <Text>();
         location = MapManager.Instance.location;
     }
     else
     {
         Destroy(gameObject);
     }
 }
        public MockLocationService(ITimerService timerService)
        {
            timerService.AddListenerOnTimer(OnTimePassed, 2);
            OnlineMapsLocationService ls = OnlineMapsLocationService.instance;

            ls.OnLocationChanged += pos =>
            {
                hasInitialized = true;
                realPos        = GPSPos.FromOnlineMapVector2(pos);
                UpdateCurrentPos();
                onLocationChanged.SafeInvoke(currentPos);
            };
            CommandHandlers.RegisterCommandHandlers(this);
        }
Exemple #7
0
    void Start()
    {
        AnimTreasure.transform.localScale = new Vector3(0, 0, 0);

        BTNClose.onClick.AddListener(DoCloseWindow);
        BTNPanelClose.onClick.AddListener(DoCloseWindow);
        BTNPlayYoutube.onClick.AddListener(DoPlayYoutube);
        Open3D.onClick.AddListener(OnOpenAR);

        locationService = OnlineMapsLocationService.instance;
        if (locationService != null)
        {
            locationService.OnLocationChanged += OnDistanceChange;
        }

        CloseSelfImmediate();
    }
Exemple #8
0
        private void Start()
        {
            // Create a new marker.
            playerMarker = OnlineMaps.instance.AddMarker(new Vector2(0, 0), null, "Player");

            // Get instance of LocationService.
            OnlineMapsLocationService locationService = OnlineMapsLocationService.instance;

            if (locationService == null)
            {
                Debug.LogError(
                    "Location Service not found.\nAdd Location Service Component (Component / Infinity Code / Online Maps / Plugins / Location Service).");
                return;
            }

            // Subscribe to the change location event.
            locationService.OnLocationChanged += OnLocationChanged;
        }
// ReSharper disable once UnusedMember.Local
    private void OnEnable()
    {
        _instance = this;
    }
Exemple #10
0
// ReSharper disable once UnusedMember.Local
    private void OnEnable()
    {
        _instance = this;
    }
 private void OnEnable()
 {
     ls = target as OnlineMapsLocationService;
 }
Exemple #12
0
    // Use this for initialization
    void Start()
    {
        if (!started)
        {
            started = true;
            UnityEngine.Debug.Log(Player.playerID);
            try
            {
                locService = Input.location;
                if (locService.status == LocationServiceStatus.Stopped)
                {
                    if (!locService.isEnabledByUser)
                    {
                        //display some sort of error message telling user location services must be enabled
                    }

                    locService.Start();

                    //isnt working so remove location startup stuff so dont have to wait
                    //MAKE SURE YOU CHANGE BACK LATER (SHOULD BE 30)
                    int timeout = 30;

                    //potentially display some sort of loading screen while waiting for location services, etc.
                    while (Input.location.status == LocationServiceStatus.Initializing && timeout > 0)
                    {
                        Thread.Sleep(1000);
                        timeout--;
                    }

                    if (timeout < 1 || Input.location.status == LocationServiceStatus.Failed)
                    {
                        //display some sort of error message, failed to start location services
                    }
                }

                //DontDestroyOnLoad(gameObject);

                coords = new byte[UPDATE_SIZE];
                size   = new byte[4];

                //remote endpoint of the server
                IPEndPoint remoteEP = new IPEndPoint(IP, OVERWORLD_PORT);

                //create TCP socket
                client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

                //connect to remote endpoint
                client.Connect(remoteEP);

                UnityEngine.Debug.Log("Connect Overworld Successful");

                //send the players id to the server
                client.Send(Player.playerID.ToByteArray());

                //upNearbyObj = false;
                waitUpdate = new ManualResetEvent(false);
                rand       = new System.Random();

                UnityEngine.Debug.Log("Connect Successful");


                t = new Timer(setUpdate, null, 0, 12000);

                //start receiving updates from server
                client.BeginReceive(size, 0, 4, 0, new AsyncCallback(updateDriver), null);

                // Gets the current 3D control.
                control = OnlineMapsControlBase3D.instance;
                if (control == null)
                {
                    UnityEngine.Debug.LogError("You must use the 3D control (Texture or Tileset).");
                    return;
                }
                //Create a marker to show the current GPS coordinates.
                //Instead of "null", you can specify the texture desired marker.
                locationMarker = control.AddMarker3D(Vector2.zero, prefab);

                //Hide handle until the coordinates are not received.
                locationMarker.enabled = true;

                // Gets Location Service Component.
                OnlineMapsLocationService ls = OnlineMapsLocationService.instance;

                if (ls == null)
                {
                    UnityEngine.Debug.LogError(
                        "Location Service not found.\nAdd Location Service Component (Component / Infinity Code / Online Maps / Plugins / Location Service).");
                    return;
                }

                //Subscribe to the GPS coordinates change
                ls.OnLocationChanged += OnLocationChanged;
                ls.OnCompassChanged  += OnCompassChanged;
            }
            //catch exception if fail to connect
            catch (Exception e)
            {
                UnityEngine.Debug.Log(e.ToString());
                UnityEngine.Debug.Log("Connection Failure");
            }
        }
    }
Exemple #13
0
 void Start()
 {
     ls = OnlineMapsLocationService.instance;
 }
 private void OnEnable()
 {
     ls = target as OnlineMapsLocationService;
 }