Пример #1
0
 public void checkImageName()
 {
     StaticSceneManager.setImage("cenoura_carrot");
     StaticLanguage.setLanguage("portuguese");
     game.Start();
     Assert.That("CENOURA" == game.solution);
 }
Пример #2
0
    public void checkError()
    {
        StaticSceneManager.setImage("cenoura_carrot");
        StaticLanguage.setLanguage("portuguese");
        game.Start();
        GameObject go     = new GameObject();
        Button     button = go.AddComponent <Button> ();

        for (int i = 0; i < 15; i++)
        {
            if ((ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text != "C") &&
                (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text != "E") &&
                (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text != "N") &&
                (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text != "O") &&
                (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text != "U") &&
                (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text != "R") &&
                (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text != "A"))
            {
                button = ButtonList [i];
            }
        }

        game.taskOnClick(button, game.solution);
        game.Update();
        game.taskOnClick(button, game.solution);
        game.Update();
        game.taskOnClick(button, game.solution);
        game.Update();

        Assert.That(game.wrong.activeSelf == true);
    }
Пример #3
0
 public void Start()
 {
     StaticCheckGame.reset();
     if (StaticMinigame3Controller.getReplay() == true)
     {
         instructionsPanel.SetActive(false);
     }
     StaticCheckGame.reset();
     if (StaticLanguage.getLanguage().Equals("portuguese"))
     {
         instructions.text            = "Organiza o frigorífico o máximo número de vezes dentro do tempo limite, movendos as comidas para o respetivo lugar seguindo estas regras:\n - Bebidas na porta;\n - Apenas os vegetais e frutas podem estar na secção inferior do frigorífico;\n - Na mesma secção apenas pode existir uma família de alimentos.";
         instructionHighscoreSub.text = "Melhor Pontuação";
         gameEndHighscoreSub.text     = "Melhor Pontuação";
     }
     else
     {
         instructions.text            = "Organize the fridge, as many times as you can within the time limit, moving the foods to their respective places following these rules:\n - Drinks on the door;\n - Only vegetables and fruits can stay on the lower section of the fridge;\n - On the same section there can only be one food family.";
         instructionHighscoreSub.text = "Highscore";
         gameEndHighscoreSub.text     = "Highscore";
     }
     if (!System.IO.File.Exists(Application.persistentDataPath + "/sendToServer"))
     {
         sendToServer = new SendToServer();
     }
     else
     {
         sendToServer = FileManager.ReadFromBinaryFile <SendToServer> (Application.persistentDataPath + "/sendToServer");
     }
     highscore.text = "" + sendToServer.minigame2Highscore;
     setFoods();
 }
Пример #4
0
 void Start()
 {
     if (StaticLanguage.getLanguage().Equals("portuguese"))
     {
         genero.text    = "Género";
         ethnicity.text = "Etnia";
     }
     else
     {
         genero.text    = "Gender";
         ethnicity.text = "Ethnicity";
     }
     if (!System.IO.File.Exists(Application.persistentDataPath + "/avatar"))
     {
         avatar = new AvatarSelection();
     }
     else
     {
         avatar = FileManager.ReadFromBinaryFile <AvatarSelection> (Application.persistentDataPath + "/avatar");
     }
     head.sprite  = avatar.selectCurrentHead();
     torso.sprite = avatar.selectCurrentTorso();
     legs.sprite  = avatar.selectCurrentLegs();
     if (avatar.getGender().Equals("Male"))
     {
         male.interactable = false;
     }
     else
     {
         female.interactable = false;
     }
 }
Пример #5
0
 void taskOnClick(string language)
 {
     StaticLanguage.setLanguage(language);
     gameWorld.GetComponent <Image>().sprite = Resources.Load("Menu/" + language + "/gameworld", typeof(Sprite)) as Sprite;
     settings.GetComponent <Image>().sprite  = Resources.Load("Menu/" + language + "/settings", typeof(Sprite)) as Sprite;
     avatar.GetComponent <Image>().sprite    = Resources.Load("Menu/" + language + "/avatar", typeof(Sprite)) as Sprite;
 }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     if (StaticLanguage.getLanguage().Equals("portuguese"))
     {
         menu.text = "Jogos";
     }
     else
     {
         menu.text = "Games";
     }
 }
