예제 #1
0
        public override void OnUpdate()
        {
            if (!JUtil.VesselIsInIVA(vessel) || !UpdateCheck())
            {
                return;
            }

            textObj.text.Text = StringProcessor.ProcessString(labelsEx[activeLabel].labelText, comp);
        }
예제 #2
0
        public override void OnUpdate()
        {
            if (!JUtil.VesselIsInIVA(vessel) || !UpdateCheck())
            {
                return;
            }

            RPMVesselComputer comp = RPMVesselComputer.Instance(vessel);

            textObj.text.Text = StringProcessor.ProcessString(labelsEx[activeLabel].labelText, comp, persistence);
        }
        private void FillScreenBuffer()
        {
            screenBuffer = new string[screenHeight];
            string[] linesArray = activePage.Text.Split(JUtil.LineSeparator, StringSplitOptions.None);
            for (int i = 0; i < screenHeight; i++)
            {
                screenBuffer[i] = (i < linesArray.Length) ? StringProcessor.ProcessString(linesArray[i], comp) : string.Empty;
            }
            textRefreshRequired = false;

            // This is where we request electric charge reserve. And if we don't have any, well... :)
            CheckForElectricCharge();
        }
예제 #4
0
        public void Start()
        {
            comp             = RasterPropMonitorComputer.Instantiate(internalProp);
            textObjTransform = internalProp.FindModelTransform(labelTransform);
            textObj          = InternalComponents.Instance.CreateText(fontName, fontSize, textObjTransform, string.Empty);
            activeLabel      = 0;

            SmarterButton.CreateButton(internalProp, switchTransform, Click);

            ConfigNode moduleConfig = null;

            foreach (ConfigNode node in GameDatabase.Instance.GetConfigNodes("PROP"))
            {
                if (node.GetValue("name") == internalProp.propName)
                {
                    moduleConfig = node.GetNodes("MODULE")[moduleID];
                    ConfigNode[] variableNodes = moduleConfig.GetNodes("VARIABLESET");

                    for (int i = 0; i < variableNodes.Length; i++)
                    {
                        try {
                            labelsEx.Add(new VariableLabelSet(variableNodes[i]));
                        } catch (ArgumentException e) {
                            JUtil.LogMessage(this, "Error in building prop number {1} - {0}", e.Message, internalProp.propID);
                        }
                    }
                    break;
                }
            }

            // Fallback: If there are no VARIABLESET blocks, we treat the module configuration itself as a variableset block.
            if (labelsEx.Count < 1 && moduleConfig != null)
            {
                try {
                    labelsEx.Add(new VariableLabelSet(moduleConfig));
                } catch (ArgumentException e) {
                    JUtil.LogMessage(this, "Error in building prop number {1} - {0}", e.Message, internalProp.propID);
                }
            }

            colorShiftRenderer = internalProp.FindModelComponent <Renderer>(coloredObject);
            if (labelsEx[activeLabel].hasColor)
            {
                colorShiftRenderer.material.SetColor(colorName, labelsEx[activeLabel].color);
            }
            textObj.text.Text = StringProcessor.ProcessString(labelsEx[activeLabel].labelText, comp);

            audioOutput = JUtil.SetupIVASound(internalProp, switchSound, switchSoundVolume, false);
            JUtil.LogMessage(this, "Configuration complete in prop {1}, supporting {0} variable indicators.", labelsEx.Count, internalProp.propID);
        }
예제 #5
0
        public override void OnUpdate()
        {
            if (oneshotComplete && oneshot)
            {
                return;
            }

            if (JUtil.RasterPropMonitorShouldUpdate(vessel) && UpdateCheck())
            {
                RPMVesselComputer comp = RPMVesselComputer.Instance(vessel);
                textObj.text.Text = StringProcessor.ProcessString(spf, comp);
                oneshotComplete   = true;
            }
        }
        public override void OnUpdate()
        {
            if (oneshotComplete && oneshot)
            {
                return;
            }
            if (!JUtil.VesselIsInIVA(vessel) || !UpdateCheck())
            {
                return;
            }

            textObj.text.Text = StringProcessor.ProcessString(sourceString, comp);
            oneshotComplete   = true;
        }
