Esempio n. 1
0
    private void Restart()
    {
        endingSlotsGrid   = childPanel.Find("ToSolve");
        startingSlotsGrid = childPanel.Find("Provided");

        // Activate the Letter Collection and Slot script
        gameObject.GetComponent <KeyCollection>().enabled = true;

        // Grab the play list object for this game
        playObj = looper.GetCurrentPlay();

        // De-serialize the keyboard json
        keyboard = JsonUtility.FromJson <DO_KeyboardGame>(playObj.json);

        if (words != null)
        {
            words.Clear();
        }
        else
        {
            words = new List <string>();
        }

        // Create the word List and populate it.
        PopulateWordList();

        Debug.Log("KEYBOARD: WORDS list count is " + words.Count.ToString());

        currentRound = 1;

        // Start first round
        GenerateRound();

        gameComplete = false;
    }
Esempio n. 2
0
    private void Restart()
    {
        // Grab the play list object for this game
        playObj = gameLoop.GetCurrentPlay();

        // De-serialize the word scramble json
        scramble = JsonUtility.FromJson <DO_WordScramble>(playObj.json);

        if (words != null)
        {
            words.Clear();
        }
        else
        {
            words = new List <string>();
        }

        // Create the word List and populate it.
        PopulateWordList();

        Debug.Log("SCRAM: WORDS list count is " + words.Count.ToString());

        currentRound = 1;

        // Start first round
        GenerateRound();
    }
Esempio n. 3
0
    /// <summary>
    /// Calculates the total number of rounds remaining until reaching a reward playlist entry.
    /// This is used to properly configure the progress bar.
    /// </summary>
    private float CalculateRoundsTillReward()
    {
        Debug.Log("Calculating rounds till reward");
        List <float> roundsTillRewardList = new List <float>();

        Debug.Log("Rounds till reward list count = " + roundsTillRewardList.Count);
        for (float i = currentRound; i < totalRoundCount; i++)
        {
            DO_PlayListObject tempPlayObj = controller.GetPlayEntry(Mathf.RoundToInt(i));

            if (!(tempPlayObj.type_id == 1))
            {
                roundsTillRewardList.Add(i);
                Debug.Log("Adding to roundstillreward list: " + i);
            }
            else
            {
                Debug.Log("Break");
                break;
            }
        }
        roundsTillReward = roundsTillRewardList.Count;
        Debug.Log("Round till reward = " + roundsTillReward);
        if (newPart == true)
        {
            totalRoundsThisPart = roundsTillReward;
            newPart             = false;
        }
        Debug.Log("newPart = " + newPart + ", totalRoundsThisPart = " + totalRoundsThisPart);

        return(roundsTillReward);
    }
Esempio n. 4
0
    void Restart()
    {
        // Grab the play list object for this game
        playlistObj = gameLoop.GetCurrentPlay();

        // Grab the choose reward object
        chooseRewardObject = JsonUtility.FromJson <DO_ChooseReward>(playlistObj.json);

        // Start the dataservice
        ds = StartupScript.ds;

        //create the already loaded lists
        alreadyLoadedImageList = new List <string>();

        // Creat the reward buttons
        CreateRewardButtons();

        //Create the webview
        CreateWebview();

        // Clear the already loaded list
        alreadyLoadedImageList.Clear();

        // deactivate the round counter bar so the countdown bar will be visable
        RoundCounterProgressBar.SetActive(false);
    }
Esempio n. 5
0
    public override void Resume()
    {
        Debug.Log("Start Resume");
        playObj = gameLoop.GetCurrentPlay();
        SetupFromString(playObj.json);
        Debug.Log("End Resume");

    }
Esempio n. 6
0
    public override void Resume()
    {
        Debug.Log("matching resume method");

        Debug.Log("enter Matching Helper start");

        playlistDataObject = gameLoop.GetCurrentPlay();

        SetupFromString(playlistDataObject.json);

        Debug.Log("done Matching Helper start");
    }
Esempio n. 7
0
    /// <summary>
    /// Retrieves the play list data from the data base and sorts it according to the order id.
    /// </summary>
    private void RetrieveAndSort()
    {
        DO_PlayListObject temp;

        foreach (var row in dataService.GetPlayList())
        {
            temp = new DO_PlayListObject(
                row.id,
                row.order_id,
                row.duration,
                row.type_id,
                row.json,
                row.custom_json);

            playListEntries.Add(temp);
        }

        playListEntries.Sort();
    }
Esempio n. 8
0
    /// <summary>
    /// This method either creates a new entry or edits an existing one. It creates
    /// a play list data object, updates the DB, and then inserts the new data
    /// object into the play list entries list. Returns true if saved successfully to
    /// the DB.
    /// </summary>
    /// <param name="typeId"></param>
    /// <param name="duration"></param>
    /// <param name="json"></param>
    /// <param name="customJson"></param>
    /// <returns>bool</returns>
    public bool AddOrEditEntryData(int typeId, int duration, string json, string customJson = null)
    {
        DO_PlayListObject temp;

        // Check if we are creating a new entry
        if (creatingNewEntry)
        {
            temp = new DO_PlayListObject(playListEntries.Count, duration, typeId, json);

            if (dataService.AddNewPlayListRow(temp) < 1)
            {
                return(false);
            }

            IEnumerable <DO_PlayListObject> tempCollection = dataService.GetLastInsertedRowId(temp.order_id);

            int newRowId = -1;

            foreach (DO_PlayListObject obj in tempCollection)
            {
                newRowId = obj.id;
            }

            temp.id = newRowId;

            playListEntries.Add(temp);
        }
        else
        {
            temp = new DO_PlayListObject(playListEntries[activeEntryIndex].id, playListEntries[activeEntryIndex].order_id, duration, typeId, json);

            if (dataService.EditPlayListRow(temp) < 1)
            {
                return(false);
            }

            playListEntries[activeEntryIndex] = temp;
        }

        return(true);
    }
Esempio n. 9
0
 public override void Resume()
 {
     playObj = gameLoop.GetCurrentPlay();
     SetupFromString(playObj.json);
 }
Esempio n. 10
0
    public int EditPlayListRow(DO_PlayListObject data)
    {
        string query = "UPDATE Play_List SET order_id = ?, duration = ?, json = ?, custom_json = ? WHERE id = ?";

        return(_connection.Execute(query, data.order_id, data.duration, data.json, data.custom_json, data.id));
    }
Esempio n. 11
0
    public int AddNewPlayListRow(DO_PlayListObject data)
    {
        string query = "INSERT INTO Play_List (order_id, duration, type_id, json, custom_json) VALUES(?,?,?,?,?)";

        return(_connection.Execute(query, data.order_id, data.duration, data.type_id, data.json, data.custom_json));
    }