Example #1
0
    private void SetStarImage(StarType starType, UISprite spStar)
    {
        string starSpriteName = "fb_xing_yidengdao";

        switch (starType)
        {
        case StarType.StarType1:
        {
            starSpriteName = "zs";

            spStar.atlas      = MogoUIManager.Instance.GetAtlasByIconName(starSpriteName);
            spStar.spriteName = starSpriteName;
            spStar.MakePixelPerfect();
        } break;

        case StarType.StarType2:
        {
            starSpriteName = "hg_h";

            spStar.atlas      = MogoUIManager.Instance.GetAtlasByIconName(starSpriteName);
            spStar.spriteName = starSpriteName;
            spStar.MakePixelPerfect();
        } break;

        case StarType.StarType3:
        {
            starSpriteName = "hg";

            spStar.atlas      = MogoUIManager.Instance.GetAtlasByIconName(starSpriteName);
            spStar.spriteName = starSpriteName;
            spStar.MakePixelPerfect();
        } break;
        }
    }
Example #2
0
    public StarInfo(StarType type, bool coreStar = false)
    {
        sType = type;

        if (type == StarType.Check)
        {
            BayerCreater();
            sPos = GenCheckStarPos(coreStar);
            if (Random.Range(0, 100) >= 20)
            {
                sColor = new Color(0.9f, 0.9f, 0.9f);
            }
            else
            {
                sColor = new Color(Random.Range(0.5f, 1), Random.Range(0.5f, 1), Random.Range(0.5f, 1));
            }
        }
        else if (type == StarType.End)
        {
            BayerCreater();
            sPos   = GenTgtStarPos();
            sColor = new Color(1, 0.85f, 0);
        }
        else
        {
            sPos = GenPos();
        }
    }
Example #3
0
	private void SetStarImage(StarType starType, UISprite spStar)
	{
		string starSpriteName = "fb_xing_yidengdao";
		switch(starType)
		{
            case StarType.StarType1:
		    {
                starSpriteName = "zs";
			
			    spStar.atlas = MogoUIManager.Instance.GetAtlasByIconName(starSpriteName);
			    spStar.spriteName = starSpriteName;
                spStar.MakePixelPerfect();
		    }break;

            case StarType.StarType2:
		    {
                starSpriteName = "hg_h";
			
			    spStar.atlas = MogoUIManager.Instance.GetAtlasByIconName(starSpriteName);
			    spStar.spriteName = starSpriteName;	
			    spStar.MakePixelPerfect();
		    }break;

            case StarType.StarType3:
		    {
			    starSpriteName = "hg";
			
			    spStar.atlas = MogoUIManager.Instance.GetAtlasByIconName(starSpriteName);
			    spStar.spriteName = starSpriteName;	
			    spStar.MakePixelPerfect();
		    }break;
		}		
	}
Example #4
0
        public virtual void SaveToXML(XmlElement objSystem)
        {
            var xeStar = objSystem.OwnerDocument.CreateElement("Star");

            objSystem.AppendChild(xeStar);
            Common.CreateTextNode(xeStar, "Type", StarType.ToString());
            Common.CreateTextNode(xeStar, "LumClass", LumClass.ToString());
            Common.CreateTextNode(xeStar, "DecClass", DecClass.ToString());
            Common.CreateTextNode(xeStar, "StellarMass", StellarMass.ToString());
            Common.CreateTextNode(xeStar, "Luminosity", Luminosity.ToString());
            Common.CreateTextNode(xeStar, "NumOrbits", NumOrbits.ToString());
            Common.CreateTextNode(xeStar, "HZone", HZone.ToString());
            Common.CreateTextNode(xeStar, "TypeRoll", TypeRoll.ToString());
            Common.CreateTextNode(xeStar, "ClassRoll", ClassRoll.ToString());
            Common.CreateTextNode(xeStar, "NumCompanions", NumCompanions.ToString());
            Common.CreateTextNode(xeStar, "Name", Name.ToString());

            foreach (var orbit in Orbits)
            {
                orbit.SaveToXML(xeStar);
            }

            var xeStars = objSystem.OwnerDocument.CreateElement("Companions");

            xeStar.AppendChild(xeStars);

            foreach (var companion in Companions)
            {
                companion.SaveToXML(xeStars);
            }
        }
Example #5
0
    public static Gradient GetStarColour(StarType _type)
    {
        switch (_type)
        {
        case  StarType.B:
            return(GetClassBColour());

        case  StarType.A:
            return(GetClassAColour());

        case  StarType.F:
            return(GetClassFColour());

        case  StarType.G:
            return(GetClassGColour());

        case  StarType.K:
            return(GetClassKColour());

        case  StarType.M:
            return(GetClassMColour());

        default:
            return(GetClassAColour());
        }
    }
