Example #1
0
    public static float Longitude;  // Boylam

    /**************************************************/

    #region Start

    void Start()
    {
        Instance = this;
        DontDestroyOnLoad(gameObject);

        StartCoroutine(StartLocationService());
    }
Example #2
0
        protected override void OnStart(string[] args)
        {
            base.OnStart(args);

            try
            {
                String device = Properties.Settings.Default.GPSDevice;
                _gpsMgr                 = new GPSManager(device, _gpsdb);
                _gpsMgr.Tracing         = Tracing;
                _gpsMgr.LogPositionWait = 60 * 1000; //record position every minute
                Tracing?.TraceEvent(TraceEventType.Information, 0, "Created GPS manager for device {0}", device);


                //create timer
                _gpstimer          = new Timer();
                _gpstimer.Interval = 2000;
                _gpstimer.Elapsed += new ElapsedEventHandler(this.MonitorGPS);
                _gpstimer.Start();
                Tracing?.TraceEvent(TraceEventType.Information, 0, "Created GPS monitor timer at intervals of {0}", _gpstimer.Interval);
            }
            catch (Exception e)
            {
                Tracing?.TraceEvent(TraceEventType.Error, 0, e.Message);
                throw e;
            }
        }
Example #3
0
    //Saving data
    public void SaveGame()
    {
        //Saving score to leaderboard
        menuManager.GetComponent <GPSManager>().PublishScoreToLeaderboard(score);
        //Loading data and this same creating a save object
        PlayerSaveData psd = SaveManager.LoadData();

        //Checking is new record set
        if (score > psd.bestScore)
        {
            //Saving score to save file
            psd.bestScore = score;
        }
        //Updating money value
        psd.money = money;
        psd.gamesPlayed++;
        //Saving data
        SaveManager.SaveData(psd);
        CheckGamesPlayed(psd.gamesPlayed);
        if (psd.money >= 100)
        {
            GPSManager.UnlockAchievement(GPGSIds.achievement_have_at_least_100_bucks);
        }

        try
        {
            this.GetComponent <GPSManager>().OpenSave(true);
        }
        catch (Exception e)
        {
        }
    }
Example #4
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Example #5
0
 void Awake()
 {
     if (singleton != null)
     {
         Debug.LogError("GPSManager already exists!");
     }
     singleton = this;
 }
Example #6
0
    // Start is called before the first frame update
    void Start()
    {
#if UNITY_ANDROID
        GPSManager.Get().SignIn();
#endif
        playerGO     = GameObject.FindGameObjectWithTag("Player");
        playerScript = playerGO.GetComponentInChildren <PlayerController>();
    }
Example #7
0
 /**
  * Handles Button Click
  */
 public void OnAchievementsButtonClick()
 {
     if (_isPlaying)
     {
         return;
     }
     audioManager.PlayTapUI();
     GPSManager.ShowAchievementsUI();
 }
Example #8
0
 /**
  * Handles Button Click
  */
 public void OnLeaderboardButtonClick()
 {
     if (_isPlaying)
     {
         return;
     }
     audioManager.PlayTapUI();
     GPSManager.ShowLeaderboardUI();
 }
Example #9
0
    private void Start()
    {
        //Permission.RequestUserPermission(Permission.FineLocation);
        //dialog = new GameObject();

        Instance = this;
        DontDestroyOnLoad(gameObject);
        StartCoroutine(StartLocationService());
    }
Example #10
0
    public void Awake()
    {
        if (Instance != null)
        {
            Destroy(this);
        }

        Instance = this;
    }
 private void Start()
 {
     //for landscape view
     Screen.orientation = ScreenOrientation.LandscapeLeft;
     Instance           = this;
     //to have unbreakable connection between app and GPS services
     DontDestroyOnLoad(gameObject);
     StartCoroutine(InitializationOfLocationService());
 }
 public void TutorialMenuButtonClicked()
 {
     if (canInteract)
     {
         ButtonClickSound();
         canInteract = false;
         PlayerSaveData psd = SaveManager.LoadData();
         GPSManager.UnlockAchievement(GPGSIds.achievement_beginner_is_here);
         StartCoroutine("ToggleTutorialPanel", false);
     }
 }
