コード例 #1
0
ファイル: InfoWindow.cs プロジェクト: sswelm/PersistentThrust
        private void UpdateInfo()
        {
            if (infoWindowInterface.ThrottleVisible && !throttleWasChanged)
            {
                m_throttleSlider.value = infoWindowInterface.Throttle;
                m_throttleInput.text   = infoWindowInterface.Throttle.ToString("G4");
            }

            if (throttleWasChanged && m_throttleSlider.value == infoWindowInterface.Throttle)
            {
                throttleWasChanged = false;
            }

            if (infoWindowInterface.SituationVisible)
            {
                m_situationInfo.OnTextUpdate.Invoke(infoWindowInterface.SituationTextString);
                for (int i = Modules.Count - 1; i >= 0; i--)
                {
                    InfoModule mod = Modules[i];

                    if (mod == null)
                    {
                        continue;
                    }

                    if (!mod.IsVisible)
                    {
                        if (mod.gameObject.activeSelf)
                        {
                            mod.gameObject.SetActive(false);
                        }

                        continue;
                    }

                    if (mod.IsActive)
                    {
                        if (!mod.gameObject.activeSelf)
                        {
                            mod.gameObject.SetActive(true);
                        }

                        mod.UpdateModule();
                    }
                    else if (mod.gameObject.activeSelf)
                    {
                        mod.gameObject.SetActive(false);
                    }
                }
            }

            if (infoWindowInterface.DeltaVVisible)
            {
            }
        }
コード例 #2
0
ファイル: InfoWindow.cs プロジェクト: sswelm/PersistentThrust
        /// <summary>
        /// Creates the individual readout module using the Situation Module prefab.
        /// </summary>
        /// <param name="module">The readout module interface</param>
        private void CreateModule(IInfoModule module)
        {
            GameObject mod = Instantiate(m_ModulePrefab);

            if (mod == null)
            {
                return;
            }

            mod.transform.SetParent(m_ModuleTransform, false);

            InfoModule bMod = mod.GetComponent <InfoModule>();

            if (bMod == null)
            {
                return;
            }

            bMod.SetModule(module);

            bMod.gameObject.SetActive(module.IsVisible);

            Modules.Add(bMod);
        }