public void Deactivate() { if (!this.m_Active) { return; } this.m_Active = false; this.ClearDatas(); Player.Get().UnblockMoves(); Player.Get().UnblockRotation(); if (this.m_CursorVisible) { CursorManager.Get().ShowCursor(false, false); CursorManager.Get().SetCursor(CursorManager.TYPE.Normal); this.m_CursorVisible = false; } if (this.m_MarkedData != null) { if (!this.m_MarkedData.m_IsGroup && GreenHellGame.IsPCControllerActive()) { this.OnSelectDialog(this.m_MarkedData); } this.m_MarkedData = null; } if (!DialogsManager.Get().IsAnyDialogPlaying()) { WalkieTalkieController.Get().OnStopDialog(null); } }
public void OnStartNode(DialogNode node) { if (WalkieTalkieController.Get()) { WalkieTalkieController.Get().OnStartNode(node); } }
public void OnStopDialog(Dialog dialog, bool finish) { if (WalkieTalkieController.Get()) { WalkieTalkieController.Get().OnStopDialog(dialog); } if (finish) { this.LockScenarioDialog(dialog.m_Name); } }
protected override void Attack() { base.Attack(); if (WalkieTalkieController.Get().IsActive()) { WalkieTalkieController.Get().Stop(); } this.m_AlreadyHit = false; this.m_HitObjects.Clear(); this.SetState(WeaponControllerState.Swing); this.m_LastAnimFrame = 0f; }
private void Update() { if (Player.Get().IsDead()) { if (this.m_CurrentDialog != null) { this.m_CurrentDialog.Stop(false); this.m_CurrentDialog = null; } return; } if (this.m_DialogsQueue.Count > 0 && !this.IsAnyDialogPlaying()) { Dialog dialog = this.m_DialogsQueue[0]; this.m_DialogsQueue.RemoveAt(0); this.StartDialog(dialog.m_Name); } if (this.m_CurrentDialog != null) { this.m_CurrentDialog.Update(); if (this.m_CurrentDialog.IsFinished()) { this.m_CurrentDialog = null; } } else if (GreenHellGame.DEBUG && Input.GetKeyDown(KeyCode.Keypad1) && this.m_DebugDialogName != string.Empty) { this.StartDialog(this.m_DebugDialogName); } if (this.m_CurrentDialog != null) { if (LoadingScreen.Get().m_Active&& !this.m_CurrentDialog.m_Paused) { this.m_CurrentDialog.Pause(); } else if (!LoadingScreen.Get().m_Active&& this.m_CurrentDialog.m_Paused) { this.m_CurrentDialog.UnPause(); } WalkieTalkieController.Get().UpdateWTLight(); } }
protected override void Attack() { base.Attack(); if (WalkieTalkieController.Get().IsActive()) { WalkieTalkieController.Get().Stop(); } if (PlayerConditionModule.Get().IsStaminaCriticalLevel()) { this.SetAttackParam(this.m_CurrentPhase + 4); } else if (this.m_CurrentMode == FistFightController.Mode.Normal) { this.SetAttackParam(this.m_CurrentPhase); } else { this.SetAttackParam(this.m_CurrentPhase + 1); } this.m_ActionAllowed = false; base.Invoke("AllowAction", 0.25f); }
protected override void Update() { base.Update(); this.UpdateScroll(); this.m_MarkedData = null; this.UpdateVis(); bool flag = PlayerWalkieTalkieModule.Get().CanCall(); this.m_BackBG.gameObject.SetActive(this.m_MarkedData == null && RectTransformUtility.RectangleContainsScreenPoint(this.m_BackBG.rectTransform, Input.mousePosition)); CursorManager.Get().SetCursor((this.m_MarkedData != null || this.m_BackBG.gameObject.activeSelf) ? CursorManager.TYPE.MouseOver : CursorManager.TYPE.Normal); if (flag && (Input.GetMouseButtonDown(0) || Input.GetKeyDown(InputHelpers.PadButton.Button_X.KeyFromPad()))) { if (this.m_MarkedData != null) { this.OnSelectDialog(this.m_MarkedData); } else if (this.m_BackBG.gameObject.activeSelf) { if (this.m_InGroup) { this.SetupDialogs(); this.m_InGroup = false; } else if (WalkieTalkieController.Get().IsActive()) { WalkieTalkieController.Get().Stop(); } } } this.UpdateBatteryLevel(); this.UpdateHeaderText(); Color color = this.m_WTIcon.color; color.a = (flag ? 1f : this.m_InactiveAlpha); this.m_WTIcon.color = color; this.UpdateBackButton(); }
public override bool CanTrigger() { return((!this.m_CantTriggerDuringDialog || !DialogsManager.Get().IsAnyDialogPlaying()) && !WalkieTalkieController.Get().IsActive() && base.CanTrigger()); }
public void ExecuteTrigger(Trigger trigger, TriggerAction.TYPE action) { if (this.IsGrabInProgress()) { return; } if (HUDSelectDialog.Get().enabled) { return; } if (Time.time - this.m_LastTrigerExecutionTime < 0.1f) { return; } if (!trigger) { return; } if (this.m_TriggerToExecute) { if (Time.time - this.m_TriggerToExecuteTime > 2f) { this.m_TriggerToExecute = null; this.m_TriggerActionToExecute = TriggerAction.TYPE.None; } return; } if (trigger.PlayGrabAnimOnExecute(action)) { if (WalkieTalkieController.Get().IsActive()) { WalkieTalkieController.Get().Stop(); } this.m_TriggerToExecute = trigger; this.m_TriggerActionToExecute = action; this.m_TriggerToExecuteTime = Time.time; } else { trigger.OnExecute(action); this.m_LastTrigerExecutionTime = Time.time; } if (action == TriggerAction.TYPE.Take || action == TriggerAction.TYPE.TakeHold || action == TriggerAction.TYPE.TakeHoldLong || action == TriggerAction.TYPE.PickUp) { Item currentItem = this.m_Player.GetCurrentItem(Hand.Left); if (currentItem != null && currentItem.m_Info.m_ID == ItemID.Bow) { this.m_Animator.SetBool(TriggerController.s_BGrabItemBow, true); return; } if (currentItem != null && currentItem.m_Info.m_ID == ItemID.Bamboo_Bow) { this.m_Animator.SetBool(TriggerController.s_BGrabItemBambooBow, true); return; } if (currentItem && currentItem.m_Info.IsBow()) { this.m_Animator.SetBool(TriggerController.s_BGrabItemBow, true); return; } if (trigger.PlayGrabAnimOnExecute(action)) { if (WalkieTalkieController.Get().IsActive()) { WalkieTalkieController.Get().Stop(); } this.m_Animator.SetBool(TriggerController.s_BGrabItem, true); return; } } else if (action == TriggerAction.TYPE.DrinkHold) { this.m_Animator.SetBool(this.m_BDrinkWater, true); this.m_TriggerInAction = true; } }
private bool CanCrouch() { return(!Inventory3DManager.Get().IsActive() && !MapController.Get().IsActive() && !NotepadController.Get().IsActive() && !HeavyObjectController.Get().IsActive() && !WalkieTalkieController.Get().IsActive() && !ConstructionController.Get().IsActive() && !HUDItem.Get().m_Active&& !HUDWheel.Get().m_Active); }
private bool ExecuteAction(HUDItem.Action action, Item item) { if (action != HUDItem.Action.Close && this.m_ItemReplacer != null) { item = this.m_ItemReplacer.ReplaceItem(); this.m_ItemReplacer = null; } switch (action) { case HUDItem.Action.Close: this.SetActive(false); break; case HUDItem.Action.Take: if (item) { item.Take(); } else if (this.m_PlantFruit) { this.m_PlantFruit.Take(); } break; case HUDItem.Action.PickUp: item.PickUp(true); break; case HUDItem.Action.Eat: if (item) { item.Eat(); } else if (this.m_PlantFruit) { this.m_PlantFruit.Eat(); } break; case HUDItem.Action.Drink: if (item) { item.Drink(); } else if (this.m_LiquidSource) { this.m_LiquidSource.Drink(); } break; case HUDItem.Action.Harvest: Player.Get().HideWeapon(); HarvestingSmallAnimalController.Get().SetItem(item); Player.Get().StartController(PlayerControllerType.HarvestingSmallAnimal); break; case HUDItem.Action.Craft: if (Player.Get().CanStartCrafting()) { if (WalkieTalkieController.Get().IsActive()) { WalkieTalkieController.Get().Stop(); } if (Player.Get().GetCurrentItem(Hand.Left) == item) { Player.Get().SetWantedItem(Hand.Left, null, true); } else if (Player.Get().GetCurrentItem(Hand.Right) == item) { Player.Get().SetWantedItem(Hand.Right, null, true); } else if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0) { item.m_InventorySlot.RemoveItem(item, false); } else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot) { item.m_CurrentSlot.RemoveItem(item, false); } else if (item.m_CurrentSlot && item.m_CurrentSlot.m_WeaponRackParent) { item.m_CurrentSlot.RemoveItem(item, false); } if (InventoryBackpack.Get().m_EquippedItem == item) { InventoryBackpack.Get().m_EquippedItem = null; } InventoryBackpack.Get().RemoveItem(item, false); Storage3D.Get().RemoveItem(item, false); CraftingManager.Get().Activate(); CraftingManager.Get().AddItem(item, true); } break; case HUDItem.Action.Fill: this.m_LiquidSource.TakeLiquid(); break; case HUDItem.Action.Equip: Player.Get().Equip(item.m_CurrentSlot); break; case HUDItem.Action.Drop: if (CraftingManager.Get().gameObject.activeSelf&& CraftingManager.Get().ContainsItem(item)) { CraftingManager.Get().RemoveItem(item, false); } if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0) { item.m_InventorySlot.RemoveItem(item, false); } else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot) { item.m_CurrentSlot.RemoveItem(item, false); } if (InventoryBackpack.Get().m_EquippedItem == item) { InventoryBackpack.Get().m_EquippedItem = null; } InventoryBackpack.Get().RemoveItem(item, false); Inventory3DManager.Get().DropItem(item); break; case HUDItem.Action.Swap: item.Swap(); break; case HUDItem.Action.Use: if (this.m_Item.IsStorage()) { Storage3D.Get().Activate((Storage)this.m_Item); } else if (MakeFireController.Get().IsActive()) { InventoryBackpack.Get().RemoveItem(this.m_Item, false); MakeFireController.Get().InsertItemToKindlingSlot(this.m_Item); } else { Item currentItem = Player.Get().GetCurrentItem(); if (currentItem) { InventoryBackpack.Get().InsertItem(currentItem, InventoryBackpack.Get().m_EquippedItemSlot, null, true, true, true, true, false); Player.Get().SetWantedItem(currentItem.m_Info.IsBow() ? Hand.Left : Hand.Right, null, true); if (Player.Get().m_ControllerToStart != PlayerControllerType.Unknown) { Player.Get().StartControllerInternal(); } } Player.Get().SetWantedItem(this.m_Item, true); } break; case HUDItem.Action.Spill: ((LiquidContainer)this.m_Item).Spill(-1f); break; case HUDItem.Action.Destroy: if (GreenHellGame.IsPadControllerActive() && !this.m_DestroyButton.confirm.gameObject.activeSelf) { this.m_DestroyButton.confirm.gameObject.SetActive(true); this.m_DestroyButton.confirm_sel.gameObject.SetActive(true); return(false); } if (!this.m_DestroyButton.confirm_sel.gameObject.activeSelf) { return(true); } if (CraftingManager.Get().gameObject.activeSelf&& CraftingManager.Get().ContainsItem(item)) { CraftingManager.Get().RemoveItem(item, false); } if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0) { item.m_InventorySlot.RemoveItem(item, false); } else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot) { item.m_CurrentSlot.RemoveItem(item, false); } if (InventoryBackpack.Get().m_EquippedItem == item) { InventoryBackpack.Get().m_EquippedItem = null; } InventoryBackpack.Get().RemoveItem(item, false); UnityEngine.Object.Destroy(item.gameObject); break; case HUDItem.Action.Take3: if (item) { item.Take3(); } break; case HUDItem.Action.TakeAll: if (item) { item.TakeAll(); } break; case HUDItem.Action.TakeClay: if (this.m_LiquidSource) { this.m_LiquidSource.TakeClay(); } break; case HUDItem.Action.CleanUp: PlayerArmorModule.Get().SetMeshesVisible(true); BodyInspectionController.Get().OnArmorMeshesEnabled(); Player.Get().m_Animator.SetBool(Player.Get().m_CleanUpHash, false); break; case HUDItem.Action.DestroyStack: if (GreenHellGame.IsPadControllerActive() && !this.m_DestroyStackButton.confirm.gameObject.activeSelf) { this.m_DestroyStackButton.confirm.gameObject.SetActive(true); this.m_DestroyStackButton.confirm_sel.gameObject.SetActive(true); return(false); } if (!this.m_DestroyStackButton.confirm_sel.gameObject.activeSelf) { return(true); } if (!item.m_CurrentSlot && item.m_InventorySlot && item.m_InventorySlot.m_Items.Count > 0) { UnityEngine.Object.Destroy(item.gameObject); } else if (item.m_CurrentSlot && item.m_CurrentSlot.m_InventoryStackSlot) { UnityEngine.Object.Destroy(item.m_CurrentSlot.m_ItemParent.gameObject); } else if (item.m_CurrentSlot && item.m_CurrentSlot.m_BackpackSlot && item.m_CurrentSlot.IsStack()) { for (int i = 0; i < ((ItemSlotStack)item.m_CurrentSlot).m_Items.Count; i++) { UnityEngine.Object.Destroy(((ItemSlotStack)item.m_CurrentSlot).m_Items[i].gameObject); } } break; case HUDItem.Action.SwapArmor: { Limb selectedLimb = HUDBodyInspection.Get().GetSelectedLimb(); ArmorData armorData = PlayerArmorModule.Get().GetArmorData(selectedLimb); Item attachedArmor = armorData.m_AttachedArmor; ItemSlot currentSlot = attachedArmor.m_CurrentSlot; if (currentSlot != null) { currentSlot.RemoveItem(); } PlayerArmorModule.Get().ArmorCarryStarted(attachedArmor); InventoryCellsGroup inventoryCellsGroup = this.m_Item.m_Info.m_InventoryCellsGroup; InventoryBackpack.Get().RemoveItem(this.m_Item, false); if (attachedArmor.m_Info.m_InventoryRotated != this.m_Item.m_Info.m_InventoryRotated) { Inventory3DManager.Get().RotateItem(attachedArmor, false); } InventoryBackpack.Get().InsertItem(attachedArmor, null, inventoryCellsGroup, true, true, true, true, true); armorData.m_Slot.InsertItem(this.m_Item); break; } case HUDItem.Action.EquipArmor: InventoryBackpack.Get().RemoveItem(this.m_Item, false); PlayerArmorModule.Get().GetArmorData(HUDBodyInspection.Get().GetSelectedLimb()).m_Slot.InsertItem(this.m_Item); break; case HUDItem.Action.Insert: if (HUDItemSlot.Get().m_SelectedSlotData == null) { return(false); } if (!HUDItemSlot.Get().m_SelectedSlotData.slot.CanInsertItem(this.m_Item)) { ((HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages))).AddMessage(GreenHellGame.Instance.GetLocalization().Get("HUD_CannotInsertItem", true), new Color?(Color.red), HUDMessageIcon.None, "", null); return(true); } if (this.m_Item.m_Storage) { this.m_Item.m_Storage.RemoveItem(this.m_Item, false); } InventoryBackpack.Get().RemoveItem(this.m_Item, false); HUDItemSlot.Get().m_SelectedSlotData.slot.InsertItem(this.m_Item); break; case HUDItem.Action.Pick: Inventory3DManager.Get().StartCarryItem(this.m_Item, false); break; case HUDItem.Action.TakeOffArmor: { Item attachedArmor2 = PlayerArmorModule.Get().GetArmorData(HUDBodyInspection.Get().GetSelectedLimb()).m_AttachedArmor; if (attachedArmor2) { PlayerArmorModule.Get().ArmorCarryStarted(attachedArmor2); InventoryBackpack.Get().InsertItem(attachedArmor2, null, null, true, true, true, true, true); } break; } case HUDItem.Action.Plow: { Acre acre = (this.m_Item && this.m_Item.IsAcre()) ? ((Acre)this.m_Item) : null; if (!acre) { return(true); } acre.Plow(); break; } case HUDItem.Action.PickStack: Inventory3DManager.Get().StartCarryItem(this.m_Item, true); break; } return(true); }
public void Execute() { if (this.m_ExecutionInProgress) { return; } if (this.m_ActiveButton == null) { this.Deactivate(); return; } if (!Inventory3DManager.Get().gameObject.activeSelf&& this.m_ActiveButton.action != HUDItem.Action.Harvest && this.m_ActiveButton.action != HUDItem.Action.Destroy && this.m_ActiveButton.action != HUDItem.Action.DestroyStack) { this.m_ActionToExecute = this.m_ActiveButton.action; switch (this.m_ActionToExecute) { case HUDItem.Action.Take: case HUDItem.Action.PickUp: case HUDItem.Action.Eat: case HUDItem.Action.Drink: case HUDItem.Action.Harvest: case HUDItem.Action.Craft: case HUDItem.Action.Use: case HUDItem.Action.Take3: case HUDItem.Action.TakeAll: case HUDItem.Action.TakeClay: case HUDItem.Action.CleanUp: case HUDItem.Action.Pick: case HUDItem.Action.TakeOffArmor: case HUDItem.Action.Plow: case HUDItem.Action.PickStack: if (WalkieTalkieController.Get().IsActive()) { WalkieTalkieController.Get().Stop(); } break; } Player.Get().BlockMoves(); Player.Get().BlockRotation(); if (this.m_ActionToExecute == HUDItem.Action.Drink && this.m_LiquidSource) { Player.Get().HideWeapon(); Player.Get().m_Animator.SetBool(TriggerController.Get().m_BDrinkWater, true); } else if (this.m_ActionToExecute == HUDItem.Action.CleanUp) { Player.Get().HideWeapon(); Player.Get().m_Animator.SetBool(Player.Get().m_CleanUpHash, true); PlayerArmorModule.Get().SetMeshesVisible(false); BodyInspectionController.Get().OnArmorMeshesDisabled(); Player.Get().OnStartWashinghands(); } else { Item currentItem = Player.Get().GetCurrentItem(Hand.Left); if (currentItem != null && currentItem.m_Info.m_ID == ItemID.Bow) { Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItemBow, true); } else if (currentItem != null && currentItem.m_Info.m_ID == ItemID.Bamboo_Bow) { Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItemBambooBow, true); } else if (currentItem && currentItem.m_Info.IsBow()) { Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItemBow, true); } else { Player.Get().m_Animator.SetBool(TriggerController.s_BGrabItem, true); } } this.m_ExecutionInProgress = true; return; } if (!this.ExecuteAction(this.m_ActiveButton.action, this.m_Item)) { return; } base.Invoke("DelayDeactivate", this.m_DelayDeactivate); this.m_DelayDeactivateRequested = true; this.m_ElemGroup.SetActive(false); }