/// <summary>Escreve informações sobre a Cache</summary> private void writeCacheInfo(HtmlTextWriter writer, ILanguageInfo info) { writer.WriteLine("<div class='stats-box'>"); writer.WriteLine("<div align='center'><b>" + info.getContent("stats_cache_title") + "</b></div>"); writer.WriteLine(info.getContent("stats_cache_count") + " <b>" + Page.Cache.Count + "</b><br />"); writer.WriteLine("<b>" + info.getContent("stats_cache_content") + "</b><br />"); writer.WriteLine("<table class='stats_cache_items' >"); foreach (DictionaryEntry item in Page.Cache) { if (item.Key.ToString().StartsWith("@@")) { continue; } writer.WriteLine("<tr>"); writer.WriteLine("<td>{0}</td>", item.Key.ToString()); writer.WriteLine("<td>{0}</td>", item.Value.ToString()); writer.WriteLine("<td><a href='javascript:{1}'><img src='{0}' /></a></td>", OrionGlobals.getCommonImagePath("remove.gif"), "deleteCache(\"" + item.Key.ToString() + "\")" ); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); writer.WriteLine("</div>"); }
/// <summary>Escreve um planeta</summary> private void writePlanet(Chronos.Core.Planet planet) { MasterSkinInfo masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"]; string control = OrionGlobals.AppPath + masterSkinInfo.masterSkinName + "/controls/" + controlToLoad; Control planetPage = Page.LoadControl(control); Image img = (Image)planetPage.FindControl("img"); if (img != null) { img.ImageUrl = OrionGlobals.getCommonImagePath("planets/" + planet.Info.Id + ".jpg"); img.EnableViewState = false; } ResourcesList resources = (ResourcesList)planetPage.FindControl("resourcesList"); if (resources != null) { resources.Manager = planet; resources.Title = info.getContent("planetResources"); resources.Category = "Intrinsic"; resources.ShowImages = true; resources.ShowOnlyQuantity = false; resources.ShowZeroQuantity = true; resources.ShowDocumentation = false; } writeGeneral(planet, planetPage); Controls.Add(planetPage); }
/// <summary>Escreve um QueueItem</summary> private void writeItem(int idx, int order, QueueItem item, HtmlTextWriter writer, int turns, bool queue) { writer.WriteLine("<td class='resourceCell'><div align='center'>" + order + "</div></td>"); if (ShowDocumentation) { writer.WriteLine("<td class='resource'><a class='docs' href='{1}'>{0}</a></td>", info.getContent(item.FactoryName), Wiki.GetUrl(item.Factory.Category, item.Factory.Name) ); } else { writer.WriteLine("<td class='resource'>" + info.getContent(item.FactoryName) + "</td>"); } if (ShowQuantity) { writer.WriteLine("<td class='resourceCell'>" + item.Quantity + "</td>"); } if (!queue) { writer.WriteLine("<td class='resourceCell'>+ " + turns + "</td>"); } else { writer.WriteLine("<td class='resourceCell'>{0} (+{1})</td>", info.getContent("waiting"), turns); } string cross = OrionGlobals.getCommonImagePath("remove.gif"); string str = "<a href='javascript:dequeue(" + idx + ")'><img src='" + cross + "' /></a>"; writer.WriteLine("<td class='resourceManagement'>" + str + "</td>"); }
private void WriteShips(HtmlTextWriter writer, Chronos.Core.Fleet fleet) { foreach (DictionaryEntry ship in fleet.Ships) { string name = string.Empty, quant = string.Empty; if (ship.Key != null) { name = ship.Key.ToString(); } if (ship.Value != null) { quant = ship.Value.ToString(); } writer.WriteLine( @"<tr height='40'> <td width='80' align='center' class='borderTop'> <img src='{0}.gif' /> </td> <td width='120' align='center' class='borderTop'> {1} </td> <td width='200' align='center' class='borderTop smallPadding'> {2} </td> </tr>" , OrionGlobals.getCommonImagePath(name.ToLower()), quant, info.getContent(name) ); } }
/// <summary>Escreve o custo do recurso</summary> private void writeBuild(HtmlTextWriter writer, ResourceInfo resources, string res, bool canBuild) { if (AskBuildQuantity) { int quantity = GetBuildQuantity(resources, res); writer.Write("<td class='resourceManagement'>"); writer.Write("<input style='width:60px;' class='textbox' type='text' name='quantity{0}' id='quantity{0}' value='{1}' />", res, quantity ); writer.Write("</td>"); } writer.Write("<td class='resourceManagement'>"); writer.Write("<a href='javascript:build(\"{0}\", \"{1}\",{2},\"{3}\")'>", res, info.getContent(res), AskBuildQuantity?"-1":"1", ID); if (canBuild) { writer.Write("<img src='{0}'/>", OrionGlobals.getCommonImagePath("ok.gif")); } else { writer.Write("<img src='{0}'/>", OrionGlobals.getCommonImagePath("no.gif")); } writer.Write("</a>"); writer.Write("</td>"); }
/// <summary>Pinta um planeta</summary> private void writePlanet(HtmlTextWriter writer, Planet planet) { writer.WriteLine("<div class='planetInfoZoneTitle'>"); writer.WriteLine("<b>{0}</b> - {1}", planet.Name, planet.Coordinate); if (planet.HasImmunity) { writer.Write("- <b class='green'>{0}: {1} </b>", info.getContent("Immunity"), planet.Immunity); } if (planet.IsInBattle) { writer.Write("- <b class='red'>{0}</b>", info.getContent("PlanetInBattle")); } writer.WriteLine("</div>"); writer.WriteLine("<table class='planetFrame'>"); writer.WriteLine("<tr>"); writer.WriteLine("<td valign='top'>"); writer.WriteLine("<a href='{1}?id={2}'><img src='{0}' width='100' height='100'/>", OrionGlobals.getCommonImagePath("planets/" + planet.Info.Id + ".jpg"), OrionGlobals.getSectionBaseUrl("planet"), planet.Id ); writer.WriteLine("</td>"); writer.WriteLine("<td width='100%' valign='top'>"); writer.WriteLine("<table width='100%'>"); writeTitle(writer); writeContent(writer, planet); writer.WriteLine("</table>"); writer.WriteLine("</td>"); writer.WriteLine("<tr>"); writer.WriteLine("</table>"); }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { int count = 0; for (int i = OrionGlobals.RequestManager.List.Count - 1; i >= 0; --i, ++count) { OrionRequest request = (OrionRequest)OrionGlobals.RequestManager.List[i]; writer.Write("<div class='history'><img src='{0}' /> ", OrionGlobals.getCommonImagePath("messages/" + request.Topic + ".gif")); writer.Write("<a href='{0}'>", request.Url); writer.Write(request.Caption); writer.Write("</a>"); writer.Write("</div>"); if (Controls.Count > 0) { foreach (Control control in Controls) { control.RenderControl(writer); } } if (count == Quantity) { break; } } }
private void WriteHeader(HtmlTextWriter writer, Chronos.Core.Fleet fleet) { writer.WriteLine("<table class='frame' width='400' cellpadding='0' cellspacing='0'><tr>"); writer.WriteLine( @"<td class='smallPadding' width='360'> <img src='{0}' onClick=" + "\"" + "show('fleet_{1}',this);\"" + @"/> <b><span class='fleetName'>{2}</b> </td> " , OrionGlobals.getCommonImagePath("plus.gif"), fleet.Id, GetFleetName(fleet) ); if (fleet.CanBeRemoved) { writer.WriteLine(@" <td align='left' width='40'> {0} </td> " , GetRemoveCode(fleet.Name)); } else { writer.WriteLine("<td></td>"); } }
/// <summary>Pinta o controlo</summary> protected override void Render(HtmlTextWriter writer) { if (null == Universe.instance.Rank || Universe.instance.Rank.Length == 0) { writer.WriteLine(info.getContent("no_rank_avalable")); return; } int count = Universe.instance.Rank.Length; if (count > 30) { count = 30; } Ruler current = getRulerSafe(); string onlineImage = OrionGlobals.getCommonImagePath("online.gif"); string offlineImage = OrionGlobals.getCommonImagePath("offline.gif"); writer.WriteLine("<div class='planetInfoZoneTitle'><b>" + info.getContent("top_3rulers") + "</b></div>"); int top = 3; if (top > Universe.instance.Rank.Length) { top = Universe.instance.Rank.Length; } RenderRulers(writer, 0, top, current, onlineImage, offlineImage, true); if (!ShowOnlyTopPlayers) { writer.WriteLine("<br/>"); if (Universe.instance.Rank.Length > 3) { writer.WriteLine("<div class='planetInfoZoneTitle'><b>" + info.getContent("top_rulers") + "</b></div>"); RenderRulers(writer, 3, count, current, onlineImage, offlineImage, false); } if (current != null && current.Rank > count) { writer.WriteLine("<div class='planetInfoZoneTitle'><b>" + string.Format(info.getContent("top_rulers_focus"), current.Name) + "</b></div>"); int start = current.Rank - 3; if (start <= count) { start = count + 1; } int end = current.Rank + 3; if (end > Universe.instance.Rank.Length) { end = Universe.instance.Rank.Length; } RenderRulers(writer, start - 1, end, current, onlineImage, offlineImage, false); } } }
/// <summary>Indica uma imagem com base num bool</summary> public static string YesNoImage(bool b) { string str = "no.gif"; if (b) { str = "yes.gif"; } return(OrionGlobals.getCommonImagePath(str)); }
/// <summary>Escreve o custo do recurso</summary> private void writeDemolish(HtmlTextWriter writer, string res, ResourceInfo resources) { writer.Write("<td class='resourceManagement'>"); if (resources.canTake(res, 1) && resources.getResourceCount(res) > 0) { writer.Write("<a href='javascript:demolish(\"{0}\", \"{1}\",\"{2}\")'>", res, info.getContent(res), ID); writer.Write("<img src='{0}'/>", OrionGlobals.getCommonImagePath("remove.gif")); writer.Write("</a>"); } writer.Write("</td>"); }
private string GetRemoveCode(string name) { return(string.Format(@" <a href='javascript:removeFleet({0})'> <img src='{1}' title='{2}' /> </a>" , "\"" + name + "\"", OrionGlobals.getCommonImagePath("remove.gif"), info.getContent("fleet_remove") )); }
/// <summary>Escreve este controlo em html</summary> protected override void Render(HtmlTextWriter writer) { Tournament tour = (Tournament)Universe.instance.PersistenceServices.GetState(Type); if (tour == null || tour.State != TournamentState.Subscriptions) { return; } writer.WriteLine("<img src='{0}' />", OrionGlobals.getCommonImagePath("yes.gif")); }
/// <summary>Escreve o título</summary> private void WriteTitle(HtmlTextWriter writer, IEnumerable resources) { writer.WriteLine("<tr class='resourceTitle'>"); writer.Write("<td class='resourceTitle'>{0}</td>", CultureModule.getContent("stats_planets")); foreach (string res in resources) { writer.Write("<td class='resourceTitle'>"); writer.Write("<img src='{0}.gif' title='{1}' alt='{1}'/>", OrionGlobals.getCommonImagePath("resources/" + res), CultureModule.getContent(res)); writer.Write("</td>"); } writer.WriteLine("</tr>"); }
/// <summary>Gera o cdigo dos relatrios de scan</summary> private void GenerateScanReport(StringWriter writer, Scan[] scans) { Ruler ruler = getRuler(); writer.Write("<tr class='resourceTitle'>"); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("turn_current")); if (ShowSourcePlanet) { writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("section_planet")); } writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("scan_target")); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("section_ruler")); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("scan_success")); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("scan_cloaked")); writer.Write("<td class='resourceTitle'>{0}</td>", info.getContent("scan_report")); writer.Write("</tr>"); foreach (Scan scan in scans) { writer.Write("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>"); writer.Write("<td class='resourceCell'>{0}</td>", scan.Turn); if (ShowSourcePlanet) { writer.Write("<td class='resourceCell'><a href='{0}default.aspx?id={2}'>{1}</a></td>", OrionGlobals.getSectionUrl("scan"), ruler.getPlanet(scan.SourcePlanetId).Name, scan.SourcePlanetId); } writer.Write("<td class='resourceCell'>{0}</td>", scan.Target.ToString()); if (scan.TargetPlanetOwner >= 0) { writer.Write("<td class='resourceCell'>{0}</td>", OrionGlobals.getLink(Universe.instance.getRuler(scan.TargetPlanetOwner))); } else { writer.Write("<td class='resourceCell'>{0}</td>", info.getContent("scan_inhabited")); } writer.Write("<td class='resourceCell'><img src='{0}' /></td>", OrionGlobals.YesNoImage(scan.Success)); writer.Write("<td class='resourceCell'><img src='{0}' /></td>", OrionGlobals.YesNoImage(!scan.Intercepted)); if (!scan.Success) { writer.Write("<td class='resourceCell'> </td>"); } else { writer.Write("<td class='resourceCell'><a href='scanreport.aspx?id={0}&scan={2}'><img src='{1}' /></a></td>", scan.SourcePlanetId, OrionGlobals.getCommonImagePath("Filter.gif"), scan.Id ); } writer.Write("</tr>"); } }
/// <summary>Escreve o nome de um planeta</summary> protected void WritePlanet(Planet planet, HtmlTextWriter writer, string targetSection) { writer.WriteLine("<td class='resourceManagement'><a href='{0}default.aspx?id={1}' title='{3}'>{2}</a>", OrionGlobals.getSectionUrl(targetSection), planet.Id, planet.Name, planet.ToString() ); if (planet.IsInBattle) { writer.WriteLine("<img src='{0}'/>", OrionGlobals.getCommonImagePath("messages/Battle.gif")); } writer.WriteLine("</td>"); }
private void planets_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item) { Control planetSkin = e.Item; Chronos.Core.Planet planet = (Chronos.Core.Planet)e.Item.DataItem; Image img = (Image)planetSkin.FindControl("img"); if (img != null) { img.ImageUrl = string.Format("{0}planets/{1}.jpg", OrionGlobals.getCommonImagePath(""), planet.Info.Id); } HyperLink planetLink = (HyperLink)planetSkin.FindControl("planetLink"); if (planetLink != null) { //planetLink.NavigateUrl = OrionGlobals.resolveBase("ruler/planets/planet/default.aspx?id=" + planet.Id); planetLink.NavigateUrl = OrionGlobals.getSectionUrl("planet") + "default.aspx?id=" + planet.Id; } HyperLink buildingsLink = (HyperLink)planetSkin.FindControl("buildingsLink"); if (buildingsLink != null) { buildingsLink.NavigateUrl = OrionGlobals.resolveBase("ruler/planets/planet/buildings.aspx?id=" + planet.Id); buildingsLink.Text = info.getContent("Building"); } Label name = (Label)planetSkin.FindControl("name"); if (name != null) { name.Text = planet.Name; } Label coordinate = (Label)planetSkin.FindControl("coordinate"); if (coordinate != null) { coordinate.Text = planet.Coordinate.ToString(); } Control resources = (Control)planetSkin.FindControl("resourcesPanel"); if (resources != null) { resources.Controls.Add(new ShowPlanetResources(planet)); } fillResourceType("Building", planetSkin, planet); } }
/// <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); } }
protected override void Render(HtmlTextWriter writer) { int r = RandomPicture; Page.RegisterHiddenField("imagesPath", OrionGlobals.getCommonImagePath("screenshots/")); writer.WriteLine("<table id='screenShotViewer' >"); writer.WriteLine("<tr><td>"); writer.WriteLine("<img id='currentPicture' src='{0}' />", OrionGlobals.getCommonImagePath("screenshots/" + r + ".png")); writer.WriteLine("</td></tr>"); writer.WriteLine("<th>"); writer.WriteLine("<span onClick='prevPicture()'> << </span>"); writer.WriteLine("<span id='currentPictureNumber'>{1}</span>/<span id='maxPicture'>{0}</span>", Max, r); writer.WriteLine("<span onClick='nextPicture()'> >> </span>"); writer.WriteLine("</th>"); writer.WriteLine("</table>"); }
/// <summary>Escreve o custo do recurso</summary> private bool WriteRareResourcesCost(HtmlTextWriter writer, ResourceInfo resources, string res) { bool canBuild = true; int amount = 0; string cost = null; bool available = false; foreach (string resourceCost in Universe.getFactories("planet", "Rare").Keys) { available = getResourceCost(resources, res, "Rare", resourceCost, out amount); if (amount > 0) { cost = resourceCost; break; } } string toolColor = null; if (available) { toolColor = "resourceCostCellSucceeded"; } else { canBuild = false; toolColor = "resourceCostCellFailed"; } writer.Write("<td class='{0}'>", toolColor); if (cost == null) { writer.Write(" "); } else { writer.WriteLine("<img src='{0}.gif' alt='{1}' title='{1}'/>", OrionGlobals.getCommonImagePath("resources/" + cost), info.getContent(cost)); } writer.Write("</td>"); return(canBuild); }
/// <summary>Escreve um item</summary> private void writeLine(ref StringBuilder allMessages, Message message, bool bold) { if (ShowImages) { allMessages.Append("<td class='resourceCell'>"); if (message.Info != null) { allMessages.Append(string.Format("<img src='{0}' />", OrionGlobals.getCommonImagePath("messages/" + message.Info.Category + ".gif")) ); } allMessages.Append("</td>"); } string line = string.Empty; try { allMessages.Append("<td class='resource'>"); line = info.getContent(message.Info.Name); if (bold) { allMessages.Append("<b>"); } allMessages.Append(message.Info.localize(message, line, new MessageDecorator(info))); if (bold) { allMessages.Append("</b>"); } allMessages.Append("</td>"); allMessages.Append("<td class='resourceCell'>"); allMessages.Append(message.Turn.ToString()); allMessages.Append("</td>"); } catch (Exception e) { Log.log("-------------- MESSAGE ERROR ------------"); Log.log(e); ExceptionLog.log(e); allMessages.Append("<span class='error'>[Error translating]</span> " + message.ToString()); } }
/// <summary>Mostra uma lista de notcias</summary> private void writeNews(HtmlTextWriter writer, NewsList list) { foreach (Entry entry in list.List) { writer.WriteLine("<div><span>{1}/{2}/{3}</span><br/>{0}</b></div>", entry.Title, entry.Issued.Day, entry.Issued.Month, entry.Issued.Year ); writer.WriteLine("<div>{0}</div>", entry.Content); writer.WriteLine("<hr noshade='noshade' size='1'/>"); } writer.WriteLine("<div align='center'><a href='{2}'>{1} <img src='{0}' /></a></div><br/>", OrionGlobals.getCommonImagePath("xml.gif"), CultureModule.getLanguage().getContent("news_feed"), OrionGlobals.resolveBase("rss.aspx") ); }
/// <summary> /// obtém o script que permite esconder/mostrar um elemento em javascript /// </summary> /// <returns></returns> public static void registerShowHideScript(System.Web.UI.Page page) { string script = @" <script language='javascript'> var imagePath = '" + OrionGlobals.getCommonImagePath("") + @"'; function show(id,img) { var obj = document.getElementById(id); if( 'none' != obj.style.display ) { obj.style.display = 'none'; img.src = imagePath + 'plus.gif'; } else { obj.style.display = 'inline'; img.src = imagePath + 'minus.gif'; } } </script> " ; page.RegisterClientScriptBlock("showhide", script); }
private void SubscriptionsViewer(HtmlTextWriter writer, Tournament tour) { if (Page.User.IsInRole("ruler")) { string register = "®ister=1"; if (Page.Request.RawUrl.IndexOf("®ister") >= 0) { register = string.Empty; } writer.WriteLine("<a href='{2}{3}'><img src='{0}' /> {1}</a>", OrionGlobals.getCommonImagePath("ok.gif"), CultureModule.getContent("tournament_register"), Page.Request.RawUrl, register); } #if DEBUG for (int i = 0; i < 100; ++i) { tour.Register(Universe.instance.CreateRuler("Zen " + i, "Zen" + i)); } #endif WriteRegistered(writer, tour); }
/// <summary>Escreve um item</summary> private bool writeLine(HtmlTextWriter writer, ResourceInfo resources, string res) { int count = resources.getResourceCount(res); if (!ShowZeroQuantity && count == 0) { return(false); } if (ShowImages) { string img = OrionGlobals.getCommonImagePath("resources/" + res + ".gif"); writer.WriteLine("<td class='resourceCell'><div align='center'><img src='{0}' title='{1}' alt='[{1}]'/></div></td>", img, info.getContent(res)); } if (ShowDocumentation) { writer.WriteLine("<td class='resourceManagement'><a class='docs' href='{1}?category={2}#{3}'>{0}</a></td>", info.getContent(res), OrionGlobals.getSectionBaseUrl("docs"), resources.Category, res ); } else { writer.WriteLine("<td class='resourceManagement'>" + info.getContent(res) + "</td>"); } if (!showOnlyQuantity) { writer.WriteLine("<td class='resourceCell'>{0}%</td>", getRatio(res)); writeCell(writer, res, getPerTurn(resources.Category, res), "", "+"); } if (ShowQuantity) { writeCell(writer, res, count, "", ""); } return(true); }
/// <summary>Escreve o title do custo</summary> private void writeTitleCost(HtmlTextWriter writer) { foreach (string cost in Cost) { string img = OrionGlobals.getCommonImagePath("resources/" + cost + ".gif"); writer.Write("<td class='resourceTitle'><img src='{0}'title='{1}' alt='{1}'/></td>", img, info.getContent(cost)); } if (ShowSpaceCost) { writer.WriteLine("<td class='resourceTitle'><img src='{0}' title='{1}' alt='{1}'/></td>", OrionGlobals.getCommonImagePath("resources/SpaceNeeded.gif"), info.getContent("space") ); } if (ShowRareResourceCost) { writer.WriteLine("<td class='resourceTitle'><img src='{0}' title='{1}' alt='{1}'/></td>", OrionGlobals.getCommonImagePath("resources/RareResources.gif"), info.getContent("Rare") ); } }
/// <summary>Mostra o índice</summary> private void writeIndex(HtmlTextWriter writer, ResourceBuilder toShow) { Ruler current = null; if (Context.User.IsInRole("ruler")) { User user = (User)Context.User; current = Universe.instance.getRuler(user.RulerId); } writer.WriteLine("<a name='TOP'></a>"); writer.WriteLine("<div class='planetInfoZoneTitle'><b>{0}</b></div>", info.getContent(category)); writer.WriteLine("<table class='planetFrame'>"); foreach (ResourceFactory factory in toShow.Values) { writer.WriteLine("<tr>"); if (current != null && factory.Category == "Research") { string img = "no.gif"; if (current.isResourceAvailable(category, factory.Name)) { img = "yes.gif"; } writer.WriteLine("<td><img src='{0}' /></td>", OrionGlobals.getCommonImagePath(img)); } writer.WriteLine("<td class='resource'><a href='#{0}' class='note'>{1}</a></td>", factory.Name, info.getContent(factory.Name), info.getContent(factory.Name + "_description") ); writer.WriteLine("<td class='resourceCell'>{0}</td>", info.getContent(factory.Name + "_description") ); writer.WriteLine("</tr>"); } writer.WriteLine("</table>"); }
protected override void Render(HtmlTextWriter writer) { if (errors.Count == 0 && ResultSet == null) { this.Visible = false; return; } writer.WriteLine("<table id='informationTable'>"); writer.WriteLine("<th colspan='2'><img src='{0}'/> {1}</th>", OrionGlobals.getSkinImagePath("msg_left.gif"), Title); if (IsInformation) { writer.WriteLine("<tr><td><img src='{0}'/></td>", OrionGlobals.getCommonImagePath("information.gif")); } else { writer.WriteLine("<tr><td><img src='{0}'/></td>", OrionGlobals.getCommonImagePath("error.gif")); } writer.WriteLine("<td class='messageContent'>"); writer.WriteLine("<ul class='information'>"); if (errors != null && errors.Count > 0) { WriteErrors(writer); } if (ResultSet != null) { WriteResult(writer); } writer.WriteLine("</ul>"); writer.WriteLine("</td></tr>"); writer.WriteLine("</table><p/>"); base.Render(writer); errors.Clear(); }
/// <summary>Prepara o controlo</summary> protected override void OnLoad(EventArgs args) { base.OnLoad(args); try { Ruler scanner = getRuler(); Scan scan = ScanUtility.Persistence.GetScan(ScanId); if (scan == null) { throw new Exception("No scan with id '" + ScanId + "' found"); } if (!scan.Success) { throw new Exception("Trying to access an unsucceceful scan"); } Planet source = scanner.getPlanet(scan.SourcePlanetId); if (source == null) { throw new Exception("Ruler '" + scanner.Id + "' don't own planet '" + scan.SourcePlanetId + ""); } Planet planet = scan.TargetPlanet; OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Scan, string.Format("{0} - {1}", info.getContent("section_scanreport"), planet.Coordinate)); scanWiki.NavigateUrl = Wiki.GetUrl("Scan"); scanWiki.Text = info.getContent("Wiki_Scan"); scanWiki.CssClass = "docs"; img.ImageUrl = OrionGlobals.getCommonImagePath("planets/" + planet.Info.Id + ".jpg"); img.EnableViewState = false; if (scan.TargetPlanetOwner != -1) { name.Text = planet.Name; ruler.Text = OrionGlobals.getLink(Universe.instance.getRuler(scan.TargetPlanetOwner)); } else { name.Text = "?"; ruler.Text = info.getContent("scan_inhabited"); } coordinate.Text = planet.Coordinate.ToString(); diameter.Text = planet.Info.Diameter.ToString(); mass.Text = planet.Info.Mass.ToString(); temperature.Text = planet.Info.Temperature; escape.Text = planet.Info.EscapeVelocity.ToString(); terrain.Text = info.getContent(planet.Info.Terrain.Description); cultureValue.Text = scan.Culture.ToString(); travelTime.Text = Chronos.Core.Fleet.TravelTime(source.Coordinate, scan.Target).ToString(); inBattle.ImageUrl = OrionGlobals.YesNoImage(scan.InBattle); if (scan.ScanLevel == 1) { return; } level2.Visible = true; fillPanel(mineral, "mineral", planet.Info.MPRatio); fillPanel(food, "food", planet.Info.FoodRatio); fillPanel(gold, "gold", planet.Info.GoldRatio); fillPanel(energy, "energy", planet.Info.EnergyRatio); fillPanel(groundSpace, "groundSpace", planet.Info.GroundSpace); fillPanel(waterSpace, "waterSpace", planet.Info.WaterSpace); fillPanel(orbitSpace, "orbitSpace", planet.Info.OrbitSpace); if (scan.ScanLevel == 2) { return; } level3.Visible = true; fleetNumber.Text = scan.NumberOfFleets.ToString(); shipsNumber.Text = scan.TotalShips.ToString(); hasStarPort.ImageUrl = OrionGlobals.YesNoImage(scan.HasStarPort); hasCommsSatellite.ImageUrl = OrionGlobals.YesNoImage(scan.HasCommsSatellite); hasGate.ImageUrl = OrionGlobals.YesNoImage(scan.HasGate); hasStarGate.ImageUrl = OrionGlobals.YesNoImage(scan.HasStarGate); hasHospital.ImageUrl = OrionGlobals.YesNoImage(scan.HasHospital); hasLandReclamation.ImageUrl = OrionGlobals.YesNoImage(scan.HasLandReclamation); hasMineralExtractor.ImageUrl = OrionGlobals.YesNoImage(scan.HasMineralExtractor); hasSpa.ImageUrl = OrionGlobals.YesNoImage(scan.HasSpa); hasStockMarkets.ImageUrl = OrionGlobals.YesNoImage(scan.HasStockMarkets); hasWaterReclamation.ImageUrl = OrionGlobals.YesNoImage(scan.HasWaterReclamation); hasIonCannon.ImageUrl = OrionGlobals.YesNoImage(scan.HasIonCannon); hasTurret.ImageUrl = OrionGlobals.YesNoImage(scan.HasTurret); } catch (Exception ex) { Visible = false; Chronos.Utils.Log.log(ex); ExceptionLog.log(ex); } }
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(); } }