Ejemplo n.º 1
0
    private GameButtonCell CreateItemCell(Transform in_parent = null, bool in_even = false)
    {
        GameButtonCell toReturn        = null;
        bool           isSecondDisplay = MyGames.color == OPP_COLOR ? true : false;

        toReturn = (CreateResourceAtPath(in_even ? "Prefabs/GameButtonCell" + (isSecondDisplay ? "2" : "1") + "A" : "Prefabs/GameButtonCell" + (isSecondDisplay ? "2" : "1") + "B", in_parent.transform)).GetComponent <GameButtonCell>();
        toReturn.transform.SetParent(in_parent);
        toReturn.transform.localScale = Vector3.one;
        return(toReturn);
    }
Ejemplo n.º 2
0
 public void OnMatchSelected(MatchInfo match, GameButtonCell cell)
 {
     if (match != null)
     {
         App.CurrentMatch = match;
         _selectedCell    = cell;
         // Query more detail state about the match
         App.Bc.AsyncMatchService
         .ReadMatch(match.ownerId, match.matchId, OnReadMatch, OnReadMatchFailed, match);
     }
 }
Ejemplo n.º 3
0
    private void AddNewCell(string jsonResponse, object cbObject)
    {
        var match = cbObject as MatchInfo;
        var data  = JsonMapper.ToObject(jsonResponse)["data"];

        //Determining if game is completed
        string board = (string)data["matchState"]["board"];

        match.complete = BoardUtility.IsGameCompleted(board);
        if (match.complete)
        {
            match.scoreSubmitted = true;
        }
        App.PlayerInfoO = match.playerOInfo;
        App.PlayerInfoX = match.playerXInfo;

        //Create game button cell
        GameButtonCell newItem = CreateItemCell(MyGamesScrollView, (index % 2) == 0);

        newItem.Init(match, this);
        newItem.transform.localPosition = Vector3.zero;
        index = index < matches.Count ? index++ : 0;
        m_itemCell.Add(newItem);

        //Ensuring no duplicated game button cells are created
        var tempList = new List <GameButtonCell>();

        for (int i = m_itemCell.Count - 1; i > -1; i--)
        {
            if (tempList.Count == 0)
            {
                tempList.Add(m_itemCell[i]);
                continue;
            }
            if (tempList[i].MatchInfo.matchId == m_itemCell[i].MatchInfo.matchId)
            {
                Destroy(m_itemCell[i].gameObject);
                m_itemCell.Remove(m_itemCell[i]);
            }
        }
    }
Ejemplo n.º 4
0
    //Populates players to pick from for a new match
    private void PopulatePlayersScrollView(List <PlayerInfo> in_itemItems)
    {
        RemoveAllCellsInView(m_itemCell);
        if (in_itemItems.Count == 0)
        {
            return;
        }

        if (MyGamesScrollView != null)
        {
            int i = 0;
            foreach (var profile in in_itemItems)
            {
                GameButtonCell newItem = CreateItemCell(MyGamesScrollView, (i % 2) == 0);
                newItem.Init(profile, this);
                newItem.transform.localPosition = Vector3.zero;
                m_itemCell.Add(newItem);
                i++;
            }
        }
    }
Ejemplo n.º 5
0
    private void PopulateMatchesScrollView(List <MatchInfo> in_itemItems, List <GameButtonCell> in_itemCell, RectTransform in_scrollView)
    {
        if (in_itemItems.Count == 0)
        {
            return;
        }

        if (in_scrollView != null)
        {
            int i = 0;
            //            foreach (var profile in in_itemItems)
            foreach (var match in in_itemItems)
            {
                GameButtonCell newItem = CreateItemCell(in_scrollView, (i % 2) == 0);
                newItem.Init(match, this);
                newItem.transform.localPosition = Vector3.zero;
                in_itemCell.Add(newItem);
                i++;
            }
        }
    }