public void UpdatePadCursor(float speed_mul = 1f)
    {
        if (!GreenHellGame.IsPadControllerActive())
        {
            return;
        }
        Vector2 vector = new Vector2(InputsManager.Get().GetActionValue(InputsManager.InputAction.LookRight) - InputsManager.Get().GetActionValue(InputsManager.InputAction.LookLeft), InputsManager.Get().GetActionValue(InputsManager.InputAction.LookUp) - InputsManager.Get().GetActionValue(InputsManager.InputAction.LookDown));

        vector.x = CJTools.Math.GetProportionalClamp(this.m_ControllerCursorDeadZone, 1f, System.Math.Abs(vector.x), 0f, 1f) * (float)System.Math.Sign(vector.x);
        vector.y = CJTools.Math.GetProportionalClamp(this.m_ControllerCursorDeadZone, 1f, System.Math.Abs(vector.y), 0f, 1f) * (float)System.Math.Sign(vector.y);
        if (vector == Vector2.zero)
        {
            return;
        }
        float magnitude = vector.magnitude;

        if (magnitude > 1f)
        {
            vector /= magnitude;
        }
        float num  = (float)Screen.height / 1080f;
        float num2 = this.m_ControllerCursorSpeedCurve.Evaluate(vector.magnitude);

        vector *= num2 * this.m_ControllerCursorSpeed * num * Time.deltaTime * speed_mul;
        this.m_LocalCursorPos  += vector;
        this.m_LocalCursorPos.x = Mathf.Clamp(this.m_LocalCursorPos.x, 0f, (float)Screen.width);
        this.m_LocalCursorPos.y = Mathf.Clamp(this.m_LocalCursorPos.y, 0f, (float)Screen.height);
        this.SetCursorPos(this.m_LocalCursorPos);
    }
Beispiel #2
0
 public virtual void OnShow()
 {
     if (GreenHellGame.IsPadControllerActive())
     {
         if (this.m_ActiveMenuOption != null && this.m_ActiveMenuOption.m_Button != null)
         {
             this.m_ActiveMenuOption.m_Button.Select();
             this.m_ActiveMenuOption.m_Button.OnSelect(null);
             return;
         }
         foreach (MenuBase.MenuOptionData menuOptionData in this.m_OptionsObjects.Values)
         {
             if (this.IsMenuButtonEnabled(menuOptionData.m_Button))
             {
                 UIButtonEx component = menuOptionData.m_Button.GetComponent <UIButtonEx>();
                 if (!component || component.m_MoveWhenFocused)
                 {
                     this.m_ActiveMenuOption = menuOptionData;
                     break;
                 }
             }
             if (this.IsMenuSliderEnabled(menuOptionData.m_Slider))
             {
                 this.m_ActiveMenuOption = menuOptionData;
                 break;
             }
             if (this.IsMenuSelectButtonEnabled(menuOptionData.m_SelectButton))
             {
                 this.m_ActiveMenuOption = menuOptionData;
                 break;
             }
         }
     }
 }
Beispiel #3
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;
    }
    public void OnChangeControllerOption()
    {
        GreenHellGame.Instance.m_Settings.SaveSettings();
        GreenHellGame.Instance.m_Settings.ApplySettings(false);
        MainMenuManager mainMenuManager = MainMenuManager.Get();

        if (mainMenuManager != null)
        {
            mainMenuManager.SetupController();
        }
        MenuInGameManager menuInGameManager = MenuInGameManager.Get();

        if (menuInGameManager != null)
        {
            menuInGameManager.SetupController();
        }
        HUDManager hudmanager = HUDManager.Get();

        if (hudmanager != null)
        {
            hudmanager.SetuController();
        }
        if (MainMenuManager.Get())
        {
            if (GreenHellGame.IsPadControllerActive())
            {
                CursorManager.Get().ShowCursor(false, false);
                return;
            }
            if (GreenHellGame.IsPCControllerActive())
            {
                CursorManager.Get().ShowCursor(true, false);
            }
        }
    }
