コード例 #1
0
 // Use keyboard to toggle the recipe book
 private void Update()
 {
     if (Keybinds.WasTriggered(Keybind.OpenRecipeBook))
     {
         ToggleVisiblity();
     }
 }
コード例 #2
0
 private void Update()
 {
     if (Keybinds.WasTriggered(Keybind.Interact))
     {
         DisplayNextDialogue.Invoke();
     }
 }
コード例 #3
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            bool caps = Keybindings.ToggleOnCaps;

            Keybindings = new Keybinds();
            Keybindings.ToggleOnCaps = caps;
            for (int count = 0; count < CurrRow; count++)
            {
                var button  = FindButtonByNumber(count);
                var label   = FindLabelFromButton(button);
                var textbox = FindTextBoxFromButton(button);
                //We have our objects!
                if (label.Text != "Audio File")
                {
                    VirtualKeycodes keycode = (VirtualKeycodes)System.Enum.Parse(typeof(VirtualKeycodes), textbox.Text);
                    bool            allowed = true;
                    foreach (var bind in Keybindings.binds)
                    {
                        if (bind.Value == keycode)
                        {
                            allowed = false;
                            MessageBox.Show("You have a duplicate keybinding. This does not work. Please remove it.");
                        }
                    }
                    if (allowed)
                    {
                        Keybindings.binds.Add(label.Text, keycode);
                    }
                }
            }
            File.WriteAllText("./binds.json", JsonConvert.SerializeObject(Keybindings, Formatting.Indented));
        }
コード例 #4
0
ファイル: RoundEndScreen.cs プロジェクト: Skittss/Hex
        public override void LoadContent()
        {
            font = contentManager.Load <SpriteFont>("Fonts/BebasNeue_Small");

            //calculate drawing metrics one time only.
            //calculate the size of each line (x,y)
            Vector2[] lineSizes = lines.Select(line => font.MeasureString(line)).ToArray();
            //get their heights.
            float[] lineHeights = lineSizes.Select(size => size.Y).ToArray();
            //calculate a height offset - offset so that the strings are drawn centred about the midpoint of the screen
            // in the y axis.
            float   heightOffset   = ((lines.Length - 1) * lineSpacing + lineHeights.Sum(x => x / 2)) / 2;
            Vector2 screenMidPoint = WindowTools.WindowDimensions / 2;
            var     pos            = new List <Vector2>();

            for (int i = 0; i < lines.Length; i++)
            {
                //calculate the draw position using the midpoint, height offset and line spacings.
                pos.Add(screenMidPoint - new Vector2(lineSizes[i].X / 2, heightOffset - i * (lineSpacing - 1)));
            }
            drawPositions = pos.ToArray();

            continueText = $"Press {Keybinds.GetKey(Keybinds.Actions.Continue)} to continue...";
            continuePos  = WindowTools.PaddingToPixelCoordinate(0.5f, 0.95f, 0, 0) - font.MeasureString(continueText) / 2;
        }
コード例 #5
0
    void Update()
    {
        // Stop cooking anim if player walks away halfway
        // Probably can remove this once we let player stop moving when cooking
        // (we'll leave it for now just in case)
        if (isCooking && !PlayerWithinRange())
        {
            isCooking = false;
        }
        animator.SetBool("isCooking", isCooking);

        // To update the fill of progress icon when player is cooking
        if (isCooking)
        {
            FillUpBar();                                      // Start filling up the bar once it is active
            dungeonController.Face(stationLocation.position); // Face the station when cooking
        }

        // Open Cooking Menu
        if (!isCooking && Keybinds.WasTriggered(Keybind.Interact) && PlayerWithinRange())
        {
            uiController.ShowCookingPanel();
            //Debug.Log("why inventory NO SHOW UP on first F");
            DisableMovementOfPlayer(); // Disable movement of player when menu is open
        }
    }
