Beispiel #1
0
 protected override void OnInsertItem(Item item)
 {
     base.OnInsertItem(item);
     this.m_Container.Fill((LiquidContainer)item);
     Inventory3DManager.Get().OnLiquidTransfer();
     base.RemoveItem();
 }
Beispiel #2
0
    private void UpdateHook()
    {
        if (!this.m_Hook)
        {
            return;
        }
        bool flag = FishingController.Get().m_State != FishingController.State.Cast;

        if (this.m_Hook.gameObject.activeSelf != flag)
        {
            this.m_Hook.gameObject.SetActive(flag);
        }
        this.m_Hook.m_BaitSlot.gameObject.SetActive((Inventory3DManager.Get() && Inventory3DManager.Get().IsActive()) || this.m_Hook.m_Bait);
        if (this.m_Hook.m_BaitSlot.gameObject.activeSelf && !this.m_Hook.m_BaitSlot.m_Active)
        {
            this.m_Hook.m_BaitSlot.Activate();
        }
        if (!flag)
        {
            return;
        }
        if (this.m_State == FishingRod.State.Fishing || this.m_State == FishingRod.State.Strike || this.m_State == FishingRod.State.Cancel)
        {
            this.m_Hook.transform.rotation = this.m_Float.transform.rotation;
            this.m_Hook.transform.position = this.m_HookInWaterPos;
            return;
        }
        this.m_Hook.transform.localRotation = Quaternion.identity;
        this.m_Hook.transform.localPosition = Vector3.zero;
    }
Beispiel #3
0
 private void UpdateSlotActivity()
 {
     if (!Inventory3DManager.Get().m_CarriedItem)
     {
         this.m_GetSlot.gameObject.SetActive(false);
         return;
     }
     if (Inventory3DManager.Get().m_CarriedItem.m_Info.m_ID == ItemID.Coconut)
     {
         this.m_GetSlot.gameObject.SetActive(false);
         return;
     }
     if (this.m_GetSlot.gameObject.activeSelf)
     {
         if (!this.m_GetSlot.CanInsertItem(Inventory3DManager.Get().m_CarriedItem))
         {
             this.m_GetSlot.gameObject.SetActive(false);
             return;
         }
     }
     else if (this.m_GetSlot.CanInsertItem(Inventory3DManager.Get().m_CarriedItem))
     {
         LiquidContainerInfo liquidContainerInfo = (LiquidContainerInfo)Inventory3DManager.Get().m_CarriedItem.m_Info;
         if (liquidContainerInfo.m_Amount < liquidContainerInfo.m_Capacity)
         {
             this.m_GetSlot.gameObject.SetActive(true);
         }
     }
 }
Beispiel #4
0
    protected override void OnEnable()
    {
        base.OnEnable();
        Item currentItem = this.m_Player.GetCurrentItem(Hand.Right);

        DebugUtils.Assert(currentItem && currentItem.m_Info.IsWeapon(), true);
        if (!currentItem)
        {
            this.Stop();
            Player.Get().StartController(PlayerControllerType.FistFight);
            Player.Get().StartControllerInternal();
            return;
        }
        if (!Inventory3DManager.Get().gameObject.activeSelf&& !currentItem.m_IsBeingDestroyed)
        {
            currentItem.gameObject.SetActive(false);
        }
        this.m_WasActivated = false;
        DebugUtils.Assert(currentItem.m_DamagerStart, true);
        DebugUtils.Assert(currentItem.m_DamagerEnd, true);
        WeaponType weaponType = ((Weapon)currentItem).GetWeaponType();

        this.m_Animator.SetInteger(this.m_IWeaponType, (int)weaponType);
        this.SetState(WeaponControllerState.None);
        this.m_AlreadyHit = false;
        this.m_HitObjects.Clear();
        this.m_HandleEndTransform = this.m_Player.transform.FindDeepChild("mixamorig:Arm.R");
    }
