コード例 #1
0
    public void UpperMenu()
    {
        GUI.skin = _skin;
        if (BattleController.isInBattle)
        {
            return;
        }

        string[]     menuOptions  = new string[] { "Treinar", "Status", "Rank", "Mundo" };
        MenuToDraw[] menuFunction = new MenuToDraw[] { LearnMenu, PowerMenu, null, MapMenu };

        rect = new Rect(0, 0, Screen.width / menuOptions.Length, def_height * 1.5f);

        for (var i = 0; i < menuOptions.Length; i++)
        {
            if (GUI.Button(rect, menuOptions[i]))
            {
                menuToDraw = menuFunction[i];
            }
            rect.x += rect.width;
        }
        rect.Set(0, rect.max.y, Screen.width, Screen.height - rect.height);
        ScreenRect = rect;
    }
コード例 #2
0
    private void Start()
    {
        gskin         = Resources.Load <GUISkin>("skin_default");
        _skin         = Resources.Load <GUISkin>("skin_used");
        avatarTexture = Resources.Load <Texture2D>("sprites/spr_avatar");
        bookTexture   = Resources.Load <Texture2D>("sprites/spr_book");
        redArrow      = Resources.Load <Texture2D>("sprites/spr_red_arrow");

        // create background texture
        menuBackground = new Texture2D(61, 100);
        Color[] c = new Color[menuBackground.width * menuBackground.height];
        for (var i = 0; i < c.Length; i++)
        {
            c[i] = new Color(i % 2, i % 2, i % 2, .5f);
        }
        menuBackground.SetPixels(c); menuBackground.alphaIsTransparency = true; menuBackground.Apply();

        def_height   = gskin.button.CalcSize(new GUIContent("QALDFD$%(")).y;
        _skin.button = new GUIStyle(gskin.button);
        _skin.label  = new GUIStyle(gskin.label);
        _skin.box    = new GUIStyle(gskin.box);

        menuToDraw = MapMenu;
    }