Пример #1
0
        public static void DebugComponent(Component component)
        {
            List<string> keywords = new List<string>();

            BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.IgnoreReturn;

            keywords.Add("Properties:");

            foreach (PropertyInfo propertyInfo in component.GetType().GetProperties(bindingFlags))
            {
                keywords.Add($"{propertyInfo.Name}  [{propertyInfo.GetValue(component, bindingFlags, null, null, null).ToString()}]");
            }

            keywords.Add("Fields:");

            foreach (FieldInfo fieldInfo in component.GetType().GetFields(bindingFlags))
            {
                keywords.Add($"{fieldInfo.Name}  [{fieldInfo.GetValue(component).ToString()}]");
            }

            foreach (string key in keywords)
            {
                BZLogger.Log($"{key}");
            }
        }
Пример #2
0
        internal static void SetKeyBindings()
        {
            KEYBINDINGS = new Dictionary <string, KeyCode>();

            bool sync = false;

            foreach (KeyValuePair <string, string> kvp in Section_hotkeys)
            {
                try
                {
                    KeyCode keyCode = (KeyCode)Enum.Parse(typeof(KeyCode), kvp.Value);
                    KEYBINDINGS.Add(kvp.Key, keyCode);
                }
                catch (ArgumentException)
                {
                    BZLogger.Log($"[{PROGRAM_NAME}]Warning! ({kvp.Value}) is not a valid KeyCode! Setting default value!");

                    for (int i = 0; i < DEFAULT_CONFIG.Count; i++)
                    {
                        if (DEFAULT_CONFIG[i].Key.Equals(kvp.Key))
                        {
                            KEYBINDINGS.Add(kvp.Key, (KeyCode)Enum.Parse(typeof(KeyCode), DEFAULT_CONFIG[i].Value, true));
                            sync = true;
                        }
                    }
                }
            }

            if (sync)
            {
                SyncConfig();
            }
        }
Пример #3
0
        private IEnumerator AssignKey(object keyName)
        {
            waitingForKey = true;

            yield return(WaitForKey());

            int isFirst  = 0;
            int keyCount = 0;

            for (int i = 0; i < HotkeyButtons.Count; i++)
            {
                if (HotkeyButtons[i].Equals(newKey.ToString()))
                {
                    if (keyCount == 0)
                    {
                        isFirst = i;
                    }

                    keyCount++;
                }
            }

            if (keyCount > 0 && isFirst != selected)
            {
                BZLogger.Log($"[{CmZConfig.PROGRAM_NAME}] Error! Duplicate keybind found, swapping keys...");
                HotkeyButtons[isFirst]   = HotkeyButtons[selected];
                buttonInfo[isFirst].Name = HotkeyButtons[selected];
            }

            HotkeyButtons[selected]   = newKey.ToString();
            buttonInfo[selected].Name = HotkeyButtons[selected];
            selected = -1;
            yield return(null);
        }
Пример #4
0
        public void Awake()
        {
            Instance = this;

            ALLSLOTS_Text.Clear();

            uGUI_Equipment uGUIequipment = gameObject.GetComponent <uGUI_Equipment>();

            Dictionary <string, uGUI_EquipmentSlot> ALLSLOTS = (Dictionary <string, uGUI_EquipmentSlot>)uGUIequipment.GetPrivateField("allSlots");

            BZLogger.Debug("uGUI_SlotTextHandler processing ALLSLOTS...");

            foreach (KeyValuePair <string, uGUI_EquipmentSlot> item in ALLSLOTS)
            {
                BZLogger.Debug($"slot name: {item.Key}");

                if (SlotHelper.ALLSLOTS.TryGetValue(item.Key, out SlotData slotData))
                {
                    TextMeshProUGUI TMProText = AddTextToSlot(item.Value.transform, slotData);

                    ALLSLOTS_Text.Add(slotData.SlotID, TMProText);
                }
            }

            BZLogger.Log("uGUI_SlotTextHandler added.");
        }
