コード例 #1
0
 // Token: 0x06000FB3 RID: 4019 RVA: 0x0006EB08 File Offset: 0x0006CD08
 private void RandomTalk()
 {
     if (this.m_animator.GetBool("Stand") && !StoreGui.IsVisible() && Player.IsPlayerInRange(base.transform.position, this.m_greetRange))
     {
         this.Say(this.m_randomTalk, "Talk");
         this.m_randomTalkFX.Create(base.transform.position, Quaternion.identity, null, 1f);
     }
 }
コード例 #2
0
ファイル: PlanBuild.cs プロジェクト: Adirelle/ValheimMods
 private bool CheckInput()
 {
     return((!Chat.instance || !Chat.instance.HasFocus()) &&
            !Console.IsVisible() &&
            !InventoryGui.IsVisible() &&
            !StoreGui.IsVisible() &&
            !Menu.IsVisible() &&
            !Minimap.IsOpen() &&
            !Player.m_localPlayer.InCutscene());
 }
コード例 #3
0
 // Token: 0x06000628 RID: 1576 RVA: 0x000349A7 File Offset: 0x00032BA7
 public void Show(Trader trader)
 {
     if (this.m_trader == trader && StoreGui.IsVisible())
     {
         return;
     }
     this.m_trader = trader;
     this.m_rootPanel.SetActive(true);
     this.FillList();
 }
コード例 #4
0
 // Some logic from GameCamera class
 private bool canAdjustCameraDistance()
 {
     return((!Chat.instance || !Chat.instance.HasFocus()) &&
            !Console.IsVisible() &&
            !InventoryGui.IsVisible() &&
            !StoreGui.IsVisible() &&
            !Menu.IsVisible() &&
            !Minimap.IsOpen() &&
            attachedToPlayer &&
            !getPlayerCharacter().InCutscene() ? !getPlayerCharacter().InPlaceMode() : false);
 }
コード例 #5
0
            static void Prefix(Player __instance, float ___m_lastToolUseTime, ref float ___m_placePressedTime)
            {
                __instance.m_placeDelay = placeDelay;

                if (!modEnabled.Value)
                {
                    return;
                }

                string rightItem = __instance.GetRightItem()?.m_shared.m_name;

                if (rightItem == "$item_hammer")
                {
                    if (!repeatBuildPlace.Value)
                    {
                        return;
                    }
                    __instance.m_placeDelay = repeatBuildPlaceDelay.Value;
                }
                else if (rightItem == "$item_hoe")
                {
                    if (!repeatTerrainMod.Value)
                    {
                        return;
                    }
                    __instance.m_placeDelay = repeatTerrainModDelay.Value;
                }
                else if (rightItem == "$item_cultivator")
                {
                    if (!repeatPlanting.Value)
                    {
                        return;
                    }
                    __instance.m_placeDelay = repeatPlantingDelay.Value;
                }

                if (!wasSelecting && (ZInput.GetButton("Attack") || ZInput.GetButton("JoyPlace")) && Time.time - ___m_lastToolUseTime > __instance.m_placeDelay)
                {
                    if (InventoryGui.IsVisible() || Minimap.IsOpen() || StoreGui.IsVisible() || Hud.IsPieceSelectionVisible())
                    {
                        wasSelecting = true;
                    }
                    else
                    {
                        ___m_placePressedTime = Time.time;
                    }
                }
                else if (wasSelecting && !ZInput.GetButton("Attack") && !ZInput.GetButton("JoyPlace"))
                {
                    wasSelecting = false;
                }
            }
コード例 #6
0
 private bool shouldUpdateRayVectors()
 {
     if ((Chat.instance != null && Chat.instance.HasFocus()) || Console.IsVisible() || TextInput.IsVisible())
     {
         return(false);
     }
     return(inPlaceMode &&
            !StoreGui.IsVisible() &&
            !InventoryGui.IsVisible() &&
            !Menu.IsVisible() &&
            !(TextViewer.instance && TextViewer.instance.IsVisible()) &&
            !Minimap.IsOpen() &&
            !Hud.IsPieceSelectionVisible());
 }