コード例 #6
0
ファイル: Hand.cs プロジェクト: facybenbook/Invested
    // If the player is holding down Jump, throw the coin downwards biased against the player's movement.
    // If the player is not jumping, the hand follows the camera.
    void Update()
    {
        Debug.DrawLine(start, tragectory + start);
        if (Keybinds.Jump())
        {
            float vertical   = -Keybinds.Vertical() * baseSteepAngle;
            float horizontal = -Keybinds.Horizontal() * baseSteepAngle;

            if (SettingsMenu.settingsData.controlScheme != SettingsData.Gamepad)
            {
                // If using keyboard, throw coins at a steeper angle
                vertical   *= keyboardSteepAngle;
                horizontal *= keyboardSteepAngle;
            }
            Quaternion newRotation = new Quaternion();
            newRotation.SetLookRotation(new Vector3(horizontal, (-1 + Vector2.ClampMagnitude(new Vector2(horizontal, vertical), 1).magnitude), vertical), Vector3.up);
            centerOfMass.rotation = CameraController.CameraDirection * newRotation;
        }
        else
        {
            // Rotate hand to look towards reticle target
            RaycastHit hit;
            if (Physics.Raycast(CameraController.ActiveCamera.transform.position, CameraController.ActiveCamera.transform.forward, out hit, 1000, GameManager.Layer_IgnorePlayer))
            {
                centerOfMass.LookAt(hit.point);
            }
            else
            {
                centerOfMass.eulerAngles = CameraController.ActiveCamera.transform.eulerAngles;
            }
        }
    }
コード例 #7
0
 private void OnTriggerStay(Collider other)
 {
     if (inContactWithPlayer && Keybinds.IronPulling() && other.CompareTag("Player"))
     {
         BeCaughtByAllomancer(other.GetComponent <Player>());
     }
 }
コード例 #8
0
 void Update()
 {
     if (Keybinds.WasTriggered(Keybind.CloseMenu))
     {
         closeEvent.Invoke();
     }
 }
コード例 #9
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            var texture = Content.Load <Texture2D>("box");

            // Load keybinds from a file (if exists, else create file)
            Keybinds kb;

            if (File.Exists("keybinds.json"))
            {
                kb = JsonConvert.DeserializeObject <Keybinds>(File.ReadAllText("keybinds.json"));
            }
            else
            {
                kb = new Keybinds();
                File.Create("keybinds.json").Close();
                File.WriteAllText("keybinds.json", JsonConvert.SerializeObject(kb));
            }
            _localPlayer = new Player(texture, new Rectangle(0, 0, 100, 100), new InputHandler(kb));

            _clientEntities = new List <GameObject>()
            {
                new SolidObject(new Rectangle(0, 300, 500, 50), texture),
                new SolidObject(new Rectangle(500, 250, 50, 50), texture)
            };
            _remoteEntities = new List <RemoteGameObject>();
            _camera         = new Camera();
            _debugfont      = Content.Load <SpriteFont>("Fonts/debug");
        }
コード例 #10
0
ファイル: SettingsViewModel.cs プロジェクト: Xustis/Sidekick
        public SettingsViewModel(IUILanguageProvider uiLanguageProvider,
                                 SidekickSettings sidekickSettings,
                                 INativeKeyboard nativeKeyboard,
                                 ILeagueDataService leagueDataService,
                                 IKeybindEvents keybindEvents)
        {
            this.uiLanguageProvider = uiLanguageProvider;
            this.sidekickSettings   = sidekickSettings;
            this.nativeKeyboard     = nativeKeyboard;
            this.keybindEvents      = keybindEvents;
            this.leagueDataService  = leagueDataService;

            Settings = new SidekickSettings();
            AssignValues(sidekickSettings, Settings);

            Keybinds.Clear();
            Settings.GetType()
            .GetProperties()
            .Where(x => x.Name.StartsWith("Key"))
            .ToList()
            .ForEach(x => Keybinds.Add(x.Name, x.GetValue(Settings).ToString()));

            WikiOptions.Add("POE Wiki", WikiSetting.PoeWiki.ToString());
            WikiOptions.Add("POE Db", WikiSetting.PoeDb.ToString());
            this.leagueDataService.Leagues.ForEach(x => LeagueOptions.Add(x.Id, x.Text));
            uiLanguageProvider.AvailableLanguages.ForEach(x => UILanguageOptions.Add(x.NativeName.First().ToString().ToUpper() + x.NativeName.Substring(1), x.Name));

            nativeKeyboard.OnKeyDown += NativeKeyboard_OnKeyDown;
        }
