Beispiel #1
0
 public override void Update(GameTime gameTime)
 {
     if (!IsJoin)
     {
         joinButton.Update(gameTime);
         for (int i = 0; i < box.Count; i++)
         {
             if (MouseManager.IsInRectangle(box[i].Bound) && MouseManager.IsClicking())
             {
                 box[boxselect].IsSelect = false;
                 boxselect       = i;
                 box[i].IsSelect = true;
             }
         }
         box[boxselect].Write(KeyboardManager.RecupClavier());
         if (KeyboardManager.IsPressed(Keys.Back))
         {
             box[boxselect].RemoveLast();
         }
     }
     else
     {
         box[3].RemoveAll();
         for (int i = 0; i < client.OtherPlayers.Count; i++)
         {
             box[3].WriteLine(client.OtherPlayers[i].name + "");
         }
     }
 }
Beispiel #2
0
 public virtual void Update(GameTime gameTime)
 {
     if (MouseManager.IsInRectangle(Bounds) && MouseManager.IsLeftClicked())
     {
         OnMouseClick(new MouseClickEventArgs(0, MouseManager.Position));
     }
 }
Beispiel #3
0
 public override void Draw(GameTime gameTime, UberSpriteBatch spriteBatch)
 {
     if (texture == null)
     {
         spriteBatch.DrawUI(MouseManager.IsInRectangle(Bounds) ? TexturesManager.Zoom : TexturesManager.Menu, text, Position, MouseManager.IsInRectangle(Bounds) ? Color.Red : Color.White);
     }
     else
     {
         spriteBatch.DrawUI(texture, Position, MouseManager.IsInRectangle(Bounds) ? Color.Gray : Color.White);
     }
 }
Beispiel #4
0
 public virtual void Update(GameTime gameTime)
 {
     if (MouseManager.IsInRectangle(Bounds) && MouseManager.IsLeftClicked())
     {
         OnMouseClick(new MouseClickEventArgs(0, MouseManager.Position));
     }
     if (MouseManager.IsClicking() && MouseManager.Position.Y <= Bounds.Bottom && MouseManager.Position.Y >= Bounds.Y)
     {
         OnSlideAxeX(new MouseClickEventArgs(0, MouseManager.Position));
     }
 }
Beispiel #5
0
        public override void Update(GameTime gameTime)
        {
            if (MouseManager.IsInRectangle(Bounds) && MouseManager.IsClicking())
            {
                isMoving = true;
            }
            if (!MouseManager.IsClicking())
            {
                isMoving = false;
            }

            if (isMoving)
            {
                Position = MoveWindow(Position);
            }

            Bounds = new Rectangle((int)Position.X, (int)Position.Y, texture.Width, texture.Height);
        }
Beispiel #6
0
 public override void Draw(GameTime gameTime, UberSpriteBatch spriteBatch)
 {
     if (texture == null)
     {
         spriteBatch.DrawUI(MouseManager.IsInRectangle(Bounds) && !MouseManager.IsClicking() ? TexturesManager.Zoom : TexturesManager.Menu,
                            text, Position, MouseManager.IsInRectangle(Bounds) ? Color.Red : Color.White);
     }
     else if (SlideSize == 0)
     {
         spriteBatch.DrawUI(texture, Position, MouseManager.IsInRectangle(Bounds) ? Color.Gray : Color.White);
     }
     else
     {
         spriteBatch.DrawUI(TexturesManager.SlideBar,
                            new Rectangle((int)BoundLeft, (int)Position.Y,
                                          SlideSize + TexturesManager.MovingCursor.Width - 1,
                                          TexturesManager.MovingCursor.Height));
         spriteBatch.DrawUI(texture, Position, MouseManager.IsInRectangle(Bounds) ? Color.Gray : Color.White);
     }
 }
Beispiel #7
0
        public override void Update(GameTime gameTime)
        {
            if (isCreate)
            {
                StartButton.Update(gameTime);
                box[2].RemoveAll();
                for (int i = 0; i < localClient.OtherPlayers.Count; i++)
                {
                    box[2].WriteLine(localClient.OtherPlayers[i].name + "");
                }
                if (gameTime.TotalGameTime.TotalMilliseconds % 500 < 10)
                {
                    serveur.SendToAll();
                }

                //box[2].WriteLine(Convert.ToString(serveur.Clients.Count));
            }
            else
            {
                createButton.Update(gameTime);
                for (int i = 0; i < box.Count; i++)
                {
                    if (MouseManager.IsInRectangle(box[i].Bound) && MouseManager.IsClicking())
                    {
                        box[boxselect].IsSelect = false;
                        boxselect       = i;
                        box[i].IsSelect = true;
                    }
                }
                box[boxselect].Write(KeyboardManager.RecupClavier());
                if (KeyboardManager.IsPressed(Keys.Back))
                {
                    box[boxselect].RemoveLast();
                }
            }
        }