Example #6
0
        /// <summary>
        /// Genera un lista de estrellas
        /// </summary>
        /// <param name="number">número de estrellas. Tiene que se un valor entre 0 -255)</param>
        /// <param name="type">tipo de las estrellas a generar</param>
        /// <param name="velocity">velocidad de las estrellas a generar</param>
        /// <param name="window">ventana para la que se generar las estrellas</param>
        /// <returns>Lista de estrellas</returns>
        static public List<Star> StarGenerator(Byte number, StarType type, Vector2f velocity, RenderWindow window)
        {
            float _baseRadius = 0.5f;                   // radio base de las estrellas del fondo
      
            Star star;
            int  posX, posY;            // asigno coordenadas enteras
            List<Star> _stars = new List<Star>();
           
            switch (type)
            {
                case StarType.SMALL: _baseRadius = 0.5f; break;
                case StarType.MEDIUM: _baseRadius = 0.8f; break;
                case StarType.BIG: _baseRadius = 1.5f; break;
            }

            Random rnd = new Random();
            
            // Creo las estrellas
            for (int contStar = 0; contStar < number; contStar++)
            {
                byte red = (byte)rnd.Next(150,255);
               
                posX = rnd.Next((int)window.Size.X);
                posY = rnd.Next(-(int)(window.Size.Y * .02), (int)(window.Size.Y * 1.02));

                star = new Star(new Vector2f(posX, posY),_baseRadius,new Color(red,red, 255),velocity);

                _stars.Add(star);
            }

            return _stars;
        }
Example #7
0
    public void SetVisuals(StarType starType)
    {
        switch (starType)
        {
        case StarType.None:
        {
            buttonComponent = circleButton;
            gameObject.SetActive(false);
            circleButton.gameObject.SetActive(true);
            silverStarButton.gameObject.SetActive(false);
            goldStarButton.gameObject.SetActive(false);
        } break;

        case StarType.Silver:
        {
            buttonComponent = silverStarButton;
            gameObject.SetActive(false);
            circleButton.gameObject.SetActive(false);
            silverStarButton.gameObject.SetActive(true);
            goldStarButton.gameObject.SetActive(false);
        } break;

        case StarType.Gold:
        {
            buttonComponent = goldStarButton;
            gameObject.SetActive(false);
            circleButton.gameObject.SetActive(false);
            silverStarButton.gameObject.SetActive(false);
            goldStarButton.gameObject.SetActive(true);
        } break;
        }
    }
Example #8
0
        public static string GetStarCssType(StarType type)
        {
            var cssclass = "typeg1";

            switch (type)
            {
            case StarType.Typeg:
                cssclass = "typeg" + Utility.RandomNumber(1, 4);
                break;

            case StarType.Dualstar:
                cssclass = "dual" + Utility.RandomNumber(1, 2);
                break;

            case StarType.Reddwarf:
                cssclass = "dwarf" + Utility.RandomNumber(1, 2);
                break;

            case StarType.Redgiant:
                cssclass = "giant" + Utility.RandomNumber(1, 3);
                break;

            case StarType.Supernova:
                cssclass = "supernova" + Utility.RandomNumber(1, 2);
                break;
            }

            return(cssclass);
        }
Example #9
0
 public StarSystemInfo(int _numberOfPlanets, bool _asteroidBelt, StarType _starType, float _systemSize)
 {
     numberOfPlanets = _numberOfPlanets;
     asteroidBelt    = _asteroidBelt;
     starType        = _starType;
     systemSize      = _systemSize;
 }
Example #10
0
        public static StarType GetStarType()
        {
            StarType type   = StarType.Typeg;
            int      random = Utility.RandomNumber(0, 100);

            if (random > 98)
            {
                type = StarType.Supernova;
            }
            else if (random < 99 && random > 85)
            {
                type = StarType.Dualstar;
            }
            else if (random < 86 && random > 65)
            {
                type = StarType.Redgiant;
            }
            else if (random < 66 && random > 50)
            {
                type = StarType.Reddwarf;
            }
            else if (random < 51 && random > 35)
            {
                type = StarType.Whitedwarf;
            }
            return(type);
        }
