예제 #1
0
        protected void WarningScreenTick(WarningScreen screen)
        {
            string         identifier = (string)screen.Metadata;
            DownloadedItem item;

            if (!game.AsyncDownloader.TryGetItem(identifier, out item) || item.Data == null)
            {
                return;
            }

            long contentLength = (long)item.Data;

            if (contentLength <= 0)
            {
                return;
            }
            string url = identifier.Substring(3);

            float  contentLengthMB = (contentLength / 1024f / 1024f);
            string address         = url;

            if (url.StartsWith("https://"))
            {
                address = url.Substring(8);
            }
            if (url.StartsWith("http://"))
            {
                address = url.Substring(7);
            }
            screen.SetText("Do you want to download the server's texture pack?",
                           "Texture pack url:", address,
                           "Download size: " + contentLengthMB.ToString("F3") + " MB");
        }
예제 #2
0
        void WarningScreenTick(WarningScreen screen)
        {
            string         identifier = (string)screen.Metadata;
            DownloadedItem item;

            if (!game.AsyncDownloader.TryGetItem(identifier, out item) || item.Data == null)
            {
                return;
            }

            long contentLength = (long)item.Data;

            if (contentLength <= 0)
            {
                return;
            }
            string url = identifier.Substring(3);

            float contentLengthMB = (contentLength / 1024f / 1024f);

            screen.SetText("Do you want to download the server's terrain image?",
                           "The terrain image is located at:", url,
                           "Terrain image size: " + contentLengthMB.ToString("F3") + " MB");
        }
		void WarningScreenTick( WarningScreen screen ) {
			string identifier = (string)screen.Metadata;
			DownloadedItem item;
			if( !game.AsyncDownloader.TryGetItem( identifier, out item ) || item.Data == null ) return;
			
			long contentLength = (long)item.Data;
			if( contentLength <= 0 ) return;
			string url = identifier.Substring( 3 );
			
			float contentLengthMB = (contentLength / 1024f / 1024f );
			screen.SetText( "Do you want to download the server's terrain image?",
			               "The terrain image is located at:", url,
			               "Terrain image size: " + contentLengthMB.ToString( "F3" ) + " MB" );
		}