Exemplo n.º 1
0
 /// <summary>Traduz uma ResourceFactory para texto localizado</summary>
 public string translate(ResourceFactory factory)
 {
     return(string.Format("<a href='{0}' class='docs'>{1}</a>",
                          OrionGlobals.getSectionBaseUrl("docs") + "?category=" + factory.Category + "#" + factory.Name,
                          info.getContent(factory.Name)
                          ));
 }
Exemplo n.º 2
0
        /// <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>");
        }
Exemplo n.º 3
0
 /// <summary>Traduz um Planeta para texto localizado</summary>
 public string translate(Planet planet)
 {
     return(string.Format("<a href='{0}' class='note'>{1}</a>",
                          OrionGlobals.getSectionBaseUrl("planet") + "?id=" + planet.Id,
                          planet.Name
                          ));
 }
Exemplo n.º 4
0
        /// <summary>Escreve uma categoria de recursos</summary>
        private void writeCategory(HtmlTextWriter writer, Planet planet, string category, string section)
        {
            ResourceInfo resInfo = planet.getResourceInfo(category);

            if (resInfo.AvailableFactories.Count == 0)
            {
                return;
            }

            writer.WriteLine("<tr>");

            QueueItem current = planet.current(category);

            writer.WriteLine("<td class='resourceCell'><a class='docs' href='{1}?id={2}'>{0}</a></td>",
                             info.getContent("section_" + section),
                             OrionGlobals.getSectionBaseUrl(section), planet.Id
                             );
            writer.WriteLine("<td class='resourceCell'>({1}) {0}</td>", (current == null?"-":info.getContent(current.FactoryName)),
                             (current == null?"-":current.Quantity.ToString())
                             );

            writer.WriteLine("<td class='resourceCell'>{0}</td>", (current == null?"-":current.RemainingTurns.ToString()));
            writer.WriteLine("<td class='resourceCell'>{0}</td>", planet.queueCount(category));

            writer.WriteLine("</tr>");
        }
Exemplo n.º 5
0
        /// <summary>Pinta o controlo</summary>
        protected override void OnLoad(EventArgs args)
        {
            base.OnLoad(args);
            Ruler ruler = getRuler();

            if (ruler == null)
            {
                throw new Exception("ShowPlanets:OnLoad : Ruler doesn't exists");
            }

            //MasterSkinInfo masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];
            string  controlPath = OrionGlobals.AppPath + "skins/planetaria/controls/ManageResearch.ascx";
            Control control     = Page.LoadControl(controlPath);

            QueueNotifier queue = (QueueNotifier)control.FindControl("queue");

            if (queue != null)
            {
                queue.Title                = info.getContent("researchQueueTitle");
                queue.Manager              = ruler;
                queue.Category             = "Research";
                queue.ShowQuantity         = false;
                queue.ShowProductionFactor = true;
            }

            QueueErrorReport queueError = (QueueErrorReport)control.FindControl("queueError");

            initResearchList(ruler, control, queueError, "tech");
            initResearchList(ruler, control, queueError, "planet");
            initResearchList(ruler, control, queueError, "exploration");
            initResearchList(ruler, control, queueError, "fleet");

            HyperLink availableResearch = (HyperLink)control.FindControl("availableResearch");

            availableResearch.NavigateUrl = string.Format("{0}?category=Research", OrionGlobals.getSectionBaseUrl("docs"));
            availableResearch.Text        = info.getContent("you_can_use_docs");
            availableResearch.CssClass    = "docs";

            HyperLink researchHelp = (HyperLink)control.FindControl("researchHelp");

            researchHelp.NavigateUrl = Wiki.GetUrl("Research", "Research");
            researchHelp.Text        = info.getContent("go_to_research_wiki");
            researchHelp.CssClass    = "docs";

            HyperLink aboutThisPage = (HyperLink)control.FindControl("aboutThisPage");

            aboutThisPage.NavigateUrl = Wiki.GetUrl("FilaDeEspera");
            aboutThisPage.Text        = info.getContent("wiki_FilaDeEspera");
            aboutThisPage.CssClass    = "docs";

            Controls.Add(control);

            OrionGlobals.RegisterRequest(MessageType.ResearchManagement, info.getContent("section_research"));
        }