Example #11
0
        private void setColor(StarType type)
        {
            // Set color based off of star type
            switch (type)
            {
            case StarType.RedGiant:
                BodyColor = Color.OrangeRed;
                break;

            case StarType.WhiteDwarf:
                BodyColor = Color.LightSteelBlue;
                break;

            case StarType.RedDwarf:
                BodyColor = Color.DarkRed;
                break;

            case StarType.Neutron:
                BodyColor = Color.Purple;
                break;

            case StarType.Supergiant:
                BodyColor = Color.DarkCyan;
                break;
            }
        }
Example #12
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] StarType starType)
        {
            if (id != starType.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(starType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!StarTypeExists(starType.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(starType));
        }
Example #13
0
 // C-tors
 public Star(string name, double distance, StarType type = StarType.RedDwarf)
 {
     Name     = name;
     Distance = distance;
     Type     = type;
     BodyType = BodyType.Star;
     setColor(type);
 }
Example #14
0
 Star(StarType t, string desc, int tierMod, int numD, int numNM, double DVmod)
 {
     Type          = t;
     Description   = desc;
     TierModifier  = tierMod;
     NumDreams     = numD;
     NumNightmares = numNM;
     DVModifier    = DVmod;
 }
Example #15
0
 public Star(string name, double distance, StarType classification, double mass,
             string constellation)
 {
     this.Name           = StringLimiter(name, 20);
     this.Distance       = distance;
     this.Classification = classification;
     this.Mass           = mass;
     this.Constellation  = StringLimiter(constellation, 30);
 }
Example #16
0
        public Sun(StarType starType)
        {
            if (starType >= StarType.Nebula)
            {
                throw new ArgumentOutOfRangeException("starType");
            }

            _starType = starType;
        }
Example #17
0
        /// <summary>
        /// 经过类型装饰
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public NPCStar GetNPCStarFromType(StarType type)
        {
            NPCStar e = NPCStarPool.GetObject();

            e.SpriteRenderer.sprite = GetSpriteMapping(GameConfig.Instance.GetComnmonStarMapping(type.ToString()));
            e.Type = type;

            e.Used();
            return(e);
        }
Example #18
0
        public async Task <IActionResult> Create([Bind("Id,Name")] StarType starType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(starType);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(starType));
        }
Example #19
0
 // 星星的类型是否一致
 bool IsStarMatchType(int row, int columns, StarType targetType)
 {
     if (starList[row, columns] == null)
     {
         return(false);
     }
     if (starList[row, columns].GetComponent <Star>().type == targetType)
     {
         return(true);
     }
     return(false);
 }
Example #20
0
        public Star(StarType star)
        {
            type        = star.type;
            description = star.description;

            maxTemperature = star.maxTemperature;
            minTemperature = star.minTemperature;

            sprite = star.sprite;

            visSize  = star.visSize;
            visColor = star.visColor;
        }
Example #21
0
 /// <summary>
 /// Initializes a new instance of <see cref="StarSystemChildDefinition"/>.
 /// </summary>
 /// <param name="starType">
 /// The type of the primary star of a star system child.
 /// </param>
 /// <param name="spectralClass">The <see cref="Stars.SpectralClass"/> of the
 /// primary star of the star system.</param>
 /// <param name="luminosityClass">
 /// The <see cref="Stars.LuminosityClass"/> of the primary star of the star
 /// system.
 /// </param>
 /// <param name="populationII">True if the primary star of the star system is to be a
 /// Population II star.</param>
 /// <param name="allowBinary">
 /// Whether a multiple-star system will satisfy this definition.
 /// </param>
 public StarSystemChildDefinition(
     StarType starType,
     SpectralClass?spectralClass     = null,
     LuminosityClass?luminosityClass = null,
     bool populationII = false,
     bool allowBinary  = true) : base(StarSystem._StarSystemSpace, HugeNumber.Zero)
 {
     StarType        = starType;
     SpectralClass   = spectralClass;
     LuminosityClass = luminosityClass;
     PopulationII    = populationII;
     AllowBinary     = allowBinary;
 }
Example #22
0
    /// <summary>
    /// 检查星星  是不是可以消除的
    /// </summary>
    /// <param name="row"></param>
    /// <param name="columns"></param>
    /// <returns></returns>
    bool CheckStarEliminable(int row, int columns)
    {
        bool       eliminable = false;
        GameObject star       = starList[row, columns];

        if (star == null)
        {
            return(eliminable);
        }

        StarType targetType = star.GetComponent <Star>().type;
        bool     targetTypeMatched;

        //上边星星
        if (row - 1 >= 0)
        {
            targetTypeMatched = IsStarMatchType(row - 1, columns, targetType);
            if (targetTypeMatched)
            {
                return(true);
            }
        }
        //右边星星
        if (columns + 1 < 9)
        {
            targetTypeMatched = IsStarMatchType(row, columns + 1, targetType);
            if (targetTypeMatched)
            {
                return(true);
            }
        }
        //下边星星
        if (row + 1 < 9)
        {
            targetTypeMatched = IsStarMatchType(row + 1, columns, targetType);
            if (targetTypeMatched)
            {
                return(true);
            }
        }
        //左边星星
        if (columns - 1 >= 0)
        {
            targetTypeMatched = IsStarMatchType(row, columns - 1, targetType);
            if (targetTypeMatched)
            {
                return(true);
            }
        }
        return(eliminable);
    }
Example #23
0
    public StarType GetRandomStarType(StarType[] _UsedType)
    {
        StarType newType = GetRandomStarType();

        for (int i = 0; i < _UsedType.Length; i++)
        {
            if (newType == _UsedType [i])
            {
                GetRandomStarType(_UsedType);
            }
        }

        return(newType);
    }
Example #24
0
 public StarSystem(StarType StarType1, StarType StarType2, StarType StarType3, StarSystemType StarSystemType, int NumPlanets, Vector3 StarPosition, string StarSystemName, Sector Sector, GameObject StarSystemObject)
 {
     numPlanets = NumPlanets;
     GenerateStarSystemType();
     starSystemType = StarSystemType;
     GenerateStars(StarSystemType);
     starType1         = StarType1;
     starType2         = StarType2;
     starType3         = StarType3;
     starPosition      = StarPosition;
     starSystemName    = StarSystemName;
     sector            = Sector;
     starSystemsObject = StarSystemObject;
 }
Example #25
0
        private void CreateStars()
        {
            Random rand = new Random();

            for (int i = 0; i < starsAmount; i++)
            {
                StarType starType       = (StarType)rand.Next(1, 6);
                int      starBrightness = rand.Next(1, 6);
                //StarType starType = StarType.Shiny;
                backgroundObjects.Add(new Star(
                                          new Point(rand.Next(1, size.Width), rand.Next(1, size.Height)),
                                          new Point(-rand.Next(1, i + 1), 0),
                                          10, starType, starBrightness));
            }
        }
Example #26
0
        static string StarImage(StarType starType)
        {
            switch (starType)
            {
            default:
            case StarType.Empty:
                return("stare.gif");

            case StarType.Half:
                return("starh.gif");

            case StarType.Full:
                return("starf.gif");
            }
        }
Example #27
0
    void OnStarGet(StarType star)
    {
        if (star != starType)
        {
            return;
        }
        if (!gameObject.activeInHierarchy)
        {
            return;
        }

        image.enabled = true;
        anim.enabled  = true;
        anim.Play(state);
    }
Example #28
0
    public void Initialize(StarType starType)
    {
        Mass = Distribution.GenerateSolarMass();

        Density = 0.1f;

        Radius = CalcRadius(Mass, Density);

        gameObject.layer = LayerMask.NameToLayer("Star");

        if (starType == StarType.DistantStar)
        {
            Destroy(this.GetComponent <Light>());
        }
    }
Example #29
0
        public static SunView3D GetView(StarType starType)
        {
            if (starType >= StarType.Nebula)
            {
                return(null);
            }

            SunView3D sunView;

            if (!_views.TryGetValue(starType, out sunView))
            {
                sunView          = new SunView3D(starType);
                _views[starType] = sunView;
            }

            return(sunView);
        }
Example #30
0
    public void consumeStar(StarType state)
    {
        consumedStar = state;
        currentStar.SetActive(false);
        currentStar = starPrefabs[(int)consumedStar];
        currentStar.SetActive(true);

        ++numOfConsume;
        if (hp <= maxHp)
        {
            hp += 10.0f;
            if (hp > maxHp)
            {
                hp = maxHp;
            }
        }
    }
Example #31
0
 /// <inheritdoc />
 /// <summary>
 ///     Initializes a new instance of the <see cref="T:VisualPlus.Toolkit.Controls.Interactivity.VisualRating" />
 ///     class.
 /// </summary>
 public VisualRating()
 {
     SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer, true);
     _bufferedContext = BufferedGraphicsManager.Current;
     _toggleHalfStar  = true;
     _maximum         = 5;
     _mouseOverIndex  = -1;
     _ratingType      = StarType.Thick;
     _starBrush       = new SolidBrush(Color.Yellow);
     _starDullStroke  = new Pen(Color.Gray, 3f);
     _starDullBrush   = new SolidBrush(Color.Silver);
     _starSpacing     = 1;
     _starStroke      = new Pen(Color.Gold, 3f);
     _starWidth       = 25;
     SetPenBrushDefaults();
     Size = new Size(200, 100);
     UpdateGraphicsBuffer();
 }
