public override void Update(InputHelper Helper, GameTime GTime)
        {
            m_Counter = m_Index;

            for (int X = 0; X <= m_Map.GetUpperBound(1); X++)
            {
                for (int Y = 0; Y <= m_Map.GetUpperBound(0); Y++)
                {
                    m_BtnWidth = m_SkinBtns[m_Counter + Y].BtnTex.Width / 4;
                    Vector2 TexturePosition = new Vector2(X * (HeadTileSize.X + 10), Y * (HeadTileSize.Y));
                    Vector2 ButtonPosition = new Vector2(TexturePosition.X - 3, TexturePosition.Y - 5);

                    if (IsMouseOverButton(Helper, m_SkinBtns[Y + m_Counter], Position + ButtonPosition))
                    {
                        if (Helper.IsNewPress(MouseButtons.LeftButton))
                        {
                            if (!m_SkinBtns[Y + m_Counter].IsButtonClicked)
                            {
                                m_SkinBtns[Y + m_Counter].SourcePosition.X += m_BtnWidth;

                                if (OnButtonClicked != null)
                                {
                                    UISkinButtonClickedEventArgs EArgs = new UISkinButtonClickedEventArgs();

                                    switch (m_SelectedSkintype)
                                    {
                                        case Elements.SkinType.Light:
                                            EArgs.SkinType = 0;
                                            EArgs.SelectedOutfit = (m_Sex == AvatarSex.Male ?
                                                m_LightAppearances[(Y * X) + m_Counter].Oft :
                                                m_LightFemaleAppearances[(Y * X) + m_Counter].Oft);

                                            OnButtonClicked(this, EArgs);
                                            break;
                                        case Elements.SkinType.Medium:
                                            EArgs.SkinType = 1;
                                            EArgs.SelectedOutfit = (m_Sex == AvatarSex.Male ?
                                                m_MediumAppearances[(Y * X) + m_Counter].Oft :
                                                m_MediumFemaleAppearances[(Y * X) + m_Counter].Oft);
                                            OnButtonClicked(this, EArgs);
                                            break;
                                        case Elements.SkinType.Dark:
                                            EArgs.SkinType = 2;
                                            EArgs.SelectedOutfit = (m_Sex == AvatarSex.Male ?
                                                m_DarkAppearances[(Y * X) + m_Counter].Oft :
                                                m_DarkFemaleAppearances[(Y * X) + m_Counter].Oft);

                                            OnButtonClicked(this, EArgs);
                                            break;
                                    }
                                }

                                m_SkinBtns[Y + m_Counter].IsButtonClicked = true;
                            }
                        }
                        else
                        {
                            if (m_SkinBtns[Y + m_Counter].IsButtonClicked)
                                m_SkinBtns[Y + m_Counter].SourcePosition.X -= m_BtnWidth;

                            m_SkinBtns[Y + m_Counter].IsButtonClicked = false;
                        }

                        if (!m_SkinBtns[Y + m_Counter].IsMouseHovering)
                        {
                            m_SkinBtns[Y + m_Counter].SourcePosition.X -= m_BtnWidth;
                            m_SkinBtns[Y + m_Counter].IsMouseHovering = true;
                        }
                    }
                    else
                    {
                        m_SkinBtns[Y + m_Counter].SourcePosition.X = (m_BtnWidth * 2);
                        m_SkinBtns[Y + m_Counter].IsMouseHovering = false;
                    }

                    if (m_Counter < m_NumberOfSkinsToDisplay)
                        m_Counter++;
                }
            }

            if (Index == 0)
                m_SkinBrowserArrowRight.Enabled = false;
            else
                m_SkinBrowserArrowRight.Enabled = true;

            base.Update(Helper, GTime);
        }
        public override void Update(InputHelper Helper, GameTime GTime)
        {
            m_Counter = m_Index;

            for (int X = 0; X <= m_Map.GetUpperBound(1); X++)
            {
                for (int Y = 0; Y <= m_Map.GetUpperBound(0); Y++)
                {
                    m_BtnWidth = m_SkinBtns[Y + m_Counter].BtnTex.Width / 4;
                    Vector2 TexturePosition = new Vector2(X * (BodyTileSize.X + 16), Y * (BodyTileSize.Y));
                    Vector2 ButtonPosition  = new Vector2(TexturePosition.X - 3, TexturePosition.Y - 5);

                    if (IsMouseOverButton(Helper, m_SkinBtns[Y + m_Counter], Position + ButtonPosition))
                    {
                        if (Helper.IsNewPress(MouseButtons.LeftButton))
                        {
                            if (!m_SkinBtns[Y + m_Counter].IsButtonClicked)
                            {
                                m_SkinBtns[Y + m_Counter].SourcePosition.X += m_BtnWidth;

                                if (OnButtonClicked != null)
                                {
                                    UISkinButtonClickedEventArgs EArgs = new UISkinButtonClickedEventArgs();

                                    switch (m_SelectedSkintype)
                                    {
                                    case Elements.SkinType.Light:
                                        EArgs.SkinType       = 0;
                                        EArgs.SelectedOutfit = (m_Sex == AvatarSex.Male ?
                                                                m_LightAppearances[(Y * X) + m_Counter].Oft :
                                                                m_LightFemaleAppearances[(Y * X) + m_Counter].Oft);

                                        OnButtonClicked(this, EArgs);
                                        break;

                                    case Elements.SkinType.Medium:
                                        EArgs                = new UISkinButtonClickedEventArgs();
                                        EArgs.SkinType       = 1;
                                        EArgs.SelectedOutfit = (m_Sex == AvatarSex.Male ?
                                                                m_MediumAppearances[(X * Y) + m_Counter].Oft :
                                                                m_MediumFemaleAppearances[(Y * X) + m_Counter].Oft);

                                        OnButtonClicked(this, EArgs);
                                        break;

                                    case Elements.SkinType.Dark:
                                        EArgs                = new UISkinButtonClickedEventArgs();
                                        EArgs.SkinType       = 2;
                                        EArgs.SelectedOutfit = (m_Sex == AvatarSex.Male ?
                                                                m_DarkAppearances[(X * Y) + m_Counter].Oft :
                                                                m_DarkFemaleAppearances[(Y * X) + m_Counter].Oft);

                                        OnButtonClicked(this, EArgs);
                                        break;
                                    }
                                }

                                m_SkinBtns[Y + m_Counter].IsButtonClicked = true;
                            }
                        }
                        else
                        {
                            if (m_SkinBtns[Y + m_Counter].IsButtonClicked)
                            {
                                m_SkinBtns[Y + m_Counter].SourcePosition.X -= m_BtnWidth;
                            }

                            m_SkinBtns[Y + m_Counter].IsButtonClicked = false;
                        }

                        if (!m_SkinBtns[Y + m_Counter].IsMouseHovering)
                        {
                            m_SkinBtns[Y + m_Counter].SourcePosition.X -= m_BtnWidth;
                            m_SkinBtns[Y + m_Counter].IsMouseHovering   = true;
                        }
                    }
                    else
                    {
                        m_SkinBtns[Y + m_Counter].SourcePosition.X = (m_BtnWidth * 2);
                        m_SkinBtns[Y + m_Counter].IsMouseHovering  = false;
                    }

                    if (m_Counter < m_NumberOfSkinsToDisplay)
                    {
                        m_Counter++;
                    }
                }
            }

            if (Index == 0)
            {
                m_SkinBrowserArrowRight.Enabled = false;
            }
            else
            {
                m_SkinBrowserArrowRight.Enabled = true;
            }

            base.Update(Helper, GTime);
        }
Example #3
0
 private void M_HeadSkinBrowser_OnButtonClicked(object Sender, UISkinButtonClickedEventArgs EArgs)
 {
     m_Avatar.ChangeOutfit(EArgs.SelectedOutfit, (Vitaboy.SkinType)EArgs.SkinType);
 }