Exemple #1
0
 /// <summary>Mostra links de ajuda</summary>
 private void RenderHelp(HtmlTextWriter writer)
 {
     writer.WriteLine("<ul class='help_zone'>");
     writer.WriteLine("<li><a href='{0}'>{1}</a></li>", Wiki.GetUrl("Prémios"), info.getContent("wiki_Prizes"));
     writer.WriteLine("<li><a href='{0}'>{1}</a></li>", Wiki.GetUrl("Medalhas"), info.getContent("wiki_Medals"));
     writer.WriteLine("</ul>");
 }
Exemple #2
0
        /// <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>");
        }
Exemple #3
0
        protected override void OnLoad(EventArgs e)
        {
            Ruler  ruler  = getRuler();
            Planet planet = getPlanet();

            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.Battle, string.Format("{0} - {1}", planet.Name, info.getContent("section_barracks")));

            resources.Manager = queue.Manager = planet;

            resources.Category = queue.Category = "Intrinsic";

            resources.QueueError = queueError;

            resources.AskBuildQuantity    = true;
            resources.ShowQuantity        = true;
            resources.ShowDemolish        = false;
            resources.Cost                = Cost;
            resources.ShowDocumentation   = true;
            resources.IncludeOnMouseOver  = false;
            resources.CategoryDescription = "soldier";

            resourcesHelp.Title             = info.getContent("planetResources");
            resourcesHelp.Manager           = planet;
            resourcesHelp.ShowImages        = true;
            resourcesHelp.Category          = "Intrinsic";
            resourcesHelp.ShowRareResources = false;
            resourcesHelp.ShowDocumentation = false;
            resourcesHelp.ShowDocumentation = false;
            resourcesHelp.ResourcesToShow   = ToShow;

            queue.Title        = info.getContent("inProduction");
            queue.EmptyMessage = info.getContent("buildingsQueueEmpty");

            resources.Title = info.getContent("fleet_buildShip");

            planetNavigation.Player  = ruler;
            planetNavigation.Current = planet;
            planetNavigation.Section = "Barracks";

            sabotageList.Source        = planet;
            sabotageList.Report        = queueError;
            sabotageList.TravelControl = travelControl;

            sabotageQueue.Source = planet;

            // Help
            intrinsicHelp.NavigateUrl = Wiki.GetUrl("Intrinsic", "Intrinsic");
            intrinsicHelp.Text        = info.getContent("wiki_Intrinsecos");

            sabotageHelp.NavigateUrl = Wiki.GetUrl("Sabotagens");
            sabotageHelp.Text        = info.getContent("wiki_Sabotage");

            queueHelp.NavigateUrl = Wiki.GetUrl("FilaDeEspera");
            queueHelp.Text        = info.getContent("wiki_FilaDeEspera");
        }
Exemple #4
0
        /// <summary>Prepara o controlo</summary>
        protected override void OnLoad(EventArgs args)
        {
            base.OnLoad(args);

            RegisterRequest();
            InitControlOnLoad();

            scanWiki.NavigateUrl = Wiki.GetUrl("Scan");
            scanWiki.Text        = info.getContent("Wiki_Scan");
            scanWiki.CssClass    = "docs";
        }
Exemple #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"));
        }
Exemple #6
0
        /// <summary>Prepara o controlo</summary>
        protected override void OnLoad(EventArgs args)
        {
            base.OnLoad(args);

            FillOptionsList();
            FillResourcesList();

            string sectionMarket = info.getContent("section_market");

            OrionGlobals.RegisterRequest(MessageType.PlanetManagement, string.Format("{0} - {1}", getPlanet().Name, sectionMarket));

            Page.RegisterHiddenField("currentOperation", "");
            Page.RegisterHiddenField("resource", "");

            operationReport.Title = sectionMarket;

            marketHelp.NavigateUrl = Wiki.GetUrl("Mercados");
            marketHelp.Text        = info.getContent("wiki_Market");
        }
Exemple #7
0
        /// <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);
            }
        }
