コード例 #1
0
 public void RpcEndGame()
 {
     countDown        = 0;
     endgameCountDown = endGameLength;
     currentGameState = 210;
     GUIManagerScript.SetEndGameScreen(true);
 }
コード例 #2
0
    public void BackButtonPressed()
    {
        // Oops, let's reset the match ID
        networkedPScript.CmdResetMatchSongID();

        List <CaptainsMessPlayer> players = networkedPScript.GetPlayers();

        int size = players.Count;

        foreach (CaptainsMessPlayer player in players)
        {
            NetworkedPlayerScript nps = player.GetComponent <NetworkedPlayerScript>();
            if (!nps.isLocalPlayer)
            {
                nps.playerButton.SetActive(true);
                nps.playerButton.GetComponent <Button>().interactable = true;

                Vector3 goal = player.GetComponent <RemotePlayerScript>().GetPosition();

                nps.playerButton.transform.DOLocalMove(goal, nps.fastMovementSpeed);
                nps.playerButton.transform.DOScale(Vector3.one, nps.fastMovementSpeed);
            }
            else
            {
                nps.playerParent.GetComponent <RectTransform>().sizeDelta = new Vector2(160 * (size + 1), 340);
            }
        }


        GUIManagerScript.SetBackButton(false);
    }
コード例 #3
0
    void Start()
    {
        playerParent = GUIManagerScript.playerParent;
        playerButton = transform.Find("PlayerButton").gameObject;

        playerButton.transform.SetParent(playerParent.transform, false);
        playerButton.transform.localScale = Vector3.one;

        playerButtonOutline         = playerButton.GetComponent <Outline>();
        playerButtonOutline.enabled = false;

        playerButton.SetActive(false);

        if (isLocalPlayer)
        {
            playerButton.GetComponent <Button>().interactable = false;
            playerButton.transform.localPosition = Vector3.zero;

            GUIManagerScript.DisableInput(false);
            GUIManagerScript.SetBackButton(false);

            nameText = "";
            GUIManagerScript.FillPlayerText(nameText);
        }
    }
コード例 #4
0
 void RpcStartMainCountdown()
 {
     roundCount++;
     currentGameState = 200;
     countDown        = gameLength;
     GUIManagerScript.SetEndGameScreen(false);
 }
コード例 #5
0
    // Use this for initialization
    void Awake()
    {
        canShoot = true;

        guiManager     = GameObject.Find("GUIManagerPrefab").GetComponent <GUIManagerScript>();
        spriteRenderer = GetComponentInChildren <SpriteRenderer>();
    }
コード例 #6
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();
            }
        }
    }
コード例 #7
0
    public void RpcCountdown(bool l)
    {
        GUIManagerScript.SetEndGameScreen(false);
        if (l)
        {
            //playerParent.GetComponent<PlayerParentScript>().LockAndSpin();
            AudioManagerScript.instance.PrepareGameMusic();
            AudioManagerScript.instance.PlayCountdown();
            GUIManagerScript.SetRulesButton(false);
            GUIManagerScript.SetPregameParent(false);
        }
        else
        {
            //playerParent.GetComponent<PlayerParentScript>().Unlock();
            Debug.Log("Countdown stopped!");
            AudioManagerScript.instance.StopSFX();
            AudioManagerScript.instance.StartMenuMusic();
            GUIManagerScript.SetRulesButton(true);
            GUIManagerScript.SetPregameParent(true);

            if (networkedPScript == null)
            {
                SetNPS();
            }
        }
    }
コード例 #8
0
    public void RpcReplayGame()
    {
        GUIManagerScript.DisableInput(false);

        List <CaptainsMessPlayer> players = GetPlayers();
        int size = players.Count;

        foreach (CaptainsMessPlayer player in players)
        {
            NetworkedPlayerScript nps = player.GetComponent <NetworkedPlayerScript>();
            if (!nps.isLocalPlayer)
            {
                nps.playerButton.SetActive(true);
            }
            nps.playerButton.GetComponent <Button>().interactable = false;

            Vector3 goal = player.GetComponent <RemotePlayerScript>().GetPosition();

            //Move there

            /*
             * nps.playerButton.transform.DOLocalMove(goal, nps.fastMovementSpeed);
             * nps.playerButton.transform.DOScale(Vector3.one, nps.fastMovementSpeed);
             */
            //Insta go there
            nps.playerButton.transform.localPosition = goal;
            nps.playerButton.transform.localScale    = Vector3.one;
        }

        playerParent.GetComponent <RectTransform>().sizeDelta = new Vector2(160 * (size + 1), 340);

        SetReady(true); //Auto advance
    }