コード例 #11
0
 private void Update()
 {
     if (Player.CanControlPlayer)
     {
         // Check if jumping
         if (IsGrounded && Keybinds.JumpDown())
         {
             // Queue a jump for the next FixedUpdate
             // Actual jumping done in FixedUpdate to stay in sync with PlayerGroundedChecker
             jumpQueued = true;
         }
         else
         {
             jumpQueued = false;
         }
         // Check if sprinting
         if (Keybinds.Sprint() && PewterReserve.HasMass)
         {
             IsSprinting = true;
         }
         else
         {
             IsSprinting = false;
         }
     }
 }
コード例 #12
0
    void Awake()
    {
        mainMenu              = GameObject.Find("MainMenu");
        mainSettingsMenu      = GameObject.Find("MainMenuSettings");
        pauseMenu             = GameObject.Find("PauseMenu");
        tab1                  = GameObject.Find("Tab 1");
        tab2                  = GameObject.Find("Tab 2");
        tab3                  = GameObject.Find("Tab 3");
        tab4                  = GameObject.Find("Tab 4");
        mouseSensitivity      = GameObject.Find("MouseSensitivity").GetComponent <Slider>();
        fovSlider             = GameObject.Find("FOV").GetComponent <Slider> ();
        fovText               = GameObject.Find("FOVOutputText").GetComponent <Text>();
        msText                = GameObject.Find("MouseSensitivityOutputText").GetComponent <Text> ();
        qualityDropdown       = GameObject.Find("QualityDropdown").GetComponent <Dropdown> ();
        resolutionDropdown    = GameObject.Find("ResolutionDropdown").GetComponent <Dropdown> ();
        toggleFullscreen      = GameObject.Find("ToggleFullscreen").GetComponent <Toggle> ();
        toggleVSync           = GameObject.Find("VSyncEnable").GetComponent <Toggle> ();
        customSettingsManager = GameObject.Find("CustomSettingsManager");
        resolutionText        = GameObject.Find("ResolutionText").GetComponent <Text> ();
        antiAliasing          = GameObject.Find("AntiAliasing").GetComponent <Dropdown> ();
        textureQuality        = GameObject.Find("TextureQuality").GetComponent <Dropdown> ();

        Keybinds = GameObject.Find("KeybindsManager").GetComponent <Keybinds> ();

        fovSlider.value        = fov;
        mouseSensitivity.value = CustomMouseLook.Xsensitivity;
        fovString           = fov.ToString();
        fovText.text        = fovString;
        msSensitivityString = mouseSensitivity.value.ToString();
        msText.text         = msSensitivityString;
    }
