コード例 #1
1
ファイル: TilePrefetcher.cs プロジェクト: LeoTosti/x-drone
        bool CacheTiles(ref MapType[] types, int zoom, GPoint p)
        {
            foreach(MapType type in types)
             {
            Exception ex;
            PureImage img;

            // tile number inversion(BottomLeft -> TopLeft) for pergo maps
            if(type == MapType.PergoTurkeyMap)
            {
               img = GMaps.Instance.GetImageFrom(type, new GPoint(p.X, maxOfTiles.Height - p.Y), zoom, out ex);
            }
            else // ok
            {
               img = GMaps.Instance.GetImageFrom(type, p, zoom, out ex);
            }

            if(img != null)
            {
               img.Dispose();
               img = null;
            }
            else
            {
               return false;
            }
             }
             return true;
        }
コード例 #2
0
 /// <summary>
 /// Initialize with custom parameters
 /// </summary>
 /// <param name="mapToWgs84Transform">Transformation to transform MapCoordinates to WGS84</param>
 /// <param name="mapType">Type of Map Displayed</param>
 /// <param name="disclaimerDownloaded">Optional EventHandler that is called after Disclaimer Async Download (to be used to refresh map)</param>
 /// <param name="downloadAsync">wether to download disclaimer information async (non blocking operation)</param>
 public GoogleMapsDisclaimer(IMathTransform mapToWgs84Transform, MapType mapType, EventHandler disclaimerDownloaded, bool downloadAsync) : this()
 {
     m_MathTransform = mapToWgs84Transform;
     m_RunAsync = downloadAsync;
     m_DownloadComplete = disclaimerDownloaded;
     m_MapType = mapType;
 }
コード例 #3
0
 public IExportUtility CreateExportUtility(MapType mapType, ExportType exportType)
 {
     IExportUtility exportUtil = null;
     switch (mapType)
     {
         case MapType.IBIS:
             switch (exportType)
             {
                 case ExportType.Compendium:
                     exportUtil = new CompendiumExportUtility(MapManager);
                     break;
                 case ExportType.GlymaXml:
                     exportUtil = new GlymaXmlExportUtility(MapManager);
                     break;
                 case ExportType.PDF:
                     exportUtil = new PdfExportUtility(MapManager);
                     break;
                 case ExportType.Word:
                     exportUtil = new WordExportUtility(MapManager);
                     break;
             }
             break;
         //TODO: Handle other map types with other export utilities.
     }
     
     return exportUtil;
 }
コード例 #4
0
ファイル: CollectionAdapter.cs プロジェクト: xcolon/Mapster
 public override int? Priority(Type sourceType, Type destinationType, MapType mapType)
 {
     if (sourceType.IsCollection() && destinationType.IsCollection())
         return -125;
     else
         return null;
 }
コード例 #5
0
ファイル: Node.cs プロジェクト: wfowler1/LibBSP
		/// <summary>
		/// Factory method to parse a <c>byte</c> array into a <c>List</c> of <see cref="Node"/> objects.
		/// </summary>
		/// <param name="data">The data to parse.</param>
		/// <param name="type">The map type.</param>
		/// <param name="version">The version of this lump.</param>
		/// <returns>A <c>List</c> of <see cref="Node"/> objects.</returns>
		/// <exception cref="ArgumentNullException"><paramref name="data" /> was <c>null</c>.</exception>
		/// <exception cref="ArgumentException">This structure is not implemented for the given maptype.</exception>
		public static List<Node> LumpFactory(byte[] data, MapType type, int version = 0) {
			if (data == null) {
				throw new ArgumentNullException();
			}
			int structLength = 0;
			switch (type) {
				case MapType.Quake: {
					structLength = 24;
					break;
				}
				case MapType.Quake2:
				case MapType.SiN:
				case MapType.SoF:
				case MapType.Daikatana: {
					structLength = 28;
					break;
				}
				case MapType.Source17:
				case MapType.Source18:
				case MapType.Source19:
				case MapType.Source20:
				case MapType.Source21:
				case MapType.Source22:
				case MapType.Source23:
				case MapType.Source27:
				case MapType.L4D2:
				case MapType.TacticalInterventionEncrypted:
				case MapType.DMoMaM: {
					structLength = 32;
					break;
				}
				case MapType.Vindictus: {
					structLength = 48;
					break;
				}
				case MapType.Quake3:
				case MapType.FAKK:
				case MapType.CoD:
				case MapType.STEF2:
				case MapType.STEF2Demo:
				case MapType.MOHAA:
				case MapType.Raven:
				case MapType.Nightfire: {
					structLength = 36;
					break;
				}
				default: {
					throw new ArgumentException("Map type " + type + " isn't supported by the Node lump factory.");
				}
			}
			int offset = 0;
			List<Node> lump = new List<Node>(data.Length / structLength);
			byte[] bytes = new byte[structLength];
			for (int i = 0; i < data.Length / structLength; ++i) {
				Array.Copy(data, (i * structLength), bytes, 0, structLength);
				lump.Add(new Node(bytes, type, version));
				offset += structLength;
			}
			return lump;
		}
コード例 #6
0
ファイル: Cubemap.cs プロジェクト: wfowler1/LibBSP
		/// <summary>
		/// Creates a new <see cref="Cubemap"/> object from a <c>byte</c> array.
		/// </summary>
		/// <param name="data"><c>byte</c> array to parse.</param>
		/// <param name="type">The map type.</param>
		/// <param name="version">The version of this lump.</param>
		/// <exception cref="ArgumentNullException"><paramref name="data" /> was <c>null</c>.</exception>
		/// <exception cref="ArgumentException">This structure is not implemented for the given maptype.</exception>
		public Cubemap(byte[] data, MapType type, int version = 0) : this() {
			if (data == null) {
				throw new ArgumentNullException();
			}
			switch (type) {
				case MapType.Source17:
				case MapType.Source18:
				case MapType.Source19:
				case MapType.Source20:
				case MapType.Source21:
				case MapType.Source22:
				case MapType.Source23:
				case MapType.Source27:
				case MapType.TacticalInterventionEncrypted:
				case MapType.L4D2:
				case MapType.Vindictus:
				case MapType.DMoMaM: {
					origin = new Vector3(BitConverter.ToInt32(data, 0), BitConverter.ToInt32(data, 4), BitConverter.ToInt32(data, 8));
					size = BitConverter.ToInt32(data, 12);
					break;
				}
				default: {
					throw new ArgumentException("Map type " + type + " isn't supported by the SourceCubemap class.");
				}
			}
		}
コード例 #7
0
		/// <summary>
		/// Sets up the game to be played in the map specified
		/// </summary>
		/// <param name="mode">Mode.</param>
		/// <param name="map">Map.</param>
		public void playGame(GameModeType mode, MapType map){

			Debug.Log ("about to load scene");

			switch(map){

			case MapType.Prototype:
				SceneManager.LoadScene ("PrototypeMap", LoadSceneMode.Single);		
				break;

			}

			Debug.Log ("Scene loaded");

			GameObject container = new GameObject ("_SCRIPTS_");
			Object.DontDestroyOnLoad (container);

			switch(mode){

			case GameModeType.ProtectTheQueen:
				
				currentModeBeingPlayed = container.AddComponent<ProtectTheQueen.ProtectTheQueenModeBehavior> ();
				break;

			}


		}
コード例 #8
0
ファイル: FilePureImageCache.cs プロジェクト: deb761/BikeMap
        public bool PutImageToCache(MemoryStream tile, MapType type, Point pos, int zoom)
        {
            FileStream fs = null;
            try
            {
                string fileName = GetFilename(type, pos, zoom, true);
                fs = new FileStream(fileName, FileMode.Create);
                tile.WriteTo(fs);
                tile.Flush();
                fs.Close();
                fs.Dispose();
                tile.Seek(0, SeekOrigin.Begin);

                return true;
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("Error in FilePureImageCache.PutImageToCache:\r\n" + ex.ToString());
                if (fs != null)
                {
                    fs.Close();
                    fs.Dispose();
                }
                return false;
            }
        }
コード例 #9
0
ファイル: StaticImage.cs プロジェクト: wrbrooks/VB3
 public MapInfo(PureProjection Projection, RectLatLng Area, int Zoom, MapType Type)
 {
     this.Projection = Projection;
      this.Area = Area;
      this.Zoom = Zoom;
      this.Type = Type;
 }
コード例 #10
0
ファイル: MapGenerator.cs プロジェクト: THEGUY3000/zunehack
        public MapGenerator(MapType Type, Map Map)
        {
            // List of map connections available
            available_conns = new List<Connector>();
            rnd = new Random();

            type = Type;
            map = Map;

            width = 50;
            height = 50;

            map.mapData = new int[width, height];
            map.Width = width;
            map.Height = height;

            map.entities = new List<Entity>();

            SetTypeTextures();

            // Fills map
            FillRandRect(0, 0, width - 1, height - 1, 1, 3);

            // Randomly place the first connector
            Connector connection = new Connector();
            connection.posX = width / 2;
            connection.posY = height / 2;
            connection.dir = GetRandomDirection();
            connection.noDoor = true;

            available_conns.Add(connection);

            // Generate some rooms
            int numGenerated = 0;
            int tries = 0;
            while (numGenerated < 20 && tries < 30 && available_conns.Count > 0)
            {
                // Attempt to make a room with the first connector
                Connector tryThis = available_conns.First();
                bool didGenerate = MakeRoom(tryThis);
                if (didGenerate)
                {
                    // This connection generated fine, remove the connector
                    numGenerated++;
                    available_conns.Remove(tryThis);
                }
                else
                {
                    // Check to see if we've tried too many times already
                    if (tries++ > 2)
                    {
                        tries = 0;
                        available_conns.Remove(tryThis);
                    }
                }
            }

            PlaceStairsUp();
            PlaceStairsDown();
        }
コード例 #11
0
ファイル: Cubemap.cs プロジェクト: wfowler1/LibBSP
		/// <summary>
		/// Factory method to parse a <c>byte</c> array into a <c>List</c> of <see cref="Cubemap"/> objects.
		/// </summary>
		/// <param name="data">The data to parse.</param>
		/// <param name="type">The map type.</param>
		/// <param name="version">The version of this lump.</param>
		/// <returns>A <c>List</c> of <see cref="Cubemap"/> objects.</returns>
		/// <exception cref="ArgumentNullException"><paramref name="data" /> was <c>null</c>.</exception>
		/// <exception cref="ArgumentException">This structure is not implemented for the given maptype.</exception>
		public static List<Cubemap> LumpFactory(byte[] data, MapType type, int version = 0) {
			if (data == null) {
				throw new ArgumentNullException();
			}
			int structLength = 0;
			switch (type) {
				case MapType.Source17:
				case MapType.Source18:
				case MapType.Source19:
				case MapType.Source20:
				case MapType.Source21:
				case MapType.Source22:
				case MapType.Source23:
				case MapType.Source27:
				case MapType.TacticalInterventionEncrypted:
				case MapType.L4D2:
				case MapType.Vindictus:
				case MapType.DMoMaM: {
					structLength = 16;
					break;
				}
				default: {
					throw new ArgumentException("Map type " + type + " isn't supported by the SourceCubemap lump factory.");
				}
			}
			int offset = 0;
			List<Cubemap> lump = new List<Cubemap>(data.Length / structLength);
			byte[] bytes = new byte[structLength];
			for (int i = 0; i < data.Length / structLength; ++i) {
				Array.Copy(data, (i * structLength), bytes, 0, structLength);
				lump.Add(new Cubemap(bytes, type, version));
				offset += structLength;
			}
			return lump;
		}
コード例 #12
0
ファイル: UpdateSummoner.cs プロジェクト: tsubus/RiotControl
        void SetSummaryParameters(DatabaseCommand command, MapType map, GameModeType gameMode, Summoner summoner, PlayerStatSummary summary, bool forceNullRating)
        {
            if (forceNullRating)
            {
                command.Set("current_rating", DbType.Int32, null);
                command.Set("top_rating", DbType.Int32, null);
            }
            else
            {
                //Zero rating means that the Elo is below 1200 and is not revealed by the server
                if (summary.rating == 0)
                    command.Set("current_rating", DbType.Int32, null);
                else
                    command.Set("current_rating", summary.rating);
                command.Set("top_rating", summary.maxRating);
            }

            command.Set("summoner_id", summoner.Id);
            command.Set("map", (int)map);
            command.Set("game_mode", (int)gameMode);

            command.Set("wins", summary.wins);
            command.Set("losses", summary.losses);
            command.Set("leaves", summary.leaves);
        }
