Beispiel #1
0
 // 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();
 }
Beispiel #2
0
        private void OnGUI()
        {
            if (!modEnabled.Value)
            {
                return;
            }

            if (thisTooltip != null && thisTooltip.Length > 0)
            {
                tooltipWindowStyle = new GUIStyle(GUI.skin.window);
                tooltipWindowStyle.normal.background = tooltipBackground;
                GUI.Window(424244, new Rect(Input.mousePosition.x + 30, Screen.height - Input.mousePosition.y + 30, 400, 80), new GUI.WindowFunction(TooltipBuilder), thisTooltip.Split('^')[0], tooltipWindowStyle);
            }

            if (testing.Value)
            {
                if (storeOpen)
                {
                    if (GameCamera.instance)
                    {
                        Traverse.Create(GameCamera.instance).Field("m_mouseCapture").SetValue(false);
                        Cursor.lockState = CursorLockMode.None;
                        Cursor.visible   = ZInput.IsMouseActive();
                    }
                    GUI.backgroundColor = windowBackgroundColor.Value;
                    windowRect          = GUI.Window(424243, windowRect, new GUI.WindowFunction(WindowBuilder), "");
                    if (!Input.GetKey(KeyCode.Mouse0) && (windowRect.x != windowPosition.Value.x || windowRect.y != windowPosition.Value.y))
                    {
                        windowPosition.Value = new Vector2(windowRect.x, windowRect.y);
                    }
                }
            }
            else if (!ZNet.instance?.IsServer() == true && Player.m_localPlayer)
            {
                if (storeOpen)
                {
                    Traverse.Create(GameCamera.instance).Field("m_mouseCapture").SetValue(false);
                    Cursor.lockState    = CursorLockMode.None;
                    Cursor.visible      = ZInput.IsMouseActive();
                    GUI.backgroundColor = windowBackgroundColor.Value;
                    windowRect          = GUI.Window(424243, windowRect, new GUI.WindowFunction(WindowBuilder), "");
                }
                if (!Input.GetKey(KeyCode.Mouse0) && (windowRect.x != windowPosition.Value.x || windowRect.y != windowPosition.Value.y))
                {
                    windowPosition.Value = new Vector2(windowRect.x, windowRect.y);
                }
            }
        }
Beispiel #3
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);
 }
        private void OnGUI()
        {
            GUI.Label(new Rect(Input.mousePosition.x, Screen.height - Input.mousePosition.y, 200, 40), "test");
            GUI.Label(new Rect(Input.mousePosition.x, Screen.height - Input.mousePosition.y + 100, 200, 40), thisTooltip);


            if (!modEnabled.Value)
            {
                return;
            }

            if (testing.Value)
            {
                if (storeOpen)
                {
                    if (GameCamera.instance)
                    {
                        Traverse.Create(GameCamera.instance).Field("m_mouseCapture").SetValue(false);
                        Cursor.lockState = CursorLockMode.None;
                        Cursor.visible   = ZInput.IsMouseActive();
                    }
                    windowRect = GUI.Window(424243, windowRect, new GUI.WindowFunction(WindowBuilder), "");
                    if (!Input.GetKey(KeyCode.Mouse0) && (windowRect.x != windowPosition.Value.x || windowRect.y != windowPosition.Value.y))
                    {
                        windowPosition.Value = new Vector2(windowRect.x, windowRect.y);
                    }
                }
                return;
            }
            if (!ZNet.instance?.IsServer() == true && Player.m_localPlayer)
            {
                if (storeOpen)
                {
                    Traverse.Create(GameCamera.instance).Field("m_mouseCapture").SetValue(false);
                    Cursor.lockState = CursorLockMode.None;
                    Cursor.visible   = ZInput.IsMouseActive();
                    windowRect       = GUI.Window(424243, windowRect, new GUI.WindowFunction(WindowBuilder), "");
                    GUI.Label(new Rect(Input.mousePosition.x, Screen.height - Input.mousePosition.y + 50, 200, 40), GUI.tooltip);
                }
                if (!Input.GetKey(KeyCode.Mouse0) && (windowRect.x != windowPosition.Value.x || windowRect.y != windowPosition.Value.y))
                {
                    windowPosition.Value = new Vector2(windowRect.x, windowRect.y);
                }
            }
        }