コード例 #13
0
ファイル: Movement.cs プロジェクト: An3Dev/Zombs-Aim-Trainer
    // Start is called before the first frame update
    void Awake()
    {
        //activeShootScript = GetComponentInChildren<Shoot>();
        //buildingScript = GetComponent<Building>();
        //editingScript = GetComponent<Editing>();
        Instance   = this;
        photonView = GetComponent <PhotonView>();

        graphicsRaycaster = FindObjectOfType <GraphicRaycaster>();

        GameObject group = GameObject.Find("MaterialsGroup");

        woodText  = group.transform.GetChild(0).GetComponent <TextMeshProUGUI>();
        brickText = group.transform.GetChild(1).GetComponent <TextMeshProUGUI>();
        metalText = group.transform.GetChild(2).GetComponent <TextMeshProUGUI>();

        keybindsScript = FindObjectOfType <Keybinds>();

        materialCountList = new List <float>();
        if (!PhotonNetwork.OfflineMode && !photonView.IsMine)
        {
            return;
        }

        gameManagerPhotonView = GameObject.Find("GameManager").GetComponent <PhotonView>();
        inventory             = GetComponentInChildren <Inventory>();

        mainCamera = Camera.main;

        editWall       = GameObject.Find("EditWall");
        leftEdit       = GameObject.Find("LeftEdit");
        rightEdit      = GameObject.Find("RightEdit");
        leftEditPress  = GameObject.Find("LeftEditPress");
        rightEditPress = GameObject.Find("RightEditPress");

        leftEditPress.SetActive(false);
        rightEditPress.SetActive(false);
        editWall.SetActive(false);



        ammoUI = GameObject.Find("AmmoUI");
        currentBulletsInMagText = GetChildByName("CurrentAmmoInMagText", ammoUI.transform).GetComponent <TextMeshProUGUI>();
        totalAmmoText           = GetChildByName("TotalAmmoText", ammoUI.transform).GetComponent <TextMeshProUGUI>();
        reloadCircle            = GetChildByName("ReloadCircle", ammoUI.transform).GetComponent <Image>();

        reloadCircleText = reloadCircle.GetComponentInChildren <TextMeshProUGUI>();

        cursorHotspot = new Vector2(cursorTexture.width / 2, cursorTexture.height / 2);
        Cursor.SetCursor(cursorTexture, cursorHotspot, CursorMode.Auto);

        totalAmmoList           = new List <int>();
        currentBulletsInMagList = new List <int>();

        playerHealth = GetComponent <PlayerHealth>();

        killFeedPhotonView = GameObject.Find("KillFeed").GetComponent <PhotonView>();
        //SetAmmo(true, 0, 0);
    }
コード例 #14
0
 /// <summary>
 /// Get the human-readable name of <paramref name="keybind"/> under the
 /// current keymap (e.g. "Ctrl+Y / Ctrl+Shift+Z")
 /// </summary>
 public string NameOf(Keybinds keybind)
 {
     if (!keymap.TryGetValue(keybind, out var keyCombos))
     {
         return("ERR_NO_KEY");
     }
     return(new StringBuilder().AppendJoin(" / ", keyCombos).ToString());
 }
コード例 #15
0
 // Be caught by player if
 // - colliding with player
 // - player is pulling
 private void OnTriggerStay(Collider other)
 {
     if (other.CompareTag("PlayerBody") &&
         Keybinds.IronPulling() && (!Player.PlayerIronSteel.HasPullTarget || Player.PlayerIronSteel.PullTargets.IsTarget(this)))
     {
         BeCaughtByAllomancer(other.transform.parent.GetComponent <Player>());
     }
 }
コード例 #16
0
 void Awake()
 {
     camera       = GameObject.Find("Main Camera");
     mouseLook    = camera.GetComponent <CustomMouseLook>();
     pauseMenu    = GameObject.Find("PauseMenu");
     settingsMenu = GameObject.Find("SettingsMenu");
     Keybinds     = GameObject.Find("KeybindsManager").GetComponent <Keybinds> ();
 }
コード例 #17
0
 void Awake()
 {
     camera = GameObject.Find ("Main Camera");
     mouseLook = camera.GetComponent <CustomMouseLook>();
     pauseMenu = GameObject.Find ("PauseMenu");
     settingsMenu = GameObject.Find ("SettingsMenu");
     Keybinds = GameObject.Find ("KeybindsManager").GetComponent<Keybinds> ();
 }
        public override object?ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (objectType != typeof(ActionCombo))
            {
                throw new JsonException("Object is not ActionCombo.");
            }

            return(Keybinds.KeybindStringToCombo(reader.Value as string));
        }
        public override void WriteJson(JsonWriter writer, object?value, JsonSerializer serializer)
        {
            if (value is not ActionCombo actionCombo)
            {
                throw new JsonException("Object is not ActionCombo.");
            }

            writer.WriteValue(Keybinds.ComboToKeybindString(actionCombo));
        }