Beispiel #8
0
        public override void DrawUI(GameTime gameTime, UberSpriteBatch spriteBatch)
        {
            Vector2 position = new Vector2(MainGame.ScreenX / 2 - TexturesManager.PowerBar.Width / 2,
                                           MainGame.ScreenY - TexturesManager.PowerBar.Height) - new Vector2(0, TexturesManager.Xp.Height);

            // Draw la barre de Vie
            int     size = (int)Life * LifeBarSize / Stats.LifeMax;
            Vector2 pos  = new Vector2(position.X, position.Y - TexturesManager.Life.Height);

            for (int i = 0; i < size; i++)
            {
                spriteBatch.DrawUI(TexturesManager.Life, pos + new Vector2(i, 0), Color.White);
            }
            for (int i = size; i < LifeBarSize; i++)
            {
                spriteBatch.DrawUI(TexturesManager.Life, pos + new Vector2(i, 0), Color.Gray);
            }
            Rectangle bounds = new Rectangle((int)pos.X, (int)pos.Y, LifeBarSize, TexturesManager.Life.Height);

            if (MouseManager.IsInRectangle(bounds))
            {
                spriteBatch.DrawUI(TexturesManager.Level, Resources.Res.Life + " : " + (int)Life, pos - new Vector2(0, TexturesManager.Level.MeasureString(Resources.Res.Life + " : " + Life).Y), Color.Red);
            }

            // Draw la barre de Power
            size = (int)Power * PowerBarSize / Stats.PowerMax;
            pos  = new Vector2(position.X + PowerBarSize, position.Y - TexturesManager.Power.Height);
            for (int i = 0; i < size; i++)
            {
                spriteBatch.DrawUI(TexturesManager.Power, pos + new Vector2(i, 0), Color.White);
            }
            for (int i = size; i < PowerBarSize; i++)
            {
                spriteBatch.DrawUI(TexturesManager.Power, pos + new Vector2(i, 0), Color.Gray);
            }
            bounds = new Rectangle((int)pos.X, (int)pos.Y, PowerBarSize, TexturesManager.Power.Height);
            if (MouseManager.IsInRectangle(bounds))
            {
                spriteBatch.DrawUI(TexturesManager.Level, Resources.Res.Power + " : " + (int)Power, pos - new Vector2(0, TexturesManager.Level.MeasureString(Resources.Res.Power + " : " + Power).Y), Color.MediumPurple);
            }


            // Draw la barre d'Xp
            size = experience * XpBarSize / ExperienceNeeded;
            for (int i = 0; i < size; i++)
            {
                spriteBatch.DrawUI(TexturesManager.Xp, new Vector2(position.X + i, position.Y + TexturesManager.PowerBar.Height), Color.White);
            }
            for (int i = size; i < XpBarSize; i++)
            {
                spriteBatch.DrawUI(TexturesManager.Xp, new Vector2(position.X + i, position.Y + TexturesManager.PowerBar.Height), (i % 60 == 0 && i != 0) ? Color.Black : Color.Gray);
            }

            // Draw la barre de Sort
            spriteBatch.DrawUI(TexturesManager.PowerBar, position, Color.White);
            position += new Vector2(5, 5);
            Vector2 delta = new Vector2(TexturesManager.PowerBar.Width / 10.0f, 0);

            foreach (Spell spell in spells)
            {
                if (!spell.IsActivated || gameTime.TotalGameTime.TotalMilliseconds % 1000 < 500) // Draw si non actif || Draw pendant 500 ms si actif sur 1000 ms
                {
                    spriteBatch.DrawUI(spell.Icon, position, spell.IsReady() ? Color.White : Color.Gray);
                }

                position += delta;
            }
        }
