Exemplo n.º 1
0
    /// <summary>
    /// Swapping 1st element to 2nd element
    /// </summary>
    /// <param name="indexA"> index A</param>
    /// <param name="indexB"> index B</param>
    public void Swap(int indexA, int indexB)
    {
        testObject tmpA = charObjects[indexA];

        charObjects[indexA] = charObjects[indexB];
        charObjects[indexB] = tmpA;

        charObjects[indexA].transform.SetAsLastSibling();
        charObjects[indexB].transform.SetAsLastSibling();
        CheckWord();
    }
Exemplo n.º 2
0
    /// <summary>
    ///  Show word from collection with desired index
    /// </summary>
    /// <param name="index"> index of the element</param>
    public void ShowScramble(int index)
    {
        charObjects.Clear();
        foreach (Transform child in container)
        {
            Destroy(child.gameObject);
        }

        //textComp.text = "";
        rowsToReadFrom[0] = indexx;
        textArray         = myTextAsset.text.Split('\n').ToList();
        //textComp.text += textArray[rowsToReadFrom[0]];

        temp  = textArray[rowsToReadFrom[0]];
        temp  = System.Text.RegularExpressions.Regex.Replace(temp, @"\s", "");
        chArr = temp.ToCharArray();

        //Randomize
        System.Random rnd = new System.Random();
        randomCharArray = chArr.OrderBy(x => rnd.Next()).ToArray();
        charResult      = string.Join("", randomCharArray);


        foreach (char c in charResult)
        {
            testObject clone = Instantiate(prefab.gameObject).GetComponent <testObject>();
            clone.transform.SetParent(container);

            charObjects.Add(clone.Init(c));
        }

        indexx += 1;


        if (indexx == 5)
        {
            if (PlayerPrefs.HasKey("Achievement2Endless"))
            {
                Debug.Log("Already has keys");
            }
            else
            {
                Achievement.instance.lbl.text = "5 Correct Words!";
                Achievement.instance.achievement.GetComponent <Animator>().Play("", 0, 0f);
            }

            PlayerPrefs.SetString("Achievement2Endless", "two");
            PlayerPrefs.Save();
        }

        currentWord = index;
        StartCoroutine(TimeLimit());
    }
Exemplo n.º 3
0
    /// <summary>
    /// Selection of words
    /// </summary>
    /// <param name="charObject"></param>
    public void Select(testObject charObject)
    {
        if (firstSelected)
        {
            Swap(firstSelected.index, charObject.index);

            firstSelected.Select();
            charObject.Select();
        }
        else
        {
            firstSelected = charObject;
        }
    }
 public string dataTest([FromBody] testObject data)
 {
     return($"hola {data.nombre}");
 }
Exemplo n.º 5
0
 /// <summary>
 /// Unselect selected words
 /// </summary>
 public void UnSelect()
 {
     firstSelected = null;
 }
Exemplo n.º 6
0
 private void cmdDeserialize_Click(object sender, EventArgs e)
 {
     myChar = serializer.clsSerializer.DeserializeFromString<testObject>(txtSerialised.Text);
     MessageBox.Show("Name: " + myChar.name);
 }