예제 #1
0
파일: Tile.cs 프로젝트: Devwarlt/loe-core
 public Tile(int x, int y, int id)
 {
     X              = x;
     Y              = y;
     TileId         = id;
     TileProperties = XmlLibrary.TilesXml[TileId];
     Texture        = XmlLibrary.GetSpriteFromContent(TileProperties);
 }
예제 #2
0
파일: Player.cs 프로젝트: Devwarlt/loe-core
 public override void Init()
 {
     if (Content != null)
     {
         Animation.UpdateOrAdd(Content);
         Texture = XmlLibrary.GetSpriteFromContent(Content, 0, 1);
     }
 }
예제 #3
0
        private void AddCharacterView()
        {
            RemoveChild(CharacterView);

            CharacterView = new Sprite(50, 15, 150, 150, XmlLibrary.GetSpriteFromContent(Content, 0, 1));
            CharacterView.IsEventApplicable = false;

            AddChild(CharacterView);
        }
예제 #4
0
            public CharacterView(int x, int y, int id)
                : base(x, y, 150, 200, AssetLibrary.Images["characterDisplayRect"])
            {
                var content = XmlLibrary.ObjectsXml[id];

                CharacterSprite = new Sprite(0, 25, 150, 150, XmlLibrary.GetSpriteFromContent(content, 0, 1));

                AddChild(CharacterSprite);
            }
예제 #5
0
        public void LoadPlayerSprite(GamePlayer player)
        {
            if (!Contains(PlayerSprite))
            {
                PlayerSprite = new CharacterView(130, -215, player.Player.Id);

                AddChild(PlayerSprite);
                return;
            }

            PlayerSprite.CharacterSprite.SpriteTexture = XmlLibrary.GetSpriteFromContent(player.Player.Content, 0, 1);
        }
예제 #6
0
        public ItemCell(int id, int itemidx, int x, int y)
            : base(x, y, 50, 50, AssetLibrary.Images["itemDisplayRect"])
        {
            Id        = id;
            ItemIndex = itemidx;
            if (Id != -1)
            {
                XmlContent = XmlLibrary.ItemsXml[Id];
            }

            ItemSprite = new Sprite(10, 10, 30, 30, (XmlContent == null) ? null : XmlLibrary.GetSpriteFromContent(XmlContent));

            //DescriptionBox = new DescriptionPanel(DrawHelper.CenteredToScreenWidth(300), DrawHelper.CenteredToScreenHeight(400), XmlContent.Name);
            //DescriptionBox.IsZeroApplicaple = true;

            ActiveDescription = new ActiveDescriptionBox(0, 0);
            ActiveDescription.Reload((XmlContent == null) ? null : XmlContent);
            ActiveDescription.Visible           = false;
            ActiveDescription.IsZeroApplicaple  = true;
            ActiveDescription.IsEventApplicable = false;

            AddChild(ItemSprite);

            AddEventListener(Event.MOUSEOVER, delegate
            {
                SpriteColor = Color.Yellow;
                Selected    = true;

                if (!Dragging && Id != -1)
                {
                    if (!ParentSprite.Contains(ActiveDescription))
                    {
                        ParentSprite.AddChild(ActiveDescription);
                    }

                    ActiveDescription.Visible = true;
                    ActiveDescription.X       = EventsHandler.MouseRectangle.X;
                    ActiveDescription.Y       = EventsHandler.MouseRectangle.Y;
                }
            });

            AddEventListener(Event.MOUSEOUT, delegate
            {
                SpriteColor = Color.Gray;

                Selected = false;
                ActiveDescription.Visible = false;
            });
        }
예제 #7
0
        public void Reload(int id)
        {
            Id         = id;
            XmlContent = XmlLibrary.ItemsXml[Id];

            if (Contains(ItemSprite))
            {
                RemoveChild(ItemSprite);
                ItemSprite.SpriteTexture = XmlLibrary.GetSpriteFromContent(XmlContent);
                AddChild(ItemSprite);
            }
            else
            {
                ItemSprite = new Sprite(5, 5, 30, 30, XmlLibrary.GetSpriteFromContent(XmlContent));
                AddChild(ItemSprite);
            }

            ActiveDescription.Reload(XmlContent);
        }
예제 #8
0
        public void Init(CharacterRect parent)
        {
            _parent = parent;

            int spriteX = 10;

            _meleeClass   = new Sprite(spriteX, 10, 120, 120, XmlLibrary.GetSpriteFromContent(XmlLibrary.ObjectsXml[5], 0, 1));
            spriteX      += 130;
            _rangeClass   = new Sprite(spriteX, 10, 120, 120, XmlLibrary.GetSpriteFromContent(XmlLibrary.ObjectsXml[6], 0, 1));
            spriteX      += 130;
            _defenseClass = new Sprite(spriteX, 10, 120, 120, XmlLibrary.GetSpriteFromContent(XmlLibrary.ObjectsXml[7], 0, 1));

            _meleeClass.AddEventListener(Event.CLICKLEFT, delegate
            {
                CreateCharacter(5);
                ParentSprite.RemoveChild(this);
            });
            _meleeClass.AddEventListener(Event.MOUSEOUT, delegate { _meleeClass.SpriteColor = Color.White; });
            _meleeClass.AddEventListener(Event.MOUSEOVER, delegate { _meleeClass.SpriteColor = Color.DarkSlateGray; });

            _rangeClass.AddEventListener(Event.CLICKLEFT, delegate
            {
                CreateCharacter(6);
                ParentSprite.RemoveChild(this);
            });
            _rangeClass.AddEventListener(Event.MOUSEOUT, delegate { _rangeClass.SpriteColor = Color.White; });
            _rangeClass.AddEventListener(Event.MOUSEOVER, delegate { _rangeClass.SpriteColor = Color.DarkSlateGray; });

            _defenseClass.AddEventListener(Event.CLICKLEFT, delegate
            {
                CreateCharacter(7);
                ParentSprite.RemoveChild(this);
            });
            _defenseClass.AddEventListener(Event.MOUSEOUT, delegate { _defenseClass.SpriteColor = Color.White; });
            _defenseClass.AddEventListener(Event.MOUSEOVER, delegate { _defenseClass.SpriteColor = Color.DarkSlateGray; });

            AddChild(_mask);
            AddChild(_meleeClass);
            AddChild(_rangeClass);
            AddChild(_defenseClass);
        }
예제 #9
0
 public virtual void Init()
 {
     Texture = XmlLibrary.GetSpriteFromContent(Content);
 }