Beispiel #1
0
        private void Render()
        {
            {
                DrawNode.Clear();
                var   visualSettings = World.GameSettings.VisualSettings;
                int   fontSize       = visualSettings.StatisticsFontSize;
                var   spriteSize     = fontSize * 2f;
                var   margin         = 10;
                float x  = visualSettings.StatisticsMargin;
                float y0 = VisibleBoundsWorldspace.MaxY - visualSettings.StatisticsMargin - spriteSize * 0 - margin * 0;
                float y1 = VisibleBoundsWorldspace.MaxY - visualSettings.StatisticsMargin - spriteSize * 1 - margin * 1;
                float y2 = VisibleBoundsWorldspace.MaxY - visualSettings.StatisticsMargin - spriteSize * 2 - margin * 2;
                float y3 = VisibleBoundsWorldspace.MaxY - visualSettings.StatisticsMargin - spriteSize * 3 - margin * 3;

                var resourceManager = World.GlobalResourceManager;

                var s0 = resourceManager.EnvironmentResource.Energy.ToString(CultureInfo.InvariantCulture);
                var s1 = resourceManager.Knowledge.Knowledge1.ToString();
                var s2 = resourceManager.Knowledge.Knowledge2.ToString();
                var s3 = resourceManager.Knowledge.Knowledge3.ToString();
                DrawNode.DrawText(x + spriteSize - spriteSize / 8 + (float)Sqrt(s0.Length) / 1.5f * fontSize, y0, s0, Font.ArialFonts[fontSize], CCSize.Zero);
                DrawNode.DrawText(x + spriteSize - spriteSize / 8 + (float)Sqrt(s1.Length) / 1.5f * fontSize, y1, s1, Font.ArialFonts[fontSize], CCSize.Zero);
                DrawNode.DrawText(x + spriteSize - spriteSize / 8 + (float)Sqrt(s2.Length) / 1.5f * fontSize, y2, s2, Font.ArialFonts[fontSize], CCSize.Zero);
                DrawNode.DrawText(x + spriteSize - spriteSize / 8 + (float)Sqrt(s3.Length) / 1.5f * fontSize, y3, s3, Font.ArialFonts[fontSize], CCSize.Zero);

                DrawNode.DrawCircle(new CCPoint(x, y0), spriteSize / 2, CCColor4B.White);
                DrawNode.DrawCircle(new CCPoint(x, y1), spriteSize / 2, CCColor4B.White);
                DrawNode.DrawCircle(new CCPoint(x, y2), spriteSize / 2, CCColor4B.White);
                DrawNode.DrawCircle(new CCPoint(x, y3), spriteSize / 2, CCColor4B.White);

                EnergySprite.Position     = new CCPoint(x, y0);
                Knowledge1Sprite.Position = new CCPoint(x, y1);
                Knowledge2Sprite.Position = new CCPoint(x, y2);
                Knowledge3Sprite.Position = new CCPoint(x, y3);

                EnergySprite.ContentSize = Knowledge1Sprite.ContentSize = Knowledge2Sprite.ContentSize = Knowledge3Sprite.ContentSize = new CCSize(spriteSize * 0.8f, spriteSize * 0.8f);
            }
            {
                var colorCollection = World.GameSettings.VisualSettings.ColorCollection;
                var margin          = World.GameSettings.VisualSettings.StatisticsMargin;
                var radius          = 45;
                var x        = VisibleBoundsWorldspace.MaxX - margin;
                var y        = VisibleBoundsWorldspace.MaxY - margin;
                var position = new CCPoint(x, y);
                DrawNode.DrawCircle(position, radius, colorCollection.FastForewardBackground, 2, colorCollection.FastForewardBorder);
                FastForewardSprite.Color       = new CCColor3B(World.GameSpeed.GetColor(colorCollection));
                FastForewardSprite.Position    = position + new CCPoint(2, 0);
                FastForewardSprite.ContentSize = new CCSize(radius * 2, radius * 2) * 0.8f;
            }
            RenderEnvironmentValues();
        }
Beispiel #2
0
 public override void Update(float dt)
 {
     base.Update(dt);
     if (!RedrawRequested)
     {
         return;
     }
     DrawNode.Clear();
     foreach (var button in Buttons.OfType <BuildButton>())
     {
         var position = button.Position;
         var delta    = GameSettings.VisualSettings.BuildButtonRadius * 0.5f;
         DrawNode.DrawCircle(position, GameSettings.VisualSettings.BuildButtonRadius, GameSettings.VisualSettings.ColorCollection.BuildButtonBackground, GameSettings.VisualSettings.StructureBorderThickness, GameSettings.VisualSettings.ColorCollection.BuildButtonBorder);
         DrawNode.DrawSegment(position - CCPoint.AnchorUpperLeft * delta, position + CCPoint.AnchorUpperLeft * delta, GameSettings.VisualSettings.PlusCrossRadius, GameSettings.VisualSettings.ColorCollection.BuildButtonForeground);
         DrawNode.DrawSegment(position - CCPoint.AnchorLowerRight * delta, position + CCPoint.AnchorLowerRight * delta, GameSettings.VisualSettings.PlusCrossRadius, GameSettings.VisualSettings.ColorCollection.BuildButtonForeground);
     }
 }