コード例 #9
0
    // Redundant? Possible. But I am not sure
    // Unity says this is the one to use, yet OnDestroy works and possibly works better?
    // Let's do both to be safe.
    void OnDestroy()
    {
        //print("Player was was destroyed");
        if (playerButton != null)
        {
            Destroy(playerButton);
        }

        if (isLocalPlayer)
        {
            GUIManagerScript.SetInput(false);
            GUIManagerScript.SetButton(false);
            GUIManagerScript.SetRulesButton(false);
            GUIManagerScript.SetBackButton(false);
            GUIManagerScript.HideColorShow();
            if (GUIManagerScript.countdownText != null)
            {
                GUIManagerScript.countdownText.enabled = false;
            }

            if (AudioManagerScript.instance != null)
            {
                AudioManagerScript.instance.StopSFX();
                AudioManagerScript.instance.EndGameMusic();
                AudioManagerScript.instance.StartMenuMusic();
            }
        }

        // If this is a client player on the server then OnClientExitLobby will not be called.
        // Call it here instead.
        if (networkManager.IsHost() && networkManager.localPlayer != this)
        {
            OnClientExitLobby();
        }
    }
コード例 #10
0
    public override void OnStartLocalPlayer()
    {
        gameObject.name = "LOCAL Player";

        remotePScript.enabled = false;
        localPScript.enabled  = true;

        CmdSetColor();

        score             = 0;
        scored_ThisRound  = 0;
        scored_TimeBonus  = 0;
        scored_FirstBonus = false;
        scored_WasGuessed = false;

        AudioManagerScript.instance.PlaySFX(AudioManagerScript.SFXClips.DanceTogether);

        GUIManagerScript.SetRulesButton(true);
        GUIManagerScript.SetPregameParent(true);
        GUIManagerScript.SetSongSetButton(true);

        SetReady(false);

        if (isServer)
        {
            GUIManagerScript.versionText.text = "v" + versionNum + " Host";
        }
        else
        {
            GUIManagerScript.versionText.text = "v" + versionNum + " Client";
        }


        base.OnStartLocalPlayer();
    }
コード例 #11
0
    public void ApplyDamage(float damage)
    {
        float avoidProbability = GetStat("avoid").finalValue;

        damage -= GetStat("armor").finalValue;

        GUIManagerScript gui          = Object.FindObjectOfType <GUIManagerScript>();
        string           debug_string = "";


        if (avoidProbability > 0f)
        {
            float random = Random.Range(0f, 1f);

            if (random < avoidProbability)
            {
                debug_string = characterName + " avoid " + damage.ToString() + "damage";
                Debug.Log(debug_string);
                gui.AddCombatLogEntry(debug_string);
                return;
            }
        }

        debug_string = characterName + " recive " + damage.ToString() + " damage";
        Debug.Log(debug_string);
        gui.AddCombatLogEntry(debug_string);
        GetStat("life").currentValue -= damage;
    }
コード例 #12
0
    public void RpcReplayGame()
    {
        endgameCountDown = -1;
        currentGameState = 0;
        GUIManagerScript.SetEndGameScreen(false);

        AudioManagerScript.instance.StartMenuMusic();
    }
コード例 #13
0
    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;
            }
        }
    }
コード例 #14
0
 public void RpcIterateSongSet()
 {
     songSet++;
     if (songSet >= songNames.Length)
     {
         songSet = 0;
     }
     GUIManagerScript.SetSongSetButtonText(GetSongTypeText(songSet));
 }
コード例 #15
0
    void Start()
    {
        countDown        = -1;
        endgameCountDown = -1;
        roundCount       = 0;
        GUIManagerScript.SetEndGameScreen(false);

        Random.InitState((int)System.Environment.TickCount);
    }
コード例 #16
0
    public override void OnStartConnecting()
    {
        mainViewParent.SetActive(true);
        GUIManagerScript.HideMainView();

        networkState = NetworkState.Connecting;

        disconnectButton.SetActive(true);
        menuParent.SetActive(false);
    }
