Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public override void Render(Sprite sprite)
        {
            base.Render(sprite);

            sprite.Draw(background, new Vector2(0, 613), ColorValue.White);

            string msg = "TRANSFORM 23 CITIES";

            fedge6.DrawString(sprite, msg, 130, 660, ColorValue.White);
            fedge6.DrawString(sprite, "\n " + player.Area.CityCount.ToString() + " / 23 )", 130, 660, ColorValue.Yellow);
        }
Ejemplo n.º 3
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;
                }
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
        private void RenderBallIcon(Sprite sprite)
        {
            if (targetCity != null)
            {
                //Array.Sort(resBallsCount, BallRecordCompare);

                resBallItemSelectedCount[0] = 0;
                resBallItemSelectedCount[1] = 0;
                resBallItemSelectedCount[2] = 0;
                resBallItemCount[0]         = 0;
                resBallItemCount[1]         = 0;
                resBallItemCount[2]         = 0;



                int order = 0;
                for (int i = 0; i < resBallsCount.Length; i++)
                {
                    switch (resBallsCount[i].Type)
                    {
                    case RBallType.Green:
                    {
                        if (resBallsCount[i].count != 0)
                        {
                            UpdateSelCount(order, i);


                            resBallsItemType[order]         = RBallType.Green;
                            resBallItemSelectedCount[order] = (int)resBallsCount[i].selectedCount;
                            resBallItemCount[order]         = resBallsCount[i].count;

                            int x = 82 - greenBallBtn.Width / 2;
                            int y = startY[order] - greenBallBtn.Height / 2;

                            sprite.Draw(greenBallBtn, x, y, ColorValue.White);

                            string count = ((int)resBallsCount[i].selectedCount).ToString();

                            f8.DrawString(sprite, count.ToString(), x + countStartX[order], y + countStartY[order], ColorValue.White);

                            order++;
                        }
                    }
                    break;

                    case RBallType.Education:
                    {
                        if (resBallsCount[i].count != 0)
                        {
                            UpdateSelCount(order, i);


                            resBallsItemType[order]         = RBallType.Education;
                            resBallItemSelectedCount[order] = (int)resBallsCount[i].selectedCount;
                            resBallItemCount[order]         = resBallsCount[i].count;

                            int x = 88 - educationBallBtn.Width / 2;
                            int y = startY[order] - educationBallBtn.Height / 2;

                            sprite.Draw(educationBallBtn, x, y, ColorValue.White);


                            string count = ((int)resBallsCount[i].selectedCount).ToString();

                            f8.DrawString(sprite, count.ToString(), x + countStartX[order], y + countStartY[order], ColorValue.White);


                            order++;
                        }
                    }
                    break;

                    case RBallType.Health:
                    {
                        if (resBallsCount[i].count != 0)
                        {
                            UpdateSelCount(order, i);


                            resBallsItemType[order]         = RBallType.Health;
                            resBallItemSelectedCount[order] = (int)resBallsCount[i].selectedCount;
                            resBallItemCount[order]         = resBallsCount[i].count;

                            int x = 88 - healthBallBtn.Width / 2;
                            int y = startY[order] - healthBallBtn.Height / 2;


                            sprite.Draw(healthBallBtn, x, y, ColorValue.White);

                            string count = ((int)resBallsCount[i].selectedCount).ToString();

                            f8.DrawString(sprite, count.ToString(), x + countStartX[order], y + countStartY[order], ColorValue.White);

                            order++;
                        }
                    }
                    break;
                    }
                }
            }
        }
Ejemplo n.º 6
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);
                }
            }
        }