Exemplo n.º 6
0
 private string FleetPlanetName(Planet planet, string name)
 {
     if (planet.IsInBattle)
     {
         return(name + " - " + info.getContent("fleet_inBattle"));
     }
     else
     {
         string link = OrionGlobals.getSectionBaseUrl("Fleet") + "?id=" + planet.Id;
         return(string.Format("<a href='{0}'>{1}</a>", link, name));
     }
 }
Exemplo n.º 7
0
 protected override void OnInit(EventArgs e)
 {
     if (!Page.Request.RawUrl.EndsWith("index.aspx"))
     {
         User user = HttpContext.Current.User as User;
         if (null != user && user.IsInRole("ruler"))
         {
             HttpContext.Current.Response.Redirect(OrionGlobals.getSectionBaseUrl("Ruler"));
         }
     }
     base.OnInit(e);
 }
Exemplo n.º 8
0
 private void WriteIndex(HtmlTextWriter writer)
 {
     writer.WriteLine("<ul>");
     foreach (string type in BattleInfo.EndBattleTypes)
     {
         writer.WriteLine("<li><a href='{0}?t={2}'>{1}</a></li>",
                          OrionGlobals.getSectionBaseUrl("tournament"),
                          CultureModule.getContent(type),
                          type
                          );
     }
     writer.WriteLine("</ul>");
 }