Beispiel #5
0
    // Token: 0x060002E2 RID: 738 RVA: 0x0001770C File Offset: 0x0001590C
    public bool Start(Humanoid character, Rigidbody body, ZSyncAnimation zanim, CharacterAnimEvent animEvent, VisEquipment visEquipment, ItemDrop.ItemData weapon, Attack previousAttack, float timeSinceLastAttack, float attackDrawPercentage)
    {
        if (this.m_attackAnimation == "")
        {
            return(false);
        }
        this.m_character            = character;
        this.m_baseAI               = this.m_character.GetComponent <BaseAI>();
        this.m_body                 = body;
        this.m_zanim                = zanim;
        this.m_animEvent            = animEvent;
        this.m_visEquipment         = visEquipment;
        this.m_weapon               = weapon;
        this.m_attackDrawPercentage = attackDrawPercentage;
        if (Attack.m_attackMask == 0)
        {
            Attack.m_attackMask = LayerMask.GetMask(new string[]
            {
                "Default",
                "static_solid",
                "Default_small",
                "piece",
                "piece_nonsolid",
                "character",
                "character_net",
                "character_ghost",
                "hitbox",
                "character_noenv",
                "vehicle"
            });
            Attack.m_attackMaskTerrain = LayerMask.GetMask(new string[]
            {
                "Default",
                "static_solid",
                "Default_small",
                "piece",
                "piece_nonsolid",
                "terrain",
                "character",
                "character_net",
                "character_ghost",
                "hitbox",
                "character_noenv",
                "vehicle"
            });
        }
        float staminaUsage = this.GetStaminaUsage();

        if (staminaUsage > 0f && !character.HaveStamina(staminaUsage + 0.1f))
        {
            if (character.IsPlayer())
            {
                Hud.instance.StaminaBarNoStaminaFlash();
            }
            return(false);
        }
        if (!Attack.HaveAmmo(character, this.m_weapon))
        {
            return(false);
        }
        Attack.EquipAmmoItem(character, this.m_weapon);
        if (this.m_attackChainLevels > 1)
        {
            if (previousAttack != null && previousAttack.m_attackAnimation == this.m_attackAnimation)
            {
                this.m_currentAttackCainLevel = previousAttack.m_nextAttackChainLevel;
            }
            if (this.m_currentAttackCainLevel >= this.m_attackChainLevels || timeSinceLastAttack > 0.2f)
            {
                this.m_currentAttackCainLevel = 0;
            }
            this.m_zanim.SetTrigger(this.m_attackAnimation + this.m_currentAttackCainLevel);
        }
        else if (this.m_attackRandomAnimations >= 2)
        {
            int num = UnityEngine.Random.Range(0, this.m_attackRandomAnimations);
            this.m_zanim.SetTrigger(this.m_attackAnimation + num);
        }
        else
        {
            this.m_zanim.SetTrigger(this.m_attackAnimation);
        }
        if (character.IsPlayer() && this.m_attackType != Attack.AttackType.None && this.m_currentAttackCainLevel == 0)
        {
            if (ZInput.IsMouseActive() || this.m_attackType == Attack.AttackType.Projectile)
            {
                character.transform.rotation = character.GetLookYaw();
                this.m_body.rotation         = character.transform.rotation;
            }
            else if (ZInput.IsGamepadActive() && !character.IsBlocking() && character.GetMoveDir().magnitude > 0.3f)
            {
                character.transform.rotation = Quaternion.LookRotation(character.GetMoveDir());
                this.m_body.rotation         = character.transform.rotation;
            }
        }
        weapon.m_lastAttackTime = Time.time;
        this.m_animEvent.ResetChain();
        return(true);
    }