Exemplo n.º 1
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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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;
        }
Exemplo n.º 5
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);
        }