Пример #7
0
    public void Start()
    {
        if (StaticMinigame3Controller.getReplay() == true)
        {
            instructionsPanel.SetActive(false);
        }

        if (StaticLanguage.getLanguage().Equals("portuguese"))
        {
            instructions.text            = "Em cada ronda, escolhe a comida que deves levar na lancheira. A cada resposta correta ganharás 1 ponto.";
            instructionHighscoreSub.text = "Melhor Pontuação";
            gameEndHighscoreSub.text     = "Melhor Pontuação";
        }
        else
        {
            instructions.text            = "In each round, choose the food you should take on your lunchbox. Each correct answear awards you with 1 point.";
            instructionHighscoreSub.text = "Highscore";
            gameEndHighscoreSub.text     = "Highscore";
        }

        if (!System.IO.File.Exists(Application.persistentDataPath + "/sendToServer"))
        {
            sendToServer = new SendToServer();
        }
        else
        {
            sendToServer = FileManager.ReadFromBinaryFile <SendToServer> (Application.persistentDataPath + "/sendToServer");
        }
        time.text  = roundTime.ToString();
        score.text = scoreNumber.ToString();

        highscore.text = "" + sendToServer.minigame3Highscore;

        healthyIngredients = new List <string> ()
        {
            "banana_0", "carrot_0", "cucumber_0", "grapes_0", "kiwi_0", "orange_0", "pear_0", "sandwich_0", "tomato_0"
        };
        unhealthyIngredients = new List <string> ()
        {
            "candy_1", "candyStick_1", "hamburger_1", "hotdog_1", "pizza_1", "popcorn_1"
        };

        choice1.onClick.AddListener(delegate {
            taskOnClick(choice1);
        });

        choice2.onClick.AddListener(delegate {
            taskOnClick(choice2);
        });

        setIngredients();
    }
Пример #8
0
    public void Start()
    {
        if (StaticLanguage.getLanguage().Equals("portuguese"))
        {
            legumesText.text   = "Legumes e Verduras";
            hidratosText.text  = "Hidratos de Carbono";
            proteinaVText.text = "Proteína Vegetal";
            proteinaAText.text = "Proteína Animal";
            frutaText.text     = "Frutas";
        }
        else
        {
            legumesText.text   = "Vegetables";
            hidratosText.text  = "Carbohydrates";
            proteinaVText.text = "Vegetable Protein";
            proteinaAText.text = "Animal Protein";
            frutaText.text     = "Fruits";
        }
        if (StaticMinigame3Controller.getReplay() == true)
        {
            instructionsPanel.SetActive(false);
        }
        StaticCheckGame.reset();
        if (StaticLanguage.getLanguage().Equals("portuguese"))
        {
            instructions.text            = "Organiza o teu prato, o máximo número de vezes dentro do tempo limite, movendo as comidas para o seu respetivo lugar.";
            instructionHighscoreSub.text = "Melhor Pontuação";
            gameEndHighscoreSub.text     = "Melhor Pontuação";
        }
        else
        {
            instructions.text            = "Organize your plate, as many times as you can within the time limit, moving the foods to their respective places.";
            instructionHighscoreSub.text = "Highscore";
            gameEndHighscoreSub.text     = "Highscore";
        }
        if (!System.IO.File.Exists(Application.persistentDataPath + "/sendToServer"))
        {
            sendToServer = new SendToServer();
        }
        else
        {
            sendToServer = FileManager.ReadFromBinaryFile <SendToServer> (Application.persistentDataPath + "/sendToServer");
        }
        time.text  = "" + roundTime;
        score.text = "" + scoreNumber;

        highscore.text = "" + sendToServer.minigame4Highscore;

        setIngredients();
    }
Пример #9
0
    // Use this for initialization
    void Start()
    {
        if (StaticLanguage.getLanguage().Equals("portuguese"))
        {
            message.text = "Já jogaste muito hoje!\nAmanhã espera-te mais diversão!";
        }
        else
        {
            message.text = "You have played for too long!\nTomorrow you can have some more fun!";
        }

        DateTime nextDay = new DateTime(System.DateTime.Now.AddDays(1).Year,
                                        System.DateTime.Now.AddDays(1).Month,
                                        System.DateTime.Now.AddDays(1).Day, 0, 0, 0);

        TimeSpan counter = nextDay - System.DateTime.Now;

        text.text = string.Format("{0:D2}:{1:D2}:{2:D2}", counter.Hours, counter.Minutes, counter.Seconds);
    }
Пример #10
0
    public void checkLetterInsertionBegginingOfWord()
    {
        StaticSceneManager.setImage("cenoura_carrot");
        StaticLanguage.setLanguage("portuguese");
        game.Start();
        GameObject go     = new GameObject();
        Button     button = go.AddComponent <Button> ();

        for (int i = 0; i < 15; i++)
        {
            if (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text == "C")
            {
                button = ButtonList [i];
            }
        }

        game.taskOnClick(button, game.solution);

        Assert.That(game.text.text [1].ToString() == "C");
    }
