public static MapLabel createLabel(Vector3 position, int nid, string alltext, int priority, int flor, bool elevator, int[] servicedFloors) { if (mainParent == null) { mainParent = new GameObject("Labels"); mainParent.tag = "Waypoints"; mainParent.transform.position = Vector3.zero; } GameObject obj = GameObject.Instantiate(Resources.Load("Prefabs/MapLabel")) as GameObject; obj.transform.parent = mainParent.transform; obj.transform.position = position; MapLabel lab = obj.GetComponent("MapLabel") as MapLabel; lab.id = nid; string[] text = alltext.Split(new char[] { ',' }, System.StringSplitOptions.RemoveEmptyEntries); lab.label = text.Length >= 1 ? text[0] : ""; lab.tags = text; lab.priority = priority; lab.floor = flor; lab.isElevator = elevator; lab.elevatorFloors = servicedFloors; return(lab); }
private void InitGui() { InitSetting(); CalculateRate(); // InitPlayerItemList(); // InitMarkItemList(); _safeCircle = new BaneCircle(safeDuquanRoot, false, true); _duquanCircle = new BaneCircle(curDuquanRoot, true, true); _bombArea = new BombArea(curBombAreaRoot); _safeMiniDis = new SafeMiniDis(miniDisRoot); if (!MapLevel.Min.Equals(adapter.MapLevel)) { // _mapGird = new MapGird(lineRoot); // _mapGird1 = new MapGird1(girdRoot); } _mapGird1 = new MapGird1(girdRoot); InitMapBg(); _airPlane = new AirPlane(kTouRoot, Loader); _routeLine = new RouteLine(routeRoot); _mapLabel = new MapLabel(labelRoot); _mapPlayer = new MapPlayer(playItemRoot); _mapMark = new MapMark(markRoot); _bioMark = new BioMark(bioMarkRoot); PreparedSprite(); }
/// <summary> /// 初始化标牌 /// </summary> public void InitMapLabel() { if (mapLabel != null) { return; } base.ToolTipMode = MarkerTooltipMode.Never; GPoint markerPosition = this.Overlay.Control.FromLatLngToLocal(this.Position); Point markerPoint = new Point((int)markerPosition.X, (int)markerPosition.Y);//点的屏幕坐标 currentPoint = markerPoint; currentLnglat = this.Position; mapLabel = new MapLabel(markerPoint); mapLabel.ClosedLabelEvent += new EventHandler(mapLabel_Closed); mapLabel.UpdateLabelLocationAndPosition(markerPoint, this.LocalPosition); mapLabel.SetTargetInfo(this.ElementName, this.Position.Lng, this.Position.Lat); mapLabel.SetLabelText(ToolTipText); mapLabel.Visible = false; this.Overlay.Control.Controls.Add(mapLabel); isTipInit = true; lableVisible = true; }
public void Initialize() { myTrans = transform; labels = GetComponent <MapLabel>(); labels.Initialize(); }
/// <summary> /// 标牌关闭事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void mapLabel_Closed(object sender, EventArgs e) { this.labelShowType = ShowTypeEnum.No; this.ToolTipMode = MarkerTooltipMode.OnMouseOver; isTipInit = false; mapLabel = null; lableVisible = false; }
/// <summary> /// 字体颜色设置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void labFColor_Click(object sender, EventArgs e) { ColorDialog dia = new ColorDialog(); MapLabel tool = this.Parent as MapLabel; if (dia.ShowDialog() == DialogResult.OK) { tool.SetFontColor(dia.Color); } }
public static int addLabel(MapLabel ml) { if (poiMarkers == null) { poiMarkers = new List <MapLabel>(); } //pois.Add(ml.PathLocation); //poiNames.Add(ml.Label); poiMarkers.Add(ml); return(poiMarkers.Count - 1); }
private void AddLabels() { foreach (Town town in WorldController.world.townList) { MapLabel label = new MapLabel(town.name, town.miniMapLocation, Font.OpenSans30, Color.Goldenrod, 1f, 1f); townLabels.Add(label); } uiScale = new float[4]; uiScale[0] = 1.5f; uiScale[1] = 1.1f; uiScale[2] = 0.8f; uiScale[3] = 0.6f; }
/// <summary> /// This method creates a new label for all the nodes of the mapdata. /// It also sets the text and minimal size of these labels. /// </summary> /// <param name="mapdata">MapData to be processed</param> private void CreateLabelsForNonSyntheticNodes(MapData mapdata) { //Create label for all non-synthetic nodes foreach (INode node in mapdata.Nodes) { MapNode mapDataNode = (MapNode)node; if (mapDataNode.Id >= 0) { //Create label for the node and set its text and minimal size MapLabel nodeLabel = new MapLabel(); nodeLabel.Text = mapDataNode.Name; nodeLabel.MinimalSize = new Dimension( (int)(FontUnits * DefaultFontSize), (int)(mapDataNode.Name.Length * CharacterUnits)); mapDataNode.Label = nodeLabel; } } }
public static void LogLibrary() { //float t = Time.realtimeSinceStartup; string log = ""; foreach (int i in MapLabel.MapLabels.Keys) { MapLabel m = MapLabel.MapLabels[i]; Vector3 rPos = MapMaker.worldSpaceToMapSpaceFull(m.PathLocation); log += "{id:" + i + ", x:" + (int)rPos.x + ", y:" + (int)rPos.y + "},\n"; } System.IO.File.WriteAllText("Lib Log " + System.DateTime.Now.ToString("MM-dd-yyyy HHmmss") + ".txt", log); //Debug.Log("Time to log: " + (Time.realtimeSinceStartup - t)); }
public int getFCost(MapLabel other) //weird ass heuristic. I pity the fool who has to debug this { if (this.IsElevator) { int bestCost = Mathf.Abs(other.OnFloor - this.OnFloor); foreach (int f in this.ElevatorFloors) { if (Mathf.Abs(other.OnFloor - f) < bestCost) { bestCost = Mathf.Abs(other.OnFloor - f); } } return(bestCost); } else { return(Mathf.Abs(other.OnFloor - this.OnFloor)); } }
/// <summary> /// 关闭标牌 /// </summary> public void CloseMapLabel() { if (mapLabel != null) { if (mapLabel.InvokeRequired) { mapLabel.Invoke(new Action(delegate { mapLabel.DisposeLabel(); mapLabel = null; isTipInit = false; })); } else { mapLabel.DisposeLabel(); mapLabel = null; isTipInit = false; } } lableVisible = false; }
// Use this for initialization void Start() { instance = this; ConsoleControl.Log("Start called"); float theBeforeTime = Time.realtimeSinceStartup; /*for (int i = 0; i < floors.Length; i++){ * floors[i].Id = i+1; * //floors[i].make(); * }*/ line = this.GetComponent <LineRenderer>(); //get a reference to the line seeker = GetComponent <Seeker>(); //astarPath = GetComponent<AstarPath>(); //logs["Getting components"] = Time.realtimeSinceStartup - theBeforeTime; //logs["Set active floor"] = Time.realtimeSinceStartup - theBeforeTime; //add the waypoints to the graph //float thebeforetime = Time.realtimeSinceStartup; PlayerPrefs.SetString("MarkerSave", ""); MapLabel.loadMarkers(); //logs["Initial marker load"] = Time.realtimeSinceStartup - theBeforeTime; if (Application.internetReachability == NetworkReachability.ReachableViaLocalAreaNetwork) { startMarkerUpdate(); } //logs["Start update of markers"] = Time.realtimeSinceStartup - theBeforeTime; logs["Startup time"] = Time.realtimeSinceStartup - theBeforeTime; setLogs(); }
void initUI(){ UIName startScreen = activeScreen; //hide everything except for what you're starting on System.Array all = System.Enum.GetValues(typeof(UIName)); foreach (UIName u in all){ if (u != startScreen){ hideScreen((UIName)u); } } //set up events for the map screen trackedEvents["startDirections"] = delegate(PowerUI.UIEvent mouseEvent){ resetGUI(); ActiveScreen = UIName.WhereFrom; }; PowerUI.UI.document.getElementById("getDirectionsButton").OnClick += trackedEvents["startDirections"]; PowerUI.UI.document.getElementById("backToLandingButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.Landing; }; var floorSelectDiv = PowerUI.UI.document.getElementById("floorSelectDiv"); for (int i = 0; i < MapMaker.floors.Length; i++){ PowerUI.Element nEl = new PowerUI.Element("div"); nEl.className = "button floorSelectButton"; nEl.textContent = i == 0 ? "Ground floor" : "Floor " + i; var k = i;//we don't want a reference to the old variable gunking up the works nEl.OnClick += delegate(PowerUI.UIEvent mouseEvent){ floorSelectDiv.childNodes[MapMaker.ActiveFloor != null ? MapMaker.ActiveFloor.Id-1 : 0].className = "button floorSelectButton"; MapMaker.ActiveFloor = MapMaker.floors[k]; nEl.className = "button floorSelectButton floorSelectButtonHighlighted"; }; floorSelectDiv.AppendNewChild(nEl); } floorSelectDiv.childNodes[MapMaker.ActiveFloor != null ? MapMaker.ActiveFloor.Id-1 : 0].className = "button floorSelectButton floorSelectButtonHighlighted"; //set up events for the landing screen PowerUI.UI.document.getElementById("browseButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.Map; startBrowse(); }; PowerUI.UI.Variables["refreshDisplayType"] = "block"; PowerUI.UI.document.getElementById("refreshButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ MapMaker.instance.startMarkerUpdate(); }; PowerUI.UI.document.getElementById("startButton").OnClick += trackedEvents["startDirections"]; //set up events for the where from? page PowerUI.UI.document.getElementById("backToStartButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.Landing; }; PowerUI.UI.document.getElementById("fromLobbyButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ poiFrom = (MapLabel.MapLabels != null && MapLabel.MapLabels.ContainsKey(103)) ? MapLabel.MapLabels[103] : poiMarkers[0]; ActiveScreen = UIName.WhereTo; PowerUI.UI.Variables["fromLabel"] = poiFrom.Label; }; trackedEvents["fromListener"] = delegate(PowerUI.UIEvent keyEvent){ //Debug.Log(keyEvent.keyCode); string term = PowerUI.UI.document.getElementById("fromSearch").value; if (term == null){ term = ""; } List<MapLabel> search = MapLabel.Search(poiMarkers, term); var resultDiv = PowerUI.UI.document.getElementById("fromSearchResults"); resultDiv.innerHTML = ""; foreach(MapLabel m in search){ MapLabel ml = m; PowerUI.Element nEl = new PowerUI.Element("div"); nEl.className = "button searchResult"; nEl.textContent = ml.Label; nEl.style.width = (PowerUI.UI.document.getElementById("fromSearch").pixelWidth - 50) + "px"; nEl.OnClick += delegate(PowerUI.UIEvent mouseEvent){ poiFrom = ml; ActiveScreen = UIName.WhereTo; PowerUI.UI.Variables["fromLabel"] = ml.Label; }; resultDiv.AppendNewChild(nEl); } }; PowerUI.UI.document.getElementById("fromSearch").OnKeyUp += trackedEvents["fromListener"]; //set up events for the where to? page PowerUI.UI.document.getElementById("backToFromButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.WhereFrom; }; trackedEvents["toListener"] = delegate(PowerUI.UIEvent keyEvent){ //Debug.Log(keyEvent.keyCode); string term = PowerUI.UI.document.getElementById("toSearch").value; if (term == null){ term = ""; } List<MapLabel> search = MapLabel.Search(poiMarkers, term); var resultDiv = PowerUI.UI.document.getElementById("toSearchResults"); resultDiv.innerHTML = ""; foreach(MapLabel m in search){ MapLabel ml = m; PowerUI.Element nEl = new PowerUI.Element("div"); nEl.className = "button searchResult"; nEl.textContent = ml.Label; nEl.style.width = (PowerUI.UI.document.getElementById("toSearch").pixelWidth - 50) + "px"; nEl.OnClick += delegate(PowerUI.UIEvent mouseEvent){ poiTo = ml; ActiveScreen = UIName.Confirm; PowerUI.UI.Variables["toLabel"] = ml.Label; }; resultDiv.AppendNewChild(nEl); } }; PowerUI.UI.document.getElementById("toSearch").OnKeyUp += trackedEvents["toListener"]; //set up events for the confirm page PowerUI.UI.document.getElementById("backToToButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.WhereTo; }; PowerUI.UI.document.getElementById("goButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.Map; resetGUI(); startNavigation(); }; foreach (var el in PowerUI.UI.document.getElementsByClassName("searchResults")){ int delta = el.id == "fromSearchResults" ? 375 : 275; el.style.height = (Screen.height - delta) + "px"; el.style.marginLeft = (int)(Screen.width/2f - 300) + "px"; } }
List <MapLabel> navigateFrom(MapLabel a, MapLabel b) { List <MapLabel> res = new List <MapLabel>(); res.Add(a); if (a.OnFloor == b.OnFloor) { res.Add(b); } else { //find out what elevators serve the starting floor List <MapLabel> availableElevators = MapLabel.ElevatorsOnFloor(a.OnFloor); bool direct = false; foreach (MapLabel m in availableElevators) { if (m.IsElevator && m.isOnFloor(b.OnFloor)) { res.Add(m); res.Add(b); direct = true; break; } } if (!direct) { MapLabel goalLoc = b; List <MapLabel> open = availableElevators; List <MapLabel> closed = new List <MapLabel>(); List <MapLabel> neighbors; MapLabel bsf; int bcsf; //choose best of the options bsf = open[0]; bcsf = bsf.getFCost(goalLoc); foreach (MapLabel p in open) { if (p.getFCost(goalLoc) < bcsf) { bsf = p; bcsf = p.getFCost(goalLoc); } } open.Remove(bsf); closed.Add(bsf); for (int i = 0; i < 5000; i++) //keep on checking. 5000 checks max { neighbors = MapLabel.ElevatorsOnFloor(bsf.OnFloor); foreach (int flo in bsf.ElevatorFloors) { List <MapLabel> ex = MapLabel.ElevatorsOnFloor(flo); foreach (MapLabel m in ex) { if (!neighbors.Contains(m)) { neighbors.Add(m); } } } //look through the neighbors foreach (MapLabel p in neighbors) { if (!closed.Contains(p)) //don't check ones you've already checked { if (!open.Contains(p)) //if you don't already might want to check it { open.Add(p); p.parentalLabel = bsf; } } } if (open.Count == 0) { break; } //choose best of the options bsf = open[0]; bcsf = 1; //bsf.getFCost(goalLoc); foreach (MapLabel p in open) { if (p.getFCost(goalLoc) < bcsf) { bsf = p; bcsf = p.getFCost(goalLoc); } } open.Remove(bsf); closed.Add(bsf); if (bsf.OnFloor == goalLoc.OnFloor) //are you done? { List <MapLabel> reverseElevatorRoute = new List <MapLabel>(); while (bsf != null) { reverseElevatorRoute.Add(bsf); bsf = bsf.parentalLabel; } reverseElevatorRoute.Reverse(); res.AddRange(reverseElevatorRoute); res.Add(goalLoc); } } } } if (true) { string deb = "Calculated segments: \n"; foreach (MapLabel m in res) { deb += m.Label + "\n"; } Debug.Log(deb); } return(res); }
void initUI() { UIName startScreen = activeScreen; //hide everything except for what you're starting on System.Array all = System.Enum.GetValues(typeof(UIName)); foreach (UIName u in all) { if (u != startScreen) { hideScreen((UIName)u); } } //set up events for the map screen trackedEvents["startDirections"] = delegate(PowerUI.UIEvent mouseEvent){ resetGUI(); ActiveScreen = UIName.WhereFrom; }; PowerUI.UI.document.getElementById("getDirectionsButton").OnClick += trackedEvents["startDirections"]; PowerUI.UI.document.getElementById("backToLandingButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.Landing; }; var floorSelectDiv = PowerUI.UI.document.getElementById("floorSelectDiv"); for (int i = 0; i < MapMaker.floors.Length; i++) { PowerUI.Element nEl = new PowerUI.Element("div"); nEl.className = "button floorSelectButton"; nEl.textContent = i == 0 ? "Ground floor" : "Floor " + i; var k = i; //we don't want a reference to the old variable gunking up the works nEl.OnClick += delegate(PowerUI.UIEvent mouseEvent){ floorSelectDiv.childNodes[MapMaker.ActiveFloor != null ? MapMaker.ActiveFloor.Id - 1 : 0].className = "button floorSelectButton"; MapMaker.ActiveFloor = MapMaker.floors[k]; nEl.className = "button floorSelectButton floorSelectButtonHighlighted"; }; floorSelectDiv.AppendNewChild(nEl); } floorSelectDiv.childNodes[MapMaker.ActiveFloor != null ? MapMaker.ActiveFloor.Id - 1 : 0].className = "button floorSelectButton floorSelectButtonHighlighted"; //set up events for the landing screen PowerUI.UI.document.getElementById("browseButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.Map; startBrowse(); }; PowerUI.UI.Variables["refreshDisplayType"] = "block"; PowerUI.UI.document.getElementById("refreshButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ MapMaker.instance.startMarkerUpdate(); }; PowerUI.UI.document.getElementById("startButton").OnClick += trackedEvents["startDirections"]; //set up events for the where from? page PowerUI.UI.document.getElementById("backToStartButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.Landing; }; PowerUI.UI.document.getElementById("fromLobbyButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ poiFrom = (MapLabel.MapLabels != null && MapLabel.MapLabels.ContainsKey(103)) ? MapLabel.MapLabels[103] : poiMarkers[0]; ActiveScreen = UIName.WhereTo; PowerUI.UI.Variables["fromLabel"] = poiFrom.Label; }; trackedEvents["fromListener"] = delegate(PowerUI.UIEvent keyEvent){ //Debug.Log(keyEvent.keyCode); string term = PowerUI.UI.document.getElementById("fromSearch").value; if (term == null) { term = ""; } List <MapLabel> search = MapLabel.Search(poiMarkers, term); var resultDiv = PowerUI.UI.document.getElementById("fromSearchResults"); resultDiv.innerHTML = ""; foreach (MapLabel m in search) { MapLabel ml = m; PowerUI.Element nEl = new PowerUI.Element("div"); nEl.className = "button searchResult"; nEl.textContent = ml.Label; nEl.style.width = (PowerUI.UI.document.getElementById("fromSearch").pixelWidth - 50) + "px"; nEl.OnClick += delegate(PowerUI.UIEvent mouseEvent){ poiFrom = ml; ActiveScreen = UIName.WhereTo; PowerUI.UI.Variables["fromLabel"] = ml.Label; }; resultDiv.AppendNewChild(nEl); } }; PowerUI.UI.document.getElementById("fromSearch").OnKeyUp += trackedEvents["fromListener"]; //set up events for the where to? page PowerUI.UI.document.getElementById("backToFromButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.WhereFrom; }; trackedEvents["toListener"] = delegate(PowerUI.UIEvent keyEvent){ //Debug.Log(keyEvent.keyCode); string term = PowerUI.UI.document.getElementById("toSearch").value; if (term == null) { term = ""; } List <MapLabel> search = MapLabel.Search(poiMarkers, term); var resultDiv = PowerUI.UI.document.getElementById("toSearchResults"); resultDiv.innerHTML = ""; foreach (MapLabel m in search) { MapLabel ml = m; PowerUI.Element nEl = new PowerUI.Element("div"); nEl.className = "button searchResult"; nEl.textContent = ml.Label; nEl.style.width = (PowerUI.UI.document.getElementById("toSearch").pixelWidth - 50) + "px"; nEl.OnClick += delegate(PowerUI.UIEvent mouseEvent){ poiTo = ml; ActiveScreen = UIName.Confirm; PowerUI.UI.Variables["toLabel"] = ml.Label; }; resultDiv.AppendNewChild(nEl); } }; PowerUI.UI.document.getElementById("toSearch").OnKeyUp += trackedEvents["toListener"]; //set up events for the confirm page PowerUI.UI.document.getElementById("backToToButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.WhereTo; }; PowerUI.UI.document.getElementById("goButton").OnClick += delegate(PowerUI.UIEvent mouseEvent){ ActiveScreen = UIName.Map; resetGUI(); startNavigation(); }; foreach (var el in PowerUI.UI.document.getElementsByClassName("searchResults")) { int delta = el.id == "fromSearchResults" ? 375 : 275; el.style.height = (Screen.height - delta) + "px"; el.style.marginLeft = (int)(Screen.width / 2f - 300) + "px"; } }
void Start() { GameObject mapControlObj = GameObject.Find("MapControl"); mapControl = mapControlObj.GetComponent<MapControl>(); label = Instantiate(labelPrefab, transform.position, Quaternion.AngleAxis(180, Vector3.up)) as MapLabel; label.SetUp(this); locName = mapControl.GetLocationName(); label.SetLabelText(locName); label.transform.parent = transform; LoadState(); HideRing(); }
public void startMarkerUpdate() { StartCoroutine(MapLabel.updateMarkerSave()); }
public static int addLabel(MapLabel ml){ if (poiMarkers == null){ poiMarkers = new List<MapLabel>(); } //pois.Add(ml.PathLocation); //poiNames.Add(ml.Label); poiMarkers.Add(ml); return poiMarkers.Count - 1; }
List<MapLabel> navigateFrom(MapLabel a, MapLabel b){ List<MapLabel> res = new List<MapLabel>(); res.Add(a); if (a.OnFloor == b.OnFloor){ res.Add(b); } else { //find out what elevators serve the starting floor List<MapLabel> availableElevators = MapLabel.ElevatorsOnFloor(a.OnFloor); bool direct = false; foreach (MapLabel m in availableElevators){ if (m.IsElevator && m.isOnFloor(b.OnFloor)){ res.Add(m); res.Add(b); direct = true; break; } } if (!direct){ MapLabel goalLoc = b; List<MapLabel> open = availableElevators; List<MapLabel> closed = new List<MapLabel>(); List<MapLabel> neighbors; MapLabel bsf; int bcsf; //choose best of the options bsf = open[0]; bcsf = bsf.getFCost(goalLoc); foreach (MapLabel p in open){ if (p.getFCost(goalLoc) < bcsf){ bsf = p; bcsf = p.getFCost(goalLoc); } } open.Remove(bsf); closed.Add(bsf); for (int i = 0; i < 5000; i++){//keep on checking. 5000 checks max neighbors = MapLabel.ElevatorsOnFloor(bsf.OnFloor); foreach (int flo in bsf.ElevatorFloors){ List<MapLabel> ex = MapLabel.ElevatorsOnFloor(flo); foreach (MapLabel m in ex){ if (!neighbors.Contains(m)){ neighbors.Add(m); } } } //look through the neighbors foreach (MapLabel p in neighbors){ if (!closed.Contains(p)){//don't check ones you've already checked if (!open.Contains(p)){//if you don't already might want to check it open.Add(p); p.parentalLabel = bsf; } } } if (open.Count == 0){ break; } //choose best of the options bsf = open[0]; bcsf = 1; //bsf.getFCost(goalLoc); foreach (MapLabel p in open){ if (p.getFCost(goalLoc) < bcsf){ bsf = p; bcsf = p.getFCost(goalLoc); } } open.Remove(bsf); closed.Add(bsf); if (bsf.OnFloor == goalLoc.OnFloor){//are you done? List<MapLabel> reverseElevatorRoute = new List<MapLabel>(); while (bsf != null){ reverseElevatorRoute.Add(bsf); bsf = bsf.parentalLabel; } reverseElevatorRoute.Reverse(); res.AddRange(reverseElevatorRoute); res.Add(goalLoc); } } } } if (true){ string deb = "Calculated segments: \n"; foreach (MapLabel m in res){ deb += m.Label + "\n"; } Debug.Log(deb); } return res; }
/// <summary> /// 释放资源 /// </summary> public override void Dispose() { base.Dispose(); this.BelongLayer = null; try { if (FlashPen != null) { FlashPen.Dispose(); FlashPen = null; } if (flashTimer != null) { flashTimer.Stop(); flashTimer.Dispose(); flashTimer = null; } if (mPen != null) { mPen.Dispose(); mPen = null; } if (mBitmap != null) { mBitmap.Dispose(); mBitmap = null; } if (mHightLightPen != null) { mHightLightPen.Dispose(); mHightLightPen = null; } if (mSelfPen != null) { mSelfPen.Dispose(); mSelfPen = null; } if (mapLabel != null) { if (mapLabel.InvokeRequired) { mapLabel.Invoke(new Action(delegate { mapLabel.Visible = false; mapLabel.DisposeLabel(); mapLabel.Dispose(); mapLabel = null; })); } else { mapLabel.Visible = false; mapLabel.DisposeLabel(); mapLabel.Dispose(); mapLabel = null; } } BelongLayer = null; } catch { } }
/// <summary> /// 关闭标牌 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void labClose_Click(object sender, EventArgs e) { MapLabel tool = this.Parent as MapLabel; tool.DisposeLabel(); }
public int getFCost(MapLabel other){//weird ass heuristic. I pity the fool who has to debug this if (this.IsElevator){ int bestCost = Mathf.Abs(other.OnFloor - this.OnFloor); foreach (int f in this.ElevatorFloors){ if (Mathf.Abs(other.OnFloor - f) < bestCost){ bestCost = Mathf.Abs(other.OnFloor - f); } } return bestCost; } else { return Mathf.Abs(other.OnFloor - this.OnFloor); } }