本文整理汇总了C#中MapType类的典型用法代码示例。如果您正苦于以下问题:C# MapType类的具体用法?C# MapType怎么用?C# MapType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapType类属于命名空间,在下文中一共展示了MapType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CacheTiles
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: LumpFactory
/// <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;
}
示例3: Cubemap
/// <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.");
}
}
}
示例4: SetSummaryParameters
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);
}
示例5: Priority
public override int? Priority(Type sourceType, Type destinationType, MapType mapType)
{
if (sourceType.IsCollection() && destinationType.IsCollection())
return -125;
else
return null;
}
示例6: GoogleMapsDisclaimer
/// <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;
}
示例7: CreateExportUtility
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;
}
示例8: MapGenerator
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();
}
示例9: LoadAggregatedChampionStatistics
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;
}
}
示例10: MapInfo
public MapInfo(PureProjection Projection, RectLatLng Area, int Zoom, MapType Type)
{
this.Projection = Projection;
this.Area = Area;
this.Zoom = Zoom;
this.Type = Type;
}
示例11: ProcessSummary
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;
}
}
}
示例12: GenerateMapScriptCore
/// <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);
}
}
示例13: LumpFactory
/// <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;
}
示例14: GoogleMapsDisclaimer
/// <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;
}
示例15: playGame
/// <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;
}
}