Пример #1
0
        public Row AddDetailRow()
        {
            Element rowElement = new Element("tr");

            Element tbody = TableElement.GetFirstChildElement("tbody");

            if (tbody != null)
            {
                tbody.AppendChild(rowElement);
            }
            else
            {
                TableElement.AppendChild(rowElement);
            }

            for (int i = 0; i < ColumnCount; i++)
            {
                rowElement.AppendChild(new Element("td"));
            }

            return(new Row(rowElement));
        }
Пример #2
0
        protected override void Init()
        {
            AddSystem(new MenuBackgroundSystem());

            CanPause = false;

            BuildMenuButton("Back", 530, delegate(ElementEvent e)
            {
                CurrentGame.ShowTitleScreen();
            });

            Element title = BuildMenuButton("High Scores", 80, null);

            title.ClassName += " MenuTitle";

            HighScore[] scores = (HighScore[])Json.Parse((string)Window.LocalStorage[SpaceDinosGame.HighScoresKey]);

            TableElement table = (TableElement)Document.CreateElement("TABLE");

            table.ClassName = "HighScores";
            _overlay.AppendChild(table);
            Element tableBody = Document.CreateElement("TBODY");

            table.AppendChild(tableBody);

            TableRowElement row = (TableRowElement)Document.CreateElement("TR");

            tableBody.AppendChild(row);

            AddCell(row, "TH", string.Empty);
            AddCell(row, "TH", "Score");
            AddCell(row, "TH", "Level");
            AddCell(row, "TH", "Name");

            for (int i = 0; i < 10; i++)
            {
                row = (TableRowElement)Document.CreateElement("TR");
                tableBody.AppendChild(row);

                switch (i)
                {
                case 0:
                    AddCell(row, "TD", "1st");
                    break;

                case 1:
                    AddCell(row, "TD", "2nd");
                    break;

                case 2:
                    AddCell(row, "TD", "3rd");
                    break;

                default:
                    AddCell(row, "TD", (i + 1) + "th");
                    break;
                }

                AddCell(row, "TD", scores[i].Score.ToString());
                AddCell(row, "TD", scores[i].Level.ToString());
                AddCell(row, "TD", scores[i].Name);
            }

            jQuery.FromElement(_overlay).Show();
        }