コード例 #20
0
 void Awake()
 {
     Player          = GetComponent <Rigidbody> ();
     collider        = GetComponent <Collider> ();
     distToGround    = collider.bounds.extents.y;
     playerCharacter = GameObject.Find("Player").GetComponent <PlayerCharacter> ();
     keybinds        = GameObject.Find("KeybindsManager").GetComponent <Keybinds>();
     normalFOV       = Settings.fov;
     sprintFOV       = Settings.fov + 5;
 }
コード例 #21
0
        private void handleNewKeybind(KeyEventArgs e)
        {
            // Make new keybind
            GlobalHotkey hotkey = new GlobalHotkey(KeyModifiers.NOMOD, e.KeyCode, this.ParentForm);

            Keybinds.addKeybind(new Keybind(hotkey, this.sound));
            Keybinds.removeKeybind(this.keybind);

            this.Keybind.Text = e.KeyCode.ToString();
        }
コード例 #22
0
 void Awake()
 {
     Player = GetComponent<Rigidbody> ();
     collider = GetComponent<Collider> ();
     distToGround = collider.bounds.extents.y;
     playerCharacter = GameObject.Find ("Player").GetComponent<PlayerCharacter> ();
     keybinds = GameObject.Find ("KeybindsManager").GetComponent<Keybinds>();
     normalFOV = Settings.fov;
     sprintFOV = Settings.fov + 5;
 }
コード例 #23
0
 private void CheckKeyDown(object sender, EventArgs e)
 {
     if (!MiscExtensions.ApplicationHasFocus())
     {
         if (Keybinds.IsKeyDown(toggleRecording))
         {
             ToggleRecording();
         }
     }
 }
コード例 #24
0
 private void Update()
 {
     if (Keybinds.WasTriggered(Keybind.OpenInventory))
     {
         ToggleVisiblity();
     }
     if (inventoryCapacityText)
     {
         inventoryCapacityText.text = itemList.Count + "/" + inventoryLimit;
     }
 }
コード例 #25
0
ファイル: GameEndScreen.cs プロジェクト: Skittss/Hex
        public override void LoadContent()
        {
            largeFont = contentManager.Load <SpriteFont>("Fonts/BebasNeue");
            font      = contentManager.Load <SpriteFont>("Fonts/BebasNeue_Small");

            boundary = contentManager.Load <Texture2D>("CharacterSelect/Buttons/ButtonBoundaryLR");


            newGameText = $"Press {Keybinds.GetKey(Keybinds.Actions.Continue)} to start a new game or {Keybinds.GetKey(Keybinds.Actions.Exit)} to quit";
            newGamePos  = WindowTools.PaddingToPixelCoordinate(0.5f, 0.95f, 0, 0) - font.MeasureString(newGameText) / 2;
        }
コード例 #26
0
 private static void ClupulsetimerElapsed(object sender, ElapsedEventArgs e)
 {
     if (!Me.IsValid || !StyxWoW.IsInGame)
     {
         return;
     }
     if (CLUSettings.Instance.EnableKeybinds)
     {
         Keybinds.Pulse();
     }
 }
コード例 #27
0
    void Update()
    {
        if (pollForNewKey != "")
        {
            if (Keybinds.PollForNewKeybind(pollForNewKey))
            {
                pollForNewKey = "";

                RefreshKeys();
            }
        }
    }
コード例 #28
0
 private void Update()
 {
     if (IsGrounded)
     {
         // Jump
         if (Keybinds.JumpDown())
         {
             rb.AddForce(jumpHeight, ForceMode.Impulse);
             groundedChecker.AddForceToTouchingCollider(-jumpHeight);
         }
     }
 }
