本文整理汇总了C#中MapId类的典型用法代码示例。如果您正苦于以下问题:C# MapId类的具体用法?C# MapId怎么用?C# MapId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapId类属于命名空间,在下文中一共展示了MapId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FinalizeDataHolder
public void FinalizeDataHolder()
{
RegionId = BattlegroundMgr.BattlemasterListReader.Entries[(int)Id].MapId;
RegionTemplate = World.GetRegionTemplate(RegionId);
if (RegionTemplate == null)
{
ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid RegionId: {0} (#{1})",
RegionId, (int)RegionId);
return;
}
if (BattlegroundMgr.Templates.Length <= (int)Id)
{
ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid BG-Id: {0} (#{1})",
Id, (int)Id);
return;
}
Difficulties = new PvPDifficultyEntry[BattlegroundMgr.PVPDifficultyReader.Entries.Values.Count(entry => (entry.mapId == RegionId))];
foreach (var entry in BattlegroundMgr.PVPDifficultyReader.Entries.Values)
{
if (entry.mapId == RegionId)
Difficulties[entry.bracketId] = entry;
}
RegionTemplate.MinLevel = Math.Max(1, MinLevel);
RegionTemplate.MaxLevel = Math.Max(MinLevel, MaxLevel);
BattlegroundMgr.Templates[(int)Id] = this;
CreateQueues();
SetStartPos();
}
示例2: ExtractedWMOManager
public ExtractedWMOManager(string _baseDirectory, MapId _mapId)
{
this._baseDirectory = _baseDirectory;
this._mapId = _mapId;
_WMOs = new List<ExtractedWMO>();
_WMOM2s = new List<ExtractedM2>();
}
示例3: GetHeightAtPosition
/// <summary>
/// Get the height of the floor underneath the given position on the map with the given MapId.
/// </summary>
/// <param name="mapId">The <see cref="WCell.Constants.World.MapId"/> that corresponds to the desired map.</param>
/// <param name="pos">The position on the map to get the height at.</param>
/// <param name="height">The height of the floor at the given position on the map.</param>
/// <returns>True if the height retrieval was successful.</returns>
public bool GetHeightAtPosition(MapId mapId, Vector3 pos, out float height)
{
height = float.MinValue;
Map map;
return ((!TryGetMap(mapId, out map)) || (map.GetHeightAtPosition(pos, out height)));
}
示例4: GetNearestWalkablePositon
/// <summary>
/// Gets the nearest walkable (i.e., not water, model, air, etc) position to the given position.
/// </summary>
/// <param name="mapId">The <see cref="WCell.Constants.World.MapId"/> that corresponds to the desired map.</param>
/// <param name="pos">The position to check against.</param>
/// <param name="walkablePos">The nearest walkable position to the given position.</param>
/// <returns>True if the check was successful.</returns>
public bool GetNearestWalkablePositon(MapId mapId, Vector3 pos, out Vector3 walkablePos)
{
walkablePos = Vector3.Zero;
Map map;
return ((!TryGetMap(mapId, out map)) || (map.GetNearestWalkablePosition(pos, out walkablePos)));
}
示例5: GetNearestValidPosition
/// <summary>
/// Gets the nearest valid (i.e., not over a hole, outside map boundaries, etc) position to the given position.
/// </summary>
/// <param name="mapId">The <see cref="WCell.Constants.World.MapId"/> that corresponds to the desired map.</param>
/// <param name="pos">The position to check against.</param>
/// <param name="validPos">The nearest valid position to the given position.</param>
/// <returns>True if the check was successful.</returns>
public bool GetNearestValidPosition(MapId mapId, Vector3 pos, out Vector3 validPos)
{
validPos = Vector3.Zero;
Map map;
return ((!TryGetMap(mapId, out map)) || (map.GetNearestValidPosition(pos, out validPos)));
}
示例6: HasLOS
public static bool HasLOS(MapId mapId, Vector3 startPos, Vector3 endPos)
{
float tMax;
var ray = CollisionHelper.CreateRay(startPos, endPos, out tMax);
var intTMax = (int)(tMax + 0.5f);
for (var t = 0; t < intTMax; t++)
{
var currentPos = ray.Position + ray.Direction * t;
TileCoord currentTileCoord;
ChunkCoord currentChunkCoord;
PointX2D currentPointX2D;
var currentHeightMapFraction = LocationHelper.GetFullInfoForPos(currentPos,
out currentTileCoord,
out currentChunkCoord,
out currentPointX2D);
var currentTile = GetTile(mapId, currentTileCoord);
if (currentTile == null)
{
// Can't check non-existant tiles.
return false;
}
var terrainHeight = currentTile.GetInterpolatedHeight(currentChunkCoord, currentPointX2D, currentHeightMapFraction);
if (terrainHeight < currentPos.Z) continue;
return false;
}
return true;
}
示例7: Process
public static ExtractedM2 Process(string basePath, MapId mapId, string path)
{
basePath = Path.Combine(basePath, mapId.ToString());
var filePath = Path.Combine(basePath, path);
filePath = Path.ChangeExtension(filePath, ".m2x");
if (!File.Exists(filePath))
{
throw new FileNotFoundException("Extracted M2 file not found: {0}", filePath);
}
var m2 = new ExtractedM2();
using(var file = File.OpenRead(filePath))
using(var br = new BinaryReader(file))
{
var type = br.ReadString();
if (type != fileType)
{
br.Close();
throw new InvalidDataException(string.Format("M2x file in invalid format: {0}", filePath));
}
m2.Extents = br.ReadBoundingBox();
m2.BoundingVertices = br.ReadVector3List();
m2.BoundingTriangles = br.ReadIndex3List();
br.Close();
}
return m2;
}
示例8: FinalizeDataHolder
public void FinalizeDataHolder()
{
MapId = BattlegroundMgr.BattlemasterListReader.Entries[(int)Id].MapId;
MapTemplate = World.GetMapTemplate(MapId);
if (MapTemplate == null)
{
ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid MapId: {0} (#{1})",
MapId, (int)MapId);
return;
}
if (BattlegroundMgr.Templates.Length <= (int)Id)
{
ContentMgr.OnInvalidDBData("BattlegroundTemplate had invalid BG-Id: {0} (#{1})",
Id, (int)Id);
return;
}
MapTemplate.BattlegroundTemplate = this;
Difficulties = new PvPDifficultyEntry[BattlegroundMgr.PVPDifficultyReader.Entries.Values.Count(entry => (entry.mapId == MapId))];
foreach (var entry in BattlegroundMgr.PVPDifficultyReader.Entries.Values.Where(entry => (entry.mapId == MapId)))
{
Difficulties[entry.bracketId] = entry;
}
MinLevel = MapTemplate.MinLevel = Difficulties.First().minLevel;
MaxLevel = MapTemplate.MaxLevel = Difficulties.Last().maxLevel;
BattlegroundMgr.Templates[(int)Id] = this;
CreateQueues();
SetStartPos();
}
示例9: FinalizeDataHolder
public void FinalizeDataHolder()
{
RegionId = BattlegroundMgr.BattlemasterListReader.Entries[(int)Id].MapId;
RegionInfo = World.GetRegionInfo(RegionId);
if (RegionInfo == null)
{
ContentHandler.OnInvalidDBData("BattlegroundTemplate had invalid RegionId: {0} (#{1})",
RegionId, (int)RegionId);
return;
}
if (BattlegroundMgr.Templates.Length <= (int)Id)
{
ContentHandler.OnInvalidDBData("BattlegroundTemplate had invalid BG-Id: {0} (#{1})",
Id, (int)Id);
return;
}
RegionInfo.MinLevel = Math.Max(1, MinLevel);
RegionInfo.MaxLevel = Math.Max(MinLevel, MaxLevel);
BattlegroundMgr.Templates[(int)Id] = this;
CreateQueues();
SetStartPos();
}
示例10: WorldState
public WorldState(MapId mapId, ZoneId zoneId, uint key, int value)
{
MapId = mapId;
ZoneId = zoneId;
Key = (WorldStateId)key;
DefaultValue = value;
}
示例11: InstanceBinding
public InstanceBinding(uint id, MapId mapId, uint difficultyIndex)
{
BindTime = DateTime.Now;
DifficultyIndex = difficultyIndex;
InstanceId = id;
MapId = mapId;
}
示例12: TryLoad
internal static bool TryLoad(MapId mapId, out Map map)
{
map = null;
var basePath = TerrainDisplayConfig.MapDir;
var mapPath = Path.Combine(basePath, mapId.ToString());
var fileName = string.Format("{0}{1}", mapId, Extension);
var filePath = Path.Combine(mapPath, fileName);
if (!Directory.Exists(mapPath))
{
log.Warn("Unable to find requested .map dir: {0}", mapPath);
return false;
}
if (!File.Exists(filePath))
{
log.Warn("Unable to find requested .map file: {0}", filePath);
return false;
}
using(var file = File.OpenRead(filePath))
{
map = ReadWDTInfo(file);
file.Close();
if (map == null)
{
log.Warn("Unable to load the requested .map file: {0}", filePath);
return false;
}
}
map.MapId = mapId;
return true;
}
示例13: ExtractedADTManager
public ExtractedADTManager(ExtractedTerrainManager terrainManager, string basePath, MapId mapId)
{
_mapId = mapId;
_terrainManager = terrainManager;
_basePath = basePath;
MapTiles = new List<ADTBase>();
}
示例14: Process
public static ExtractedWMO Process(string basePath, MapId mapId, string path)
{
basePath = Path.Combine(basePath, mapId.ToString());
var filePath = Path.Combine(basePath, path);
filePath = Path.ChangeExtension(filePath, ".wmo");
if (!File.Exists(filePath))
{
throw new FileNotFoundException("Extracted M2 file not found: {0}", filePath);
}
var wmo = new ExtractedWMO();
using (var file = File.OpenRead(filePath))
using (var br = new BinaryReader(file))
{
var type = br.ReadString();
if (type != fileType)
{
br.Close();
throw new InvalidDataException(string.Format("WMO file in invalid format: {0}", filePath));
}
wmo.Extents = br.ReadBoundingBox();
wmo.WMOId = br.ReadUInt32();
ReadWMODoodadDefs(br, wmo);
ReadWMOGroups(br, wmo);
}
return wmo;
}
示例15: SendInstanceReset
/// <summary>
/// An instance has been reset
/// </summary>
public static void SendInstanceReset(IPacketReceiver client, MapId mapId)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_UPDATE_LAST_INSTANCE, 4))
{
packet.Write((int)mapId);
client.Send(packet);
}
}