Example #13
0
 //Detecting collision with trigger
 void OnTriggerEnter2D(Collider2D other)
 {
     //Checking is that deadLine
     if (other.CompareTag("DeadLine"))
     {
         audioManager.GetComponent <AudioManagerScript>().DeathLane.Play();
         GPSManager.UnlockAchievement(GPGSIds.achievement_get_burnt);
         //Handheld.Vibrate();
         StartCoroutine("KillPlayer");
     }
     //Checking is that boost
     else if (other.CompareTag("BoostJump") && activeBoostID == 0)
     {
         audioManager.GetComponent <AudioManagerScript>().BubbleDestroy.Play();
         GPSManager.UnlockAchievement(GPGSIds.achievement_boost_up);
         StartCoroutine(BoostJump(other, false));
     }
     else if (other.CompareTag("BoostMagnet") && activeBoostID == 0)
     {
         audioManager.GetComponent <AudioManagerScript>().BubbleDestroy.Play();
         GPSManager.UnlockAchievement(GPGSIds.achievement_boost_up);
         StartCoroutine("BoostMagnet", other);
     }
     else if (other.CompareTag("BoostMultipler") && activeBoostID == 0)
     {
         audioManager.GetComponent <AudioManagerScript>().BubbleDestroy.Play();
         GPSManager.UnlockAchievement(GPGSIds.achievement_boost_up);
         StartCoroutine("BoostMultipler", other);
     }
     else if (other.CompareTag("BoostShield") && activeBoostID == 0)
     {
         audioManager.GetComponent <AudioManagerScript>().BubbleDestroy.Play();
         GPSManager.UnlockAchievement(GPGSIds.achievement_boost_up);
         StartCoroutine("BoostShield", other);
     }
     else if (other.CompareTag("Coin"))
     {
         CollectCoin(other.gameObject);
     }
     else if (other.CompareTag("Crystal"))
     {
         CollectCrystal(other.gameObject);
     }
     //Checking is that best score lane
     else if (other.CompareTag("ScoreLane"))
     {
         audioManager.GetComponent <AudioManagerScript>().RecordLane.Play();
         Instantiate(scoreLaneDestroyEffect, new Vector3(0f, other.gameObject.transform.position.y, 0f), Quaternion.identity);
         Destroy(other.gameObject);
         Handheld.Vibrate();
         menuManager.GetComponent <MenuManagerScript>().ChangeScoreColor(false);
     }
 }
Example #14
0
 /**
  * Handles Button Click
  */
 public void OnAboutButtonClick()
 {
     if (_isPlaying)
     {
         return;
     }
     audioManager.PlayTapUI();
     Social.ReportProgress(GPGSIds.achievement_thank_you, 0.0f, null);
     aboutPanel.SetActive(!aboutPanel.activeSelf);
     tapToStartText.gameObject.SetActive(!aboutPanel.activeSelf);
     GPSManager.ThankYouAchievement();
 }
    /**
     * Loads flags from the player prefs
     */
    private void LoadFlagsFromPlayerPrefs()
    {
        _isIarPopUpPossible = PlayerPrefsManager.GetTimesOpen() < TimesToOpenB4IarCall &&
                              PlayerPrefsManager.GetTimesPlayed() < TimesToPlayB4IarCall;

        if (PlayerPrefsManager.IsAutoLogin())
        {
            GPSManager.SignInToGooglePlayServices();
        }

        audioManager.SetSound(PlayerPrefsManager.IsSoundOn());
    }