Example #32
0
        public void ParseCsv(string[] csv)
        {
            int i = 0;

            // id
            id = csv.GetInt32(i++);
            // 星星类型
            starType = (StarType)csv.GetInt32(i++);
            // 描述
            description = csv.GetString(i++);
            // 进程描述
            processDescription = csv.GetString(i++);
            // 参数
            parameters = csv.GetInt32Array(i++);


            War.model.AddStarConfig(this);
        }
Example #33
0
 // 星星的类型是否一致
 bool IsStarMatchType(int row, int columns, StarType targetType)
 {
     if (starList[row, columns] == null) return false;
     if (starList[row, columns].GetComponent<Star>().type == targetType)
     {
         return true;
     }
     return false;
 }
Example #34
0
        public void SetType(StarType _type)
        {
            type = _type;
            switch (type) {
                case StarType.A:
                    Scale = 4;
                    Colour = new Vector3(0.5f, 1, 0.5f);
                    break;

                case StarType.B:
                    Scale = 6;
                    Colour = new Vector3(0.8f, 0.8f, 1.0f);
                    break;

                case StarType.F:
                    Scale = 1;
                    Colour = new Vector3(1, 1, 1);
                    break;

                case StarType.G:
                    Scale = 0.8f;
                    Colour = new Vector3(1, 1, 0.3f);
                    break;

                case StarType.K:
                    Scale = 0.7f;
                    Colour = new Vector3(1, 0.8f, 0.3f);
                    break;

                case StarType.M:
                    Scale = 0.5f;
                    Colour = new Vector3(1, 0.3f, 0.3f);
                    break;

                case StarType.O:
                    Scale = 10;
                    Colour = new Vector3(0.3f, 0.3f, 1);
                    break;

            }

            glowSize = 30 * Scale;
        }
