public Personnage(int pointsDeVieMaximum, int force, int agilite, string nom,
                   Peuple peuple, int chance, Class classPersonnage, int vitalite, int intelligence, Alignement alignement)
 {
     this.pointsDeVie        = pointsDeVieMaximum;
     this.pointsDeVieMaximum = pointsDeVieMaximum;
     this.force           = force;
     this.agilite         = agilite;
     this.peuple          = peuple;
     this.nom             = nom;
     this.chance          = chance;
     this.classPersonnage = classPersonnage;
     this.vitalite        = vitalite;
     this.intelligence    = intelligence;
     this.alignement      = alignement;
 }
        public Personnage(string nom)
        {
            Random r = new Random();

            this.pointsDeVie        = pointsDeVieMaximum;
            this.pointsDeVieMaximum = r.Next(6, 15);
            this.force           = r.Next(6, 15);
            this.agilite         = r.Next(6, 15);
            this.peuple          = (Peuple)r.Next(0, 7);
            this.nom             = nom;
            this.chance          = r.Next(6, 15);
            this.classPersonnage = (Class)r.Next(0, 3);
            this.vitalite        = r.Next(6, 15);
            this.intelligence    = r.Next(6, 15);
            this.alignement      = (Alignement)r.Next(0, 2);
        }
Exemple #3
0
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public void Setup(HandPick @handpick, int nbCols, int nbRows, float tilesSize, OnExitRequested onExitRequested)
    {
        UICmd.SetUniqueHandler(new UICMD[] { UICMD.MAP_ZOOM_INC, UICMD.MAP_ZOOM_DEC }, ProcessUICmd);

        UICmd.SetUniqueHandler(new UICMD[] { UICMD.SWITCH_TO_2D_MAP, UICMD.SWITCH_TO_3D_MAP }, ProcessUICmd);

        UICmd.SetUniqueHandler(UICMD.MAP_ADD_FLAG, ContentProcessUICmd);

        UICmd.SetUniqueHandler(UICMD.MAP_ADD_PIN, ContentProcessUICmd);


        m_handpick = @handpick;

        m_nbCols = nbCols > 0 ? Alignement.Align(nbCols, 2) : 2;

        m_nbRows = nbRows > 0 ? Alignement.Align(nbRows, 2) : 2;

        m_nbSlots = m_nbRows * m_nbCols;

        m_nbColsUsed = 0;

        m_nbRowsUsed = 0;

        m_nbSlotsUsed = 0;

        m_nbTiles = m_nbSlots << 1;

        m_tilesSize = tilesSize >= 1.0f ? tilesSize : 1.0f;

        m_pool = new WebMapTilePool(m_nbTiles);

        System.Array.Resize(ref m_slots, m_nbSlots);

        System.Array.Resize(ref m_slotsUsed, m_nbSlots);

        System.Array.Resize(ref m_tilesRelaxed, m_nbSlots);

        System.Array.Resize(ref m_loadSeq, m_nbSlots);

        m_onExitRequested = onExitRequested;

        CreateLayout();

        CreateContentDespotitNode();

        CreatePinSelectionHalo();
    }
Exemple #4
0
    public static Rect AlignRect(float width, float height, Rect parentRect, Alignement alignement, float xOffset, float yOffset)
    {
        Rect oRect;

            switch (alignement)
            {
                case Alignement.TOPLEFT:
                    oRect = new Rect(0f, 0f, width, height);
                    break;
                case Alignement.TOPRIGHT:
                    oRect = new Rect( parentRect.width - width, 0f, width, height);
                    break;
                case Alignement.TOPCENTER:
                    oRect = new Rect( parentRect.width * 0.5F - width * 0.5F, 0f, width, height);
                    break;
                case Alignement.CENTER:
                    oRect = new Rect( parentRect.width * 0.5F - width * 0.5F, parentRect.height * 0.5F - height * 0.5F, width, height);
                    break;
                case Alignement.RIGHT:
                    oRect = new Rect( parentRect.width - width, parentRect.height * 0.5F - height * 0.5F, width, height);
                    break;
                case Alignement.BOTTOMRIGHT:
                    oRect = new Rect( parentRect.width - width, parentRect.height - height, width, height);
                    break;
                case Alignement.BOTTOMCENTER:
                    oRect = new Rect( parentRect.width * 0.5F - width * 0.5F,  parentRect.height- height, width, height);
                    break;
                case Alignement.BOTTOMLEFT:
                    oRect = new Rect( 0f, parentRect.y + parentRect.height - height, width, height);
                    break;
                case Alignement.LEFT:
                    oRect = new Rect( 0f, parentRect.height * 0.5F - height * 0.5F, width, height);
                    break;
                default:
                    oRect = new Rect( 0f, 0f, width, height );
                    break;
            }

            oRect.x += parentRect.x + xOffset;
            oRect.y += parentRect.y + yOffset;
            return oRect;
    }
        public void Update(GameRolePlayCharacterInformations msg)
        {
            if (msg == null)
            {
                throw new ArgumentNullException("msg");
            }
            Position = new ObjectPosition(Map, Map.Cells[msg.disposition.cellId], (DirectionsEnum)msg.disposition.direction);
            Update(msg.humanoidInfo);

            Name = msg.name;
            Look = msg.look;
            if (Alignement == null)
            {
                Alignement = new AlignmentInformations(msg.alignmentInfos);
            }
            else
            {
                Alignement.Update(msg.alignmentInfos);
            }
        }
        public void Update(GameRolePlayCharacterInformations msg)
        {
            if (msg == null)
            {
                throw new ArgumentNullException("msg");
            }
            Update(msg.disposition);
            Update(msg.humanoidInfo);

            Name = msg.name;
            Look = msg.look;
            if (Alignement == null)
            {
                Alignement = new AlignmentInformations(msg.alignmentInfos);
            }
            else
            {
                Alignement.Update(msg.alignmentInfos);
            }
        }
