Пример #1
0
 private void deleteDictionaryEntry(KeyValuePair <string, List <InputCode> > pair)
 {
     Rebind.RemoveEntry(pair.Key);
     Rebind.defaultBindsSerializer.Save(Rebind.defaultKeys.Dictionary);
     Rebind.keyBindsSerializer.Save(Rebind.defaultKeys.Dictionary);
     EditorUtility.SetDirty(target);
 }
Пример #2
0
 void OnEnable()
 {
     Rebind.SetupSerializers();
     EditorApplication.modifierKeysChanged += this.Repaint; //Only way of detecting if the "Shift" key has been pressed
     Rebind.defaultKeys.Dictionary          = Rebind.defaultBindsSerializer.Read();
     Rebind.keys.Dictionary = Rebind.keyBindsSerializer.Read();
 }
Пример #3
0
 private void createDictionaryEntry()
 {
     actionName = actionName.Replace(" ", string.Empty);
     Rebind.CreateEntry(actionName);
     actionName = "";
     create     = false;
     Rebind.defaultBindsSerializer.Save(Rebind.defaultKeys.Dictionary);
     Rebind.keyBindsSerializer.Save(Rebind.defaultKeys.Dictionary);
 }
Пример #4
0
    private bool pollForInput()
    {
        InputCode poll = checkInput();

        if (poll != InputCode.None)
        {
            Rebind.BindKeyToAction(keyEditInfo.actionName, poll, keyEditInfo.listIndex);
            Rebind.defaultBindsSerializer.Save(Rebind.defaultKeys.Dictionary);
            Rebind.keyBindsSerializer.Save(Rebind.defaultKeys.Dictionary);
            EditorUtility.SetDirty(target);
            return(false);
        }
        return(true);
    }
Пример #5
0
    public static bool CanClick()
    {
        bool anti = false;

        for (int i = 1; i <= 10 && !anti; i++)
        {
            if (Rebind.GetInput("SELECT_POKE_PARTY_" + i))
            {
                anti = true;
            }
        }

        return(!anti && !Rebind.GetInput("SELECT_POKE_PREV") && !Rebind.GetInput("SELECT_POKE_NEXT") &&
               !Rebind.GetInput("THROW_POKEBALL") && !Input.GetKey(KeyCode.Escape) &&
               !Input.GetMouseButton(0) && !Input.GetMouseButton(1));
    }
Пример #6
0
    void OnAnimatorMove()
    {
        //Animator animator = GetComponent<Animator> ();
        Animator animator = Player.trainer.GetComponent <Animator> ();

        if (animator)
        {
            Vector3 newPosition = animator.deltaPosition;
            if (Rebind.GetInput("SPRINT") || run)
            {
                newPosition *= runSpeed;
            }
            //rigidbody.position += newPosition;
            rigidbody.position += newPosition;
        }
    }