Example #35
0
 public Star(GraphicsDevice graphics, ContentManager content, StarType starType)
     : this(Vector3.Zero, graphics, content, starType)
 {
 }
Example #36
0
 public Star(Vector3 position, GraphicsDevice graphics, ContentManager content, StarType starType)
 {
     this.Position = position;
     SetType(starType);
     LoadContent(graphics, content);
 }
 public static MvcHtmlString Stars(this HtmlHelper helper, StarType type, double? rating) {
     if (rating.HasValue) {
         var totalWidth = 5*14;
         var starWidth = (int)(rating*14.0);
         return
             new MvcHtmlString(string.Format("<span class='{0}' style='width:{1}px'></span><span style='width:{3}px'></span>",
                                             type,
                                             starWidth,
                                             rating,
                                             totalWidth - starWidth));
     }
     else {
         return
             new MvcHtmlString(string.Format("<span class='{0}' style='width:70px' title='No votes'></span>",
                                             type == StarType.RedSkull ? StarType.WhiteSkull : StarType.WhiteStarSmall));
     }
 }
Example #38
0
        public Star Star_Create(Int32 Galaxy_Id, String name, Decimal radius, Decimal galactic_radius, Decimal speed, StarType type,
            Decimal diameter, Int32 size, Decimal mass)
        {
            Star s = new Star();

            using (var cmd = GetCommand())
            {
                cmd.CommandText = "[dbo].[Star_Create]";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Galaxy_Id", Galaxy_Id);
                cmd.Parameters.AddWithValue("@name", name);
                cmd.Parameters.AddWithValue("@radius", radius);
                cmd.Parameters.AddWithValue("@galactic_radius", galactic_radius);
                cmd.Parameters.AddWithValue("@speed", speed);
                cmd.Parameters.AddWithValue("@type", type.ToString());
                cmd.Parameters.AddWithValue("@diameter", diameter);
                cmd.Parameters.AddWithValue("@size", size);
                cmd.Parameters.AddWithValue("@mass", mass);

                Int32 id = 0;
                SqlParameter param = new SqlParameter("@id", id);
                param.Direction = ParameterDirection.Output;

                cmd.Parameters.Add(param);

                cmd.ExecuteNonQuery();

                id = Convert.ToInt32(param.Value);

                return Star_SelectById(id);

            }

            return s;
        }
Example #39
0
    public void SetLevel(StarType type, int level)
    {
        for (int i = 0; i < transformList.Count; i++)
        {
            UISprite spStar = transformList[i].GetComponent<UISprite>();
            if (spStar != null)
                SetStarImage(type, spStar);

            if (i < level)
                transformList[i].gameObject.SetActive(true);
            else
                transformList[i].gameObject.SetActive(false);
        }
    }