Example #1
0
    public IEnumerator WriteScoreToServer(int score, string facebookid)
    {
        // Writing score to the server and waiting for the callback with the data.
        // Callback is then checked to see whetver the server returned error or not.

        Cus.LogAMessage("[ServerScoreboard]: Trying to write the score to the Server DB... \n");

        WWW www = new WWW(url);

        yield return(www);

        if (www.isDone == true)
        {
            if (!string.IsNullOrEmpty(www.error) || www.text.Contains("[ERROR]") == true)
            {
                if (www.error != null && www.error != String.Empty && www.error != "")
                {
                    Cus.LogAMessage("[ServerScoreboard]: Error while trying to open/load the website DB, because: " + www.error.ToString());
                }
                else
                {
                    Cus.LogAMessage("[ServerScoreboard]: Error while trying to open/load the website DB, because: " + www.text);
                }
            }
            else
            {
                Cus.LogAMessage("[ServerScoreboard]: Successfully uploaded the score to the server DB...\n");
                PlayerPrefs.SetInt("highest_player_score", StatsM.StatsScoreFromWord);
                int b = PlayerPrefs.GetInt("highest_player_score")
                ;               Cus.LogAMessage("[ServerScoreboard]: Highest player score set to:" + b);
            }
        }
    }
Example #2
0
    // Function which updates statistics after each question.
    public void UpdateStatistics(int value, string target)
    {
        Cus.LogAMessage("[Statistics]: Updating local player data...\n");

        StatsScoreFromWord = value;

        if (target == "update_score")
        {
            StatsScore += value;
            PlayerPrefs.SetInt("TotalScore", StatsScore);
        }
    }
Example #3
0
    // Randomize data and sort that data into lists by their difficulty levels.
    private void RandomizeData()
    {
        // Seed for generating random values.
        System.Random rnd = new System.Random();

        string[] def_array = null;
        int      random_sk = 0;
        string   laikinas;

        for (int b = 0; b < TextAssetCount; b++)
        {
            // Choose the word list.
            if (b == 0)
            {
                def_array = WordsEasy;
            }
            else if (b == 1)
            {
                def_array = WordsMedium;
            }
            else if (b == 2)
            {
                def_array = WordsHard;
            }
            else if (b == 3)
            {
                def_array = WordsVeryHard;
            }

            for (int i = 0; i < def_array.Length; i++)
            {
                // Randomize values in the word list.
                random_sk = rnd.Next(0, def_array.Length - 1);

                def_array[i]         = def_array[i].TrimEnd(new char[] { '\r', '\n' });
                def_array[random_sk] = def_array[random_sk].TrimEnd(new char[] { '\r', '\n' });

                laikinas             = def_array[random_sk];
                def_array[random_sk] = def_array[i];
                def_array[i]         = laikinas;
            }
        }

        Cus.LogAMessage("EASY: " + WordsEasy.Length);
        Cus.LogAMessage("MED: " + WordsMedium.Length);
        Cus.LogAMessage("HARD: " + WordsHard.Length);
        Cus.LogAMessage("VERYHARD: " + WordsVeryHard.Length);

        DataActionsAreFinished = true;
    }
Example #4
0
 // Function for confirming selected game mode.
 public void GameModeWasSelected()
 {
     if (CurrentGameMode == "SinglePlayer")
     {
         Anc.PlayAnimForward(1);
     }
     else if (CurrentGameMode == "TwoPlayers")
     {
         CustomWordInput.text = "Įveskite žodį";
         Anc.PlayAnimForward(2);
     }
     Cus.LogAMessage("[Game]: Game mode was selected: " + CurrentGameMode + "\n");
     MostRecentGameMode = CurrentGameMode;
 }
Example #5
0
    // Awake function for Facebook SDK initialization.
    void Awake()
    {
        ShareStatusTimerIsActive = false;
        ShareStatusWindowTimer   = ShareStatusWindowTimerDefault;

        if (!FB.IsInitialized)
        {
            // Initialize the Facebook SDK.
            Cus.LogAMessage("[Facebook SDK]: Initializing FACEBOOK SDK...\n");
            FB.Init(InitCallback, OnHideUnity);
        }
        else
        {
            // Already initialized, signal an app activation App Event.
            FB.ActivateApp();
        }
    }
Example #6
0
    // Initialize bool that responsible for all the other values to be initialized before the word is displayed.
    void Start()
    {
        ValuesAreInitialized = false;

        Cus.LogAMessage("[Game]: Starting LocalGameManager script...\n");
    }
Example #7
0
    // Initialize ad variables.
    void Start()
    {
        Cus.LogAMessage("[ADmob]: Starting Ads Script...\n");

        InterstitialOriginatedFrom = "";

        InterstitialAdIsDisplaying = -1;
        InterstitialAdIsLoaded     = -1;
        InterstitialAdWasClosed    = -1;
        InterstitialAdTryingToLoad = -1;

        RewardVideoEndTimer = RewardVideoEndTimerDefault;

        RewardVideoSuccess = -1;

        RewardVideoTimerEnabled = false;

        // Initialize the Google Mobile Ads SDK.
        MobileAds.Initialize(AppId);
    }