Beispiel #5
0
    public void StartSleeping(RestingPlace place = null, bool block_moves = true)
    {
        if (!Player.Get().CanSleep())
        {
            return;
        }
        this.m_RestingPlace = place;
        this.SetupSurroundingConstructions();
        if (block_moves)
        {
            this.m_Player.BlockMoves();
            this.m_Player.BlockRotation();
        }
        this.m_StartSleepingTime = Time.time;
        this.m_StartSleepHour    = this.m_Sky.Cycle.Hour;
        this.m_Progress          = 0f;
        this.m_PrevProgress      = 0f;
        this.m_HourProgress      = 0;
        HUDSleeping.Get().gameObject.SetActive(true);
        MenuInGameManager.Get().HideMenu();
        Item currentItem = this.m_Player.GetCurrentItem(Hand.Right);

        if (currentItem != null && currentItem.m_Info.IsHeavyObject())
        {
            this.m_Player.DropItem(currentItem);
        }
        Player.Get().StartController(PlayerControllerType.Sleep);
        PlayerAudioModule.Get().PlaySleepSound();
        GreenHellGame.Instance.SetSnapshot(AudioMixerSnapshotGame.Sleep, 0.5f);
        if (Inventory3DManager.Get().IsActive())
        {
            Inventory3DManager.Get().Deactivate();
        }
    }
    public void Update()
    {
        if (!CustomCursor.Get())
        {
            return;
        }
        bool       visible    = Cursor.visible;
        CursorMode cursorMode = (Inventory3DManager.Get() && Inventory3DManager.Get().gameObject.activeSelf&& Inventory3DManager.Get().m_CarriedItem) ? CursorMode.ForceSoftware : CursorMode.Auto;

        if (cursorMode != this.m_Mode)
        {
            this.m_Mode = cursorMode;
            if (this.m_Mode == CursorMode.ForceSoftware)
            {
                CustomCursor.Get().Show(true);
                this.m_SystemCursorActive = false;
            }
            else
            {
                CustomCursor.Get().Show(false);
                this.m_SystemCursorActive = true;
            }
            if (CustomCursor.Get())
            {
                CustomCursor.Get().m_Texture = this.m_TexturesMap[this.m_Type];
            }
            Cursor.SetCursor(this.m_TexturesMap[this.m_Type], Vector2.zero, this.m_Mode);
        }
    }
Beispiel #7
0
 public void DropAllItems()
 {
     foreach (Item item in this.m_Items)
     {
         if (item.m_CurrentSlot)
         {
             if (item.m_CurrentSlot.IsStack())
             {
                 item.m_CurrentSlot.RemoveItem(item, false);
             }
             else
             {
                 item.m_CurrentSlot.RemoveItem();
             }
         }
         item.transform.parent = null;
         if (item.m_Info.m_InventoryCellsGroup != null)
         {
             item.m_Info.m_InventoryCellsGroup.Remove(item);
             item.m_Info.m_InventoryCellsGroup = null;
         }
         Inventory3DManager.Get().DropItem(item);
     }
     this.m_Items.Clear();
     this.OnInventoryChanged();
 }
Beispiel #8
0
 public void OnCraft(GameObject obj)
 {
     if (!Player.Get().CanStartCrafting())
     {
         return;
     }
     if (NotepadController.Get().IsActive())
     {
         NotepadController.Get().Hide();
         this.m_DelayedType = HUDQuickAccessBar.TYPE.Craft;
         this.m_DelayedObj  = obj;
         return;
     }
     if (BodyInspectionController.Get().IsActive())
     {
         Player.Get().StopController(PlayerControllerType.BodyInspection);
     }
     if (!Inventory3DManager.Get().gameObject.activeSelf)
     {
         Inventory3DManager.Get().Activate();
     }
     if (!CraftingManager.Get().gameObject.activeSelf)
     {
         CraftingManager.Get().Activate();
     }
     else
     {
         CraftingManager.Get().Deactivate();
     }
 }