コード例 #7
0
            private static void Prefix()
            {
                if (CheckPlayerNull() || Player.m_localPlayer.IsTeleporting() || global::Console.instance.m_chatWindow.gameObject.activeInHierarchy || Chat.instance.m_chatWindow.gameObject.activeInHierarchy || Player.m_localPlayer.InPlaceMode() || TextInput.IsVisible() || StoreGui.IsVisible() || InventoryGui.IsVisible() || Menu.IsVisible())
                {
                    return;
                }
                Vector3 dir  = Traverse.Create(Player.m_localPlayer).Field <Vector3>("m_lookDir").Value;
                Vector3 rdir = Traverse.Create(Player.m_localPlayer).Field <Vector3>("m_moveDir").Value;

                dir.y  = 0;
                rdir.y = 0;
                rdir   = rdir.normalized;
                dir    = dir.normalized;
                if (Input.GetKeyDown(KS_Dodge.Value.MainKey))
                {
                    Dodge(rdir);
                    return;
                }
                if (KS_Dodge_Forward.Value.IsDown())
                {
                    Dodge(dir);
                }
                if (KS_Dodge_Backward.Value.IsDown())
                {
                    Dodge(dir * -1);
                }
                if (KS_Dodge_Right.Value.IsDown())
                {
                    Dodge(Quaternion.Euler(0, 90, 0) * dir);
                }
                if (KS_Dodge_Left.Value.IsDown())
                {
                    Dodge(Quaternion.Euler(0, 90, 0) * dir * -1);
                }
            }
コード例 #8
0
ファイル: TruePause.cs プロジェクト: QuietusPlus/TruePause
 public static bool Update(ref Menu __instance)
 {
     if (Game.instance.IsShuttingDown())
     {
         __instance.m_root.gameObject.SetActive(false);
         return(false);
     }
     if (__instance.m_root.gameObject.activeSelf)
     {
         AccessTools.Field(typeof(Menu), "m_hiddenFrames").SetValue(__instance, 0);
         if ((Input.GetKeyDown(KeyCode.Escape) || ZInput.GetButtonDown("JoyMenu")) && !(GameObject)AccessTools.Field(typeof(Menu), "m_settingsInstance").GetValue(__instance) && !Feedback.IsVisible())
         {
             if (__instance.m_quitDialog.gameObject.activeSelf)
             {
                 __instance.OnQuitNo();
                 return(false);
             }
             if (__instance.m_logoutDialog.gameObject.activeSelf)
             {
                 __instance.OnLogoutNo();
                 return(false);
             }
             StartTime();
             __instance.m_root.gameObject.SetActive(false);
             return(false);
         }
     }
     else
     {
         int m_hiddenFrames = (int)AccessTools.Field(typeof(Menu), "m_hiddenFrames").GetValue(__instance);
         m_hiddenFrames++;
         AccessTools.Field(typeof(Menu), "m_hiddenFrames").SetValue(__instance, m_hiddenFrames);
         bool flag = !InventoryGui.IsVisible() && !Minimap.IsOpen() && !global::Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog() && !StoreGui.IsVisible() && !Hud.IsPieceSelectionVisible();
         if (((Input.GetKeyDown(KeyCode.Escape) || ZInput.GetButtonDown("JoyMenu")) || (!Application.isFocused && focusPause.Value && ZNet.instance.IsServer())) && flag)
         {
             __instance.m_root.gameObject.SetActive(true);
             __instance.m_menuDialog.gameObject.SetActive(true);
             if (ZNet.instance.IsServer())
             {
                 StopTime();
                 __instance.m_root.Find("OLD_menu").gameObject.SetActive(true);
                 __instance.m_root.Find("Menu").gameObject.SetActive(false);
             }
             Gogan.LogEvent("Screen", "Enter", "Menu", 0L);
             __instance.m_logoutDialog.gameObject.SetActive(false);
             __instance.m_quitDialog.gameObject.SetActive(false);
         }
     }
     return(false);
 }
