示例#1
0
        public Image GetImage(Size size, string imagePath)
        {
            try
            {
                ImageHolder image = _imageHolder.Find(tmp => tmp.ImagePath == imagePath);

                if (image != null)
                {
                    return(image.Image);
                }

                image = new ImageHolder(size, fileManager);
                if (image.Load(_basePath, imagePath))
                {
                    _imageHolder.Add(image);
                    return(image.Image);
                }
                return(null);
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex);
                return(null);
            }
        }
示例#2
0
        public Image GetImage(int unitType)
        {
            try
            {
                ImageHolder image = _imageHolder.Find(tmp => tmp.UnitType == unitType);

                if (image != null)
                {
                    return(image.Image);
                }

                image = new ImageHolder(new Size(8, 8), fileManager);
                if (image.Load("items", unitType))
                {
                    _imageHolder.Add(image);
                    return(image.Image);
                }
                return(null);
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex);
                return(null);
            }
        }
示例#3
0
        public Image GetImage(Size size, string imagePath)
        {
            try
            {
                ImageHolder image = _imageHolder.Find(tmp => tmp.ImagePath == imagePath);

                if (image != null)
                {
                    return image.Image;
                }

                image = new ImageHolder(size, fileManager);
                if (image.Load(_basePath, imagePath))
                {
                    _imageHolder.Add(image);
                    return image.Image;
                }
                return null;
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex);
                return null;
            }
        }
示例#4
0
        public Image GetImage(int unitType)
        {
            try
            {
                ImageHolder image = _imageHolder.Find(tmp => tmp.UnitType == unitType);

                if (image != null)
                {
                    return image.Image;
                }

                image = new ImageHolder(new Size(8, 8), fileManager);
                if (image.Load("items", unitType))
                {
                    _imageHolder.Add(image);
                    return image.Image;
                }
                return null;
            }
            catch (Exception ex)
            {
                ExceptionLogger.LogException(ex);
                return null;
            }
        }