void CreateButtons()
    {
        for (int i = 0; i < options.Length; i++)
        {
            GameObject   button = (GameObject)Instantiate(choiceBox);
            Button       b      = button.GetComponent <Button>();
            ChoiceButton cb     = button.GetComponent <ChoiceButton>();
            if ((options[i].Split(':')[0]).Contains("(Player)"))
            {
                cb.SetText(PutPlayerName(options[i].Split(':')[0]));
            }
            else
            {
                cb.SetText(options[i].Split(':')[0]);
            }
            cb.option = options[i].Split(':')[1];
            cb.number = i;
            cb.box    = this;
            ColorBlock block = b.colors;

            if ((cb.option.Split(',')[0]) == "lineRight")
            {
                block.pressedColor = new Color32(113, 247, 159, 255);
            }
            else if ((cb.option.Split(',')[0]) == "lineWrong")
            {
                block.pressedColor = new Color32(213, 87, 59, 255);
            }
            if ((cb.option.Split(',')[0]) == "scene")
            {
                miniGame();
            }

            b.colors = block;
            b.transform.SetParent(GameObject.Find("GamePanel").transform);
            b.transform.localPosition = new Vector3(0, -25 + (i * 50));
            b.transform.localScale    = new Vector3(1, 1, 1);
            buttons.Add(b);
            thingy.SetActive(false);
            charAnimator.SetBool("startIndicator", false);
            charAnimator.SetBool("stopIndicator", true);
        }
        if (playerTalking)
        {
            print("SHOULD PRINT");
        }

        if (buttons.Count > 1)
        {
            playerControl    = false;
            characterName    = parser.GetName(lineNum - 1);
            dialogue         = parser.GetContent(lineNum - 1);
            dialogueBox.text = dialogue;
            nameBox.text     = characterName;
            thingy.SetActive(false);
        }
        //buttons[buttons.Count - 1].Select();
        //buttonSelect = buttons.Count - 1;
    }
 void CreateButtons()
 {
     for (int i = 0; i < choices.Length - 1; i++)
     {
         GameObject   buttonObj     = (GameObject)Instantiate(choiceButton);
         Button       button        = buttonObj.GetComponent <Button>();
         ChoiceButton choiceBtn     = buttonObj.GetComponent <ChoiceButton>();
         string[]     choiceOptions = choices[i].Split(':');
         choiceBtn.SetText(choiceOptions[0]);
         choiceBtn.SetNextLine(choiceOptions[1]);
         string choiceText = "";
         for (int j = 2; j < choiceOptions.Length; j++)
         {
             choiceText += choiceOptions[j];
             if (j != choiceOptions.Length - 1)
             {
                 choiceText += ":";
             }
         }
         choiceBtn.SetChoice(choiceText);
         choiceBtn.manager = this;
         button.transform.SetParent(canvas.transform, true);
         button.transform.localPosition = new Vector3(0, -25 + (i * 50));
         button.transform.localScale    = new Vector3(1, 1, 1);
         buttons.Add(button);
         if (choices[choices.Length - 1] == "false")
         {
             choiceBtn.ParseChoice();
             break;
         }
     }
 }
    private void GenerateButtons()
    {
        for (int i = 0; i < choices.Length; i++)
        {
            GameObject   obj           = GameObject.Instantiate(choicePrefab, dialogueBox.transform.GetChild(2));
            ChoiceButton choice        = obj.GetComponent <ChoiceButton>();
            string[]     choiceOptions = choices[i].Split(':');
            Debug.Log(choices[i] + " |  " + choiceOptions.Length);
            choice.SetText(choiceOptions[0]);
            choice.nextLine = choiceOptions[1];

            string choiceText = "";
            for (int j = 2; j < choiceOptions.Length; j++)
            {
                choiceText += choiceOptions[j];
                if (j != choiceOptions.Length - 1)
                {
                    choiceText += ":";
                }
            }
            choice.choice = choiceText;

            btns.Add(obj.GetComponent <Button>());
        }
    }
Beispiel #4
0
    //creates buttons for player inputs
    void CreateButtons()
    {
        spaceText.text = "(Enter)";
        spaceText.rectTransform.localPosition = new Vector3(spaceText.rectTransform.localPosition.x, -76, spaceText.rectTransform.localPosition.z);

        int xPos = -125;
        int yPos = -127;

        for (int i = 0; i < options.Length; i++)
        {
            GameObject   button = Instantiate(choiceBox);
            Button       b      = button.GetComponent <Button>();
            ChoiceButton cb     = button.GetComponent <ChoiceButton>();

            cb.SetText(options[i].Split(':')[0]);
            cb.option      = options[i].Split(':')[1];
            cb.choiceKey   = "";
            cb.choiceValue = "";

            cb.box = this;

            cb.transform.SetParent(thisCanvas.transform, false);
            RectTransform transform = b.gameObject.GetComponent <RectTransform>();
            transform.anchoredPosition = new Vector2(xPos + (i * 250), yPos);
            buttons.Add(b);
            if (i == 0)
            {
                b.Select();
            }
        }
    }
Beispiel #5
0
 void CreateButtons()
 {
     for (int i = 0; i < options.Length; i++)
     {
         GameObject   button = (GameObject)Instantiate(choiceBox);
         Button       b      = button.GetComponent <Button>();
         ChoiceButton cb     = button.GetComponent <ChoiceButton>();
         cb.SetText(options[i].Split(':')[0]);
         cb.option = options[i].Split(':')[1];
         cb.box    = this;
         b.transform.SetParent(this.transform);
         b.transform.localPosition = new Vector3(0, -25 + (i * 50));
         b.transform.localScale    = new Vector3(1, 1, 1);
         buttons.Add(b);
     }
 }