Exemple #7
0
        public static void DrawString(this SpriteBatch spriteBatch, SpriteFont font, string text, Rectangle boundary, Alignement alignement, TextStyle style, Color color, float scale = 1f)
        {
            Vector2 textSize = font.MeasureString(text) * scale;
            Vector2 pos      = boundary.Center.ToVector2();
            Vector2 origin   = textSize / 2;

            if (alignement.HasFlag(Alignement.Left))
            {
                origin.X += boundary.Width / 2f - textSize.X / 2;
            }

            if (alignement.HasFlag(Alignement.Right))
            {
                origin.X -= boundary.Width / 2f - textSize.X / 2;
            }

            if (alignement.HasFlag(Alignement.Top))
            {
                origin.Y += boundary.Height / 2f - textSize.Y / 2;
            }

            if (alignement.HasFlag(Alignement.Bottom))
            {
                origin.Y -= boundary.Height / 2f - textSize.Y / 2;
            }

            switch (style)
            {
            case TextStyle.Bold:
                spriteBatch.DrawString(font, text, new Vector2(pos.X + 1, pos.Y + 1), color, 0, origin, 1,
                                       SpriteEffects.None, 0);
                break;

            case TextStyle.DropShadow:
                spriteBatch.DrawString(font, text, pos - origin + new Vector2(2 * Rise.Ui.ScaleFactor),
                                       new Color(0, 0, 0, (int)(100f * ((float)color.A / 255f))), 0, Vector2.Zero, scale,
                                       SpriteEffects.None, 0);
                break;

            case TextStyle.Rectangle:
                spriteBatch.FillRectangle(
                    new Rectangle((pos - origin - new Vector2(4)).ToPoint(),
                                  new Point((int)textSize.X, (int)textSize.Y) + new Point(8)), Color.Black);
                break;
            }

            spriteBatch.DrawString(font, text, pos - origin, color, 0f, Vector2.Zero, new Vector2(scale, scale),
                                   SpriteEffects.None, 1f);
        }
Exemple #8
0
 public static Rect AlignRect(float width, float height, Rect parentRect, Alignement alignement)
 {
     return AlignRect(width, height, parentRect, alignement, 0f, 0f);
 }
Exemple #9
0
 public static Rect AlignRect(float width, float height, Alignement alignement, float xOffset, float yOffset)
 {
     return AlignRect(width, height, new Rect(0, 0, Screen.width, Screen.height), alignement, xOffset, yOffset);
 }
Exemple #10
0
 public static Rect AlignRect(float width, float height, Alignement alignement)
 {
     return AlignRect(width, height, new Rect(0, 0, Screen.width, Screen.height), alignement, 0f, 0f);
 }
Exemple #11
0
 public TextSprite(SpriteSheet _font, Alignement align = Alignement.LEFT, int x = 0, int y = 0)
 {
     font       = _font;
     position   = new GridPosition(x, y);
     alignement = align;
 }
    //****************************************************************************************************
    //
    //****************************************************************************************************

    public WebMapTilePool(int capacity)
    {
        m_entries = new WebMapTile[Alignement.Align(capacity, 16)];

        System.Array.Resize(ref m_entries, capacity);
    }