Beispiel #5
0
 private void UpdateInputs()
 {
     if (!Player.Get().GetMovesBlocked())
     {
         this.m_Inputs.m_Vertical   = InputsManager.Get().GetActionValue(InputsManager.InputAction.Forward) - InputsManager.Get().GetActionValue(InputsManager.InputAction.Backward);
         this.m_Inputs.m_Vertical   = Mathf.Sign(this.m_Inputs.m_Vertical) * (this.m_Inputs.m_Vertical * this.m_Inputs.m_Vertical);
         this.m_Inputs.m_Horizontal = InputsManager.Get().GetActionValue(InputsManager.InputAction.Right) - InputsManager.Get().GetActionValue(InputsManager.InputAction.Left);
         this.m_Inputs.m_Horizontal = Mathf.Sign(this.m_Inputs.m_Horizontal) * (this.m_Inputs.m_Horizontal * this.m_Inputs.m_Horizontal);
         this.m_Inputs.m_Jump       = InputsManager.Get().IsActionActive(InputsManager.InputAction.Jump);
         if (GreenHellGame.IsPadControllerActive() && HUDWheel.Get().m_Active)
         {
             this.m_Inputs.m_Duck = false;
         }
         if (GreenHellGame.Instance.m_Settings.m_ToggleRunOption == GameSettings.ToggleRunOption.No)
         {
             this.m_Inputs.m_Sprint = InputsManager.Get().IsActionActive(InputsManager.InputAction.Sprint);
         }
     }
     else if (!MainLevel.Instance.IsPause())
     {
         this.m_Inputs.m_Jump   = false;
         this.m_Inputs.m_Sprint = false;
     }
     if (!this.m_Player.GetRotationBlocked())
     {
         Vector2 lookInput = InputHelpers.GetLookInput(this.m_LookSensitivityX, this.m_LookSensitivityY, this.m_PadSensitivity);
         this.m_Inputs.m_MouseX = lookInput.x;
         this.m_Inputs.m_MouseY = lookInput.y;
     }
 }
 public void OnCloseDialog()
 {
     if (GreenHellGame.IsPadControllerActive())
     {
         this.m_Slots[this.m_SlotIdx].Select();
         this.m_Slots[this.m_SlotIdx].OnSelect(null);
     }
 }
Beispiel #7
0
 protected override void Update()
 {
     base.Update();
     if (GreenHellGame.IsPadControllerActive() && Input.GetKeyDown(InputHelpers.PadButton.Back.KeyFromPad()))
     {
         this.OnDebug();
     }
 }
Beispiel #8
0
 public float GetAxis(string axis_name)
 {
     if (this.m_PadControllerType == InputsManager.PadControllerType.Ps4 && GreenHellGame.IsPadControllerActive() && CrossPlatformInputManager.AxisExists(axis_name + "Ps4"))
     {
         return(CrossPlatformInputManager.GetAxis(axis_name + "Ps4"));
     }
     return(CrossPlatformInputManager.GetAxis(axis_name));
 }
Beispiel #9
0
 private Dictionary <int, List <InputActionData> > GetActionsByKeyCode()
 {
     if (!GreenHellGame.IsPadControllerActive() || this.m_PadControllerType != InputsManager.PadControllerType.Ps4)
     {
         return(this.m_ActionsByKeyCode);
     }
     return(this.m_Ps4ActionsByKeyCode);
 }
Beispiel #10
0
 protected override void OnShow()
 {
     base.OnShow();
     this.SetupSelections();
     this.PlayOpenSound();
     this.SetupController();
     this.m_PadQuitHint.SetActive(GreenHellGame.IsPadControllerActive() && !BodyInspectionController.Get().IsActive());
     this.m_PadSortHint.SetActive(GreenHellGame.IsPadControllerActive() && !BodyInspectionController.Get().IsActive());
 }
