コード例 #1
0
 void Start()
 {
     GUImgr.Start();
     if (this.GetComponent <PartyMenuPopup> () != null)
     {
         Debug.Log("partymenu != null");
         partyMenuPopup = gameObject.GetComponent <PartyMenuPopup>();
     }
     else
     {
         Debug.Log("partymenu else");
         partyMenuPopup = gameObject.AddComponent <PartyMenuPopup> ();
     }
 }
コード例 #2
0
    public void EnemyTargetWindow(Pokemon pokemon)
    {
        float tmpPokeHp = pokemon.hp;

        if (tmpPokeHp <= 0)
        {
            tmpPokeHp = 0;
        }
        float ypos = 5;
        float xpos = (Screen.width / 2) - 100;

        GUI.DrawTexture(new Rect(xpos, ypos, 200, 60), GUImgr.gradRight);
        GUI.Label(new Rect(xpos, ypos, 200, 20), pokemon.name + " lvl" + pokemon.level.ToString());
        ypos += 20;
        GUI.Label(new Rect(xpos, ypos, 200, 20), "HP");
        GUImgr.DrawBar(new Rect(xpos + 35, ypos + 5, 200, 10), tmpPokeHp, GUImgr.hp);
    }
コード例 #3
0
    public void AddSlot(Pokemon thisPokemon, float yPos)
    {
        pokemon = thisPokemon;
        var label = new GUIStyle();

        label.fontSize  = 12;
        label.fontStyle = FontStyle.Bold;
        GUI.DrawTexture(new Rect(0, yPos, 72, 70), GUImgr.statOk);
        if (pokemon.icon != null)
        {
            GUI.DrawTexture(new Rect(0, yPos, 48, 48), pokemon.icon);
        }
        GUI.Label(new Rect(36, yPos, 40, 25), "Lv: " + pokemon.level, label);
        GUImgr.DrawBar(new Rect(0, yPos + 53, 48, 4), pokemon.xp, GUImgr.xp, true);
        GUImgr.DrawBar(new Rect(53, yPos + 20, 4, 36), pokemon.pp, GUImgr.pp, false);
        GUImgr.DrawBar(new Rect(58, yPos + 20, 4, 36), pokemon.hp, GUImgr.hp, false);
        rect = new Rect(0, yPos, 72, 70);
    }
コード例 #4
0
ファイル: BattleGUI.cs プロジェクト: qipa/Unity-2
    public void ToggleHud()
    {
        Vector2 xy;

        xy = Camera.main.WorldToScreenPoint(pokemonObj.transform.position);
        float x = xy.x;
        float y = Screen.height - xy.y;

        GUImgr.DrawBar(new Rect(x - 40, y - 69, 85, 8), pokemonObj.pokemon.hp, GUImgr.hp);    // Draw HP bar
        GUImgr.DrawBar(new Rect(x - 40, y - 61, 85, 8), pokemonObj.pokemon.pp, GUImgr.pp);    // Draw PP bar
        //GUI.Label(new Rect(x-40,y-80 ,200,15), "HP: " + currentHealth.ToString()+"/" +  health.ToString());
        if (pokemonObj.enemy && pokemonObj.enemy.pokemon != null)
        {
            moveCast = pokemonObj.enemy.pokemon.moveCast;
            damage   = (int)pokemonObj.enemy.pokemon.damage;
            Vector2 xy1;
            xy1 = Camera.main.WorldToScreenPoint(pokemonObj.enemy.transform.position);
            float x1 = xy1.x;
            float y1 = Screen.height - xy1.y;                                                          //
            GUImgr.DrawBar(new Rect(x1 - 40, y1 - 60, 85, 8), pokemonObj.enemy.pokemon.hp, GUImgr.hp); //Draw Enemy HP Bar
            GUI.Label(new Rect(x1 + 70, y1 - 100, 250, 40), damage.ToString() + " damage taken from " + moveCast + " !");
        }
    }
