예제 #1
0
 public void AddChild(VisibleGameObject _object)
 {
     _child.Add(_object);
     _object.X    = _x + _object.OffSetX;
     _object.Y    = _y + _object.OffSetY;
     _object.Rect = new Rectangle((int)_object.X, (int)_object.Y, (int)_object.Width, (int)_object.Height);
     _nChild++;
 }
 public CharacterManager(string xmlInfo)
 {
     _xmlInfo = xmlInfo;
     try
     {
         XmlDocument doc = new XmlDocument();
         doc.Load(_xmlInfo);
         _nprototype = doc.SelectNodes(@"//Character").Count;
         _prototype  = new VisibleGameObject[_nprototype];
     }
     catch
     {
     }
 }
 public ProcessBarManager(string xmlInfo)
 {
     _xmlInfo = xmlInfo;
     try
     {
         XmlDocument _doc = new XmlDocument();
         _doc.Load(_xmlInfo);
         _nprototype = _doc.SelectNodes(@"//ProcessBar").Count;
         _prototype  = new VisibleGameObject[_nprototype];
     }
     catch
     {
     }
 }
예제 #4
0
 public BackgroundManager(string xmlInfo)
 {
     _xmlInfo = xmlInfo;
     try
     {
         XmlDocument _doc = new XmlDocument();
         _doc.Load(_xmlInfo);
         XmlNodeList _listBackground = _doc.SelectNodes(@"//Background");
         _nprototype = _listBackground.Count;
         _prototype  = new VisibleGameObject[_nprototype];
     }
     catch
     {
     }
 }
예제 #5
0
 public GameFrameManager(string xmlInfo)
 {
     _xmlInfo = xmlInfo;
     try
     {
         XmlDocument _doc = new XmlDocument();
         _doc.Load(_xmlInfo);
         XmlNodeList _listFrame = _doc.DocumentElement.SelectNodes("//Frame");
         _nprototype = _listFrame.Count;
         _prototype  = new VisibleGameObject [_nprototype];
     }
     catch
     {
     }
 }
        public MapManager(string xmlInfo)
        {
            _xmlInfo = xmlInfo;
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(_xmlInfo);
                _nprototype = doc.SelectNodes(@"//Map").Count;
                _prototype = new VisibleGameObject[_nprototype];
            }
            catch
            {

            }
        }
        public GameTitleManager(string xmlInfo)
        {
            _xmlInfo = xmlInfo;
            try
            {
                XmlDocument _doc = new XmlDocument ();
                _doc.Load (_xmlInfo);
                _nprototype = _doc.SelectNodes(@"//GameTitle").Count;
                _prototype = new VisibleGameObject[_nprototype];
            }
            catch
            {

            }
        }
        public MenuFrameManager(string xmlInfo)
        {
            _xmlInfo = xmlInfo;
            try
            {
                XmlDocument _doc = new XmlDocument();
                _doc.Load(_xmlInfo);
                XmlNodeList _menuFrame = _doc.SelectNodes(@"//MenuFrame");
                _nprototype = _menuFrame.Count;
                _prototype = new VisibleGameObject[_nprototype];
            }
            catch
            {

            }
        }
        public MapObstacleManager(string xmlInfo)
        {
            try
            {
                _xmlInfo = xmlInfo;
                XmlDocument _doc = new XmlDocument();

                _doc.Load(_xmlInfo);
                XmlNodeList _listMapObstacle = _doc.SelectNodes(@"//MapObstacle");
                _nprototype = _listMapObstacle.Count;
                _prototype  = new VisibleGameObject[_nprototype];
            }
            catch
            {
            }
        }
        public BackgroundManager(string xmlInfo)
        {
            _xmlInfo = xmlInfo;
            try
            {
                XmlDocument _doc = new XmlDocument();
                _doc.Load(_xmlInfo);
                XmlNodeList _listBackground = _doc.SelectNodes(@"//Background");
                _nprototype = _listBackground.Count;
                _prototype = new VisibleGameObject[_nprototype];
            }
            catch
            {

            }
        }
        public PortralManager(string xmlInfo)
        {
            try
            {
                _xmlInfo = xmlInfo;
                XmlDocument _doc = new XmlDocument();

                _doc.Load(_xmlInfo);
                XmlNodeList _listPortral = _doc.SelectNodes(@"//Portral");
                _nprototype = _listPortral.Count;
                _prototype  = new VisibleGameObject[_nprototype];
            }
            catch
            {
            }
        }
        public ButtonManger(string xmlInfo)
        {
            try
            {
                _xmlInfo = xmlInfo;
                XmlDocument _doc = new XmlDocument();

                _doc.Load(_xmlInfo);
                XmlNodeList _listButton = _doc.SelectNodes(@"//Button");
                _nprototype = _listButton.Count;
                _prototype  = new VisibleGameObject[_nprototype];
            }
            catch
            {
            }
        }
        public SkillManager(string xmlInfo)
        {
            try
            {
                _xmlInfo = xmlInfo;
                XmlDocument _doc = new XmlDocument();

                _doc.Load(_xmlInfo);
                XmlNodeList _listSkill = _doc.SelectNodes(@"//Skill");
                _nprototype = _listSkill.Count;
                _prototype = new VisibleGameObject[_nprototype];
            }
            catch
            {

            }
        }
        public MapObstacleManager(string xmlInfo)
        {
            try
            {
                _xmlInfo = xmlInfo;
                XmlDocument _doc = new XmlDocument();

                _doc.Load(_xmlInfo);
                XmlNodeList _listMapObstacle = _doc.SelectNodes(@"//MapObstacle");
                _nprototype = _listMapObstacle.Count;
                _prototype = new VisibleGameObject[_nprototype];
            }
            catch
            {

            }
        }
 public virtual void ChildNotify(VisibleGameObject child)
 {
 }