예제 #7
0
        public void UpdateText(RasterPropMonitorComputer rpmComp)
        {
            // If there's a handler references method, it gets called before each text call.
            if (pageHandlerS.getHandlerReferences != null)
            {
                pageHandlerS.getHandlerReferences(pageHandlerModule, backgroundHandlerModule);
            }

            if (pageHandlerMethod != null)
            {
                processedText = pageHandlerMethod(screenWidth, screenHeight);

                if (processedText.IndexOf("$&$", StringComparison.Ordinal) != -1)
                {
                    // There are processed variables in here?
                    StringBuilder bf         = new StringBuilder();
                    string[]      linesArray = processedText.Split(JUtil.LineSeparator, StringSplitOptions.None);
                    for (int i = 0; i < linesArray.Length; i++)
                    {
                        bf.AppendLine(StringProcessor.ProcessString(linesArray[i], rpmComp));
                    }
                    processedText = bf.ToString();
                }
            }
            else
            {
                if (isMutable)
                {
                    if (spf == null)
                    {
                        string[] linesArray = text.Split(JUtil.LineSeparator, StringSplitOptions.None);
                        spf = new StringProcessorFormatter[linesArray.Length];
                        for (int i = 0; i < linesArray.Length; ++i)
                        {
                            spf[i] = new StringProcessorFormatter(linesArray[i], rpmComp);
                        }
                    }

                    StringBuilder bf = new StringBuilder();
                    for (int i = 0; i < spf.Length; i++)
                    {
                        bf.AppendLine(StringProcessor.ProcessString(spf[i], rpmComp));
                    }

                    processedText = bf.ToString();
                }
            }
        }
        private void FillScreenBuffer()
        {
            RPMVesselComputer comp = RPMVesselComputer.Instance(vessel);
            StringBuilder     bf   = new StringBuilder();

            string[] linesArray = activePage.Text.Split(JUtil.LineSeparator, StringSplitOptions.None);
            for (int i = 0; i < linesArray.Length; i++)
            {
                bf.AppendLine(StringProcessor.ProcessString(linesArray[i], comp, persistence));
            }
            textRefreshRequired = false;
            screenBuffer        = bf.ToString();

            // This is where we request electric charge reserve. And if we don't have any, well... :)
            CheckForElectricCharge();
        }
        public override void OnUpdate()
        {
            if (oneshotComplete && oneshot)
            {
                return;
            }
            if (!JUtil.VesselIsInIVA(vessel) || !UpdateCheck())
            {
                return;
            }

            RPMVesselComputer comp = RPMVesselComputer.Instance(vessel);

            textObj.text.Text = StringProcessor.ProcessString(sourceString, comp, internalProp.propID);
            oneshotComplete   = true;
        }
예제 #10
0
        /// <summary>
        /// Respond to a click event: update the text object
        /// </summary>
        public void Click()
        {
            activeLabel++;

            if (activeLabel == labels.Count)
            {
                activeLabel = 0;
            }

            textObj.text = StringProcessor.ProcessString(labels[activeLabel].spf, rpmComp);

            // Force an update.
            updateCountdown = 0;

            if (audioOutput != null && (CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA ||
                                        CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.Internal))
            {
                audioOutput.audio.Play();
            }
        }
예제 #11
0
        public override void OnUpdate()
        {
            if (textObj == null)
            {
                // Shouldn't happen ... but it does, thanks to the quirks of
                // docking and undocking.
                return;
            }

            if (oneshotComplete && oneshot)
            {
                return;
            }

            if (JUtil.RasterPropMonitorShouldUpdate(vessel) && UpdateCheck())
            {
                textObj.text.text = StringProcessor.ProcessString(spf, rpmComp);
                oneshotComplete   = true;
            }
        }
예제 #12
0
        /// <summary>
        /// Do we need to update our text and shader?
        /// </summary>
        public override void OnUpdate()
        {
            if (textObj == null)
            {
                // Shouldn't happen ... but it does, thanks to the quirks of
                // docking and undocking.
                return;
            }

            // Update shader parameters
            UpdateShader();

            if (labels[activeLabel].oneshotComplete && labels[activeLabel].oneshot)
            {
                return;
            }

            if (JUtil.RasterPropMonitorShouldUpdate(vessel) && UpdateCheck())
            {
                textObj.text = StringProcessor.ProcessString(labels[activeLabel].spf, rpmComp);
                labels[activeLabel].oneshotComplete = true;
            }
        }