Пример #1
0
        public override void DrawUI(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            if (signature != null)
            {
                Vector2 signatureSize = new Vector2(signature.width * 8, signature.height * 8);

                string  text     = "" + amount;
                Vector2 textSize = Game1.font.MeasureString(text);

                Vector2 signaturePos = new Vector2(
                    bounds.X + (bounds.Width - (signatureSize.X + textSize.X)) * 0.5f,
                    bounds.Y + 32 + (textSize.Y - signatureSize.Y) * 0.5f - textSize.Y
                    );

                Vector2 textPos = new Vector2(
                    signaturePos.X + signatureSize.X + 2,
                    bounds.Y + 32 - textSize.Y
                    );

                float     labelHeight = Math.Max(signatureSize.Y, textSize.Y);
                Vectangle labelRect   = new Vectangle(signaturePos.X, signaturePos.Y + (signatureSize.Y - labelHeight) * 0.5f, signatureSize.X + textSize.X, Math.Max(signatureSize.Y, textSize.Y));
                spriteBatch.Draw(TextureCache.white, labelRect.Bloat(5, 2), new Color(0, 0, 0, 0.5f));

                signature.Draw(spriteBatch, signaturePos, true);
                spriteBatch.DrawString(Game1.font, text, textPos, Color.LightGray);
            }
        }
Пример #2
0
        public override void Draw(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            base.Draw(spriteBatch, blackboard);
            Vector2 pos           = new Vector2(bounds.X, bounds.Y + bounds.Height);
            Vector2 signatureSize = new Vector2(signature.width * 8, signature.height * 8);

            string  text     = "$" + price;
            Vector2 textSize = Game1.font.MeasureString(text);

            Vector2 signaturePos = new Vector2(
                pos.X + (bounds.Width - (signatureSize.X + textSize.X)) * 0.5f,
                pos.Y + (textSize.Y - signatureSize.Y) * 0.5f
                );

            Vector2 textPos = new Vector2(
                signaturePos.X + signatureSize.X,
                pos.Y
                );

            float     labelHeight = Math.Max(signatureSize.Y, textSize.Y);
            Vectangle labelRect   = new Vectangle(signaturePos.X, signaturePos.Y + (signatureSize.Y - labelHeight) * 0.5f, signatureSize.X + textSize.X, Math.Max(signatureSize.Y, textSize.Y));

            spriteBatch.Draw(TextureCache.white, labelRect.Bloat(5, 2), new Color(0, 0, 0, 0.5f));

            signature.Draw(spriteBatch, signaturePos, true);

            spriteBatch.DrawString(Game1.font, "$" + price, textPos, Color.Yellow);
        }
Пример #3
0
        public override void DrawUI(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            Vector2 pos           = new Vector2(bounds.X, bounds.Y + 32);
            Vector2 signatureSize = new Vector2(signature.width * 8, signature.height * 8);

            string  text     = numCrystals > 1? " +" + numCrystals + " bubbles": " +1 bubble";
            Vector2 textSize = Game1.font.MeasureString(text);

            Vector2 signaturePos = new Vector2(
                pos.X + (bounds.Width - (signatureSize.X + textSize.X)) * 0.5f,
                pos.Y + (textSize.Y - signatureSize.Y) * 0.5f
                );

            Vector2 textPos = new Vector2(
                signaturePos.X + signatureSize.X,
                pos.Y
                );

            Vectangle labelRect = new Vectangle(signaturePos.X, signaturePos.Y + (signatureSize.Y - textSize.Y) * 0.5f, signatureSize.X + textSize.X, Math.Max(signatureSize.Y, textSize.Y));

            spriteBatch.Draw(TextureCache.white, labelRect.Bloat(5, 2), new Color(0, 0, 0, 0.5f));
            signature.Draw(spriteBatch, signaturePos, true);

            spriteBatch.DrawString(Game1.font, text, textPos, Color.Yellow);
        }