コード例 #9
0
 // Token: 0x06000582 RID: 1410 RVA: 0x0002F520 File Offset: 0x0002D720
 private void Update()
 {
     if (Game.instance.IsShuttingDown())
     {
         this.m_root.gameObject.SetActive(false);
         return;
     }
     if (this.m_root.gameObject.activeSelf)
     {
         this.m_hiddenFrames = 0;
         if ((Input.GetKeyDown(KeyCode.Escape) || ZInput.GetButtonDown("JoyMenu")) && !this.m_settingsInstance && !Feedback.IsVisible())
         {
             if (this.m_quitDialog.gameObject.activeSelf)
             {
                 this.OnQuitNo();
                 return;
             }
             if (this.m_logoutDialog.gameObject.activeSelf)
             {
                 this.OnLogoutNo();
                 return;
             }
             this.m_root.gameObject.SetActive(false);
             return;
         }
     }
     else
     {
         this.m_hiddenFrames++;
         bool flag = !InventoryGui.IsVisible() && !Minimap.IsOpen() && !global::Console.IsVisible() && !TextInput.IsVisible() && !ZNet.instance.InPasswordDialog() && !StoreGui.IsVisible() && !Hud.IsPieceSelectionVisible();
         if ((Input.GetKeyDown(KeyCode.Escape) || ZInput.GetButtonDown("JoyMenu")) && flag)
         {
             Gogan.LogEvent("Screen", "Enter", "Menu", 0L);
             this.m_root.gameObject.SetActive(true);
             this.m_menuDialog.gameObject.SetActive(true);
             this.m_logoutDialog.gameObject.SetActive(false);
             this.m_quitDialog.gameObject.SetActive(false);
         }
     }
 }
コード例 #10
0
 // Token: 0x0600024D RID: 589 RVA: 0x00012BD3 File Offset: 0x00010DD3
 private bool InInventoryEtc()
 {
     return(InventoryGui.IsVisible() || Minimap.IsOpen() || StoreGui.IsVisible() || Hud.IsPieceSelectionVisible());
 }
コード例 #11
0
 // Token: 0x0600024C RID: 588 RVA: 0x00012B4C File Offset: 0x00010D4C
 private bool TakeInput()
 {
     return(!GameCamera.InFreeFly() && ((!Chat.instance || !Chat.instance.HasFocus()) && !Menu.IsVisible() && !global::Console.IsVisible() && !TextInput.IsVisible() && !Minimap.InTextInput() && (!ZInput.IsGamepadActive() || !Minimap.IsOpen()) && (!ZInput.IsGamepadActive() || !InventoryGui.IsVisible()) && (!ZInput.IsGamepadActive() || !StoreGui.IsVisible())) && (!ZInput.IsGamepadActive() || !Hud.IsPieceSelectionVisible()));
 }
コード例 #12
0
ファイル: GameCamera.cs プロジェクト: ingvard/valheim-jserver
 // Token: 0x06000ADF RID: 2783 RVA: 0x0004DFF4 File Offset: 0x0004C1F4
 private void UpdateMouseCapture()
 {
     if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F1))
     {
         this.m_mouseCapture = !this.m_mouseCapture;
     }
     if (this.m_mouseCapture && !InventoryGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !StoreGui.IsVisible() && !Hud.IsPieceSelectionVisible())
     {
         Cursor.lockState = CursorLockMode.Locked;
         Cursor.visible   = false;
         return;
     }
     Cursor.lockState = CursorLockMode.None;
     Cursor.visible   = ZInput.IsMouseActive();
 }
