Example #1
0
        void RenderHarv(Sprite sprite)
        {
            sprite.Draw(statusHarvBackground, 405, 580, ColorValue.White);


            int harvHPBarWidth = (int)(statusHPBarBarValue.Width * selectedHarv.HealthValue / selectedHarv.GetProps().HP);
            int harvSTBarWidth = (int)(statusHPBarBarValue.Width * selectedHarv.CurrentStorage / selectedHarv.GetProps().Storage);

            string hpInfo = ((int)selectedHarv.HealthValue).ToString() + "/" + ((int)selectedHarv.GetProps().HP).ToString();
            string stInfo = ((int)selectedHarv.CurrentStorage).ToString() + "/" + ((int)selectedHarv.GetProps().Storage).ToString();


            sprite.Draw(statusHarvBackground, 405, 580, ColorValue.White);

            sprite.Draw(statusHPBarBarValue, new Rectangle(562, 640, harvHPBarWidth, statusHPBarBarValue.Height),
                        new Rectangle(0, 0, harvHPBarWidth, statusHPBarBarValue.Height), ColorValue.White);
            sprite.Draw(statusHPBarBarEdge, 544, 637, ColorValue.White);


            sprite.Draw(statusSTBarBarValue, new Rectangle(679, 672, harvSTBarWidth, statusSTBarBarValue.Height),
                        new Rectangle(0, 0, harvSTBarWidth, statusSTBarBarValue.Height), ColorValue.White);
            sprite.Draw(statusSTBarBarEdge, 661, 666, ColorValue.White);

            Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(715, 667, 0));

            sprite.SetTransform(trans);
            f8.DrawString(sprite, stInfo, 0, 0, ColorValue.White);
            sprite.SetTransform(Matrix.Identity);
        }
