Example #1
0
    /// <summary>
    /// Add a row to the Message list.
    /// </summary>
    public void AddRowForMessage(string title, string objectId, TableRow.SelectedHandler callback)
    {
        if (currentMessageRowCount == MAX_MESSAGE_ROW_COUNT)
        {
            //remove the first message when MAX_MESSAGE_ROW_COUNT is reached.
            RemoveChild(messageList.transform);
            currentMessageRowCount--;
        }

        currentMessageRowCount++;
        AddRowToTable(messageList.transform, messageRowPrefab, title, objectId, callback);
    }
Example #2
0
 /// <summary>
 /// Add a row to the Player list.
 /// </summary>
 public void AddRowForPlayer(string title, string objectId, TableRow.SelectedHandler callback)
 {
     AddRowToTable(playerList.transform, playerRowPrefab, title, objectId, callback);
 }
Example #3
0
 /// <summary>
 /// Add a row to the Room list.
 /// </summary>
 public void AddRowForRoom(string title, string objectId, TableRow.SelectedHandler callback)
 {
     AddRowToTable(roomList.transform, roomRowPrefab, title, objectId, callback);
 }
Example #4
0
    // Helper methods
    void AddRowToTable(Transform table, GameObject rowPrefab, string title, string objectId, TableRow.SelectedHandler callback)
    {
        GameObject newRow   = Instantiate(rowPrefab, table);
        TableRow   tableRow = newRow.GetComponent <TableRow>();

        tableRow.OnSelected += callback;
        tableRow.SetTitle(title);
        tableRow.SetObjectId(objectId);
    }