Esempio n. 1
0
    private static void NumberInputProcessed(bool del)
    {
        GameObject            player = GameObject.Find("LOCAL Player");
        NetworkedPlayerScript nps    = player.GetComponent <NetworkedPlayerScript>();

        bool shouldClear = true;

        if (numberTextField.text != null)
        {
            int input = -1;
            if (System.Int32.TryParse(numberTextField.text, out input))
            {
                if (nps.GetColor() != input)
                {
                    if (nps.DoesPlayerNumberExist(input) != -1)
                    {
                        GUIManagerScript.SetNumberInputFieldColor(ColorScript.GetColor(input), true);
                        shouldClear = false;
                    }
                }
            }
        }

        if (shouldClear)
        {
            Color clr = ColorScript.GetColor(nps.GetColor());
            clr = clr * 0.5f;
            GUIManagerScript.SetNumberInputFieldColor(clr);

            if (del)
            {
                GUIManagerScript.ClearNumberInput();
            }
        }
    }
    public void RpcStartGame(int s)
    {
        songID            = s;
        scored_ThisRound  = 0;
        scored_TimeBonus  = 0;
        scored_FirstBonus = false;
        scored_WasGuessed = false;

        //playerParent.GetComponent<PlayerParentScript>().Unlock();

        // Bullshit code. Temp? Maybe not?
        // What if player WAS ready, but now that we're actually starting they are no longer?
        // Too late for them! Let's double check
        if (!ready)
        {
            Assert.IsFalse(ready, "Player wasn't ready, but the server thought they were!");
            // Oh noes! What do we do? Let's cheat:
            SetReady(true);
            // See buddy, you were ready the whole time, right?
        }
        ResetMatch();

        if (isLocalPlayer)
        {
            GUIManagerScript.SetButton(false);

            GUIManagerScript.SetBackButton(false);

            Color clr = ColorScript.GetColor(GetColor());
            clr = clr * 0.5f;
            GUIManagerScript.SetNumberInputFieldColor(clr);
            GUIManagerScript.ClearNumberInput();
            GUIManagerScript.SetSongSetButton(false);

            //Hacky bullshit for finding which kind of game we're in?
            GameManagerScript gameManager = FindObjectOfType <GameManagerScript>();
            Assert.IsNotNull <GameManagerScript>(gameManager);
            int index = gameManager.GetSongSet();

            AudioManagerScript.instance.StartGameMusic(index);

            GUIManagerScript.SetClassicGameParent(color, ColorScript.GetColor(color), ColorScript.GetColorName(color));

            localPScript.reminded = false;
        }

        List <CaptainsMessPlayer> players = GetPlayers();

        foreach (CaptainsMessPlayer player in players)
        {
            NetworkedPlayerScript nps = player.GetComponent <NetworkedPlayerScript>();
            if (!nps.isLocalPlayer)
            {
                player.GetComponent <NetworkedPlayerScript>().playerButton.SetActive(true);
                player.GetComponent <NetworkedPlayerScript>().playerButton.GetComponent <Button>().interactable = true;
            }
        }
    }
    void RpcSetColor(int c)
    {
        color   = c;
        to_sort = true;

        SetColor();

        if (isLocalPlayer)
        {
            string clr_name = ColorScript.GetColorName(c);

            Color clr = ColorScript.GetColor(c);
            GUIManagerScript.SetInputColor(clr, clr_name);
            clr = clr * 0.5f;
            GUIManagerScript.SetBGColor(clr);
            GUIManagerScript.FillPlayerNumber(c);
            GUIManagerScript.SetNumberInputFieldColor(clr);
            GUIManagerScript.ClearNumberInput();
        }
    }