Beispiel #1
0
        private void DisplayInfo(IPlayer player, string clanTag)
        {
            JArray clanMembers = GetClanMembers(clanTag);

            if (clanMembers == null)
            {
                player.Reply(Lang("NotFound", player.Id));

                return;
            }

            CustomTable customTable = new CustomTable();

            customTable.AddColumn(Lang("ColumnName", player.Id));
            customTable.AddColumn(Lang("ColumnID", player.Id));
            customTable.AddColumn(Lang("ColumnStatus", player.Id));

            foreach (JToken userID in clanMembers)
            {
                IPlayer mPlayer = covalence.Players.FindPlayerById((string)userID);

                if (mPlayer == null)
                {
                    continue;
                }

                customTable.AddRow(mPlayer.Name, mPlayer.Id, mPlayer.IsConnected ? Lang("Online", player.Id) : Lang("Offline", player.Id));
            }

            player.Reply(Lang("DisplayMsg", player.Id, clanTag, customTable));
        }
Beispiel #2
0
    public CustomTable OneToManyParameterReference(GameObject ref1, GameObject ref2, int currentPage, int height)
    {
        //List of CustomTable ( new class ) created.


        //returnTable[0] will have all rows for selection 1 of drop down
        //returnTable[1] will have all rows for selection 2 of drop down
        CustomTable refTable = new CustomTable();

        //  CustomTable ref2Table = new CustomTable();


        if (ref1 == null && ref2 == null)
        {
            return(refTable);
        }
        else
        {
            int inactivePlanes = 0;
            foreach (Transform aircraft in aircraftParent.transform)
            {
                if (aircraft.gameObject.activeInHierarchy)
                {
                    int SiblingIndex = aircraft.GetSiblingIndex() - inactivePlanes;

                    //Lies between the rows to be calculated
                    if (SiblingIndex >= (currentPage * height) && SiblingIndex < (currentPage * height) + height)
                    {
                        //Iterate through each aircraft in parent object and doo the calculations
                        List <string> calculations = new List <string>();

                        //create new row - add aircrat name at index 0 and remaining calculations after it
                        calculations.Add(aircraft.gameObject.GetComponent <movement>().callsign);


                        if (ref1)
                        {
                            if (!ref1.activeInHierarchy)
                            {
                                string[] inActiveStatusArray = { "NaN", "NaN", "NaN", "NaN", "NaN", "NaN" };
                                calculations.AddRange(inActiveStatusArray);
                            }
                            else
                            {
                                calculations.AddRange(DoCalculations(aircraft.gameObject, ref1));
                            }
                            //Add row method also keeps the counter. So we can check if a table is empty if ref1Table.RowCount = 0
                        }
                        else
                        {
                            string[] emptyArray = { " ", " ", " ", " ", " ", " " };
                            calculations.AddRange(emptyArray);
                        }

                        if (ref2)
                        {
                            if (!ref2.activeInHierarchy)
                            {
                                string[] inActiveStatusArray = { "NaN", "NaN", "NaN", "NaN", "NaN", "NaN" };
                                calculations.AddRange(inActiveStatusArray);
                            }
                            else
                            {
                                calculations.AddRange(DoCalculations(aircraft.gameObject, ref2));
                            }
                        }
                        else
                        {
                            string[] emptyArray = { " ", " ", " ", " ", " ", " " };
                            calculations.AddRange(emptyArray);
                        }

                        refTable.AddRow(calculations);
                    }
                }
                else
                {
                    inactivePlanes++;
                }
            }

            //will add these tables to return table. Please see CustomTable methods to retrieve these rows.


            return(refTable);
        }
    }