Beispiel #1
0
        private void createTitle(ItemsTable _itemsTable)
        {
            ItemsTableLine line = new ItemsTableLine();

            line.add(new ItemsTableText(info.getContent("currentBattle_turn"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("currentBattle_opponent"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("online"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("battle_type"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("currentBattle_status"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("currentBattle_timeout"), "resourceTitle"));

            if (type == Chronos.Battle.BattleType.BATTLE)
            {
                line.add(new ItemsTableText(info.getContent("currentBattle_location"), "resourceTitle"));
            }

            ItemsTableText timeLeft = new ItemsTableText(info.getContent("currentBattle_timeLeft"), "resourceTitle");

            timeLeft.Width = "150px";
            line.add(timeLeft);


            _itemsTable.HeaderItem         = line;
            _itemsTable.TableTitleCssClass = "resourceTitle";
        }
Beispiel #2
0
        private void noResults()
        {
            ItemsTableLine line = new ItemsTableLine();
            ItemsTableText txt  = new ItemsTableText(info.getContent("conquerplanet_noPlanet"), "resource");

            txt.ColumnSpan = 6;
            line.add(txt);
            _itemsTable.addLine(line);
        }
Beispiel #3
0
        private void insertNoFleets()
        {
            ItemsTableLine line = new ItemsTableLine();
            ItemsTableText item = new ItemsTableText(info.getContent("battle_noFleets"), "resource");

            item.ColumnSpan = 4;
            line.add(item);
            _itemsTable.addLine(line);
        }
Beispiel #4
0
 public void addLine(ItemsTableLine line)
 {
     line.Index = ++_index;
     Controls.Add(line);
     foreach (ItemsTableItem item in line.Controls)
     {
         item.Index = line.Index;
     }
 }
Beispiel #5
0
 private void addLine( string text, int span, string css )
 {
     ItemsTableLine line = new ItemsTableLine();
     ItemsTableText l = new ItemsTableText( text , "resource" );
     if( css != null ) {
         l.CssClass += " " + css;
     }
     l.ColumnSpan = span;
     line.add( l );
     itemsTable.addLine( line );
 }
Beispiel #6
0
        /// <summary>
        /// preenche o título
        /// </summary>
        private void createTitle(ItemsTable _itemsTable)
        {
            ItemsTableLine line = new ItemsTableLine();

            line.add(new ItemsTableText(info.getContent("section_fleet"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("coordenada"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("conquerplanet_ruler"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("battle_startBattle"), "resourceTitle"));
            _itemsTable.HeaderItem = line;
            //_itemsTable.TableTitleCssClass = "resourceTitle";
        }
Beispiel #7
0
        /// <summary>
        /// preenche o título
        /// </summary>
        private void createTitle(ItemsTable itemsTable)
        {
            ItemsTableLine line = new ItemsTableLine();

            line.add(new ItemsTableText(info.getContent("fleet_fleetToMove"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("coordenada"), "resourceTitle"));
            line.add(new ItemsTableText(info.getContent("fleet_moveFleet"), "resourceTitle"));

            itemsTable.HeaderItem         = line;
            itemsTable.TableTitleCssClass = "resourceTitle";
        }
Beispiel #8
0
        /// <summary>
        /// escreve uma linha de Items
        /// </summary>
        private void writeItemsLine(HtmlTextWriter writer, ItemsTableLine item)
        {
            writer.WriteLine("<tr>");
            foreach (ItemsTableItem i in item.Controls)
            {
                //writer.WriteLine( "<td class='resource' align='center' >" );
                i.RenderControl(writer);
                //writer.WriteLine( "</td>" );
            }

            writer.WriteLine("</tr>");
        }
Beispiel #9
0
        private void addLine(string text, int span, string css)
        {
            ItemsTableLine line = new ItemsTableLine();
            ItemsTableText l    = new ItemsTableText(text, "resource");

            if (css != null)
            {
                l.CssClass += " " + css;
            }
            l.ColumnSpan = span;
            line.add(l);
            itemsTable.addLine(line);
        }
Beispiel #10
0
        /// <summary>
        /// Criar a tabela com as naves e o
        /// </summary>
        private void createTable()
        {
            itemsTable.Title         = info.getContent("fleet_moveFleet");
            itemsTable.TitleCssClass = "planetInfoZoneTitle";
            itemsTable.TableCssClass = "planetFrame";

            createTitle(itemsTable);

            bool hasResults = false;

            if (travel.IsTravelAvailable)
            {
                foreach (string fleet in getMoveableFleets())
                {
                    ItemsTableLine line = new ItemsTableLine();

                    ItemsTableText fleetName = new ItemsTableText(fleet, "resource");

                    ItemsTableText coord = new ItemsTableText(_ruler.getFleet(fleet).Coordinate.ToString(), "resource");

                    ItemsTableImageButton moveFleet = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("move.gif"), "move_" + _ruler.getFleet(fleet).Id.ToString());
                    moveFleet.Click += new ImageClickEventHandler(moveFleet_Click);

                    line.add(fleetName);
                    line.add(coord);
                    line.add(moveFleet);

                    itemsTable.addLine(line);

                    hasResults = true;
                }

                if (!hasResults)
                {
                    addLine(info.getContent("fleet_noFleetsToMove"), 3);
                    travel.Visible = false;
                }
                else
                {
                    addLine(info.getContent("fleet_help"), 3);
                }
            }
            else
            {
                travel.Visible = false;
                addLine(info.getContent("fleet_moveNotAvailable"), 3);
            }
        }
Beispiel #11
0
        public void removeLine(ItemsTableLine l)
        {
            l.preRemove();
            Controls.Remove(l);
            int i = 0;

            foreach (ItemsTableLine line in Controls)
            {
                if (line.Index != i)
                {
                    line.Index = i;
                    foreach (ItemsTableItem item in line.Controls)
                    {
                        item.Index = i;
                    }
                }
                ++i;
            }
        }
Beispiel #12
0
        /// <summary>
        /// Criar a tabela com as naves e o 
        /// </summary>
        private void createTable()
        {
            itemsTable.Title = info.getContent("fleet_moveFleet");
            itemsTable.TitleCssClass = "planetInfoZoneTitle";
            itemsTable.TableCssClass = "planetFrame";

            createTitle( itemsTable );

            bool hasResults = false;

            if( travel.IsTravelAvailable ) {
                foreach( string fleet in getMoveableFleets() ) {

                    ItemsTableLine line = new ItemsTableLine();

                    ItemsTableText fleetName = new ItemsTableText( fleet , "resource" );

                    ItemsTableText coord = new ItemsTableText( _ruler.getFleet(fleet).Coordinate.ToString() , "resource" );

                    ItemsTableImageButton moveFleet = new ItemsTableImageButton( OrionGlobals.getCommonImagePath("move.gif"), "move_" +  _ruler.getFleet( fleet ).Id.ToString()  );
                    moveFleet.Click += new ImageClickEventHandler(moveFleet_Click);

                    line.add( fleetName );
                    line.add( coord );
                    line.add( moveFleet );

                    itemsTable.addLine( line );

                    hasResults = true;
                }

                if( !hasResults ) {
                    addLine( info.getContent("fleet_noFleetsToMove"), 3 );
                    travel.Visible = false;
                } else {
                    addLine( info.getContent( "fleet_help" ), 3 );
                }
            }else{
                travel.Visible= false;
                addLine( info.getContent( "fleet_moveNotAvailable" ), 3 );
            }
        }
Beispiel #13
0
        /// <summary>
        /// actualiza a tabela depois de um click
        /// </summary>
        private void updateTable()
        {
            string name = _itemsTable.getSpecificText(_itemsTable.SelectedIndex, 0);

            IEnumerator iter = _itemsTable.Controls.GetEnumerator();

            while (iter.MoveNext())
            {
                ItemsTableLine line = (ItemsTableLine)iter.Current;
                string         str  = ((ItemsTableItem)line.Controls[0]).Item;
                if (str == name)
                {
                    _itemsTable.removeLine(line);
                    iter = _itemsTable.Controls.GetEnumerator();
                }
            }

            if (_itemsTable.Count == 0)
            {
                noResults();
            }
        }
Beispiel #14
0
        /// <summary>
        /// actualiza a tabela depois de um click
        /// </summary>
        private void updateTable()
        {
            string fleetName = itemsTable.getSpecificText(itemsTable.SelectedIndex, 0);

            IEnumerator iter = itemsTable.Controls.GetEnumerator();

            while (iter.MoveNext())
            {
                ItemsTableLine line = (ItemsTableLine)iter.Current;
                string         str  = ((ItemsTableItem)line.Controls[0]).Item;
                if (str == fleetName)
                {
                    itemsTable.removeLine(line);
                    iter = itemsTable.Controls.GetEnumerator();
                }
            }

            if (itemsTable.Count == 0)
            {
                addLine(info.getContent("fleet_noFleetsToMove"), 3);
                travel.Visible = false;
            }
        }
Beispiel #15
0
 /// <summary>
 /// preenche o título
 /// </summary>
 private void createTitle( ItemsTable _itemsTable )
 {
     ItemsTableLine line = new ItemsTableLine();
     line.add( new ItemsTableText( info.getContent("section_fleet"), "resourceTitle" ) );
     line.add( new ItemsTableText( info.getContent("coordenada"), "resourceTitle" ) );
     line.add( new ItemsTableText( info.getContent("conquerplanet_ruler"), "resourceTitle" ) );
     line.add( new ItemsTableText( info.getContent("battle_startBattle"), "resourceTitle" ) );
     _itemsTable.HeaderItem = line;
     //_itemsTable.TableTitleCssClass = "resourceTitle";
 }
Beispiel #16
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();
            }
        }
Beispiel #17
0
        /// <summary>
        ///
        /// </summary>
        private ItemsTable CreateBattles()
        {
            ICollection battles = ruler.GetAllBattles(type);

            ItemsTable _itemsTable = new ItemsTable();

            if (TitleRef == null)
            {
                _itemsTable.Title = info.getContent("currentBattle_title");
            }
            else
            {
                _itemsTable.Title = info.getContent(TitleRef);
            }

            _itemsTable.TitleCssClass = "planetInfoZoneTitle";
            _itemsTable.TableCssClass = "planetFrame";

            createTitle(_itemsTable);

            if (battles != null && battles.Count > 0)
            {
                string onlineImage  = OrionGlobals.getCommonImagePath("online.gif");
                string offlineImage = OrionGlobals.getCommonImagePath("offline.gif");

                IEnumerator iter = battles.GetEnumerator( );
                while (iter.MoveNext())
                {
                    SimpleBattleInfo battleInfo = iter.Current as SimpleBattleInfo;

                    if (null == battleInfo)
                    {
                        continue;
                    }

                    if (!battleInfo.Accepted)
                    {
                        continue;
                    }

                    ItemsTableLine line = new ItemsTableLine();

                    ItemsTableText turn = new ItemsTableText(battleInfo.CurrentTurn.ToString(  ), "resource");

                    ItemsTableText opponent = new ItemsTableText(OrionGlobals.getLink(battleInfo.Enemy), "resource");

                    string onlineState;

                    // indicar se o utilizador está online
                    if (OrionGlobals.isUserOnline(battleInfo.Enemy.ForeignId))
                    {
                        onlineState = string.Format("<img src='{0}' />", onlineImage);
                    }
                    else
                    {
                        onlineState = string.Format("<img src='{0}' />", offlineImage);
                    }

                    ItemsTableText opponentStatus = new ItemsTableText(onlineState, "resource");

                    ItemsTableText battleType = new ItemsTableText(info.getContent(battleInfo.Type), "resource");

                    ItemsTableItem status;
                    string         rulerTurn;
                    if (battleInfo.IsPositionTime)
                    {
                        rulerTurn = info.getContent("currentBattle_rulerPosition");
                    }
                    else
                    {
                        if (battleInfo.IsTurn)
                        {
                            if (battleInfo.EnemyIsPositionTime)
                            {
                                rulerTurn = info.getContent("currentBattle_enemyPositioning");
                            }
                            else
                            {
                                rulerTurn = info.getContent("currentBattle_rulerTurn");
                            }
                        }
                        else
                        {
                            rulerTurn = info.getContent("currentBattle_enemyTurn");
                        }
                    }

                    status = new ItemsTableLink(
                        rulerTurn,
                        OrionGlobals.calculatePath("battle.aspx?id=" + battleInfo.BattleId),
                        "resource"
                        );

                    ItemsTableText timeLeft = new ItemsTableText(modifyTime(battleInfo.TurnsLeft.ToString()), "resource");

                    ItemsTableText coordPlanet = null;
                    if (type == Chronos.Battle.BattleType.BATTLE)
                    {
                        if (battleInfo.IsPlanet)
                        {
                            Planet p = Universe.instance.getPlanet(battleInfo.Coordinate);
                            coordPlanet = new ItemsTableText(getPlanetLink(p), "resource");
                        }
                        else
                        {
                            coordPlanet = new ItemsTableText(battleInfo.Coordinate.ToString(), "resource");
                        }
                    }

                    ItemsTableText timeout = new ItemsTableText(battleInfo.MissedTurns.ToString(), "resource");

                    line.add(turn);
                    line.add(opponent);
                    line.add(opponentStatus);
                    line.add(battleType);
                    line.add(status);
                    line.add(timeout);

                    if (type == Chronos.Battle.BattleType.BATTLE)
                    {
                        line.add(coordPlanet);
                    }

                    line.add(timeLeft);
                    _itemsTable.addLine(line);
                }
            }


            if (!_itemsTable.HasControls())
            {
                ItemsTableLine line = new ItemsTableLine();
                ItemsTableText txt  = new ItemsTableText(info.getContent("currentBattle_noBattles"), "resource");

                if (type == Chronos.Battle.BattleType.BATTLE)
                {
                    txt.ColumnSpan = 8;
                }
                else
                {
                    txt.ColumnSpan = 7;
                }

                line.add(txt);
                _itemsTable.addLine(line);
            }

            return(_itemsTable);
        }
Beispiel #18
0
 public void addLine( ItemsTableLine line )
 {
     line.Index = ++_index;
     Controls.Add( line );
     foreach( ItemsTableItem item in line.Controls ) {
         item.Index = line.Index;
     }
 }
Beispiel #19
0
        /// <summary>
        /// escreve uma linha de Items
        /// </summary>
        private void writeItemsLine( HtmlTextWriter writer, ItemsTableLine item )
        {
            writer.WriteLine("<tr>");
            foreach( ItemsTableItem i in item.Controls ) {
                //writer.WriteLine( "<td class='resource' align='center' >" );
                i.RenderControl( writer );
                //writer.WriteLine( "</td>" );
            }

            writer.WriteLine("</tr>");
        }
Beispiel #20
0
 public void removeLine( ItemsTableLine l )
 {
     l.preRemove();
     Controls.Remove( l );
     int i = 0;
     foreach( ItemsTableLine line in Controls ) {
         if( line.Index != i ) {
             line.Index = i;
             foreach( ItemsTableItem item in line.Controls ) {
                 item.Index = i;
             }
         }
         ++i;
     }
 }
Beispiel #21
0
        private void CreateFleets()
        {
            Hashtable universeFleets = _ruler.UniverseFleets;

            _itemsTable.Title         = info.getContent("battle_fleetsReadyToBattle");
            _itemsTable.TitleCssClass = "planetInfoZoneTitle";
            _itemsTable.TableCssClass = "planetFrame";

            createTitle(_itemsTable);
            bool isOneReady = false;

            if (universeFleets != null && universeFleets.Count > 0)
            {
                IDictionaryEnumerator iter = universeFleets.GetEnumerator();

                while (iter.MoveNext())
                {
                    Chronos.Core.Fleet f = (Chronos.Core.Fleet)iter.Value;
                    Planet             p = Universe.instance.getPlanet(f.Coordinate);

                    if (f.GoodForBattle)
                    {
                        ItemsTableLine line = new ItemsTableLine();

                        ItemsTableText fleet = new ItemsTableText(f.Name, "resource");
                        ItemsTableText coord = new ItemsTableText(f.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");
                        }

                        ItemsTableItem action;

                        if (p.IsInBattle)
                        {
                            action = new ItemsTableText(info.getContent("battle_isInBattle"), "resource");
                        }
                        else
                        {
                            if (p.HasImmunity)
                            {
                                action = new ItemsTableText(string.Format(info.getContent("BattleImmunity"), p.Immunity), "resource");
                            }
                            else
                            {
                                if (p.Owner != null && Ruler.IsSameAlliance((Ruler)p.Owner, (Ruler)f.Owner))
                                {
                                    action = new ItemsTableText(info.getContent("battle_sameAlliance"), "resource");
                                }
                                else
                                {
                                    if (!p.HasProtection)
                                    {
                                        action = new ItemsTableText(info.getContent("planet_not_protected"), "resource");
                                    }
                                    else
                                    {
                                        action = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("ok.gif"), fleet.ID);
                                        ((ItemsTableImageButton)action).Click += new ImageClickEventHandler(submit_Click);
                                    }
                                }
                            }
                        }

                        line.add(fleet);
                        line.add(coord);
                        line.add(rulerName);
                        line.add(action);

                        _itemsTable.addLine(line);

                        isOneReady = true;
                    }
                }
            }

            if (!isOneReady)
            {
                insertNoFleets();
            }
        }
Beispiel #22
0
        /// <summary>
        /// preenche o título
        /// </summary>
        private void createTitle( ItemsTable itemsTable )
        {
            ItemsTableLine line = new ItemsTableLine();

            line.add( new ItemsTableText( info.getContent("fleet_fleetToMove"), "resourceTitle" ) );
            line.add( new ItemsTableText( info.getContent("coordenada"), "resourceTitle" ) );
            line.add( new ItemsTableText( info.getContent("fleet_moveFleet"), "resourceTitle" ) );

            itemsTable.HeaderItem = line;
            itemsTable.TableTitleCssClass = "resourceTitle";
        }
Beispiel #23
0
 private void noResults()
 {
     ItemsTableLine line = new ItemsTableLine();
     ItemsTableText txt = new ItemsTableText( info.getContent("conquerplanet_noPlanet"), "resource" );
     txt.ColumnSpan = 6;
     line.add( txt );
     _itemsTable.addLine( line );
 }
Beispiel #24
0
        /// <summary>
        ///
        /// </summary>
        private ItemsTable CreateBattles()
        {
            ICollection battles = ruler.GetAllBattles( type );

            ItemsTable _itemsTable = new ItemsTable();

            if( TitleRef == null ) {
                _itemsTable.Title = info.getContent("currentBattle_title");
            }else {
                _itemsTable.Title = info.getContent(TitleRef);
            }

            _itemsTable.TitleCssClass = "planetInfoZoneTitle";
            _itemsTable.TableCssClass = "planetFrame";

            createTitle( _itemsTable );

            if( battles != null && battles.Count > 0 ) {

                string onlineImage = OrionGlobals.getCommonImagePath("online.gif");
                string offlineImage = OrionGlobals.getCommonImagePath("offline.gif");

                IEnumerator iter = battles.GetEnumerator( );
                while( iter.MoveNext() ) {
                    SimpleBattleInfo battleInfo = iter.Current as SimpleBattleInfo;

                    if( null == battleInfo)
                        continue;

                    if( !battleInfo.Accepted ) {
                        continue;
                    }

                    ItemsTableLine line = new ItemsTableLine();

                    ItemsTableText turn = new ItemsTableText( battleInfo.CurrentTurn.ToString(  ), "resource" );

                    ItemsTableText opponent = new ItemsTableText( OrionGlobals.getLink( battleInfo.Enemy ) , "resource" );

                    string onlineState;

                    // indicar se o utilizador está online
                    if( OrionGlobals.isUserOnline(battleInfo.Enemy.ForeignId) ) {
                        onlineState = string.Format("<img src='{0}' />", onlineImage);
                    } else {
                        onlineState = string.Format("<img src='{0}' />", offlineImage);
                    }

                    ItemsTableText opponentStatus = new ItemsTableText( onlineState , "resource" );

                    ItemsTableText battleType = new ItemsTableText( info.getContent(battleInfo.Type) , "resource" );

                    ItemsTableItem status;
                    string rulerTurn;
                    if( battleInfo.IsPositionTime ) {
                        rulerTurn = info.getContent("currentBattle_rulerPosition");
                    }else {
                        if( battleInfo.IsTurn ) {
                            if( battleInfo.EnemyIsPositionTime ) {
                                rulerTurn = info.getContent("currentBattle_enemyPositioning");
                            }else {
                                rulerTurn = info.getContent("currentBattle_rulerTurn");
                            }
                        }else{
                            rulerTurn = info.getContent("currentBattle_enemyTurn");
                        }
                    }

                    status = new ItemsTableLink(
                        rulerTurn,
                        OrionGlobals.calculatePath( "battle.aspx?id=" + battleInfo.BattleId ),
                        "resource"
                    );

                    ItemsTableText timeLeft = new ItemsTableText( modifyTime(battleInfo.TurnsLeft.ToString()) , "resource" );

                    ItemsTableText coordPlanet = null;
                    if( type == Chronos.Battle.BattleType.BATTLE ) {
                        if( battleInfo.IsPlanet  ) {
                            Planet p = Universe.instance.getPlanet( battleInfo.Coordinate );
                            coordPlanet = new ItemsTableText( getPlanetLink( p ), "resource" );
                        } else {
                            coordPlanet = new ItemsTableText( battleInfo.Coordinate.ToString(), "resource" );
                        }
                    }

                    ItemsTableText timeout = new ItemsTableText( battleInfo.MissedTurns.ToString() , "resource" );

                    line.add( turn );
                    line.add( opponent );
                    line.add( opponentStatus );
                    line.add( battleType );
                    line.add( status );
                    line.add( timeout );

                    if( type == Chronos.Battle.BattleType.BATTLE ) {
                        line.add( coordPlanet );
                    }

                    line.add( timeLeft );
                    _itemsTable.addLine( line );
                }
            }

            if( !_itemsTable.HasControls() ) {
                ItemsTableLine line = new ItemsTableLine();
                ItemsTableText txt = new ItemsTableText( info.getContent("currentBattle_noBattles"), "resource" );

                if( type == Chronos.Battle.BattleType.BATTLE ) {
                    txt.ColumnSpan = 8;
                }else {
                    txt.ColumnSpan = 7;
                }

                line.add( txt );
                _itemsTable.addLine( line );
            }

            return _itemsTable;
        }
Beispiel #25
0
        private void createTitle( ItemsTable _itemsTable )
        {
            ItemsTableLine line = new ItemsTableLine();
            line.add( new ItemsTableText( info.getContent("currentBattle_turn"), "resourceTitle" ) );
            line.add( new ItemsTableText( info.getContent("currentBattle_opponent"), "resourceTitle" ) );
            line.add( new ItemsTableText( info.getContent("online"), "resourceTitle" ) );
            line.add( new ItemsTableText( info.getContent("battle_type"), "resourceTitle" ) );
            line.add( new ItemsTableText( info.getContent("currentBattle_status"), "resourceTitle" ) );
            line.add( new ItemsTableText( info.getContent("currentBattle_timeout"), "resourceTitle" ) );

            if( type == Chronos.Battle.BattleType.BATTLE ) {
                line.add( new ItemsTableText( info.getContent("currentBattle_location"), "resourceTitle" ) );
            }

            ItemsTableText timeLeft = new ItemsTableText( info.getContent("currentBattle_timeLeft"), "resourceTitle" );
            timeLeft.Width = "150px";
            line.add( timeLeft );

            _itemsTable.HeaderItem = line;
            _itemsTable.TableTitleCssClass = "resourceTitle";
        }
Beispiel #26
0
        private void CreateFleets()
        {
            Hashtable universeFleets = _ruler.UniverseFleets;

            _itemsTable.Title = info.getContent("battle_fleetsReadyToBattle");
            _itemsTable.TitleCssClass = "planetInfoZoneTitle";
            _itemsTable.TableCssClass = "planetFrame";

            createTitle( _itemsTable );
            bool isOneReady = false;

            if( universeFleets != null && universeFleets.Count > 0 ) {
                IDictionaryEnumerator iter = universeFleets.GetEnumerator();

                while( iter.MoveNext() ){
                    Chronos.Core.Fleet f = (Chronos.Core.Fleet)iter.Value;
                    Planet p = Universe.instance.getPlanet(f.Coordinate);

                    if( f.GoodForBattle ) {
                        ItemsTableLine line = new ItemsTableLine();

                        ItemsTableText fleet = new ItemsTableText( f.Name, "resource" );
                        ItemsTableText coord = new ItemsTableText( f.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" );
                        }

                        ItemsTableItem action;

                        if( p.IsInBattle ) {
                            action = new ItemsTableText( info.getContent( "battle_isInBattle" ), "resource" );
                        } else {
                            if( p.HasImmunity ) {
                                action = new ItemsTableText( string.Format( info.getContent("BattleImmunity"), p.Immunity), "resource" );
                            }else{
                                if( p.Owner != null && Ruler.IsSameAlliance( (Ruler)p.Owner, (Ruler)f.Owner) ) {
                                    action = new ItemsTableText( info.getContent("battle_sameAlliance"), "resource" );
                                }else{
                                    if( !p.HasProtection ) {
                                        action = new ItemsTableText( info.getContent("planet_not_protected"), "resource" );
                                    }else{
                                        action = new ItemsTableImageButton( OrionGlobals.getCommonImagePath("ok.gif"), fleet.ID );
                                        ((ItemsTableImageButton)action).Click += new ImageClickEventHandler( submit_Click );
                                    }
                                }
                            }
                        }

                        line.add( fleet );
                        line.add( coord );
                        line.add( rulerName );
                        line.add( action );

                        _itemsTable.addLine( line );

                        isOneReady = true;
                    }
                }
            }

            if( !isOneReady ) {
                insertNoFleets();
            }
        }
Beispiel #27
0
 private void insertNoFleets()
 {
     ItemsTableLine line = new ItemsTableLine();
     ItemsTableText item = new ItemsTableText( info.getContent("battle_noFleets"), "resource" );
     item.ColumnSpan = 4;
     line.add( item );
     _itemsTable.addLine( line );
 }
Beispiel #28
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();
            }
        }