Beispiel #11
0
    public void Show(IYesNoDialogOwner owner, DialogWindowType type, string label = "label", string description = "description", bool change_effect = true)
    {
        this.m_DialogType                = type;
        this.m_DW.m_LabelText.text       = label;
        this.m_DW.m_DescriptionText.text = description;
        if (GreenHellGame.IsPadControllerActive())
        {
            this.m_DW.m_Button1.gameObject.SetActive(false);
            this.m_DW.m_Button2.gameObject.SetActive(false);
            this.m_DW.m_Button3.gameObject.SetActive(false);
            if (type == DialogWindowType.YesNo)
            {
                this.m_DW.m_PadButton1.gameObject.SetActive(true);
                this.m_DW.m_PadButton2.gameObject.SetActive(true);
                this.m_DW.m_PadButton3.gameObject.SetActive(false);
            }
            else if (type == DialogWindowType.Ok)
            {
                this.m_DW.m_PadButton1.gameObject.SetActive(false);
                this.m_DW.m_PadButton2.gameObject.SetActive(false);
                this.m_DW.m_PadButton3.gameObject.SetActive(true);
            }
        }
        else
        {
            this.m_DW.m_PadButton1.gameObject.SetActive(false);
            this.m_DW.m_PadButton2.gameObject.SetActive(false);
            this.m_DW.m_PadButton3.gameObject.SetActive(false);
            if (type == DialogWindowType.YesNo)
            {
                this.m_DW.m_Button1.gameObject.SetActive(true);
                this.m_DW.m_Button2.gameObject.SetActive(true);
                this.m_DW.m_Button3.gameObject.SetActive(false);
            }
            else if (type == DialogWindowType.Ok)
            {
                this.m_DW.m_Button1.gameObject.SetActive(false);
                this.m_DW.m_Button2.gameObject.SetActive(false);
                this.m_DW.m_Button3.gameObject.SetActive(true);
            }
        }
        base.gameObject.SetActive(true);
        this.m_Screen = owner;
        this.SetCanvasActive(false);
        this.m_ChangeEffect = change_effect;
        if (this.m_ChangeEffect)
        {
            PostProcessManager.Get().SetWeight(PostProcessManager.Effect.InGameMenu, 1f);
        }
        MenuScreen menuScreen = this.m_Screen as MenuScreen;

        if (menuScreen != null && !menuScreen.m_IsIngame)
        {
            Time.timeScale = 0.5f;
        }
        InputsManager.Get().RegisterReceiver(this);
    }
 private void UpdateController()
 {
     if (this.m_BlockControllerUpdate)
     {
         return;
     }
     this.m_PadControllerConnected = false;
     string[] joystickNames = Input.GetJoystickNames();
     if (joystickNames.Length != 0)
     {
         int i = 0;
         while (i < joystickNames.Length)
         {
             if (!string.IsNullOrEmpty(joystickNames[i]))
             {
                 this.m_PadControllerConnected = true;
                 if (joystickNames[i].Contains("Wireless") && !joystickNames[i].Contains("Xbox"))
                 {
                     InputsManager.Get().m_PadControllerType = InputsManager.PadControllerType.Ps4;
                     break;
                 }
                 InputsManager.Get().m_PadControllerType = InputsManager.PadControllerType.Xbox;
                 break;
             }
             else
             {
                 i++;
             }
         }
     }
     if (GreenHellGame.IsPadControllerActive() && !this.m_PadControllerConnected)
     {
         GreenHellGame.Instance.m_Settings.m_ControllerType = ControllerType.PC;
         this.OnChangeControllerOption();
     }
     if (this.m_PadControllerConnected && GreenHellGame.IsPCControllerActive() && !this.m_WasPadConstrollerInfo)
     {
         if (MainLevel.Instance && !MainLevel.Instance.IsPause())
         {
             MenuInGameManager.Get().ShowScreen(typeof(MenuInGame));
             this.m_PadConstrollerInfoPause = true;
         }
         this.m_WasPadConstrollerInfo = true;
         GreenHellGame.GetYesNoDialog().Show(this, DialogWindowType.YesNo, GreenHellGame.Instance.GetLocalization().Get("YesNoDialog_Info", true), GreenHellGame.Instance.GetLocalization().Get("ControllerDetected_Info", true), false);
     }
     if (this.m_WasPadConstrollerInfo && !this.m_PadControllerConnected)
     {
         this.m_WasPadConstrollerInfo = false;
         return;
     }
     if (this.m_PadControllerConnected && GreenHellGame.IsPadControllerActive())
     {
         this.m_WasPadConstrollerInfo = true;
     }
 }
