private void FillBattle(Ruler ruler, ItemsTable table, string tableTitle, Chronos.Battle.BattleType type) { table.Title = tableTitle; table.TitleCssClass = "planetInfoZoneTitle"; table.TableCssClass = "planetFrame"; CreateTitle(table); if (ruler == null) { NoBattle(table, 6); return; } ICollection collection = ruler.GetAllBattles(type); if (collection.Count == 0) { NoBattle(table, 6); return; } IEnumerator iter = collection.GetEnumerator( ); while (iter.MoveNext( )) { ItemsTableLine line = new ItemsTableLine(); SimpleBattleInfo bInfo = (SimpleBattleInfo)iter.Current; ItemsTableText id = new ItemsTableText(bInfo.BattleId.ToString(), "resource"); ItemsTableText enemy = new ItemsTableText(OrionGlobals.getLink(bInfo.Enemy), "resource"); ItemsTableLink link = new ItemsTableLink( info.getContent("battleAdminUser_viewBattle"), OrionGlobals.calculatePath(string.Format("battle.aspx?id={0}&rulerid={1}", bInfo.BattleId, ruler.Id)), "resource" ); ItemsTableLinkButton linkButton1 = new ItemsTableLinkButton(bInfo.Owner.Name); linkButton1.Click += new EventHandler(linkButton1_Click); ItemsTableLinkButton linkButton2 = new ItemsTableLinkButton(bInfo.Enemy.Name); linkButton2.Click += new EventHandler(linkButton2_Click); ItemsTableImageButton remove = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("remove.gif"), "battle_" + bInfo.BattleId); remove.Click += new ImageClickEventHandler(remove_Click); line.add(id); line.add(enemy); line.add(link); line.add(linkButton1); line.add(linkButton2); line.add(remove); table.addLine(line); } this.Controls.Add(table); }
private void NoBattle(ItemsTable table, int span) { ItemsTableLine line = new ItemsTableLine(); ItemsTableText text = new ItemsTableText(info.getContent("currentBattle_noBattles"), "resource"); text.ColumnSpan = span; line.add(text); table.addLine(line); }
private void CreateUnits(ItemsTable itemsTable, string tableTitle, string type, string title) { itemsTable.Title = info.getContent(tableTitle); itemsTable.TitleCssClass = "planetInfoZoneTitle"; itemsTable.TableCssClass = "planetFrame"; createTitle(itemsTable, title); ArrayList unitsAvailable = new ArrayList(); foreach (string res in units.Keys) { Resource r = Universe.getFactory("planet", "Unit", res).create( ); if (r.Unit.UnitType.ToLower() != type) { continue; } unitsAvailable.Add(res); ItemsTableLine line = new ItemsTableLine(); ItemsTableImage image = new ItemsTableImage(OrionGlobals.getCommonImagePath(res.ToLower() + ".gif")); image.Height = "30px"; image.Width = "30px"; image.CssClass = "resource"; ItemsTableText name = new ItemsTableText(info.getContent(res), "resource"); ItemsTableTextBox quant = new ItemsTableTextBox(); line.add(image); line.add(name); line.add(quant); itemsTable.addLine(line); } if (itemsTable.Count == 0) { Information.AddInformation(info.getContent("battle_noUnits")); } else { allUnits[type] = unitsAvailable; } }
private void CreateUnits() { itemsTable.Title = info.getContent("cancelBattle_acceptReject"); itemsTable.TitleCssClass = "planetInfoZoneTitle"; itemsTable.TableCssClass = "planetFrame"; createTitle(itemsTable); ICollection battles = _ruler.GetAllBattles(BattleType.FRIENDLY); foreach (SimpleBattleInfo battleInfo in battles) { if (battleInfo.Accepted) { continue; } ItemsTableLine line = new ItemsTableLine(); ItemsTableText id = new ItemsTableText(battleInfo.BattleId.ToString(), "resource"); ItemsTableText ruler = new ItemsTableText(OrionGlobals.getLink(battleInfo.Enemy), "resource"); ItemsTableLink view = new ItemsTableLink( info.getContent("currentBattle_viewBattle"), OrionGlobals.calculatePath("battle.aspx?id=" + battleInfo.BattleId), "resource" ); ItemsTableImageButton accept = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("ok.gif"), "accept_" + battleInfo.BattleId); accept.Click += new ImageClickEventHandler(Accept_Click); ItemsTableImageButton reject = new ItemsTableImageButton(OrionGlobals.getCommonImagePath("remove.gif"), "reject_" + battleInfo.BattleId); reject.Click += new ImageClickEventHandler(Reject_Click); line.add(id); line.add(ruler); line.add(view); line.add(accept); line.add(reject); itemsTable.addLine(line); } }
private void CreateUnits( ItemsTable itemsTable, string tableTitle, string type, string title ) { itemsTable.Title = info.getContent(tableTitle); itemsTable.TitleCssClass = "planetInfoZoneTitle"; itemsTable.TableCssClass = "planetFrame"; createTitle( itemsTable, title ); ArrayList unitsAvailable = new ArrayList(); foreach( string res in units.Keys ) { Resource r = Universe.getFactory("planet", "Unit", res).create( ); if( r.Unit.UnitType.ToLower() != type ) { continue; } unitsAvailable.Add( res ); ItemsTableLine line = new ItemsTableLine(); ItemsTableImage image = new ItemsTableImage( OrionGlobals.getCommonImagePath( res.ToLower()+".gif") ); image.Height = "30px"; image.Width = "30px"; image.CssClass = "resource"; ItemsTableText name = new ItemsTableText( info.getContent(res), "resource" ); ItemsTableTextBox quant = new ItemsTableTextBox(); line.add( image ); line.add( name ); line.add( quant ); itemsTable.addLine( line ); } if( itemsTable.Count == 0 ) { Information.AddInformation(info.getContent("battle_noUnits")); }else { allUnits[type] = unitsAvailable; } }
private void FillBattle( Ruler ruler, ItemsTable table, string tableTitle, Chronos.Battle.BattleType type ) { table.Title = tableTitle; table.TitleCssClass = "planetInfoZoneTitle"; table.TableCssClass = "planetFrame"; CreateTitle(table); if( ruler == null ) { NoBattle( table, 6 ); return; } ICollection collection = ruler.GetAllBattles( type ); if( collection.Count == 0 ) { NoBattle( table, 6 ); return; } IEnumerator iter = collection.GetEnumerator( ); while( iter.MoveNext( ) ) { ItemsTableLine line = new ItemsTableLine(); SimpleBattleInfo bInfo = (SimpleBattleInfo)iter.Current; ItemsTableText id = new ItemsTableText( bInfo.BattleId.ToString(), "resource" ); ItemsTableText enemy = new ItemsTableText( OrionGlobals.getLink( bInfo.Enemy ), "resource" ); ItemsTableLink link = new ItemsTableLink( info.getContent( "battleAdminUser_viewBattle" ), OrionGlobals.calculatePath( string.Format("battle.aspx?id={0}&rulerid={1}",bInfo.BattleId,ruler.Id) ), "resource" ); ItemsTableLinkButton linkButton1 = new ItemsTableLinkButton( bInfo.Owner.Name ); linkButton1.Click += new EventHandler(linkButton1_Click); ItemsTableLinkButton linkButton2 = new ItemsTableLinkButton( bInfo.Enemy.Name ); linkButton2.Click += new EventHandler(linkButton2_Click); ItemsTableImageButton remove = new ItemsTableImageButton( OrionGlobals.getCommonImagePath( "remove.gif" ), "battle_" + bInfo.BattleId ); remove.Click += new ImageClickEventHandler(remove_Click); line.add( id ); line.add( enemy ); line.add( link ); line.add( linkButton1 ); line.add( linkButton2 ); line.add( remove ); table.addLine( line ); } this.Controls.Add( table ); }
private void NoBattle( ItemsTable table, int span ) { ItemsTableLine line = new ItemsTableLine(); ItemsTableText text = new ItemsTableText(info.getContent("currentBattle_noBattles"),"resource"); text.ColumnSpan = span; line.add( text ); table.addLine( line ); }