コード例 #5
0
    void PokemonWindow()
    {
        float mx = Input.mousePosition.x;
        float my = Screen.height - Input.mousePosition.y;

        {
            float xpos = Screen.width / 2 - Player.trainer.pokemon.Count * 64 / 2;
            foreach (Pokemon poke in Player.trainer.pokemon)
            {
                if (poke == Player.pokemon)
                {
                    GUI.DrawTexture(new Rect(xpos + 16, 0, 32, 50), GUImgr.gradDown);
                }
                if (my < 64 && mx > xpos && mx < xpos + 64)
                {
                    GUI.DrawTexture(new Rect(xpos + 16, 0, 32, 50), GUImgr.gradDown);
                    if (Input.GetMouseButton(0) && !Player.click)
                    {
                        Player.click = true;
                        if (Player.pokemon.obj != null)
                        {
                            Player.pokemon.obj.Return();
                            Player.trainer.ThrowPokemon(poke);
                        }
                        Player.pokemon = poke;
                    }
                }
                GUI.DrawTexture(new Rect(xpos, 0, 64, 64), poke.icon);
                xpos += 64;
            }
        }

        if (Player.pokemon != null)
        {
            Pokemon poke = Player.pokemon;
            float   ypos = 70;
            GUI.DrawTexture(new Rect(0, ypos, 300, 200), GUImgr.gradRight);
            ypos += 20;
            GUI.Label(new Rect(20, ypos, 200, 25), poke.name);
            GUI.Label(new Rect(150, ypos, 200, 25), "HP");
            GUImgr.DrawBar(new Rect(175, ypos + 10, 100, 5), poke.hp, GUImgr.hp);
            ypos += 20;
            string numberText = poke.number.ToString();
            if (poke.number < 100)
            {
                numberText = "0" + numberText;
            }
            if (poke.number < 10)
            {
                numberText = "0" + numberText;
            }
            GUI.Label(new Rect(20, ypos, 200, 25), "#" + numberText + " " + Pokemon.GetName(poke.number));
            GUI.Label(new Rect(150, ypos, 200, 25), "XP");
            GUImgr.DrawBar(new Rect(175, ypos + 10, 100, 5), poke.xp, GUImgr.xp);
            ypos += 50;

            GUI.Label(new Rect(20, ypos, 200, 25), "Health " + poke.health.ToString());
            GUI.Label(new Rect(150, ypos, 200, 25), "Speed " + poke.speed.ToString());
            ypos += 20;
            GUI.Label(new Rect(20, ypos, 200, 25), "Attack " + poke.attack.ToString());
            GUI.Label(new Rect(150, ypos, 200, 25), "Defence " + poke.defence.ToString());

            ypos += 20;
            if (poke.heldItem != null)
            {
                GUI.Label(new Rect(20, ypos, 200, 25), poke.heldItem.type.ToString());
            }
        }
    }
コード例 #6
0
    void OnGUI()
    {
        GUI.skin.label.fontSize         = 15;
        GUI.skin.label.fontStyle        = FontStyle.Bold;
        GUI.skin.label.normal.textColor = Color.black;

        float mx = Input.mousePosition.x;
        float my = Screen.height - Input.mousePosition.y;

        if (Dialog.inDialog)
        {
            Dialog.GUIWindow();
            return;
        }

        Dialog.doneDialog = false;

        if (chatActive)
        {
            OpenChatWindow();
        }

        if (Player.pokemonActive && Player.pokemon.obj != null)
        {
            Player.pokemon.obj.GetComponent <PokemonDomesticated>().BattleGUI();
            return;
        }

        if (menuActive)
        {
            GUI.skin.label.alignment = TextAnchor.MiddleRight;
            float ypos = 0;
            GUI.DrawTexture(new Rect(Screen.width - 100, 0, 150, Screen.height), GUImgr.gradLeft);
            for (int i = 0; i < 8; i++)
            {
                if ((int)currentWindow == i && i > 0)
                {
                    GUI.DrawTexture(new Rect(Screen.width - 120, ypos + 5, 150, 15), GUImgr.gradLeft);
                }
                if (mx > Screen.width - 200 && my > ypos && my < ypos + 25)
                {
                    GUI.DrawTexture(new Rect(Screen.width - 120, ypos + 5, 150, 15), GUImgr.gradLeft);
                    if (Input.GetMouseButton(0) && !Player.click)
                    {
                        Player.click = true;
                        if (i == 0)
                        {
                            menuActive = false;
                        }
                        else
                        {
                            currentWindow = (MenuWindows)i;
                        }
                    }
                }
                if (i == 0)
                {
                    GUI.Label(new Rect(Screen.width - 210, ypos, 200, 25), "Close");
                }
                else
                {
                    GUI.Label(new Rect(Screen.width - 210, ypos, 200, 25), ((MenuWindows)i).ToString());
                }
                ypos += 25;
            }

            string timeTxt = TimeMgr.hour.ToString() + ":";
            if (TimeMgr.minuite < 10)
            {
                timeTxt += "0" + ((int)TimeMgr.minuite).ToString();
            }
            else
            {
                timeTxt += ((int)TimeMgr.minuite).ToString();
            }
            GUI.Label(new Rect(Screen.width - 210, Screen.height - 25, 200, 25), timeTxt);

            GUI.skin.label.alignment = TextAnchor.MiddleLeft;

            switch (currentWindow)
            {
            case MenuWindows.Multiplayer:   MultiplayerWindow();    break;

            case MenuWindows.Pokedex:               PokedexWindow();                break;

            case MenuWindows.Pokemon:               PokemonWindow();                break;

            case MenuWindows.Inventory:             InventoryWindow();              break;

            case MenuWindows.Talents:               TalentsWindow();                break;

            case MenuWindows.Options:               OptionsWindow();                break;

            case MenuWindows.Quit:                  QuitWindow();                   break;
            }
            return;
        }

        {
            float ypos = 0;
            foreach (Pokemon poke in Player.trainer.pokemon)
            {
                if (poke == Player.pokemon)
                {
                    GUI.DrawTexture(new Rect(0, ypos + 16, 100, 32), GUImgr.gradRight);
                }
                GUI.DrawTexture(new Rect(0, ypos, 64, 64), poke.icon);
                GUI.Label(new Rect(64, ypos, 200, 25), poke.name + " lvl" + poke.level.ToString());
                GUImgr.DrawBar(new Rect(64, ypos + 25, 100, 5), poke.hp, GUImgr.hp);
                GUImgr.DrawBar(new Rect(64, ypos + 35, 100, 5), poke.xp, GUImgr.xp);
                ypos += 70;
            }
        }
    }