コード例 #13
0
        public static void Postfix(GameCamera __instance, ref float ___m_distance, ref float ___m_zoomSens)
        {
            if (!isEnabled.Value || GameCamera.InFreeFly())
            {
                return;
            }

            Player localPlayer = Player.m_localPlayer;

            if (!localPlayer)
            {
                return;
            }

            checkInteriorChange(localPlayer);
            ___m_zoomSens = cameraZoomSensitivity.Value;

            // Separate camera distances for different scenarios.
            if (canChangeCameraDistance)
            {
                if (cameraDistanceInteriorsEnabled.Value && playerInInterior)
                {
                    targetDistance = cameraDistanceInteriors.Value;
                }
                else if (cameraDistanceShelterEnabled.Value && playerInShelter)
                {
                    targetDistance = cameraDistanceShelter.Value;
                }
                else if (cameraDistanceBoatEnabled.Value && characterControlledShip)
                {
                    targetDistance = cameraDistanceBoat.Value;
                }
                else if (cameraDistanceBoatEnabled.Value && characterStoppedShipControl)
                {
                    targetDistance = cameraDistance.Value;
                }
                else if (cameraDistanceExteriorsEnabled.Value && (!playerInShelter && !playerInInterior))
                {
                    targetDistance = cameraDistance.Value;
                }

                canChangeCameraDistance = false;
            }

            if (smoothZoomEnabled.Value)
            {
                // Disable the games default zooming in and out. Otherwise, the distance will flicker.
                ___m_zoomSens = 0;

                if ((Chat.instance && Chat.instance.HasFocus() || (Console.IsVisible() || InventoryGui.IsVisible()) || (StoreGui.IsVisible() || Menu.IsVisible() || (Minimap.IsOpen() || localPlayer.InCutscene())) ? 0 : (!localPlayer.InPlaceMode() ? 1 : 0)) != 0)
                {
                    float minDistance = __instance.m_minDistance;
                    float maxDistance = localPlayer.GetControlledShip() != null ? cameraMaxDistanceBoat.Value : cameraMaxDistance.Value;

                    float prevTargetDistance = targetDistance;
                    targetDistance -= Input.GetAxis("Mouse ScrollWheel") * cameraZoomSensitivity.Value;
                    targetDistance  = Mathf.Clamp(targetDistance, minDistance, maxDistance);

                    // Reset time when player changes zoom distance (scrollwheel)
                    if (prevTargetDistance != targetDistance)
                    {
                        timePos = 0;
                    }
                }

                targetDistanceHasBeenReached = checkLerpDuration(timePos);

                if (!targetDistanceHasBeenReached)
                {
                    timePos += Time.deltaTime;
                    moveToNewCameraDistance(timePos / timeDuration, ref ___m_distance);
                }
            }
        }
コード例 #14
0
 public static bool Prefix(GameCamera __instance, ref bool ___m_mouseCapture)
 {
     if (Input.GetKey(KeyCode.LeftControl) && Input.GetKeyDown(KeyCode.F1))
     {
         ___m_mouseCapture = !___m_mouseCapture;
     }
     if (___m_mouseCapture && !InventoryGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !StoreGui.IsVisible() && !Hud.IsPieceSelectionVisible() && !Manager.MenuOpen)
     {
         Cursor.lockState = CursorLockMode.Locked;
         Cursor.visible   = false;
         return(false);
     }
     Cursor.lockState = CursorLockMode.None;
     Cursor.visible   = ZInput.IsMouseActive();
     return(false);
 }
コード例 #15
0
 public static bool IgnoreKeyPresses(bool extra = false)
 {
     return(ZNetScene.instance == null || Player.m_localPlayer == null || Minimap.IsOpen() || Console.IsVisible() || TextInput.IsVisible() || ZNet.instance.InPasswordDialog() || Chat.instance?.HasFocus() == true || StoreGui.IsVisible() || InventoryGui.IsVisible() || Menu.IsVisible() || TextViewer.instance?.IsVisible() == true);
 }