Exemple #8
0
        /// <summary>Pinta o Controlo</summary>
        protected void writeControl(Chronos.Core.Ruler ruler, Chronos.Core.Planet planet)
        {
            //MasterSkinInfo masterSkinInfo = (MasterSkinInfo)Context.Items["MasterSkinInfo"];
            string  control    = OrionGlobals.AppPath + "skins/planetaria/controls/ManageBuildings.ascx";
            Control planetSkin = Page.LoadControl(control);

            ResourcesList resources = (ResourcesList)planetSkin.FindControl("resourcesList");

            if (resources != null)
            {
                resources.Manager           = planet;
                resources.Title             = info.getContent("planetResources");
                resources.Category          = "Intrinsic";
                resources.ShowImages        = true;
                resources.ShowDocumentation = false;
                resources.ResourcesToShow   = new string[] {
                    "gold", "mp", "food", "labor", "housing", "energy", "culture", "polution"
                };
                resources.ShowSpace = true;
            }

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

            if (queue != null)
            {
                queue.Manager      = planet;
                queue.Category     = "Building";
                queue.Title        = info.getContent("inProduction");
                queue.EmptyMessage = info.getContent("buildingsQueueEmpty");
            }

            PlanetNavigation nav = (PlanetNavigation)planetSkin.FindControl("planetNavigation");

            if (null != nav)
            {
                nav.Player  = ruler;
                nav.Current = planet;
                nav.Section = "Buildings";
            }

            writeBuildingList(planet, planetSkin, "general", true);
            writeBuildingList(planet, planetSkin, "upgrade", false);

            HyperLink intrinsicHelp = (HyperLink)planetSkin.FindControl("intrinsicHelp");

            intrinsicHelp.NavigateUrl = Wiki.GetUrl("Intrinsic", "Intrinsic");
            intrinsicHelp.Text        = info.getContent("wiki_Intrinsecos");

            HyperLink buildingHelp = (HyperLink)planetSkin.FindControl("buildingHelp");

            buildingHelp.NavigateUrl = Wiki.GetUrl("Building", "Building");
            buildingHelp.Text        = info.getContent("wiki_Edificios");

            HyperLink queueHelp = (HyperLink)planetSkin.FindControl("queueHelp");

            queueHelp.NavigateUrl = Wiki.GetUrl("FilaDeEspera");
            queueHelp.Text        = info.getContent("wiki_FilaDeEspera");

            Controls.Add(planetSkin);

            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.PlanetManagement, string.Format("{1} - {0}", info.getContent("section_buildings"), planet.Name));
        }
 /// <summary>Escreve texto antes dos Results</summary>
 protected override void WriteHeader()
 {
     Information.AddInformation(info.getContent("restrictions_header") + string.Format(" <a href='{0}'>{1}</a>", Wiki.GetUrl("Restricoes"), info.getContent("restrictions_link")));
 }
Exemple #10
0
 private void WriteUnits(HtmlTextWriter writer, Tournament tour)
 {
     writer.WriteLine("<div class='planetInfoZoneTitle'><b>{0}</b></div>", CultureModule.getContent("tournament_units"));
     writer.WriteLine("<table class='planetFrame' width='100%'>");
     writer.WriteLine("<tr>");
     foreach (string ship in tour.BaseFleet.Ships.Keys)
     {
         writer.WriteLine("<td class='resourceCell'><a href='{2}' alt='{3}' title='{3}'><img src='{0}units/{1}_preview.gif' class='unit_small_preview' /></a></td>", OrionGlobals.getCommonImagePath(), ship, Wiki.GetUrl("Unit", ship), CultureModule.getContent(ship));
     }
     writer.WriteLine("</tr>");
     writer.WriteLine("<tr>");
     foreach (object quantity in tour.BaseFleet.Ships.Values)
     {
         writer.WriteLine("<td class='resourceCell'>{0}</td>", quantity);
     }
     writer.WriteLine("</tr>");
     writer.WriteLine("</table>");
 }