Beispiel #9
0
    private void Start()
    {
        Camera camera = Inventory3DManager.Get().m_Camera;

        foreach (ItemSlot itemSlot in this.m_LeftSlots)
        {
            itemSlot.m_Camera                  = camera;
            itemSlot.m_BackpackSlot            = true;
            itemSlot.m_ShowIconIfFull          = false;
            itemSlot.m_ShowOnlyIfItemIsCorrect = true;
        }
        this.m_EquippedItemSlot = this.m_LeftSlots[0];
        foreach (ItemSlot itemSlot2 in this.m_RightSlots)
        {
            itemSlot2.m_Camera                  = camera;
            itemSlot2.m_BackpackSlot            = true;
            itemSlot2.m_ShowIconIfFull          = false;
            itemSlot2.m_ShowOnlyIfItemIsCorrect = true;
        }
        foreach (ItemSlot itemSlot3 in this.m_TopSlots)
        {
            itemSlot3.m_Camera                  = camera;
            itemSlot3.m_BackpackSlot            = true;
            itemSlot3.m_ShowIconIfFull          = false;
            itemSlot3.m_ShowOnlyIfItemIsCorrect = true;
        }
    }
Beispiel #10
0
    private void UpdateWoundSlots(HUDItemSlot.SlotData data)
    {
        bool flag = Inventory3DManager.Get().isActiveAndEnabled&& BodyInspectionController.Get().IsActive() && (!Inventory3DManager.Get().m_CarriedItem || data.slot.CanInsertItem(Inventory3DManager.Get().m_CarriedItem));

        data.obj.gameObject.SetActive(flag);
        if (!flag)
        {
            return;
        }
        Vector3 screenPoint = data.slot.GetScreenPoint();

        if (screenPoint.z <= 0f)
        {
            data.icon.enabled = false;
            return;
        }
        data.icon.rectTransform.position = screenPoint;
        BIWoundSlot biwoundSlot = (BIWoundSlot)data.slot;

        if (biwoundSlot.GetInjury() != null && BodyInspectionController.Get() != null && BodyInspectionController.Get().enabled&& biwoundSlot.GetInjury().m_Bandage == null && biwoundSlot.m_Maggots == null && biwoundSlot.GetInjury().m_ParentInjury == null)
        {
            data.icon.enabled = true;
            data.icon.color   = ((!(Inventory3DManager.Get().m_SelectedSlot == data.slot)) ? this.m_NormalColor : this.m_SelectedColor);
        }
        else
        {
            data.icon.enabled = false;
        }
    }
Beispiel #11
0
    public void OnPocketClick(string pocket_name)
    {
        BackpackPocket pocket = (BackpackPocket)Enum.Parse(typeof(BackpackPocket), pocket_name);

        Inventory3DManager.Get().SetupPocket(pocket);
        this.PlayChangeTabSound();
    }
Beispiel #12
0
    protected void DestroyMe(DamageInfo damage_info, string destroyed_prefab_name = "")
    {
        if (base.gameObject.GetComponent <DestroyablePlant>() != null)
        {
            base.gameObject.GetComponent <DestroyablePlant>().OnDestroyPlant();
        }
        string text = (destroyed_prefab_name.Length <= 0) ? this.m_Item.m_Info.m_DestroyedPrefabName : destroyed_prefab_name;

        if (text.Length > 0)
        {
            GameObject prefab = GreenHellGame.Instance.GetPrefab(text);
            if (!prefab)
            {
                DebugUtils.Assert("[:DestroyMe] Can't find destroyed prefab - " + text, true, DebugUtils.AssertType.Info);
                return;
            }
            GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(prefab, base.transform.position, base.transform.rotation);
        }
        for (int i = 0; i < this.m_Item.m_Info.m_ItemsToBackpackOnDestroy.Count; i++)
        {
            Item item = ItemsManager.Get().CreateItem(this.m_Item.m_Info.m_ItemsToBackpackOnDestroy[i], false, Vector3.zero, Quaternion.identity);
            if (item && !item.Take())
            {
                Inventory3DManager.Get().DropItem(item);
            }
        }
        StaticObjectsManager.Get().ObjectDestroyed(base.gameObject);
        this.PlayDestroySound();
        UnityEngine.Object.Destroy(base.gameObject);
    }
Beispiel #13
0
    public void Craft()
    {
        if (this.m_Result == ItemID.None)
        {
            DebugUtils.Assert("ERROR - Missing result ItemID! Can't craft item!", true, DebugUtils.AssertType.Info);
            return;
        }
        Item item = this.CreateItem(this.m_Result);

        ItemsManager.Get().OnCrafted(this.m_Result);
        this.m_Result = ItemID.None;
        InventoryBackpack.InsertResult insertResult = InventoryBackpack.Get().InsertItem(item, null, null, true, false, true, true, true);
        if (insertResult != InventoryBackpack.InsertResult.Ok)
        {
            this.AddItem(item, true);
        }
        else
        {
            item.OnTake();
        }
        InventoryBackpack.Get().SetupPocket(item.m_Info.m_BackpackPocket);
        Inventory3DManager.Get().SetNewCraftedItem(item);
        this.CheckResult();
        HUDCrafting.Get().Setup();
    }
