Exemplo n.º 1
0
    public void CreateMatchListing()
    {
        MatchNameTxt.text = SelectedMatch.MatchName;
        Team1NameTxt.text = SelectedMatch.Team1;
        Team2NameTxt.text = SelectedMatch.Team2;

        ClearListing(TeamContents [0].transform);
        ClearListing(TeamContents [1].transform);
        Team1Players.Clear();
        Team2Players.Clear();

        foreach (PlayerData PD in SelectedMatch.Team1Players)
        {
            GameObject GO = Instantiate(PlayerItem);
            GO.GetComponent <EditScoreItem> ()._PlayerData = PD;
            GO.GetComponent <EditScoreItem> ().AssignValues();
            GO.transform.SetParent(TeamContents [0].transform);
            GO.transform.localScale = Vector3.one;
            Team1Players.Add(GO.GetComponent <EditScoreItem> ());
            TeamContents [0].GetComponent <RectTransform> ().sizeDelta = new Vector2(565, TeamContents [0].GetComponent <RectTransform> ().rect.height + 80);
        }


        foreach (PlayerData PD in SelectedMatch.Team2Players)
        {
            GameObject GO = Instantiate(PlayerItem);
            GO.GetComponent <EditScoreItem> ()._PlayerData = PD;
            GO.GetComponent <EditScoreItem> ().AssignValues();
            GO.transform.SetParent(TeamContents [1].transform);
            GO.transform.localScale = Vector3.one;
            Team2Players.Add(GO.GetComponent <EditScoreItem> ());
            TeamContents [1].GetComponent <RectTransform> ().sizeDelta = new Vector2(565, TeamContents [1].GetComponent <RectTransform> ().rect.height + 80);
        }
    }
Exemplo n.º 2
0
 public void PublishChanges()
 {
     SelectedMatch.isLive = true;
     foreach (EditScoreItem GO in Team1Players)
     {
         GO.UpdateScore();
     }
     foreach (EditScoreItem GO in Team2Players)
     {
         GO.UpdateScore();
     }
     DatabaseEntry.instance.CricketList.Where(a => a.TournamentName == SelectedMatch.TournamentName).First().Tournaments.Where(a => a.MatchName == SelectedMatch.MatchName).First().Team1Players = Team1Players.Select(a => a._PlayerData).ToList();
     DatabaseEntry.instance.CricketList.Where(a => a.TournamentName == SelectedMatch.TournamentName).First().Tournaments.Where(a => a.MatchName == SelectedMatch.MatchName).First().Team2Players = Team2Players.Select(a => a._PlayerData).ToList();
     DatabaseEntry.instance.UpdateMatchDetails(SelectedMatch.TournamentName, SelectedMatch.MatchName, Team1Players.Select(a => a._PlayerData).ToList(), Team2Players.Select(a => a._PlayerData).ToList());
 }