Beispiel #1
0
        protected void setupInfoBox()
        {
            if (infoBox != null)
            {
                return;
            }

            try
            {
                getMaxTotalFuel();
                resourceBroker = new ResourceBroker();
                ResourceRatio[] inputs = inputList.ToArray();
                Color           clr;
                for (int index = 0; index < inputs.Length; index++)
                {
                    if (inputs[index].ResourceName == fuelGaugeResource)
                    {
                        infoBox = this.part.stackIcon.StageIcon.DisplayInfo();
                        infoBox.SetMessage(fuelGaugeResource);
                        clr   = XKCDColors.GreenYellow; //XKCDColors.BrightOlive;
                        clr.a = 0.55f;
                        infoBox.SetMsgTextColor(clr);
                        clr   = XKCDColors.Asparagus;
                        clr.a = 0.5f;
                        infoBox.SetMsgBgColor(clr);
                        infoBox.SetProgressBarBgColor(clr);
                        infoBox.Collapse();
                        break;
                    }
                }
            }
            catch { }
        }
Beispiel #2
0
        private IEnumerator <WaitForSeconds> DoSelfDestruct()
        {
            Log.Write($"Starting self destruct coroutine");
            ScreenMessage msg = ScreenMessages.PostScreenMessage("Starting self destruct sequence", 1.0f, ScreenMessageStyle.UPPER_CENTER);

            StageIconInfoBox ib = null;

            if (this.part.stackIcon.StageIcon != null)
            {
                this.part.stackIcon.StageIcon.SetIconColor(Color.red);
                ib = this.part.stackIcon.StageIcon.DisplayInfo();
                //			ib.SetCaption($"Self Destruct");
                ib.SetMsgBgColor(Color.white);
                ib.SetMsgTextColor(Color.black);
            }

            while ((Time.time - countDownTime) < 5.0f)
            {
                Log.Write($"Self destruct countdown: {(5.0f - (Time.time - countDownTime)).ToString("#0")}");
                msg.message = $"Self destruct in {(5.0f - (Time.time - countDownTime)).ToString("#0")}";
                ScreenMessages.PostScreenMessage(msg);
                if (ib != null)
                {
                    ib.SetValue((Time.time - countDownTime), 0.0f, 4.0f);
                    ib.SetMessage($"Self Destruct: {(5.0f - (Time.time - countDownTime)).ToString("#0")}s");
                }
                yield return(new WaitForSeconds(1.0f));
            }

            while (vessel.parts.Count > 0)
            {
                Part part = vessel.parts.Find(x => x != vessel.rootPart && x != this.part && !x.children.Any() && x.partInfo.name != "pkLES.EscapeMk1v2" && x.partInfo.name != "pkLES.mk2" && x.partInfo.name != "pkLES.mk2.noBPC" && x.partInfo.name != "LaunchEscapeSystem");
                if (part != null)
                {
                    Log.Write($"Exploding {part.partInfo.name} [{part.partInfo.title}]");
                    part.explode();
                    yield return(null);
                }
                else
                {
                    while (vessel.parts.Count > 0)
                    {
                        Log.Write($"Exploding {vessel.parts[0].partInfo.name} [{vessel.parts[0].partInfo.title}]");
                        vessel.parts[0].explode();
                        yield return(null);
                    }
                }
                yield return(new WaitForSeconds(0.1f));
            }
        }