Пример #5
0
        private void Start()
        {
            //get player instance
            PlayerMain = Player.main;
            PdaMain    = PlayerMain.GetPDA();
            //forced triggering the Awake method in uGUI_Equipment for patching
            PdaMain.Open();
            PdaMain.Close();
            //add and start a handler to check the player mode if changed
            PlayerMain.playerModeChanged.AddHandler(gameObject, new Event <Player.Mode> .HandleFunction(OnPlayerModeChanged));

            string vehicleName = string.Empty;

            if (ThisVehicle)
            {
                isActive    = (PlayerMain.GetVehicle() == ThisVehicle);
                vehicleName = ThisVehicle.vehicleName;
            }
            else if (helper.isReady)
            {
                isActive    = (PlayerMain.GetComponentInParent <SeaTruckUpgrades>() == helper.TruckUpgrades);
                vehicleName = helper.TruckName;
            }

            BZLogger.Log($"Broadcasting message: 'WakeUp', Name: {vehicleName}, Instance ID: {gameObject.GetInstanceID()}");
            gameObject.BroadcastMessage("WakeUp");
        }
Пример #6
0
        internal static void LoadConfig()
        {
            PROGRAM_VERSION = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;

            if (!CheckConfig())
            {
                CreateDefaultConfigFile();
            }

            try
            {
                Section_hotkeys = ParserHelper.GetAllKeyValuesFromSection(FILENAME, SECTIONS[0], SECTION_Hotkeys);

                int.TryParse(ParserHelper.GetKeyValue(FILENAME, SECTIONS[1], SECTION_Settings[0]), out int result);
                MAXSLOTS = result < 5 || result > 12 ? 12 : result;

                TEXTCOLOR = ColorHelper.GetColor(ParserHelper.GetKeyValue(FILENAME, SECTIONS[1], SECTION_Settings[1]));

                BZLogger.Log("Configuration loaded.");
            }
            catch
            {
                BZLogger.Error("An error occurred while loading the configuration file!");
            }
        }
        protected internal SeaTruckArms_Graphics()
        {
            GraphicsRoot = new GameObject("SeaTruckArmsRoot");

            BZLogger.Log($"API message: Graphics root GameObject created: {GraphicsRoot.name}, ID: {GraphicsRoot.GetInstanceID()}");

            //SceneManager.MoveGameObjectToScene(GraphicsRoot, SceneManager.GetSceneByName("StartScreen"));

            GraphicsRoot.AddComponent <Indestructible>();

            CoroutineHost.StartCoroutine(LoadPipeResourcesAsync());

            CoroutineHost.StartCoroutine(LoadExosuitResourcesAsync());

            RegisterBaseArms();

            RegisterBaseArmHandlers();

            InitializeTextures();

            CoroutineHost.StartCoroutine(InitializeArmSocketGraphics());

            CoroutineHost.StartCoroutine(InitializeArmsGraphics());

            GraphicsRoot.AddComponent <ArmRegistrationListener>();
        }
        internal static void LoadConfig()
        {
            PROGRAM_VERSION = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;

            if (!File.Exists(FILENAME))
            {
                CreateDefaultConfigFile();
            }
            else
            {
                CONFIG_VERSION = ParserHelper.GetKeyValue(FILENAME, PROGRAM_NAME, "Version");

                if (CONFIG_VERSION.Equals(PROGRAM_VERSION))
                {
                    BZLogger.Log("Configuration file version match with program version.");
                }
                else
                {
                    CreateDefaultConfigFile();
                }
            }

            Section_hotkeys = ParserHelper.GetAllKeyValuesFromSection(FILENAME, SECTIONS[1], SECTION_HOTKEYS);

            string autostart = ParserHelper.GetKeyValue(FILENAME, SECTIONS[0], SECTION_SETTINGS[0]);

            if (!bool.TryParse(autostart, out AUTOSTART))
            {
                AUTOSTART = false;
            }

            BZLogger.Log("Configuration loaded.");
        }
        public static void Load()
        {
            //load and init config from file
            QSEzConfig.LoadConfig();

            isExists_SlotExtenderZero = ReflectionHelper.IsNamespaceExists("SlotExtenderZero");

            if (isExists_SlotExtenderZero)
            {
                BZLogger.Log("SlotExtenderZero found! trying to work together..");
            }

            try
            {
                Assembly assembly = Assembly.GetExecutingAssembly();

                Harmony.CreateAndPatchAll(assembly, $"BelowZero.{assembly.GetName().Name}.mod");

                BZLogger.Log("Harmony Patches installed");

                SceneManager.sceneLoaded += new UnityAction <Scene, LoadSceneMode>(OnSceneLoaded);

                //CoroutineHost.StartCoroutine(WaitForUGUI());

                IngameMenuHandler.Main.RegisterOnQuitEvent(OnQuitEvent);
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }
Пример #10
0
        internal static void Config_Load()
        {
            BZLogger.Debug("Method call: SEzConfig.Config_Load()");

            PROGRAM_VERSION = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;

            if (!Config_Check())
            {
                Config_CreateDefault();
            }

            try
            {
                Hotkeys_Config = ParserHelper.GetAllKeyValuesFromSection(FILENAME, "Hotkeys", SECTION_HOTKEYS);

                int.TryParse(ParserHelper.GetKeyValue(FILENAME, "Settings", SECTION_SETTINGS[0]), out int result);
                MAXSLOTS = result < 5 || result > 12 ? 12 : result;

                EXTRASLOTS = MAXSLOTS - 4;

                TEXTCOLOR = ColorHelper.GetColor(ParserHelper.GetKeyValue(FILENAME, "Settings", SECTION_SETTINGS[1]));

                SLOT_LAYOUT = ParserHelper.GetKeyValue(FILENAME, "Settings", SECTION_SETTINGS[2]) == "Circle" ? SlotLayout.Circle : SlotLayout.Grid;

                isSeatruckArmsExists = BZCommon.ReflectionHelper.IsNamespaceExists("SeaTruckArms");

                isSeatruckScannerModuleExists = BZCommon.ReflectionHelper.IsNamespaceExists("SeaTruckScannerModule");

                BZLogger.Log("Configuration loaded.");
            }
            catch
            {
                BZLogger.Error("An error occurred while loading the configuration file!");
            }
        }
Пример #11
0
        internal static void Postfix(Inventory __instance)
        {
            __instance.equipment.AddSlots(SlotHelper.NewChipSlotIDs);

            BZLogger.Log("Inventory Chip Slots Patched.");

            Main.ChipSlotsPatched = true;
        }
Пример #12
0
        internal static void Config_Write()
        {
            BZLogger.Debug("Method call: SEzConfig.WriteConfig()");

            ParserHelper.SetAllKeyValuesInSection(FILENAME, "Hotkeys", Hotkeys_Config);
            ParserHelper.SetKeyValue(FILENAME, "Settings", SECTION_SETTINGS[0], MAXSLOTS.ToString());
            ParserHelper.SetKeyValue(FILENAME, "Settings", SECTION_SETTINGS[1], ColorHelper.GetColorName(TEXTCOLOR));
            ParserHelper.SetKeyValue(FILENAME, "Settings", SECTION_SETTINGS[2], SLOT_LAYOUT.ToString());

            BZLogger.Log("Configuration saved.");
        }
        internal void RegisterBaseArms()
        {
            ArmTechTypes.Clear();

            ArmTechTypes.Add(SeaTruckClawArm_Prefab.TechTypeID, ArmTemplate.ClawArm);
            ArmTechTypes.Add(SeaTruckDrillArm_Prefab.TechTypeID, ArmTemplate.DrillArm);
            ArmTechTypes.Add(SeaTruckGrapplingArm_Prefab.TechTypeID, ArmTemplate.GrapplingArm);
            ArmTechTypes.Add(SeaTruckPropulsionArm_Prefab.TechTypeID, ArmTemplate.PropulsionArm);
            ArmTechTypes.Add(SeaTruckTorpedoArm_Prefab.TechTypeID, ArmTemplate.TorpedoArm);

            BZLogger.Log("API message: Base arm techtypes registered.");
        }
        /*
         * public static IEnumerable<string> SessionNewSeatruckSlotIDs
         * {
         *  get
         *  {
         *      foreach (SlotData slotData in SessionSeatruckSlots)
         *      {
         *          if (slotData.SlotType != SlotType.OriginalNormal)
         *          {
         *              yield return slotData.SlotID;
         *          }
         *      }
         *  }
         * }
         */
        /*
         * public static IEnumerable<string> SessionNewExosuitSlotIDs
         * {
         *  get
         *  {
         *      foreach (SlotData slotData in SessionExosuitSlots)
         *      {
         *          if (slotData.SlotType == SlotType.CloneNormal)
         *          {
         *              yield return slotData.SlotID;
         *          }
         *      }
         *  }
         * }
         */
        /*
         * public static IEnumerable<string> SessionNewChipSlotIDs
         * {
         *  get
         *  {
         *      foreach (SlotData slotData in NewChipSlots)
         *      {
         *         yield return slotData.SlotID;
         *      }
         *  }
         * }
         */

        public static void InitSlotIDs()
        {
            BZLogger.Debug("Method call: SlotHelper.InitSlotIDs()");

            for (int i = 0; i < SEzConfig.EXTRASLOTS; i++)
            {
                SessionSeatruckSlots.Add(NewSeatruckSlots[i]);
                SessionExosuitSlots.Add(NewExosuitSlots[i]);
            }

            if (SEzConfig.isSeatruckArmsExists)
            {
                foreach (SlotData slotData in NewSeatruckSlots)
                {
                    SlotType slotType = slotData.SlotType;

                    if (slotType == SlotType.CloneArmLeft || slotType == SlotType.CloneArmRight)
                    {
                        SessionSeatruckSlots.Add(slotData);
                    }
                }
            }

            NewChipSlotIDs = new string[NewChipSlots.Count];

            for (int i = 0; i < NewChipSlotIDs.Length; i++)
            {
                NewChipSlotIDs[i] = NewChipSlots[i].SlotID;
            }

            NewHoverbikeSlotIDs = new string[NewHoverbikeSlots.Count];

            for (int i = 0; i < NewHoverbikeSlotIDs.Length; i++)
            {
                NewHoverbikeSlotIDs[i] = NewHoverbikeSlots[i].SlotID;
            }

            SessionExosuitSlotIDs = new string[SessionExosuitSlots.Count];

            for (int i = 0; i < SessionExosuitSlotIDs.Length; i++)
            {
                SessionExosuitSlotIDs[i] = SessionExosuitSlots[i].SlotID;
            }

            SessionSeatruckSlotIDs = new string[SessionSeatruckSlots.Count];

            for (int i = 0; i < SessionSeatruckSlotIDs.Length; i++)
            {
                SessionSeatruckSlotIDs[i] = SessionSeatruckSlots[i].SlotID;
            }

            BZLogger.Log("Session slotID's created.");
        }
        internal void RegisterBaseArmHandlers()
        {
            ArmHandlers.Clear();

            ArmHandlers.Add(SeaTruckClawArm_Prefab.TechTypeID, new ClawArmHandlerRequest());
            ArmHandlers.Add(SeaTruckDrillArm_Prefab.TechTypeID, new DrillArmHandlerRequest());
            ArmHandlers.Add(SeaTruckGrapplingArm_Prefab.TechTypeID, new GrapplingArmHandlerRequest());
            ArmHandlers.Add(SeaTruckPropulsionArm_Prefab.TechTypeID, new PropulsionArmHandlerRequest());
            ArmHandlers.Add(SeaTruckTorpedoArm_Prefab.TechTypeID, new TorpedoArmHandlerRequest());

            BZLogger.Log("API message: Base arm handlers registered.");
        }
Пример #16
0
        internal static void Config_Init()
        {
            BZLogger.Debug("Method call: SEzConfig.Config_Init()");

            SLOTKEYBINDINGS_Update();

            KEYBINDINGS_Set();

            SLOTKEYBINDINGS_SyncToAll();

            BZLogger.Log("Configuration initialized.");
        }
        private void InitializeTextures()
        {
            ArmSocket_MultiColorMask      = ImageUtils.LoadTextureFromFile($"{Main.modFolder}/Assets/ArmSocket_MultiColorMask.png");
            ArmSocket_MultiColorMask.name = "ArmSocket_MultiColorMask";

            ArmSocket_Illum_Green      = ImageUtils.LoadTextureFromFile($"{Main.modFolder}/Assets/ArmSocket_Illum_Green.png");
            ArmSocket_Illum_Green.name = "ArmSocket_Illum_Green";

            ArmSocket_Illum_Red      = ImageUtils.LoadTextureFromFile($"{Main.modFolder}/Assets/ArmSocket_Illum_Red.png");
            ArmSocket_Illum_Red.name = "ArmSocket_Illum_Red";

            BZLogger.Log("API message: Texture cache initialized.");
        }
Пример #18
0
        public void ExecuteCommand(object message, object command)
        {
            if (message != null)
            {
                ErrorMessage.AddMessage(message.ToString());
            }

            if (command != null)
            {
                BZLogger.Log((string)command);
                DevConsole.SendConsoleCommand(command.ToString());
            }
        }
        private void AddToLog()
        {
            BZLogger.Log("\n*** Rhzero: Object Information Log ***");

            BZLogger.Log($"Object: {componentNames[selected_component]}");

            foreach (string item in objectInfoText)
            {
                BZLogger.Log(item);
            }

            BZLogger.Log("\n*** Rhzero: End of Log ***");
        }
Пример #20
0
 internal void PrintForces(Hoverbike hoverbike)
 {
     BZLogger.Log($"[{CmZConfig.PROGRAM_NAME}] DebugHoverBike:\n" +
                  $"forwardAccel: {hoverbike.forwardAccel}\n" +
                  $"forwardBoostForce: {hoverbike.forwardBoostForce}\n" +
                  $"fovMaxVelocity: {hoverbike.fovMaxVelocity}\n" +
                  $"fovSmoothSpeed: {hoverbike.fovSmoothSpeed}\n" +
                  $"fovSpeedPower: {hoverbike.fovSpeedPower}\n" +
                  $"verticalBoostForce: {hoverbike.verticalBoostForce}\n" +
                  $"hoverForce: {hoverbike.hoverForce}\n" +
                  $"verticalDampening: { hoverbike.verticalDampening}\n" +
                  $"waterDampening: {hoverbike.waterDampening}\n" +
                  $"waterLevelOffset: {hoverbike.waterLevelOffset}");
 }
        public void RegisterNewArm(CraftableSeaTruckArm armPrefab, ISeaTruckArmHandlerRequest armHandlerRequest)
        {
            if (ArmTechTypes.ContainsKey(armPrefab.TechType))
            {
                return;
            }

            ArmTechTypes.Add(armPrefab.TechType, armPrefab.ArmTemplate);
            ArmHandlers.Add(armPrefab.TechType, armHandlerRequest);

            string techName = TechTypeExtensions.AsString(armPrefab.TechType);

            BZLogger.Log($"API message: New arm techtype registered, ID:[{(int)armPrefab.TechType}], name:[{techName}]");
        }
        public static void Prefix(QuickSlots __instance, GameObject owner, Transform toolSocket, Transform cameraSocket,
                                  Inventory inv, Transform slotTr, ref int slotCount)
        {
            if (Main.isPatched)
            {
                return;
            }

            __instance.SetPrivateField("slotNames", ExpandedQuickSlotNames, BindingFlags.Static);

            slotCount = QSEzConfig.MAXSLOTS;

            BZLogger.Log("QuickSlots constructor Patched.");

            Main.isPatched = true;
        }
Пример #23
0
        internal static void CreateDefaultConfigFile()
        {
            BZLogger.Warn("Configuration file is missing or wrong version. Trying to create a new one.");

            try
            {
                ParserHelper.CreateDefaultConfigFile(FILENAME, "QuickSlotExtenderZero", PROGRAM_VERSION, DEFAULT_CONFIG);
                ParserHelper.AddInfoText(FILENAME, SECTIONS[1], "TextColor possible values: Red, Green, Blue, Yellow, White, Magenta, Cyan, Orange, Lime, Amethyst");

                BZLogger.Log("The new configuration file was successfully created.");
            }
            catch
            {
                BZLogger.Error("An error occured while creating the new configuration file!");
            }
        }
        public static void ExpandSlotMapping()
        {
            BZLogger.Debug("Method call: SlotHelper.ExpandSlotMapping()");

            foreach (SlotData slotData in NewChipSlots)
            {
                Equipment.slotMapping.Add(slotData.SlotID, EquipmentType.Chip);
            }

            foreach (SlotData slotData in ScannerModuleBatterySlots)
            {
                Equipment.slotMapping.Add(slotData.SlotID, EquipmentType.BatteryCharger);
            }

            foreach (SlotData slotData in NewHoverbikeSlots)
            {
                if (slotData.SlotType == SlotType.CloneNormal)
                {
                    Equipment.slotMapping.Add(slotData.SlotID, EquipmentType.HoverbikeModule);
                }
            }

            foreach (SlotData slotData in SessionExosuitSlots)
            {
                if (slotData.SlotType == SlotType.CloneNormal)
                {
                    Equipment.slotMapping.Add(slotData.SlotID, EquipmentType.ExosuitModule);
                }
            }

            foreach (SlotData slotData in SessionSeatruckSlots)
            {
                switch (slotData.SlotType)
                {
                case SlotType.CloneNormal:
                    Equipment.slotMapping.Add(slotData.SlotID, EquipmentType.SeaTruckModule);
                    break;

                case SlotType.CloneArmLeft:
                case SlotType.CloneArmRight:
                    Equipment.slotMapping.Add(slotData.SlotID, (EquipmentType)ModdedEquipmentType.SeatruckArm);
                    break;
                }
            }

            BZLogger.Log("Equipment slot mapping Patched!");
        }
        private IEnumerator InitializeArmSocketGraphics()
        {
            while (pipeResource == null || exosuitResource == null)
            {
                yield return(null);
            }

            GameObject pipes_end_cap = pipeResource.transform.Find("model/endcap/pipes_end_cap").gameObject;

            ArmSocket = Object.Instantiate(pipes_end_cap, GraphicsRoot.transform);

            ArmSocket.SetActive(false);

            ArmSocket.name = "ArmSocket";

            //GameObject exoStorage = exosuitResource.transform.Find("exosuit_01/root/geoChildren/upgrade_geoHldr/Exosuit_01_storage").gameObject;

            GameObject exoStorage = objectHelper.FindDeepChild(exosuitResource.transform, "Exosuit_01_storage").gameObject;

            objectHelper.GetPrefabClone(ref exoStorage, GraphicsRoot.transform, true, "model", out GameObject exoStorageModel);

            Renderer exoStorageRenderer = exoStorageModel.GetComponent <Renderer>();

            Renderer armsocket_renderer = ArmSocket.GetComponent <Renderer>();

            exoStorageRenderer.material.CopyPropertiesFromMaterial(armsocket_renderer.material);

            Texture _MainTex = armsocket_renderer.material.GetTexture(Shader.PropertyToID("_MainTex"));

            Material material = armsocket_renderer.material;

            material.EnableKeyword("UWE_3COLOR");
            material.EnableKeyword("MARMO_EMISSION");
            material.SetTexture(Shader.PropertyToID("_MainTex"), _MainTex);

            material.SetTexture(Shader.PropertyToID("_Illum"), ArmSocket_Illum_Green);
            material.SetTexture(Shader.PropertyToID("_MultiColorMask"), ArmSocket_MultiColorMask);

            Object.Destroy(exoStorageModel);

            BZLogger.Log("API message: Arm socket graphics cache initialized.");

            yield break;
        }
        public static void AddRendererToColorCustomizer(GameObject containCustomizer, GameObject containRenderer, bool clearCustomizer, params int[] materialIndexes)
        {
            ColorCustomizer colorCustomizer = containCustomizer.GetComponent <ColorCustomizer>();

            if (colorCustomizer == null)
            {
                throw new ArgumentException("GameObject does not have ColorCustomizer component!");
            }

            Renderer renderer = containRenderer.GetComponent <Renderer>();

            if (renderer == null)
            {
                throw new ArgumentException($"GameObject [{containRenderer.name}] does not have Renderer component!");
            }

            List <ColorCustomizer.ColorData> colorDatas = colorCustomizer.colorDatas.ToList();

            if (clearCustomizer)
            {
                colorDatas.Clear();
            }
            else
            {
                foreach (ColorCustomizer.ColorData colorData in colorDatas)
                {
                    if (colorData.renderer.Equals(renderer))
                    {
                        BZLogger.Log($"ColorData.renderers [{renderer.name}] has contain the desired renderer!");
                        return;
                    }
                }
            }

            foreach (int index in materialIndexes)
            {
                colorDatas.Add(new ColorCustomizer.ColorData {
                    renderer = renderer, materialIndex = index
                });
            }

            colorCustomizer.colorDatas = colorDatas.ToArray();
        }
Пример #27
0
        internal static void Config_CreateDefault()
        {
            BZLogger.Debug("Method call: SEzConfig.Config_CreateDefault()");

            BZLogger.Warn("Configuration file is missing or wrong version. Trying to create a new one.");

            try
            {
                ParserHelper.CreateDefaultConfigFile(FILENAME, "SlotExtenderZero", PROGRAM_VERSION, DEFAULT_CONFIG);

                ParserHelper.AddInfoText(FILENAME, "MaxSlots possible values", "5 to 12");
                ParserHelper.AddInfoText(FILENAME, "TextColor possible values", "Red, Green, Blue, Yellow, White, Magenta, Cyan, Orange, Lime, Amethyst");
                ParserHelper.AddInfoText(FILENAME, "SlotLayout possible values", "Grid, Circle");

                BZLogger.Log("The new configuration file was successfully created.");
            }
            catch
            {
                BZLogger.Error("An error occured while creating the new configuration file!");
            }
        }
        public static void AddRendererToSkyApplier(GameObject containAppliers, GameObject containRenderer, Skies applierType)
        {
            List <SkyApplier> skyAppliers = new List <SkyApplier>();

            containAppliers.GetComponents(skyAppliers);

            if (skyAppliers.Count < 1)
            {
                throw new ArgumentException($"GameObject [{containAppliers.name}] does not have SkyApplier components!");
            }

            Renderer renderer = containRenderer.GetComponent <Renderer>();

            if (renderer == null)
            {
                throw new ArgumentException($"GameObject [{containRenderer.name}] does not have Renderer component!");
            }

            foreach (SkyApplier skyApplier in skyAppliers)
            {
                if (skyApplier.anchorSky == applierType)
                {
                    List <Renderer> renderers = skyApplier.renderers.ToList();

                    if (renderers.Contains(renderer))
                    {
                        BZLogger.Log($"SkyApplier [{renderer.name}] has contain the desired renderer!");
                        return;
                    }

                    renderers.Add(renderer);

                    skyApplier.renderers = renderers.ToArray();

                    return;
                }
            }

            throw new Exception("The desired Skies type not found in these SkyAppliers!");
        }
Пример #29
0
        internal static void InitConfig()
        {
            VERSION = FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).FileVersion;

            if (!File.Exists(FILENAME))
            {
                BZLogger.Log($"[{PROGRAM_NAME}]Warning! Configuration file is missing. Creating a new one.");

                ParserHelper.CreateDefaultConfigFile(FILENAME, PROGRAM_NAME, VERSION, DEFAULT_CONFIG);
                ParserHelper.AddInfoText(FILENAME, SECTIONS[2], "OverPowerMultiplier and HungerAndThirstInterval possible values: 1 to 10");
            }

            isConsoleEnabled = bool.Parse(ParserHelper.GetKeyValue(FILENAME, SECTIONS[1], SECTION_PROGRAM[0]));
            isInfoBarEnabled = bool.Parse(ParserHelper.GetKeyValue(FILENAME, SECTIONS[1], SECTION_PROGRAM[1]));

            Section_hotkeys         = ParserHelper.GetAllKeyValuesFromSection(FILENAME, SECTIONS[0], SECTION_HOTKEYS);
            Section_settings        = ParserHelper.GetAllKeyValuesFromSection(FILENAME, SECTIONS[2], SECTION_SETTINGS);
            Section_toggleButtons   = ParserHelper.GetAllKeyValuesFromSection(FILENAME, SECTIONS[3], SECTION_TOGGLEBUTTONS);
            Section_userWarpTargets = ParserHelper.GetAllKVPFromSection(FILENAME, SECTIONS[4]);

            int.TryParse(Section_settings[SECTION_SETTINGS[0]], out overPowerMultiplier);

            if (overPowerMultiplier < 0 && overPowerMultiplier > 10)
            {
                overPowerMultiplier = 10;
                ParserHelper.SetKeyValue(FILENAME, SECTIONS[2], Section_settings[SECTION_SETTINGS[0]], 2.ToString());
            }

            int.TryParse(Section_settings[SECTION_SETTINGS[1]], out hungerAndThirstInterval);

            if (hungerAndThirstInterval < 0 && hungerAndThirstInterval > 10)
            {
                hungerAndThirstInterval = 10;
                ParserHelper.SetKeyValue(FILENAME, SECTIONS[2], Section_settings[SECTION_SETTINGS[1]], 2.ToString());
            }

            SetKeyBindings();
        }
        private void SearchForModdedTechTypes()
        {
            int i = 0;

            int[] techTypeArray = (int[])Enum.GetValues(typeof(TechType));

            for (int j = 0; j < techTypeArray.Length; j++)
            {
                if (techTypeArray[j] >= 11000)
                {
                    TechType techType = (TechType)techTypeArray[j];
                    string   techName = TechTypeExtensions.AsString(techType);

                    EquipmentType equipmentType = TechData.GetEquipmentType(techType);
                    FoundModdedTechTypes.Add(techName, techType);
                    TypeDefCache.Add(techType, equipmentType);
                    BZLogger.Log($"Modded techtype found! Name: [{techName}], ID: [{(int)techType}], Type: [{equipmentType}]");
                    i++;
                }
            }

            BZLogger.Log($"Found [{i}] modded TechType(s).");
        }