コード例 #13
0
 public MapTile GetTile(int zoom, int tileX, int tileY, MapType type)
 {
     string key = String.Format("{0},{1},{2},{3}", zoom, tileX, tileY, type);
     cacheLock.EnterUpgradeableReadLock();
     try
     {
         if (cache.ContainsKey(key))
         {
             cacheAccessCounter[key] = DateTime.Now.Ticks;
             return cache[key];
         }
         else
         {
             MapTile tile = innerFactory.GetTile(zoom, tileX, tileY, type);
             cacheLock.EnterWriteLock();
             try
             {
                 if (tile != null)
                 {
                     cache[key] = tile;
                     cacheAccessCounter[key] = DateTime.Now.Ticks;
                 }
                 return tile;
             }
             finally
             {
                 cacheLock.ExitWriteLock();
             }
         }
     }
     finally
     {
         cacheLock.ExitUpgradeableReadLock();
     }
 }
コード例 #14
0
ファイル: Database.cs プロジェクト: LeeSeungSoo/RiotControl
 List<AggregatedChampionStatistics> LoadAggregatedChampionStatistics(Summoner summoner, MapType map, GameModeType gameMode, NpgsqlConnection database)
 {
     const string query =
         "with source as " +
         "(select player.champion_id, player.won, player.kills, player.deaths, player.assists, player.gold, player.minion_kills from game_result, player where game_result.map = cast(:map as map_type) and game_result.game_mode = cast(:game_mode as game_mode_type) and (game_result.team1_id = player.team_id or game_result.team2_id = player.team_id) and player.summoner_id = :summoner_id) " +
         "select statistics.champion_id, coalesce(champion_wins.wins, 0) as wins, coalesce(champion_losses.losses, 0) as losses, statistics.kills, statistics.deaths, statistics.assists, statistics.gold, statistics.minion_kills from " +
         "(select source.champion_id, sum(source.kills) as kills, sum(source.deaths) as deaths, sum(source.assists) as assists, sum(source.gold) as gold, sum(source.minion_kills) as minion_kills from source group by source.champion_id) " +
         "as statistics " +
         "left outer join " +
         "(select champion_id, count(*) as wins from source where won = true group by champion_id) " +
         "as champion_wins " +
         "on statistics.champion_id = champion_wins.champion_id " +
         "left outer join " +
         "(select champion_id, count(*) as losses from source where won = false group by champion_id) " +
         "as champion_losses " +
         "on statistics.champion_id = champion_losses.champion_id;";
     DatabaseCommand select = GetCommand(query, database);
     select.SetEnum("map", map.ToEnumString());
     select.SetEnum("game_mode", gameMode.ToEnumString());
     select.Set("summoner_id", summoner.Id);
     using (NpgsqlDataReader reader = select.ExecuteReader())
     {
         List<AggregatedChampionStatistics> output = new List<AggregatedChampionStatistics>();
         while (reader.Read())
         {
             AggregatedChampionStatistics statistics = new AggregatedChampionStatistics(reader);
             statistics.ChampionName = GetChampionName(statistics.ChampionId);
             output.Add(statistics);
         }
         output.Sort();
         return output;
     }
 }
コード例 #15
0
ファイル: FilePureImageCache.cs プロジェクト: deb761/BikeMap
 public PureImage GetImageFromCache(MapType type, Point pos, int zoom)
 {
     try
     {
         string fileName = GetFilename(type, pos, zoom, false);
         FileInfo fi = new FileInfo(fileName);
         if (fi.Exists && fi.LastWriteTimeUtc > _CacheDate)
         {
             Image image = Image.FromFile(fileName);
             WindowsFormsImage img = new WindowsFormsImage();
             img.Img = image;
             img.Data = new MemoryStream();
             image.Save(img.Data, System.Drawing.Imaging.ImageFormat.Jpeg);
             System.Diagnostics.Debug.WriteLine(string.Format("{0} FilePureImageCache.GetImageFromCache(type={1}, pos={2}, zoom={3}, file date={4}) succeeded.", DateTime.Now, type, pos, zoom, fi.LastWriteTimeUtc));
             return img;
         }
         else
         {
             System.Diagnostics.Debug.WriteLine(string.Format("{0} FilePureImageCache.GetImageFromCache(type={1}, pos={2}, zoom={3}) NOT IN CACHE.", DateTime.Now, type, pos, zoom));
             return null;
         }
     }
     catch (Exception ex)
     {
         System.Diagnostics.Debug.WriteLine("Error in FilePureImageCache.GetImageFromCache:\r\n" + ex.ToString());
         return null;
     }
 }
コード例 #16
0
        /// <summary>
        /// Registers the JavaScript to display the map.
        /// </summary>
        /// <param name="scriptManager">The page's script manager.</param>
        /// <param name="mapType">Type of the map.</param>
        /// <param name="mapSectionId">The ID of the section (div) on the page in which the map should be created.</param>
        /// <param name="currentLocationSpanId">The ID of the span showing the current location text.</param>
        /// <param name="noLocationSpanId">The ID of the span shown when no location is selected.</param>
        /// <param name="instructionSpanId">The ID of the span with driving directions, etc.</param>
        /// <param name="directionsLinkId">The ID of the link to driving directions.</param>
        /// <param name="directionsSectionId">The ID of the section (div) with driving directions text.</param>
        /// <param name="locations">The list of locations to display.</param>
        /// <param name="showAllLocationsOnLoad">if set to <c>true</c> shows the map with all locations on it by default.</param>
        public override void GenerateMapScriptCore(ScriptManager scriptManager, MapType mapType, string mapSectionId, string currentLocationSpanId, string noLocationSpanId, string instructionSpanId, string directionsLinkId, string directionsSectionId, LocationCollection locations, bool showAllLocationsOnLoad)
        {
            ICollection<JavaScript.Location> locationsAsJson = locations.AsJson();
            string mapParameters = String.Format(CultureInfo.InvariantCulture, "currentLocationSpan: {0}, noLocationSpan: {1}, instructionSpan: {2}, directionsLink: {3}, directionsSection: {4}, mapType: {5}, locationsArray: {6}", GetElementJavaScript(currentLocationSpanId), GetElementJavaScript(noLocationSpanId), GetElementJavaScript(instructionSpanId), GetElementJavaScript(directionsLinkId), GetElementJavaScript(directionsSectionId), ConvertMapType(mapType), new JavaScriptSerializer().Serialize(locationsAsJson));

            scriptManager.Scripts.Add(new ScriptReference(GetLoaderUrl(this.ApiKey)));
            scriptManager.Scripts.Add(new ScriptReference("Engage.Dnn.Locator.JavaScript.BaseLocator.js", "EngageLocator"));
            scriptManager.Scripts.Add(new ScriptReference("Engage.Dnn.Locator.JavaScript.GoogleLocator.js", "EngageLocator"));
            ScriptManager.RegisterStartupScript(
                    scriptManager.Page,
                    typeof(GoogleProvider),
                    "Initialize",
                    "google.setOnLoadCallback(jQuery(function(){ jQuery.noConflict(); $create(Engage.Dnn.Locator.GoogleMap, {" + mapParameters + "}, {}, {}, $get('" + mapSectionId + "')); }));",
                    true);

            if (showAllLocationsOnLoad)
            {
                ScriptManager.RegisterStartupScript(
                        scriptManager.Page,
                        typeof(GoogleProvider),
                        "showAllLocations",
                        "google.setOnLoadCallback(jQuery(function(){ $find('" + mapSectionId + "$GoogleMap').showAllLocations(); }));",
                        true);
            }
        }
コード例 #17
0
        void ProcessSummary(MapType map, GameModeType gameMode, string target, Summoner summoner, List<PlayerStatSummary> summaries, DbConnection connection, bool forceNullRating = false)
        {
            foreach (var summary in summaries)
            {
                if (summary.playerStatSummaryType != target)
                    continue;
                using (var update = Command("update summoner_rating set wins = :wins, losses = :losses, leaves = :leaves, kills = :kills, deaths = :deaths, assists = :assists, current_rating = :current_rating, top_rating = :top_rating where summoner_id = :summoner_id and map = :map and game_mode = :game_mode", connection))
                {
                    SetSummaryParameters(update, map, gameMode, summoner, summary, forceNullRating);

                    int rowsAffected = update.Execute();
                    if (rowsAffected == 0)
                    {
                        //We're dealing with a new summoner rating entry, insert it
                        using (var insert = Command("insert into summoner_rating (summoner_id, map, game_mode, wins, losses, leaves, kills, deaths, assists, current_rating, top_rating) values (:summoner_id, :map, :game_mode, :wins, :losses, :leaves, :kills, :deaths, :assists, :current_rating, :top_rating)", connection))
                        {
                            SetSummaryParameters(insert, map, gameMode, summoner, summary, forceNullRating);
                            insert.Execute();
                            //SummonerMessage(string.Format("New rating for mode {0}", target), summoner);
                        }
                    }
                    else
                    {
                        //This rating was already in the database and was updated
                        //SummonerMessage(string.Format("Updated rating for mode {0}", target), summoner);
                    }
                    break;
                }
            }
        }
コード例 #18
0
 /// <summary>
 /// Initialize with custom parameters
 /// </summary>
 /// <remarks>
 /// IMPORTANT: In Async mode you need to use UpdateBoundingBox when the MapBox/MapImage center or ZoomLevel changes, else the text will be wrong
 /// </remarks>
 /// <param name="mapToWgs84Transform">Transformation to transform MapCoordinates to WGS84</param>
 /// <param name="mapType">Type of Map Displayed</param>
 /// <param name="disclaimerDownloaded">Optional EventHandler that is called after Disclaimer Async Download (to be used to refresh map)</param>
 /// <param name="runInAsyncMode">whether to download disclaimer information async (non blocking operation)</param>
 public GoogleMapsDisclaimer(IMathTransform mapToWgs84Transform, MapType mapType, EventHandler disclaimerDownloaded, bool runInAsyncMode) : this()
 {
     _mathTransform = mapToWgs84Transform;
     _runInRunAsyncMode = runInAsyncMode;
     _downloadCompleteHandler = disclaimerDownloaded;
     _mapType = mapType;
 }
コード例 #19
0
ファイル: Edge.cs プロジェクト: wfowler1/LibBSP
		/// <summary>
		/// Creates a new <see cref="Edge"/> object from a <c>byte</c> array.
		/// </summary>
		/// <param name="data"><c>byte</c> array to parse.</param>
		/// <param name="type">The map type.</param>
		/// <param name="version">The version of this lump.</param>
		/// <exception cref="ArgumentNullException"><paramref name="data"/> was <c>null</c>.</exception>
		/// <exception cref="ArgumentException">This structure is not implemented for the given maptype.</exception>
		public Edge(byte[] data, MapType type, int version = 0) : this() {
			if (data == null) {
				throw new ArgumentNullException();
			}
			switch (type) {
				case MapType.Quake:
				case MapType.SiN:
				case MapType.Daikatana:
				case MapType.Source17:
				case MapType.Source18:
				case MapType.Source19:
				case MapType.Source20:
				case MapType.Source21:
				case MapType.Source22:
				case MapType.Source23:
				case MapType.Source27:
				case MapType.L4D2:
				case MapType.TacticalInterventionEncrypted:
				case MapType.DMoMaM:
				case MapType.Quake2:
				case MapType.SoF: {
					firstVertex = BitConverter.ToUInt16(data, 0);
					secondVertex = BitConverter.ToUInt16(data, 2);
					break;
				}
				case MapType.Vindictus: {
					firstVertex = BitConverter.ToInt32(data, 0);
					secondVertex = BitConverter.ToInt32(data, 4);
					break;
				}
				default: {
					throw new ArgumentException("Map type " + type + " isn't supported by the Edge class.");
				}
			}
		}
コード例 #20
0
ファイル: DictionaryAdapter.cs プロジェクト: centur/Mapster
        protected override bool CanMap(Type sourceType, Type destinationType, MapType mapType)
        {
            if (sourceType == typeof (string) || sourceType == typeof (object))
                return false;

            var dictType = destinationType.GetDictionaryType();
            return dictType?.GetGenericArguments()[0] == typeof (string);
        }
コード例 #21
0
ファイル: CacheQueue.cs プロジェクト: LeoTosti/x-drone
 public CacheItemQueue(MapType Type, GPoint Pos, int Zoom, MemoryStream Img, CacheUsage cacheType)
 {
     this.Type = Type;
      this.Pos = Pos;
      this.Zoom = Zoom;
      this.Img = Img;
      this.CacheType = cacheType;
 }