Beispiel #13
0
	public virtual void SetupController()
	{
		bool flag = GreenHellGame.IsPadControllerActive();
		foreach (GameObject gameObject in this.m_PadDisableElements)
		{
			gameObject.SetActive(!flag && base.enabled);
		}
		foreach (GameObject gameObject2 in this.m_PadEnableElements)
		{
			gameObject2.SetActive(flag && base.enabled);
		}
	}
 protected override void Update()
 {
     base.Update();
     this.UpdateSlots();
     if (!GreenHellGame.IsYesNoDialogActive())
     {
         CursorManager.Get().SetCursor(((this.m_ActiveMenuOption != null && this.m_ActiveMenuOption.m_Button != null) || this.m_HLSlotIdx >= 0) ? CursorManager.TYPE.MouseOver : CursorManager.TYPE.Normal);
     }
     if (GreenHellGame.IsPadControllerActive())
     {
         CursorManager.Get().SetCursorPos(Vector2.zero);
     }
 }
Beispiel #15
0
    public override void OnShow()
    {
        base.OnShow();
        if (GreenHellGame.IsPadControllerActive())
        {
            CursorManager.Get().ShowCursor(true, false);
        }
        Transform transform = base.transform.FindDeepChild("DebugSpawn");

        if (transform == null)
        {
            return;
        }
        transform.gameObject.SetActive(false);
    }
Beispiel #16
0
 public override void GetActions(List <TriggerAction.TYPE> actions)
 {
     if (!this.m_Info.m_CanBeAddedToInventory)
     {
         actions.Add(TriggerAction.TYPE.PickUp);
         actions.Add(TriggerAction.TYPE.Expand);
     }
     else if (this.m_Info.m_Harvestable || this.m_Info.m_Eatable || this.m_Info.CanDrink() || this.m_Info.m_Craftable)
     {
         actions.Add(TriggerAction.TYPE.Expand);
     }
     if (GreenHellGame.IsPadControllerActive() && Inventory3DManager.Get().IsActive() && Inventory3DManager.Get().CanSetCarriedItem(true))
     {
         actions.Add(TriggerAction.TYPE.Pick);
     }
 }
Beispiel #17
0
 public override void GetActions(List <TriggerAction.TYPE> actions)
 {
     if (HeavyObjectController.Get().IsActive())
     {
         return;
     }
     if (GreenHellGame.IsPadControllerActive() && Inventory3DManager.Get().IsActive() && Inventory3DManager.Get().CanSetCarriedItem(true))
     {
         actions.Add(TriggerAction.TYPE.Pick);
     }
     if (this.m_Info.m_CanBeAddedToInventory)
     {
         actions.Add(TriggerAction.TYPE.Take);
     }
     actions.Add(TriggerAction.TYPE.Expand);
 }
