Пример #1
0
        public void OnShow()
        {
            var mapId = WorldFrame.Instance.MapManager.MapId;
            var mapRow = Storage.DbcStorage.Map.GetRowById(mapId);
            if(mapRow == null)
            {
                WorldFrame.Instance.State = AppState.MapSelect;
                return;
            }

            var loadScreenPath = "Interface\\Glues\\loading.blp";
            var loadEntry = mapRow.GetInt32(Storage.MapFormatGuess.FieldMapLoadingScreen);
            if(loadEntry != 0)
            {
                var loadRow = Storage.DbcStorage.LoadingScreen.GetRowById(loadEntry);
                if(loadRow != null)
                {
                    var path = loadRow.GetString(Storage.MapFormatGuess.FieldLoadingScreenPath);
                    mWidescreen = false;

                    if (string.IsNullOrEmpty(path) == false)
                    {
                        if (Storage.MapFormatGuess.FieldLoadingScreenHasWidescreen >= 0 && loadRow.GetInt32(Storage.MapFormatGuess.FieldLoadingScreenHasWidescreen) == 1)
                        {
                            var widePath = path.ToUpperInvariant().Replace(".BLP", "WIDE.BLP");
                            if (IO.FileManager.Instance.Provider.Exists(widePath))
                            {
                                path = widePath;
                                mWidescreen = true;
                            }
                        }

                        loadScreenPath = path;
                    }
                }
            }

            if (mLoadingImage != null)
                mLoadingImage.Dispose();
            mLoadingImage = new TextureBitmap();
            mLoadingImage.LoadComplete += ImageLoaded;
            mLoadingImage.LoadFromFile(loadScreenPath);

            if(mLoadingBarBackground == null)
            {
                mLoadingBarBackground = new TextureBitmap();
                mLoadingBarBackground.LoadFromFile(@"Interface\Glues\LoadingBar\Loading-BarBorder.blp");
                mLoadingBarFill = new TextureBitmap();
                mLoadingBarFill.LoadFromFile(@"Interface\Glues\LoadingBar\Loading-BarFill.blp");
            }
        }
Пример #2
0
        private void ImageLoaded(TextureBitmap bmp)
        {
            var facx = mSize.X / bmp.Width;
            var facy = mSize.Y / bmp.Height;
            var fac = Math.Min(facx, facy);
            var newHeight = fac * bmp.Height;
            var ofsy = (mSize.Y - newHeight) / 2.0f;

            var newWidth = fac * bmp.Width;
            if (mWidescreen) newWidth *= ( 16.0f / 9.0f );
            else newWidth *= ( 4.0f / 3.0f );
	
            var ofsx = (mSize.X - newWidth) / 2.0f;
            mTargetRectangle = new RectangleF(ofsx, ofsy, newWidth, newHeight);
        }