コード例 #16
0
 private static void Postfix(ref GameCamera __instance, float dt)
 {
     if (Configuration.Current.FirstPerson.IsEnabled)
     {
         // This is from game code, not sure if need it though
         if (__instance.m_freeFly)
         {
             __instance.UpdateFreeFly(dt);
             __instance.UpdateCameraShake(dt);
             return;
         }
         Player localPlayer = Player.m_localPlayer;
         if (Input.GetKeyDown(Configuration.Current.FirstPerson.hotkey))
         {
             DynamicPerson.isFirstPerson = !DynamicPerson.isFirstPerson;
             if (DynamicPerson.isFirstPerson)
             {
                 SetupFP(ref __instance, ref localPlayer);
             }
             else
             {
                 // We are not in First Person any more, reload old values
                 __instance.m_3rdOffset = DynamicPerson.noVPFP_3rdOffset;
                 __instance.m_fpsOffset = DynamicPerson.noVPFP_fpsOffset;
                 // Set the camera stuff to our constant stored values
                 __instance.m_minDistance = CameraConstants.minDistance;
                 __instance.m_maxDistance = CameraConstants.maxDistance;
                 __instance.m_zoomSens    = CameraConstants.zoomSens;
                 // Default Field Of View value
                 __instance.m_fov = 65f;
                 // Make head stuff be normal again
                 localPlayer.m_head.localScale = Vector3.one;
                 localPlayer.m_eye.localScale  = Vector3.one;
             }
         }
         // FOV of cameras needs to be reset too
         __instance.m_camera.fieldOfView    = __instance.m_fov;
         __instance.m_skyCamera.fieldOfView = __instance.m_fov;
         if (localPlayer)
         {
             // Same game check
             if ((!Chat.instance || !Chat.instance.HasFocus()) &&
                 !Console.IsVisible() && !InventoryGui.IsVisible() &&
                 !StoreGui.IsVisible() && !Menu.IsVisible() &&
                 !Minimap.IsOpen() && !localPlayer.InCutscene() &&
                 !localPlayer.InPlaceMode())
             {
                 if (DynamicPerson.isFirstPerson)
                 {
                     // I dont think either of these two ifs needs explain....
                     if (Input.GetKeyDown(Configuration.Current.FirstPerson.raiseFOVHotkey))
                     {
                         __instance.m_fov += 1f;
                         Console.instance.AddString($"Changed fov to: {__instance.m_fov}");
                     }
                     else if (Input.GetKeyDown(Configuration.Current.FirstPerson.lowerFOVHotkey))
                     {
                         __instance.m_fov -= 1f;
                         Console.instance.AddString($"Changed fov to: {__instance.m_fov}");
                     }
                 }
                 else
                 {
                     // Not first camera, just do main game thing
                     float minDistance = __instance.m_minDistance;
                     float axis        = Input.GetAxis("Mouse ScrollWheel");
                     __instance.m_distance -= axis * __instance.m_zoomSens;
                     float max = (localPlayer.GetControlledShip() != null) ? __instance.m_maxDistanceBoat : __instance.m_maxDistance;
                     __instance.m_distance = Mathf.Clamp(__instance.m_distance, 0f, max);
                 }
             }
             if (localPlayer.IsDead() && localPlayer.GetRagdoll())
             {
                 // THe weird death cam actually:
                 //  - Breaks body into ragdoll
                 //  - Gives momentum to pieces
                 //  - Then finds the average point of them all to make camera look at
                 __instance.transform.LookAt(localPlayer.GetRagdoll().GetAverageBodyPosition());
             }
             else if (DynamicPerson.isFirstPerson)
             {
                 // Place camera at head level, plus a tiny bit more
                 __instance.transform.position = localPlayer.m_head.position + new Vector3(0, 0.2f, 0);
             }
             else
             {
                 // Not even sure why we need to reset the base transform
                 // But game does it so...
                 // ¯\_(ツ)_/¯
                 Vector3    position;
                 Quaternion rotation;
                 __instance.GetCameraPosition(dt, out position, out rotation);
                 __instance.transform.position = position;
                 __instance.transform.rotation = rotation;
             }
             __instance.UpdateCameraShake(dt);
         }
     }
 }
コード例 #17
0
ファイル: GameCamera.cs プロジェクト: ingvard/valheim-jserver
    // Token: 0x06000AE2 RID: 2786 RVA: 0x0004E194 File Offset: 0x0004C394
    private void UpdateCamera(float dt)
    {
        if (this.m_freeFly)
        {
            this.UpdateFreeFly(dt);
            this.UpdateCameraShake(dt);
            return;
        }
        this.m_camera.fieldOfView    = this.m_fov;
        this.m_skyCamera.fieldOfView = this.m_fov;
        Player localPlayer = Player.m_localPlayer;

        if (localPlayer)
        {
            if ((!Chat.instance || !Chat.instance.HasFocus()) && !global::Console.IsVisible() && !InventoryGui.IsVisible() && !StoreGui.IsVisible() && !Menu.IsVisible() && !Minimap.IsOpen() && !localPlayer.InCutscene() && !localPlayer.InPlaceMode())
            {
                float minDistance = this.m_minDistance;
                float axis        = Input.GetAxis("Mouse ScrollWheel");
                this.m_distance -= axis * this.m_zoomSens;
                float max = (localPlayer.GetControlledShip() != null) ? this.m_maxDistanceBoat : this.m_maxDistance;
                this.m_distance = Mathf.Clamp(this.m_distance, minDistance, max);
            }
            if (localPlayer.IsDead() && localPlayer.GetRagdoll())
            {
                Vector3 averageBodyPosition = localPlayer.GetRagdoll().GetAverageBodyPosition();
                base.transform.LookAt(averageBodyPosition);
            }
            else
            {
                Vector3    position;
                Quaternion rotation;
                this.GetCameraPosition(dt, out position, out rotation);
                base.transform.position = position;
                base.transform.rotation = rotation;
            }
            this.UpdateCameraShake(dt);
        }
    }