コード例 #22
0
ファイル: DisplacementVertex.cs プロジェクト: wfowler1/LibBSP
		public float alpha { get; private set; } // Alpha value of texture at this vertex

		/// <summary>
		/// Creates a new <see cref="DisplacementVertex"/> object from a <c>byte</c> array.
		/// </summary>
		/// <param name="data"><c>byte</c> array to parse.</param>
		/// <param name="type">The map type.</param>
		/// <param name="version">The version of this lump.</param>
		/// <exception cref="ArgumentNullException"><paramref name="data"/> was <c>null</c>.</exception>
		public DisplacementVertex(byte[] data, MapType type, int version = 0) : this() {
			if (data == null) {
				throw new ArgumentNullException();
			}
			this.normal = new Vector3(BitConverter.ToSingle(data, 0), BitConverter.ToSingle(data, 4), BitConverter.ToSingle(data, 8));
			this.dist = BitConverter.ToSingle(data, 12);
			this.alpha = BitConverter.ToSingle(data, 16);
		}
コード例 #23
0
        /// <summary>
        /// 直接生成地图不注册区域
        /// </summary>
        /// <param name="mapType"></param>
        /// <returns></returns>
        private ChessboardCell[,] MakeMap(MapType mapType = MapType.Common)
        {
            var idList = new IDList("");
            var temp = new ChessboardCell[8, 12];
            for (int x = 0; x < temp.GetLength(0); x++)//初始化区块
            {
                for (int y = 0; y < temp.GetLength(1); y++)
                {
                    Position a = new Position(x, y);
                    temp[x, y] = new ChessboardCell(idList, a);
                }
            }
            for (int x = 0; x < temp.GetLength(0); x++)//设定召唤区块
            {
                for (int y = 0; y < 2; y++)
                {
                    temp[x, y].CellType = ChessboardCellType.Birth;
                    temp[x, y].Owner = GameCore.Teams[0];
                }
                for (int y = temp.GetLength(1) - 2; y < temp.GetLength(1); y++)
                {
                    temp[x, y].CellType = ChessboardCellType.Birth;
                    temp[x, y].Owner = GameCore.Teams[1];
                }
            }
            if (temp.GetLength(0) % 2 == 0) //设定基地,自动基地判断大小
            {
                for (int x = temp.GetLength(0) / 2 - 1; x <= temp.GetLength(0) / 2; x++) //偶数
                {
                    for (int y = 0; y <= 0; y++)
                    {
                        temp[x, y].CellType = ChessboardCellType.Base;
                    }
                    for (int y = temp.GetLength(1) - 1; y <= temp.GetLength(1) - 1; y++)
                    {
                        temp[x, y].CellType = ChessboardCellType.Base;
                    }
                }
            }
            else
            {
                for (int x = temp.GetLength(0) / 2 - 1; x <= temp.GetLength(0) / 2 + 1; x++) //奇数
                {
                    for (int y = 0; y <= 0; y++)
                    {
                        temp[x, y].CellType = ChessboardCellType.Base;
                    }
                    for (int y = temp.GetLength(1) - 1; y <= temp.GetLength(1) - 1; y++)
                    {
                        temp[x, y].CellType = ChessboardCellType.Base;
                    }
                }
            }

            return temp;
        }
コード例 #24
0
ファイル: Map.cs プロジェクト: GW2DotNetTools/GW2-CSharp
 /// <summary>
 /// The map constructor
 /// </summary>
 /// <param name="id">The map id</param>
 /// <param name="type">The identifier for the map.</param>
 /// <param name="scores">An object containing the score of the three servers for only the specified map</param>
 /// <param name="bonuses">A list of all bonuses being granted by this map. If no player team owns a bonus from the map, this list is empty.</param>
 /// <param name="deaths">An object containing the total deaths of the three servers for only the specified map</param>
 /// <param name="kills">An object containing the total kills of the three servers for only the specified map</param>
 /// <param name="objectives">A list of objective objects for this map</param>
 public Map(int id, MapType type, Scores scores, List<Bonus> bonuses, Deaths deaths, Kills kills, List<MatchObjective> objectives)
 {
     Id = id;
     Type = type;
     Scores = scores;
     Bonuses = bonuses;
     Deaths = deaths;
     Kills = kills;
     Objectives = objectives;
 }
コード例 #25
0
ファイル: RecordTypeAdapter.cs プロジェクト: centur/Mapster
        protected override bool CanMap(Type sourceType, Type destinationType, MapType mapType)
        {
            if (sourceType == typeof (string) || sourceType == typeof (object))
                return false;

            if (!destinationType.IsRecordType())
                return false;

            return true;
        }
コード例 #26
0
        protected override void PerformExtendedReading(DatabaseReader reader)
        {
            InternalGameId = reader.Integer();

            Map = (MapType)reader.Integer();
            GameMode = (GameModeType)reader.Integer();

            GameTime = reader.Time();

            reader.SanityCheck(GetExtendedFields());
        }
コード例 #27
0
ファイル: UIVertexExtensions.cs プロジェクト: wfowler1/LibBSP
		/// <summary>
		/// Creates a new <see cref="UIVertex"/> object from a <c>byte</c> array.
		/// </summary>
		/// <param name="data"><c>byte</c> array to parse.</param>
		/// <param name="type">The map type.</param>
		/// <param name="version">The version of this lump.</param>
		/// <returns>The resulting <see cref="UIVertex"/> object.</returns>
		/// <exception cref="ArgumentNullException"><paramref name="data"/> was null.</exception>
		/// <exception cref="ArgumentException">This structure is not implemented for the given maptype.</exception>
		/// <remarks><see cref="UIVertex"/> has no constructor, so the object must be initialized field-by-field. Even if it
		/// did have a constructor, the way data needs to be read wouldn't allow use of it.</remarks>
		public static UIVertex CreateVertex(byte[] data, MapType type, int version = 0) {
			if (data == null) {
				throw new ArgumentNullException();
			}
			UIVertex result = new UIVertex();
			switch (type) {
				case MapType.MOHAA:
				case MapType.Quake3:
				case MapType.CoD:
				case MapType.CoD2:
				case MapType.CoD4:
				case MapType.FAKK: {
					result.uv0 = new Vector2(BitConverter.ToSingle(data, 12), BitConverter.ToSingle(data, 16));
					result.color = Color32Extensions.FromArgb(data[43], data[40], data[41], data[42]);
					goto case MapType.DMoMaM;
				}
				case MapType.Raven: {
					result.uv0 = new Vector2(BitConverter.ToSingle(data, 12), BitConverter.ToSingle(data, 16));
					result.color = Color32Extensions.FromArgb(data[67], data[64], data[65], data[66]);
					goto case MapType.DMoMaM;
				}
				case MapType.STEF2:
				case MapType.STEF2Demo: {
					result.uv0 = new Vector2(BitConverter.ToSingle(data, 12), BitConverter.ToSingle(data, 16));
					result.color = Color32Extensions.FromArgb(data[35], data[32], data[33], data[34]);
					goto case MapType.DMoMaM;
				}
				case MapType.Quake:
				case MapType.Nightfire:
				case MapType.SiN:
				case MapType.SoF:
				case MapType.Source17:
				case MapType.Source18:
				case MapType.Source19:
				case MapType.Source20:
				case MapType.Source21:
				case MapType.Source22:
				case MapType.Source23:
				case MapType.Source27:
				case MapType.L4D2:
				case MapType.TacticalInterventionEncrypted:
				case MapType.Quake2:
				case MapType.Daikatana:
				case MapType.Vindictus:
				case MapType.DMoMaM: {
					result.position = new Vector3(BitConverter.ToSingle(data, 0), BitConverter.ToSingle(data, 4), BitConverter.ToSingle(data, 8));
					break;
				}
				default: {
					throw new ArgumentException("Map type " + type + " isn't supported by the UIVertex class factory.");
				}
			}
			return result;
		}
コード例 #28
0
ファイル: Game.cs プロジェクト: Julien-Marcou/SmallWorld
 public Game(MapType mapType, int mapSeed)
 {
     Map = MapFactory.GetMap(mapType, mapSeed);
     Players = new Dictionary<int, Player>();
     CurrentPlayerIndex = 0;
     CurrentTurn = 0;
     MaxPlayers = Map.MaxPlayers;
     UnitPerPlayer = Map.UnitPerPlayer;
     MaxTurns = Map.MaxTurns;
     IsFinished = false;
 }
コード例 #29
0
ファイル: GameTeamPlayer.cs プロジェクト: andor44/RiotControl
        protected override void PerformExtendedReading(Reader reader)
        {
            InternalGameId = reader.Integer();

            Map = reader.String().ToMapType();
            GameMode = reader.String().ToGameModeType();

            GameTime = reader.Time();

            reader.SanityCheck(GetExtendedFields());
        }
コード例 #30
0
ファイル: ClassAdapter.cs プロジェクト: eric-swann-q2/Mapster
        public override int? Priority(Type sourceType, Type destinationType, MapType mapType)
        {
            if (sourceType == typeof (string) || sourceType == typeof (object))
                return null;

            var destProp = destinationType.GetPublicFieldsAndProperties(allowNoSetter: false).Select(x => x.Name).ToList();
            if (destProp.Count == 0)
                return null;

            return -150;
        }
コード例 #31
0
ファイル: MainWindow2.xaml.cs プロジェクト: jalsary/my-center
 void MainMap_OnMapTypeChanged(MapType type)
 {
     //    sliderZoom.Minimum = MainMap.MinZoom;
     //  sliderZoom.Maximum = MainMap.MaxZoom;
 }
コード例 #32
0
ファイル: MainGui.cs プロジェクト: qjoseph/Materialize
    public void QuickSave(int mapType)
    {
        MapType type = SetMapType(mapType);

        SaveTextureFile(type);
    }