Exemplo n.º 9
0
        private void WriteFleetInformation(HtmlTextWriter writer, Chronos.Core.Fleet fleet)
        {
            string state       = info.getContent("fleet_state");
            string information = string.Empty;

            if (fleet.IsMoving)
            {
                state += info.getContent("fleet_inMovement");
                string arrival = string.Format(info.getContent("fleet_turnsToGo"), fleet.HoursToArrive);
                information = string.Format("<b>{0}:</b> {1}<br/>{2}", info.getContent("fleet_coordinate"), fleet.DestinyCoordinate.ToString(), arrival);
            }
            else
            {
                if (fleet.IsInBattle)
                {
                    state      += info.getContent("fleet_inBattle");
                    information = info.getContent("fleet_battleCoordinate") + fleet.Coordinate.ToString();
                }
                else
                {
                    if (fleet.IsMoveable)
                    {
                        state += info.getContent("fleet_stopped");
                        if (fleet.Owner is Planet)
                        {
                            Planet p    = ((Planet)fleet.Owner);
                            string link = OrionGlobals.getSectionBaseUrl("Fleet") + "?id=" + p.Id;
                            information = string.Format("{0}<a href='{1}'>{2}</a>", info.getContent("fleet_location"), link, p.Name);
                        }
                        else
                        {
                            information = info.getContent("fleet_location") + fleet.Coordinate.ToString();
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            writer.WriteLine(@"
				<tr>
					<td class='borderTop' colspan='3' style='padding: 5px 0px 5px 0px;'>
						{0}<br/>
						{1}
					</td>
				</tr>"                , state, information
                             );
        }
Exemplo n.º 10
0
        /// <summary>Mostra o menu que indica todas as categorias possíveis</summary>
        private void showMainMenu(HtmlTextWriter writer)
        {
            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.ResearchManagement, CultureModule.getContent("section_docs"));

            writer.WriteLine("<ul>");
            foreach (string allowed in AllowedCategories)
            {
                writer.WriteLine("<li><a href='{0}?category={1}'>",
                                 OrionGlobals.getSectionBaseUrl("docs"),
                                 allowed
                                 );
                writer.WriteLine(info.getContent(allowed));
                writer.WriteLine("</a> ({0})</li>", getHash(allowed).Count);
            }
            writer.WriteLine("</ul>");
        }
Exemplo n.º 11
0
        private void WriteLocation(HtmlTextWriter writer, FlexWiki.AbsoluteTopicName topic, string display)
        {
            writer.WriteLine("<div id='wiki_nav'>");
            writer.WriteLine("<div id='wiki_search'><input type='text' name='wiki_search' value='' /> <input type='submit' value='Procurar' /></div>");
            writer.WriteLine("<a href='{0}'>Manual</a>", OrionGlobals.getSectionBaseUrl("wiki"));

            string parent = GetTopicField(topic, "Parent");

            if (parent != null)
            {
                FlexWiki.AbsoluteTopicName parentTopic = new FlexWiki.AbsoluteTopicName(parent);
                writer.WriteLine(" &raquo; <a href='{0}'>{1}</a>", GetUrl(parentTopic), GetDisplay(parentTopic));
            }

            if (topic.Fullname != "Orionsbelt.Orionsbelt")
            {
                writer.WriteLine(" &raquo; <a href='{0}'>{1}</a>", GetUrl(topic), display);
            }
            writer.WriteLine("</div>");
        }
Exemplo n.º 12
0
        /// <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);
        }
Exemplo n.º 13
0
        /// <summary>Pinta o controlo</summary>
        protected override void Render(HtmlTextWriter writer)
        {
            Planet previous = null;
            Planet next     = null;

            int idx = Player.getIndex(Current);

            previous = getPrevious(idx);
            next     = getNext(idx);

            writer.WriteLine("<table width='100%' class='nav'>");
            writer.WriteLine("<tr>");

            writer.WriteLine("<td align='left' width='33%'>");
            if (next != null)
            {
                writer.WriteLine("<a href='{0}?id={1}' title='{2} @ {3}'>&lt;&lt;</a>", OrionGlobals.getSectionBaseUrl(Section), next.Id, next.Name, next.Coordinate.ToString());
            }
            writer.WriteLine("</td>");

            writer.WriteLine("<td align='center' width='33%'>");
            writer.WriteLine("<b>{0}</b> @ {1}", Current.Name, Current.Coordinate.ToString());
            writer.WriteLine("</td>");

            writer.WriteLine("<td align='right' width='33%'>");
            if (previous != null)
            {
                writer.WriteLine("<a href='{0}?id={1}' title='{2} @ {3}'>&gt;&gt;</a>", OrionGlobals.getSectionBaseUrl(Section), previous.Id, previous.Name, previous.Coordinate.ToString());
            }
            writer.WriteLine("</td>");

            writer.WriteLine("</tr>");
            writer.WriteLine("</table>");

            if (Current.IsInBattle)
            {
                writer.WriteLine("<div class='errorTitle'>{0}</div>", info.getContent("PlanetInBattle"));
            }
        }
Exemplo n.º 14
0
        /// <summary>Escreve um item</summary>
        private void writeLine(HtmlTextWriter writer, ResourceInfo resources, string res)
        {
            if (ShowImagePreview)
            {
                writer.WriteLine("<td class='resourceManagement'><img src='{0}.gif' style='width:20px;height:20px;'/></td>", OrionGlobals.getCommonImagePath(res.ToLower()));
            }

            if (ShowQuantity)
            {
                writeQuantity(writer, resources, res);
            }

            writer.WriteLine("<td class='resource'>");
            if (ShowDocumentation)
            {
                writer.WriteLine("<a class='docs' href='{1}/{2}.{3}' {4}>{0}</a>",
                                 info.getContent(res),
                                 OrionGlobals.getSectionBaseUrl("wiki"),
                                 resources.Category, res,
                                 getTooltipText(resources, res)
                                 );
            }
            else
            {
                writer.WriteLine(info.getContent(res));
            }

            writer.WriteLine("</td>");

            bool canBuild = resources.canQueue(res, 1).Ok;

            if (ShowCost)
            {
                writeCost(writer, resources, res);
            }

            if (ShowDuration)
            {
                ResourceFactory factory  = (ResourceFactory)resources.AvailableFactories[res];
                int             duration = QueueItem.BaseDuration(Manager, factory, 1);
                int             real     = QueueItem.RealDuration(Manager, factory, 1);
                if (duration == real)
                {
                    writer.WriteLine("<td class='resourceCell'>{0}</td>", factory.Duration.Value);
                }
                else
                {
                    string css = "green";
                    if (real > duration)
                    {
                        css = "red";
                    }
                    writer.WriteLine("<td class='resourceCell'><span class='{0}'>{1}</span> ({2})</td>", css, real, duration);
                }
            }

            writeBuild(writer, resources, res, canBuild);

            if (ShowDemolish)
            {
                writeDemolish(writer, res, resources);
            }
        }
Exemplo n.º 15
0
 private string getPlanetLink(Planet p)
 {
     return(string.Format("<a href='{0}?id={1}'>{2}</a>", OrionGlobals.getSectionBaseUrl("planet"), p.Id, p.Name));
 }