Ejemplo n.º 1
0
 public void SetRussian()
 {
     LocalizeBase.SetCurrentLanguage(SystemLanguage.Russian);
 }
Ejemplo n.º 2
0
 public void SetEnglish()
 {
     LocalizeBase.SetCurrentLanguage(SystemLanguage.English);
 }
Ejemplo n.º 3
0
    public void playerGotTheBall()
    {
        // This function is called from PlayerAI.OnCollisionEnter

        button2D.gameObject.SetActive(false);

        // Show the true indication
        questionManager.trueOrFalse.GetComponent <Text>().color = Color.green;
        questionManager.trueOrFalse.GetComponent <Text>().text  = LocalizeBase.GetLocalizedString("correct");
        questionManager.trueOrFalse.GetComponent <Animator>().SetTrigger("setAnim");

        //Remove the ball collider from the ball so that when the player is dribbling the ball, the collider on ball doesn't get triggered
        Destroy(ball.GetComponent("BallCollider"));

        Time.timeScale = 1f;

        Mode2D(false);
        Sprites2D.SetActive(false);

        // Hide ball target object
        ballTarget.transform.position = Vector3.zero;

        // Remove the PlayerControl script from current shooting player
        Destroy(selectedPlayer.GetComponent <PlayerControl>());

        // Destroy closes component
        if (closest != null)
        {
            Destroy(closest.GetComponent <PlayerAI>());
        }

        // New selected Player is target Player
        selectedPlayer = targetPlayer;



        selectedPlayer.AddComponent <PlayerControl>();

        // Give ball and Joystick Reference
        selectedPlayer.GetComponent <PlayerControl>().joystick = joystick;
        selectedPlayer.GetComponent <PlayerControl>().ball     = ball;

        // Makes timer visible
        dribblingTime.gameObject.SetActive(true);

        // Close Joystick
        joystick.gameObject.SetActive(false);

        // Reset bounce
        ball.GetComponent <SphereCollider>().material = null;

        // Disable him to move
        selectedPlayer.GetComponent <PlayerControl>().canMove = false;

        // Enable him to select target
        targetSelect = true;

        // Put ball in front of player
        putBallInfrontOfPlayer();

        // Show indication signs for targets.
        showIndicationforTargets();

        // Close indication from selected && add selected indication
        selectedPlayer.transform.GetChild(2).gameObject.SetActive(false);
        selectedPlayer.transform.GetChild(3).gameObject.SetActive(true);

        mainCamera.gameObject.SetActive(true);
        camera2D.gameObject.SetActive(false);

        if (selectedPlayer.name == "bluePlayer6")
        {
            selectedPlayer.transform.LookAt(redPlayers.transform.GetChild(0));
            // Put ball in front of player
            putBallInfrontOfPlayer();

            mainCamera.GetComponent <CameraController>().player = selectedPlayer;
            goalTargets.SetActive(true);

            // Tutorial
            if (watchTutorial2)
            {
                showTutorial(7);
            }
        }
    }
Ejemplo n.º 4
0
    private void loadGraphs()
    {
        // Assign text
        Text dateText      = screens[0].transform.GetChild(1).GetComponent <Text>();
        Text succesfulText = screens[0].transform.GetChild(3).GetComponent <Text>();
        Text failText      = screens[0].transform.GetChild(4).GetComponent <Text>();
        // Assign Graphs
        Image      succesful = screens[0].transform.GetChild(2).GetChild(1).GetComponent <Image>();
        GameObject chart     = screens[0].transform.GetChild(5).GetChild(0).gameObject;

        // Find true and false answers
        string[] answers = lastDate[1].Split(';');
        // Set last record values
        dateText.text      = LocalizeBase.GetLocalizedString("stats_todays_data") + lastDate[0];
        succesfulText.text = LocalizeBase.GetLocalizedString("stats_correct_answers") + answers[0];
        failText.text      = LocalizeBase.GetLocalizedString("stats_incorrect_answers") + answers[1];
        // Set circle graph

        // Find percentage
        float value = float.Parse(answers[0]) * 100 / (float.Parse(answers[0]) + float.Parse(answers[1]));

        // Set to graph
        succesful.fillAmount = value / 100;


        // Set chart graph

        // Get bar object from prefabs folder
        GameObject barObject = Resources.Load("Prefabs/barObject") as GameObject;
        // Get This month
        string today = System.DateTime.Now.ToString("dd/MM/yyyy");

        string[] thisMonth = today.Split(delimeter);
        chart.transform.parent.GetChild(4).GetComponent <Text>().text = monthName(int.Parse(thisMonth[1])) + " " + LocalizeBase.GetLocalizedString("stats_months_data");

        for (int i = 0; i < getWhole.Length; i++)
        {
            string[] getMonth   = getWhole[i].Split(delimeter);
            string[] getAnswers = getWhole[i].Split('-');
            string[] findAnswer = getAnswers[1].Split(';');
            if (thisMonth[1] == getMonth[1])
            {
                barObject.transform.GetChild(0).GetComponent <RectTransform>().sizeDelta = new Vector2(10f, (float.Parse(findAnswer[0]) * 5) >= 173f ? 173f : (float.Parse(findAnswer[0]) * 5));
                barObject.transform.GetChild(1).GetComponent <RectTransform>().sizeDelta = new Vector2(10f, (float.Parse(findAnswer[1]) * 5) >= 173f ? 173f : (float.Parse(findAnswer[1]) * 5));
                barObject.transform.GetChild(2).GetComponent <Text>().text = getMonth[0];
                Instantiate(barObject, chart.transform);
            }
        }
    }
Ejemplo n.º 5
0
    public void AskQuestion(bool repeatLastQuestion)
    {
        if (!repeatLastQuestion)
        {
            // Switch to question UI
            gamePanel.SetActive(false);
            questionPanel.SetActive(true);

            incorrectAnswerCount = 0;

            // Get a random question type
            currentQuestionType = questionTypes[random.Next(questionTypes.Length)];

            // Get a random question of that type
            currentQuestion = questions[currentQuestionType][random.Next(questions[currentQuestionType].Length)];

            levelManager.DisplayInfoSprites(currentQuestion.angle, currentQuestion.distance);

            questionTitle.text = LocalizeBase.GetLocalizedString("question_title");
            questionText.text  = GetQuestionText();
            help.GetComponent <Image>().sprite = Resources.Load <Sprite>("Textures/" + LocalizeBase.GetLocalizedString("help"));

            answerText.text = currentQuestion.result.ToString();
            Debug.Log("Answer: " + currentQuestion.result);
        }
        else
        {
            // when the incorrectAnswerCount hits 4, show the correct answer, other wise show wrong answer message
            if (incorrectAnswerCount > 3)
            {
                popupPanel.GetComponentInChildren <Text>().text = String.Format(LocalizeBase.GetLocalizedString("reveal_correct_answer"), currentQuestion.result);
                popupPanel.SetActive(true);
            }
            else
            {
                // Show the wrong indication
                trueOrFalse.GetComponent <Text>().color = Color.red;
                trueOrFalse.GetComponent <Text>().text  = LocalizeBase.GetLocalizedString("incorrect");
                trueOrFalse.GetComponent <Animator>().SetTrigger("setAnim");
                ClosePopup();
            }
        }
    }