コード例 #33
0
    public bool GetButton(ButtonMethodName g_input, int g_joystickNumber, JoystickButton g_button)
    {
        //check if it use simulator
        if (useSimulator)
        {
            foreach (JellyJoystickSimulator t_simulator in myJellyJoystickSimulators)
            {
                if (t_simulator.myJoystickNumber == g_joystickNumber)
                {
                    foreach (JellyJoystickSimulator.Button t_button in t_simulator.myButtons)
                    {
                        if (t_button.myJoystickButton == g_button)
                        {
                            if (t_simulator.GetButton(g_input, t_button))
                            {
                                return(true);
                            }
                            break;
                        }
                    }
                    break;
                }
            }
        }

        //get the input function
        ButtonMethod t_InputFunction;

        if (g_input == ButtonMethodName.Up)
        {
            t_InputFunction = Input.GetKeyUp;
        }
        else if (g_input == ButtonMethodName.Hold)
        {
            t_InputFunction = Input.GetKey;
        }
        else
        {
            t_InputFunction = Input.GetKeyDown;
        }

        //0 -> all; 1-8 -> joystick1-8
        g_joystickNumber = Mathf.Clamp(g_joystickNumber, 0, NUMBER_MAX_JOYSTICK);

        if (g_joystickNumber != 0)
        {
            //get the map type
            MapType t_mapType = myMapTypes [g_joystickNumber - 1];

            if (t_mapType == MapType.PS4)
            {
                if (g_button == JoystickButton.A)
                {
                    return(t_InputFunction(GetKeyCode(1, g_joystickNumber)));
                }
                if (g_button == JoystickButton.B)
                {
                    return(t_InputFunction(GetKeyCode(2, g_joystickNumber)));
                }
                if (g_button == JoystickButton.X)
                {
                    return(t_InputFunction(GetKeyCode(0, g_joystickNumber)));
                }
                if (g_button == JoystickButton.Y)
                {
                    return(t_InputFunction(GetKeyCode(3, g_joystickNumber)));
                }

                if (g_button == JoystickButton.LB)
                {
                    return(t_InputFunction(GetKeyCode(4, g_joystickNumber)));
                }
                if (g_button == JoystickButton.RB)
                {
                    return(t_InputFunction(GetKeyCode(5, g_joystickNumber)));
                }

                if (g_button == JoystickButton.BACK)
                {
                    return(t_InputFunction(GetKeyCode(8, g_joystickNumber)));
                }
                if (g_button == JoystickButton.START)
                {
                    return(t_InputFunction(GetKeyCode(9, g_joystickNumber)));
                }

                if (g_button == JoystickButton.LS)
                {
                    return(t_InputFunction(GetKeyCode(10, g_joystickNumber)));
                }
                if (g_button == JoystickButton.RS)
                {
                    return(t_InputFunction(GetKeyCode(11, g_joystickNumber)));
                }
            }
            else if (t_mapType == MapType.OSX_XBOX)
            {
                if (g_button == JoystickButton.A)
                {
                    return(t_InputFunction(GetKeyCode(16, g_joystickNumber)));
                }
                if (g_button == JoystickButton.B)
                {
                    return(t_InputFunction(GetKeyCode(17, g_joystickNumber)));
                }
                if (g_button == JoystickButton.X)
                {
                    return(t_InputFunction(GetKeyCode(18, g_joystickNumber)));
                }
                if (g_button == JoystickButton.Y)
                {
                    return(t_InputFunction(GetKeyCode(19, g_joystickNumber)));
                }

                if (g_button == JoystickButton.LB)
                {
                    return(t_InputFunction(GetKeyCode(13, g_joystickNumber)));
                }
                if (g_button == JoystickButton.RB)
                {
                    return(t_InputFunction(GetKeyCode(14, g_joystickNumber)));
                }

                if (g_button == JoystickButton.BACK)
                {
                    return(t_InputFunction(GetKeyCode(10, g_joystickNumber)));
                }
                if (g_button == JoystickButton.START)
                {
                    return(t_InputFunction(GetKeyCode(9, g_joystickNumber)));
                }

                if (g_button == JoystickButton.LS)
                {
                    return(t_InputFunction(GetKeyCode(11, g_joystickNumber)));
                }
                if (g_button == JoystickButton.RS)
                {
                    return(t_InputFunction(GetKeyCode(12, g_joystickNumber)));
                }
            }
            else if (t_mapType == MapType.WIN_XBOX)
            {
                if (g_button == JoystickButton.A)
                {
                    return(t_InputFunction(GetKeyCode(0, g_joystickNumber)));
                }
                if (g_button == JoystickButton.B)
                {
                    return(t_InputFunction(GetKeyCode(1, g_joystickNumber)));
                }
                if (g_button == JoystickButton.X)
                {
                    return(t_InputFunction(GetKeyCode(2, g_joystickNumber)));
                }
                if (g_button == JoystickButton.Y)
                {
                    return(t_InputFunction(GetKeyCode(3, g_joystickNumber)));
                }

                if (g_button == JoystickButton.LB)
                {
                    return(t_InputFunction(GetKeyCode(4, g_joystickNumber)));
                }
                if (g_button == JoystickButton.RB)
                {
                    return(t_InputFunction(GetKeyCode(5, g_joystickNumber)));
                }

                if (g_button == JoystickButton.BACK)
                {
                    return(t_InputFunction(GetKeyCode(6, g_joystickNumber)));
                }
                if (g_button == JoystickButton.START)
                {
                    return(t_InputFunction(GetKeyCode(7, g_joystickNumber)));
                }

                if (g_button == JoystickButton.LS)
                {
                    return(t_InputFunction(GetKeyCode(8, g_joystickNumber)));
                }
                if (g_button == JoystickButton.RS)
                {
                    return(t_InputFunction(GetKeyCode(9, g_joystickNumber)));
                }
            }
            else if (t_mapType == MapType.PS3)
            {
                if (g_button == JoystickButton.A)
                {
                    return(t_InputFunction(GetKeyCode(2, g_joystickNumber)));
                }
                if (g_button == JoystickButton.B)
                {
                    return(t_InputFunction(GetKeyCode(1, g_joystickNumber)));
                }
                if (g_button == JoystickButton.X)
                {
                    return(t_InputFunction(GetKeyCode(3, g_joystickNumber)));
                }
                if (g_button == JoystickButton.Y)
                {
                    return(t_InputFunction(GetKeyCode(0, g_joystickNumber)));
                }

                if (g_button == JoystickButton.LB)
                {
                    return(t_InputFunction(GetKeyCode(6, g_joystickNumber)));
                }
                if (g_button == JoystickButton.RB)
                {
                    return(t_InputFunction(GetKeyCode(7, g_joystickNumber)));
                }

                if (g_button == JoystickButton.BACK)
                {
                    return(t_InputFunction(GetKeyCode(8, g_joystickNumber)));
                }
                if (g_button == JoystickButton.START)
                {
                    return(t_InputFunction(GetKeyCode(9, g_joystickNumber)));
                }

                if (g_button == JoystickButton.LS)
                {
                    return(t_InputFunction(GetKeyCode(10, g_joystickNumber)));
                }
                if (g_button == JoystickButton.RS)
                {
                    return(t_InputFunction(GetKeyCode(11, g_joystickNumber)));
                }
            }
        }
        else
        {
            for (int i = 1; i <= NUMBER_MAX_JOYSTICK; i++)
            {
                if (GetButton(g_input, i, g_button))
                {
                    return(true);
                }
            }
        }
        return(false);
    }
コード例 #34
0
 public void ChangeMap(MapType MapType)
 {
     mapType = MapType;
 }
コード例 #35
0
ファイル: BSPReader.cs プロジェクト: lordee/LibBSP
        /// <summary>
        /// Gets the lump information at offset "<paramref name="offset"/>" for this BSP file when reading it as "<paramref name="version"/>".
        /// </summary>
        /// <param name="offset">The offset of the lump's information.</param>
        /// <param name="version">The type of BSP to interpret the file as.</param>
        /// <returns>A <see cref="LumpInfo"/> object containing information about the lump.</returns>
        private LumpInfo GetLumpInfoAtOffset(int offset, MapType version)
        {
            if (bspFile.Length < offset + 16)
            {
                return(new LumpInfo());
            }
            byte[] input;
            using (FileStream stream = new FileStream(bspFile.FullName, FileMode.Open, FileAccess.Read)) {
                BinaryReader binaryReader = new BinaryReader(stream);
                stream.Seek(offset, SeekOrigin.Begin);
                input = binaryReader.ReadBytes(16);
                binaryReader.Close();
            }
            if (version == MapType.TacticalInterventionEncrypted)
            {
                input = XorWithKeyStartingAtIndex(input, offset);
            }

            int lumpOffset  = 0;
            int lumpLength  = 0;
            int lumpVersion = 0;
            int lumpIdent   = 0;

            if (version == MapType.L4D2)
            {
                lumpVersion = BitConverter.ToInt32(input, 0);
                lumpOffset  = BitConverter.ToInt32(input, 4);
                lumpLength  = BitConverter.ToInt32(input, 8);
                lumpIdent   = BitConverter.ToInt32(input, 12);
                // TODO: This is awful. Let's rework the enum to have internal ways to check engine forks.
            }
            else if (version == MapType.Source17 ||
                     version == MapType.Source18 ||
                     version == MapType.Source19 ||
                     version == MapType.Source20 ||
                     version == MapType.Source21 ||
                     version == MapType.Source22 ||
                     version == MapType.Source23 ||
                     version == MapType.Source27 ||
                     version == MapType.Vindictus ||
                     version == MapType.DMoMaM ||
                     version == MapType.TacticalInterventionEncrypted)
            {
                lumpOffset  = BitConverter.ToInt32(input, 0);
                lumpLength  = BitConverter.ToInt32(input, 4);
                lumpVersion = BitConverter.ToInt32(input, 8);
                lumpIdent   = BitConverter.ToInt32(input, 12);
            }
            else if (version == MapType.CoD || version == MapType.CoD2)
            {
                lumpLength = BitConverter.ToInt32(input, 0);
                lumpOffset = BitConverter.ToInt32(input, 4);
            }
            else
            {
                lumpOffset = BitConverter.ToInt32(input, 0);
                lumpLength = BitConverter.ToInt32(input, 4);
            }

            /*if (bigEndian) {
             *      byte[] bytes = BitConverter.GetBytes(lumpLength);
             *      Array.Reverse(bytes);
             *      lumpLength = BitConverter.ToInt32(bytes, 0);
             *      bytes = BitConverter.GetBytes(lumpOffset);
             *      Array.Reverse(bytes);
             *      lumpOffset = BitConverter.ToInt32(bytes, 0);
             * }*/

            return(new LumpInfo()
            {
                offset = lumpOffset,
                length = lumpLength,
                version = lumpVersion,
                ident = lumpIdent
            });
        }
コード例 #36
0
ファイル: BSPReader.cs プロジェクト: lordee/LibBSP
        /// <summary>
        /// Gets the information for lump "<paramref name="index"/>" for this BSP file when reading it as "<paramref name="version"/>".
        /// </summary>
        /// <param name="index">The numerical index of this lump.</param>
        /// <param name="version">The type of BSP to interpret the file as.</param>
        /// <returns>A <see cref="LumpInfo"/> object containing information about the lump.</returns>
        /// <exception cref="IndexOutOfRangeException">"<paramref name="index"/>" is less than zero, or greater than the number of lumps allowed by "<paramref name="version"/>".</exception>
        public LumpInfo GetLumpInfo(int index, MapType version)
        {
            if (index < 0 || index >= BSP.GetNumLumps(version))
            {
                throw new IndexOutOfRangeException();
            }

            switch (version)
            {
            case MapType.Quake:
            case MapType.Nightfire: {
                return(GetLumpInfoAtOffset(4 + (8 * index), version));
            }

            case MapType.Quake2:
            case MapType.Daikatana:
            case MapType.SiN:
            case MapType.SoF:
            case MapType.Quake3:
            case MapType.Raven:
            case MapType.CoD:
            case MapType.CoD2: {
                return(GetLumpInfoAtOffset(8 + (8 * index), version));
            }

            case MapType.STEF2:
            case MapType.STEF2Demo:
            case MapType.MOHAA:
            case MapType.FAKK: {
                return(GetLumpInfoAtOffset(12 + (8 * index), version));
            }

            case MapType.Source17:
            case MapType.Source18:
            case MapType.Source19:
            case MapType.Source20:
            case MapType.Source21:
            case MapType.Source22:
            case MapType.Source23:
            case MapType.Source27:
            case MapType.L4D2:
            case MapType.TacticalInterventionEncrypted:
            case MapType.Vindictus:
            case MapType.DMoMaM: {
                if (lumpFiles == null)
                {
                    LoadLumpFiles();
                }
                if (lumpFiles.ContainsKey(index))
                {
                    return(lumpFiles[index]);
                }
                return(GetLumpInfoAtOffset(8 + (16 * index), version));
            }

            case MapType.CoD4: {
                using (FileStream stream = new FileStream(bspFile.FullName, FileMode.Open, FileAccess.Read)) {
                    BinaryReader binaryReader = new BinaryReader(stream);
                    stream.Seek(8, SeekOrigin.Begin);
                    int numlumps = binaryReader.ReadInt32();
                    int offset   = (numlumps * 8) + 12;
                    for (int i = 0; i < numlumps; i++)
                    {
                        int id     = binaryReader.ReadInt32();
                        int length = binaryReader.ReadInt32();
                        if (id == index)
                        {
                            return(new LumpInfo()
                                {
                                    offset = offset,
                                    length = length
                                });
                        }
                        else
                        {
                            offset += length;
                            while (offset % 4 != 0)
                            {
                                offset++;
                            }
                        }
                    }
                    binaryReader.Close();
                }
                return(new LumpInfo());
            }

            default: {
                return(null);
            }
            }
        }
コード例 #37
0
        ////////////////////////////////////////////////////////////////////////////

        protected override void GenSelectStoreFunctions(MapType abstractedType, TypeCtorDecl synonym,
                                                        out Function /*!*/ select, out Function /*!*/ store)
        {
            //Contract.Requires(synonym != null);
//Contract.Requires(abstractedType != null);
            Contract.Ensures(Contract.ValueAtReturn(out select) != null);
            Contract.Ensures(Contract.ValueAtReturn(out store) != null);
            Contract.Assert(synonym.Name != null);
            string /*!*/
                baseName     = synonym.Name;
            int typeParamNum = abstractedType.FreeVariables.Count +
                               abstractedType.TypeParameters.Count;

            int arity = typeParamNum + abstractedType.Arguments.Count;

            Type /*!*/[] /*!*/
            selectTypes = new Type /*!*/ [arity + 2];
            Type /*!*/[] /*!*/
            storeTypes = new Type /*!*/ [arity + 3];

            int i = 0;

            // Fill in the free variables and type parameters
            for (; i < typeParamNum; i++)
            {
                selectTypes[i] = AxBuilder.T;
                storeTypes[i]  = AxBuilder.T;
            }

            // Fill in the map type
            selectTypes[i] = AxBuilder.U;
            storeTypes[i]  = AxBuilder.U;
            i++;
            // Fill in the index types
            foreach (Type /*!*/ type in abstractedType.Arguments)
            {
                Contract.Assert(type != null);
                selectTypes[i] = AxBuilder.U;
                storeTypes[i]  = AxBuilder.U;
                i++;
            }

            // Fill in the output type for select function which also happens
            // to be the type of the last argument to the store function
            selectTypes[i] = AxBuilder.U;
            storeTypes[i]  = AxBuilder.U;
            i++;
            // Fill in the map type which is the output of the store function
            storeTypes[i] = AxBuilder.U;
            Contract.Assert(cce.NonNullElements <Type>(selectTypes));
            Contract.Assert(cce.NonNullElements <Type>(storeTypes));

            select = HelperFuns.BoogieFunction(baseName + "Select", selectTypes);
            store  = HelperFuns.BoogieFunction(baseName + "Store", storeTypes);

            if (CommandLineOptions.Clo.UseArrayTheory)
            {
                select.AddAttribute("builtin", "select");
                store.AddAttribute("builtin", "store");
            }
            else
            {
                AxBuilder.AddTypeAxiom(GenMapAxiom0(select, store,
                                                    abstractedType.TypeParameters.Count, abstractedType.FreeVariables.Count));
                AxBuilder.AddTypeAxiom(GenMapAxiom1(select, store,
                                                    abstractedType.TypeParameters.Count, abstractedType.FreeVariables.Count));
            }
        }