Beispiel #14
0
 private void UpdateBlock()
 {
     if (this.m_IsBlock != InputsManager.Get().IsActionActive(InputsManager.InputAction.Block))
     {
         this.SetBlock(!this.m_IsBlock);
     }
     if (this.m_IsBlock)
     {
         PlayerConditionModule.Get().DecreaseStamina(PlayerConditionModule.Get().GetStaminaDecrease(StaminaDecreaseReason.Block) * Time.deltaTime);
         if (PlayerConditionModule.Get().GetStamina() == 0f)
         {
             this.SetBlock(false);
         }
         else if (SwimController.Get().IsActive())
         {
             this.SetBlock(false);
         }
         else if (Inventory3DManager.Get().gameObject.activeSelf)
         {
             this.SetBlock(false);
         }
         else if (HUDReadableItem.Get().enabled)
         {
             this.SetBlock(false);
         }
     }
 }
Beispiel #15
0
 public override void OnInputAction(InputsManager.InputAction action)
 {
     base.OnInputAction(action);
     if (action == InputsManager.InputAction.BowAim)
     {
         if (!Inventory3DManager.Get().gameObject.activeSelf&& this.m_State == BowController.State.Idle && this.m_Arrow != null && Time.time - this.m_EnterStateTime >= 0.5f && !PlayerConditionModule.Get().IsStaminaCriticalLevel())
         {
             this.SetState(BowController.State.AimLoop);
             this.m_Player.StartAim(Player.AimType.Bow);
             this.PlayDrawSound();
         }
     }
     else if (action == InputsManager.InputAction.BowShot)
     {
         if (this.m_State == BowController.State.AimLoop)
         {
             this.SetState(BowController.State.Shot);
             this.m_Player.StopAim();
             this.PlayShotSound();
         }
     }
     else if (action == InputsManager.InputAction.BowCancelAim && this.m_State == BowController.State.AimLoop)
     {
         this.SetState(BowController.State.Idle);
         this.m_Player.StopAim();
     }
 }
    private void StartPassingOut()
    {
        this.m_StartPassOutTime = 0f;
        this.m_Progress         = 0f;
        this.m_PrevProgress     = 0f;
        this.m_HoursDelta       = 0f;
        this.m_HourProgress     = 0;
        this.m_Player.ResetBlockMoves();
        this.m_Player.ResetBlockRotation();
        this.m_Player.BlockMoves();
        this.m_Player.BlockRotation();
        HUDItem.Get().Deactivate();
        this.m_MovesBlocked = true;
        this.SetState(ConsciousnessController.ConsciousnessState.PassingOut);
        this.m_Animator.SetInteger(this.m_PassOutHash, 1);
        if (Inventory3DManager.Get().gameObject.activeSelf)
        {
            Inventory3DManager.Get().Deactivate();
        }
        DialogsManager.Get().StopDialog();
        Item currentItem = this.m_Player.GetCurrentItem(Hand.Right);

        if (currentItem && currentItem.m_Info.IsStone())
        {
            this.m_Player.DropItem(currentItem);
        }
    }