Пример #7
0
    public void HandleTrainer()
    {
        //swap pokemon
        if (!click && !pokemonActive)
        {
            Pokemon oldPokemonSelection = pokemon;

            for (int i = 1; i <= trainer.party.Count(); i++)
            {
                if (Rebind.GetInputDown("SELECT_POKE_PARTY_" + i))
                {
                    trainer.party.Select(i - 1);
                }
            }

            if (Rebind.GetInputDown("SELECT_POKE_PREV"))
            {
                trainer.party.SelectPrev();
            }
            else if (Rebind.GetInputDown("SELECT_POKE_NEXT"))
            {
                trainer.party.SelectNext();
            }

            if (oldPokemonSelection != pokemon)
            {
                click = true;
                if (oldPokemonSelection.obj != null)
                {
                    oldPokemonSelection.obj.Return();
                    trainer.ThrowPokemon(pokemon);
                }
            }
        }

        var itemsCount = trainer.inventory.items.Count;

        //throw pokemon
        if (!click && Input.GetKey(KeyCode.Return))
        {
            if (pokemon != null && pokemon.obj == null)
            {
                trainer.ThrowPokemon(pokemon);
            }
            else
            {
                if (pokemonActive)
                {
                    pokemon.obj.Return();
                    pokemonActive = false;
                }
                else
                {
                    pokemonActive = true;
                }
            }
            click = true;
        }

        //activate menu
        if (Input.GetKeyDown(KeyCode.Escape) && !click)
        {
            if (pokemonActive)
            {
                pokemonActive = false;
            }
            else
            {
                GameGUI.menuActive = !GameGUI.menuActive;
            }
            click = true;
        }

        //hides or reveals the stats(Data) popup on press of k
        if (Input.GetKeyDown(KeyCode.K) && !GameGUI.menuActive)
        {
            if (!pokemonActive)
            {
                GameGUI.dataWindow = !GameGUI.dataWindow;
            }
        }

        //capture pokemon
        if (Input.GetKeyDown("c"))
        {
            GameGUI gamegui = GetComponent <GameGUI>();
            CapturePokemon();
            click = true;
        }

        //chat window
        if (Input.GetKeyDown("i"))
        {
            if (GameGUI.chatActive)
            {
                GameGUI.chatActive = false;
            }
            else
            {
                GameGUI.chatActive = true;
            }

            click = true;
        }

        if (Input.GetKeyDown("h"))
        {
            PokeCenter.HealPokemon();
        }

        /*
         * don't try using this right now, because it doesn't exist!
         * if (Input.GetKeyDown ("k")) {
         *      Populate okasf = new Populate();
         *      okasf.Test();
         * }
         */
        //anticlick
        bool anti = false;

        for (int i = 1; i <= 10 && !anti; i++)
        {
            if (Rebind.GetInput("SELECT_POKE_PARTY_" + i))
            {
                anti = true;
            }
        }
    }
Пример #8
0
    public void HandleTrainer()
    {
        //swap pokemon
        if (!click && !pokemonActive)
        {
            Pokemon oldPokemonSelection = pokemon;

            for (int i = 1; i <= trainer.party.Count(); i++)
            {
                if (Rebind.GetInputDown("SELECT_POKE_PARTY_" + i))
                {
                    trainer.party.Select(i - 1);
                }
            }

            if (Rebind.GetInputDown("SELECT_POKE_PREV"))
            {
                trainer.party.SelectPrev();
            }
            else if (Rebind.GetInputDown("SELECT_POKE_NEXT"))
            {
                trainer.party.SelectNext();
            }

            if (oldPokemonSelection != pokemon)
            {
                click = true;
                if (oldPokemonSelection.obj != null)
                {
                    oldPokemonSelection.obj.Return();
                    trainer.ThrowPokemon(pokemon);
                }
            }
        }

        var itemsCount = trainer.inventory.items.Count;

        //throw pokemon
        if (!click && Input.GetKey(KeyCode.Return))
        {
            //Swap above line for this one if you need to break the code to work without RebindInspector.
            //Suspect errors with Player.click, but haven't really investigated.
            //if (Input.GetKey(KeyCode.Return)){
            if (pokemon != null && pokemon.obj == null)
            {
                trainer.ThrowPokemon(pokemon);
            }
            else
            {
                if (pokemonActive)
                {
                    pokemon.obj.Return();
                    pokemonActive = false;
                }
                else
                {
                    pokemonActive = true;
                }
            }
            click = true;
        }

        //activate menu
        if (Input.GetKeyDown(KeyCode.Escape) && !click)
        {
            if (pokemonActive)
            {
                pokemonActive = false;
            }
            else
            {
                GameGUI.menuActive = !GameGUI.menuActive;
            }
            click = true;
        }

        //hides or reveals the stats(Data) popup on press of k
        if (Input.GetKeyDown(KeyCode.K) && !GameGUI.menuActive)
        {
            if (!pokemonActive)
            {
                GameGUI.dataWindow = !GameGUI.dataWindow;
            }
        }

        /*
         * don't try using this right now, because it doesn't exist!
         * if (Input.GetKeyDown ("k")) {
         *      Populate okasf = new Populate();
         *      okasf.Test();
         * }
         */
        //anticlick
        bool anti = false;

        for (int i = 1; i <= 10 && !anti; i++)
        {
            if (Rebind.GetInput("SELECT_POKE_PARTY_" + i))
            {
                anti = true;
            }
        }
    }