Exemple #1
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            if (mouseClick)
            {
                editingText = EDITING_NONE;
            }

            bool drawRow = false;

#if SCREENSHOTMODE
            Keys[] keys = Keyboard.GetState().GetPressedKeys();
            foreach (Keys key in keys)
            {
                if (key == Keys.End)
                {
                    drawRow = true;
                }
            }
#endif
            if (drawRow)
            {
                graphics.GraphicsDevice.Clear(Color.White);

                KeyFrame[] keyFrame = charDef.GetAnimation(selAnim).getKeyFrameArray();
                for (int i = 0; i < keyFrame.Length; i++)
                {
                    int fref = charDef.GetAnimation(selAnim).GetKeyFrame(i).frameRef;
                    if (fref >= 0)
                    {
                        DrawCharacter(new Vector2(
                                          100f + (float)(i % 12) * 100f,
                                          130f + (float)(i / 12) * 130f
                                          ),
                                      0.5f,
                                      FACE_LEFT,
                                      fref,
                                      true, 1.0f);
                    }
                }
            }
            else
            {
                graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

                #region Black BG
                spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
                spriteBatch.Draw(nullTex, new Rectangle(300, 450, 200, 5), new Color(new
                                                                                     Vector4(1.0f, 0.0f, 0.0f, 0.5f)));
                spriteBatch.Draw(nullTex, new Rectangle(0, 0, 200, 450), new Color(new
                                                                                   Vector4(0.0f, 0.0f, 0.0f, 0.5f)));
                spriteBatch.Draw(nullTex, new Rectangle(590, 0, 300, 600), new Color(new
                                                                                     Vector4(0.0f, 0.0f, 0.0f, 0.5f)));
                spriteBatch.Draw(nullTex, new Rectangle(200, 0, 150, 130), new Color(new
                                                                                     Vector4(0.0f, 0.0f, 0.0f, 0.5f)));
                spriteBatch.End();
                #endregion

                if (selFrame > 0)
                {
                    DrawCharacter(new Vector2(400f, 450f), 2f, FACE_RIGHT,
                                  selFrame - 1, false, 0.2f);
                }
                if (selFrame < charDef.GetFrameArray().Length - 1)
                {
                    DrawCharacter(new Vector2(400f, 450f), 2f, FACE_RIGHT,
                                  selFrame + 1, false, 0.2f);
                }

                DrawCharacter(new Vector2(400f, 450f), 2f, FACE_RIGHT, selFrame,
                              false, 1.0f);

                int fref = charDef.GetAnimation(selAnim).GetKeyFrame(curKey).frameRef;
                if (fref < 0)
                {
                    fref = 0;
                }

                DrawCharacter(new Vector2(500f, 100f), 0.5f, FACE_LEFT,
                              fref,
                              true, 1.0f);

                text.Size = 0.45f;

                #region Play Stop
                if (playing)
                {
                    if (text.DrawClickText(480, 100, "stop",
                                           mouseState.X, mouseState.Y, mouseClick))
                    {
                        playing = false;
                    }
                }
                else
                {
                    if (text.DrawClickText(480, 100, "play",
                                           mouseState.X, mouseState.Y, mouseClick))
                    {
                        playing = true;
                    }
                }
                #endregion

                #region Load/Save

                if (drawButton(200, 5, 3, mouseClick))
                {
                    charDef.WriteBackup();
                }
                if (drawButton(230, 5, 4, mouseClick))
                {
                    charDef.Read();
                }
                if (editingText == EDITING_PATH)
                {
                    text.Color = Color.Lime;
                    text.DrawText(270, 15, charDef.path + "*");
                }
                else
                {
                    if (text.DrawClickText(270, 15, charDef.path, mouseState.X,
                                           mouseState.Y, mouseClick))
                    {
                        editingText = EDITING_PATH;
                    }
                }
                #endregion

                #region Texture Switching
                if (auxMode == AUX_TEXTURES)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (drawButton(210 + i * 21, 40, 1, mouseClick, 0.45f))
                        {
                            switch (i)
                            {
                            case 0:
                                if (charDef.headIdx > 0)
                                {
                                    charDef.headIdx--;
                                }
                                break;

                            case 1:
                                if (charDef.torsoIdx > 0)
                                {
                                    charDef.torsoIdx--;
                                }
                                break;

                            case 2:
                                if (charDef.legsIdx > 0)
                                {
                                    charDef.legsIdx--;
                                }
                                break;

                            case 3:
                                if (charDef.weaponIdx > 0)
                                {
                                    charDef.weaponIdx--;
                                }
                                break;
                            }
                        }
                        string t = charDef.headIdx.ToString();
                        switch (i)
                        {
                        case 1:
                            t = charDef.torsoIdx.ToString();
                            break;

                        case 2:
                            t = charDef.legsIdx.ToString();
                            break;

                        case 3:
                            t = charDef.weaponIdx.ToString();
                            break;
                        }
                        text.Color = (Color.White);
                        text.DrawText(212 + i * 21, 60, t);
                        if (drawButton(210 + i * 21, 85, 2, mouseClick, 0.45f))
                        {
                            switch (i)
                            {
                            case 0:
                                if (charDef.headIdx < headTex.Length - 1)
                                {
                                    charDef.headIdx++;
                                }
                                break;

                            case 1:
                                if (charDef.torsoIdx < torsoTex.Length - 1)
                                {
                                    charDef.torsoIdx++;
                                }
                                break;

                            case 2:
                                if (charDef.legsIdx < legsTex.Length - 1)
                                {
                                    charDef.legsIdx++;
                                }
                                break;

                            case 3:
                                if (charDef.weaponIdx < weaponTex.Length - 1)
                                {
                                    charDef.weaponIdx++;
                                }
                                break;
                            }
                        }
                    }
                }
                #endregion

                #region Script/Trigs Selector
                if (auxMode == AUX_SCRIPT)
                {
                    text.Color = Color.Lime;
                    text.DrawText(210, 110, "script");
                }
                else
                {
                    if (text.DrawClickText(210, 110, "script", mouseState.X,
                                           mouseState.Y, mouseClick))
                    {
                        auxMode = AUX_SCRIPT;
                    }
                }
                if (auxMode == AUX_TRIGS)
                {
                    text.Color = Color.Lime;
                    text.DrawText(260, 110, "trigs");
                }
                else
                {
                    if (text.DrawClickText(260, 110, "trigs", mouseState.X,
                                           mouseState.Y, mouseClick))
                    {
                        auxMode = AUX_TRIGS;
                    }
                }
                if (auxMode == AUX_TEXTURES)
                {
                    text.Color = Color.Lime;
                    text.DrawText(300, 110, "tex");
                }
                else
                {
                    if (text.DrawClickText(300, 110, "tex", mouseState.X,
                                           mouseState.Y, mouseClick))
                    {
                        auxMode = AUX_TEXTURES;
                    }
                }
                #endregion

                #region Trigs
                if (auxMode == AUX_TRIGS)
                {
                    if (drawButton(330, 42, 1,
                                   (mouseState.LeftButton == ButtonState.Pressed), 0.5f))
                    {
                        if (trigScroll > 0)
                        {
                            trigScroll--;
                        }
                    }
                    if (drawButton(330, 92, 2,
                                   (mouseState.LeftButton == ButtonState.Pressed), 0.5f))
                    {
                        if (trigScroll < 100)
                        {
                            trigScroll++;
                        }
                    }
                    for (int i = 0; i < 4; i++)
                    {
                        int t = i + trigScroll;
                        if (text.DrawClickText(210, 42 + i * 16,
                                               GetTrigName(t), mouseState.X,
                                               mouseState.Y, mouseClick))
                        {
                            charDef.GetFrame(selFrame).GetPart(selPart).idx
                                = t + 1000;
                        }
                    }
                }
                #endregion

                #region Script
                if (auxMode == AUX_SCRIPT)
                {
                    for (int i = 0; i < 4; i++)
                    {
                        if (editingText == EDITING_SCRIPT && selScriptLine == i)
                        {
                            text.Color = Color.Lime;
                            text.DrawText(210, 42 + i * 16, i.ToString() + ": " +
                                          charDef.GetAnimation(selAnim).GetKeyFrame(selKeyFrame).GetScript(i)
                                          + "*");
                        }
                        else
                        {
                            if (text.DrawClickText(210, 42 + i * 16, i.ToString() + ": " +
                                                   charDef.GetAnimation(selAnim).GetKeyFrame(selKeyFrame).GetScript(i),
                                                   mouseState.X, mouseState.Y, mouseClick))
                            {
                                selScriptLine = i;
                                editingText   = EDITING_SCRIPT;
                            }
                        }
                    }
                }
                #endregion

                #region Parts List
                for (int i = 0; i < charDef.GetFrame(selFrame).GetPartArray().Length; i++)
                {
                    String line = "";
                    int    idx  = charDef.GetFrame(selFrame).GetPart(i).idx;
                    if (idx < 0)
                    {
                        line = "";
                    }
                    else if (idx < 64)
                    {
                        line = "head" + idx.ToString();
                    }
                    else if (idx < 74)
                    {
                        line = "torso" + idx.ToString();
                    }
                    else if (idx < 128)
                    {
                        line = "arms" + idx.ToString();
                    }
                    else if (idx < 192)
                    {
                        line = "legs" + idx.ToString();
                    }
                    else if (idx < 1000)
                    {
                        line = "weapon" + idx.ToString();
                    }
                    else
                    {
                        line = GetTrigName(idx - 1000);
                    }

                    if (selPart == i)
                    {
                        text.Color = Color.Lime;
                        text.DrawText(600, 5 + i * 15, i.ToString() + ": " +
                                      line);

                        if (drawButton(700, 5 + i * 15, 1, mouseClick, 0.5f))
                        {
                            SwapParts(selPart, selPart - 1);
                            if (selPart > 0)
                            {
                                selPart--;
                            }
                        }
                        if (drawButton(720, 5 + i * 15, 2, mouseClick, 0.5f))
                        {
                            SwapParts(selPart, selPart + 1);
                            if (selPart <
                                charDef.GetFrame(selFrame).GetPartArray().Length - 1)
                            {
                                selPart++;
                            }
                        }
                        Part part = charDef.GetFrame(selFrame).GetPart(selPart);
                        if (text.DrawClickText(740, 5 + i * 15,
                                               (part.flip == 0 ? "(n)" : "(m)"),
                                               mouseState.X, mouseState.Y, mouseClick))
                        {
                            part.flip = 1 - part.flip;
                        }
                        if (text.DrawClickText(762, 5 + i * 15, "(r)",
                                               mouseState.X, mouseState.Y, mouseClick))
                        {
                            part.scaling =
                                new Vector2(1.0f, 1.0f);
                        }
                        if (text.DrawClickText(780, 5 + i * 15, "(x)",
                                               mouseState.X, mouseState.Y, mouseClick))
                        {
                            part.idx = -1;
                        }
                    }
                    else
                    {
                        if (text.DrawClickText(600, 5 + i * 15, i.ToString() + ": " +
                                               line, mouseState.X, mouseState.Y, mouseClick))
                        {
                            selPart = i;
                        }
                    }
                }
                #endregion

                #region Frame List
                for (int i = frameScroll; i < frameScroll + 20; i++)
                {
                    if (i < charDef.GetFrameArray().Length)
                    {
                        int y = (i - frameScroll) * 15 + 280;
                        if (i == selFrame)
                        {
                            text.Color = Color.Lime;
                            text.DrawText(600, y, i.ToString() + ": " +
                                          charDef.GetFrame(i).name +
                                          (editingText == EDITING_FRAME_NAME
                                ? "*" : ""));

                            if (text.DrawClickText(720, y, "(a)",
                                                   mouseState.X, mouseState.Y, mouseClick))
                            {
                                Animation animation = charDef.GetAnimation(selAnim);

                                for (int j = 0; j <
                                     animation.getKeyFrameArray().Length
                                     ; j++)
                                {
                                    KeyFrame keyframe = animation.GetKeyFrame(j);

                                    if (keyframe.frameRef == -1)
                                    {
                                        keyframe.frameRef = i;
                                        keyframe.duration = 1;

                                        break;
                                    }
                                }
                            }
                        }
                        else
                        {
                            if (text.DrawClickText(600, y, i.ToString() + ": " +
                                                   charDef.GetFrame(i).name, mouseState.X,
                                                   mouseState.Y, mouseClick))
                            {
                                if (selFrame != i)
                                {
                                    if (charDef.GetFrame(i).name == "")
                                    {
                                        CopyFrame(selFrame, i);
                                    }
                                    selFrame    = i;
                                    editingText = EDITING_FRAME_NAME;
                                }
                            }
                        }
                    }
                }
                if (drawButton(770, 280, 1, (mouseState.LeftButton == ButtonState.Pressed)) && frameScroll > 0)
                {
                    frameScroll--;
                }
                if (drawButton(770, 570, 2, (mouseState.LeftButton == ButtonState.Pressed)) && frameScroll <
                    charDef.GetFrameArray().Length - 20)
                {
                    frameScroll++;
                }
                #endregion

                #region Animation List
                for (int i = animScroll; i < animScroll + 15; i++)
                {
                    if (i < charDef.GetAnimationArray().Length)
                    {
                        int y = (i - animScroll) * 15 + 5;
                        if (i == selAnim)
                        {
                            text.Color = Color.Lime;
                            text.DrawText(5, y, i.ToString() + ": " +
                                          charDef.GetAnimation(i).name +
                                          (editingText == EDITING_ANIMATION_NAME
                                ? "*" : ""));
                        }
                        else
                        {
                            if (text.DrawClickText(5, y, i.ToString() + ": " +
                                                   charDef.GetAnimation(i).name, mouseState.X,
                                                   mouseState.Y, mouseClick))
                            {
                                selAnim     = i;
                                editingText = EDITING_ANIMATION_NAME;
                            }
                        }
                    }
                }
                if (drawButton(170, 5, 1, (mouseState.LeftButton == ButtonState.Pressed)) && animScroll > 0)
                {
                    animScroll--;
                }
                if (drawButton(170, 200, 2, (mouseState.LeftButton == ButtonState.Pressed)) && animScroll <
                    charDef.GetAnimationArray().Length - 15)
                {
                    animScroll++;
                }
                #endregion

                #region Keyframe List
                for (int i = keyFrameScroll; i < keyFrameScroll + 13; i++)
                {
                    Animation animation = charDef.GetAnimation(selAnim);

                    if (i < animation.getKeyFrameArray().Length)
                    {
                        int    y        = (i - keyFrameScroll) * 15 + 250;
                        int    frameRef = animation.GetKeyFrame(i).frameRef;
                        String name     = "";
                        if (frameRef > -1)
                        {
                            name = charDef.GetFrame(frameRef).name;
                        }
                        if (i == selKeyFrame)
                        {
                            text.Color = Color.Lime;
                            text.DrawText(5, y, i.ToString() + ": " +
                                          name);
                        }
                        else
                        {
                            if (text.DrawClickText(5, y, i.ToString() + ": " +
                                                   name, mouseState.X,
                                                   mouseState.Y, mouseClick))
                            {
                                selKeyFrame = i;
                            }
                        }
                        if (animation.GetKeyFrame(i).frameRef > -1)
                        {
                            if (text.DrawClickText(110, y, "-", mouseState.X,
                                                   mouseState.Y, mouseClick))
                            {
                                animation.GetKeyFrame(i).duration--;
                                if (animation.GetKeyFrame(i).duration <= 0)
                                {
                                    for (int j = i; j <
                                         animation.getKeyFrameArray().Length
                                         - 1; j++)
                                    {
                                        KeyFrame keyframe = animation.GetKeyFrame(j);
                                        keyframe.frameRef =
                                            animation.GetKeyFrame(j + 1).frameRef;
                                        keyframe.duration =
                                            animation.GetKeyFrame(j + 1).duration;
                                    }
                                    animation.GetKeyFrame(
                                        animation.getKeyFrameArray().Length - 1).frameRef
                                        = -1;
                                }
                            }
                            text.DrawText(125, y,
                                          animation.GetKeyFrame(i).duration.ToString());

                            if (text.DrawClickText(140, y, "+", mouseState.X,
                                                   mouseState.Y, mouseClick))
                            {
                                animation.GetKeyFrame(i).duration++;
                            }
                        }
                    }
                }
                if (drawButton(170, 250, 1, (mouseState.LeftButton == ButtonState.Pressed)) && keyFrameScroll > 0)
                {
                    keyFrameScroll--;
                }
                if (drawButton(170, 410, 2, (mouseState.LeftButton == ButtonState.Pressed)) && keyFrameScroll <
                    charDef.GetAnimation(selAnim).getKeyFrameArray().Length - 13)
                {
                    keyFrameScroll++;
                }
                #endregion

                #region Icon Palette
                spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
                for (int l = 0; l < 4; l++)
                {
                    Texture2D texture = null;
                    switch (l)
                    {
                    case 0:
                        texture = headTex[charDef.headIdx];
                        break;

                    case 1:
                        texture = torsoTex[charDef.torsoIdx];
                        break;

                    case 2:
                        texture = legsTex[charDef.legsIdx];
                        break;

                    case 3:
                        texture = weaponTex[charDef.weaponIdx];
                        break;
                    }
                    if (texture != null)
                    {
                        for (int i = 0; i < 25; i++)
                        {
                            Rectangle sRect = new Rectangle((i % 5) * 64,
                                                            (i / 5) * 64, 64, 64);
                            Rectangle dRect = new Rectangle(i * 23, 467
                                                            + l * 32, 23, 32);
                            spriteBatch.Draw(nullTex, dRect, new Color(new Vector4(0f, 0f, 0f, 0.1f)));
                            if (l == 3)
                            {
                                sRect.X     = (i % 4) * 80;
                                sRect.Y     = (i / 4) * 64;
                                sRect.Width = 80;

                                if (i < 15)
                                {
                                    dRect.X     = i * 30;
                                    dRect.Width = 30;
                                }
                            }
                            spriteBatch.Draw(texture, dRect,
                                             sRect, Color.White);

                            if (dRect.Contains(mouseState.X, mouseState.Y))
                            {
                                if (mouseClick)
                                {
                                    if (l < 3 || i < 15)
                                    {
                                        charDef.GetFrame(selFrame).GetPart(selPart).idx
                                            = i + 64 * l;
                                    }
                                }
                            }
                        }
                    }
                }
                spriteBatch.End();
                #endregion


                DrawCursor();
            }

            mouseClick = false;

            base.Draw(gameTime);
        }