Beispiel #6
0
 //  選択ボタン作成
 void CreateButtons()
 {
     for (int i = 0; i < m_options.Length; i++)
     {
         GameObject   button = (GameObject)Instantiate(m_choiceBox);
         Button       b      = button.GetComponent <Button>();
         ChoiceButton cb     = button.GetComponent <ChoiceButton>();
         cb.SetText(m_options[i].Split(':')[0]);                     //errorOK
         cb.m_option = m_options[i].Split(':')[1];
         cb.m_box    = this;
         b.transform.SetParent(this.transform);
         b.transform.localPosition = new Vector3(0, -75 + (i * 30));
         b.transform.localScale    = new Vector3(1.0f, 0.8f, 0.8f);
         m_buttons.Add(b);
     }
 }
Beispiel #7
0
 void CreateButtons()
 {
     for (int i = 0; i < options.Length; i++)
     {
         GameObject   button = Instantiate(choiceBox);
         Button       b      = button.GetComponent <Button>();
         ChoiceButton cb     = button.GetComponent <ChoiceButton>();
         cb.SetText(options[i].Split(':')[0]);
         cb.option = options[i].Split(':')[1];
         cb.box    = this;
         cb.parser = GameObject.Find("DialogueParser").GetComponent <DialogueParser>();
         b.transform.SetParent(this.transform);
         b.transform.localPosition = new Vector3(0, 70 - (i * 50));
         print(cb.GetComponentInChildren <Text>().text);
         print(b.transform.localPosition);
         b.transform.localScale = new Vector3(1, 1, 1);
         buttons.Add(b);
     }
 }
Beispiel #8
0
    void SetDialog(int linea)
    {
        Debug.Log(" set dialog en linea " + linea);
        choiceBox1.GetComponent <Button>().onClick.RemoveListener(() => Responder1());
        choiceBox2.GetComponent <Button>().onClick.RemoveListener(() => Responder2());
        choiceBox3.GetComponent <Button>().onClick.RemoveListener(() => Responder3());

        switch (linea)
        {
        case -1:
            if (SceneManager.GetActiveScene().name == "Scene1")
            {
                Controlador.escenaPrevia = "MATEO";
            }
            if (SceneManager.GetActiveScene().name == "Scene2")
            {
                Controlador.escenaPrevia = "DIEGO";
            }
            if (SceneManager.GetActiveScene().name == "Scene3")
            {
                Controlador.escenaPrevia = "ARIEL";
            }
            if (SceneManager.GetActiveScene().name == "Scene4")
            {
                Controlador.escenaPrevia = "MAXIMILIANO";
            }
            if (SceneManager.GetActiveScene().name == "Scene5")
            {
                Controlador.escenaPrevia = "ISRAEL";
            }

            if (SceneManager.GetActiveScene().name == "Scene6")
            {
                Controlador.escenaPrevia = "SANTI";
            }
            resultado = "Pelea";

            Analytics.CustomEvent("DialogosFin", new Dictionary <string, object> {
                { "Resultado", resultado },
                { "Quien", SceneManager.GetActiveScene().name },
                { "Time", Time.time - StartTime }
            });

            print("COMBATE!");
            //int sceneNum = SceneManager.GetActiveScene ().buildIndex;
            //SceneManager.LoadScene (sceneNum+1);
            StartCoroutine(Pelear());
            break;

        case 0:
            if (SceneManager.GetActiveScene().name == "Scene1")
            {
                Controlador.GanarHijo(posiblesHijos[Random.Range(0, 4)]);
                Controlador.escenaPrevia = "MATEO";
            }
            if (SceneManager.GetActiveScene().name == "Scene2")
            {
                Controlador.GanarHijo(posiblesHijos[Random.Range(5, 8)]);
                Controlador.escenaPrevia = "DIEGO";
            }
            if (SceneManager.GetActiveScene().name == "Scene3")
            {
                Controlador.GanarHijo(posiblesHijos[Random.Range(9, 12)]);
                Controlador.escenaPrevia = "ARIEL";
            }
            if (SceneManager.GetActiveScene().name == "Scene4")
            {
                Controlador.GanarHijo(posiblesHijos[Random.Range(13, 16)]);
                Controlador.escenaPrevia = "MAXIMILIANO";
            }
            if (SceneManager.GetActiveScene().name == "Scene5")
            {
                Controlador.GanarHijo(posiblesHijos[Random.Range(17, 20)]);
                Controlador.escenaPrevia = "ISRAEL";
            }
            if (SceneManager.GetActiveScene().name == "Scene6")
            {
                Controlador.GanarHijo(posiblesHijos[Random.Range(21, 24)]);
                Controlador.escenaPrevia = "SANTI";
            }

            resultado = "Ganaste";

            Analytics.CustomEvent("DialogosFin", new Dictionary <string, object> {
                { "Resultado", resultado },
                { "Quien", SceneManager.GetActiveScene().name },
                { "Time", Time.time - StartTime }
            });


            print("HUEVITO!!");
            StartCoroutine(Esperar());

            break;

        default:
            dialogueBox.text = guion.GetPregunta(linea);

            choiceBox1.SetText(guion.GetOptions(linea, 1));
            choiceBox2.SetText(guion.GetOptions(linea, 2));
            choiceBox3.SetText(guion.GetOptions(linea, 3));

            choiceBox1.SetResult(guion.GetResults(linea, 1));
            choiceBox2.SetResult(guion.GetResults(linea, 2));
            choiceBox3.SetResult(guion.GetResults(linea, 3));


            SetFace(linea);

            break;
        }
    }