Ejemplo n.º 1
0
    // gets the saved stepdata from database
    public void GetSavedSteps()
    {
        ServerResponse sr = UserRequestLibrary.GetResourcesRequest();

        m_currentStepTracker = sr.Resources.StepCounter;

        ResourcesWindow.get.m_StepCounterText.text = ((int)m_currentStepTracker).ToString();
    }
Ejemplo n.º 2
0
    // saves the accumulated steps from player in the database
    public void UpdateStepsInDatabase()
    {
        ServerResponse sr = UserRequestLibrary.GetResourcesRequest();

        if (m_locationTrackable)
        {
            BA_Praxis_Library.Resources res = new BA_Praxis_Library.Resources()
            {
                StepCounter     = (int)m_currentStepTracker,
                AncientMaterial = sr.Resources.AncientMaterial,
                ChaosMaterial   = sr.Resources.ChaosMaterial,
                DarkMaterial    = sr.Resources.DarkMaterial,
                NatureMaterial  = sr.Resources.NatureMaterial,
                NeutralMaterial = sr.Resources.NeutralMaterial
            };

            sr = UserRequestLibrary.UpdateResourcesRequest(res);
        }
    }
Ejemplo n.º 3
0
    // tries to start the gps location system
    private IEnumerator StartGPSLocationService()
    {
        if (!Input.location.isEnabledByUser)
        {
            m_IsGPSEnabled.text = "User has not enabled GPS";
            yield break;
        }

        Input.location.Start();

        int maxWait = 20;

        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }

        if (maxWait <= 0)
        {
            m_IsGPSEnabled.text = "Timed out";
            yield break;
        }

        if (Input.location.status == LocationServiceStatus.Failed)
        {
            m_IsGPSEnabled.text = "Unable to get device location";
            yield break;
        }

        m_Latitude_Latest  = Input.location.lastData.latitude;
        m_Longitude_Latest = Input.location.lastData.longitude;

        m_locationTrackable = true;

        ServerResponse sr = UserRequestLibrary.GetResourcesRequest();

        m_currentStepTracker = sr.Resources.StepCounter;

        m_IsGPSEnabled.text = "GPS active";
    }
Ejemplo n.º 4
0
    public static void UpdateResourcesForCurrentSelectedCharacter(int materialsGained)
    {
        int currentCharID = PlayerData.currentSelectedCharacter;

        ServerResponse sr = UserRequestLibrary.GetResourcesRequest();

        Resources resources = sr.Resources;

        // if character is adventurer
        if (currentCharID == 0)
        {
            resources.NeutralMaterial += materialsGained;
        }

        // if character is bandit | red ogre | werewolf
        else if (currentCharID == 1 || currentCharID == 5 || currentCharID == 9)
        {
            resources.DarkMaterial += materialsGained;
        }

        // if character is golem | satyr | yeti
        else if (currentCharID == 2 || currentCharID == 6 || currentCharID == 10)
        {
            resources.AncientMaterial += materialsGained;
        }

        // if character is wasp | rat | mandrake
        else if (currentCharID == 8 || currentCharID == 4 || currentCharID == 3)
        {
            resources.NatureMaterial += materialsGained;
        }

        // if character is shade
        else if (currentCharID == 7)
        {
            resources.ChaosMaterial += materialsGained;
        }

        UserRequestLibrary.UpdateResourcesRequest(resources);
    }