Exemple #11
0
        /// <summary>Escreve a Queue</summary>
        private void writeQueue(HtmlTextWriter writer)
        {
            QueueItem[] items   = Manager.getQueueList(Category);
            QueueItem   current = Manager.current(Category);

            if (current == null && items.Length == 0)
            {
                writer.WriteLine(EmptyMessage);
                return;
            }

            if (errorMessage != null)
            {
                string msg = info.getContent(errorMessage);
                writer.WriteLine("<div class='error'>{0}</div>", msg);
            }

            writeScriptBlock((current != null).ToString() + ";" + items.Length);

            int order = 1;

            ViewState["QueueStatus"] = (current != null).ToString() + ";" + items.Length;

            if (ShowImagePreview && current != null)
            {
                ++order;
                writer.WriteLine("<div id='inProductionPreview'>");
                writer.WriteLine("<img src='{0}units/{1}_preview.gif' />", OrionGlobals.getCommonImagePath(), current.FactoryName);
                writer.WriteLine("<ul>");
                writer.WriteLine("<li>{2}: <a class='docs' href='{1}'>{0}</a></li>",
                                 info.getContent(current.FactoryName),
                                 Wiki.GetUrl(current.Factory.Category, current.Factory.Name),
                                 info.getContent("recurso")
                                 );
                writer.WriteLine("<li>{0}: {1}</li>", info.getContent("quantidade"), current.Quantity);
                writer.WriteLine("<li>{0}: {1} {2}</li>", info.getContent("conclusao"), current.RemainingTurns, info.getContent("Turns"));
                writer.WriteLine("<li><a href='javascript:dequeue(-1);'>{0}</a></li>", info.getContent("cancel"));
                writer.WriteLine("</ul>");
                writer.WriteLine("</div>");
            }

            if (items.Length == 0 && current == null)
            {
                return;
            }

            writer.WriteLine("<table class='planetFrame' width='100%'>");
            writer.WriteLine("<tr class='resourceTitle'>");
            writeTitle(writer);
            writer.WriteLine("</tr>");

            if (!ShowImagePreview && current != null)
            {
                writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
                writeItem(-1, order, current, writer, current.RemainingTurns, false);
                writer.WriteLine("</tr>");

                ++order;
            }

            for (int i = 0; i < items.Length; ++i, ++order)
            {
                writer.WriteLine("<tr onmouseover='overResource(this);' onmouseout='outResource(this);'>");
                writeItem(i, order, items[i], writer, QueueItem.RealDuration(Manager, items[i].Factory, items[i].Quantity), true);
                writer.WriteLine("</tr>");
            }

            writer.WriteLine("</table>");
        }
        /// <summary>Inicializa o controlo</summary>
        protected override void OnLoad(EventArgs args)
        {
            base.OnLoad(args);
            if (Page.IsPostBack)
            {
                string action = Page.Request.Form["action"];
                if (action != null && action == "intrinsic")
                {
                    CheckIntrinsicInput();
                }
                else
                {
                    CheckFleetInput();
                }
                intrinsicResources.Items.Clear();
                intrinsicDestiny.Items.Clear();
                fleetDestiny.Items.Clear();
                planetFleets.Items.Clear();
            }

            Page.RegisterHiddenField("action", "");
            Planet planet = getPlanet();

            OrionGlobals.RegisterRequest(Chronos.Messaging.MessageType.PlanetManagement, string.Format("{0} - {1}", planet.Name, info.getContent("section_tele")));

            intrinsicTeletransport.Visible = planet.CanTeletransportIntrinsic;
            fleetTeletransport.Visible     = planet.CanTeletransportFleets && planet.Fleets.Count > 1;
            noFleets.Visible = planet.Fleets.Count == 1;

            planetNavigation.Player  = (Ruler)planet.Owner;
            planetNavigation.Current = planet;
            planetNavigation.Section = "Tele";

            teletransportationWiki.NavigateUrl = Wiki.GetUrl("TeleTransporte");
            teletransportationWiki.Text        = info.getContent("Wiki_Teletransporte");
            teletransportationWiki.CssClass    = "docs";

            if (intrinsicTeletransport.Visible)
            {
                GetIntrinsic(planet, intrinsicResources);
                intrinsicResources.DataBind();
                intrinsicResources.Attributes.Add("onchange", string.Format("intrinsicChanged('{0}');", intrinsicResources.ClientID));
                toSend.Attributes.Add("onchange", string.Format("intrinsicChanged('{0}');", intrinsicResources.ClientID));
                IntrinsicPlanets(intrinsicDestiny, planet.IntrinsicTeletransportationPlanets);
                intrinsicDestiny.DataBind();
                moveIntrinsic.Text = info.getContent("send");
                SetQuantities(toSend);
                moveIntrinsic.Attributes.Add("onclick", "return moveIntrinsic();");
                WriteIntrinsicScripts(planet);
                energyQuantity.Text = planet.Energy.ToString();
            }

            if (fleetTeletransport.Visible)
            {
                energyQuantity2.Text = planet.Energy.ToString();
                moveFleet.Text       = info.getContent("send");
                SetFleetsToMove(planetFleets, planet);
                IntrinsicPlanets(fleetDestiny, planet.FleetTeletransportationPlanets);
                WriteFleetScripts(planet);
                moveFleet.Attributes.Add("onclick", "return moveFleet();");
            }
        }