Beispiel #18
0
    private void UpdateSelectionBG()
    {
        bool flag = false;

        if (this.m_ActiveButton != null)
        {
            this.m_SelectionBG.rectTransform.position = this.m_ActiveButton.trans.position + Vector3.right * 5f;
            flag = true;
            if (GreenHellGame.IsPadControllerActive() && this.m_DestroyButton != null && this.m_DestroyButton.confirm.gameObject.activeSelf)
            {
                flag = false;
            }
            if (GreenHellGame.IsPadControllerActive() && this.m_DestroyStackButton != null && this.m_DestroyStackButton.confirm.gameObject.activeSelf)
            {
                flag = false;
            }
        }
        this.m_SelectionBG.gameObject.SetActive(flag);
        this.m_PadIconSelect.SetActive(GreenHellGame.IsPadControllerActive() && (flag || (this.m_DestroyButton != null && this.m_DestroyButton.confirm_sel.activeSelf)));
        if (this.m_PadIconSelect.activeSelf)
        {
            float x = ((RectTransform)HUDManager.Get().m_CanvasGameObject.transform).localScale.x;
            if (flag)
            {
                Vector3 position = this.m_SelectionBG.transform.position;
                position.x += this.m_SelectionBG.rectTransform.rect.width * 0.5f * x + this.m_PadIconSelect.GetComponent <Image>().rectTransform.rect.width * 0.3f * x;
                this.m_PadIconSelect.transform.position = position;
            }
            else
            {
                Vector3 position2 = this.m_DestroyButton.confirm_sel.transform.position;
                position2.x += this.m_DestroyButton.confirm_sel.GetComponent <Image>().rectTransform.rect.width * 0.5f * x + this.m_PadIconSelect.GetComponent <Image>().rectTransform.rect.width * 0.3f * x;
                this.m_PadIconSelect.transform.position = position2;
            }
        }
        if (GreenHellGame.IsPCControllerActive())
        {
            if (this.m_DestroyButton != null)
            {
                this.m_DestroyButton.confirm.gameObject.SetActive(this.m_DestroyButton == this.m_ActiveButton);
            }
            if (this.m_DestroyStackButton != null)
            {
                this.m_DestroyStackButton.confirm.gameObject.SetActive(this.m_DestroyStackButton == this.m_ActiveButton);
            }
        }
    }
    private void OnChangeControllerOption()
    {
        base.SetupController();
        bool flag = GreenHellGame.IsPadControllerConnected();

        this.m_ControllerButton.gameObject.SetActive(flag);
        this.m_ControllerButton.SetByOption(GreenHellGame.IsPCControllerActive() ? "No" : "Yes");
        if (GreenHellGame.IsPadControllerActive() && this.m_CursorVisible)
        {
            this.HideCursor();
        }
        else if (GreenHellGame.IsPCControllerActive() && !this.m_CursorVisible)
        {
            this.ShowCursor();
        }
        this.m_PadControllerConnected = flag;
    }
    public override void OnShow()
    {
        base.OnShow();
        EventSystem current = EventSystem.current;

        if (current != null)
        {
            current.SetSelectedGameObject(null);
        }
        this.m_BackButton.GetComponentInChildren <Text>().text = GreenHellGame.Instance.GetLocalization().Get("Menu_Back", true);
        this.FillSlots();
        if (GreenHellGame.IsPadControllerActive())
        {
            this.m_Slots[0].Select();
            this.m_Slots[0].OnSelect(null);
        }
    }
Beispiel #21
0
    public void SetupController()
    {
        bool flag = GreenHellGame.IsPadControllerActive();

        foreach (GameObject gameObject in this.m_PadDisableElements)
        {
            if (gameObject != null)
            {
                gameObject.SetActive(!flag);
            }
        }
        foreach (GameObject gameObject2 in this.m_PadEnableElements)
        {
            if (gameObject2 != null)
            {
                gameObject2.SetActive(flag);
            }
        }
    }
 public void OnTriggerAction(TriggerAction.TYPE action)
 {
     if (GreenHellGame.IsPadControllerActive())
     {
         if ((Inventory3DManager.Get().IsActive() || this.m_Player.GetRotationBlocked()) && action != TriggerAction.TYPE.Expand && action != TriggerAction.TYPE.InventoryExpand && action != TriggerAction.TYPE.Use && action != TriggerAction.TYPE.Pick && action != TriggerAction.TYPE.Remove)
         {
             return;
         }
     }
     else if (this.m_Player.GetRotationBlocked())
     {
         return;
     }
     this.OnTriggerAction(ref this.m_BestTrigger, ref this.m_HoldDatasBestTrigger, action);
     if (this.m_AdditionalTrigger.trigger && this.m_AdditionalTrigger.actions.Contains(action) && this.m_AdditionalTrigger.trigger.CanExecuteActions())
     {
         this.ExecuteTrigger(this.m_AdditionalTrigger.trigger, action);
     }
 }