Example #16
0
        /// <summary>
        /// Begins the listening for messages, and signals from the signal app
        /// </summary>
        public void StartListening()
        {
            SubscribeGeneralMessage(Gestures.UP);
            SubscribeGeneralMessage(Gestures.DOWN);
            SubscribeGeneralMessage(Gestures.LEFT);
            SubscribeGeneralMessage(Gestures.RIGHT);
            IMusicManager musicManager = new SpotifyManager();

            actionHandler.RegisterMusicManager(musicManager);
            MessagingCenter.Subscribe <SettingsViewModel>(this, Gestures.SPOTIFY, async message =>
            {
                if (!actionHandler.HasAuthenticatedMusicManager)
                {
                    MessagingCenter.Subscribe <SpotifyLoginMessage>(this, "LoginSuccess", message =>
                    {
                        if (!actionHandler.HasAuthenticatedMusicManager)
                        {
                            actionHandler.UpdateMusicManagerAuthentication(true);
                            MessagingCenter.Send(new SpotifyLoginMessage("RegistrationSuccess", message.HasPremium), "RegistrationSuccess");
                        }
                    });
                    await musicManager.Init();
                }
            });
            MessagingCenter.Subscribe <DNDPermissionMessage>(this, "DNDAdded", message =>
            {
                if (!notificationManager.IsNotificationPolicyAccessGranted)
                {
                    Intent intent = new Intent(Android.Provider.Settings.ActionNotificationPolicyAccessSettings);
                    StartActivity(intent);
                }
                else
                {
                    MessagingCenter.Send(new DNDPermissionMessage(), "DNDGranted");
                }
            });

            MessagingCenter.Subscribe <string>(this, "GPSRoute", async message =>
            {
                GPSManager gpsManager = new GPSManager();
                GPSHandler handler    = new GPSHandler();
                GPSSetting setting    = await handler.GetSetting();
                Rootobject root       = await gpsManager.GetDirectionsAsync(setting.Destination, setting.Mode);
                if (root.status.Equals("NOT_FOUND"))
                {
                    MessagingCenter.Send <string>("", "Unsuccessful");
                    return;
                }
                MessagingCenter.Send <string, Rootobject>("", "GetRoute", root);
            });
        }
 /**
  * Ends game
  */
 private void OnPlayerDestroy()
 {
     audioManager.PlayDestroyPlayer();
     cameraManager.StartShaking();
     _currentGameState = GameState.Waiting;
     uiManager.ShowReturningMenuUI();
     StartCoroutine(WaitToRestart());
     CheckNewHighScore();
     GPSManager.SubmitScore(_score);
     GPSManager.CheckAchievement(_score);
     levelManager.EndLevel();
     playerManager.SpawnPlayer();
     CheckForIARPopUp();
 }
Example #18
0
 //Checks achievements
 public void CheckGamesPlayed(int gamesPlayed)
 {
     if (gamesPlayed >= 100)
     {
         GPSManager.UnlockAchievement(GPGSIds.achievement_play_100_games);
     }
     else if (gamesPlayed >= 10)
     {
         GPSManager.UnlockAchievement(GPGSIds.achievement_play_10_games);
     }
     if (gamesPlayed >= 1)
     {
         GPSManager.UnlockAchievement(GPGSIds.achievement_play_1_game);
     }
 }
Example #19
0
    public void AddScore()
    {
        score += 100;

#if UNITY_ANDROID
        if (score == 1000)
        {
            GPSManager.Get().UnlockAchievement1000();
        }

        if (score == 2000)
        {
            GPSManager.Get().UnlockAchievement2000();
        }
#endif
    }
    //Gets prize
    public void GetPrize()
    {
        ButtonClickSound();
        if (canInteract && IsPrizeReady())
        {
            audioManager.GetComponent <AudioManagerScript>().IAPbuy.Play();
            canInteract = false;
            microtransactionsAnimator.SetTrigger("getPrize");
            PlayerSaveData psd = SaveManager.LoadData();
            psd.freePrizeCollectedDate = DateTime.Now;

            microtransactionsSpecialMoneyAnimation.SetActive(false);
            microtransactionsSpecialMoneyAnimation.SetActive(true);
            microtransactionsMoneyAnimation.SetActive(false);
            microtransactionsMoneyAnimation.SetActive(true);

            psd.specialMoney += UnityEngine.Random.Range(1, 3);
            psd.money        += UnityEngine.Random.Range(5, 11);

            freePrizeDate = DateTime.Now;
            SaveManager.SaveData(psd);
            UpdateMoneyInMenu(psd.money, psd.specialMoney);
            gameManager.GetComponent <GameManagerScript>().money = psd.money;
            UpdateMoneyInGame(psd.money);
            CheckFreePrize();
            canInteract = true;

            if (psd.money >= 100)
            {
                GPSManager.UnlockAchievement(GPGSIds.achievement_have_at_least_100_bucks);
            }
            if (psd.specialMoney >= 100)
            {
                GPSManager.UnlockAchievement(GPGSIds.achievement_have_at_least_100_crystals);
            }

            try
            {
                this.GetComponent <GPSManager>().OpenSave(true);
            }
            catch (Exception e)
            {
            }
        }
    }
Example #21
0
    public void Start()
    {
        AlertsAPI.instance.Init();

        if (MissionManager.mission.audio_enabled)
        {
            backScene = "Voice";
        }
        else if (MissionManager.mission.photo_enabled)
        {
            backScene = "Media";
        }
        else
        {
            backScene = "Description";
        }

        GPSManager.StartGPS();
    }