コード例 #38
0
 public RawTile(MapType Type, GPoint Pos, int Zoom)
 {
     this.Type = Type;
     this.Pos  = Pos;
     this.Zoom = Zoom;
 }
コード例 #39
0
    public IEnumerator LoadTexture(MapType textureToLoad, string pathToFile)
    {
        Busy = true;

        Texture2D newTexture = null;

        pathToFile = Uri.UnescapeDataString(pathToFile);

        if (File.Exists(pathToFile))
        {
            var fileData = File.ReadAllBytes(pathToFile);
            newTexture = new Texture2D(2, 2);
            newTexture.LoadImage(fileData); //..this will auto-resize the texture dimensions.
        }

        if (!newTexture)
        {
            yield break;
        }
        newTexture.anisoLevel = 9;


        switch (textureToLoad)
        {
        case MapType.Height:
            MainGui.Instance.HeightMap = newTexture;
            break;

        case MapType.Diffuse:
            MainGui.Instance.DiffuseMap = newTexture;
            break;

        case MapType.DiffuseOriginal:
            MainGui.Instance.DiffuseMapOriginal = newTexture;
            break;

        case MapType.Normal:
            MainGui.Instance.NormalMap = newTexture;
            break;

        case MapType.Metallic:
            MainGui.Instance.MetallicMap = newTexture;
            break;

        case MapType.Smoothness:
            MainGui.Instance.SmoothnessMap = newTexture;
            break;

        case MapType.Edge:
            MainGui.Instance.EdgeMap = newTexture;
            break;

        case MapType.Ao:
            MainGui.Instance.AoMap = newTexture;
            break;

        case MapType.Property:
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(textureToLoad), textureToLoad, null);
        }

        MainGui.Instance.SetLoadedTexture(textureToLoad);

        Resources.UnloadUnusedAssets();


        yield return(new WaitForSeconds(0.01f));

        Busy = false;
    }
コード例 #40
0
        public TileMap(int width, int height, MapType type, GameScreen screen, TileMap oldMap)
        {
            this.GScreen = screen;
            this.Width   = width;
            this.Height  = height;
            this.OldMap  = oldMap;

            // Init
            numEntities  = 0;
            DeadEntities = new List <Entity>();

            Map         = new List <TileBlock>();
            Entities    = new List <Entity>();
            GameObjects = new List <GameObject>();
            Attacks     = new List <Attack>();
            HitTexts    = new List <HitText>();


            switch (type)
            {
            case MapType.Treasure:
                setBackground(GameScreen.Backgrounds[BackgroundId.Cave1]);
                for (int w = 0; w < width; w++)
                {
                    for (int h = 0; h < height; h++)
                    {
                        if (h == height - 2 && w == 0)
                        {
                            Map.Add(TileBlock.IRON_DOOR.Clone().addEvent(TileBlockEvent.MapGoBack));
                        }
                        else if (h == 0 || h == height - 1)
                        {
                            Map.Add(TileBlock.STONE_WALL.Clone());
                        }
                        else if (w > 2 && w < width - 2 && h == height - 2 && ScreenManager.Rand.Next(width / 3) == 0)
                        {
                            Map.Add(TileBlock.CLOSED_CHEST.Clone());
                        }
                        else
                        {
                            Map.Add(TileBlock.NONE.Clone());
                        }
                    }
                }
                break;

            case MapType.Hall:
            default: // Hall Way
                setBackground(GameScreen.Backgrounds[BackgroundId.Cave1]);
                int specialCount = 0;
                for (int w = 0; w < width; w++)
                {
                    for (int h = 0; h < height; h++)
                    {
                        if (h == height - 2 && w == width - 1)
                        {
                            Map.Add(TileBlock.DOOR.Clone());
                            addRandomEntity(w * SPRITE_SIZE, h * SPRITE_SIZE, screen);
                        }
                        else if (h == 0 || h == height - 1)
                        {
                            Map.Add(TileBlock.STONE_WALL.Clone());
                        }
                        else if (w > 3 && w < width - 2 && h == height - 2 && ScreenManager.Rand.Next(25) == 0)
                        {
                            Map.Add(TileBlock.STONE_WALL.Clone());
                        }
                        else if (w > 3 && w < width - 2 && h == height - 2 && ScreenManager.Rand.Next(25) == 0)
                        {
                            Map.Add(TileBlock.STONE2_WALL.Clone());
                        }
                        else if (specialCount == 0 && w > 2 && h == height - 2 && ScreenManager.Rand.Next(150) == 0)
                        {
                            specialCount++;
                            Map.Add(TileBlock.HPPOOL.Clone());
                        }
                        else if (specialCount == 0 && w > 2 && h == height - 2 && ScreenManager.Rand.Next(200) == 0)
                        {
                            specialCount++;
                            Map.Add(TileBlock.IRON_DOOR.Clone().addEvent(TileBlockEvent.NewTreasureRoom));
                        }
                        else
                        {
                            Map.Add(TileBlock.NONE.Clone());

                            if (h == height - 2 && w > 4 && ScreenManager.Rand.Next(12) == 0)
                            {
                                addRandomEntity(w * SPRITE_SIZE, h * SPRITE_SIZE, screen);
                            }
                        }
                    }
                }
                break;
            }
        }
コード例 #41
0
 public static extern uint MapVirtualKey(uint uCode, MapType uMapType);
コード例 #42
0
ファイル: VariableManager.cs プロジェクト: zvonimir/corral
        public VariableManager(ProgramInfo pinfo)
        {
            varkName           = "k";
            csProcName         = "contextSwitch";
            raiseExceptionName = "raiseException";
            errorVarName       = "assertsPassed";
            inAtomicBlockName  = "inAtomicBlock";
            tidVarName         = LanguageSemantics.tidName;
            tidCountVarName    = "tidCount";
            oldkVarName        = "old_k";
            oldtidVarName      = "old_tid";

            cbaMainName = pinfo.mainProcName;
            csProcBound = -1;

            vark = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, varkName, Microsoft.Boogie.Type.Int));

            raiseException = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, raiseExceptionName,
                                                                              Microsoft.Boogie.Type.Bool));

            errorVar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, errorVarName,
                                                                        Microsoft.Boogie.Type.Bool));

            inAtomicBlock = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, inAtomicBlockName,
                                                                             Microsoft.Boogie.Type.Bool));

            tidVar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, tidVarName,
                                                                      pinfo.threadIdType));

            tidCountVar = new GlobalVariable(Token.NoToken, new TypedIdent(Token.NoToken, tidCountVarName,
                                                                           pinfo.threadIdType));

            // Construct type int -> bool
            var ts = new List <Microsoft.Boogie.Type>();

            ts.Add(pinfo.threadIdType);
            MapType mt = new MapType(Token.NoToken, new List <TypeVariable>(), ts, Microsoft.Boogie.Type.Bool);

            // Construct type int -> int
            mt = new MapType(Token.NoToken, new List <TypeVariable>(), ts, Microsoft.Boogie.Type.Int);

            oldkLocalVars   = new Dictionary <string, LocalVariable>();
            oldtidLocalVars = new Dictionary <string, LocalVariable>();

            declaredGlobals = pinfo.declaredGlobals;

            numCopiesCreated = 0;
            gblVarCopies     = new Dictionary <string, List <GlobalVariable> >();
            gblVarInitCopies = new Dictionary <string, List <GlobalVariable> >();

            // Make some copies for now
            makeCopies(1);

            // Check if any of variables we're going to insert
            // have any clashes with what is existing
            if (declaredGlobals.ContainsKey(varkName) ||
                declaredGlobals.ContainsKey(raiseExceptionName) ||
                declaredGlobals.ContainsKey(errorVarName) ||
                declaredGlobals.ContainsKey(inAtomicBlockName) ||
                pinfo.allProcs.Contains(csProcName))
            {
                throw new InvalidProg("Possible name clashes!");
            }
        }
コード例 #43
0
        /// <summary>
        /// Returns a texture <see cref="name"/> with back slashes converted to forward slashes,
        /// Source cubemap names fixed, etc.
        /// </summary>
        /// <param name="name">The name of the texture to process.</param>
        /// <param name="mapType">The <see cref="MapType"/> of the BSP this texture name is from.</param>
        /// <returns>A sanitized version of the passed <paramref name="name"/>.</returns>
        public static string SanitizeName(string name, MapType mapType)
        {
            string sanitized = name.Replace('\\', '/');

            switch (mapType)
            {
            case MapType.Vindictus:
            case MapType.TacticalInterventionEncrypted:
            case MapType.Source17:
            case MapType.Source18:
            case MapType.Source19:
            case MapType.Source20:
            case MapType.Source21:
            case MapType.Source22:
            case MapType.Source23:
            case MapType.Source27:
            case MapType.L4D2:
            case MapType.DMoMaM:
            case MapType.Titanfall: {
                if (sanitized.Length >= 5 && sanitized.Substring(0, 5).Equals("maps/", StringComparison.InvariantCultureIgnoreCase))
                {
                    sanitized = sanitized.Substring(5);
                    for (int i = 0; i < sanitized.Length; ++i)
                    {
                        if (sanitized[i] == '/')
                        {
                            sanitized = sanitized.Substring(i + 1);
                            break;
                        }
                    }
                }

                // Parse cubemap textures
                // TODO: Use regex? .{1,}(_-?[0-9]{1,}){3}$
                int  numUnderscores = 0;
                bool validnumber    = false;
                for (int i = sanitized.Length - 1; i > 0; --i)
                {
                    if (sanitized[i] <= '9' && sanitized[i] >= '0')
                    {
                        // Current is a number, this may be a cubemap reference
                        validnumber = true;
                    }
                    else
                    {
                        if (sanitized[i] == '-')
                        {
                            // Current is a minus sign (-).
                            if (!validnumber)
                            {
                                break;                                         // Make sure there's a number to add the minus sign to. If not, kill the loop.
                            }
                        }
                        else
                        {
                            if (sanitized[i] == '_')
                            {
                                // Current is an underscore (_)
                                if (validnumber)
                                {
                                    // Make sure there is a number in the current string
                                    ++numUnderscores;                                             // before moving on to the next one.
                                    if (numUnderscores == 3)
                                    {
                                        // If we've got all our numbers
                                        sanitized = sanitized.Substring(0, i);                                                 // Cut the texture string
                                    }
                                    validnumber = false;
                                }
                                else
                                {
                                    // No number after the underscore
                                    break;
                                }
                            }
                            else
                            {
                                // Not an acceptable character
                                break;
                            }
                        }
                    }
                }
                break;
            }
            }
            return(sanitized);
        }