コード例 #7
0
 void Start()
 {
     GUImgr.Start();
 }
コード例 #8
0
    public void BattleGUI()
    {
        GUI.DrawTexture(new Rect(0, Screen.height - 90, 200, 100), GUImgr.gradRight);
        float ypos = Screen.height - 85;

        GUI.Label(new Rect(10, ypos, 200, 20), name + " lvl" + pokemonObj.pokemon.level.ToString());

        //stats
        ypos += 20;
        GUI.Label(new Rect(10, ypos, 200, 20), "HP");
        GUImgr.DrawBar(new Rect(35, ypos + 5, 200, 10), pokemonObj.pokemon.hp, GUImgr.hp);

        ypos += 20;
        GUI.Label(new Rect(10, ypos, 200, 20), "PP");
        GUImgr.DrawBar(new Rect(35, ypos + 5, 200, 10), pokemonObj.pokemon.pp, GUImgr.pp);

        ypos += 20;
        GUI.Label(new Rect(10, ypos, 200, 20), "XP");
        GUImgr.DrawBar(new Rect(35, ypos + 5, 200, 10), pokemonObj.pokemon.xp, GUImgr.xp);

        //current target
        if (pokemonObj.enemy != null)
        {
            if (pokemonObj.enemy.pokemon != null)
            {
                GUI.DrawTexture(new Rect(0, 0, 200, 60), GUImgr.gradRight);
                ypos = 5;
                GUI.Label(new Rect(10, ypos, 200, 20), pokemonObj.enemy.name + " lvl" + pokemonObj.enemy.pokemon.level.ToString());
                ypos += 20;
                GUI.Label(new Rect(10, ypos, 200, 20), "HP");
                GUImgr.DrawBar(new Rect(35, ypos + 5, 200, 10), pokemonObj.enemy.pokemon.hp, GUImgr.hp);;
            }
        }

        //moves
        float height = pokemonObj.pokemon.moves.Count * 40 + 10;

        GUI.DrawTexture(new Rect(Screen.width - 200, Screen.height - height, 200, height), GUImgr.gradLeft);
        ypos = Screen.height - 40;
        float xpos  = Screen.width - 150;
        int   moveN = pokemonObj.pokemon.moves.Count;

        foreach (Move move in pokemonObj.pokemon.moves)
        {
            GUI.Label(new Rect(xpos, ypos, 200, 20), moveN.ToString() + " - " + move.moveType.ToString());
            GUImgr.DrawBar(new Rect(xpos, ypos + 20, 100, 5), move.cooldown, GUImgr.pp);
            ypos -= 40;
            bool useMove = false;
            if (!Player.click)
            {
                switch (moveN)
                {
                case 1: if (Input.GetKey(KeyCode.Alpha1) || Input.GetKey(KeyCode.Keypad1))
                    {
                        useMove = true;
                    }
                    break;

                case 2: if (Input.GetKey(KeyCode.Alpha2) || Input.GetKey(KeyCode.Keypad2))
                    {
                        useMove = true;
                    }
                    break;

                case 3: if (Input.GetKey(KeyCode.Alpha3) || Input.GetKey(KeyCode.Keypad3))
                    {
                        useMove = true;
                    }
                    break;

                case 4: if (Input.GetKey(KeyCode.Alpha4) || Input.GetKey(KeyCode.Keypad4))
                    {
                        useMove = true;
                    }
                    break;

                case 5: if (Input.GetKey(KeyCode.Alpha5) || Input.GetKey(KeyCode.Keypad5))
                    {
                        useMove = true;
                    }
                    break;

                case 6: if (Input.GetKey(KeyCode.Alpha6) || Input.GetKey(KeyCode.Keypad6))
                    {
                        useMove = true;
                    }
                    break;

                case 7: if (Input.GetKey(KeyCode.Alpha7) || Input.GetKey(KeyCode.Keypad7))
                    {
                        useMove = true;
                    }
                    break;

                case 8: if (Input.GetKey(KeyCode.Alpha8) || Input.GetKey(KeyCode.Keypad8))
                    {
                        useMove = true;
                    }
                    break;

                case 9: if (Input.GetKey(KeyCode.Alpha9) || Input.GetKey(KeyCode.Keypad9))
                    {
                        useMove = true;
                    }
                    break;
                }
            }
            if (useMove)
            {
                pokemonObj.UseMove(transform.forward, move);
            }
            moveN--;
        }
    }