Beispiel #9
0
        public override void Update(GameTime gameTime)
        {
            if (CanMove)
            {
                base.Update(gameTime);
                InternalMove(gameTime);
            }

            coord = new Vector2((int)Math.Ceiling(Position.X * 32 / 1000) - 1, (int)Math.Ceiling(Position.Y * 32 / 1000) - 1);

            // Pour le lancement de spells
            for (int i = 0; i < spells.Count; i++)
            {
                if (!KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Spell1 + i]) && !(MouseManager.IsInRectangle(spellsRect[i]) && MouseManager.IsLeftClicked()))
                {
                    continue;
                }

                if (spells[i].Type == SpellType.Buff)
                {
                    if (spells[i].IsActivated)
                    {
                        spells[i].Unbuff();
                    }
                    else
                    {
                        spells[i].Buff();
                    }
                }
                else
                {
                    spells[i].Cast();
                }
            }

            // Change de cible
            if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Target]) || MouseManager.IsLeftClicked())
            {
                if (Target != null)
                {
                    Target.Targeter = null;
                }

                if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Target]))
                {
                    IList <Monster> monsters = Game.Entities.OfType <Monster>().ToList();
                    ++targetIndex;
                    if (targetIndex >= monsters.Count)
                    {
                        targetIndex = (monsters.Count > 0 ? 0 : -1);
                    }
                    Target = targetIndex >= 0 ? monsters[targetIndex] : null;
                }
                else
                {
                    foreach (Monster monster in Game.Entities.OfType <Monster>())
                    {
                        if (MouseManager.IsInRectangle(GameScreen.Camera.ScreenLocation(MouseManager.Position), monster.Bounds))
                        {
                            Target = monster;
                        }
                    }
                }

                if (Target != null)
                {
                    Target.Targeter = this;
                }
            }

            // Deselectionne une cible
            if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Escape]))
            {
                if (Target != null)
                {
                    Target.Targeter = null;
                }
                Target = null;
            }

            // Insérer tout le cheat
            if (Keyboard.GetState().IsKeyDown(Keys.D0))
            {
                Power = Stats.PowerMax;
            }

            // Update tout les spells
            foreach (Spell spell in spells)
            {
                spell.Update(gameTime);
            }

            Regeneration(gameTime);
        }
Beispiel #10
0
        public override void Update(GameTime gameTime)
        {
            if (CanMove)
            {
                Vector2 oldPos = Position;
                base.Update(gameTime);
                InternalMove(gameTime);
                if (MouseManager.IsRightClicked()) //Deplacement a la souris
                {
                    pos = GameScreen.camera.Location(MouseManager.Position);
                }
                if (pos.X > 0 && pos.Y > 0)
                {
                    new Maps.Path.Ia(gameTime, pos, this, this.Game.MapFirst.Data);
                }
                if (oldPos == Position)
                {
                    Step = 1;
                }
            }

            coord = new Vector2((int)Math.Ceiling(Position.X * 32 / 1000) - 1, (int)Math.Ceiling(Position.Y * 32 / 1000) - 1);

            Keys[] keys = new[] { Keys.Q, Keys.A, Keys.E, Keys.R, Keys.D2 };

            for (int i = 0; i < spells.Count; i++)
            {
                if (keys.Length < i)
                {
                    break;
                }
                if (!KeyboardManager.IsPressed(keys[i]) && !(MouseManager.IsInRectangle(spellsRect[i]) && MouseManager.IsLeftClicked()))
                {
                    continue;
                }

                if (spells[i].Type == SpellType.Buff) // Si le sort est un Buff...
                {
                    if (spells[i].IsActivated)
                    {
                        spells[i].Unbuff();
                    }
                    else
                    {
                        spells[i].Buff();
                    }
                }
                else
                {
                    spells[i].Cast();
                }
            }

            if (KeyboardManager.IsPressed(Keys.Tab) || MouseManager.IsLeftClicked()) // Change de cible
            {
                if (Target != null)
                {
                    Target.Targeter = null;
                }

                if (KeyboardManager.IsPressed(Keys.Tab))
                {
                    IList <Monster> monsters = Game.Entities.OfType <Monster>().ToList();
                    ++targetIndex;
                    if (targetIndex >= monsters.Count)
                    {
                        targetIndex = (monsters.Count > 0 ? 0 : -1);
                    }
                    Target = targetIndex >= 0 ? monsters[targetIndex] : null;
                }
                else
                {
                    foreach (Monster monster in Game.Entities.OfType <Monster>())
                    {
                        if (MouseManager.IsInRectangle(monster.Bounds, GameScreen.camera))
                        {
                            Target = monster;
                        }
                    }
                }

                if (Target != null)
                {
                    Target.Targeter = this;
                }
            }

            if (KeyboardManager.IsPressed(Keys.Escape)) // Deselectionne une cible
            {
                if (Target != null)
                {
                    Target.Targeter = null;
                }
                Target = null;
            }

            // Insérer tout le cheat
            if (Keyboard.GetState().IsKeyDown(Keys.D1))
            {
                Power = Stats.PowerMax;
            }
            // Insérer tout le cheat

            foreach (Spell spell in spells) // Update tout les spells
            {
                spell.Update(gameTime);
            }

            Regeneration(gameTime);
        }