Beispiel #17
0
    protected override void OnEnable()
    {
        base.OnEnable();
        this.m_Animator.SetBool(this.m_BSwim, true);
        this.m_Player.m_UseGravity = false;
        this.m_DiveBone            = this.m_Player.gameObject.transform.FindDeepChild("mixamorig:Spine");
        this.m_SwimBones.Clear();
        this.m_SwimBones.Add(this.m_Player.gameObject.transform.FindDeepChild("mixamorig:Eye.R"));
        this.m_WantedSpeed.Force(this.m_CharacterController.velocity);
        this.m_SwimBonesRotation = this.m_LookController.m_LookDev.y;
        this.m_DiveBonesRotation = 0f;
        if (Inventory3DManager.Get().gameObject.activeSelf)
        {
            Inventory3DManager.Get().Deactivate();
        }
        this.m_State = SwimState.Swim;
        if (this.m_Player.m_FPPController.m_TimeInAir > 1f)
        {
            this.m_CheckHighSpeed = true;
            PlayerAudioModule.Get().PlayFallIntoWaterSound();
        }
        else
        {
            PlayerAudioModule.Get().PlayFeetLandingSound(1f, false);
        }
        Item currentItem = Player.Get().GetCurrentItem();

        if (currentItem && currentItem.GetInfoID() == ItemID.Fire)
        {
            Player.Get().DropItem(currentItem);
        }
        Player.Get().StopAim();
        this.m_SmoothPos.Force(base.transform.position);
        DialogsManager.Get().StopDialog();
    }
Beispiel #18
0
    protected override void OnShow()
    {
        base.OnShow();
        this.OnClickLimb(Limb.LArm);
        this.m_LimbCurrentSelections[0].enabled = true;
        this.m_HintBG.gameObject.SetActive(true);
        this.m_HintText.gameObject.SetActive(true);
        PlayerArmorModule.Get().SetMeshesVisible(this.m_ArmorEnabled);
        if (this.m_ArmorEnabled)
        {
            BodyInspectionController.Get().OnArmorMeshesEnabled();
        }
        else
        {
            BodyInspectionController.Get().OnArmorMeshesDisabled();
        }
        this.m_ArmorBG.gameObject.SetActive(true);
        this.m_BackpackHint.SetActive(GreenHellGame.IsPadControllerActive() && !Inventory3DManager.Get().IsActive());
        this.m_SortBackpackHint.SetActive(GreenHellGame.IsPadControllerActive() && Inventory3DManager.Get().IsActive());
        TextGenerationSettings generationSettings = this.m_SelectLimbText.GetGenerationSettings(this.m_SelectLimbText.rectTransform.rect.size);

        generationSettings.scaleFactor = 1f;
        float preferredWidth = this.m_TextGen.GetPreferredWidth(this.m_SelectLimbText.text, generationSettings);

        this.m_SelectLimgBGSize.Set(Mathf.Max(99.75f, preferredWidth + this.m_SelectLimbW), this.m_SelectLimbBG.rectTransform.rect.size.y);
        this.m_SelectLimbBG.rectTransform.sizeDelta = this.m_SelectLimgBGSize;
        preferredWidth = this.m_TextGen.GetPreferredWidth(this.m_RotateLimbText.text, generationSettings);
        this.m_RotateLimgBGSize.Set(Mathf.Max(80f, preferredWidth + this.m_SelectLimbW), this.m_RotateLimbBG.rectTransform.rect.size.y);
        this.m_RotateLimbBG.rectTransform.sizeDelta = this.m_RotateLimgBGSize;
    }
