예제 #1
0
        public void Main(string argument, UpdateType updateSource)
        {
            this.CalcCapacity();
            this.CalcRatio();

            // the following is an example output

            /*
             * Tank #123
             * =========
             *
             * Level:
             *     1234567 m^3 (123.4%)
             * Capacity:
             *     1234567 m^3
             *
             *
             * Tank #456
             * =========
             *
             * Level:
             *     1234567 m^3 (123.4%)
             * Capacity:
             *     1234567 m^3
             */
            int k = 0;

            for (int i = 0; i < this.lcds.Count; ++i)
            {
                IMyTextPanel d      = this.lcds.ElementAt(i);
                String       output = "";

                if (k < this.tanks.Count)
                {
                    output += this.WriteOutput(this.tanks.ElementAt(k));
                }
                else
                {
                    break;
                }

                ++k;

                if (k < this.tanks.Count)
                {
                    output += this.WriteOutput(this.tanks.ElementAt(k));
                }
                else
                {
                    break;
                }

                ++k;

                d.SetValueBool("ShowTextOnScreen", true);
                d.FontColor = new Color(51, 65, 60);
                d.FontSize  = 1.15f;
                d.Font      = "Monospace";

                d.WritePublicText(output);
            }

            String output2 = "";

            output2 += this.lcdSumName;
            // underline this shit
            output2 += "\n"
                       + new string('=', this.lcdSumName.Length)
                       + "\n\nCommulative values\n\n";
            output2 += "Level:\n";
            output2 += "    "
                       + Math.Round((this.CalcCapacity() * this.CalcRatio()) / 1000, 1).ToString("0000.0")
                       + "m^3 ("
                       + Math.Round(this.CalcRatio() * 100, 1).ToString("000.0")
                       + "%)\nCapacity\n";
            output2 += "    "
                       + Math.Round(this.CalcCapacity() / 1000, 1).ToString("0000.0")
                       + "m^3\n\n";

            this.lcd.SetValueBool("ShowTextOnScreen", true);
            this.lcd.FontColor = new Color(51, 65, 60);
            this.lcd.FontSize  = 1.15f;
            this.lcd.Font      = "Monospace";

            this.lcd.WritePublicText(output2);
        }