Ejemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        commonText.text = labelTag;

        if (!isLocalPlayer)
        {
            return;
        }

        if (myManager.TypeStart() != null && toType.Length == 0)
        {
            foreach (var item in myManager.TypeStart())
            {
                if (item.Key == true)
                {
                    toType          = item.Value;
                    currectCharSet  = new List <char>();
                    correctCharNumb = 0;
                    currectCharSet.AddRange(toType);
                }
            }
        }

        //Debug.Log("probalom elérni a szöveget: "+myManager.GetGlobalController().textForEveryone);
        if (myManager.TypeStart() == null && toType.Length == 0 &&
            !myManager.GetGlobalController().textForEveryone.Contains("PRESS ENTER") &&
            !myManager.GetGlobalController().textForEveryone.Contains("COUNT DOWN") &&
            myManager.GetGlobalController().textForEveryone != null)
        {
            toType          = myManager.GetGlobalController().textForEveryone;
            correctCharNumb = 0;
            currectCharSet  = new List <char>();
            currectCharSet.AddRange(toType);
        }

        if (toType != "" && correctCharNumb != currectCharSet.Count)
        {
            Debug.Log("check");
            CharCheck();
            if (myManager.GetGlobalController().textForEveryone.Contains("PRESS ENTER"))
            {
                DoTheCleanup();
            }
        }

        if (fireIt)
        {
            fireBallScript.StartCurrent();
            if (gameObject.name.Equals("Player1"))
            {
                CmdScoreOnClient(1);
            }
            else
            {
                CmdScoreOnClient(2);
            }

            //ez a visszaállítás rész!!!
            toType           = "";
            typerText.text   = "";
            currentlyCorrect = "";
            currectCharSet   = new List <char>();
            correctCharNumb  = 0;
            fireIt           = false;
        }

        if (Input.GetKeyDown(KeyCode.Return))
        {
            Debug.Log("Enter pressed name: " + gameObject.name);

            if (gameObject.name.EndsWith("(Clone)"))
            {
                CmdClientReadySign();
            }
            else
            {
                labelTag        += "\nready";
                commonText.text += "\nready";
                myManager.EnterPressedByClient(gameObject.name);
            }
        }
    }