Пример #4
0
        public override void Draw(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            base.Draw(spriteBatch, blackboard);
            Vector2 signatureSize = new Vector2(signature.width * 8, signature.height * 8);

            Vector2 signaturePos = new Vector2(
                bounds.CenterX - signatureSize.X * 0.5f,
                bounds.CenterY - (signatureSize.Y * 0.5f + 8)
                );

            signature.Draw(spriteBatch, signaturePos, true);
        }
Пример #5
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            if (texture != null)
            {
                base.Draw(spriteBatch);
            }

            if (signature != null)
            {
                spriteBatch.DrawString(Game1.font, "Make this:", new Vector2(bounds.CenterX, bounds.Y), Color.White);
                signature.Draw(spriteBatch, bounds.Center, false);
            }
        }
Пример #6
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            // base.Draw(spriteBatch);

            if (signature != null)
            {
                spriteBatch.DrawString(Game1.font, "Make this:", new Vector2(bounds.CenterX, bounds.Y), TextAlignment.CENTER, Color.White);
                signature.Draw(spriteBatch, bounds.Center, false);
            }

            if (signature2 != null)
            {
                spriteBatch.DrawString(Game1.font, "And/or this:", new Vector2(bounds.CenterX, bounds.Y + 100), TextAlignment.CENTER, Color.White);
                signature2.Draw(spriteBatch, bounds.Center + new Vector2(0, 100), false);
            }
        }
Пример #7
0
        public override void Draw(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            base.Draw(spriteBatch, blackboard);

            bool hovering = (blackboard.inputState != null) ? (blackboard.inputState.hoveringElement == this) : false;

            if (hovering || selected)
            {
                spriteBatch.Draw(
                    TextureCache.centrifuge_highlight,
                    bounds,
                    selected ? new Color(0.7f, 0.7f, 1.0f, 1.0f) : new Color(1.0f, 1.0f, 0.0f, 1.0f)
                    );
            }

            spriteBatch.Draw(GetModeIcon(mode), bounds.XY + new Vector2(15, 20), Color.White);

            if (outputSignature != null)
            {
                outputSignature.Draw(spriteBatch, bounds.BottomRight + new Vector2(-14, -8), true);
            }
        }