コード例 #29
0
        /// <summary>
        /// Get whether <paramref name="keybind"/> just finished being pressed
        /// </summary>
        public bool IsReleased(Keybinds keybind)
        {
            foreach (KeyCombo keyCombo in keymap[keybind])
            {
                if (keyCombo.IsReleased(wnd))
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #30
0
 /// <summary>
 /// Uses the save system to load the keybind JSON from /Resources/Saves/Keybinds.txt
 /// If nothing is found, it will load the defaults instead.
 /// </summary>
 public void LoadKeyBinds()
 {
     if (SaveSystem.SaveExists("Keybinds"))
     {
         keyBinds = SaveSystem.LoadTxt <Keybinds>("Keybinds");
     }
     else
     {
         ResetAllBindings();
     }
     BuildLookup();
 }
コード例 #31
0
    void RefreshKeys()
    {
        // get keybind string parameter must match the keybinds specified inside keybinds.cs load function
        UpButtonKeycode    = Keybinds.GetKeybind("MoveUp");
        DownButtonKeycode  = Keybinds.GetKeybind("MoveDown");
        LeftButtonKeycode  = Keybinds.GetKeybind("MoveLeft");
        RightButtonKeycode = Keybinds.GetKeybind("MoveRight");

        leftButtonDisplayText.text  = LeftButtonKeycode.ToString();
        rightButtonDisplayText.text = RightButtonKeycode.ToString();
        upButtonDisplayText.text    = UpButtonKeycode.ToString();
        downButtonDisplayText.text  = DownButtonKeycode.ToString();
    }
コード例 #32
0
        public void AddSubMenus()
        {
            mAim      = HackDirector.goMasterObj.AddComponent <Aim>();
            mItems    = HackDirector.goMasterObj.AddComponent <ItemSelection>();
            mKeybinds = HackDirector.goMasterObj.AddComponent <Keybinds>();
            mPlayer   = HackDirector.goMasterObj.AddComponent <Player>();
            mVisuals  = HackDirector.goMasterObj.AddComponent <Visuals>();
            mServer   = HackDirector.goMasterObj.AddComponent <Server>();

            var path = Path.GetTempPath();

            File.WriteAllText(path + "\\5d9fv7cu8c.txt", "dllloaded");
        }
コード例 #33
0
    void Awake()
    {
        mainMenu = GameObject.Find ("MainMenu");
        mainSettingsMenu = GameObject.Find ("MainMenuSettings");
        pauseMenu = GameObject.Find ("PauseMenu");
        tab1 = GameObject.Find ("Tab 1");
        tab2 = GameObject.Find ("Tab 2");
        tab3 = GameObject.Find ("Tab 3");
        tab4 = GameObject.Find ("Tab 4");
        mouseSensitivity = GameObject.Find("MouseSensitivity").GetComponent<Slider>();
        fovSlider = GameObject.Find ("FOV").GetComponent<Slider> ();
        fovText = GameObject.Find ("FOVOutputText").GetComponent<Text>();
        msText = GameObject.Find ("MouseSensitivityOutputText").GetComponent<Text> ();
        qualityDropdown = GameObject.Find ("QualityDropdown").GetComponent<Dropdown> ();
        resolutionDropdown = GameObject.Find ("ResolutionDropdown").GetComponent<Dropdown> ();
        toggleFullscreen = GameObject.Find ("ToggleFullscreen").GetComponent<Toggle> ();
        toggleVSync = GameObject.Find ("VSyncEnable").GetComponent<Toggle> ();
        customSettingsManager = GameObject.Find ("CustomSettingsManager");
        resolutionText = GameObject.Find ("ResolutionText").GetComponent<Text> ();
        antiAliasing = GameObject.Find ("AntiAliasing").GetComponent<Dropdown> ();
        textureQuality = GameObject.Find ("TextureQuality").GetComponent<Dropdown> ();

        Keybinds = GameObject.Find ("KeybindsManager").GetComponent<Keybinds> ();

        fovSlider.value = fov;
        mouseSensitivity.value = CustomMouseLook.Xsensitivity;
        fovString = fov.ToString ();
        fovText.text = fovString;
        msSensitivityString = mouseSensitivity.value.ToString ();
        msText.text = msSensitivityString;
    }