コード例 #1
0
        public void Reflect(Blueprint blueprint)
        {
            if (blueprint == null)
            {
                container.SetActive(false);
                return;
            }

            if (!container.activeSelf)
            {
                container.SetActive(true);
            }

            try {
                var thumbnailRect  = new Rect(0, 0, 512, 512);
                var thumbnailPivot = new Vector2(0.5f, 0.5f);
                thumbnailImage.sprite = Sprite.Create(blueprint.Thumbnail, thumbnailRect, thumbnailPivot);
            }
            catch {
                Debug.LogWarning("Error setting blueprint thumbnail");
            }

            nameText.text = blueprint.name;
            Vector2Int size = blueprint.Blocks.Size;

            blockCountView.SetValue(blueprint.Blocks.GetMemberCount());
            sizeView.SetValue($"{size.x}x{size.y}");
            massView.SetValue($"{blueprint.Blocks.Totals.Mass:0} Tonne");
            energyView.SetValue($"{blueprint.Blocks.Totals.PowerGeneration:0} KW");
        }
コード例 #2
0
 private void Render(GridTotals totals)
 {
     massView.SetValue($"{totals.Mass:0} Tonne");
     hullView.SetValue($"{totals.Hull:0}");
     energyView.SetValue($"{totals.PowerGenerationModifier:0}");
     turningPower.SetValue($"{totals.TurningPowerModifier:0}");
 }