Beispiel #23
0
 protected override void Update()
 {
     base.Update();
     if (this.m_BG.color.a < 1f)
     {
         Color color = this.m_BG.color;
         color.a        += Time.deltaTime;
         color.a         = Mathf.Clamp01(color.a);
         this.m_BG.color = color;
     }
     else if (this.m_CanvasGroup.alpha < 1f)
     {
         this.m_CanvasGroup.alpha += Time.deltaTime;
         this.m_CanvasGroup.alpha  = Mathf.Clamp01(this.m_CanvasGroup.alpha);
         Color color2 = this.m_QuitButton.image.color;
         color2.a = this.m_CanvasGroup.alpha;
         this.m_QuitButton.image.color = color2;
         color2   = this.m_QuitText.color;
         color2.a = this.m_CanvasGroup.alpha;
         this.m_QuitText.color = color2;
     }
     if (this.m_CanvasGroup.alpha < 1f)
     {
         if (this.m_CursorVisible)
         {
             this.ShowCursor(false);
             return;
         }
     }
     else
     {
         if (GreenHellGame.IsPCControllerActive() && !this.m_CursorVisible)
         {
             this.ShowCursor(true);
             return;
         }
         if (GreenHellGame.IsPadControllerActive() && this.m_CursorVisible)
         {
             this.ShowCursor(false);
         }
     }
 }
Beispiel #24
0
    protected override void OnShow()
    {
        base.OnShow();
        Vector3 position = this.m_Dummy.transform.position;

        position.y = (float)Screen.height * 0.23f;
        this.m_Dummy.transform.position = position;
        this.m_Reply.SetActive(GreenHellGame.IsPCControllerActive());
        this.m_ReplyCanvasGroup.alpha = 0f;
        this.m_ReplyPad.SetActive(GreenHellGame.IsPadControllerActive());
        this.m_ReplyPadCanvasGroup.alpha = 0f;
        this.m_NodesVisible = false;
        this.m_SelectedNode = 0;
        this.Setup();
        InputsManager.Get().RegisterReceiver(this);
        this.Update();
        foreach (UISelectDialogNodeData uiselectDialogNodeData in this.m_UINodeDatas)
        {
            uiselectDialogNodeData.m_Object.SetActive(this.m_NodesVisible);
        }
    }
Beispiel #25
0
 protected override void OnHide()
 {
     base.OnHide();
     Player.Get().UnblockRotation();
     Player.Get().UnblockMoves();
     if (this.m_CursorVisible)
     {
         CursorManager.Get().ShowCursor(false, false);
         CursorManager.Get().SetCursor(CursorManager.TYPE.Normal);
         this.m_CursorVisible = false;
     }
     else if (GreenHellGame.IsPadControllerActive() && Inventory3DManager.Get().IsActive() && this.m_PadHideCursorPos != Vector2.zero)
     {
         CursorManager.Get().ShowCursor(this.m_PadHideCursorPos);
     }
     foreach (HUDItemButton huditemButton in this.m_ActiveButtons)
     {
         huditemButton.confirm_sel.gameObject.SetActive(false);
         huditemButton.confirm.gameObject.SetActive(false);
     }
     this.HideElements();
 }
Beispiel #26
0
    public override void GetActions(List <TriggerAction.TYPE> actions)
    {
        if (HeavyObjectController.Get().IsActive())
        {
            return;
        }
        if (GreenHellGame.IsPadControllerActive() && Inventory3DManager.Get().IsActive() && Inventory3DManager.Get().CanSetCarriedItem(true))
        {
            actions.Add(TriggerAction.TYPE.Pick);
        }
        switch (this.m_State)
        {
        case Bowl.State.None:
            if (LiquidInHandsController.Get().IsActive())
            {
                actions.Add(TriggerAction.TYPE.Pour);
            }
            else if (!this.m_RackChild)
            {
                actions.Add(TriggerAction.TYPE.Take);
            }
            break;

        case Bowl.State.UnsafeWater:
        case Bowl.State.WaterCooked:
        case Bowl.State.Herb:
        case Bowl.State.HerbCooked:
            if (this.m_LCInfo.CanDrink())
            {
                actions.Add(TriggerAction.TYPE.Drink);
            }
            else
            {
                actions.Add(TriggerAction.TYPE.Take);
            }
            break;
        }
        actions.Add(TriggerAction.TYPE.Expand);
    }