Example #22
0
    public void RequestCoordinates()
    {
        bool requestSuccess = GPSManager.ReceivePlayerLocation();

        if (!requestSuccess || GPSManager.location == null)
        {
            return;
        }

        if (GPSManager.location[0] == 0 || GPSManager.location[1] == 0 || !GPSManager.IsActive())
        {
            AlertsAPI.instance.makeAlert("GPS desligado!\nAtive o serviço de localização do celular na barra superior do dispositivo.", "Entendi");
            return;
        }

        AlertsAPI.instance.makeToast("Localização obtida", 1);
        string playerLocation = GPSManager.location[0] + " | " + GPSManager.location[1];

        MissionManager.missionResponse.coordinates = playerLocation;
    }
Example #23
0
 private void ShareCallBack(IShareResult result)
 {
     if (result.Error != null || result.Cancelled)
     {
         StartCoroutine(this.GetComponent <MenuManagerScript>().ToggleInfoPanel("Something went wrong while posting... :(", true));
     }
     else
     {
         PlayerSaveData psd = SaveManager.LoadData();
         if (!psd.isSharedPost)
         {
             psd.isSharedPost  = true;
             psd.specialMoney += 100;
             GPSManager.UnlockAchievement(GPGSIds.achievement_have_at_least_100_crystals);
             this.GetComponent <MenuManagerScript>().UpdateMoneyInMenu(psd.money, psd.specialMoney);
             SaveManager.SaveData(psd);
             StartCoroutine(this.GetComponent <MenuManagerScript>().ToggleInfoPanel("Successfully got 100 crystals!", true));
         }
     }
 }
Example #24
0
    public void ContinueMission()
    {
        if (MissionManager.missionResponse.coordinates != null)
        {
            GPSManager.StopGPS();

            if (MissionManager.mission.text_enabled)
            {
                LoadScene("Write");
            }
            else
            {
                LoadScene("Send");
            }
        }
        else
        {
            AlertsAPI.instance.makeToast("Marque o local da missão", 1);
        }
    }
Example #25
0
    //Adding and saving money after purchase
    public void AddPurchasedMoney(int ammount, bool isSpecial)
    {
        audioManager.GetComponent <AudioManagerScript>().IAPbuy.Play();

        PlayerSaveData psd = SaveManager.LoadData();

        if (isSpecial)
        {
            psd.specialMoney += ammount;
            if (psd.specialMoney >= 100)
            {
                GPSManager.UnlockAchievement(GPGSIds.achievement_have_at_least_100_crystals);
            }
        }
        else
        {
            psd.money += ammount;
            if (psd.specialMoney >= 100)
            {
                GPSManager.UnlockAchievement(GPGSIds.achievement_have_at_least_100_bucks);
            }
        }

        //Saving data
        SaveManager.SaveData(psd);

        menuManager.GetComponent <MenuManagerScript>().UpdateMoneyInMenu(psd.money, psd.specialMoney);

        try
        {
            this.GetComponent <GPSManager>().OpenSave(true);
        }
        catch (Exception e)
        {
        }
    }
Example #26
0
    // Use this for initialization
    void Start()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        DateTime time = DateTime.Now;

        Application.runInBackground = true;
        timeActive = 0;
        day        = time.Day;
        move       = false;

        puffManager = GetComponent <PuffManager>();
        gpsManager  = GetComponent <GPSManager>();

        StartCoroutine(DayTimer());
        StartCoroutine(Move());
    }
Example #27
0
    public IEnumerator Start()
    {
        Instance = this;
        if (!Input.location.isEnabledByUser)
            AutomaticLocation.Instance.debug = "Disabled";

        Input.location.Start();
        int maxWait = 20;
        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0) {
            yield return new WaitForSeconds(1);
            maxWait--;
        }
        if (maxWait < 1) {
            AutomaticLocation.Instance.debug = "Timed out";
        }
        if (Input.location.status == LocationServiceStatus.Failed) {
            AutomaticLocation.Instance.debug = "Unable to determine device location";
        } else
        {
            AutomaticLocation.Instance.debug = "Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp;
            //AutomaticLocation.Instance.debug = "Requesting city";
            StartCoroutine(City(Input.location.lastData.latitude.ToString(),Input.location.lastData.longitude.ToString()));
        }
        Input.location.Stop();
    }