Пример #11
0
    // Use this for initialization
    void Start()
    {
        if (StaticLanguage.getLanguage().Equals("portuguese"))
        {
            portFlag.interactable = false;
        }
        else
        {
            engFlag.interactable = false;
        }

        engFlag.onClick.AddListener(delegate {
            taskOnClick("english");
            engFlag.interactable  = false;
            portFlag.interactable = true;
        });
        portFlag.onClick.AddListener(delegate {
            taskOnClick("portuguese");
            portFlag.interactable = false;
            engFlag.interactable  = true;
        });
    }
Пример #12
0
    // Use this for initialization
    void Start()
    {
        if (StaticLanguage.getLanguage().Equals("portuguese"))
        {
            title.text  = "Definições";
            som.text    = "Som";
            musica.text = "Música";
        }
        else
        {
            title.text  = "Settings";
            som.text    = "Sound";
            musica.text = "Music";
        }

        if (StaticSettings.getMusicOn() == true)
        {
            musicOn.gameObject.SetActive(true);
            musicOff.gameObject.SetActive(false);
        }
        else
        {
            musicOn.gameObject.SetActive(false);
            musicOff.gameObject.SetActive(true);
        }

        if (StaticSettings.getSoundOn() == true)
        {
            soundOn.gameObject.SetActive(true);
            soundOff.gameObject.SetActive(false);
        }
        else
        {
            soundOn.gameObject.SetActive(false);
            soundOff.gameObject.SetActive(true);
        }
    }
Пример #13
0
    public void Start()
    {
        if (!System.IO.File.Exists(Application.persistentDataPath + "/data"))
        {
            status = new Minigame1Status();
        }
        else
        {
            status = FileManager.ReadFromBinaryFile <Minigame1Status> (Application.persistentDataPath + "/data");
        }

        if (!System.IO.File.Exists(Application.persistentDataPath + "/sendToServer"))
        {
            sendToServer = new SendToServer();
        }
        else
        {
            sendToServer = FileManager.ReadFromBinaryFile <SendToServer> (Application.persistentDataPath + "/sendToServer");
        }

        picture.GetComponent <Image> ().sprite = Resources.Load("Minigame 1/" + StaticSceneManager.GetSceneImage(), typeof(Sprite)) as Sprite;
        string imageName = picture.GetComponent <Image> ().sprite.name.ToUpper();

        string[] imageNameLanguages = imageName.Split('_');
        if (StaticLanguage.getLanguage() == "portuguese")
        {
            solution = imageNameLanguages[0];
        }
        if (StaticLanguage.getLanguage() == "english")
        {
            solution = imageNameLanguages [1];
        }

        text.text = " ";
        setBlanks(solution);
        setButtons(solution);
    }
Пример #14
0
    void gameEnd()
    {
        choice1.interactable = false;
        choice2.interactable = false;
        if (StaticLanguage.getLanguage().Equals("portuguese"))
        {
            if (scoreNumber > sendToServer.minigame2Highscore)
            {
                gameEndMessage.text = "Acabou o tempo!\nFizeste ";
                if (scoreNumber != 1)
                {
                    gameEndMessage.text += scoreNumber + " pontos";
                }
                else
                {
                    gameEndMessage.text += scoreNumber + " ponto";
                }
                gameEndMessage.text += " e bateste a tua antiga melhor pontuação.";
            }
            else
            {
                gameEndMessage.text = "Acabou o tempo!\nFizeste ";
                if (scoreNumber != 1)
                {
                    gameEndMessage.text += scoreNumber + " pontos";
                }
                else
                {
                    gameEndMessage.text += scoreNumber + " ponto";
                }
                gameEndMessage.text += " e não conseguiste bater a tua melhor pontuação.";
            }
        }
        else
        {
            if (scoreNumber > sendToServer.minigame2Highscore)
            {
                gameEndMessage.text = "Time is up!\nYou got ";
                if (scoreNumber != 1)
                {
                    gameEndMessage.text += scoreNumber + " points";
                }
                else
                {
                    gameEndMessage.text += scoreNumber + " point";
                }
                gameEndMessage.text += " and you were able to beat your previous highscore.";
            }
            else
            {
                gameEndMessage.text = "Time is up!\nYou got ";
                if (scoreNumber != 1)
                {
                    gameEndMessage.text += scoreNumber + " points";
                }
                else
                {
                    gameEndMessage.text += scoreNumber + " point";
                }
                gameEndMessage.text += " and you were not able to beat your previous highscore.";
            }
        }

        if (scoreNumber > sendToServer.minigame3Highscore)
        {
            sendToServer.minigame3Highscore = scoreNumber;
        }

        sendToServer.minigame3TimesPlayed++;
        FileManager.WriteToBinaryFile(Application.persistentDataPath + "/sendToServer", sendToServer);
        gameOn = false;

        highscore2.text = "" + sendToServer.minigame3Highscore;
        gameEndPanel.SetActive(true);
    }