Beispiel #27
0
 private void UpdateInputs()
 {
     if (InputsManager.Get().IsActionActive(InputsManager.InputAction.Quit) || InputsManager.Get().IsActionActive(InputsManager.InputAction.AdditionalQuit))
     {
         this.Deactivate();
     }
     if (GreenHellGame.IsPadControllerActive() && this.m_DetailsScrollbar)
     {
         if (InputsManager.Get().IsActionActive(InputsManager.InputAction.LSForward))
         {
             this.m_ScrollValue += Time.deltaTime * this.m_PadScrollSpeed;
         }
         else if (InputsManager.Get().IsActionActive(InputsManager.InputAction.LSBackward))
         {
             this.m_ScrollValue -= Time.deltaTime * this.m_PadScrollSpeed;
         }
         this.m_ScrollValue = Mathf.Clamp01(this.m_ScrollValue);
     }
     if (GreenHellGame.IsPadControllerActive() && this.m_DetailsScrollbar)
     {
         this.m_DetailsScrollbar.value = this.m_ScrollValue;
     }
 }
Beispiel #28
0
    public override void OnShow()
    {
        base.OnShow();
        base.EnableSlots(true);
        this.m_IsDialog = false;
        bool flag = this.m_Slots.Any((SaveGameMenuSlot s) => !s.m_Empty && s.m_SaveInfo.loadable && s.m_SaveInfo.game_version < GreenHellGame.s_GameVersionReleaseCandidate);

        this.m_OldSavesWarning.gameObject.SetActive(flag);
        if (flag)
        {
            Text component = this.m_OldSavesWarning.FindChild("Text").GetComponent <Text>();
            component.text = GreenHellGame.Instance.GetLocalization().Get("SaveGame_PreMasterVersionWarning2", true);
            if (SteamManager.Initialized)
            {
                Text text = component;
                text.text = text.text + "\n\n" + GreenHellGame.Instance.GetLocalization().Get("SaveGame_SteamBetasInfo", true);
            }
        }
        if (GreenHellGame.IsPadControllerActive())
        {
            EventSystem current = EventSystem.current;
            if (current != null)
            {
                current.SetSelectedGameObject(null);
            }
            for (int i = 0; i < this.m_Slots.Count; i++)
            {
                if (this.m_Slots[i].m_SaveInfo.loadable)
                {
                    this.m_Slots[i].Select();
                    this.m_Slots[i].OnSelect(null);
                    return;
                }
            }
        }
    }
Beispiel #29
0
 protected override void Update()
 {
     base.Update();
     this.UpdateAnimations();
     this.UpdateColor();
     this.UpdateEquippedIcon();
     this.m_PadQuitHint.SetActive(GreenHellGame.IsPadControllerActive() && !BodyInspectionController.Get().IsActive());
     this.m_PadSortHint.SetActive(GreenHellGame.IsPadControllerActive() && !BodyInspectionController.Get().IsActive());
     this.m_IsHovered = RectTransformUtility.RectangleContainsScreenPoint(this.m_BG.rectTransform, Input.mousePosition);
     if (this.m_IsHovered)
     {
         PocketImageData pocketImageData = null;
         foreach (PocketImageData pocketImageData2 in this.m_PocketImages)
         {
             if (pocketImageData2.selection.gameObject.activeSelf)
             {
                 pocketImageData = pocketImageData2;
                 break;
             }
         }
         CursorManager.Get().SetCursor((pocketImageData != null) ? CursorManager.TYPE.MouseOver : CursorManager.TYPE.Normal);
         if (pocketImageData != null && Input.GetKeyDown(InputHelpers.PadButton.Button_X.KeyFromPad()))
         {
             this.OnPocketClick(pocketImageData.pocket.ToString());
         }
     }
     foreach (Image image in this.m_PADChangeTabs)
     {
         if (image.gameObject.activeSelf)
         {
             Color color = image.color;
             color.a     = (Inventory3DManager.Get().m_CarriedItem ? (this.m_PADChangeTabDefaultAlpha * 0.5f) : this.m_PADChangeTabDefaultAlpha);
             image.color = color;
         }
     }
 }
