예제 #1
0
        /// <summary>Escreve as informações gerais de um planeta</summary>
        private void writeGeneral(Chronos.Core.Planet planet, Control control)
        {
            fillLabel(control, "name", planet.Name);
            fillLabel(control, "coordinate", planet.Coordinate.ToString());
            fillLabel(control, "diameter", planet.Info.Diameter.ToString());
            fillLabel(control, "mass", planet.Info.Mass.ToString());
            fillLabel(control, "temperature", planet.Info.Temperature.ToString());
            fillLabel(control, "escape", planet.Info.EscapeVelocity.ToString());
            fillLabel(control, "terrain", info.getContent(planet.Info.Terrain.Description));

            fillPanel(control, "mineral", (int)planet.ModifiersRatio["mp"]);
            fillPanel(control, "food", (int)planet.ModifiersRatio["food"]);
            fillPanel(control, "gold", (int)planet.ModifiersRatio["gold"]);
            fillPanel(control, "energy", (int)planet.ModifiersRatio["energy"]);
            fillPanel(control, "groundSpace", planet.getResourceCount("Intrinsic", "groundSpace"));
            fillPanel(control, "waterSpace", planet.getResourceCount("Intrinsic", "waterSpace"));
            fillPanel(control, "orbitSpace", planet.getResourceCount("Intrinsic", "orbitSpace"));
        }
예제 #2
0
        /// <summary>Preenche os controlos relativos a um recurso</summary>
        private void fillResource(string resource, Control control, Chronos.Core.Planet planet)
        {
            Label quantity = (Label)control.FindControl(resource + "Quantity");

            if (quantity != null)
            {
                quantity.EnableViewState = false;
                int val = planet.getResourceCount(resource);
                quantity.Text = val.ToString();
                if (val < 0)
                {
                    quantity.CssClass = "error";
                }
            }

            Label ratio = (Label)control.FindControl(resource + "Ratio");

            if (ratio != null)
            {
                ratio.EnableViewState = false;
                int val = planet.getRatio(resource);
                if (val > 0)
                {
                    ratio.Text = val.ToString() + "%";
                }
                else
                {
                    ratio.Text = "-";
                }
            }

            Label perTurn = (Label)control.FindControl(resource + "PerTurn");

            if (perTurn != null)
            {
                perTurn.EnableViewState = false;
                int    val = planet.getPerTurn("Intrinsic", resource);
                string str = val.ToString();

                if (val > 0)
                {
                    str          = "+" + str;
                    perTurn.Text = str;
                }
                else if (val == 0)
                {
                    perTurn.Text = "-";
                }
                else
                {
                    perTurn.CssClass = "error";
                    perTurn.Text     = str;
                }
            }
        }