Пример #15
0
    public void checkWin()
    {
        StaticSceneManager.setImage("cenoura_carrot");
        StaticLanguage.setLanguage("portuguese");
        game.Start();
        GameObject go      = new GameObject();
        Button     button  = go.AddComponent <Button> ();
        Button     button1 = Instantiate(button);
        Button     button2 = Instantiate(button);
        Button     button3 = Instantiate(button);
        Button     button4 = Instantiate(button);
        Button     button5 = Instantiate(button);
        Button     button6 = Instantiate(button);
        Button     button7 = Instantiate(button);

        for (int i = 0; i < 15; i++)
        {
            if (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text == "C")
            {
                button1 = ButtonList [i];
            }
        }
        for (int i = 0; i < 15; i++)
        {
            if (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text == "E")
            {
                button2 = ButtonList [i];
            }
        }
        for (int i = 0; i < 15; i++)
        {
            if (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text == "N")
            {
                button3 = ButtonList [i];
            }
        }
        for (int i = 0; i < 15; i++)
        {
            if (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text == "O")
            {
                button4 = ButtonList [i];
            }
        }
        for (int i = 0; i < 15; i++)
        {
            if (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text == "U")
            {
                button5 = ButtonList [i];
            }
        }
        for (int i = 0; i < 15; i++)
        {
            if (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text == "R")
            {
                button6 = ButtonList [i];
            }
        }
        for (int i = 0; i < 15; i++)
        {
            if (ButtonList [i].GetComponent <UnityEngine.UI.Text> ().text == "A")
            {
                button7 = ButtonList [i];
            }
        }

        game.taskOnClick(button1, game.solution);
        game.taskOnClick(button2, game.solution);
        game.taskOnClick(button3, game.solution);
        game.taskOnClick(button4, game.solution);
        game.taskOnClick(button5, game.solution);
        game.taskOnClick(button6, game.solution);
        game.taskOnClick(button7, game.solution);

        game.Update();

        Assert.That(game.check.activeSelf == true);
    }
Пример #16
0
 // Use this for initialization
 void Start()
 {
     gameWorld.GetComponent <Image>().sprite = Resources.Load("Menu/" + StaticLanguage.getLanguage() + "/gameworld", typeof(Sprite)) as Sprite;
     settings.GetComponent <Image>().sprite  = Resources.Load("Menu/" + StaticLanguage.getLanguage() + "/settings", typeof(Sprite)) as Sprite;
     avatar.GetComponent <Image>().sprite    = Resources.Load("Menu/" + StaticLanguage.getLanguage() + "/avatar", typeof(Sprite)) as Sprite;
 }
Пример #17
0
    void Start()
    {
        if (!System.IO.File.Exists(Application.persistentDataPath + "/data"))
        {
            status = new Minigame1Status();
        }
        else
        {
            status = FileManager.ReadFromBinaryFile <Minigame1Status> (Application.persistentDataPath + "/data");
        }

        if (StaticLanguage.getLanguage().Equals("portuguese"))
        {
            instructions.text = "Clique em cada uma das imagens e tente adivinhar o nome do vegetal respetivo.";
        }
        else
        {
            instructions.text = "Click on each image and try to guess the name of the respective vegetable.";
        }

        if (status.ingredients ["ABÓBORA"] == 1)
        {
            abobora.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["BATATAS"] == 1)
        {
            batata.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["BERINGELA"] == 1)
        {
            beringela.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["BETERRABA"] == 1)
        {
            beterraba.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["BRÓCOLOS"] == 1)
        {
            brocolos.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["CEBOLA"] == 1)
        {
            cebola.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["CENOURA"] == 1)
        {
            cenoura.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["COURGETTE"] == 1)
        {
            courgette.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["COUVE"] == 1)
        {
            couve.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["ERVILHAS"] == 1)
        {
            ervilhas.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["ESPARGOS"] == 1)
        {
            espargos.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["MILHO"] == 1)
        {
            milho.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["PEPINO"] == 1)
        {
            pepino.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["PIMENTO"] == 1)
        {
            pimento.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["RABANETE"] == 1)
        {
            rabanete.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
        if (status.ingredients ["TOMATE"] == 1)
        {
            tomate.gameObject.transform.GetChild(0).gameObject.SetActive(true);
        }
    }