示例#1
0
        internal override void AddToPanel(uGUI_TabbedControlsPanel panel, int tabIndex)
        {
            // Add item
            OptionGameObject = panel.AddItem(tabIndex, panel.bindingOptionPrefab);

            // Update text
            Text text = OptionGameObject.GetComponentInChildren <Text>();

            if (text != null)
            {
                OptionGameObject.GetComponentInChildren <TranslationLiveUpdate>().translationKey = Label;
                text.text = Language.main.Get(Label);
            }

            // Create bindings
            uGUI_Bindings bindings = OptionGameObject.GetComponentInChildren <uGUI_Bindings>();
            uGUI_Binding  binding  = bindings.bindings[0];

            // Destroy secondary bindings
            int last = bindings.bindings.Length - 1;

            UnityEngine.Object.Destroy(bindings.bindings[last].gameObject);
            UnityEngine.Object.Destroy(bindings);

            // Update bindings
            binding.device = Device;
            binding.value  = KeyCodeUtils.KeyCodeToString(Key);
#if SUBNAUTICA
            binding.onValueChanged.RemoveAllListeners();
            var callback = new UnityAction <KeyCode>((KeyCode key) => parentOptions.OnKeybindChange(Id, key));
            binding.onValueChanged.AddListener(new UnityAction <string>((string s) => callback?.Invoke(KeyCodeUtils.StringToKeyCode(s))));
#elif BELOWZERO
            binding.action     = ButtonPatcher.EnsureButton(Label, KeyCodeUtils.KeyCodeToString(Key), Device);
            binding.bindingSet = GameInput.BindingSet.Primary;
            var callback = new UnityAction <KeyCode>((KeyCode key) => parentOptions.OnKeybindChange(Id, key));
            binding.bindCallback = new Action <GameInput.Device, GameInput.Button, GameInput.BindingSet, string>((GameInput.Device device, GameInput.Button button, GameInput.BindingSet bindingSet, string s) => { callback?.Invoke(KeyCodeUtils.StringToKeyCode(s)); panel.TryBind1_0(device, button, bindingSet, s); binding.RefreshValue(); });
#endif

            base.AddToPanel(panel, tabIndex);
        }
示例#2
0
        public static void PostPatch()
        {
            FishPatcher.Patch(harmony);

            TechTypePatcher.Patch();
#if BELOWZERO
            ButtonPatcher.Patch();
#endif
            CraftTreeTypePatcher.Patch();
            PingTypePatcher.Patch();
            EnumPatcher.Patch(harmony);

            CraftDataPatcher.Patch(harmony);
            CraftTreePatcher.Patch(harmony);
            ConsoleCommandsPatcher.Patch(harmony);
            LanguagePatcher.Patch(harmony);
            PrefabDatabasePatcher.PostPatch(harmony);
            SpritePatcher.Patch(harmony);
            KnownTechPatcher.Patch(harmony);
            BioReactorPatcher.Patch();
            OptionsPanelPatcher.Patch(harmony);
            ItemsContainerPatcher.Patch(harmony);
            PDAPatcher.Patch(harmony);
            PDAEncyclopediaPatcher.Patch(harmony);
            ItemActionPatcher.Patch(harmony);
            LootDistributionPatcher.Patch(harmony);
            WorldEntityDatabasePatcher.Patch(harmony);
            IngameMenuPatcher.Patch(harmony);
            TooltipPatcher.Patch(harmony);



            Logger.Debug("Saving TechType Cache");
            TechTypePatcher.cacheManager.SaveCache();
            Logger.Debug("Saving CraftTreeType Cache");
            CraftTreeTypePatcher.cacheManager.SaveCache();
            Logger.Debug("Saving PingType Cache");
            PingTypePatcher.cacheManager.SaveCache();
        }