コード例 #1
0
 private static void InitializeEquippableComponent(EquippableModComponent equippable, ProxyObject dict, string inheritanceName)
 {
     InitializeBaseComponent(equippable, dict, inheritanceName);
     equippable.EquippedModelPrefabName = dict[inheritanceName]["EquippedModelPrefab"];
     equippable.ImplementationType      = dict[inheritanceName]["ImplementationType"];
     equippable.EquippingAudio          = dict[inheritanceName]["EquippingAudio"];
 }
コード例 #2
0
        internal static void Prefix(PlayerManager __instance, GearItem gi)
        {
            EquippableModComponent equippable = ModUtils.GetEquippableModComponent(__instance.m_ItemInHands);

            if (equippable != null)
            {
                __instance.UnequipItemInHands();
            }
        }
コード例 #3
0
        public static void Unequip(EquippableModComponent modComponent)
        {
            if (modComponent == null)
            {
                return;
            }

            GameManager.GetPlayerManagerComponent().UnequipItemInHandsSkipAnimation();
        }
コード例 #4
0
        internal static void Postfix(PlayerManager __instance, PlayerControlMode mode)
        {
            if (mode == lastMode)
            {
                return;
            }

            lastMode = mode;

            EquippableModComponent equippable = ComponentUtils.GetEquippableModComponent(__instance.m_ItemInHands);

            equippable?.OnControlModeChangedWhileEquipped?.Invoke();
        }
コード例 #5
0
        private static void Postfix(GearItem gi, ref bool __result)
        {
            if (__result || gi is null)
            {
                return;
            }
            EquippableModComponent equippable = ComponentUtils.GetEquippableModComponent(gi);

            if (equippable != null)
            {
                __result = true;
            }
        }
コード例 #6
0
ファイル: Mapper.cs プロジェクト: nbakulev/ModComponent
        private static void ConfigureEquippable(ModComponent modComponent)
        {
            EquippableModComponent equippableModComponent = modComponent as EquippableModComponent;

            if (equippableModComponent == null)
            {
                return;
            }

            if (string.IsNullOrEmpty(equippableModComponent.InventoryActionLocalizationId) && !string.IsNullOrEmpty(equippableModComponent.ImplementationType))
            {
                equippableModComponent.InventoryActionLocalizationId = "GAMEPLAY_Equip";
            }
        }
コード例 #7
0
        internal static void Configure(ModComponent modComponent)
        {
            EquippableModComponent equippableModComponent = modComponent.TryCast <EquippableModComponent>();

            if (equippableModComponent is null)
            {
                return;
            }

            if (string.IsNullOrEmpty(equippableModComponent.InventoryActionLocalizationId) &&
                !string.IsNullOrEmpty(equippableModComponent.ImplementationType) &&
                !string.IsNullOrEmpty(equippableModComponent.EquippedModelPrefabName))
            {
                equippableModComponent.InventoryActionLocalizationId = "GAMEPLAY_Equip";
            }
        }
コード例 #8
0
ファイル: GearEquipper.cs プロジェクト: ds5678/ModComponent
        internal static void OnUnequipped(EquippableModComponent modComponent)
        {
            if (modComponent is null)
            {
                return;
            }

            if (modComponent.EquippedModel != null)
            {
                Object.Destroy(modComponent.EquippedModel);
                modComponent.EquippedModel = null;
            }

            modComponent.OnUnequipped?.Invoke();
            ModComponentUtils.ModUtils.PlayAudio(modComponent.StowAudio);
        }
コード例 #9
0
        public static void Equip(EquippableModComponent equippable)
        {
            if (equippable == null)
            {
                return;
            }

            if (equippable.EquippedModelPrefab != null)
            {
                equippable.EquippedModel       = Object.Instantiate(equippable.EquippedModelPrefab, GameManager.GetWeaponCamera().transform);
                equippable.EquippedModel.layer = vp_Layer.Weapon;
            }

            equippable.OnEquipped?.Invoke();

            InterfaceManager.QuitCurrentScreens();
            ModUtils.PlayAudio(equippable.EquippingAudio);
        }
コード例 #10
0
        public static bool Prefix()
        {
            PlayerManager playerManager = GameManager.GetPlayerManagerComponent();

            if (playerManager == null || InterfaceManager.IsOverlayActive() || playerManager.InPlaceMeshMode() || playerManager.ItemInHandsPlaceable())
            {
                return(true);
            }

            EquippableModComponent equippable = ModUtils.GetEquippableModComponent(playerManager.m_ItemInHands);

            if (equippable == null)
            {
                return(true);
            }

            equippable.OnSecondaryAction?.Invoke();
            return(false);
        }
コード例 #11
0
        public static bool Prefix(MonoBehaviour context)
        {
            PlayerManager playerManager = GameManager.GetPlayerManagerComponent();

            if (playerManager == null || GameManager.ControlsLocked() || InterfaceManager.IsOverlayActive() || !InputManager.GetFirePressed(context) || InputManager.GetFireReleased(context))
            {
                return(true);
            }

            EquippableModComponent equippable = ModUtils.GetEquippableModComponent(playerManager.m_ItemInHands);

            if (equippable == null || equippable.Implementation == null)
            {
                return(true);
            }

            equippable.OnPrimaryAction?.Invoke();
            return(false);
        }
コード例 #12
0
ファイル: GearEquipper.cs プロジェクト: ds5678/ModComponent
        public static void Equip(EquippableModComponent equippable)
        {
            if (equippable is null)
            {
                return;
            }

            GameObject equippedModelPrefab = Resources.Load(equippable.EquippedModelPrefabName)?.Cast <GameObject>();

            if (equippedModelPrefab != null)
            {
                equippable.EquippedModel       = Object.Instantiate(equippedModelPrefab, GameManager.GetWeaponCamera().transform);
                equippable.EquippedModel.layer = vp_Layer.Weapon;
            }
            else
            {
                Logger.Log("The equippedModelPrefab for '{0}' was null.", equippable.EquippedModelPrefabName);
            }

            equippable.OnEquipped?.Invoke();

            InterfaceManager.QuitCurrentScreens();
            ModComponentUtils.ModUtils.PlayAudio(equippable.EquippingAudio);
        }