예제 #16
0
 public override void ChildNotify(VisibleGameObject child)
 {
     //_menuIndex = _child.IndexOf((Button)child);
 }
        public override bool InitPrototypes(ContentManager content, string fileName)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(fileName);
                XmlNodeList nodelist = doc.SelectNodes(@"//Character");
                _nprototype = nodelist.Count;
                _prototype  = new VisibleGameObject[_nprototype];
                for (int i = 0; i < nodelist.Count; ++i)
                {
                    _prototype[i]          = new PlayerCharacter();
                    _prototype[i]._nsprite = 40;
                    _prototype[i]._sprite  = new GameSprite[_prototype[i]._nsprite];

                    XmlNode      node = nodelist[i].SelectSingleNode(@"Stand");
                    GameSprite[] temp = Utility.LoadSprites(node, content);
                    for (int j = 0; j < 8; ++j)
                    {
                        _prototype[i]._sprite[j] = temp[j];
                    }

                    node = nodelist[i].SelectSingleNode(@"Move");
                    temp = Utility.LoadSprites(node, content);
                    for (int j = 8; j < 16; ++j)
                    {
                        _prototype[i]._sprite[j] = temp[j - 8];
                    }

                    node = nodelist[i].SelectSingleNode(@"Attack");
                    temp = Utility.LoadSprites(node, content);
                    for (int j = 16; j < 24; ++j)
                    {
                        _prototype[i]._sprite[j] = temp[j - 16];
                    }

                    node = nodelist[i].SelectSingleNode(@"Dying");
                    temp = Utility.LoadSprites(node, content);
                    for (int j = 24; j < 32; ++j)
                    {
                        _prototype[i]._sprite[j] = temp[j - 24];
                    }

                    node = nodelist[i].SelectSingleNode(@"Dyed");
                    temp = Utility.LoadSprites(node, content);
                    for (int j = 32; j < 40; ++j)
                    {
                        _prototype[i]._sprite[j] = temp[j - 32];
                    }

                    ((PlayerCharacter)_prototype[i]).CellToMove   = new List <Point>();
                    ((PlayerCharacter)_prototype[i]).DestPoint    = new Point();
                    ((PlayerCharacter)_prototype[i]).IsMoving     = false;
                    ((PlayerCharacter)_prototype[i]).Map          = null;
                    ((PlayerCharacter)_prototype[i]).Speed        = int.Parse(nodelist[i].SelectSingleNode(@"Speed").InnerText);
                    ((PlayerCharacter)_prototype[i]).Hp           = int.Parse(nodelist[i].SelectSingleNode(@"Hp").InnerText);
                    ((PlayerCharacter)_prototype[i]).Mp           = int.Parse(nodelist[i].SelectSingleNode(@"Mp").InnerText);
                    ((PlayerCharacter)_prototype[i]).CriticalRate = int.Parse(nodelist[i].SelectSingleNode(@"CriticalRate").InnerText);
                    ((PlayerCharacter)_prototype[i]).Attack       = int.Parse(nodelist[i].SelectSingleNode(@"Damage").InnerText);
                    ((PlayerCharacter)_prototype[i]).Defense      = int.Parse(nodelist[i].SelectSingleNode(@"Defense").InnerText);
                    ((PlayerCharacter)_prototype[i]).AttackSpeed  = int.Parse(nodelist[i].SelectSingleNode(@"AttackSpeed").InnerText);
                    ((PlayerCharacter)_prototype[i]).Range        = int.Parse(nodelist[i].SelectSingleNode(@"Range").InnerText);
                    ((PlayerCharacter)_prototype[i]).X            = 0;
                    ((PlayerCharacter)_prototype[i]).Y            = 0;
                    ((PlayerCharacter)_prototype[i]).HitFrame     = int.Parse(nodelist[i].SelectSingleNode(@"HitFrame").InnerText);
                }
                return(true);
            }
            catch
            {
                return(false);
            }
        }
 public virtual void ChildNotify(VisibleGameObject child)
 {
 }
 public void RegisterObserver(VisibleGameObject observer)
 {
     _observers.Add(observer);
 }
 public void UnregisterObserver(VisibleGameObject observer)
 {
     _observers.Remove(observer);
 }
        public override bool InitPrototypes(ContentManager content, string fileName)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(fileName);
                XmlNodeList nodelist = doc.SelectNodes(@"//Character");
                _nprototype = nodelist.Count;
                _prototype = new VisibleGameObject[_nprototype];
                for (int i = 0; i < nodelist.Count; ++i)
                {
                    _prototype[i] = new PlayerCharacter();
                    _prototype[i]._nsprite = 40;
                    _prototype[i]._sprite = new GameSprite[_prototype[i]._nsprite];

                    XmlNode node = nodelist[i].SelectSingleNode(@"Stand");
                    GameSprite[] temp = Utility.LoadSprites(node, content);
                    for (int j = 0; j < 8; ++j)
                        _prototype[i]._sprite[j] = temp[j];

                    node = nodelist[i].SelectSingleNode(@"Move");
                    temp = Utility.LoadSprites(node, content);
                    for (int j = 8; j < 16; ++j)
                        _prototype[i]._sprite[j] = temp[j - 8];

                    node = nodelist[i].SelectSingleNode(@"Attack");
                    temp = Utility.LoadSprites(node, content);
                    for (int j = 16; j < 24; ++j)
                        _prototype[i]._sprite[j] = temp[j - 16];

                    node = nodelist[i].SelectSingleNode(@"Dying");
                    temp = Utility.LoadSprites(node, content);
                    for (int j = 24; j < 32; ++j)
                        _prototype[i]._sprite[j] = temp[j - 24];

                    node = nodelist[i].SelectSingleNode(@"Dyed");
                    temp = Utility.LoadSprites(node, content);
                    for (int j = 32; j < 40; ++j)
                        _prototype[i]._sprite[j] = temp[j - 32];

                    ((PlayerCharacter)_prototype[i]).CellToMove = new List<Point>();
                    ((PlayerCharacter)_prototype[i]).DestPoint = new Point();
                    ((PlayerCharacter)_prototype[i]).IsMoving = false;
                    ((PlayerCharacter)_prototype[i]).Map = null;
                    ((PlayerCharacter)_prototype[i]).Speed = int.Parse(nodelist[i].SelectSingleNode(@"Speed").InnerText);
                    ((PlayerCharacter)_prototype[i]).Hp = int.Parse(nodelist[i].SelectSingleNode(@"Hp").InnerText);
                    ((PlayerCharacter)_prototype[i]).Mp = int.Parse(nodelist[i].SelectSingleNode(@"Mp").InnerText);
                    ((PlayerCharacter)_prototype[i]).CriticalRate = int.Parse(nodelist[i].SelectSingleNode(@"CriticalRate").InnerText);
                    ((PlayerCharacter)_prototype[i]).Attack = int.Parse(nodelist[i].SelectSingleNode(@"Damage").InnerText);
                    ((PlayerCharacter)_prototype[i]).Defense = int.Parse(nodelist[i].SelectSingleNode(@"Defense").InnerText);
                    ((PlayerCharacter)_prototype[i]).AttackSpeed = int.Parse(nodelist[i].SelectSingleNode(@"AttackSpeed").InnerText);
                    ((PlayerCharacter)_prototype[i]).Range = int.Parse(nodelist[i].SelectSingleNode(@"Range").InnerText);
                    ((PlayerCharacter)_prototype[i]).X = 0;
                    ((PlayerCharacter)_prototype[i]).Y = 0;
                    ((PlayerCharacter)_prototype[i]).HitFrame = int.Parse(nodelist[i].SelectSingleNode(@"HitFrame").InnerText);
                }
                return true;
            }
            catch
            {
                return false;
            }
        }
 public override void ChildNotify(VisibleGameObject child)
 {
     //_menuIndex = _child.IndexOf((Button)child);
 }
 public void UnregisterObserver(VisibleGameObject observer)
 {
     _observers.Remove(observer);
 }
 public void RegisterObserver(VisibleGameObject observer)
 {
     _observers.Add(observer);
 }