// Manage add-on health text description
        internal static void ManageHealthText()
        {
            if (ManageAllGUIElements.HealthTextObject == null)
            {
                ManageAllGUIElements.HealthTextObject = PrepareGUIObjects.PrepareGUIObject("HealthTextUI", GearInfo.health_txt_Position);
            }

            // (Object, font size modifier, dual color / gray, is module in, what color if not gray, text type)
            if (ManageAllGUIElements.HealthTextObject != null)
            {
                ManageAllGUIElements.HealthTextObject = PrepareGUITxt.PrepareTxtElement(ManageAllGUIElements.HealthTextObject, 2f, false, SeamothInfo.electronicModuleIn, Color.white, GearInfo.health_txt_Position, GearInfo.health_txt_Size);
            }

            GearInfo.healthDisplayText = ManageAllGUIElements.HealthTextObject.GetComponent <Text>();

            if (SeamothInfo.electronicModuleIn)
            {
                string colorStartDesc;
                string colorWhite = "<color=white>";
                string colorGrey  = "<color=grey>";
                string colorEnd   = "</color>";

                if (SeamothInfo.seamothLinkModuleIn)
                {
                    colorStartDesc = colorWhite;
                }
                else
                {
                    colorStartDesc = colorGrey;
                }

                if (Config.MarchThroughHealthValue == 1f)
                {
                    GearInfo.healthDisplayText.text = (colorStartDesc + "Health max units" + colorEnd);
                }
                else if (Config.MarchThroughHealthValue == 2f)
                {
                    GearInfo.healthDisplayText.text = (colorStartDesc + "Health units" + colorEnd);
                }
                else
                {
                    GearInfo.healthDisplayText.text = (colorStartDesc + "Health %" + colorEnd);
                }

                if (ManageAllGUIElements.HealthTextObject != null)
                {
                    ManageAllGUIElements.HealthTextObject.SetActive(true);
                }
            }
            else
            {
                if (ManageAllGUIElements.HealthTextObject != null)
                {
                    ManageAllGUIElements.HealthTextObject.SetActive(false);
                }
            }
        }
        // Manage add-on temperature text description
        internal static void ManageTemperText()
        {
            if (ManageAllGUIElements.TemperTextObject == null)
            {
                ManageAllGUIElements.TemperTextObject = PrepareGUIObjects.PrepareGUIObject("TemperTextUI", GearInfo.temper_txt_Position);
            }

            if (ManageAllGUIElements.TemperTextObject != null)
            {
                ManageAllGUIElements.TemperTextObject = PrepareGUITxt.PrepareTxtElement(ManageAllGUIElements.TemperTextObject, 2f, false, SeamothInfo.electronicModuleIn, Color.white, GearInfo.temper_txt_Position, GearInfo.temper_txt_Size);
            }

            GearInfo.temperDisplayText = ManageAllGUIElements.TemperTextObject.GetComponent <Text>();

            if (SeamothInfo.electronicModuleIn)
            {
                string colorStartDesc;
                string colorWhite = "<color=white>";
                string colorGrey  = "<color=grey>";
                string colorEnd   = "</color>";

                if (SeamothInfo.seamothLinkModuleIn)
                {
                    colorStartDesc = colorWhite;
                }
                else
                {
                    colorStartDesc = colorGrey;
                }

                GearInfo.temperDisplayText.text = (colorStartDesc + "Water temp" + colorEnd);

                if (ManageAllGUIElements.TemperTextObject != null)
                {
                    ManageAllGUIElements.TemperTextObject.SetActive(true);
                }
            }
            else
            {
                if (ManageAllGUIElements.TemperTextObject != null)
                {
                    ManageAllGUIElements.TemperTextObject.SetActive(false);
                }
            }
        }
Ejemplo n.º 3
0
        // Manage Cruise Control text
        internal static void ManageCruiseText()
        {
            if (SeamothInfo.CruiseControlOn && SeamothInfo.electronicModuleIn && SeamothInfo.seamothLinkModuleIn)
            {
                if (ManageAllGUIElements.CruiseSetTextObject == null)
                {
                    ManageAllGUIElements.CruiseSetTextObject = PrepareGUIObjects.PrepareGUIObject("CruiseSetTextUI", GearInfo.cruise_txt_Position);
                }

                // (Object, font size modifier, dual color / gray, is module in, what color if not gray, text type)
                if (ManageAllGUIElements.CruiseSetTextObject != null)
                {
                    ManageAllGUIElements.CruiseSetTextObject = PrepareGUITxt.PrepareTxtElement(ManageAllGUIElements.CruiseSetTextObject, 1.5f, true, SeamothInfo.electronicModuleIn, Color.white, GearInfo.cruise_txt_Position, GearInfo.cruise_txt_Size);
                }

                GearInfo.cruiseDisplayText = ManageAllGUIElements.CruiseSetTextObject.GetComponent <Text>();

                // ("F1") displays 1 decimal place
                if (Config.SeamothGearValue == 5f)
                {
                    GearInfo.cruiseDisplayText.text = GearInfo.colorYellow + Player.main.GetVehicle().forwardForce.ToString("F1") + GearInfo.colorEnd;
                }
                else if (Config.SeamothGearValue == 6f)
                {
                    GearInfo.cruiseDisplayText.text = GearInfo.colorRed + Player.main.GetVehicle().forwardForce.ToString("F1") + GearInfo.colorEnd;
                }
                else
                {
                    GearInfo.cruiseDisplayText.text = Player.main.GetVehicle().forwardForce.ToString("F1");
                }

                if (ManageAllGUIElements.CruiseSetTextObject != null)
                {
                    ManageAllGUIElements.CruiseSetTextObject.SetActive(true);
                }
            }
            else
            {
                if (ManageAllGUIElements.CruiseSetTextObject != null)
                {
                    ManageAllGUIElements.CruiseSetTextObject.SetActive(false);
                }
            }
        }