コード例 #17
0
    void ConfirmPlacement_RPC(int bigID, int smallID, Defines.TURN turn, float time)
    {
        BoardScript      board     = GameObject.Find("Board").GetComponent <BoardScript>();
        BigGridScript    bigGrid   = board.bigGrids[bigID].GetComponent <BigGridScript>();
        GridScript       smallGrid = bigGrid.grids[smallID].GetComponent <GridScript>();
        GUIManagerScript guiScript = GameObject.FindGameObjectsWithTag("GUIManager")[0].GetComponent <GUIManagerScript>();

        smallGrid.ConfirmPlacement();
        guiScript.SetTimer(turn, time);
    }
コード例 #18
0
    void Start()
    {
        countDown        = -1;
        endgameCountDown = -1;
        roundCount       = 0;
        GUIManagerScript.SetEndGameScreen(false);
        GUIManagerScript.SetSongSetButtonText(GetSongTypeText(songSet));

        Random.InitState((int)System.Environment.TickCount);
    }
コード例 #19
0
 public void RpcResetScore()
 {
     Debug.Log("NP RpsResetScore");
     score = 0;
     if (isLocalPlayer)
     {
         Debug.Log("NP RpsResetScore Local Player");
         GUIManagerScript.SetScoreText(score);
     }
 }
コード例 #20
0
    public override void OnJoinedLobby()
    {
        mainViewParent.SetActive(true);
        GUIManagerScript.HideMainView();

        networkState = NetworkState.Connected;

        //gameSession.OnJoinedLobby();

        disconnectButton.SetActive(true);
        menuParent.SetActive(false);
    }
コード例 #21
0
    public override void OnStopConnecting()
    {
        mainViewParent.SetActive(false);

        networkState = NetworkState.Offline;

        disconnectButton.SetActive(false);
        menuParent.SetActive(true);
        GUIManagerScript.HideScoreText();

        GUIManagerScript.SetBGColor(new Color32(32, 32, 32, 255));
    }
コード例 #22
0
    public override void OnLeftLobby()
    {
        mainViewParent.SetActive(false);

        networkState = NetworkState.Offline;

        //gameSession.OnLeftLobby();

        disconnectButton.interactable = false;
        menuParent.SetActive(true);
        GUIManagerScript.HideScoreText();

        GUIManagerScript.SetBGColor(new Color32(32, 32, 32, 255));
    }
コード例 #23
0
    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.FillPlayerText(nameText);

            GUIManagerScript.SetButton(false);

            GUIManagerScript.DisableInput(true);
            GUIManagerScript.SetBackButton(false);

            AudioManagerScript.instance.StartGameMusic();

            GUIManagerScript.SetColorShow(nameText, 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;
            }
        }
    }
コード例 #24
0
    public void RpcEndGame()
    {
        SetReady(false);

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

            GUIManagerScript.SetBackButton(false);

            AudioManagerScript.instance.EndGameMusic();

            AudioManagerScript.instance.PlayRoundEnd(scored_GuessedCorrect);

            GUIManagerScript.HideColorShow();
        }
    }
コード例 #25
0
    public void LockChoiceButtonPressed()
    {
        InputField numberTextField = GUIManagerScript.numberTextField;

        int input = -1;

        if (System.Int32.TryParse(numberTextField.text, out input))
        {
            int s = DoesPlayerNumberExist(input);
            if (s != -1)
            {
                CmdSetMatchSongID(s, input);
                GUIManagerScript.NumberInputLocked(true);
                GUIManagerScript.SetBackButton(true);
            }
        }
    }
コード例 #26
0
    void SetReady(bool ready)
    {
        if (ready)
        {
            SendReadyToBeginMessage();

            GUIManagerScript.SetButtonText("Cancel");
        }
        else
        {
            SendNotReadyToBeginMessage();

            GUIManagerScript.SetButtonText("Dance");
        }

        GUIManagerScript.SetMainButtonHighlight(ready);
    }
コード例 #27
0
    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();
        }
    }