コード例 #9
0
    void PokemonWindow()
    {
        var     party = Player.trainer.party;
        float   mx    = Input.mousePosition.x;
        float   my    = Screen.height - Input.mousePosition.y;
        float   xpos  = Screen.width / 2 - party.Count() * 64 / 2;
        Pokemon pokemon;

        foreach (var slot in party.GetSlots())
        {
            pokemon = slot.pokemon;

            if (party.IsActive(pokemon))
            {
                GUI.DrawTexture(new Rect(xpos + 16, 0, 32, 50), GUImgr.gradDown);
            }

            if (my < 64 && mx > xpos && mx < xpos + 64)
            {
                GUI.DrawTexture(new Rect(xpos + 16, 0, 32, 50), GUImgr.gradDown);
                if (Input.GetMouseButton(0) && !Player.click)
                {
                    Player.click = true;
                    party.Select(slot.index);
                    if (Player.pokemon.obj != null)
                    {
                        Player.pokemon.obj.GetComponent <PokemonObj>().Return();
                        Player.trainer.ThrowPokemon(pokemon);
                    }
                }
            }

            GUI.DrawTexture(new Rect(xpos, 0, 64, 64), pokemon.icon);
            xpos += 64;
        }

        if (Player.pokemon != null)
        {
            Pokemon poke = Player.pokemon;
            float   ypos = 70;
            GUI.DrawTexture(new Rect(0, ypos, 300, 200), GUImgr.gradRight);
            ypos += 20;
            GUI.Label(new Rect(20, ypos, 200, 25), poke.name);
            GUI.Label(new Rect(150, ypos, 200, 25), "HP");
            GUImgr.DrawBar(new Rect(175, ypos + 10, 100, 5), poke.hp, GUImgr.hp);
            ypos += 20;
            string numberText = poke.number.ToString();
            if (poke.number < 100)
            {
                numberText = "0" + numberText;
            }
            if (poke.number < 10)
            {
                numberText = "0" + numberText;
            }
            GUI.Label(new Rect(20, ypos, 200, 25), "#" + numberText + " " + Pokemon.GetName(poke.number));
            GUI.Label(new Rect(150, ypos, 200, 25), "XP");
            GUImgr.DrawBar(new Rect(175, ypos + 10, 100, 5), poke.xp, GUImgr.xp);
            ypos += 50;

            GUI.Label(new Rect(20, ypos, 200, 25), "Health " + poke.health.ToString());
            GUI.Label(new Rect(150, ypos, 200, 25), "Speed " + poke.speed.ToString());
            ypos += 20;
            GUI.Label(new Rect(20, ypos, 200, 25), "Attack " + poke.attack.ToString());
            GUI.Label(new Rect(150, ypos, 200, 25), "Defence " + poke.defence.ToString());

            ypos += 20;
            if (poke.heldItem != null)
            {
                GUI.Label(new Rect(20, ypos, 200, 25), poke.heldItem.data.name);
            }
        }
    }