Ejemplo n.º 4
0
        // Manage km/h text
        internal static void ManageKmhText()
        {
            if (ManageAllGUIElements.KmhTextObject == null)
            {
                ManageAllGUIElements.KmhTextObject = PrepareGUIObjects.PrepareGUIObject("KmhTextUI", GearInfo.kmh_txt_Position);
            }

            // (Object, font size modifier, dual color / gray, is module in, what color if not gray, text type)
            if (ManageAllGUIElements.KmhTextObject != null)
            {
                ManageAllGUIElements.KmhTextObject = PrepareGUITxt.PrepareTxtElement(ManageAllGUIElements.KmhTextObject, 1.5f, true, SeamothInfo.mechanicalModuleIn, Color.yellow, GearInfo.kmh_txt_Position, GearInfo.kmh_txt_Size);
            }

            GearInfo.kmhDisplayText = ManageAllGUIElements.KmhTextObject.GetComponent <Text>();

            string colorStart;
            string colorWhite = "<color=white>";
            string colorGrey  = "<color=grey>";
            string colorEnd   = "</color>";

            if (SeamothInfo.mechanicalModuleIn && SeamothInfo.seamothLinkModuleIn)
            {
                colorStart = colorWhite;
            }
            else
            {
                colorStart = colorGrey;
            }

            if (Config.ShowSpeedKmhToggleValue)
            {
                GearInfo.kmhDisplayText.text = (colorStart + "km/h" + colorEnd);
            }
            else
            {
                GearInfo.kmhDisplayText.text = (colorStart + "nm/h" + colorEnd);
            }

            if (ManageAllGUIElements.KmhTextObject != null)
            {
                ManageAllGUIElements.KmhTextObject.SetActive(true);
            }
        }
        // Manage speedometer text
        internal static void ManageSpeedText()
        {
            string colorGrey = "<color=grey>";
            string colorEnd  = "</color>";

            if (ManageAllGUIElements.SpeedNowTextObject == null)
            {
                ManageAllGUIElements.SpeedNowTextObject = PrepareGUIObjects.PrepareGUIObject("SpeedNowTextUI", GearInfo.speed_txt_Position);
            }

            if (ManageAllGUIElements.SpeedNowTextObject != null)
            {
                ManageAllGUIElements.SpeedNowTextObject = PrepareGUITxt.PrepareTxtElement(ManageAllGUIElements.SpeedNowTextObject, 0.65f, true, SeamothInfo.mechanicalModuleIn, Color.white, GearInfo.speed_txt_Position, GearInfo.speed_txt_Size);
            }

            GearInfo.speedDisplayText = ManageAllGUIElements.SpeedNowTextObject.GetComponent <Text>();

            if (SeamothInfo.mechanicalModuleIn && SeamothInfo.seamothLinkModuleIn)
            {
                if (Config.ShowSpeedKmhToggleValue)
                {
                    GearInfo.speedDisplayText.text = Mathf.RoundToInt(Player.main.GetVehicle().useRigidbody.velocity.magnitude).ToString();
                }
                else
                {
                    GearInfo.speedDisplayText.text = Mathf.RoundToInt(Player.main.GetVehicle().useRigidbody.velocity.magnitude / 1.852f).ToString();
                }
            }
            else
            {
                GearInfo.speedDisplayText.text = colorGrey + "-" + colorEnd;
            }

            if (ManageAllGUIElements.SpeedNowTextObject != null)
            {
                ManageAllGUIElements.SpeedNowTextObject.SetActive(true);
            }
        }
        // Manage gears text
        internal static void ManageGearText()
        {
            string colorGrey = "<color=grey>";
            string colorEnd  = "</color>";

            if (ManageAllGUIElements.GearTextObject == null)
            {
                ManageAllGUIElements.GearTextObject = PrepareGUIObjects.PrepareGUIObject("GearTextUI", GearInfo.gear_txt_Position);
            }

            // (Object, font size modifier, dual color / gray, is module in, what color if not gray, text type)
            if (ManageAllGUIElements.GearTextObject != null)
            {
                ManageAllGUIElements.GearTextObject = PrepareGUITxt.PrepareTxtElement(ManageAllGUIElements.GearTextObject, 1.5f, true, SeamothInfo.mechanicalModuleIn, Color.white, GearInfo.gear_txt_Position, GearInfo.gear_txt_Size);
            }

            GearInfo.gearDisplayText = ManageAllGUIElements.GearTextObject.GetComponent <Text>();

            string gearTxt;

            if (SeamothInfo.mechanicalModuleIn && SeamothInfo.seamothLinkModuleIn)
            {
                gearTxt = Config.SeamothGearValue.ToString();
            }
            else
            {
                gearTxt = colorGrey + Config.SeamothGearValue.ToString() + colorEnd;
            }

            GearInfo.gearDisplayText.text = gearTxt; // + "(" + Player.main.GetVehicle().forwardForce.ToString() + ")"; // for checking forward force

            if (ManageAllGUIElements.GearTextObject != null)
            {
                ManageAllGUIElements.GearTextObject.SetActive(true);
            }
        }