Beispiel #30
0
    protected override void Update()
    {
        base.Update();
        this.m_SelectedNode = -1;
        if (this.m_NodesVisible)
        {
            for (int i = 0; i < this.m_UINodeDatas.Count; i++)
            {
                UISelectDialogNodeData uiselectDialogNodeData = this.m_UINodeDatas[i];
                if (GreenHellGame.IsPCControllerActive())
                {
                    if (!uiselectDialogNodeData.m_Node.m_Locked && RectTransformUtility.RectangleContainsScreenPoint(uiselectDialogNodeData.m_BG.rectTransform, Input.mousePosition))
                    {
                        this.m_SelectedNode = i;
                        break;
                    }
                }
                else
                {
                    this.m_SelectedNode = this.m_PadNodeIndex;
                }
            }
            for (int j = 0; j < this.m_UINodeDatas.Count; j++)
            {
                this.m_UINodeDatas[j].m_BG.enabled = (j == this.m_SelectedNode);
                this.m_UINodeDatas[j].m_PadIcon.gameObject.SetActive(GreenHellGame.IsPadControllerActive() && j == this.m_SelectedNode);
            }
            if (GreenHellGame.IsPCControllerActive())
            {
                if (!InputsManager.Get().IsActionActive(InputsManager.InputAction.ShowSelectDialogNode))
                {
                    this.OnSelect(this.m_SelectedNode);
                }
            }
            else if (Input.GetKeyDown(InputHelpers.PadButton.Button_X.KeyFromPad()))
            {
                this.OnSelect(this.m_SelectedNode);
            }
            else if (Input.GetKeyDown(InputHelpers.PadButton.Button_B.KeyFromPad()))
            {
                this.OnSelect(-1);
            }
        }
        CursorManager.Get().SetCursor((this.m_SelectedNode >= 0) ? CursorManager.TYPE.MouseOver : CursorManager.TYPE.Normal);
        if (this.m_TimerBelt[GreenHellGame.IsPCControllerActive() ? 0 : 1] && this.m_TimerBelt[GreenHellGame.IsPCControllerActive() ? 0 : 1].gameObject.activeSelf)
        {
            float   b          = Time.time - this.m_ShowTime;
            Vector3 localScale = this.m_TimerBelt[GreenHellGame.IsPCControllerActive() ? 0 : 1].rectTransform.localScale;
            localScale.x = CJTools.Math.GetProportionalClamp(1f, 0f, b, 0f, this.m_Duration);
            this.m_TimerBelt[GreenHellGame.IsPCControllerActive() ? 0 : 1].rectTransform.localScale = localScale;
        }
        GameObject  gameObject  = GreenHellGame.IsPCControllerActive() ? this.m_Reply : this.m_ReplyPad;
        CanvasGroup canvasGroup = GreenHellGame.IsPCControllerActive() ? this.m_ReplyCanvasGroup : this.m_ReplyPadCanvasGroup;

        if (gameObject.gameObject.activeSelf)
        {
            if (canvasGroup.alpha < 1f)
            {
                canvasGroup.alpha += Time.deltaTime * 3f;
            }
            canvasGroup.alpha = Mathf.Min(canvasGroup.alpha, 1f);
            float num = Mathf.Sin(Time.time);
            if (num > 0f)
            {
                if (!this.m_WasSound)
                {
                    Player.Get().m_AudioModule.PlayDialogSound(1f, false);
                    this.m_WasSound = true;
                }
                Quaternion identity = Quaternion.identity;
                identity.z = Mathf.Sin(Time.time * 100f) * num * 0.1f;
                this.m_Icon.rectTransform.localRotation = identity;
                return;
            }
            this.m_Icon.rectTransform.localRotation = Quaternion.identity;
            this.m_WasSound = false;
        }
    }