Exemplo n.º 1
0
    void Start()
    {
        if (SelectionSingleton.instance.IsPractice)
        {
            ScoreBoard.SetActive(false);
        }

        audioSource = GetComponent <AudioSource>();
        sfxVol      = AudioUtil.GetSfx();

        if (AudioUtil.GetBgm() == 0f)
        {
            audioSource.clip = null;
        }

        currentScoreToWin = SCORE_TO_WIN;
        Time.timeScale    = 1;
        teams[0]          = new TeamProps {
            Score      = 0, SetCore = 0,
            TeamName   = SelectionSingleton.instance.OpponentCountry.ShortName,
            UIScore    = TopScoreUI,
            UISetScore = TopSetScoreUI
        };
        teams[1] = new TeamProps {
            Score      = 0, SetCore = 0,
            TeamName   = SelectionSingleton.instance.PlayerCountry.ShortName,
            UIScore    = BottomScoreUI,
            UISetScore = BottomSetScoreUI
        };

        NumberOfPlayers     = (DemoPlay) ? 3 : SelectionSingleton.instance.NumberOfPlayers;
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        if (SelectionSingleton.instance.PlayerCountry.Name.Equals(SelectionSingleton.instance.OpponentCountry.Name))
        {
            PlayerNameUI.text = SelectionSingleton.instance.PlayerCountry.Name + "(YOU)";
            EnemyNameUI.text  = SelectionSingleton.instance.OpponentCountry.Name;
            teams[1].TeamName = PlayerNameUI.text;
            teams[0].TeamName = EnemyNameUI.text;
        }
        else
        {
            PlayerNameUI.text = SelectionSingleton.instance.PlayerCountry.Name;
            EnemyNameUI.text  = SelectionSingleton.instance.OpponentCountry.Name;
        }

        SelectedPlayerTeam = CharacterComponents;
        SelectedEnemyTeam  = CharacterComponents;

        if (dontPlay)
        {
            isServing = false;
        }
        else
        {
            SpawnPlayers();
        }
    }
Exemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e) //this is save method coding
        {
            TeamProps pr = new TeamProps();                      //Property class instance

            pr.TeamName = txtTeamName.Text.Trim();
            pr.CoachID  = Convert.ToInt32(CoachID.Text);
            pr.State    = State.Text.Trim();
            pr.City     = City.Text.Trim();
            if (HiddenField1.Value != "")
            {
                pr.ID = Convert.ToInt32(HiddenField1.Value);
            }
            bool result = _serviceCoach.InsertUpdateTeamMaster(pr);//Add update method calling

            if (result)
            {
                Response.Write("<script>alert('Record saved successfully')</script>");
                Response.Redirect("Team.aspx");
            }
            bindGrid();
        }
        public bool InsertUpdateTeamMaster(TeamProps pr)
        {
            bool isUpdate = false;

            try
            {
                if (pr.ID == 0)
                {
                    Team _team = new Team();
                    _team.TeamName = pr.TeamName;
                    _team.City     = pr.City;
                    _team.State    = pr.State;
                    _team.CoachID  = pr.CoachID;
                    _db.Teams.Add(_team);
                    _db.SaveChanges();
                    isUpdate = true;
                }
                else
                {
                    var _team = _db.Teams.Where(x => x.ID == pr.ID).FirstOrDefault();
                    if (_team != null)
                    {
                        _team.TeamName = pr.TeamName;
                        _team.City     = pr.City;
                        _team.State    = pr.State;
                        _team.CoachID  = pr.CoachID;
                        _db.SaveChanges();
                        isUpdate = true;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(isUpdate);
        }
Exemplo n.º 4
0
    public void AddScore(int teamIndex)
    {
        var sd = GameObject.FindObjectsOfType <SuperKickDestination>();

        foreach (var i in sd)
        {
            Destroy(i.gameObject);
        }

        if (SelectionSingleton.instance.IsPractice)
        {
            return;
        }

        TeamProps t  = teams[teamIndex];
        TeamProps to = teams[(teamIndex == 0) ? 1 : 0];
        string    sr = "ROUND";

        t.Score       += 1;
        t.UIScore.text = t.Score.ToString();
        string c = (teamIndex == 0) ? "red" : "blue";

        if ((t.Score + to.Score) % 3 == 0)
        {
            isTopServe = !isTopServe;
        }

        if (t.Score >= currentScoreToWin && t.Score - to.Score > 1)
        {
            currentSet++;

            sr                = "SET";
            t.SetCore        += 1;
            t.UISetScore.text = t.SetCore.ToString();
            t.Score           = 0;
            t.UIScore.text    = t.Score.ToString();
            to.Score          = 0;
            to.UIScore.text   = t.Score.ToString();


            if (currentSet == FINAL_SET)
            {
                Debug.Log("FINAL SET");
                currentScoreToWin = SCORE_TO_WIN_LAST_SET;
            }
        }

        if (t.SetCore == SETS_TO_WIN)
        {
            MatchFinishedPanel.SetActive(true);
            hasWinner = true;
            sr        = "MATCH";

            if (teamIndex == 1)
            {
                if (!SelectionSingleton.instance.IsMinigame)
                {
                    TextEndGame.text = "You've earned <color=\"yellow\">100</color> points";
                    EarnedPointsUI.SetActive(true);
                    PointsUtil.AddPoints(100);
                }
                else
                {
                    TextEndGame.text = "You've earned <color=\"yellow\">5</color> allocation points";
                    EarnedPointsUI.SetActive(true);
                    var vsac = VSAllCountriesModel.GetCurrentGame();
                    vsac.RemainingPoints += 5;
                    vsac.CurrentLevel     = vsac.CurrentLevel < 4 ? vsac.CurrentLevel + 1 : 0;
                    VSAllCountriesModel.SaveInstance(vsac);
                    //PointsUtil.AddPoints(100);
                }
            }
        }

        ScoredTeamText.text = $"<color={c}>{t.TeamName}</color> WIN {sr}";
    }