コード例 #28
0
    void SortPlayers()
    {
        List <CaptainsMessPlayer> players = mess.Players();
        int i    = 0;
        int size = players.Count;

        List <CaptainsMessPlayer> SortedList = players.OrderBy(o => o.GetComponent <NetworkedPlayerScript>().nameText).ToList();

        foreach (CaptainsMessPlayer player in SortedList)
        {
            NetworkedPlayerScript nps = player.GetComponent <NetworkedPlayerScript>();
            if (!nps.isLocalPlayer)
            {
                RemotePlayerScript rps = player.GetComponent <RemotePlayerScript>();

                Vector3 goal = rps.SetPosition(++i, size);

                if (nps.playerButton.activeSelf == false)
                {
                    nps.playerButton.SetActive(true);
                    nps.playerButton.transform.localPosition = new Vector3(i * 160, -340, 0);
                }

                nps.playerButton.transform.DOLocalMove(goal, movementSpeed);
                nps.playerButton.transform.DOScale(Vector3.one, movementSpeed);
            }
            nps.SetColor();
            nps.SetNameText();
        }

        if (size >= 4)
        {
            GUIManagerScript.SetButton(true);
        }
        else
        {
            GUIManagerScript.SetButton(false);
        }

        playerParent.GetComponent <RectTransform>().sizeDelta = new Vector2(160 * (size + 1), 340);
    }
コード例 #29
0
    public void PlayerButtonPressed()
    {
        GameManagerScript gameManager = FindObjectOfType <GameManagerScript>();

        Assert.IsNotNull <GameManagerScript>(gameManager);

        if (isLocalPlayer)
        {
            if (!gameManager.IsGameStarted())
            {
                ToggleReady();
            }
        }
        else
        {
            if (gameManager.IsGameStarted())
            {
                List <CaptainsMessPlayer> players = GetPlayers();
                foreach (CaptainsMessPlayer player in players)
                {
                    NetworkedPlayerScript nps = player.GetComponent <NetworkedPlayerScript>();
                    if (player.name == "LOCAL Player")
                    {
                        nps.CmdSetMatchSongID(songID, color);
                    }
                    nps.playerButton.SetActive(false);
                    nps.playerButton.GetComponent <Button>().interactable = false;
                }

                playerButton.SetActive(true);
                playerButton.GetComponent <Button>().interactable = false;
                playerButton.transform.DOLocalMove(new Vector3(30, 20, 0), fastMovementSpeed);
                playerButton.transform.DOScale(new Vector3(1.5f, 1.5f, 1f), fastMovementSpeed);

                playerParent.GetComponent <RectTransform>().sizeDelta = new Vector2(170, 140);

                GUIManagerScript.SetBackButton(true);
            }
        }
    }
コード例 #30
0
    public void BackButtonPressed()
    {
        // Oops, let's reset the match ID
        networkedPScript.CmdResetMatchSongID();

        GUIManagerScript.NumberInputLocked(false);

        List <CaptainsMessPlayer> players = networkedPScript.GetPlayers();

        int size = players.Count;

        foreach (CaptainsMessPlayer player in players)
        {
            NetworkedPlayerScript nps = player.GetComponent <NetworkedPlayerScript>();
            if (!nps.isLocalPlayer)
            {
                nps.playerButton.SetActive(true);
                nps.playerButton.GetComponent <Button>().interactable = true;

                Vector3 goal = player.GetComponent <RemotePlayerScript>().GetPosition();

                nps.playerButton.transform.DOLocalMove(goal, nps.fastMovementSpeed);
                nps.playerButton.transform.DOScale(Vector3.one, nps.fastMovementSpeed);
            }
            else
            {
                nps.playerParent.GetComponent <RectTransform>().sizeDelta = new Vector2(160 * (size + 1), 340);
            }
        }

        // Optional clear colors after backing out of choice?

        /*Color clr = ColorScript.GetColor(networkedPScript.GetColor());
         * clr = clr * 0.5f;
         * GUIManagerScript.SetNumberInputFieldColor(clr);
         * GUIManagerScript.ClearNumberInput();*/

        GUIManagerScript.SetBackButton(false);
    }
コード例 #31
0
 void Awake()
 {
     mode = Mode.None;
     hexfieldMan = GetComponent<HexfieldManagerScript>();
     GUIMan = GetComponent<GUIManagerScript>();
     GameObject[] tempUnitList = GameObject.FindGameObjectsWithTag("Unit");
     unitList = new List<UnitScript>();
     foreach (GameObject go in tempUnitList)
         unitList.Add(go.GetComponent<UnitScript>());
 }