本文整理汇总了C#中Zone.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# Zone.Initialize方法的具体用法?C# Zone.Initialize怎么用?C# Zone.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zone
的用法示例。
在下文中一共展示了Zone.Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddZone
public void AddZone(int id, string name, int width, int height)
{
lock (zoneMngrLock)
{
Zone z = new Zone();
z.Initialize(id, name, width, height);
zones.Add(z);
zone_lookup.Add(z.Id, z);
}
}
示例2: HandleTeleport
private void HandleTeleport(ServerToClientMessage wm)
{
string[] data = wm.Data.Remove(0, 1).Split('#');
for (int i = 0; i < data.Length; i++)
{
string key = data[i].Substring(0, 1);
string value = data[i].Substring(1, data[i].Length - 1);
if (key == "Z")
{
// id:name:width:height
string[] zoneInfo = value.Split(':');
int id = Convert.ToInt32(zoneInfo[0]);
if (zoneManager.ZoneExists(id))
{
Logger.Output(this, "HandleTeleport() Removing existing zone {0}.", id);
zoneManager.RemoveZone(id);
}
int width = Convert.ToInt32(zoneInfo[2]);
int height = Convert.ToInt32(zoneInfo[3]);
Zone zone = new Zone();
zone.Initialize(id, zoneInfo[1], width, height);
zoneManager.AddZone(zone);
int oldZone = playerCharacter.Zone;
zoneManager.MoveEntity(playerCharacter, zone);
zoneManager.RemoveZone(oldZone);
Logger.Output(this, "HandleTeleport() Zone (Id:{0}, Name:{1}, Size:{2}x{3}", id, zoneInfo[1], width, height);
}
else if (key == "C")
{
Character character = new Character(value);
zoneManager.AddEntity(character);
Logger.Output(this, "HandleTeleport() Character (Id:{0}, Name:{1}, Pos:{2}", character.Id, character.Name, character.Position);
}
else if (key == "E")
{
int typeId = int.Parse(value.Split('|')[0]);
string entityData = value.Split('|')[1];
AddEntityFromFormat(typeId, entityData);
Logger.Output(this, "HandleTeleport() Entity sent to parser.");
}
}
}