Example #2
0
        public override void Render(Sprite sprite)
        {
            if (state != NIGDialogState.Hiding)
            {
                ColorValue overlayColor = ColorValue.Transparent;
                overlayColor.A = (byte)(165 * showPrg);

                sprite.Draw(overlay, 0, 0, overlayColor);


                int x = 442;
                int y = 164;

                float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
                scale = (1.0f / 0.75f) * scale;
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                               Matrix.Scaling(scale, scale, 1) *
                               Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(background, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }
            if (state == NIGDialogState.Showing)
            {
                sprite.Draw(okButton.Image, okButton.X, okButton.Y, ColorValue.White);
                if (okButton.IsMouseOver)
                {
                    sprite.Draw(okButton.Image, okButton.X, okButton.Y - 4, ColorValue.White);
                }

                GameFontManager.Instance.FRuanEdged8.DrawString(sprite, "TRANSFORM 23 CITIES.\nYOU MUST SURVIVE.", 540, 240, ColorValue.White);
            }
        }
Example #3
0
        public override void Render(Sprite sprite)
        {
            if (state != NIGDialogState.Hiding)
            {
                ColorValue overlayColor = ColorValue.Transparent;
                overlayColor.A = (byte)(165 * showPrg);

                sprite.Draw(overlay, 0, 0, overlayColor);


                int x = 461;
                int y = 166;

                float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
                scale = (1.0f / 0.75f) * scale;
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                               Matrix.Scaling(scale, scale, 1) *
                               Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(background, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }
            if (state == NIGDialogState.Showing)
            {
                sprite.Draw(chooseColor, 673, 208, gameLogic.LocalHumanPlayer.SideColor);

                sprite.Draw(okButton.Image, okButton.X, okButton.Y, ColorValue.White);
                if (okButton.IsMouseOver)
                {
                    sprite.Draw(okButton.Image, okButton.X, okButton.Y - 4, ColorValue.White);
                }
            }
        }
Example #4
0
        public void RenderRank(Sprite sprite)
        {
            List <Player> players = new List <Player>();

            for (int i = 0; i < gameLogic.LocalPlayerCount; i++)
            {
                players.Add(gameLogic.GetLocalPlayer(i));
            }

            RankInfo.StatisticRank(players);

            int startX = 543;
            int startY = 160;

            for (int i = 0; i < players.Count; i++)
            {
                if (players[i].Type != PlayerType.LocalHuman)
                {
                    string s = (i + 1).ToString();
                    sprite.Draw(rankBackground, startX, startY, ColorValue.White);
                    f8.DrawString(sprite, s, startX, startY - 20, ColorValue.White);


                    Matrix trans = Matrix.Scaling(0.33f, 0.33f, 1) * Matrix.Translation(new Vector3(startX + 19, startY + 14, 0));
                    sprite.SetTransform(trans);

                    f8.DrawString(sprite, "TH", 0, 0, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);

                    sprite.Draw(rankColor, startX + 35, startY + 9, players[i].SideColor);
                    f8.DrawString(sprite, players[i].Area.CityCount.ToString(), startX + 80, startY - 20, ColorValue.White);
                    startY += 37;
                }
                else
                {
                    string s = (i + 1).ToString();
                    sprite.Draw(homeBackground, startX, startY - 4, players[i].SideColor);
                    f8.DrawString(sprite, s, startX + 2, startY, ColorValue.White);

                    Matrix trans = Matrix.Scaling(0.35f, 0.35f, 1) * Matrix.Translation(new Vector3(startX + 22, startY + 35, 0));
                    sprite.SetTransform(trans);
                    f8.DrawString(sprite, "TH", 0, 0, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);

                    f6.DrawString(sprite, players[i].Area.CityCount.ToString(), startX + 73, startY - 45, ColorValue.White);
                    startY += 70;
                }
            }
        }
Example #5
0
    public override void Logic()
    {
        if (effectTimer.IsDone)
        {
            Remove();
        }

        effectTimer.Logic();

        Color c = defaultColor;

        c.A          = (1f - effectTimer.PercentageDone);
        sprite.Color = c;

        sprite.SetTransform(position, size, TKMath.GetAngle(velocity));

        if (!active)
        {
            return;
        }

        base.Logic();

        velocity.Y -= Stats.defaultStats.Gravity * Game.delta;
        position   += velocity * Game.delta;

        if (map.GetCollision(position, new Vector2(0.01f, 0.01f)))
        {
            active   = false;
            velocity = Vector2.Zero;
        }
    }
Example #6
0
        public override void Render(Sprite sprite)
        {
            sprite.Draw(background, 0, 0, ColorValue.White);

            if (showPrg > 0.5f)
            {
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                               Matrix.Scaling((showPrg - 0.5f) * 2 * 0.8f + 0.2f, 1, 1) *
                               Matrix.Translation(97 + background.Width / 2, 24 + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(panel, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            //int idx = currentPage;
            //if (idx >= TotalPages)
            //    idx = TotalPages - 1;

            if (state == NIGDialogState.Showing)
            {
                sprite.Draw(nextBtn, nextButton.X, nextButton.Y, ColorValue.White);
                if (nextButton.IsMouseOver && !nextButton.IsPressed)
                {
                    sprite.Draw(nextBtn, nextButton.X, nextButton.Y - 1, ColorValue.White);
                }


                sprite.Draw(prevBtn, prevButton.X, prevButton.Y, ColorValue.White);
                if (prevButton.IsMouseOver && !exitButton.IsPressed)
                {
                    sprite.Draw(prevBtn, prevButton.X, prevButton.Y - 1, ColorValue.White);
                }


                sprite.Draw(exitBtn, exitButton.X, exitButton.Y, ColorValue.White);
                if (exitButton.IsMouseOver && !exitButton.IsPressed)
                {
                    sprite.Draw(exitBtn, exitButton.X, exitButton.Y - 3, ColorValue.White);
                }
                sprite.Draw(help[currentPage], 0, 0, ColorValue.White);
            }



            sprite.Draw(cursor, mousePosition.X, mousePosition.Y, ColorValue.White);
        }
Example #7
0
        private void RenderSelectedCityHP(Sprite sprite)
        {
            if (SelectedCity != null)
            {
                float radLng = MathEx.Degree2Radian(SelectedCity.Longitude);
                float radLat = MathEx.Degree2Radian(SelectedCity.Latitude);

                Vector3 tangy = PlanetEarth.GetTangentY(radLng, radLat);
                Vector3 tangx = PlanetEarth.GetTangentX(radLng, radLat);

                Vector3 cityNormal = PlanetEarth.GetNormal(radLng, radLat);
                cityNormal.Normalize();

                Vector3 hpPos = SelectedCity.Position + tangy * 150 + cityNormal * 400;

                Viewport vp        = renderSys.Viewport;
                Vector3  screenPos = vp.Project(hpPos, scene.Camera.ProjectionMatrix,
                                                scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 lp = vp.Project(hpPos + tangx, scene.Camera.ProjectionMatrix,
                                        scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 rp = vp.Project(hpPos - tangx, scene.Camera.ProjectionMatrix,
                                        scene.Camera.ViewMatrix, Matrix.Identity);


                float scale = 1.75f * Vector3.Distance(lp, rp) / 2;

                Matrix trans = Matrix.Translation(-onCityHPBackground.Width / 2, -onCityHPBackground.Height / 2, 0) *
                               Matrix.Scaling(scale, scale, 1) * Matrix.Translation(screenPos.X, screenPos.Y, 0);



                int hpTexWidth = (int)(onCityHPTex.Width * SelectedCity.HPRate);

                sprite.SetTransform(trans);
                sprite.Draw(onCityHPBase, 0, 0, ColorValue.White);
                sprite.Draw(onCityHPTex, new Rectangle(0, 0, hpTexWidth, onCityHPTex.Height),
                            new Rectangle(0, 0, hpTexWidth, onCityHPTex.Height), ColorValue.White);
                sprite.Draw(onCityHPBackground, 0, 0, ColorValue.White);
                f6.DrawString(sprite, SelectedCity.Level.ToString(), 25, -16, ColorValue.White);

                sprite.SetTransform(Matrix.Identity);
            }
        }
Example #8
0
        private void RenderSelectedHarvHP(Sprite sprite)
        {
            if (selectedHarv != null)
            {
                float radLng = (selectedHarv.Longitude);
                float radLat = (selectedHarv.Latitude);

                Vector3 tangy = PlanetEarth.GetTangentY(radLng, radLat);
                Vector3 tangx = PlanetEarth.GetTangentX(radLng, radLat);

                Vector3 cityNormal = PlanetEarth.GetNormal(radLng, radLat);
                cityNormal.Normalize();

                Vector3 hpPos = selectedHarv.Position + tangy * 100;

                Viewport vp        = renderSys.Viewport;
                Vector3  screenPos = vp.Project(hpPos, scene.Camera.ProjectionMatrix,
                                                scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 lp = vp.Project(hpPos + tangx, scene.Camera.ProjectionMatrix,
                                        scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 rp = vp.Project(hpPos - tangx, scene.Camera.ProjectionMatrix,
                                        scene.Camera.ViewMatrix, Matrix.Identity);


                float scale = 1.0f * Vector3.Distance(lp, rp);

                Matrix trans = Matrix.Translation(-harvHPBarBackground.Width / 2, -harvHPBarBackground.Height / 2, 0) *
                               Matrix.Scaling(scale, scale, 1) * Matrix.Translation(screenPos.X, screenPos.Y, 0);



                int hpTexWidth = (int)(harvHPValue.Width * selectedHarv.HPRate);

                sprite.SetTransform(trans);
                sprite.Draw(harvHPBarBackground, 0, 0, ColorValue.White);
                sprite.Draw(harvHPValue, new Rectangle(0, 0, hpTexWidth, harvHPValue.Height),
                            new Rectangle(0, 0, hpTexWidth, harvHPValue.Height), ColorValue.White);
                sprite.Draw(harvHPBorader, 0, 0, ColorValue.White);
                //f6.DrawString(sprite, SelectedCity.Level.ToString(), 25, -16, ColorValue.White);

                sprite.SetTransform(Matrix.Identity);
            }
        }
Example #9
0
        public override void Render(Sprite sprite)
        {
            for (int i = subElements.Count - 1; i >= 0; i--)
            {
                subElements[i].Render(sprite);

                sprite.SetTransform(Matrix.Identity);
            }
        }
Example #10
0
        public override void Render(Sprite sprite)
        {
            for (int i = subElements.Count - 1; i >= 0; i--)
            {
                subElements[i].Render(sprite);

                sprite.SetTransform(Matrix.Identity);
            }
        }
Example #11
0
        public override void Render(Sprite sprite)
        {
            if (state != NIGDialogState.Hiding)
            {
                ColorValue overlayColor = ColorValue.Transparent;
                overlayColor.A = (byte)(165 * showPrg);

                sprite.Draw(overlay, 0, 0, overlayColor);


                int x = 451;
                int y = 157;

                float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
                scale = (1.0f / 0.75f) * scale;
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                               Matrix.Scaling(scale, scale, 1) *
                               Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(background, 0, 0, ColorValue.White);

                sprite.SetTransform(Matrix.Identity);


                sprite.Draw(resumeButton.Image, resumeButton.X, resumeButton.Y, ColorValue.White);
                if (resumeButton.IsMouseOver)
                {
                    sprite.Draw(resumeButton.Image, resumeButton.X, resumeButton.Y - 4, ColorValue.White);
                }

                sprite.Draw(restartButton.Image, restartButton.X, restartButton.Y, ColorValue.White);
                if (restartButton.IsMouseOver)
                {
                    sprite.Draw(restartButton.Image, restartButton.X, restartButton.Y - 4, ColorValue.White);
                }

                sprite.Draw(exitButton.Image, exitButton.X, exitButton.Y, ColorValue.White);
                if (exitButton.IsMouseOver)
                {
                    sprite.Draw(exitButton.Image, exitButton.X, exitButton.Y - 4, ColorValue.White);
                }
            }
        }
Example #12
0
    public EffectBaseHit(SYBase b, float size, Map m)
        : base(m)
    {
        size = MathHelper.Clamp(size, 0.2f, 2f);

        sprite = new Sprite(b.sprite.Texture);
        sprite.SetTransform(b.sprite.Position, b.sprite.Scale * 1.1f, b.sprite.Rotation);

        effectTimer.Reset(size / 7f);
    }
Example #13
0
        public override void Render(Sprite sprite)
        {
            float d = 3 * time / duration;

            d = d - (float)Math.Truncate(d);

            float alpha = MathEx.Saturate(1 - d);


            ColorValue modClr = modColor;// new ColorValue(1, 1, 1, alpha);

            modClr.A = (byte)(byte.MaxValue * alpha);


            float scale = 5 - 4 * alpha;

            sprite.SetTransform(Matrix.Translation(-texture.Width / 2, -texture.Height / 2, 0) * Matrix.Scaling(scale, scale, scale) * Matrix.Translation(x, y, 0));
            sprite.Draw(texture, 0, 0, modClr);
            sprite.SetTransform(Matrix.Identity);
        }
Example #14
0
        void RenderGreen(Sprite sprite)
        {
            sprite.Draw(statusGreenBackground, 405, 580, ColorValue.White);
            ForestObject oil = (ForestObject)selectedResource;
            {
                int hp     = (int)oil.CurrentAmount;
                int hpFull = (int)(oil.MaxAmount);

                int hpTexWidth = (int)(statusGreenBarValue.Width * (oil.CurrentAmount / oil.MaxAmount));
                sprite.Draw(statusGreenBarValue, new Rectangle(598, 615, hpTexWidth, statusGreenBarValue.Height),
                            new Rectangle(0, 0, hpTexWidth, statusGreenBarValue.Height), ColorValue.White);
                sprite.Draw(statusGreenBarEdge, 580, 600, ColorValue.White);

                string hpInfo = hp.ToString() + "/" + hpFull.ToString();

                Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(680, 624, 0));
                sprite.SetTransform(trans);
                f8.DrawString(sprite, hpInfo, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }
        }
Example #15
0
        private void RenderSendBall(Sprite sprite)
        {
            if (targetCity != null)
            {
                float radLng = MathEx.Degree2Radian(targetCity.Longitude);
                float radLat = MathEx.Degree2Radian(targetCity.Latitude);

                float lngSign = Math.Sign(radLng);

                Vector3 tangy = PlanetEarth.GetTangentY(radLng, radLat);
                Vector3 tangx = PlanetEarth.GetTangentX(radLng, radLat);


                Vector3 cityNormal = PlanetEarth.GetNormal(radLng, radLat);
                cityNormal.Normalize();

                Vector3 hpPos = targetCity.Position + cityNormal * 100 + tangx * (lngSign * City.CityRadius * 0.55f);

                Viewport vp        = renderSys.Viewport;
                Vector3  screenPos = vp.Project(hpPos, scene.Camera.ProjectionMatrix,
                                                scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 lp = vp.Project(hpPos + tangx, scene.Camera.ProjectionMatrix,
                                        scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 rp = vp.Project(hpPos - tangx, scene.Camera.ProjectionMatrix,
                                        scene.Camera.ViewMatrix, Matrix.Identity);


                float scale0 = MathEx.Saturate(1.5f * Vector3.Distance(lp, rp));
                float scale  = (animProgress * animProgress) * scale0;

                Matrix trans = Matrix.Translation(0, -background.Height / 2, 0) *
                               Matrix.Scaling(scale, scale, 1) * Matrix.Translation(screenPos.X, screenPos.Y, 0);



                sprite.SetTransform(trans);

                if (selectedIndex == -1)
                {
                    sprite.Draw(background, 0, 0, ColorValue.White);
                }
                else
                {
                    sprite.Draw(backgroundSelected[selectedIndex], 0, 0, ColorValue.White);
                }
                UpdateHotarea(ref trans);

                if (state == State.Opened)
                {
                    Matrix trans2 = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                                    Matrix.Scaling(scale0, scale0, 1) * Matrix.Translation(screenPos.X, screenPos.Y, 0);

                    sprite.SetTransform(trans2);

                    RenderBallIcon(sprite);
                }

                sprite.SetTransform(Matrix.Identity);
            }
        }
Example #16
0
        public override void Render(Sprite sprite)
        {
            if (state != NIGDialogState.Hiding)
            {
                ColorValue overlayColor = ColorValue.Transparent;
                overlayColor.A = (byte)(165 * showPrg);

                sprite.Draw(overlay, 0, 0, overlayColor);


                int x = 442;
                int y = 164;

                float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
                scale = (1.0f / 0.75f) * scale;
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                    Matrix.Scaling(scale, scale, 1) *
                    Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(background, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);


            }
            if (state == NIGDialogState.Showing)
            {
               
                sprite.Draw(okButton.Image, okButton.X, okButton.Y, ColorValue.White);
                if (okButton.IsMouseOver)
                {
                    sprite.Draw(okButton.Image, okButton.X, okButton.Y - 4, ColorValue.White);
                }

                GameFontManager.Instance.FRuanEdged8.DrawString(sprite, "TRANSFORM 23 CITIES.\nYOU MUST SURVIVE.", 540, 240, ColorValue.White);
            }
        }
Example #17
0
        private void RenderBallIcon(Sprite sprite)
        {
            if (selectCity != null && selectCity.Owner == player)
            {
                //Array.Sort(resBallsCount, BallRecordCompare);

                int left = 0;
                for (int i = 0; i < resBallsCount.Length; i++)
                {
                    RBallType ballType     = resBallsCount[i].Type;
                    bool      overrideDraw = selectCity.CanProduceProduction() ? (ballType == selectCity.GetProductionType()) : false;
                    //resBallsCount[i].Type == selectCity.GetProductionType()
                    switch (ballType)
                    {
                    case RBallType.Green:
                    {
                        if (resBallsCount[i].count != 0 || overrideDraw)
                        {
                            if (selectCity.CanProduceProduction() && selectCity.GetProductionType() == RBallType.Green)
                            {
                                if (selectCity.IsFull())
                                {
                                    sprite.Draw(statusMaxBalls, 651 + 69 * left, 723 - statusMaxBalls.Height, ColorValue.White);
                                }
                                else
                                {
                                    int height = (int)(selectCity.GetProductionProgress() * statusProducePrgTex.Height);


                                    sprite.Draw(statusProducePrgTex, new Rectangle(651 + 69 * left, 723 - height, statusProducePrgTex.Width, height),
                                                new Rectangle(0, statusProducePrgTex.Height - height, statusProducePrgTex.Width, height), ColorValue.White);
                                }
                            }

                            int x = 687 + 69 * left - greenBallTex.Width / 2;
                            int y = 692 - greenBallTex.Height / 2;
                            sprite.Draw(greenBallTex, x, y, ColorValue.White);
                            Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) *
                                           Matrix.Translation(new Vector3(x + 45 - f8.MeasureString(resBallsCount[i].count.ToString()).Width, y + 18, 0));
                            sprite.SetTransform(trans);
                            f8.DrawString(sprite, resBallsCount[i].count.ToString(), 0, 0, ColorValue.White);
                            sprite.SetTransform(Matrix.Identity);
                            left++;
                        }
                    }
                    break;

                    case RBallType.Education:
                    {
                        if (resBallsCount[i].count != 0 || overrideDraw)
                        {
                            if (selectCity.CanProduceProduction() && selectCity.GetProductionType() == RBallType.Education)
                            {
                                if (selectCity.IsFull())
                                {
                                    sprite.Draw(statusMaxBalls, 651 + 69 * left, 723 - statusMaxBalls.Height, ColorValue.White);
                                }
                                else
                                {
                                    int height = (int)(selectCity.GetProductionProgress() * statusProducePrgTex.Height);


                                    sprite.Draw(statusProducePrgTex, new Rectangle(651 + 69 * left, 723 - height, statusProducePrgTex.Width, height),
                                                new Rectangle(0, statusProducePrgTex.Height - height, statusProducePrgTex.Width, height), ColorValue.White);
                                }
                            }

                            int x = 687 + 69 * left - educationBallTex.Width / 2;
                            int y = 692 - educationBallTex.Height / 2;
                            sprite.Draw(educationBallTex, x, y, ColorValue.White);
                            Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) *
                                           Matrix.Translation(new Vector3(x + 45 - f8.MeasureString(resBallsCount[i].count.ToString()).Width, y + 18, 0));
                            sprite.SetTransform(trans);
                            f8.DrawString(sprite, resBallsCount[i].count.ToString(), 0, 0, ColorValue.White);
                            sprite.SetTransform(Matrix.Identity);


                            left++;
                        }
                    }
                    break;

                    case RBallType.Health:
                    {
                        if (resBallsCount[i].count != 0 || overrideDraw)
                        {
                            if (selectCity.CanProduceProduction() && selectCity.GetProductionType() == RBallType.Health)
                            {
                                if (selectCity.IsFull())
                                {
                                    sprite.Draw(statusMaxBalls, 651 + 69 * left, 723 - statusMaxBalls.Height, ColorValue.White);
                                }
                                else
                                {
                                    int height = (int)(selectCity.GetProductionProgress() * statusProducePrgTex.Height);


                                    sprite.Draw(statusProducePrgTex, new Rectangle(651 + 69 * left, 723 - height, statusProducePrgTex.Width, height),
                                                new Rectangle(0, statusProducePrgTex.Height - height, statusProducePrgTex.Width, height), ColorValue.White);
                                }
                            }

                            int x = 687 + 69 * left - healthBallTex.Width / 2;
                            int y = 692 - healthBallTex.Height / 2;
                            sprite.Draw(healthBallTex, x, y, ColorValue.White);
                            Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) *
                                           Matrix.Translation(new Vector3(x + 45 - f8.MeasureString(resBallsCount[i].count.ToString()).Width, y + 18, 0));
                            sprite.SetTransform(trans);
                            f8.DrawString(sprite, resBallsCount[i].count.ToString(), 0, 0, ColorValue.White);
                            sprite.SetTransform(Matrix.Identity);
                            left++;
                        }
                    }
                    break;
                    }
                }
            }
        }
Example #18
0
        public void RenderRank(Sprite sprite)
        {
            List<Player> players = new List<Player>();
            for (int i = 0; i < gameLogic.LocalPlayerCount; i++)
                players.Add(gameLogic.GetLocalPlayer(i));

            RankInfo.StatisticRank(players);

            int startX = 543;
            int startY = 160;

            for (int i = 0; i < players.Count; i++)
            {
                if (players[i].Type != PlayerType.LocalHuman)
                {
                    string s = (i + 1).ToString();
                    sprite.Draw(rankBackground, startX, startY, ColorValue.White);
                    f8.DrawString(sprite, s, startX, startY - 20, ColorValue.White);


                    Matrix trans = Matrix.Scaling(0.33f, 0.33f, 1) * Matrix.Translation(new Vector3(startX + 19, startY + 14, 0));
                    sprite.SetTransform(trans);

                    f8.DrawString(sprite, "TH", 0, 0, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);

                    sprite.Draw(rankColor, startX + 35, startY + 9, players[i].SideColor);
                    f8.DrawString(sprite, players[i].Area.CityCount.ToString(), startX + 80, startY - 20, ColorValue.White);
                    startY += 37;
                }
                else
                {
                    string s = (i + 1).ToString();
                    sprite.Draw(homeBackground, startX, startY - 4, players[i].SideColor);
                    f8.DrawString(sprite, s, startX + 2, startY, ColorValue.White);

                    Matrix trans = Matrix.Scaling(0.35f, 0.35f, 1) * Matrix.Translation(new Vector3(startX + 22, startY + 35, 0));
                    sprite.SetTransform(trans);
                    f8.DrawString(sprite, "TH", 0, 0, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);

                    f6.DrawString(sprite, players[i].Area.CityCount.ToString(), startX + 73, startY - 45, ColorValue.White);
                    startY += 70;
                }
            }
        }
Example #19
0
        private void RenderSelectedHarvHP(Sprite sprite)
        {
            if (selectedHarv != null)
            {
                float radLng = (selectedHarv.Longitude);
                float radLat = (selectedHarv.Latitude);

                Vector3 tangy = PlanetEarth.GetTangentY(radLng, radLat);
                Vector3 tangx = PlanetEarth.GetTangentX(radLng, radLat);

                Vector3 cityNormal = PlanetEarth.GetNormal(radLng, radLat);
                cityNormal.Normalize();

                Vector3 hpPos = selectedHarv.Position + tangy * 100;

                Viewport vp = renderSys.Viewport;
                Vector3 screenPos = vp.Project(hpPos, scene.Camera.ProjectionMatrix,
                                               scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 lp = vp.Project(hpPos + tangx, scene.Camera.ProjectionMatrix,
                                                       scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 rp = vp.Project(hpPos - tangx, scene.Camera.ProjectionMatrix,
                                                       scene.Camera.ViewMatrix, Matrix.Identity);


                float scale = 1.0f * Vector3.Distance(lp, rp);

                Matrix trans = Matrix.Translation(-harvHPBarBackground.Width / 2, -harvHPBarBackground.Height / 2, 0) *
                           Matrix.Scaling(scale, scale, 1) * Matrix.Translation(screenPos.X, screenPos.Y, 0);



                int hpTexWidth = (int)(harvHPValue.Width * selectedHarv.HPRate);

                sprite.SetTransform(trans);
                sprite.Draw(harvHPBarBackground, 0, 0, ColorValue.White);
                sprite.Draw(harvHPValue, new Rectangle(0, 0, hpTexWidth, harvHPValue.Height),
                    new Rectangle(0, 0, hpTexWidth, harvHPValue.Height), ColorValue.White);
                sprite.Draw(harvHPBorader, 0, 0, ColorValue.White);
                //f6.DrawString(sprite, SelectedCity.Level.ToString(), 25, -16, ColorValue.White);

                sprite.SetTransform(Matrix.Identity);



            }
        }
Example #20
0
        public override void Render(Sprite sprite)
        {
            sprite.Draw(bg, 0, 0, ColorValue.White);

            //int panelHeight = 538;
            //int h = (int)(roll * (list.Height + panelHeight));

            //if (h < panelHeight)
            //{
            //    Rectangle drect = new Rectangle(658, 46 + panelHeight - h, list.Width, h);
            //    Rectangle srect = new Rectangle(0, 0, list.Width, h);
            //    sprite.Draw(list, drect, srect, ColorValue.White);
            //}
            //else if (h > list.Height - panelHeight)
            //{
            //    Rectangle drect = new Rectangle(658, 46, list.Width, list.Height * 2 - h + panelHeight);
            //    Rectangle srect = new Rectangle(0, h - panelHeight, list.Width, list.Height * 2 - h + panelHeight);
            //    sprite.Draw(list, drect, srect, ColorValue.White);
            //}

            if (ruanProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(ruanProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                                   Matrix.Translation(179 + crdRuan.Width / 2, 292 + crdRuan.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdRuan, -crdRuan.Width / 2, -crdRuan.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }


            if (zjProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(zjProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                                   Matrix.Translation(701 + crdZj.Width / 2, 465 + crdZj.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdZj, -crdZj.Width / 2, -crdZj.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            if (xinProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(xinProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                                   Matrix.Translation(230 + crdXin.Width / 2, 460 + crdXin.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdXin, -crdXin.Width / 2, -crdXin.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            if (ybProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(ybProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                                   Matrix.Translation(695 + crdYb.Width / 2, 288 + crdYb.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdYb, -crdYb.Width / 2, -crdYb.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            if (musicProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(musicProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                                   Matrix.Translation(218 + crdMusic.Width / 2, 649 + crdMusic.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdMusic, -crdMusic.Width / 2, -crdMusic.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }


            sprite.Draw(backBtn.Image, backBtn.X, backBtn.Y, ColorValue.White);
            if (backBtn.IsMouseOver)
            {
                sprite.Draw(backBtn.Image, backBtn.X, backBtn.Y - 4, ColorValue.White);
            }

            sprite.Draw(cursor, mousePosition.X, mousePosition.Y, ColorValue.White);
        }
Example #21
0
        private void RenderCityStatus(Sprite sprite)
        {
            if (selectCity != null)
            {

                int hp = (int)selectCity.HealthValue;
                int hpFull = (int)(selectCity.HealthValue / selectCity.HPRate);
                int level = selectCity.Level;
                string name = selectCity.Name;


                if (selectCity.Owner == player)
                {
                    sprite.Draw(statusBackground, 405, 580, ColorValue.White);
                }
                else
                {
                    sprite.Draw(statusEnemyBackground, 405, 580, ColorValue.White);
                }

                
                if (isHPBuffer)
                {
                    Matrix buffScale = Matrix.Scaling(new Vector3(0.1f * (float)Math.Sin(buffWave) + 1));
                    buffScale.TranslationValue = new Vector3(776 + statusHPBufferTex.Width / 2, 624 + statusHPBufferTex.Height / 2, 0);

                    sprite.SetTransform(buffScale);
                    sprite.Draw(statusHPBufferTex, -statusHPBufferTex.Width / 2, -statusHPBufferTex.Height / 2, ColorValue.White);

                }
                if (isExpBuffer)
                {
                    Matrix buffScale = Matrix.Scaling(new Vector3(0.1f * (float)Math.Sin(buffWave) + 1));
                    buffScale.TranslationValue = new Vector3(802 + statusExpBuffTex.Width / 2, 624 + statusExpBuffTex.Height / 2, 0);

                    sprite.SetTransform(buffScale);
                    sprite.Draw(statusExpBuffTex, -statusExpBuffTex.Width / 2, -statusExpBuffTex.Height / 2, ColorValue.White);
                }
                if (isDownShow)
                {
                    Matrix buffScale = Matrix.Scaling(new Vector3(0.1f * (float)Math.Sin(buffWave) + 1));
                    buffScale.TranslationValue = new Vector3(839 + statusExpdownBuff.Width / 2, 622 + statusExpdownBuff.Height / 2, 0);

                    sprite.SetTransform(buffScale);
                    sprite.Draw(statusExpdownBuff, -statusExpdownBuff.Width / 2, -statusExpdownBuff.Height / 2, ColorValue.White);
                }
                sprite.SetTransform(Matrix.Identity);

                f6.DrawString(sprite, selectCity.Name.ToUpperInvariant(), 456, 572, ColorValue.White);
                f6.DrawString(sprite, level.ToString().ToUpperInvariant(), 775, 570, ColorValue.White);

                //画资源球图标                                
                int hpTexWidth = (int)(statusHPTex.Width * SelectedCity.HPRate);
                string hpInfo = hp.ToString() + "/" + hpFull.ToString();

                int expTexWidth = (int)(statusExpTex.Width * selectCity.LevelEP);
                string expInfo = "EXP " + ((int)(selectCity.LevelEP * 100)).ToString() + "/100";

                //HP
                sprite.Draw(statusHPTex, new Rectangle(505, 638, hpTexWidth, statusHPTex.Height),
                    new Rectangle(0, 0, hpTexWidth, statusHPTex.Height), ColorValue.White);
                sprite.Draw(statusHPBackground, 506, 640, ColorValue.White);

                if (selectCity.Owner == player)
                {
                    Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(579, 638, 0));
                    sprite.SetTransform(trans);
                    f8.DrawString(sprite, hpInfo, 0, 0, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);

                    //EXP
                    sprite.Draw(statusExpTex, new Rectangle(578, 624, expTexWidth, statusExpTex.Height),
                        new Rectangle(0, 0, expTexWidth, statusExpTex.Height), ColorValue.White);
                    sprite.Draw(statusExpBackground, 579, 624, ColorValue.White);


                    trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(635, 620, 0));
                    sprite.SetTransform(trans);
                    f8.DrawString(sprite, expInfo, 0, 0, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);
                }
            }
        }
Example #22
0
        public override void Render(Sprite sprite)
        {
            float d = 3 * time / duration;

            d = d - (float)Math.Truncate(d);

            float alpha = MathEx.Saturate(1 - d);


            ColorValue modClr = modColor;// new ColorValue(1, 1, 1, alpha);
            modClr.A = (byte)(byte.MaxValue * alpha);


            float scale = 5 - 4 * alpha;
            sprite.SetTransform(Matrix.Translation(-texture.Width / 2, -texture.Height / 2, 0) * Matrix.Scaling(scale, scale, scale) * Matrix.Translation(x, y, 0));
            sprite.Draw(texture, 0, 0, modClr);
            sprite.SetTransform(Matrix.Identity);
        }
Example #23
0
        private void RenderCityStatus(Sprite sprite)
        {
            if (selectCity != null)
            {
                int    hp     = (int)selectCity.HealthValue;
                int    hpFull = (int)(selectCity.HealthValue / selectCity.HPRate);
                int    level  = selectCity.Level;
                string name   = selectCity.Name;


                if (selectCity.Owner == player)
                {
                    sprite.Draw(statusBackground, 405, 580, ColorValue.White);
                }
                else
                {
                    sprite.Draw(statusEnemyBackground, 405, 580, ColorValue.White);
                }


                if (isHPBuffer)
                {
                    Matrix buffScale = Matrix.Scaling(new Vector3(0.1f * (float)Math.Sin(buffWave) + 1));
                    buffScale.TranslationValue = new Vector3(776 + statusHPBufferTex.Width / 2, 624 + statusHPBufferTex.Height / 2, 0);

                    sprite.SetTransform(buffScale);
                    sprite.Draw(statusHPBufferTex, -statusHPBufferTex.Width / 2, -statusHPBufferTex.Height / 2, ColorValue.White);
                }
                if (isExpBuffer)
                {
                    Matrix buffScale = Matrix.Scaling(new Vector3(0.1f * (float)Math.Sin(buffWave) + 1));
                    buffScale.TranslationValue = new Vector3(802 + statusExpBuffTex.Width / 2, 624 + statusExpBuffTex.Height / 2, 0);

                    sprite.SetTransform(buffScale);
                    sprite.Draw(statusExpBuffTex, -statusExpBuffTex.Width / 2, -statusExpBuffTex.Height / 2, ColorValue.White);
                }
                if (isDownShow)
                {
                    Matrix buffScale = Matrix.Scaling(new Vector3(0.1f * (float)Math.Sin(buffWave) + 1));
                    buffScale.TranslationValue = new Vector3(839 + statusExpdownBuff.Width / 2, 622 + statusExpdownBuff.Height / 2, 0);

                    sprite.SetTransform(buffScale);
                    sprite.Draw(statusExpdownBuff, -statusExpdownBuff.Width / 2, -statusExpdownBuff.Height / 2, ColorValue.White);
                }
                sprite.SetTransform(Matrix.Identity);

                f6.DrawString(sprite, selectCity.Name.ToUpperInvariant(), 456, 572, ColorValue.White);
                f6.DrawString(sprite, level.ToString().ToUpperInvariant(), 775, 570, ColorValue.White);

                //画资源球图标
                int    hpTexWidth = (int)(statusHPTex.Width * SelectedCity.HPRate);
                string hpInfo     = hp.ToString() + "/" + hpFull.ToString();

                int    expTexWidth = (int)(statusExpTex.Width * selectCity.LevelEP);
                string expInfo     = "EXP " + ((int)(selectCity.LevelEP * 100)).ToString() + "/100";

                //HP
                sprite.Draw(statusHPTex, new Rectangle(505, 638, hpTexWidth, statusHPTex.Height),
                            new Rectangle(0, 0, hpTexWidth, statusHPTex.Height), ColorValue.White);
                sprite.Draw(statusHPBackground, 506, 640, ColorValue.White);

                if (selectCity.Owner == player)
                {
                    Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(579, 638, 0));
                    sprite.SetTransform(trans);
                    f8.DrawString(sprite, hpInfo, 0, 0, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);

                    //EXP
                    sprite.Draw(statusExpTex, new Rectangle(578, 624, expTexWidth, statusExpTex.Height),
                                new Rectangle(0, 0, expTexWidth, statusExpTex.Height), ColorValue.White);
                    sprite.Draw(statusExpBackground, 579, 624, ColorValue.White);


                    trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(635, 620, 0));
                    sprite.SetTransform(trans);
                    f8.DrawString(sprite, expInfo, 0, 0, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);
                }
            }
        }
Example #24
0
        public override void Render(Sprite sprite)
        {
            if (state != NIGDialogState.Hiding)
            {
                ColorValue overlayColor = ColorValue.Transparent;
                overlayColor.A = (byte)(165 * showPrg);

                sprite.Draw(overlay, 0, 0, overlayColor);


                int x = 373;
                int y = 54;

                float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
                scale = (1.0f / 0.75f) * scale;
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                               Matrix.Scaling(scale, scale, 1) *
                               Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(background, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }
            if (state == NIGDialogState.Showing)
            {
                if (clearProgress > 1)
                {
                    float scale = -MathEx.Sqr(MathEx.Saturate(1 * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                                   Matrix.Translation(668 + clearTex.Width / 2, 57 + clearTex.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(clearTex, -clearTex.Width / 2, -clearTex.Height / 2, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);
                }

                if (clearProgress <= 1)
                {
                    float scale = -MathEx.Sqr(MathEx.Saturate(clearProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                                   Matrix.Translation(668 + clearTex.Width / 2, 57 + clearTex.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(clearTex, -clearTex.Width / 2, -clearTex.Height / 2, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);
                    //sprite.Draw(clearTex, 668, 57, ColorValue.White);
                }


                sprite.Draw(backButton.Image, backButton.X, backButton.Y, ColorValue.White);
                if (backButton.IsMouseOver)
                {
                    sprite.Draw(backButton.Image, backButton.X, backButton.Y - 4, ColorValue.White);
                }

                sprite.Draw(nextButton.Image, nextButton.X, nextButton.Y, ColorValue.White);
                if (nextButton.IsMouseOver)
                {
                    sprite.Draw(nextButton.Image, nextButton.X, nextButton.Y - 4, ColorValue.White);
                }

                sprite.Draw(replayButton.Image, replayButton.X, replayButton.Y, ColorValue.White);
                if (replayButton.IsMouseOver)
                {
                    sprite.Draw(replayButton.Image, replayButton.X, replayButton.Y - 4, ColorValue.White);
                }

                RenderRank(sprite);
            }
        }
Example #25
0
        public override void Render(Sprite sprite)
        {
            sprite.SetTransform(Matrix.Identity);

            sprite.Draw(background, 0, 0, ColorValue.White);
            sprite.Draw(waterTex, 0, 0, ColorValue.White);
            sprite.Draw(mapTex, 0, 0, ColorValue.White);
            //sprite.Draw(rolesTex, 258, 75, ColorValue.White);
            sprite.Draw(boarderTex, 0, 0, ColorValue.White);

            float rolescale = -MathEx.Sqr(MathEx.Saturate(rolesProgress * 6) * 1.5f - 1) + 1;

            rolescale = (1.0f / 0.75f) * rolescale;
            Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                               Matrix.Translation(258 + rolesTex.Width / 2, 75 + rolesTex.Height / 2, 0);

            sprite.SetTransform(roletrans);
            sprite.Draw(rolesTex, -rolesTex.Width / 2, -rolesTex.Height / 2, ColorValue.White);
            sprite.SetTransform(Matrix.Identity);


            if (logoProgress > 0)
            {
                float logoScale = -MathEx.Sqr(MathEx.Saturate(logoProgress * 6) * 1.5f - 1) + 1;
                logoScale = (1.0f / 0.75f) * logoScale;
                Matrix logoTrans = Matrix.Scaling(logoScale, logoScale, 1) *
                                   Matrix.Translation(31 + logo.Width / 2, 29 + logo.Height / 2, 0);
                Rectangle rect = new Rectangle(-logo.Width / 2, -logo.Height / 2, 554 - 31, 315 - 28);
                sprite.SetTransform(logoTrans);
                sprite.Draw(logo, rect, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            if (logoProgress >= 0.67f)
            {
                if (startButton.IsMouseOver)
                {
                    // y=-(x-1)^2+1
                    float scale = -MathEx.Sqr(MathEx.Saturate(startProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                                   Matrix.Translation(startButton.X + start.Width / 2, startButton.Y + start.Height / 2, 0);
                    //sprite.Draw(start, startButton.X, startButton.Y, ColorValue.Yellow);
                    sprite.SetTransform(trans);
                    sprite.Draw(start, -start.Width / 2, -start.Height / 2, ColorValue.Yellow);
                    sprite.SetTransform(Matrix.Identity);
                }
                else
                {
                    sprite.Draw(start, startButton.X, startButton.Y, ColorValue.White);
                }


                if (helpButton.IsMouseOver)
                {
                    //  sprite.Draw(help, helpButton.X, helpButton.Y, ColorValue.Yellow);
                    float scale = -MathEx.Sqr(MathEx.Saturate(helpProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                                   Matrix.Translation(helpButton.X + help.Width / 2, helpButton.Y + help.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(help, -help.Width / 2, -help.Height / 2, ColorValue.Yellow);
                    sprite.SetTransform(Matrix.Identity);
                }
                else
                {
                    sprite.Draw(help, helpButton.X, helpButton.Y, ColorValue.White);
                }

                if (exitButton.IsMouseOver)
                {
                    //sprite.Draw(exit, exitButton.X, exitButton.Y, ColorValue.Yellow);
                    float scale = -MathEx.Sqr(MathEx.Saturate(exitProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                                   Matrix.Translation(exitButton.X + exit.Width / 2, exitButton.Y + exit.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(exit, -help.Width / 2, -exit.Height / 2, ColorValue.Yellow);
                    sprite.SetTransform(Matrix.Identity);
                }
                else
                {
                    sprite.Draw(exit, exitButton.X, exitButton.Y, ColorValue.White);
                }

                if (creditButton.IsMouseOver)
                {
                    //sprite.Draw(credits, creditButton.X, creditButton.Y, ColorValue.Yellow);
                    float scale = -MathEx.Sqr(MathEx.Saturate(creditProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                                   Matrix.Translation(creditButton.X + credits.Width / 2, creditButton.Y + credits.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(credits, -credits.Width / 2, -credits.Height / 2, ColorValue.Yellow);
                    sprite.SetTransform(Matrix.Identity);
                }
                else
                {
                    sprite.Draw(credits, creditButton.X, creditButton.Y, ColorValue.White);
                }


                //if (parent.NextScreen == null)
                {
                    sprite.Draw(cursor, mousePosition.X, mousePosition.Y, ColorValue.White);
                }
            }
        }
Example #26
0
        public override void Render(Sprite sprite)
        {
            sprite.Draw(bg, 0, 0, ColorValue.White);

            //int panelHeight = 538;
            //int h = (int)(roll * (list.Height + panelHeight));

            //if (h < panelHeight)
            //{
            //    Rectangle drect = new Rectangle(658, 46 + panelHeight - h, list.Width, h);
            //    Rectangle srect = new Rectangle(0, 0, list.Width, h);
            //    sprite.Draw(list, drect, srect, ColorValue.White);
            //}
            //else if (h > list.Height - panelHeight)
            //{
            //    Rectangle drect = new Rectangle(658, 46, list.Width, list.Height * 2 - h + panelHeight);
            //    Rectangle srect = new Rectangle(0, h - panelHeight, list.Width, list.Height * 2 - h + panelHeight);
            //    sprite.Draw(list, drect, srect, ColorValue.White);
            //}

            if (ruanProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(ruanProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                        Matrix.Translation(179 + crdRuan.Width / 2, 292 + crdRuan.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdRuan, -crdRuan.Width / 2, -crdRuan.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }


            if (zjProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(zjProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                        Matrix.Translation(701 + crdZj.Width / 2, 465 + crdZj.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdZj, -crdZj.Width / 2, -crdZj.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            if (xinProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(xinProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                        Matrix.Translation(230 + crdXin.Width / 2, 460 + crdXin.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdXin, -crdXin.Width / 2, -crdXin.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            if (ybProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(ybProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                        Matrix.Translation(695 + crdYb.Width / 2, 288 + crdYb.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdYb, -crdYb.Width / 2, -crdYb.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            if (musicProgress > 0)
            {
                float rolescale = -MathEx.Sqr(MathEx.Saturate(musicProgress * 6) * 1.5f - 1) + 1;
                rolescale = (1.0f / 0.75f) * rolescale;
                Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                        Matrix.Translation(218 + crdMusic.Width / 2, 649 + crdMusic.Height / 2, 0);
                sprite.SetTransform(roletrans);
                sprite.Draw(crdMusic, -crdMusic.Width / 2, -crdMusic.Height / 2, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

       
            sprite.Draw(backBtn.Image, backBtn.X, backBtn.Y, ColorValue.White);
            if (backBtn.IsMouseOver)
            {
                sprite.Draw(backBtn.Image, backBtn.X, backBtn.Y - 4, ColorValue.White);
            }
            
            sprite.Draw(cursor, mousePosition.X, mousePosition.Y, ColorValue.White);
        }
Example #27
0
        public override void Render(Sprite sprite)
        {
            sprite.SetTransform(Matrix.Identity);

            sprite.Draw(background, 0, 0, ColorValue.White);
            sprite.Draw(waterTex, 0, 0, ColorValue.White);
            sprite.Draw(mapTex, 0, 0, ColorValue.White);
            //sprite.Draw(rolesTex, 258, 75, ColorValue.White);      
            sprite.Draw(boarderTex, 0, 0, ColorValue.White);

            float rolescale = -MathEx.Sqr(MathEx.Saturate(rolesProgress * 6) * 1.5f - 1) + 1;
            rolescale = (1.0f / 0.75f) * rolescale;
            Matrix roletrans = Matrix.Scaling(rolescale, rolescale, 1) *
                    Matrix.Translation(258 + rolesTex.Width / 2, 75 + rolesTex.Height / 2, 0);
            sprite.SetTransform(roletrans);
            sprite.Draw(rolesTex, -rolesTex.Width / 2, -rolesTex.Height / 2, ColorValue.White);
            sprite.SetTransform(Matrix.Identity);


            if (logoProgress > 0)
            {
                float logoScale = -MathEx.Sqr(MathEx.Saturate(logoProgress * 6) * 1.5f - 1) + 1;
                logoScale = (1.0f / 0.75f) * logoScale;
                Matrix logoTrans = Matrix.Scaling(logoScale, logoScale, 1) *
                        Matrix.Translation(31 + logo.Width / 2, 29 + logo.Height / 2, 0);
                Rectangle rect = new Rectangle(-logo.Width / 2, -logo.Height / 2, 554 - 31, 315 - 28);
                sprite.SetTransform(logoTrans);
                sprite.Draw(logo, rect, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            if (logoProgress >= 0.67f)
            {
                if (startButton.IsMouseOver)
                {
                    // y=-(x-1)^2+1
                    float scale = -MathEx.Sqr(MathEx.Saturate(startProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                        Matrix.Translation(startButton.X + start.Width / 2, startButton.Y + start.Height / 2, 0);
                    //sprite.Draw(start, startButton.X, startButton.Y, ColorValue.Yellow);
                    sprite.SetTransform(trans);
                    sprite.Draw(start, -start.Width / 2, -start.Height / 2, ColorValue.Yellow);
                    sprite.SetTransform(Matrix.Identity);
                }
                else
                {
                    sprite.Draw(start, startButton.X, startButton.Y, ColorValue.White);
                }


                if (helpButton.IsMouseOver)
                {
                    //  sprite.Draw(help, helpButton.X, helpButton.Y, ColorValue.Yellow);
                    float scale = -MathEx.Sqr(MathEx.Saturate(helpProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                        Matrix.Translation(helpButton.X + help.Width / 2, helpButton.Y + help.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(help, -help.Width / 2, -help.Height / 2, ColorValue.Yellow);
                    sprite.SetTransform(Matrix.Identity);
                }
                else
                {
                    sprite.Draw(help, helpButton.X, helpButton.Y, ColorValue.White);
                }

                if (exitButton.IsMouseOver)
                {
                    //sprite.Draw(exit, exitButton.X, exitButton.Y, ColorValue.Yellow);
                    float scale = -MathEx.Sqr(MathEx.Saturate(exitProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                        Matrix.Translation(exitButton.X + exit.Width / 2, exitButton.Y + exit.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(exit, -help.Width / 2, -exit.Height / 2, ColorValue.Yellow);
                    sprite.SetTransform(Matrix.Identity);
                }
                else
                {
                    sprite.Draw(exit, exitButton.X, exitButton.Y, ColorValue.White);
                }

                if (creditButton.IsMouseOver)
                {
                    //sprite.Draw(credits, creditButton.X, creditButton.Y, ColorValue.Yellow);
                    float scale = -MathEx.Sqr(MathEx.Saturate(creditProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                        Matrix.Translation(creditButton.X + credits.Width / 2, creditButton.Y + credits.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(credits, -credits.Width / 2, -credits.Height / 2, ColorValue.Yellow);
                    sprite.SetTransform(Matrix.Identity);
                }
                else
                {
                    sprite.Draw(credits, creditButton.X, creditButton.Y, ColorValue.White);
                }


                //if (parent.NextScreen == null)
                {
                    sprite.Draw(cursor, mousePosition.X, mousePosition.Y, ColorValue.White);
                }
            }
        }
Example #28
0
        public override void Render(Sprite sprite)
        {
            sprite.SetTransform(Matrix.Translation(PanelX, PanelY + PanelHeight, 0));
            sprite.Draw(background, 0, -PanelHeight, ColorValue.White);

            //if (switchButton.IsPressed)
            //{
            //    sprite.Draw(switchButton.ImageMouseDown, switchButton.X, switchButton.Y - (PanelY + PanelHeight), switchButton.ModulateColor);
            //}
            //else if (switchButton.IsMouseOver)
            //{
            //    sprite.Draw(switchButton.ImageMouseOver, switchButton.X, switchButton.Y - (PanelY + PanelHeight), switchButton.ModulateColor);
            //}
            //else
            //{
            //    sprite.Draw(switchButton.Image, switchButton.X, switchButton.Y - (PanelY + PanelHeight), switchButton.ModulateColor);
            //}

            BattleField field = gameLogic.Field;

            #region 遍历战场上的城市,绘制地图上点
            for (int i = 0; i < field.CityCount; i++)
            {
                City cc = field.Cities[i];

                if (!cc.IsHomeCity)
                {
                    ColorValue modColor;

                    if (cc.IsCaptured)
                    {
                        modColor = cc.Owner.SideColor;
                       
                    }
                    else
                    {
                        modColor = ColorValue.White;
                    }

                    Point pt;
                    if (!positionBuffer.TryGetValue(cc, out pt))
                    {
                        pt = GetPosition(MathEx.Degree2Radian(cc.Longitude), MathEx.Degree2Radian(cc.Latitude));

                        pt.X += MapX;
                        pt.Y = pt.Y + MapY - PanelHeight;

                        positionBuffer.Add(cc, pt);
                    }
                    sprite.Draw(mapdot, pt.X - 7, pt.Y - 7, modColor);
                }
                else
                {
                    ColorValue modColor;

                    if (cc.IsCaptured)
                    {
                        modColor = cc.Owner.SideColor;
                    }
                    else
                    {
                        modColor = ColorValue.White;
                    }
                    if (cc.IsCaptured)
                    {
                        

                        Point pt;
                        if (!positionBuffer.TryGetValue(cc, out pt))
                        {
                            pt = GetPosition(MathEx.Degree2Radian(cc.Longitude), MathEx.Degree2Radian(cc.Latitude));

                            pt.X += MapX;
                            pt.Y = pt.Y + MapY - PanelHeight;

                            positionBuffer.Add(cc, pt);
                        }
                        sprite.Draw(mapCircle, pt.X - 12, pt.Y - 12, modColor);
                    }

                }
            }
            #endregion

            #region 绘制摄像机
            {
                Point pt = GetPosition(camera.Longitude, camera.Latitude);

                float ratio = camera.Height / 60f;
                Rectangle rect = new Rectangle(
                    pt.X + MapX - (int)(cameraView.Width * ratio * 0.5f),
                    pt.Y + MapY - (int)(cameraView.Height * ratio * 0.5f), (int)(cameraView.Width * ratio), (int)(cameraView.Height * ratio));
                rect.Y -= PanelHeight;

                sprite.Draw(cameraView, rect, ColorValue.White);
            }
            #endregion

            sprite.SetTransform(Matrix.Identity);

            #region 绘制事件标记
            for (int i = 0; i < marks.Count; i++)
            {
                marks[i].Render(sprite);
            }
            #endregion

            //sprite.Draw(compass, -21, 666, ColorValue.White);
        }
Example #29
0
        private void RenderSelectedCityHP(Sprite sprite)
        {
            if (SelectedCity != null)
            {
                float radLng = MathEx.Degree2Radian(SelectedCity.Longitude);
                float radLat = MathEx.Degree2Radian(SelectedCity.Latitude);

                Vector3 tangy = PlanetEarth.GetTangentY(radLng, radLat);
                Vector3 tangx = PlanetEarth.GetTangentX(radLng, radLat);

                Vector3 cityNormal = PlanetEarth.GetNormal(radLng, radLat);
                cityNormal.Normalize();

                Vector3 hpPos = SelectedCity.Position + tangy * 150 + cityNormal * 400;

                Viewport vp = renderSys.Viewport;
                Vector3 screenPos = vp.Project(hpPos, scene.Camera.ProjectionMatrix,
                                               scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 lp = vp.Project(hpPos + tangx, scene.Camera.ProjectionMatrix,
                                                       scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 rp = vp.Project(hpPos - tangx, scene.Camera.ProjectionMatrix,
                                                       scene.Camera.ViewMatrix, Matrix.Identity);


                float scale = 1.75f * Vector3.Distance(lp, rp) / 2;

                Matrix trans = Matrix.Translation(-onCityHPBackground.Width / 2, -onCityHPBackground.Height / 2, 0) *
                           Matrix.Scaling(scale, scale, 1) * Matrix.Translation(screenPos.X, screenPos.Y, 0);



                int hpTexWidth = (int)(onCityHPTex.Width * SelectedCity.HPRate);

                sprite.SetTransform(trans);
                sprite.Draw(onCityHPBase, 0, 0, ColorValue.White);
                sprite.Draw(onCityHPTex, new Rectangle(0, 0, hpTexWidth, onCityHPTex.Height),
                    new Rectangle(0, 0, hpTexWidth, onCityHPTex.Height), ColorValue.White);
                sprite.Draw(onCityHPBackground, 0, 0, ColorValue.White);
                f6.DrawString(sprite, SelectedCity.Level.ToString(), 25, -16, ColorValue.White);

                sprite.SetTransform(Matrix.Identity);

                

            }
        }
Example #30
0
        public override void Render(Sprite sprite)
        {
            if (state != NIGDialogState.Hiding)
            {
                ColorValue overlayColor = ColorValue.Transparent;
                overlayColor.A = (byte)(165 * showPrg);

                sprite.Draw(overlay, 0, 0, overlayColor);


                int x = 461; 
                int y = 166;

                float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
                scale = (1.0f / 0.75f) * scale;
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                    Matrix.Scaling(scale, scale, 1) *
                    Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(background, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);

            }
            if (state == NIGDialogState.Showing)
            {                
                sprite.Draw(chooseColor, 673, 208, gameLogic.LocalHumanPlayer.SideColor);

                sprite.Draw(okButton.Image, okButton.X, okButton.Y, ColorValue.White);
                if (okButton.IsMouseOver)
                {
                    sprite.Draw(okButton.Image, okButton.X, okButton.Y - 4, ColorValue.White);
                }
            }
        }
Example #31
0
        private void RenderBallIcon(Sprite sprite)
        {
            if (selectCity != null && selectCity.Owner == player)
            {

                //Array.Sort(resBallsCount, BallRecordCompare);

                int left = 0;
                for (int i = 0; i < resBallsCount.Length; i++)
                {
                    RBallType ballType = resBallsCount[i].Type;
                    bool overrideDraw = selectCity.CanProduceProduction() ? (ballType == selectCity.GetProductionType()) : false;
                    //resBallsCount[i].Type == selectCity.GetProductionType()
                    switch (ballType)
                    {
                        case RBallType.Green:
                            {
                                if (resBallsCount[i].count != 0 || overrideDraw)
                                {
                                    if (selectCity.CanProduceProduction() && selectCity.GetProductionType() == RBallType.Green)
                                    {
                                        if (selectCity.IsFull())
                                        {
                                            sprite.Draw(statusMaxBalls, 651 + 69 * left, 723 - statusMaxBalls.Height, ColorValue.White);
                                        }
                                        else
                                        {
                                            int height = (int)(selectCity.GetProductionProgress() * statusProducePrgTex.Height);


                                            sprite.Draw(statusProducePrgTex, new Rectangle(651 + 69 * left, 723 - height, statusProducePrgTex.Width, height),
                                                 new Rectangle(0, statusProducePrgTex.Height - height, statusProducePrgTex.Width, height), ColorValue.White);
                                        }
                                    }

                                    int x = 687 + 69 * left - greenBallTex.Width / 2;
                                    int y = 692 - greenBallTex.Height / 2;
                                    sprite.Draw(greenBallTex, x, y, ColorValue.White);
                                    Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) *
                                            Matrix.Translation(new Vector3(x + 45 - f8.MeasureString(resBallsCount[i].count.ToString()).Width, y + 18, 0));
                                    sprite.SetTransform(trans);
                                    f8.DrawString(sprite, resBallsCount[i].count.ToString(), 0, 0, ColorValue.White);
                                    sprite.SetTransform(Matrix.Identity);
                                    left++;
                                }

                                

                            }
                            break;
                        case RBallType.Education:
                            {
                                if (resBallsCount[i].count != 0 || overrideDraw)
                                {
                                    if (selectCity.CanProduceProduction() && selectCity.GetProductionType() == RBallType.Education)
                                    {
                                        if (selectCity.IsFull())
                                        {
                                            sprite.Draw(statusMaxBalls, 651 + 69 * left, 723 - statusMaxBalls.Height, ColorValue.White);
                                        }
                                        else
                                        {
                                            int height = (int)(selectCity.GetProductionProgress() * statusProducePrgTex.Height);


                                            sprite.Draw(statusProducePrgTex, new Rectangle(651 + 69 * left, 723 - height, statusProducePrgTex.Width, height),
                                                 new Rectangle(0, statusProducePrgTex.Height - height, statusProducePrgTex.Width, height), ColorValue.White);
                                        }
                                    }

                                    int x = 687 + 69 * left - educationBallTex.Width / 2;
                                    int y = 692 - educationBallTex.Height /2 ;
                                    sprite.Draw(educationBallTex, x, y, ColorValue.White);
                                    Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * 
                                            Matrix.Translation( new Vector3(x + 45 - f8.MeasureString(resBallsCount[i].count.ToString()).Width, y + 18, 0));
                                    sprite.SetTransform(trans);
                                    f8.DrawString(sprite, resBallsCount[i].count.ToString(), 0, 0, ColorValue.White);
                                    sprite.SetTransform(Matrix.Identity);
                                  

                                    left++;
                                }
                               
                            }
                            break;
                        case RBallType.Health:
                            {
                                if (resBallsCount[i].count != 0 || overrideDraw)
                                {
                                    if (selectCity.CanProduceProduction() && selectCity.GetProductionType() == RBallType.Health)
                                    {
                                        if (selectCity.IsFull())
                                        {
                                            sprite.Draw(statusMaxBalls, 651 + 69 * left, 723 - statusMaxBalls.Height, ColorValue.White);
                                        }
                                        else
                                        {
                                            int height = (int)(selectCity.GetProductionProgress() * statusProducePrgTex.Height);


                                            sprite.Draw(statusProducePrgTex, new Rectangle(651 + 69 * left, 723 - height, statusProducePrgTex.Width, height),
                                                 new Rectangle(0, statusProducePrgTex.Height - height, statusProducePrgTex.Width, height), ColorValue.White);
                                        }
                                    }

                                    int x = 687 + 69 * left - healthBallTex.Width / 2;
                                    int y = 692 - healthBallTex.Height / 2;
                                    sprite.Draw(healthBallTex, x, y, ColorValue.White);
                                    Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) *
                                             Matrix.Translation(new Vector3(x + 45 - f8.MeasureString(resBallsCount[i].count.ToString()).Width, y + 18, 0));
                                    sprite.SetTransform(trans);
                                    f8.DrawString(sprite, resBallsCount[i].count.ToString(), 0, 0, ColorValue.White);
                                    sprite.SetTransform(Matrix.Identity);
                                    left++;
                                }
                             
                            }
                            break;
                    }
                }

                
            }
        }
Example #32
0
        public override void Render(Sprite sprite)
        {
            sprite.Draw(background, 0, 0, ColorValue.White);

            if (showPrg > 0.5f)
            {
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                   Matrix.Scaling((showPrg - 0.5f) * 2 * 0.8f + 0.2f, 1, 1) *
                   Matrix.Translation(97 + background.Width / 2, 24 + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(panel, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }

            //int idx = currentPage;
            //if (idx >= TotalPages)
            //    idx = TotalPages - 1;

            if (state == NIGDialogState.Showing)
            {
                sprite.Draw(nextBtn, nextButton.X, nextButton.Y, ColorValue.White);
                if (nextButton.IsMouseOver && !nextButton.IsPressed)
                {
                    sprite.Draw(nextBtn, nextButton.X, nextButton.Y - 1, ColorValue.White);
                }


                sprite.Draw(prevBtn, prevButton.X, prevButton.Y, ColorValue.White);
                if (prevButton.IsMouseOver && !exitButton.IsPressed)
                {
                    sprite.Draw(prevBtn, prevButton.X, prevButton.Y - 1, ColorValue.White);
                }


                sprite.Draw(exitBtn, exitButton.X, exitButton.Y, ColorValue.White);
                if (exitButton.IsMouseOver && !exitButton.IsPressed)
                {
                    sprite.Draw(exitBtn, exitButton.X, exitButton.Y - 3, ColorValue.White);
                }
                sprite.Draw(help[currentPage], 0, 0, ColorValue.White);
            }





            sprite.Draw(cursor, mousePosition.X, mousePosition.Y, ColorValue.White);
        }
Example #33
0
        public override void Render(Sprite sprite)
        {
            if (state != NIGDialogState.Hiding)
            {
                ColorValue overlayColor = ColorValue.Transparent;
                overlayColor.A = (byte)(165 * showPrg);

                sprite.Draw(overlay, 0, 0, overlayColor);


                int x = 451;
                int y = 157;

                float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
                scale = (1.0f / 0.75f) * scale;
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                    Matrix.Scaling(scale, scale, 1) *
                    Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(background, 0, 0, ColorValue.White);

                sprite.SetTransform(Matrix.Identity);


                sprite.Draw(resumeButton.Image, resumeButton.X, resumeButton.Y, ColorValue.White);
                if (resumeButton.IsMouseOver)
                {
                    sprite.Draw(resumeButton.Image, resumeButton.X, resumeButton.Y - 4, ColorValue.White);
                }

                sprite.Draw(restartButton.Image, restartButton.X, restartButton.Y, ColorValue.White);
                if (restartButton.IsMouseOver)
                {
                    sprite.Draw(restartButton.Image, restartButton.X, restartButton.Y - 4, ColorValue.White);
                }

                sprite.Draw(exitButton.Image, exitButton.X, exitButton.Y, ColorValue.White);
                if (exitButton.IsMouseOver)
                {
                    sprite.Draw(exitButton.Image, exitButton.X, exitButton.Y - 4, ColorValue.White);
                }
            }
        }
Example #34
0
        void RenderGreen(Sprite sprite)
        {
            sprite.Draw(statusGreenBackground, 405, 580, ColorValue.White);
            ForestObject oil = (ForestObject)selectedResource;
            {
                int hp = (int)oil.CurrentAmount;
                int hpFull = (int)(oil.MaxAmount);

                int hpTexWidth = (int)(statusGreenBarValue.Width * (oil.CurrentAmount / oil.MaxAmount));
                sprite.Draw(statusGreenBarValue, new Rectangle(598, 615, hpTexWidth, statusGreenBarValue.Height),
                         new Rectangle(0, 0, hpTexWidth, statusGreenBarValue.Height), ColorValue.White);
                sprite.Draw(statusGreenBarEdge, 580, 600, ColorValue.White);

                string hpInfo = hp.ToString() + "/" + hpFull.ToString();

                Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(680, 624, 0));
                sprite.SetTransform(trans);
                f8.DrawString(sprite, hpInfo, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);
            }
        }
Example #35
0
        public override void Render(Sprite sprite)
        {
            if (state != NIGDialogState.Hiding)
            {
                ColorValue overlayColor = ColorValue.Transparent;
                overlayColor.A = (byte)(165 * showPrg);

                sprite.Draw(overlay, 0, 0, overlayColor);


                int x = 373;
                int y = 54;

                float scale = -MathEx.Sqr(MathEx.Saturate(showPrg) * 1.5f - 1) + 1;
                scale = (1.0f / 0.75f) * scale;
                Matrix trans = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                    Matrix.Scaling(scale, scale, 1) *
                    Matrix.Translation(x + background.Width / 2, y + background.Height / 2, 0);

                sprite.SetTransform(trans);
                sprite.Draw(background, 0, 0, ColorValue.White);
                sprite.SetTransform(Matrix.Identity);

            }
            if (state == NIGDialogState.Showing)
            {
                //sprite.Draw(failTex, 661, 54, ColorValue.White);

                if (clearProgress > 1)
                {
                    float scale = -MathEx.Sqr(MathEx.Saturate(1 * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                        Matrix.Translation(661 + failTex.Width / 2, 54 + failTex.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(failTex, -failTex.Width / 2, -failTex.Height / 2, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);
                }

                if (clearProgress <= 1)
                {
                    float scale = -MathEx.Sqr(MathEx.Saturate(clearProgress * 6) * 1.5f - 1) + 1;
                    scale = 0.5f + 1.5f * scale;

                    Matrix trans = Matrix.Scaling(scale, scale, 1) *
                        Matrix.Translation(661 + failTex.Width / 2, 54 + failTex.Height / 2, 0);

                    sprite.SetTransform(trans);
                    sprite.Draw(failTex, -failTex.Width / 2, -failTex.Height / 2, ColorValue.White);
                    sprite.SetTransform(Matrix.Identity);
               
                }

                sprite.Draw(backButton.Image, backButton.X, backButton.Y, ColorValue.White);
                if (backButton.IsMouseOver)
                {
                    sprite.Draw(backButton.Image, backButton.X, backButton.Y - 4, ColorValue.White);
                }

                sprite.Draw(replayButton.Image, replayButton.X, replayButton.Y, ColorValue.White);
                if (replayButton.IsMouseOver)
                {
                    sprite.Draw(replayButton.Image, replayButton.X, replayButton.Y - 4, ColorValue.White);
                }

                RenderRank(sprite);


            }
        }
Example #36
0
        void RenderHarv(Sprite sprite)
        {
            sprite.Draw(statusHarvBackground, 405, 580, ColorValue.White);

            
            int harvHPBarWidth = (int)(statusHPBarBarValue.Width * selectedHarv.HealthValue / selectedHarv.GetProps().HP);
            int harvSTBarWidth = (int)(statusHPBarBarValue.Width * selectedHarv.CurrentStorage / selectedHarv.GetProps().Storage);

            string hpInfo = ((int)selectedHarv.HealthValue).ToString() + "/" + ((int)selectedHarv.GetProps().HP).ToString();
            string stInfo = ((int)selectedHarv.CurrentStorage).ToString() + "/" + ((int)selectedHarv.GetProps().Storage).ToString();

            
            sprite.Draw(statusHarvBackground, 405, 580, ColorValue.White);

            sprite.Draw(statusHPBarBarValue, new Rectangle(562, 640, harvHPBarWidth, statusHPBarBarValue.Height),
                    new Rectangle(0, 0, harvHPBarWidth, statusHPBarBarValue.Height), ColorValue.White);
            sprite.Draw(statusHPBarBarEdge, 544, 637, ColorValue.White);


            sprite.Draw(statusSTBarBarValue, new Rectangle(679, 672, harvSTBarWidth, statusSTBarBarValue.Height),
                new Rectangle(0, 0, harvSTBarWidth, statusSTBarBarValue.Height), ColorValue.White);
            sprite.Draw(statusSTBarBarEdge, 661, 666, ColorValue.White);

            Matrix trans = Matrix.Scaling(0.8f, 0.8f, 1) * Matrix.Translation(new Vector3(715, 667, 0));
            sprite.SetTransform(trans);
            f8.DrawString(sprite, stInfo, 0, 0, ColorValue.White);
            sprite.SetTransform(Matrix.Identity);
         
        }
Example #37
0
        private void RenderSendBall(Sprite sprite)
        {
            if (targetCity != null)
            {
                float radLng = MathEx.Degree2Radian(targetCity.Longitude);
                float radLat = MathEx.Degree2Radian(targetCity.Latitude);

                float lngSign = Math.Sign(radLng);

                Vector3 tangy = PlanetEarth.GetTangentY(radLng, radLat);
                Vector3 tangx = PlanetEarth.GetTangentX(radLng, radLat);


                Vector3 cityNormal = PlanetEarth.GetNormal(radLng, radLat);
                cityNormal.Normalize();

                Vector3 hpPos = targetCity.Position + cityNormal * 100 + tangx * (lngSign * City.CityRadius * 0.55f);

                Viewport vp = renderSys.Viewport;
                Vector3 screenPos = vp.Project(hpPos, scene.Camera.ProjectionMatrix,
                                               scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 lp = vp.Project(hpPos + tangx, scene.Camera.ProjectionMatrix,
                                                       scene.Camera.ViewMatrix, Matrix.Identity);

                Vector3 rp = vp.Project(hpPos - tangx, scene.Camera.ProjectionMatrix,
                                                       scene.Camera.ViewMatrix, Matrix.Identity);


                float scale0 = MathEx.Saturate(1.5f * Vector3.Distance(lp, rp));
                float scale = (animProgress * animProgress) * scale0;

                Matrix trans = Matrix.Translation(0, -background.Height / 2, 0) *
                           Matrix.Scaling(scale, scale, 1) * Matrix.Translation(screenPos.X, screenPos.Y, 0);




                sprite.SetTransform(trans);

                if (selectedIndex == -1)
                {
                    sprite.Draw(background, 0, 0, ColorValue.White);
                }
                else
                {
                    sprite.Draw(backgroundSelected[selectedIndex], 0, 0, ColorValue.White);
                }
                UpdateHotarea(ref trans);

                if (state == State.Opened)
                {
                    Matrix trans2 = Matrix.Translation(-background.Width / 2, -background.Height / 2, 0) *
                        Matrix.Scaling(scale0, scale0, 1) * Matrix.Translation(screenPos.X, screenPos.Y, 0);

                    sprite.SetTransform(trans2);

                    RenderBallIcon(sprite);
                }

                sprite.SetTransform(Matrix.Identity);

            }
        }
Example #38
0
        public override void Render(Sprite sprite)
        {
            sprite.SetTransform(Matrix.Translation(PanelX, PanelY + PanelHeight, 0));
            sprite.Draw(background, 0, -PanelHeight, ColorValue.White);

            //if (switchButton.IsPressed)
            //{
            //    sprite.Draw(switchButton.ImageMouseDown, switchButton.X, switchButton.Y - (PanelY + PanelHeight), switchButton.ModulateColor);
            //}
            //else if (switchButton.IsMouseOver)
            //{
            //    sprite.Draw(switchButton.ImageMouseOver, switchButton.X, switchButton.Y - (PanelY + PanelHeight), switchButton.ModulateColor);
            //}
            //else
            //{
            //    sprite.Draw(switchButton.Image, switchButton.X, switchButton.Y - (PanelY + PanelHeight), switchButton.ModulateColor);
            //}

            BattleField field = gameLogic.Field;

            #region 遍历战场上的城市,绘制地图上点
            for (int i = 0; i < field.CityCount; i++)
            {
                City cc = field.Cities[i];

                if (!cc.IsHomeCity)
                {
                    ColorValue modColor;

                    if (cc.IsCaptured)
                    {
                        modColor = cc.Owner.SideColor;
                    }
                    else
                    {
                        modColor = ColorValue.White;
                    }

                    Point pt;
                    if (!positionBuffer.TryGetValue(cc, out pt))
                    {
                        pt = GetPosition(MathEx.Degree2Radian(cc.Longitude), MathEx.Degree2Radian(cc.Latitude));

                        pt.X += MapX;
                        pt.Y  = pt.Y + MapY - PanelHeight;

                        positionBuffer.Add(cc, pt);
                    }
                    sprite.Draw(mapdot, pt.X - 7, pt.Y - 7, modColor);
                }
                else
                {
                    ColorValue modColor;

                    if (cc.IsCaptured)
                    {
                        modColor = cc.Owner.SideColor;
                    }
                    else
                    {
                        modColor = ColorValue.White;
                    }
                    if (cc.IsCaptured)
                    {
                        Point pt;
                        if (!positionBuffer.TryGetValue(cc, out pt))
                        {
                            pt = GetPosition(MathEx.Degree2Radian(cc.Longitude), MathEx.Degree2Radian(cc.Latitude));

                            pt.X += MapX;
                            pt.Y  = pt.Y + MapY - PanelHeight;

                            positionBuffer.Add(cc, pt);
                        }
                        sprite.Draw(mapCircle, pt.X - 12, pt.Y - 12, modColor);
                    }
                }
            }
            #endregion

            #region 绘制摄像机
            {
                Point pt = GetPosition(camera.Longitude, camera.Latitude);

                float     ratio = camera.Height / 60f;
                Rectangle rect  = new Rectangle(
                    pt.X + MapX - (int)(cameraView.Width * ratio * 0.5f),
                    pt.Y + MapY - (int)(cameraView.Height * ratio * 0.5f), (int)(cameraView.Width * ratio), (int)(cameraView.Height * ratio));
                rect.Y -= PanelHeight;

                sprite.Draw(cameraView, rect, ColorValue.White);
            }
            #endregion

            sprite.SetTransform(Matrix.Identity);

            #region 绘制事件标记
            for (int i = 0; i < marks.Count; i++)
            {
                marks[i].Render(sprite);
            }
            #endregion

            //sprite.Draw(compass, -21, 666, ColorValue.White);
        }