Exemple #2
0
        protected override void Draw(GameTime gameTime)
        {
            _graphics.GraphicsDevice.Clear(Color.CornflowerBlue);

            _spriteBatch.Begin();
            _spriteBatch.Draw(_nullTex, new Rectangle(300, 450, 200, 5), new Color(new Vector4(1.0f, 0.0f, 0.0f, 0.5f)));
            _spriteBatch.Draw(_nullTex, new Rectangle(0, 0, 200, 450), new Color(new Vector4(0.0f, 0.0f, 0.0f, 0.5f)));
            _spriteBatch.Draw(_nullTex, new Rectangle(590, 0, 300, 600), new Color(new Vector4(0.0f, 0.0f, 0.0f, 0.5f)));
            _spriteBatch.Draw(_nullTex, new Rectangle(200, 0, 150, 110), new Color(new Vector4(0.0f, 0.0f, 0.0f, 0.5f)));
            _spriteBatch.End();

            if (_selFrame > 0)
            {
                DrawCharacter(new Vector2(400f, 450f), 2f, FaceRight, _selFrame - 1, false, 0.2f);
            }
            if (_selFrame < _charDef.Frames.Length - 1)
            {
                DrawCharacter(new Vector2(400f, 450f), 2f, FaceRight, _selFrame + 1, false, 0.2f);
            }
            DrawCharacter(new Vector2(400f, 450f), 2f, FaceRight, _selFrame, false, 1.0f);

            DrawPalette();
            DrawPartsList();
            DrawFramesList();
            DrawAnimationList();
            DrawKeyFramesList();

            var fref = _charDef.Animations[_selAnim].KeyFrames[_curKey].FrameRef;

            if (fref < 0)
            {
                fref = 0;
            }

            DrawCharacter(new Vector2(500f, 100f), 0.5f, FaceLeft, fref, true, 1.0f);
            if (_playing)
            {
                if (_text.DrawClickText(480, 100, "stop", _mouseState.X, _mouseState.Y, _mouseClick))
                {
                    _playing = false;
                }
            }
            else
            {
                if (_text.DrawClickText(480, 100, "play", _mouseState.X, _mouseState.Y, _mouseClick))
                {
                    _playing = true;
                }
            }

            if (DrawButton(200, 5, 3, _mouseState.X, _mouseState.Y, _mouseClick))
            {
                _charDef.Write();
            }
            if (DrawButton(230, 5, 4, _mouseState.X, _mouseState.Y, _mouseClick))
            {
                _charDef.Read();
            }

            if (_editMode == EditingMode.PathName)
            {
                _text.Color = Color.Lime;

                _text.DrawText(270, 15, _charDef.Path + "*");
            }
            else
            {
                if (_text.DrawClickText(270, 15, _charDef.Path, _mouseState.X, _mouseState.Y, _mouseClick))
                {
                    _editMode = EditingMode.PathName;
                }
            }

            #region Script/Trigs/Textures Selector

            if (_auxMode == AuxScript)
            {
                _text.Color = Color.Lime;
                _text.DrawText(210, 110, "script");
            }
            else
            {
                if (_text.DrawClickText(210, 110, "script", _mouseState.X, _mouseState.Y, _mouseClick))
                {
                    _auxMode = AuxScript;
                }
            }

            if (_auxMode == AuxTrigs)
            {
                _text.Color = Color.Lime;
                _text.DrawText(260, 110, "trigs");
            }
            else
            {
                if (_text.DrawClickText(260, 110, "trigs", _mouseState.X, _mouseState.Y, _mouseClick))
                {
                    _auxMode = AuxTrigs;
                }
            }

            if (_auxMode == AuxTextures)
            {
                _text.Color = Color.Lime;
                _text.DrawText(300, 110, "tex");
            }
            else
            {
                if (_text.DrawClickText(300, 110, "tex", _mouseState.X, _mouseState.Y, _mouseClick))
                {
                    _auxMode = AuxTextures;
                }
            }

            #endregion

            #region Script

            if (_auxMode == AuxScript)
            {
                for (var i = 0; i < 4; i++)
                {
                    var scriptLineDescription = i + ": " +
                                                _charDef.Animations[_selAnim].KeyFrames[_selKeyFrame].Scripts[i];
                    const int scriptLineX = 210;
                    var       scriptLineY = 42 + i * 16;

                    if (_editMode == EditingMode.Script && _selScriptLine == i)
                    {
                        _text.Color = Color.Lime;
                        _text.DrawText(scriptLineX, scriptLineY, scriptLineDescription + "*");
                    }
                    else if (_text.DrawClickText(scriptLineX, scriptLineY, scriptLineDescription, _mouseState.X,
                                                 _mouseState.Y, _mouseClick))
                    {
                        _selScriptLine = i;
                        _editMode      = EditingMode.Script;
                    }
                }
            }

            #endregion

            #region Trigs

            if (_auxMode == AuxTrigs)
            {
                if (DrawButton(330, 42, 1, _mouseState.X, _mouseState.Y, _mouseClick))
                {
                    if (_trigScroll > 0)
                    {
                        _trigScroll--;
                    }
                }
                if (DrawButton(330, 92, 2, _mouseState.X, _mouseState.Y, _mouseClick))
                {
                    if (_trigScroll < 100)
                    {
                        _trigScroll++;
                    }
                }
                for (var i = 0; i < 4; i++)
                {
                    var t = i + _trigScroll;
                    if (_text.DrawClickText(210, 42 + i * 16, GetTrigName(t), _mouseState.X, _mouseState.Y, _mouseClick))
                    {
                        _charDef.Frames[_selFrame].Parts[_selPart].Index = t + 1000;
                    }
                }
            }

            #endregion

            #region Texture Switching

            if (_auxMode == AuxTextures)
            {
                for (var i = 0; i < 4; i++)
                {
                    if (DrawButton(210 + i * 21, 40, 1, _mouseState.X, _mouseState.Y, _mouseClick, 0.45f))
                    {
                        switch (i)
                        {
                        case 0:
                            if (_charDef.HeadIndex > 0)
                            {
                                _charDef.HeadIndex--;
                            }
                            break;

                        case 1:
                            if (_charDef.TorsoIndex > 0)
                            {
                                _charDef.TorsoIndex--;
                            }
                            break;

                        case 2:
                            if (_charDef.LegsIndex > 0)
                            {
                                _charDef.LegsIndex--;
                            }
                            break;

                        case 3:
                            if (_charDef.WeaponIndex > 0)
                            {
                                _charDef.WeaponIndex--;
                            }
                            break;
                        }
                    }
                    var t = _charDef.HeadIndex.ToString(CultureInfo.InvariantCulture);
                    switch (i)
                    {
                    case 1:
                        t = _charDef.TorsoIndex.ToString(CultureInfo.InvariantCulture);
                        break;

                    case 2:
                        t = _charDef.LegsIndex.ToString(CultureInfo.InvariantCulture);
                        break;

                    case 3:
                        t = _charDef.WeaponIndex.ToString(CultureInfo.InvariantCulture);
                        break;
                    }
                    _text.Color = Color.White;
                    _text.DrawText(212 + i * 21, 60, t);
                    if (DrawButton(210 + i * 21, 85, 2, _mouseState.X, _mouseState.Y, _mouseClick, 0.45f))
                    {
                        switch (i)
                        {
                        case 0:
                            if (_charDef.HeadIndex < _headTex.Length - 1)
                            {
                                _charDef.HeadIndex++;
                            }
                            break;

                        case 1:
                            if (_charDef.TorsoIndex < _torsoTex.Length - 1)
                            {
                                _charDef.TorsoIndex++;
                            }
                            break;

                        case 2:
                            if (_charDef.LegsIndex < _legsTex.Length - 1)
                            {
                                _charDef.LegsIndex++;
                            }
                            break;

                        case 3:
                            if (_charDef.WeaponIndex < _weaponTex.Length - 1)
                            {
                                _charDef.WeaponIndex++;
                            }
                            break;
                        }
                    }
                }
            }

            #endregion

            DrawCursor();

            _mouseClick = false;

            base.Draw(gameTime);
        }