コード例 #44
0
ファイル: MapUtil.cs プロジェクト: osorensen/PurplePen
        public const int DefaultMetricMargin = 28; // 7mm



        // Validate the map file to make sure it is readable. If OK, return true and set the scale.
        // If not OK, return false and set the error message. 
        public static bool ValidateMapFile(string mapFileName, out float scale, out float dpi, out Size bitmapSize, out RectangleF mapBounds, out MapType mapType, out string errorMessageText)
        {
            scale = 0; dpi = 0;
            mapType = MapType.None;
            bitmapSize = new Size();
            string fileExtension = Path.GetExtension(mapFileName);

            if (string.Compare(fileExtension, ".pdf", StringComparison.InvariantCultureIgnoreCase) == 0) {
                if (ValidatePdf(mapFileName, out dpi, out bitmapSize, out errorMessageText) != null) {
                    mapType = MapType.PDF;
                    mapBounds = new RectangleF(0, 0, (float)bitmapSize.Width / dpi * 25.4F, (float) bitmapSize.Height / dpi * 25.4F);
                    return true;
                }
                else {
                    mapBounds = new RectangleF();
                    return false;
                }
            }

            Map map = new Map(TextMetricsProvider, new GDIPlus_FileLoader(Path.GetDirectoryName(mapFileName)));

            try {
                InputOutput.ReadFile(mapFileName, map);
            }
            catch (Exception e) {
                // Didn't load as an OCAD file. If it has a non-OCD/OpenMapper extension, try loading as an image.
                if ((string.Compare(fileExtension, ".ocd", StringComparison.InvariantCultureIgnoreCase) != 0) && 
                    (string.Compare(fileExtension, ".omap", StringComparison.InvariantCultureIgnoreCase) != 0) &&
                    (string.Compare(fileExtension, ".xmap", StringComparison.InvariantCultureIgnoreCase) != 0)) 
                {
                    try {
                        Bitmap bitmap = (Bitmap) Image.FromFile(mapFileName);
                        bitmapSize = bitmap.Size;
                        dpi = bitmap.HorizontalResolution;
                        bitmap.Dispose();
                        mapType = MapType.Bitmap;
                        mapBounds = new RectangleF(0, 0, (float)bitmapSize.Width / dpi * 25.4F, (float)bitmapSize.Height / dpi * 25.4F);
                        errorMessageText = "";
                        return true;
                    }
                    catch {
                        // Wasn't an bitmap file either.
                        errorMessageText = string.Format(MiscText.CannotReadImageFile, mapFileName);
                        mapBounds = new RectangleF();
                        return false;
                    }
                }

                if (string.Compare(fileExtension, ".ocd", StringComparison.InvariantCultureIgnoreCase) == 0) {
                    errorMessageText = string.Format(MiscText.CannotReadMap, e.Message);
                }
                else {
                    errorMessageText = string.Format(MiscText.CannotReadMapOOM, e.Message);
                }

                mapBounds = new RectangleF();
                return false;
            }

            using (map.Read())
            {
                scale = map.MapScale;
                mapBounds = map.Bounds;
            }

            errorMessageText = "";
            mapType = MapType.OCAD;
            return true;
        }
コード例 #45
0
ファイル: LifeGame.cs プロジェクト: Ranats/LifeRogue
    public void LoadMap(int x, int y, MapType map = MapType.galaxy, TextAsset mapAsset = null)
    {
        print("load");

        /**        System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(Application.dataPath+"/Resources/Map");
         *      System.IO.FileInfo[] info = dir.GetFiles("*.csv");
         *      foreach(System.IO.FileInfo f in info)
         *      {
         *          print(f.Name);
         *      }
         **/
        TextAsset csvFile;

        if (mapAsset != null)
        {
            csvFile = mapAsset;
        }
        else
        {
            csvFile = Resources.Load("Map/" + map.ToString()) as TextAsset;
        }
        StringReader    reader   = new StringReader(csvFile.text);
        List <string[]> csvDatas = new List <string[]>();

        int i = 0;

        while (reader.Peek() > -1)
        {
            string line = reader.ReadLine();

            int j = 0;
            foreach (string cell in line.Split(','))
            {
                if (cell == "1")
                {
                    cells[y + j, x + i].Birth();
                    cells[y + j, x + i].isAlive = true;
                    cells[y + j, x + i].Living  = true;
                }
                else
                {
                    print(x + i);
                    print(y + j);
                    cells[y + j, x + i].Die();
                    cells[y + j, x + i].isAlive = false;
                    cells[y + j, x + i].Living  = false;
                }

                if (cell == "g")
                {
                    cells[y + j, x + i].isGoal = true;

                    float      xPos = (GRID_SIZE - 1) - (x + i * CELL_SIZE) - 2f;
                    float      yPos = (GRID_SIZE - 1) - (y + j * CELL_SIZE);
                    GameObject obj  = GameObject.Instantiate(goalPrefab);
                    obj.transform.position = new Vector3(xPos, yPos, 0);

                    goal = new Vector2(i, j);
                }
                else
                {
                    cells[y + j, x + i].isGoal = false;
                }

                //                GameObject obj = GameObjectCommon.InstantiateChild(goalPrefab, pos, cells[y + j, x + i].transform);
                //obj.transform.localScale = Vector3.one * CELL_SIZE;

                j++;
            }
            i++;
            //            csvDatas.Add(line.Split(','));
        }
    }
コード例 #46
0
 /// <summary>
 /// Depending on format, this is a variable length structure. Return -1. The <see cref="Textures"/> class will handle object creation.
 /// </summary>
 /// <param name="mapType">The <see cref="LibBSP.MapType"/> of the BSP.</param>
 /// <param name="lumpVersion">The version number for the lump.</param>
 /// <returns>-1</returns>
 public static int GetStructLength(MapType type, int version)
 {
     return(-1);
 }
コード例 #47
0
ファイル: BSPReader.cs プロジェクト: lordee/LibBSP
        /// <summary>
        /// Tries to get the <see cref="MapType"/> member most closely represented by the referenced file.
        /// </summary>
        /// <param name="bigEndian">Set to <c>true</c> to attempt reading the data in big-endian byte order.</param>
        /// <returns>The <see cref="MapType"/> of this BSP, <see cref="MapType.Undefined"/> if it could not be determined.</returns>
        private MapType GetVersion(bool bigEndian)
        {
            MapType current = MapType.Undefined;

            using (FileStream stream = new FileStream(bspFile.FullName, FileMode.Open, FileAccess.Read)) {
                BinaryReader binaryReader = new BinaryReader(stream);
                stream.Seek(0, SeekOrigin.Begin);
                int data = binaryReader.ReadInt32();
                if (bigEndian)
                {
                    byte[] bytes = BitConverter.GetBytes(data);
                    Array.Reverse(bytes);
                    data = BitConverter.ToInt32(bytes, 0);
                }
                if (data == 1347633737)
                {
                    // 1347633737 reads in ASCII as "IBSP"
                    // Versions: CoD, CoD2, CoD4, Quake 2, Daikatana, Quake 3 (RtCW), Soldier of Fortune
                    data = binaryReader.ReadInt32();
                    if (bigEndian)
                    {
                        byte[] bytes = BitConverter.GetBytes(data);
                        Array.Reverse(bytes);
                        data = BitConverter.ToInt32(bytes, 0);
                    }
                    switch (data)
                    {
                    case 4: {
                        current = MapType.CoD2;
                        break;
                    }

                    case 22: {
                        current = MapType.CoD4;
                        break;
                    }

                    case 38: {
                        current = MapType.Quake2;
                        break;
                    }

                    case 41: {
                        current = MapType.Daikatana;
                        break;
                    }

                    case 46: {
                        current = MapType.Quake3;
                        // This version number is both Quake 3 and Soldier of Fortune. Find out the length of the
                        // header, based on offsets.
                        for (int i = 0; i < 17; i++)
                        {
                            stream.Seek((i + 1) * 8, SeekOrigin.Begin);
                            int temp = binaryReader.ReadInt32();
                            if (bigEndian)
                            {
                                byte[] bytes = BitConverter.GetBytes(temp);
                                Array.Reverse(bytes);
                                temp = BitConverter.ToInt32(bytes, 0);
                            }
                            if (temp == 184)
                            {
                                current = MapType.SoF;
                                break;
                            }
                            else
                            {
                                if (temp == 144)
                                {
                                    break;
                                }
                            }
                        }
                        break;
                    }

                    case 47: {
                        current = MapType.Quake3;
                        break;
                    }

                    case 59: {
                        current = MapType.CoD;
                        break;
                    }
                    }
                }
                else
                {
                    if (data == 892416050)
                    {
                        // 892416050 reads in ASCII as "2015," the game studio which developed MoHAA
                        current = MapType.MOHAA;
                    }
                    else
                    {
                        if (data == 1095516485)
                        {
                            // 1095516485 reads in ASCII as "EALA," the ones who developed MoHAA Spearhead and Breakthrough
                            current = MapType.MOHAA;
                        }
                        else
                        {
                            if (data == 1347633750)
                            {
                                // 1347633750 reads in ASCII as "VBSP." Indicates Source engine.
                                // Some source games handle this as 2 shorts.
                                // TODO: Big endian?
                                // Formats: Source 17-23 and 27, DMoMaM, Vindictus
                                data = (int)binaryReader.ReadUInt16();
                                switch (data)
                                {
                                case 17: {
                                    current = MapType.Source17;
                                    break;
                                }

                                case 18: {
                                    current = MapType.Source18;
                                    break;
                                }

                                case 19: {
                                    current = MapType.Source19;
                                    break;
                                }

                                case 20: {
                                    int version2 = (int)binaryReader.ReadUInt16();
                                    if (version2 == 4)
                                    {
                                        // TODO: This doesn't necessarily mean the whole map should be read as DMoMaM.
                                        current = MapType.DMoMaM;
                                    }
                                    else
                                    {
                                        // TODO: Vindictus? Before I was determining these by looking at the Game Lump data, is there a better way?
                                        current = MapType.Source20;
                                    }
                                    break;
                                }

                                case 21: {
                                    current = MapType.Source21;
                                    // Hack to determine if this is a L4D2 map. Read what would normally be the offset of
                                    // a lump. If it is less than the header length it's probably not an offset, indicating L4D2.
                                    stream.Seek(8, SeekOrigin.Begin);
                                    int test = binaryReader.ReadInt32();
                                    if (bigEndian)
                                    {
                                        byte[] bytes = BitConverter.GetBytes(test);
                                        Array.Reverse(bytes);
                                        test = BitConverter.ToInt32(bytes, 0);
                                    }
                                    if (test < 1032)
                                    {
                                        current = MapType.L4D2;
                                    }
                                    break;
                                }

                                case 22: {
                                    current = MapType.Source22;
                                    break;
                                }

                                case 23: {
                                    current = MapType.Source23;
                                    break;
                                }

                                case 27: {
                                    current = MapType.Source27;
                                    break;
                                }
                                }
                            }
                            else
                            {
                                if (data == 1347633746)
                                {
                                    // Reads in ASCII as "RBSP". Raven software's modification of Q3BSP, or Ritual's modification of Q2.
                                    // Formats: Raven, SiN
                                    current = MapType.Raven;
                                    for (int i = 0; i < 17; i++)
                                    {
                                        // Find out where the first lump starts, based on offsets.
                                        stream.Seek((i + 1) * 8, SeekOrigin.Begin);
                                        int temp = binaryReader.ReadInt32();
                                        if (bigEndian)
                                        {
                                            byte[] bytes = BitConverter.GetBytes(temp);
                                            Array.Reverse(bytes);
                                            temp = BitConverter.ToInt32(bytes, 0);
                                        }
                                        if (temp == 168)
                                        {
                                            current = MapType.SiN;
                                            break;
                                        }
                                        else
                                        {
                                            if (temp == 152)
                                            {
                                                break;
                                            }
                                        }
                                    }
                                }
                                else
                                {
                                    if (data == 556942917)
                                    {
                                        // "EF2!"
                                        current = MapType.STEF2;
                                    }
                                    else
                                    {
                                        if (data == 1263223110)
                                        {
                                            // "FAKK"
                                            // Formats: STEF2 demo, Heavy Metal FAKK2 (American McGee's Alice)
                                            data = binaryReader.ReadInt32();
                                            if (bigEndian)
                                            {
                                                byte[] bytes = BitConverter.GetBytes(data);
                                                Array.Reverse(bytes);
                                                data = BitConverter.ToInt32(bytes, 0);
                                            }
                                            switch (data)
                                            {
                                            case 19: {
                                                current = MapType.STEF2Demo;
                                                break;
                                            }

                                            case 12:
                                            case 42: {                                                    // American McGee's Alice
                                                current = MapType.FAKK;
                                                break;
                                            }
                                            }
                                        }
                                        else
                                        {
                                            switch (data)
                                            {
                                            // Various numbers not representing a string
                                            // Formats: HL1, Quake, Nightfire, or perhaps Tactical Intervention's encrypted format
                                            case 29:
                                            case 30: {
                                                current = MapType.Quake;
                                                break;
                                            }

                                            case 42: {
                                                current = MapType.Nightfire;
                                                break;
                                            }

                                            default: {
                                                // Hack to get Tactical Intervention's encryption key. At offset 384, there are two unused lumps whose
                                                // values in the header are always 0s. Grab these 32 bytes (256 bits) and see if they match an expected value.
                                                stream.Seek(384, SeekOrigin.Begin);
                                                key = binaryReader.ReadBytes(32);
                                                stream.Seek(0, SeekOrigin.Begin);
                                                data = BitConverter.ToInt32(XorWithKeyStartingAtIndex(binaryReader.ReadBytes(4)), 0);
                                                if (data == 1347633750)
                                                {
                                                    current = MapType.TacticalInterventionEncrypted;
                                                }
                                                else
                                                {
                                                    current = MapType.Undefined;
                                                }
                                                break;
                                            }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                binaryReader.Close();
            }
            return(current);
        }
コード例 #48
0
ファイル: PrimitiveAdapter.cs プロジェクト: mehedi101/Mapster
 protected override bool CanMap(Type sourceType, Type destinationType, MapType mapType)
 {
     return(true);
 }
コード例 #49
0
 public override MapType VisitMapType(MapType node)
 {
     throw new NotImplementedException();
 }
コード例 #50
0
ファイル: MapInfo.cs プロジェクト: ywqy/GD
 public MapInfo(MapType mapType, Vector2Int size)
 {
 }
コード例 #51
0
 internal MapArea(string var1, MapType var2, int var3)
 {
     areaName = var1;
     type     = var2;
     ID       = var3;
 }
コード例 #52
0
 public static bool HCMapSupported(MapType type) => SupportedHCMaps.Contains(type);
コード例 #53
0
    public float GetAxis(AxisMethodName g_input, int g_joystickNumber, JoystickAxis g_axis)
    {
        //check if it use simulator
        if (useSimulator)
        {
            foreach (JellyJoystickSimulator t_simulator in myJellyJoystickSimulators)
            {
                if (t_simulator.myJoystickNumber == g_joystickNumber)
                {
                    foreach (JellyJoystickSimulator.Axis t_axis in t_simulator.myAxes)
                    {
                        if (t_axis.myJoystickAxis == g_axis)
                        {
                            float t_value = t_simulator.GetAxis(t_axis);
                            if (t_value != 0)
                            {
                                return(t_value);
                            }
                            break;
                        }
                    }
                    break;
                }
            }
        }

        //get the input function
        AxisMethod t_InputFunction;

        if (g_input == AxisMethodName.Normal)
        {
            t_InputFunction = Input.GetAxis;
        }
        else
        {
            t_InputFunction = Input.GetAxisRaw;
        }

        //0 -> all; 1-8 -> joystick1-8
        g_joystickNumber = Mathf.Clamp(g_joystickNumber, 0, NUMBER_MAX_JOYSTICK);

        if (g_joystickNumber != 0)
        {
            //get the map type
            MapType t_mapType = myMapTypes [g_joystickNumber - 1];

            if (t_mapType == MapType.PS4)
            {
                if (g_axis == JoystickAxis.LS_X)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis1"));
                }
                if (g_axis == JoystickAxis.LS_Y)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis2") * -1);
                }

                if (g_axis == JoystickAxis.RS_X)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis3"));
                }
                if (g_axis == JoystickAxis.RS_Y)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis4") * -1);
                }

                if (g_axis == JoystickAxis.LT)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis5"));
                }
                if (g_axis == JoystickAxis.RT)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis6"));
                }
            }
            else if (t_mapType == MapType.OSX_XBOX)
            {
                if (g_axis == JoystickAxis.LS_X)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis1"));
                }
                if (g_axis == JoystickAxis.LS_Y)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis2") * -1);
                }

                if (g_axis == JoystickAxis.RS_X)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis3"));
                }
                if (g_axis == JoystickAxis.RS_Y)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis4") * -1);
                }

                if (g_axis == JoystickAxis.LT)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis5"));
                }
                if (g_axis == JoystickAxis.RT)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis6"));
                }
            }
            else if (t_mapType == MapType.WIN_XBOX)
            {
                if (g_axis == JoystickAxis.LS_X)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis1"));
                }
                if (g_axis == JoystickAxis.LS_Y)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis2") * -1);
                }

                if (g_axis == JoystickAxis.RS_X)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis4"));
                }
                if (g_axis == JoystickAxis.RS_Y)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis5") * -1);
                }

                if (g_axis == JoystickAxis.LT)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis9"));
                }
                if (g_axis == JoystickAxis.RT)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis10"));
                }
            }
            else if (t_mapType == MapType.PS3)
            {
                if (g_axis == JoystickAxis.LS_X)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis2"));
                }
                if (g_axis == JoystickAxis.LS_Y)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis1") * -1);
                }

                if (g_axis == JoystickAxis.RS_X)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis3"));
                }
                if (g_axis == JoystickAxis.RS_Y)
                {
                    return(t_InputFunction("Joystick" + g_joystickNumber + "Axis5") * -1);
                }
            }
        }
        else
        {
            for (int i = 1; i <= NUMBER_MAX_JOYSTICK; i++)
            {
                float t_value = GetAxis(g_input, i, g_axis);
                if (t_value != 0)
                {
                    return(t_value);
                }
            }
        }
        return(0);
    }
