/// <summary>
    /// Pause game
    /// </summary>
    public void PauseGame()
    {
        string txt = "pause";

        SendMessageToServer.SendToServer(txt, Tags.pauseGame, client);
        timePanel.prgBar.isOn = false;
    }
Exemple #2
0
    /// <summary>
    /// Display Score Text
    /// </summary>
    /// <param name="text"></param>
    /// <param name="value"></param>
    /// <param name="isScore"></param>
    public void DisplayScoreText(string text, int value, bool isScore)
    {
        switch (Round.roundNumber)
        {
        case 1:
            if (isScore)
            {
                firstScoreText.text += text + ",";
                firstRoundValue     += value;
                string txt = player.juryNumber.ToString() + "," + color + "," + firstRoundValue.ToString();
                SendMessageToServer.SendToServer(txt, Tags.score, client);
            }
            else
            {
                firstPinaltyText.text += text + ",";
                firstRoundValue       += value;
                string txt = player.juryNumber.ToString() + "," + color + "," + firstRoundValue.ToString();
                SendMessageToServer.SendToServer(txt, Tags.score, client);
            }
            break;

        case 2:
            if (isScore)
            {
                secondScoreText.text += text + ",";
                secondRoundValue     += value;
                string txt = player.juryNumber.ToString() + "," + color + "," + secondRoundValue.ToString();
                SendMessageToServer.SendToServer(txt, Tags.score, client);
            }
            else
            {
                secondPinaltyText.text += text + ",";
                secondRoundValue       += value;
                string txt = player.juryNumber.ToString() + "," + color + "," + secondRoundValue.ToString();
                SendMessageToServer.SendToServer(txt, Tags.score, client);
            }
            break;

        case 3:
            if (isScore)
            {
                thirdScoreText.text += text + ",";
                thirdRoundValue     += value;
                string txt = player.juryNumber.ToString() + "," + color + "," + thirdRoundValue.ToString();
                SendMessageToServer.SendToServer(txt, Tags.score, client);
            }
            else
            {
                thirdPinaltyText.text += text + ",";
                thirdRoundValue       += value;
                string txt = player.juryNumber.ToString() + "," + color + "," + thirdRoundValue.ToString();
                SendMessageToServer.SendToServer(txt, Tags.score, client);
            }
            break;

        default:
            break;
        }
        CalculateTotalValue();
    }
    /// <summary>
    /// Allow to play game
    /// </summary>
    public void PlayGame()
    {
        string txt = "play";

        SendMessageToServer.SendToServer(txt, Tags.playGame, client);

        timePanel.prgBar.isOn = true;
    }
    /// <summary>
    /// Send time after setting
    /// </summary>
    public void SetTime()
    {
        string txt = timeInputField.min.text + "," + timeInputField.sec.text;

        timePanel.DisplayTime(txt);
        ActivateMainWindow();
        SendMessageToServer.SendToServer(Round.roundNumber.ToString(), Tags.round, client);
    }
 /// <summary>
 /// Delete game
 /// </summary>
 public void DeleteGame()
 {
     if (!timePanel.prgBar.isOn)
     {
         string txt = "delete";
         monitorScore.ClearAll();
         SendMessageToServer.SendToServer(txt, Tags.deleteGame, client);
     }
 }
    private void Update()
    {
        if (prgBar.isOn)
        {
            if (Round.roundNumber.Equals(0))
            {
                round.PassRound(1);
                SendMessageToServer.SendToServer(Round.roundNumber.ToString(), Tags.round, client);
            }
            totalTime            -= Time.deltaTime;
            secondValue           = (int)(totalTime % 60);
            minuteValue           = (int)(totalTime / 60);
            min.text              = minuteValue.ToString() + " : " + secondValue.ToString();
            prgBar.currentPercent = (totalTime * 100) / (minuteValue * 60 + secondValue);
        }

        if (totalTime <= 0)
        {
            prgBar.isOn = false;
            if (Round.roundNumber < 3)
            {
                Round.roundNumber++;
                round.PassRound(Round.roundNumber);
                SendMessageToServer.SendToServer(Round.roundNumber.ToString(), Tags.round, client);
                SendMessageToServer.SendToServer("pause", Tags.pauseGame, client);
                totalTime = totalTimeSaved;
                min.text  = minSaved;
            }
            else
            {
                round.MakeAllDefault();
                round.FinishGame();
                SendMessageToServer.SendToServer("finishRound", Tags.finishRound, client);
                SendMessageToServer.SendToServer("pause", Tags.pauseGame, client);
                totalTime = totalTimeSaved;
                min.text  = minSaved;
            }
        }
    }
Exemple #7
0
    /// <summary>
    /// Sends selected juryNumber to the Server
    /// </summary>
    /// <param name="number"></param>
    public void SendJuryNumber(int _number)
    {
        ushort number = Convert.ToUInt16(_number);

        SendMessageToServer.SendToServer(number, Tags.juryNumber, client);
    }
Exemple #8
0
 /// <summary>
 /// Call this method when tag is connection
 /// </summary>
 /// <param name="reader"></param>
 public void ConnectionTag(ushort number)
 {
     player.ID = number;
     SendMessageToServer.SendToServer(player.type, Tags.type, client);
 }