public static void RegisterMap( int mapIndex, int mapID, int fileIndex, int width, int height, int season, string name, MapRules rules ) { Map newMap = new Map( mapID, mapIndex, fileIndex, width, height, season, name, rules ); Map.Maps[mapIndex] = newMap; Map.AllMaps.Add( newMap ); }
public InstanceMap(int index, Map parent, string name, Season season, MapRules rules) : base(parent.MapID, index, parent.MapID, parent.Width, parent.Height, (int)season, name, rules) { InstanceRegions = new List <InstanceRegion>(); Mobiles = new List <Mobile>(); Items = new List <Item>(); BounceInfo = new Dictionary <PlayerMobile, MapPoint>(); if (!Maps.InBounds(MapIndex) || MapIndex == 255 || MapIndex == 127) { Serial = new InstanceMapSerial(-MapIndex); Deleted = true; return; } Serial = new InstanceMapSerial(MapIndex); Parent = parent; Maps[MapIndex] = this; AllMaps.Add(this); UpdateMaps(); }
public void LoadMap(Map map, MapRules rules) { UnloadMap(); this.Map = map; cells = new Dictionary <Int32, Cell> (); // current stair FloorManager.FloorStair stair = FloorManager.Instance.Stair; int i = 0; for (int y = 0; y < Map.Height; y++) { for (int x = 0; x < Map.Width; x++) { Cell cell = Map.getCell(rules, x, y); if (Map.Equals(stair.StairMap) && stair.StairPosition == new Vector2(x, y)) { cell = stair.StairCell.gameObject.GetComponent <Cell>(); } cell = Instantiate(cell, getPositionFromCell(i) + new Vector2(0.5f, 0.5f), Quaternion.identity).GetComponent <Cell> (); cell.init(i, null); cells.Add(cell.Id, cell); cell.transform.parent = gameObject.transform; //Debug.Log (i + " " + cell); // Rotation for texture cell.transform.rotation = Quaternion.Euler(0, 0, 180); i++; } } foreach (Cell c in cells.Values) { //Cell[] neighbors = new Cell[4]; //neighbors [Cell.LEFT] = (x==0)?null:cells[i-1]; //neighbors [Cell.TOP] = getCellFromPosition (new Vector2(x,y-1)); c.BindOn(getCellFromId(c.Id + Map.Width), Cell.TOP); c.BindOn((c.Id) % (Map.Height) >= Map.Width - 1?null:getCellFromId(c.Id + 1), Cell.RIGHT); } foreach (Map.TeleporterLine teleporterLine in Map.Teleporters) { Teleporter teleporter = getCellFromPosition(teleporterLine.origin).gameObject.AddComponent <Teleporter> (); teleporter.Destination(teleporterLine.destinationMap, teleporterLine.destinationPosition); } /*foreach (Cell c in cells.Values) { * if( * !c || * c.Left.Right != c || * c.Right.Left != c || * c.Top.Bottom != c || * c.Bottom.Top != c * ){ * Debug.LogWarning("Bug cell "+c.Id); * } * }*/ PutCameraOverMap(); this._ready = true; }
public static void RegisterMap(int mapIndex, int mapID, int fileIndex, int width, int height, int season, string name, MapRules rules) { Map newMap = new Map(mapID, mapIndex, fileIndex, width, height, season, name, rules); Map.Maps[mapIndex] = newMap; Map.AllMaps.Add(newMap); }
private static void Init() { if (Window2.Loaded == null || !Window2.Loaded) { MapRules.LoadExternalRules(); Window2.Loaded = true; } }
public static void RegisterMap( int mapIndex, int mapID, int fileIndex, int width, int height, Season season, Expansion ex, string name, MapRules rules) { var newMap = new Map(mapID, mapIndex, fileIndex, width, height, season.GetID(), ex, name, rules); Map.Maps[mapIndex] = newMap; Map.AllMaps.Add(newMap); }
public Cell getCell(MapRules rules, int x, int y) { try{ //Debug.Log(x + ":" + y + " = " + _txtMap [x][Height-y-1]); Cell ret = rules.getCell(_txtMap [Height - y - 1][x]); return(ret ? ret : rules.DefaultCell); }catch (Exception) { Debug.LogWarning("Cell not found during map loading ! Default cell will be used"); return(rules.DefaultCell); } }
public static MatchOptions GetOptions(MatchOptions2 Options2) { if (Options2 == null) { return(Settings()); } else { return(MapRules.MapOptions(Options2)); } }
public static void Beautify(Element elem, string identifier, MatchOptions2 Options2) { if (elem == null) { return; } if (identifier == "ignore") { return; } Init(); string padyam = CleanHTML(elem.InnerHTML.ToUpperCase()); string html = ""; if (Options2 == null) { Options2 = MapRules.DefaultOptions(); } html = (identifier == null || identifier == "") ? Determine(padyam, Options2) : TryMatch(padyam, identifier, Options2); if (html != "") { elem.InnerHTML = "<div class='formatted'>" + html + "</div>" + "<div class='orginal'>" + elem.InnerHTML + "</div>"; } Element Close = Util.FindByClass(elem, "open"); if (Close == null) { return; } Util.RegisterClick3(Close, delegate(ElementEvent ee) { Element Anchor = ee.Target.ParentNode.ParentNode; Element Target = Util.FindByClass(Anchor, "ganaVibhajana"); OverlayDialog OD = new OverlayDialog("", Target.InnerHTML); OD.FooterText = "ఛందం<sup class='copyright'>©</sup> తో పద్యసాహిత్యం మరింత రసమయం..!! [<a target='_blank' href='http://chandam.apphb.com'>http://chandam.apphb.com</a>]"; OD.ShowClose = false; OD.Show(); }); }
public Map( int mapID, int mapIndex, int fileIndex, int width, int height, int season, string name, MapRules rules ) { m_MapID = mapID; m_MapIndex = mapIndex; m_FileIndex = fileIndex; m_Width = width; m_Height = height; m_Season = season; m_Name = name; m_Rules = rules; m_Regions = new Dictionary<string, Region>( StringComparer.OrdinalIgnoreCase ); m_InvalidSector = new Sector( 0, 0, this ); m_SectorsWidth = width >> SectorShift; m_SectorsHeight = height >> SectorShift; m_Sectors = new Sector[m_SectorsWidth][]; }
public static InstanceMap CreateMap(Map parent, string name, Season season, MapRules rules) { // If the map is TerMur, use Spring or Summer to prevent static clouds from being hidden. if (season != Season.Spring && season != Season.Summer && parent.MapID == 5) { season = Utility.RandomList(Season.Spring, Season.Summer); } var map = new InstanceMap(parent, name, season, rules); if (!map.Deleted) { Maps.AddOrReplace(map.Serial, map); } return(map); }
public static void BeautifyAll(string identifier, Element parent, MatchOptions2 Options2) { ElementCollection List = (parent == null) ? Document.GetElementsByTagName("*") : parent.GetElementsByTagName("*"); if (List == null) { return; } Element[] L = new Element[List.Length]; for (int i = 0; i < List.Length; i++) { L[i] = List[i]; } if (Options2 == null) { Options2 = MapRules.DefaultOptions(); Options2.ShowGV = true; } for (int i = 0; i < L.Length; i++) { Element elem = L[i]; string chandam = (string)elem.GetAttribute("chandam"); string identifier2 = (string)elem.GetAttribute("chandassu"); if (chandam == "0") { continue; } if (chandam == "1" || identifier2 != "") { if (identifier2 != null && identifier2 != "") { Beautify(elem, identifier2, Options2); } else { Beautify(elem, identifier, Options2); } } } }
public static void BeautifyTags(string tag, string identifier, MatchOptions2 Options2) { ElementCollection List = Document.GetElementsByTagName(tag); Element[] L = new Element[List.Length]; for (int i = 0; i < List.Length; i++) { L[i] = List[i]; } if (Options2 == null) { Options2 = MapRules.DefaultOptions(); Options2.ShowGV = true; } foreach (Element e in L) { if (e.TagName.ToLowerCase() == "div") { return; } Beautify(e, identifier, Options2); } }
public BaseInstanceMap(int mapID, int fileIndex, int width, int height, int season, string name, MapRules rules) : base(mapID, Serial.NewMap, fileIndex, width, height, season, name, rules) { Type ourType = this.GetType(); m_TypeRef = World.m_InstanceMapTypes.IndexOf(ourType); if (m_TypeRef == -1) { World.m_InstanceMapTypes.Add(ourType); m_TypeRef = World.m_InstanceMapTypes.Count - 1; } Register(); }
//private Point3D m_EjectPoint; //Where do all the Players go? //public Point3D EjectPoint{ get{ return m_EjectPoint; } set{ m_EjectPoint = value; } } public BaseInstanceMap(Map model, string name, MapRules rules) : this(model.MapID, model.FileIndex, model.Width, model.Height, model.Season, name, rules) { }
public Map( int mapID, int mapIndex, int fileIndex, int width, int height, int season, string name, MapRules rules ) { m_MapID = mapID; m_MapIndex = mapIndex; m_FileIndex = fileIndex; m_Width = width; m_Height = height; m_Season = season; m_Name = name; m_Rules = rules; m_Regions = new ArrayList(); //m_Tiles = new TileMatrix( fileIndex, width, height ); m_InvalidSector = new Sector( 0, 0, this ); m_SectorsWidth = width >> SectorShift; m_SectorsHeight = height >> SectorShift; m_Sectors = new Sector[m_SectorsWidth][]; }
/* * Create a map according to its position in the floor */ public Map GetMap(MapRules rules, int widthFloor, int heightFloor, int[] coordinatesMap) { // Init map char[][] txtMap = rules.GetMapModel(); // x = width, y = height int widthMap = txtMap.Length; int heightMap = txtMap [0].Length - 1; List <Map.TeleporterLine> teleporters = new List <Map.TeleporterLine> (); // Create corridor in txtMap List <PosCorridor> posCorridors = GetCorridors(widthFloor, heightFloor, coordinatesMap); foreach (PosCorridor corridor in posCorridors) { int originCorridor, x, y; int[] destinationMap = new int[2]; Vector2 originTeleporter, destinationTeleporter; // TODO créer une seule méthode pour les 4 positions de corridor switch (corridor) { case PosCorridor.BOTTOM: // Teleporter originCorridor = widthMap / 2; destinationMap [0] = coordinatesMap[0]; destinationMap [1] = coordinatesMap[1] - 1; originTeleporter = new Vector2(originCorridor, 0); destinationTeleporter = new Vector2(originCorridor, heightMap - 2); teleporters.Add(new Map.TeleporterLine(originTeleporter, destinationMap, destinationTeleporter)); // Construct corridor x = originCorridor; y = heightMap - 1; while (txtMap [y] [x] != 'G') { txtMap[y][x] = 'G'; y--; } break; case PosCorridor.TOP: // Teleporter originCorridor = widthMap / 2; destinationMap [0] = coordinatesMap[0]; destinationMap [1] = coordinatesMap[1] + 1; originTeleporter = new Vector2(originCorridor, heightMap - 1); destinationTeleporter = new Vector2(originCorridor, 1); teleporters.Add(new Map.TeleporterLine(originTeleporter, destinationMap, destinationTeleporter)); // Construct corridor x = originCorridor; y = 0; while (txtMap [y] [x] != 'G') { txtMap[y][x] = 'G'; y++; } break; case PosCorridor.LEFT: // Teleporter originCorridor = heightMap / 2; destinationMap [0] = coordinatesMap[0] - 1; destinationMap [1] = coordinatesMap[1]; originTeleporter = new Vector2(0, originCorridor); destinationTeleporter = new Vector2(widthMap - 2, originCorridor); teleporters.Add(new Map.TeleporterLine(originTeleporter, destinationMap, destinationTeleporter)); // Construct corridor x = 0; y = heightMap - originCorridor - 1; while (txtMap [y] [x] != 'G') { txtMap[y][x] = 'G'; x++; } break; case PosCorridor.RIGHT: // Teleporter originCorridor = heightMap / 2; destinationMap [0] = coordinatesMap[0] + 1; destinationMap [1] = coordinatesMap[1]; originTeleporter = new Vector2(widthMap - 1, originCorridor); destinationTeleporter = new Vector2(1, originCorridor); teleporters.Add(new Map.TeleporterLine(originTeleporter, destinationMap, destinationTeleporter)); // Construct corridor x = widthMap - 1; y = heightMap - originCorridor - 1; while (txtMap [y] [x] != 'G') { txtMap[y][x] = 'G'; x--; } break; } } // Convert char[][] to string[] // Why convert ? char[][] problems with memory recording string[] resultMap = new string[15]; int i = 0; foreach (char[] line in txtMap) { resultMap [i] = new string(line); i++; } return(new Map(widthMap, heightMap, resultMap, teleporters)); }