Пример #1
0
 private PortraitItem GetItem(int id)
 {
     PortraitItem item;
     this.portraits.TryGetValue(id, out item);
     if (item == null)
     {
         PlayerImage image = null;
         this.PlayerImages.TryGetValue(id, out image);
         if (image == null)
         {
             image = this.LoadImage(id);
             this.PlayerImages.Add(id, image);
             if (image == null)
             {
                 image = defaultImage;
             }
         }
         item = new PortraitItem();
         image.Portrait.Save(this.TempImageFileName);
         item.PortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
         image.SmallPortrait.Save(this.TempImageFileName);
         item.SmallPortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
         this.portraits.Add(id, item);
     }
     return item;
 }
Пример #2
0
        private PortraitItem GetItem(int id)
        {
            PortraitItem item;

            this.portraits.TryGetValue(id, out item);
            if (item == null)
            {
                PlayerImage image = null;
                this.PlayerImages.TryGetValue(id, out image);
                if (image == null)
                {
                    image = this.LoadImage(id);
                    this.PlayerImages.Add(id, image);
                    if (image == null)
                    {
                        image = defaultImage;
                    }
                }
                item = new PortraitItem();
                image.Portrait.Save(this.TempImageFileName);
                item.PortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
                image.SmallPortrait.Save(this.TempImageFileName);
                item.SmallPortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
                this.portraits.Add(id, item);
            }
            return(item);
        }
Пример #3
0
        internal Texture2D GetSmallPortrait(int id)
        {
            PortraitItem item = this.GetItem(id);

            if (item != null)
            {
                return(item.SmallPortraitTexture);
            }
            return(null);
        }
Пример #4
0
        internal Texture2D GetPortrait(float id)
        {
            PortraitItem item = this.GetItem(id);

            if (item != null)
            {
                return(item.PortraitTexture);
            }
            return(null);
        }
Пример #5
0
        private PortraitItem GetItem(int id)
        {
            PortraitItem item;

            this.portraits.TryGetValue(id, out item);
            if (item == null)
            {
                PlayerImage image = null;
                this.PlayerImages.TryGetValue(id, out image);
                item = new PortraitItem();
                if (image == null)
                {
                    string key = this.GetKey(id);
                    try
                    {
                        Image image2 = (Image)this.PortraitRM.GetObject(key);
                        if (image2 != null)
                        {
                            image2.Save(this.TempImageFileName);
                            item.PortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
                            image2 = (Image)this.SmallPortraitRM.GetObject(key + "s");
                            if (image2 == null)
                            {
                                return(null);
                            }
                            image2.Save(this.TempImageFileName);
                            item.SmallPortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
                            this.portraits.Add(id, item);
                            return(item);
                        }
                        return(null);
                    }
                    finally
                    {
                        File.Delete(this.TempImageFileName);
                    }
                    return(item);
                }
                image.Portrait.Save(this.TempImageFileName);
                item.PortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
                image.SmallPortrait.Save(this.TempImageFileName);
                item.SmallPortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
                this.portraits.Add(id, item);
            }
            return(item);
        }
Пример #6
0
 private PortraitItem GetItem(int id)
 {
     PortraitItem item;
     this.portraits.TryGetValue(id, out item);
     if (item == null)
     {
         PlayerImage image = null;
         this.PlayerImages.TryGetValue(id, out image);
         item = new PortraitItem();
         if (image == null)
         {
             string key = this.GetKey(id);
             try
             {
                 Image image2 = (Image) this.PortraitRM.GetObject(key);
                 if (image2 != null)
                 {
                     image2.Save(this.TempImageFileName);
                     item.PortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
                     image2 = (Image) this.SmallPortraitRM.GetObject(key + "s");
                     if (image2 == null)
                     {
                         return null;
                     }
                     image2.Save(this.TempImageFileName);
                     item.SmallPortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
                     this.portraits.Add(id, item);
                     return item;
                 }
                 return null;
             }
             finally
             {
                 File.Delete(this.TempImageFileName);
             }
             return item;
         }
         image.Portrait.Save(this.TempImageFileName);
         item.PortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
         image.SmallPortrait.Save(this.TempImageFileName);
         item.SmallPortraitTexture = Texture2D.FromFile(this.Device, this.TempImageFileName);
         this.portraits.Add(id, item);
     }
     return item;
 }