コード例 #10
0
    void PokemonWindow()
    {
        var     party    = Player.trainer.party;
        float   mx       = Input.mousePosition.x;
        float   my       = Screen.height - Input.mousePosition.y;
        float   xpos     = Screen.width / 2 - party.Count() * 64 / 2;
        float   swapXPos = 430;
        Pokemon pokemon;
        int     curSlot = 0;

        foreach (var slot in party.GetSlots())
        {
            pokemon = slot.pokemon;

            if (party.IsActive(pokemon))
            {
                GUI.DrawTexture(new Rect(xpos + 16, 0, 32, 50), GUImgr.gradDown);
                curSlot = slot.index;
            }

            /*else {
             *      GUI.DrawTexture (new Rect(swapXPos, Screen.height/4, 64, 64), GUImgr.statOk);
             *      //GUI.DrawTexture(new Rect(swapXPos,Screen.height/4, 64, 64), pokemon.icon);
             *      loop++;
             *      if (GUI.Button(new Rect(swapXPos,Screen.height/4,64,64), pokemon.icon)) {
             *              party.Swap (loop, curSlot);
             *      }
             *      swapXPos+=70;
             * }*/

            if (my < 64 && mx > xpos && mx < xpos + 64)
            {
                GUI.DrawTexture(new Rect(xpos + 16, 0, 32, 50), GUImgr.gradDown);
                if (Input.GetMouseButton(0) && !Player.click)
                {
                    Player.click = true;
                    party.Select(slot.index);
                    if (Player.pokemon.obj != null)
                    {
                        Player.pokemon.obj.GetComponent <PokemonObj>().Return();
                        Player.trainer.ThrowPokemon(pokemon);
                    }
                }
            }

            GUI.DrawTexture(new Rect(xpos, 0, 64, 64), pokemon.icon);
            xpos += 64;
        }

        //I really HATE that I have to do a double loop here to do my swap buttons, but I don't have
        //a good way of making sure that my active pokemon is set before I make the buttons otherwise.
        //Purpose: To allow for a quick swap of the party, by simply clicking a member portrait while
        //looking at the party member you want to switch.
        GUI.DrawTexture(new Rect(330, Screen.height / 8, 100 + 70 * (party.Count() - 1), 70), GUImgr.bckDrop);
        GUI.Label(new Rect(330, Screen.height / 8, 150, 25), "Quick Swap: ");
        foreach (var slot in party.GetSlots())
        {
            pokemon = slot.pokemon;
            if (!party.IsActive(pokemon))
            {
                GUI.DrawTexture(new Rect(swapXPos, 1 * Screen.height / 8, 64, 64), GUImgr.statOk);
                //GUI.DrawTexture(new Rect(swapXPos,Screen.height/4, 64, 64), pokemon.icon);
                if (GUI.Button(new Rect(swapXPos, 1 * Screen.height / 8, 64, 64), pokemon.icon))
                {
                    party.Swap(slot.index, curSlot);
                }
                swapXPos += 70;
            }
        }

        if (Player.pokemon != null)
        {
            Pokemon poke = Player.pokemon;
            float   ypos = 70;
            GUI.DrawTexture(new Rect(0, ypos, 300, 200), GUImgr.gradRight);
            ypos += 20;
            GUI.Label(new Rect(20, ypos, 200, 25), poke.name);
            GUI.Label(new Rect(150, ypos, 200, 25), "HP");
            GUImgr.DrawBar(new Rect(175, ypos + 10, 100, 5), poke.hp, GUImgr.hp);
            ypos += 20;
            string numberText = poke.number.ToString();
            if (poke.number < 100)
            {
                numberText = "0" + numberText;
            }
            if (poke.number < 10)
            {
                numberText = "0" + numberText;
            }
            GUI.Label(new Rect(20, ypos, 200, 25), "#" + numberText + " " + Pokemon.GetName(poke.number));
            GUI.Label(new Rect(150, ypos, 200, 25), "XP");
            GUImgr.DrawBar(new Rect(175, ypos + 10, 100, 5), poke.xp, GUImgr.xp);
            ypos += 50;

            GUI.Label(new Rect(20, ypos, 200, 25), "Health " + poke.health.ToString());
            GUI.Label(new Rect(150, ypos, 200, 25), "Speed " + poke.speed.ToString());
            ypos += 20;
            GUI.Label(new Rect(20, ypos, 200, 25), "Attack " + poke.attack.ToString());
            GUI.Label(new Rect(150, ypos, 200, 25), "Defence " + poke.defence.ToString());

            ypos += 20;
            if (poke.heldItem != null)
            {
                GUI.Label(new Rect(20, ypos, 200, 25), poke.heldItem.data.name);
            }
        }
    }
コード例 #11
0
 void Start()
 {
     GUImgr.Start();
     partyMenu = gameObject.AddComponent <PartyMenu> ();
 }