Example #28
0
 private void Awake()
 {
     Instance = this;
     //DontDestroyOnLoad(gameObject);
     StartCoroutine(StartLocationService());
 }
    // ReSharper disable once InconsistentNaming

    /**
     * Overwrites GPS highScore with local highScore
     */
    internal static void OverwriteGPSHighScore()
    {
        GPSManager.SubmitScore(PlayerPrefsManager.GetLocalHighScore());
    }
    //When player pressed button to buy/select character
    public void CharactersButtonClicked(int id, bool owned, bool special)
    {
        if (canInteract)
        {
            ButtonClickSound();
            canInteract = false;
            int cost = this.GetComponent <CharactersDataScript>().characterCost[id];
            //Checking that is player having that character
            if (owned)
            {
                //Finding player
                GameObject player = GameObject.Find("Player");
                //Setting a new sprite
                player.GetComponent <SpriteRenderer>().sprite = this.GetComponent <CharactersDataScript>().characterSprite[id];
                //Saving new selected player id
                this.GetComponent <CharactersDataScript>().choosedCharacterID = id;
                PlayerSaveData psd = SaveManager.LoadData();
                psd.choosedCharacter = id;
                SaveManager.SaveData(psd);
                StartCoroutine("OpenMainMenu", 2);

                try
                {
                    this.GetComponent <GPSManager>().OpenSave(true);
                }
                catch (Exception e)
                {
                }
            }
            else
            {
                if (special)
                {
                    PlayerSaveData psd = SaveManager.LoadData();
                    //Checking is player have enought money to buy character
                    if (psd.specialMoney >= cost)
                    {
                        //Finding player
                        GameObject player = GameObject.Find("Player");
                        //Setting a new sprite
                        player.GetComponent <SpriteRenderer>().sprite = this.GetComponent <CharactersDataScript>().characterSprite[id];
                        //Saving new selected player id and money
                        this.GetComponent <CharactersDataScript>().choosedCharacterID  = id;
                        this.GetComponent <CharactersDataScript>().ownedCharacters[id] = true;
                        psd.specialMoney       -= cost;
                        psd.choosedCharacter    = id;
                        psd.ownedCharacters[id] = true;
                        SaveManager.SaveData(psd);
                        UpdateMoneyInMenu(psd.money, psd.specialMoney);
                        StartCoroutine("OpenMainMenu", 2);
                        GPSManager.UnlockAchievement(GPGSIds.achievement_get_first_special_character);

                        try
                        {
                            this.GetComponent <GPSManager>().OpenSave(true);
                        }
                        catch (Exception e)
                        {
                        }
                    }
                    else
                    {
                        canInteract = true;
                    }
                }
                else
                {
                    PlayerSaveData psd = SaveManager.LoadData();
                    //Checking is player have enought money to buy character
                    if (psd.money >= cost)
                    {
                        //Finding player
                        GameObject player = GameObject.Find("Player");
                        //Setting a new sprite
                        player.GetComponent <SpriteRenderer>().sprite = this.GetComponent <CharactersDataScript>().characterSprite[id];
                        //Saving new selected player id and money
                        this.GetComponent <CharactersDataScript>().choosedCharacterID  = id;
                        this.GetComponent <CharactersDataScript>().ownedCharacters[id] = true;
                        psd.money              -= cost;
                        psd.choosedCharacter    = id;
                        psd.ownedCharacters[id] = true;

                        int y = 0;
                        foreach (bool x in psd.ownedCharacters)
                        {
                            if (x)
                            {
                                y++;
                            }
                        }
                        if (y >= 10)
                        {
                            GPSManager.UnlockAchievement(GPGSIds.achievement_get_10_characters);
                        }
                        else if (y >= 2)
                        {
                            GPSManager.UnlockAchievement(GPGSIds.achievement_get_first_character);
                        }

                        SaveManager.SaveData(psd);
                        gameManager.GetComponent <GameManagerScript>().money = psd.money;
                        UpdateMoneyInMenu(psd.money, psd.specialMoney);
                        StartCoroutine("OpenMainMenu", 2);

                        try
                        {
                            this.GetComponent <GPSManager>().OpenSave(true);
                        }
                        catch (Exception e)
                        {
                        }
                    }
                    else
                    {
                        canInteract = true;
                    }
                }
            }
        }
    }
 private void Awake()
 {
     GPSManager.Activate();
 }