void HandleDidRangeBeacons(object sender, CLRegionBeaconsRangedEventArgs e) { Unknowns.Clear(); Immediates.Clear(); Nears.Clear(); Fars.Clear(); foreach (CLBeacon beacon in e.Beacons) { switch (beacon.Proximity) { case CLProximity.Immediate: Immediates.Add(beacon); break; case CLProximity.Near: Nears.Add(beacon); break; case CLProximity.Far: Fars.Add(beacon); break; case CLProximity.Unknown: Unknowns.Add(beacon); break; } } TableView.ReloadData(); }
void HandleDidRangeBeacons(object sender, CLRegionBeaconsRangedEventArgs e) { Unknowns.Clear(); Immediates.Clear(); Nears.Clear(); Fars.Clear(); SystemLogger.Log(SystemLogger.Module.PLATFORM, "************************** HandleDidRangeBeacons Identifier: " + e.Region.Identifier); int i = 0; foreach (CLBeacon beacon in e.Beacons) { switch (beacon.Proximity) { case CLProximity.Immediate: Immediates.Add(beacon); break; case CLProximity.Near: Nears.Add(beacon); break; case CLProximity.Far: Fars.Add(beacon); break; case CLProximity.Unknown: Unknowns.Add(beacon); break; } SystemLogger.Log(SystemLogger.Module.PLATFORM, "************************** HandleDidRangeBeacons Accuracy: " + beacon.Accuracy); SystemLogger.Log(SystemLogger.Module.PLATFORM, "************************** HandleDidRangeBeacons Proximity: " + beacon.Proximity); SystemLogger.Log(SystemLogger.Module.PLATFORM, "************************** HandleDidRangeBeacons Description: " + beacon.Description); SystemLogger.Log(SystemLogger.Module.PLATFORM, "************************** HandleDidRangeBeacons Major: " + beacon.Major); SystemLogger.Log(SystemLogger.Module.PLATFORM, "************************** HandleDidRangeBeacons Minor: " + beacon.Minor); SystemLogger.Log(SystemLogger.Module.PLATFORM, "************************** HandleDidRangeBeacons Rssi: " + beacon.Rssi); SystemLogger.Log(SystemLogger.Module.PLATFORM, "************************** HandleDidRangeBeacons ProximityUuid: " + beacon.ProximityUuid); Beacon AppverseBeacon = FromCLBeacon(beacon); String id = uniqueIDForBeacon(AppverseBeacon); if (!rangingBeacons.ContainsKey(id)) { SystemLogger.Log(SystemLogger.Module.PLATFORM, "************************** ADDED LOCATION: " + AppverseBeacon.Distance.ToString()); rangingBeacons.Add(id, AppverseBeacon); } else { rangingBeacons[id] = AppverseBeacon; } } }
public void Init(string fileName) { TextAsset asset = Resources.Load("File/" + fileName) as TextAsset; //GameMgr.Instance.m_AssetsLoad.LoadConfig("OriginPathFile_Client", OnLoad); var bytes = asset.bytes; GtMsg.NavData nav = GtMsg.NavData.Parser.ParseFrom(bytes); list.Clear(); foreach (var c in nav.Celllist) { Cell cell = new Cell(); cell.index = c.Index; cell.v[0] = CommonFunc.GetVector3(c.V[0]); cell.v[1] = CommonFunc.GetVector3(c.V[1]); cell.v[2] = CommonFunc.GetVector3(c.V[2]); cell.MidPos = CommonFunc.GetVector3(c.MidPos); cell.LineMidSqrDistance[0] = c.LineMidSqrDistance[0]; cell.LineMidSqrDistance[1] = c.LineMidSqrDistance[1]; cell.LineMidSqrDistance[2] = c.LineMidSqrDistance[2]; cell.LineMidPos[0] = CommonFunc.GetVector3(c.LineMidPos[0]); cell.LineMidPos[1] = CommonFunc.GetVector3(c.LineMidPos[1]); cell.LineMidPos[2] = CommonFunc.GetVector3(c.LineMidPos[2]); cell.Normalize[0] = CommonFunc.GetVector3(c.Normalize[0]); cell.Normalize[1] = CommonFunc.GetVector3(c.Normalize[1]); cell.Normalize[2] = CommonFunc.GetVector3(c.Normalize[2]); for (var i = 0; i < 3; i++) { var n = c.Nears[i]; if (n.Enable) { Nears near = new Nears(); near.Index = n.Index; near.Distance = n.Distance; near.PointIndex[0] = n.PointIndex[0]; near.PointIndex[1] = n.PointIndex[1]; near.OtherLineIndex = n.OtherLineIndex; near.LineIndex = n.LineIndex; cell.nears[i] = near; } else { cell.nears[i] = null; } } list.Add(cell); } }
static void InsertNears(Cell a, Cell b, int index, List <int> l) { foreach (var n in a.nears) { if (n.Index == index) { return; } } var c = new Nears { Index = index, Distance = Vector3.Distance(a.MidPos, b.MidPos) }; c.PointIndex[0] = l[0]; c.PointIndex[1] = l[1]; c.NotNearPointIndex = l[2]; a.nears.Add(c); }
static void InsertNears(Cell a, Cell b, GtMsg.Cell a1, int aLineIndex, int bLineIndex) { int index = b.index; var c = new Nears { Index = index, Distance = Vector3.Distance(a.MidPos, b.MidPos) }; CommonFunc.Get2PointIndexBy1LineIndex(aLineIndex, ref c.PointIndex[0], ref c.PointIndex[1]); c.LineIndex = aLineIndex; c.OtherLineIndex = bLineIndex; a.nears[aLineIndex] = c; GtMsg.Nears c2 = a1.Nears[aLineIndex]; c2.Index = index; c2.Enable = true; c2.Distance = c.Distance; c2.OtherLineIndex = c.OtherLineIndex; c2.LineIndex = c.LineIndex; c2.PointIndex.Add(c.PointIndex[0]); c2.PointIndex.Add(c.PointIndex[1]); }
void AddRunKillDama(TCell StartPos, int dir, TNode Parent) { ArrayList arr = new ArrayList(); TCell Near; if (StartPos == null) { Near = Pos.NearDama(dir, Pole); } else { Near = StartPos.NearDama(dir, Pole); } TCheck Who; Pole.Who(Near, out Who); if (Who == null) { return; } if (Who.C == C) { return; } Near = Near.Near(dir); TCheck W2; if (Pole.Who(Near, out W2)) { if (W2 == null) { TNode Cur = new TNode(Parent, Near, Who, dir); if (Tree == null) { Tree = new TTree(Cur, Pole); } Tree.Count++; int Count = Tree.Count; TCell[] Nears; for (int i = 1; i <= 4; i++) { if (((dir == 1) && (i == 4)) || ((dir == 2) && (i == 3)) || ((dir == 3) && (i == 2)) || ((dir == 4) && (i == 1))) { continue; } Nears = Near.NearsDama(dir, Pole); for (int k = 0; k < Nears.Count(); k++) { AddRunKillDama(Nears[k], i, Cur); } } if (Count == Tree.Count) { Tree.Lists.Add(Cur); } } } }