Beispiel #19
0
    private void SetupSelections()
    {
        Color color = this.m_Buttons[0].m_Icon.color;

        color.a = ((!Player.Get().CanStartCrafting()) ? this.m_InactiveAlpha : (CraftingManager.Get().gameObject.activeSelf ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[0].m_Icon.color = color;
        color   = this.m_Buttons[3].m_Icon.color;
        color.a = ((!Player.Get().CanShowNotepad()) ? this.m_InactiveAlpha : (NotepadController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[3].m_Icon.color = color;
        color   = this.m_Buttons[4].m_Icon.color;
        color.a = (Inventory3DManager.Get().gameObject.activeSelf ? this.m_SelectedAlpha : this.m_NormalAlpha);
        this.m_Buttons[4].m_Icon.color = color;
        color   = this.m_Buttons[5].m_Icon.color;
        color.a = ((!Player.Get().CanStartBodyInspection()) ? this.m_InactiveAlpha : (BodyInspectionController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[5].m_Icon.color = color;
        color   = this.m_Buttons[1].m_Icon.color;
        color.a = ((!Player.Get().CanStartCrafting()) ? this.m_InactiveAlpha : (CraftingManager.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[1].m_Icon.color = color;
        color   = this.m_Buttons[0].m_Icon.color;
        color.a = ((!Player.Get().CanShowMap()) ? this.m_InactiveAlpha : (MapController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[0].m_Icon.color = color;
        color   = this.m_Buttons[2].m_Icon.color;
        color.a = ((!Player.Get().CanSleep()) ? this.m_InactiveAlpha : (SleepController.Get().IsActive() ? this.m_SelectedAlpha : this.m_NormalAlpha));
        this.m_Buttons[2].m_Icon.color = color;
    }
Beispiel #20
0
 private void LateUpdate()
 {
     if (MenuInGameManager.Get().IsAnyScreenVisible() || !this.m_MainCamera.enabled)
     {
         return;
     }
     CameraManager.Mode mode = this.m_Mode;
     if (mode != CameraManager.Mode.Normal)
     {
         if (mode != CameraManager.Mode.Free)
         {
             if (mode == CameraManager.Mode.CutscenePlayer)
             {
                 this.UpdateCutscenePlayerMode();
             }
         }
         else
         {
             this.UpdateFreeMode();
         }
     }
     else
     {
         this.UpdateNormalMode();
     }
     if (Inventory3DManager.Get().gameObject.activeSelf)
     {
         Inventory3DManager.Get().CustomUpdate();
     }
     HUDManager.Get().UpdateAfterCamera();
 }
Beispiel #21
0
 private void StopMovie()
 {
     this.m_Type = MovieType.None;
     if (this.m_PlayingMovieClip != null)
     {
         this.m_VideoPlayer.Stop();
         this.m_VideoPlayer.targetTexture = null;
         this.m_VideoPlayer.enabled       = false;
         this.m_PlayingMovieClip          = null;
         this.m_Texture.texture           = null;
         this.m_Texture.enabled           = false;
         this.m_Texture.gameObject.SetActive(false);
         this.m_BG.gameObject.SetActive(false);
         this.m_MainCamera.gameObject.SetActive(true);
         Inventory3DManager.Get().enabled = true;
         this.m_Camera.enabled = false;
         MainLevel.Instance.OnStopMovie();
         AudioSource component = base.gameObject.GetComponent <AudioSource>();
         component.Stop();
         component.clip = null;
         RenderTexture renderTexture = this.m_RenderTexture;
         if (renderTexture != null && renderTexture.IsCreated())
         {
             UnityEngine.Object.Destroy(this.m_RenderTexture);
         }
         this.m_RenderTexture = null;
         return;
     }
 }
Beispiel #22
0
    private void SetupName()
    {
        Trigger trigger = this.GetTrigger();

        if (trigger)
        {
            this.m_Name.text = trigger.GetTriggerInfoLocalized();
            this.m_Name.gameObject.SetActive(true);
            if (trigger.IsItem() && Inventory3DManager.Get().gameObject.activeSelf)
            {
                Item item = (Item)trigger;
                if (item.m_InInventory)
                {
                    int    itemsCount = InventoryBackpack.Get().GetItemsCount(item.GetInfoID());
                    Text   name       = this.m_Name;
                    string text       = name.text;
                    name.text = string.Concat(new object[]
                    {
                        text,
                        " (",
                        itemsCount,
                        ")"
                    });
                }
            }
        }
        else
        {
            this.m_Name.gameObject.SetActive(false);
        }
    }
Beispiel #23
0
    public override void UpdateAfterCamera()
    {
        base.UpdateAfterCamera();
        if (this.m_ActiveSlots.Count == 0 || !base.enabled)
        {
            return;
        }
        this.m_ClosestDistTemp = float.MaxValue;
        SlotData selectedSlotData = this.m_SelectedSlotData;

        this.m_SelectedSlotData = null;
        this.m_VisibleSlots.Clear();
        foreach (SlotData slotData in this.m_ActiveSlots)
        {
            if (slotData.slot.IsBIWoundSlot())
            {
                this.UpdateWoundSlots(slotData);
            }
            else
            {
                this.UpdateSlots(slotData);
            }
        }
        if (this.m_SelectedSlotData == null && Inventory3DManager.Get().IsActive() && Inventory3DManager.Get().m_ActivePocket != BackpackPocket.Left && Player.Get().GetCurrentItem(Hand.Right) && Player.Get().GetCurrentItem(Hand.Right).m_Info.IsFishingRod())
        {
            FishingRod component = Player.Get().GetCurrentItem(Hand.Right).gameObject.GetComponent <FishingRod>();
            ItemSlot   y;
            if (!component.m_Hook)
            {
                y = component.m_HookSlot;
            }
            else
            {
                y = component.m_Hook.m_BaitSlot;
            }
            foreach (SlotData slotData2 in this.m_VisibleSlots)
            {
                if (slotData2.slot == y)
                {
                    this.m_SelectedSlotData = slotData2;
                    break;
                }
            }
        }
        if (this.m_SelectedSlotData != null)
        {
            this.m_SelectedSlotData.icon.rectTransform.localScale = Vector2.one * 2f;
            if (this.m_SelectedSlotData.add_icon)
            {
                this.m_SelectedSlotData.add_icon.rectTransform.localScale = Vector2.one * 0.5f;
            }
            Color color = this.m_SelectedSlotData.icon.color;
            color.a *= 1.5f;
            this.m_SelectedSlotData.icon.color = color;
        }
        if (this.m_SelectedSlotData != selectedSlotData)
        {
            HUDItem.Get().OnChangeSelectedSlot(this.m_SelectedSlotData);
        }
    }
Beispiel #24
0
    private void PlayMovieWithFadeInternal()
    {
        this.m_TextSkip.text = GreenHellGame.Instance.GetLocalization().Get("HUDSkipMovie", true);
        VideoClip videoClip = Resources.Load("Movies/" + this.m_MovieName) as VideoClip;

        if (videoClip == null)
        {
            this.SetState(MovieWithFadeState.PostFadeOut);
            return;
        }
        this.m_RenderTexture = new RenderTexture((int)videoClip.width, (int)videoClip.height, 32, RenderTextureFormat.ARGB32);
        if (!this.m_RenderTexture.Create())
        {
            UnityEngine.Object.Destroy(this.m_RenderTexture);
            this.m_RenderTexture = null;
            this.SetState(MovieWithFadeState.PreFadeOut);
            return;
        }
        this.m_VideoPlayer.targetTexture = this.m_RenderTexture;
        this.m_VideoPlayer.clip          = videoClip;
        this.m_VideoPlayer.SetTargetAudioSource(0, base.GetComponent <AudioSource>());
        this.m_VideoPlayer.enabled = true;
        this.m_VideoPlayer.Play();
        this.m_Texture.texture = this.m_RenderTexture;
        this.m_Texture.enabled = true;
        this.m_Texture.gameObject.SetActive(true);
        this.m_BG.gameObject.SetActive(true);
        this.m_PlayingMovieClip = videoClip;
        this.m_MainCamera       = Camera.main;
        this.m_MainCamera.gameObject.SetActive(false);
        Inventory3DManager.Get().m_Camera.enabled = false;
        this.m_Camera.enabled   = true;
        this.m_VideoJustStarted = true;
    }
Beispiel #25
0
    public bool PlayMovie(string movie_name)
    {
        this.m_Type          = MovieType.Simple;
        this.m_TextSkip.text = GreenHellGame.Instance.GetLocalization().Get("HUDSkipMovie", true);
        movie_name           = this.GetMovieNamePlatformDependant(movie_name);
        VideoClip videoClip = Resources.Load("Movies/" + movie_name) as VideoClip;

        if (videoClip == null)
        {
            return(false);
        }
        this.m_RenderTexture = new RenderTexture((int)videoClip.width, (int)videoClip.height, 24, RenderTextureFormat.ARGB32);
        if (!this.m_RenderTexture.Create())
        {
            UnityEngine.Object.Destroy(this.m_RenderTexture);
            this.m_RenderTexture = null;
            return(false);
        }
        this.m_VideoPlayer.targetTexture = this.m_RenderTexture;
        this.m_VideoPlayer.clip          = videoClip;
        this.m_VideoPlayer.SetTargetAudioSource(0, base.GetComponent <AudioSource>());
        this.m_VideoPlayer.enabled = true;
        this.m_VideoPlayer.Play();
        this.m_Texture.texture = this.m_RenderTexture;
        this.m_Texture.enabled = true;
        this.m_Texture.gameObject.SetActive(true);
        this.m_BG.gameObject.SetActive(true);
        this.m_PlayingMovieClip = videoClip;
        this.m_MainCamera       = Camera.main;
        this.m_MainCamera.gameObject.SetActive(false);
        Inventory3DManager.Get().m_Camera.enabled = false;
        this.m_Camera.enabled   = true;
        this.m_VideoJustStarted = true;
        return(true);
    }
Beispiel #26
0
 public void OnInsertItem(ItemSlot slot)
 {
     if (this.m_TargetContainerSlot == slot)
     {
         ((LiquidContainer)slot.m_Item).Spill(-1f);
         this.m_TargetContainerInfo = (LiquidContainerInfo)slot.m_Item.m_Info;
         this.m_TargetContainerInfo.m_LiquidType = LiquidType.Water;
         HUDProcess.Get().RegisterProcess(slot.m_Item, slot.m_Item.GetIconName(), this, false);
         return;
     }
     if (slot.m_Item.m_Info.IsLiquidContainer())
     {
         Item item = slot.m_Item;
         this.Fill((LiquidContainerInfo)item.m_Info);
         slot.RemoveItem();
         if (InventoryBackpack.Get().InsertItem(item, null, null, true, true, true, true, true) != InsertResult.Ok)
         {
             DebugUtils.Assert("Tomuś, do something with this situation!", true, DebugUtils.AssertType.Info);
         }
         if (Inventory3DManager.Get().isActiveAndEnabled)
         {
             Inventory3DManager.Get().OnLiquidTransfer();
         }
     }
 }
Beispiel #27
0
 public bool InsertItem(Item item, ItemSlot slot, InventoryCellsGroup group, bool can_stack, bool can_auto_select_group, Storage storage = null)
 {
     if (item.m_Info.m_FakeItem)
     {
         return(true);
     }
     if (slot)
     {
         if (slot.CanInsertItem(item))
         {
             if (slot.IsStack() && slot.m_ItemParent && slot.m_ItemParent.m_Info.m_InventoryRotated != item.m_Info.m_InventoryRotated)
             {
                 Inventory3DManager.Get().RotateItem(item, true);
             }
             slot.InsertItem(item);
             return(true);
         }
         if (!slot.IsOccupied())
         {
             return(false);
         }
     }
     if (group == null)
     {
         if (can_stack)
         {
             List <Item> list = storage ? storage.m_Items : InventoryBackpack.Get().m_Items;
             for (int i = 0; i < list.Count; i++)
             {
                 Item item2 = list[i];
                 if (item2.m_InventorySlot && !item2.m_CurrentSlot && item2.m_InventorySlot.CanInsertItem(item))
                 {
                     if (item2.m_Info.m_InventoryRotated != item.m_Info.m_InventoryRotated)
                     {
                         Inventory3DManager.Get().RotateItem(item, true);
                     }
                     item2.m_InventorySlot.InsertItem(item);
                     return(true);
                 }
             }
         }
         if (can_auto_select_group)
         {
             group = this.FindFreeGroup(item);
             if (group != null && group.IsFree())
             {
                 group.Insert(item, this.m_Grid);
                 return(true);
             }
         }
         return(false);
     }
     if (group.IsFree())
     {
         group.Insert(item, this.m_Grid);
         return(true);
     }
     return(false);
 }
Beispiel #28
0
 public override void OnInputAction(InputsManager.InputAction action)
 {
     if (Inventory3DManager.Get().gameObject.activeSelf)
     {
         return;
     }
     base.OnInputAction(action);
 }
Beispiel #29
0
    private void UpdateAimVisibility()
    {
        bool active = this.m_ShowCrosshair && !Inventory3DManager.Get().gameObject.activeSelf&& !BodyInspectionController.Get().IsActive() && !HUDWheel.Get().enabled&& !HUDNewWheel.Get().enabled&& !BodyInspectionMiniGameController.Get().IsActive();

        this.m_CrosshairLeft.gameObject.SetActive(active);
        this.m_CrosshairRight.gameObject.SetActive(active);
        this.m_Crosshair_Down.gameObject.SetActive(active);
    }
Beispiel #30
0
 private void Update()
 {
     if (!Inventory3DManager.Get().gameObject.activeSelf)
     {
         Inventory3DManager.Get().Activate();
     }
     this.UpdateHints();
 }