コード例 #54
0
 public static bool IsCVMap(MapType type) => CVMaps.Contains(type);
コード例 #55
0
ファイル: MapInfo.cs プロジェクト: ywqy/GD
 public MapInfo(MapType mapType)
 {
     mType = mapType;
 }
コード例 #56
0
    private static void InitProviders()
    {
        providers = new []
        {
            new OnlineMapsProvider("arcgis", "ArcGIS (Esri)")
            {
                url    = "https://server.arcgisonline.com/ArcGIS/rest/services/{variant}/MapServer/tile/{zoom}/{y}/{x}",
                _types = new []
                {
                    new MapType("WorldImagery")
                    {
                        variantWithoutLabels = "World_Imagery"
                    },
                    new MapType("WorldTopoMap")
                    {
                        variantWithLabels = "World_Topo_Map"
                    },
                    new MapType("WorldStreetMap")
                    {
                        variantWithLabels = "World_Street_Map"
                    },
                    new MapType("DeLorme")
                    {
                        variantWithLabels = "Specialty/DeLorme_World_Base_Map"
                    },
                    new MapType("WorldTerrain")
                    {
                        variantWithoutLabels = "World_Terrain_Base"
                    },
                    new MapType("WorldShadedRelief")
                    {
                        variantWithoutLabels = "World_Shaded_Relief"
                    },
                    new MapType("WorldPhysical")
                    {
                        variantWithoutLabels = "World_Physical_Map"
                    },
                    new MapType("OceanBasemap")
                    {
                        variantWithLabels = "Ocean_Basemap"
                    },
                    new MapType("NatGeoWorldMap")
                    {
                        variantWithLabels = "NatGeo_World_Map"
                    },
                    new MapType("WorldGrayCanvas")
                    {
                        variantWithLabels = "Canvas/World_Light_Gray_Base"
                    },
                }
            },
            new OnlineMapsProvider("CartoDB")
            {
                url    = "https://cartodb-basemaps-d.global.ssl.fastly.net/{variant}/{z}/{x}/{y}.png",
                _types = new []
                {
                    new MapType("Positron")
                    {
                        variantWithLabels    = "light_all",
                        variantWithoutLabels = "light_nolabels"
                    },
                    new MapType("DarkMatter")
                    {
                        variantWithLabels    = "dark_all",
                        variantWithoutLabels = "dark_nolabels"
                    },
                }
            },
            new OnlineMapsProvider("DigitalGlobe")
            {
                url    = "https://a.tiles.mapbox.com/v4/digitalglobe.{variant}/{zoom}/{x}/{y}.jpg?access_token={accesstoken}",
                _types = new []
                {
                    new MapType("Satellite")
                    {
                        variantWithoutLabels = "nal0g75k"
                    },
                    new MapType("Street")
                    {
                        variantWithLabels = "nako6329",
                    },
                    new MapType("Terrain")
                    {
                        variantWithLabels = "nako1fhg",
                    },
                },
                extraFields = new []
                {
                    new ExtraField("Access Token", "accesstoken"),
                }
            },
            new OnlineMapsProvider("google", "Google Maps")
            {
                hasLanguage = true,
                _types      = new[]
                {
                    new MapType(SATELLITE)
                    {
                        urlWithLabels    = "https://mt{rnd0-3}.googleapis.com/vt/lyrs=y&hl={lng}&x={x}&y={y}&z={zoom}",
                        urlWithoutLabels = "https://khm{rnd0-3}.googleapis.com/kh?v=742&hl={lng}&x={x}&y={y}&z={zoom}",
                    },
                    new MapType(RELIEF)
                    {
                        urlWithLabels = "https://mts{rnd0-3}.google.com/vt/lyrs=t@131,r@216000000&src=app&hl={lng}&x={x}&y={y}&z={zoom}&s="
                    },
                    new MapType(TERRAIN)
                    {
                        urlWithLabels = "https://mt{rnd0-3}.googleapis.com/vt?pb=!1m4!1m3!1i{zoom}!2i{x}!3i{y}!2m3!1e0!2sm!3i295124088!3m9!2s{lng}!3sUS!5e18!12m1!1e47!12m3!1e37!2m1!1ssmartmaps!4e0"
                    }
                }
            },
            new OnlineMapsProvider("Hydda")
            {
                url    = "https://{s}.tile.openstreetmap.se/hydda/{variant}/{z}/{x}/{y}.png",
                _types = new []
                {
                    new MapType("Full")
                    {
                        variantWithLabels = "full"
                    },
                    new MapType("Base")
                    {
                        variantWithLabels = "base"
                    },
                    new MapType("RoadsAndLabels")
                    {
                        variantWithLabels = "roads_and_labels"
                    },
                }
            },
            new OnlineMapsProvider("Mapbox classic")
            {
                url           = "https://b.tiles.mapbox.com/v4/{mapid}/{zoom}/{x}/{y}.png?access_token={accesstoken}",
                labelsEnabled = true,

                _types = new []
                {
                    new MapType("Map"),
                },

                extraFields = new []
                {
                    new ExtraField("Map ID", "mapid"),
                    new ExtraField("Access Token", "accesstoken"),
                }
            },
            new OnlineMapsProvider("MapQuest")
            {
                url    = "https://a.tiles.mapbox.com/v4/{variant}/{zoom}/{x}/{y}.png?access_token={accesstoken}",
                _types = new []
                {
                    new MapType(SATELLITE)
                    {
                        variantWithoutLabels = "mapquest.satellite"
                    },
                    new MapType("Streets")
                    {
                        variantWithLabels = "mapquest.streets"
                    },
                },
                extraFields = new []
                {
                    new ToggleExtraGroup("Anonymous", true, new []
                    {
                        new ExtraField("Access Token", "accesstoken", "pk.eyJ1IjoibWFwcXVlc3QiLCJhIjoiY2Q2N2RlMmNhY2NiZTRkMzlmZjJmZDk0NWU0ZGJlNTMifQ.mPRiEubbajc6a5y9ISgydg")
                    })
                },
            },
            new OnlineMapsProvider("mapy", "Mapy.CZ")
            {
                url    = "https://m{rnd0-4}.mapserver.mapy.cz/{variant}/{zoom}-{x}-{y}",
                _types = new []
                {
                    new MapType(SATELLITE)
                    {
                        variantWithoutLabels = "ophoto-m"
                    },
                    new MapType("Travel")
                    {
                        variantWithLabels = "wturist-m"
                    },
                    new MapType("Winter")
                    {
                        variantWithLabels = "wturist_winter-m"
                    },
                    new MapType("Geographic")
                    {
                        variantWithLabels = "zemepis-m"
                    },
                    new MapType("Summer")
                    {
                        variantWithLabels = "turist_aquatic-m"
                    },
                    new MapType("19century", "19th century")
                    {
                        variantWithLabels = "army2-m"
                    },
                }
            },
            new OnlineMapsProvider("nokia", "Nokia Maps (here.com)")
            {
                url = "https://{rnd1-4}.maps.nlp.nokia.com/maptile/2.1/{prop}/newest/{variant}/{zoom}/{x}/{y}/256/png8?lg={lng}&app_id={appid}&app_code={appcode}",
                twoLetterLanguage = false,
                hasLanguage       = true,
                labelsEnabled     = true,
                prop = "maptile",

                _types = new []
                {
                    new MapType(SATELLITE)
                    {
                        variantWithLabels    = "hybrid.day",
                        variantWithoutLabels = "satellite.day",
                    },
                    new MapType(TERRAIN)
                    {
                        variant           = "terrain.day",
                        propWithoutLabels = "basetile",
                    },
                    new MapType(MAP)
                    {
                        variant           = "normal.day",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalDayCustom")
                    {
                        variant           = "normal.day.custom",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalDayGrey")
                    {
                        variant           = "normal.day.grey",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalDayMobile")
                    {
                        variant           = "normal.day.mobile",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalDayGreyMobile")
                    {
                        variant           = "normal.day.grey.mobile",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalDayTransit")
                    {
                        variant           = "normal.day.transit",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalDayTransitMobile")
                    {
                        variant           = "normal.day.transit.mobile",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalNight")
                    {
                        variant           = "normal.night",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalNightMobile")
                    {
                        variant           = "normal.night.mobile",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalNightGrey")
                    {
                        variant           = "normal.night.grey",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("normalNightGreyMobile")
                    {
                        variant           = "normal.night.grey.mobile",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("carnavDayGrey")
                    {
                        variantWithLabels = "carnav.day.grey",
                        propWithoutLabels = "basetile",
                    },
                    new MapType("pedestrianDay")
                    {
                        variantWithLabels = "pedestrian.day"
                    },
                    new MapType("pedestrianNight")
                    {
                        variantWithLabels = "pedestrian.night"
                    },
                },

                extraFields = new []
                {
                    new ToggleExtraGroup("Anonymous", true, new []
                    {
                        new ExtraField("App ID", "appid", "xWVIueSv6JL0aJ5xqTxb"),
                        new ExtraField("App Code", "appcode", "djPZyynKsbTjIUDOBcHZ2g"),
                    })
                }
            },
            new OnlineMapsProvider("OpenMapSurfer")
            {
                url    = "http://korona.geog.uni-heidelberg.de/tiles/{variant}/x={x}&y={y}&z={z}",
                _types = new []
                {
                    new MapType("Roads")
                    {
                        variantWithLabels = "roads"
                    },
                    new MapType("AdminBounds")
                    {
                        variantWithLabels = "adminb"
                    },
                    new MapType("Grayscale")
                    {
                        variantWithLabels = "roadsg"
                    },
                }
            },
            new OnlineMapsProvider("osm", "OpenStreetMap")
            {
                _types = new []
                {
                    new MapType("Mapnik")
                    {
                        urlWithLabels = "https://a.tile.openstreetmap.org/{zoom}/{x}/{y}.png"
                    },
                    new MapType("BlackAndWhite")
                    {
                        urlWithLabels = "http://a.tiles.wmflabs.org/bw-mapnik/{zoom}/{x}/{y}.png"
                    },
                    new MapType("DE")
                    {
                        urlWithLabels = "http://a.tile.openstreetmap.de/tiles/osmde/{zoom}/{x}/{y}.png"
                    },
                    new MapType("France")
                    {
                        urlWithLabels = "https://a.tile.openstreetmap.fr/osmfr/{zoom}/{x}/{y}.png"
                    },
                    new MapType("HOT")
                    {
                        urlWithLabels = "https://a.tile.openstreetmap.fr/hot/{zoom}/{x}/{y}.png"
                    },
                }
            },
            new OnlineMapsProvider("OpenTopoMap")
            {
                _types = new []
                {
                    new MapType("OpenTopoMap")
                    {
                        urlWithLabels = "https://a.tile.opentopomap.org/{z}/{x}/{y}.png"
                    },
                }
            },
            new OnlineMapsProvider("OpenWeatherMap")
            {
                url    = "http://a.tile.openweathermap.org/map/{variant}/{z}/{x}/{y}.png",
                _types = new []
                {
                    new MapType("Clouds")
                    {
                        variantWithoutLabels = "clouds"
                    },
                    new MapType("CloudsClassic")
                    {
                        variantWithoutLabels = "clouds_cls"
                    },
                    new MapType("Precipitation")
                    {
                        variantWithoutLabels = "precipitation"
                    },
                    new MapType("PrecipitationClassic")
                    {
                        variantWithoutLabels = "precipitation_cls"
                    },
                    new MapType("Rain")
                    {
                        variantWithoutLabels = "rain"
                    },
                    new MapType("RainClassic")
                    {
                        variantWithoutLabels = "rain_cls"
                    },
                    new MapType("Pressure")
                    {
                        variantWithoutLabels = "pressure"
                    },
                    new MapType("PressureContour")
                    {
                        variantWithoutLabels = "pressure_cntr"
                    },
                    new MapType("Wind")
                    {
                        variantWithoutLabels = "wind"
                    },
                    new MapType("Temperature")
                    {
                        variantWithoutLabels = "temp"
                    },
                    new MapType("Snow")
                    {
                        variantWithoutLabels = "snow"
                    },
                }
            },
            new OnlineMapsProvider("Stamen")
            {
                url    = "https://stamen-tiles-a.a.ssl.fastly.net/{variant}/{z}/{x}/{y}.png",
                _types = new []
                {
                    new MapType("Toner")
                    {
                        variantWithLabels = "toner"
                    },
                    new MapType("TonerBackground")
                    {
                        variantWithoutLabels = "toner-background"
                    },
                    new MapType("TonerHybrid")
                    {
                        variantWithLabels = "toner-hybrid"
                    },
                    new MapType("TonerLines")
                    {
                        variantWithLabels = "toner-lines"
                    },
                    new MapType("TonerLabels")
                    {
                        variantWithLabels = "toner-labels"
                    },
                    new MapType("TonerLite")
                    {
                        variantWithLabels = "toner-lite"
                    },
                    new MapType("Watercolor")
                    {
                        variantWithoutLabels = "watercolor"
                    },
                }
            },
            new OnlineMapsProvider("Thunderforest")
            {
                url    = "https://a.tile.thunderforest.com/{variant}/{z}/{x}/{y}.png",
                _types = new []
                {
                    new MapType("OpenCycleMap")
                    {
                        variantWithLabels = "cycle"
                    },
                    new MapType("Transport")
                    {
                        variantWithLabels = "transport"
                    },
                    new MapType("TransportDark")
                    {
                        variantWithLabels = "transport-dark"
                    },
                    new MapType("SpinalMap")
                    {
                        variantWithLabels = "spinal-map"
                    },
                    new MapType("Landscape")
                    {
                        variantWithLabels = "landscape"
                    },
                    new MapType("Outdoors")
                    {
                        variantWithLabels = "outdoors"
                    },
                    new MapType("Pioneer")
                    {
                        variantWithLabels = "pioneer"
                    },
                }
            },
            new OnlineMapsProvider("TianDiTu")
            {
                _types = new []
                {
                    new MapType("Normal")
                    {
                        urlWithoutLabels = "http://t{rnd0-7}.tianditu.cn/DataServer?T=vec_w&X={x}&Y={y}&L={z}"
                    },
                    new MapType(SATELLITE)
                    {
                        urlWithoutLabels = "http://t{rnd0-7}.tianditu.cn/DataServer?T=img_w&X={x}&Y={y}&L={z}"
                    },
                    new MapType(TERRAIN)
                    {
                        urlWithoutLabels = "http://t{rnd0-7}.tianditu.cn/DataServer?T=ter_w&X={x}&Y={y}&L={z}"
                    },
                }
            },
            new OnlineMapsProvider("virtualearth", "Virtual Earth (Bing Maps)")
            {
                hasLanguage = true,
                _types      = new []
                {
                    new MapType("Aerial")
                    {
                        urlWithoutLabels = "https://t{rnd0-4}.ssl.ak.tiles.virtualearth.net/tiles/a{quad}.jpeg?mkt={lng}&g=1457&n=z",
                        urlWithLabels    = "https://t{rnd0-4}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{quad}?mkt={lng}&it=A,G,L,LA&og=30&n=z"
                    },
                    new MapType("Road")
                    {
                        urlWithLabels = "https://t{rnd0-4}.ssl.ak.dynamic.tiles.virtualearth.net/comp/ch/{quad}?mkt={lng}&it=G,VE,BX,L,LA&og=30&n=z"
                    }
                }
            },
            new OnlineMapsProvider("yandex", "Yandex Maps")
            {
                projection = new OnlineMapsProjectionWGS84(),
                _types     = new []
                {
                    new MapType(MAP)
                    {
                        hasLanguage   = true,
                        urlWithLabels = "https://vec0{rnd1-4}.maps.yandex.net/tiles?l=map&v=4.65.1&x={x}&y={y}&z={zoom}&scale=1&lang={lng}"
                    },
                    new MapType(SATELLITE)
                    {
                        urlWithoutLabels = "https://sat0{rnd1-4}.maps.yandex.net/tiles?l=sat&v=3.261.0&x={x}&y={y}&z={zoom}"
                    },
                }
            },
            new OnlineMapsProvider("Other")
            {
                _types = new []
                {
                    new MapType("AMap Satellite")
                    {
                        urlWithoutLabels = "https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={zoom}"
                    },
                    new MapType("AMap Terrain")
                    {
                        urlWithLabels = "https://webrd03.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={zoom}"
                    },
                    new MapType("MtbMap")
                    {
                        urlWithLabels = "http://tile.mtbmap.cz/mtbmap_tiles/{z}/{x}/{y}.png"
                    },
                    new MapType("HikeBike")
                    {
                        urlWithLabels = "https://a.tiles.wmflabs.org/hikebike/{z}/{x}/{y}.png"
                    },
                }
            },
            new OnlineMapsProvider("Custom")
            {
                _types = new []
                {
                    new MapType("Custom")
                    {
                        isCustom = true
                    }
                }
            }
        };

        for (int i = 0; i < providers.Length; i++)
        {
            OnlineMapsProvider provider = providers[i];
            provider.index = i;
            for (int j = 0; j < provider._types.Length; j++)
            {
                MapType type = provider._types[j];
                type.provider = provider;
                type.fullID   = provider.id + "." + type.id;
                type.index    = j;
            }
        }
    }
コード例 #57
0
 public static bool MapHasRng(MapType type) => !MapsWithoutRNG.Contains(type);
コード例 #58
0
ファイル: NumList.cs プロジェクト: lordee/LibBSP
        /// <summary>
        /// Gets the index for the Mark Surfaces lump in the BSP file for a specific map format, and the type of data the format uses.
        /// </summary>
        /// <param name="version">The map type.</param>
        /// <param name="dataType"><c>out</c> parameter that will contain the data type this version uses.</param>
        /// <returns>Index for this lump, or -1 if the format doesn't have this lump or it's not implemented.</returns>
        public static int GetIndexForMarkSurfacesLump(MapType version, out DataType dataType)
        {
            switch (version)
            {
            case MapType.Raven:
            case MapType.Quake3: {
                dataType = DataType.Int32;
                return(5);
            }

            case MapType.FAKK:
            case MapType.MOHAA: {
                dataType = DataType.Int32;
                return(7);
            }

            case MapType.Quake2:
            case MapType.SiN:
            case MapType.Daikatana:
            case MapType.SoF: {
                dataType = DataType.UInt16;
                return(9);
            }

            case MapType.STEF2:
            case MapType.STEF2Demo: {
                dataType = DataType.UInt32;
                return(9);
            }

            case MapType.Quake: {
                dataType = DataType.UInt16;
                return(11);
            }

            case MapType.Nightfire: {
                dataType = DataType.UInt32;
                return(12);
            }

            case MapType.Vindictus: {
                dataType = DataType.UInt32;
                return(16);
            }

            case MapType.TacticalInterventionEncrypted:
            case MapType.Source17:
            case MapType.Source18:
            case MapType.Source19:
            case MapType.Source20:
            case MapType.Source21:
            case MapType.Source22:
            case MapType.Source23:
            case MapType.Source27:
            case MapType.L4D2:
            case MapType.DMoMaM: {
                dataType = DataType.UInt16;
                return(16);
            }

            case MapType.CoD: {
                dataType = DataType.UInt32;
                return(23);
            }
            }
            dataType = DataType.Invalid;
            return(-1);
        }
コード例 #59
0
ファイル: MainGui.cs プロジェクト: qjoseph/Materialize
    private void ClearTexture(MapType mapType)
    {
        switch (mapType)
        {
        case MapType.Height:
            if (HeightMap)
            {
                Destroy(HeightMap);
                HeightMap = null;
            }

            if (HdHeightMap)
            {
                Destroy(HdHeightMap);
                HdHeightMap = null;
            }

            break;

        case MapType.Diffuse:
            if (DiffuseMap)
            {
                Destroy(DiffuseMap);
                DiffuseMap = null;
            }

            if (DiffuseMapOriginal)
            {
                Destroy(DiffuseMapOriginal);
                DiffuseMapOriginal = null;
            }

            break;

        case MapType.Normal:
            if (NormalMap)
            {
                Destroy(NormalMap);
                NormalMap = null;
            }

            break;

        case MapType.Metallic:
            if (MetallicMap)
            {
                Destroy(MetallicMap);
                MetallicMap = null;
            }

            break;

        case MapType.Smoothness:
            if (SmoothnessMap)
            {
                Destroy(SmoothnessMap);
                SmoothnessMap = null;
            }

            break;

        case MapType.Edge:
            if (EdgeMap)
            {
                Destroy(EdgeMap);
                EdgeMap = null;
            }

            break;

        case MapType.Ao:
            if (AoMap)
            {
                Destroy(AoMap);
                AoMap = null;
            }

            break;

        case MapType.DiffuseOriginal:
            if (DiffuseMapOriginal)
            {
                Destroy(DiffuseMapOriginal);
                DiffuseMapOriginal = null;
            }

            break;

        case MapType.Property:
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(mapType), mapType, null);
        }

        Resources.UnloadUnusedAssets();
    }
コード例 #60
0
ファイル: HotKeyConverter.cs プロジェクト: msmcjp/mmfm
 private static extern uint MapVirtualKey(uint uCode, MapType uMapType);