Exemple #1
0
        /// <summary>
        /// Criar a table
        /// </summary>
        private void createTable()
        {
            _itemsTable.Reset();
            _itemsTable.Title         = info.getContent("conquerplanet_title");
            _itemsTable.TitleCssClass = "planetInfoZoneTitle";
            _itemsTable.TableCssClass = "planetFrame";

            createTitle(_itemsTable);

            bool hasResults = false;

            ArrayList fleetsInConquerState = _ruler.FleetsInConquerState();

            foreach (Chronos.Core.Fleet fleet in fleetsInConquerState)
            {
                Planet p = Universe.instance.getPlanet(fleet.Coordinate);

                ItemsTableLine line = new ItemsTableLine();

                ItemsTableText name       = new ItemsTableText(fleet.Name, "resource");
                ItemsTableText coordinate = new ItemsTableText(fleet.Coordinate.ToString(), "resource");


                ItemsTableText rulerName;
                if (p.Owner != null)
                {
                    rulerName = new ItemsTableText(OrionGlobals.getLink((Ruler)p.Owner), "resource");
                }
                else
                {
                    rulerName = new ItemsTableText(info.getContent("conquerplanet_none"), "resource");
                }

                ItemsTableTextBox textbox = new ItemsTableTextBox();
                textbox.CssClass = "resource";
                textbox.CssClass = "textbox";

                ItemsTableImageButton conquerPlanet = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("ok.gif"), "conquer_" + fleet.Id.ToString());
                conquerPlanet.Click += new ImageClickEventHandler(conquerPlanet_Click);

                ItemsTableItem returnPlanet;

                if (p.InitMade)
                {
                    returnPlanet = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("remove.gif"), "conquer_return" + fleet.Id.ToString());

                    ((ItemsTableImageButton)returnPlanet).Click += new ImageClickEventHandler(returnPlanet_Click);
                }
                else
                {
                    returnPlanet = new ItemsTableText("", "resource");
                }

                line.add(name);
                line.add(coordinate);
                line.add(rulerName);
                line.add(textbox);
                line.add(conquerPlanet);
                line.add(returnPlanet);
                line.add(returnPlanet);

                _itemsTable.addLine(line);

                hasResults = true;
            }

            if (!hasResults)
            {
                noResults();
            }
        }