Пример #8
0
        public override void Draw(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            if (blackboard.selectedObject == this && blackboard.draggingOntoObject != null)
            {
                return;
            }

            base.Draw(spriteBatch, blackboard);

            if (isBigFactory)
            {
                spriteBatch.Draw(TextureCache.sidejug, bounds.XY + new Vector2(-14, 12), Color.White);
                spriteBatch.Draw(TextureCache.sidejug_right, bounds.XY + new Vector2(45, 12), Color.White);
            }

            bool hovering = (blackboard.inputState != null) ? (blackboard.inputState.hoveringElement == this) : false;

            if (hovering || selected)
            {
                spriteBatch.Draw(
                    TextureCache.processor_highlight,
                    bounds,
                    selected ? new Color(0.8f, 0.8f, 0.8f, 0.5f) : new Color(0.75f, 0.75f, 0.0f, 0.5f)
                    );
            }

            anyThreadStalled = false;
            bool anyThreadRunning = false;

            foreach (FactoryThread thread in threads)
            {
                if (thread.stalled)
                {
                    anyThreadStalled = true;
                }
                else
                {
                    anyThreadRunning = true;
                }
            }

            if (anyThreadRunning)
            {
                spoolAnimCountdown--;
                if (spoolAnimCountdown <= 0)
                {
                    spoolAnimIndex     = (spoolAnimIndex + 1) % TextureCache.spools.Length;
                    spoolAnimCountdown = 3;
                }
            }

            if (isBigFactory)
            {
                spriteBatch.Draw(TextureCache.spools[spoolAnimIndex], bounds.XY + new Vector2(7, 32), Color.White);
            }
            spriteBatch.Draw(TextureCache.spools[spoolAnimIndex], bounds.XY + new Vector2(24, 32), Color.White);

            if (internalSeller != null)
            {
                Vector2 pos           = new Vector2(bounds.X, bounds.Y + bounds.Height);
                Vector2 signatureSize = new Vector2(internalSeller.width * 8, internalSeller.height * 8);

                string text = "";
                switch (sellerAction)
                {
                case FactoryCommandType.EARNMONEY:
                    text = "$" + sellerPrice;
                    break;

                case FactoryCommandType.GAINCRYSTAL:
                    text = "crystal";
                    break;
                }
                Vector2 textSize = Game1.font.MeasureString(text);

                Vector2 signaturePos = new Vector2(
                    pos.X + (bounds.Width - (signatureSize.X + textSize.X)) * 0.5f,
                    pos.Y + (textSize.Y - signatureSize.Y) * 0.5f
                    );

                Vector2 textPos = new Vector2(
                    signaturePos.X + signatureSize.X,
                    pos.Y
                    );

                internalSeller.Draw(spriteBatch, signaturePos, true);

                spriteBatch.DrawString(Game1.font, text, textPos, Color.Yellow);
            }

            const int CORE_SIZE               = 5;
            const int MAX_CORES_PER_LINE      = 5;
            int       numCoresDrawn           = 0;
            Vector2   initialBarPos           = bounds.Center + new Vector2(-16, 1);// new Vector2((int)bounds.CenterX + 2 - CORE_SIZE*3, (int)(bounds.Bottom + 2));
            Vector2   progressBarPos          = initialBarPos;
            int       recordingDurationFrames = 0;

            if (commands.Count > 0)
            {
                recordingDurationFrames = commands.Last().time;
            }
            float recordingDurationSeconds = Game1.FramesToSeconds(recordingDurationFrames);

            int numCoresDrawnThisLine    = 0;
            int numCoresPerThread        = (int)Math.Ceiling(recordingDurationSeconds / TIME_PER_CORE);
            int progressBarInternalWidth = (1 + numCoresPerThread * CORE_SIZE);

            foreach (FactoryThread thread in threads)
            {
                float maxTimeFraction = 1.0f;//recordingDurationSeconds / (numCoresPerThread * TIME_PER_CORE);
                spriteBatch.Draw(TextureCache.white, new Rectangle((int)progressBarPos.X, (int)progressBarPos.Y, numCoresPerThread * CORE_SIZE, CORE_SIZE), Color.Black);
                spriteBatch.Draw(TextureCache.white, new Rectangle((int)progressBarPos.X, (int)(progressBarPos.Y), (int)(progressBarInternalWidth * maxTimeFraction), CORE_SIZE), new Color(100, 100, 100));
                float progressFraction = thread.internalTime / (recordingDurationSeconds * 60.0f);                                                                                                                                       // (60.0f* numCoresPerThread * TIME_PER_CORE);
                spriteBatch.Draw(TextureCache.white, new Rectangle((int)progressBarPos.X, (int)(progressBarPos.Y), (int)(progressBarInternalWidth * progressFraction), CORE_SIZE), thread.stalled ? Color.Red : new Color(100, 200, 0)); // new Color(120,170,255));
                spriteBatch.Draw(thread.stalled ? TextureCache.bad_cores_bar_small : TextureCache.cores_bar_small, new Rectangle((int)progressBarPos.X, (int)progressBarPos.Y, 1 + numCoresPerThread * CORE_SIZE, 1 + CORE_SIZE), Color.White);

                numCoresDrawn         += numCoresPerThread;
                numCoresDrawnThisLine += numCoresPerThread;
                if (numCoresDrawnThisLine <= MAX_CORES_PER_LINE)
                {
                    progressBarPos.X += numCoresPerThread * CORE_SIZE;
                }
                else
                {
                    progressBarPos.X      = initialBarPos.X;
                    progressBarPos.Y     += CORE_SIZE + 2;
                    numCoresDrawnThisLine = 0;
                }
            }

            while (numCores > numCoresDrawn)
            {
                spriteBatch.Draw(TextureCache.empty_core, new Rectangle((int)progressBarPos.X, (int)progressBarPos.Y, 1 + CORE_SIZE, 1 + CORE_SIZE), Color.White);
                progressBarPos.X += CORE_SIZE;
                numCoresDrawn++;
            }
        }