public override void OnInspectorGUI() { Pathfinder pathfinder = target as Pathfinder; EditorGUILayout.LabelField("Test"); type = (WayType)EditorGUILayout.EnumPopup(type); startPoint = EditorGUILayout.ObjectField(startPoint, typeof(PointOnMap)) as PointOnMap; endPoint = EditorGUILayout.ObjectField(endPoint, typeof(PointOnMap)) as PointOnMap; if (GUILayout.Button("Check Way")) { if (startPoint != null && endPoint != null) { testWay = pathfinder.GetWay(type, startPoint, endPoint, pathfinder.transform); if (testWay != null) { foreach (iWayPlace pnp in testWay.pointsAndPaths) { if (pnp is Path) { Debug.Log(string.Format("{0}", ((Path)pnp).name)); } else if (pnp is PointOnMap) { Debug.Log(string.Format("{0}: {1}", ((PointOnMap)pnp).name, ((PointOnMap)pnp).shortWay.totalTime)); } } } } } }
public void DrawWay(float deltaTime, WayType wayType = WayType.MAINSTREET) { timeInWay += deltaTime * GetSpeedModifier(); lineRenderer.positionCount = 1; lineRenderer.SetPosition(0, startPlace.GetPoint().transform.position); float timeToPoint = 0; for (int i = 0; i < curWay.pointsAndPaths.Count; i++) { iWayPlace place = curWay.pointsAndPaths[i]; timeToPoint += place.GetTimeToWay(); if (place is PointOnMap) { lineRenderer.positionCount++; Vector3 wayPoint = new Vector3(place.GetPoint().transform.position.x, place.GetPoint().transform.position.y, place.GetPoint().transform.position.z + 0.01f * Agency.GetInstantiate().teams.IndexOf(this)); lineRenderer.SetPosition(lineRenderer.positionCount - 1, wayPoint); } else if (place is Path) { if (timeToPoint > timeInWay) { lineRenderer.positionCount++; float part = (timeInWay - timeToPoint + place.GetTimeToWay()) / place.GetTimeToWay(); PointOnMap end = (PointOnMap)curWay.pointsAndPaths[i + 1]; Vector3 partVector = ((Path)place).GetPointOnPath(end, part); Vector3 wayPoint = new Vector3(partVector.x, partVector.y, partVector.z + 0.01f * Agency.GetInstantiate().teams.IndexOf(this)); lineRenderer.SetPosition(lineRenderer.positionCount - 1, wayPoint); } } MapManager mapManager = MapManager.GetInstantiate(); if (detectives[0].activityPlace is iWayPlace && (iWayPlace)detectives[0].activityPlace == place) { if (timeToPoint <= timeInWay) { if (i == curWay.pointsAndPaths.Count - 1) { if (curTarget is Office) { ChangeActivity(DetectiveActivity.IN_OFFICE, curTarget); } else if (curTarget is DetectiveHome) { ChangeActivity(DetectiveActivity.IN_HOME, curTarget); } else if (curTarget is QuestEvent) { ChangeActivity(DetectiveActivity.IN_EVENT, curTarget); } Destroy(curWay.gameObject); } else { ChangeActivity(DetectiveActivity.IN_WAY, curWay.pointsAndPaths[i + 1]); } } break; } } }
public void GoTo(iActivityPlace target, WayType wayType, bool colorWay) { curTarget = target; ResetWayColor(); curWay = MapManager.GetInstantiate().pathfinder.GetWay(wayType, startPlace.GetPoint(), target.GetPoint(), transform); showWay = colorWay; ChangeActivity(DetectiveActivity.IN_WAY, curWay.pointsAndPaths[0]); }
public List <Path> GetAvaliablePaths(WayType type) { List <Path> retVal = new List <Path>(); foreach (Path path in avaliablePaths) { if (path.GetWayType() == WayType.MAINSTREET) { retVal.Add(path); } else if (path.GetWayType() == WayType.TRANSPORT && type == WayType.TRANSPORT) { retVal.Add(path); } else if (path.GetWayType() == WayType.BACKSTREET && type == WayType.BACKSTREET) { retVal.Add(path); } } return(retVal); }
// Token: 0x0600023C RID: 572 RVA: 0x0000768C File Offset: 0x00005A8C public void CngColor(WayType way) { switch (way) { case WayType.NONE: base.GetComponent <Image>().color = new Color(1f, 1f, 1f); break; case WayType.Mountain: base.GetComponent <Image>().color = new Color(0.5f, 1f, 0.5f); break; case WayType.Sea: base.GetComponent <Image>().color = new Color(0.5f, 0.5f, 1f); break; case WayType.Cave: base.GetComponent <Image>().color = new Color(1f, 1f, 0.5f); break; } }
public Edge(Vertex First, Vertex Second, WayType wayType) { this.wayType = wayType; LoopRotation = 0; FirstVertex = First; SecondVertex = Second; if (wayType == WayType.Loop) { FirstVertex = SecondVertex; } PropertyChangedEventHandler eh = new PropertyChangedEventHandler(ChildChanged); if (FirstVertex != null) { FirstVertex.PropertyChanged += eh; } if (SecondVertex != null) { secondVertex.PropertyChanged += eh; } }
/// <summary> /// Функция считавает таблицы на основании типа. /// При LightImport - isLight == true, order by orderBM /// При Import - order by orderBM /// При Export - needExport == true, order by orderPDA /// </summary> /// <param name="wayType">тип выбора таблиц</param> /// <returns>список выбранных таблиц с заполненными полями</returns> public static List<TableInfo> LoadTables(WayType wayType) { List<TableInfo> lt=new List<TableInfo>(); string sql = "select * from Transfer2PDA order by {0}"; switch(wayType) { case WayType.AllImport: case WayType.LightImport: query.Select(string.Format(sql, "OrderBM")); break; case WayType.Export: query.Select(string.Format(sql, "OrderPDA")); break; case WayType.ExportClear: query.Select(string.Format(sql, "OrderPDA desc")); break; } //if(wayType==WayType.Export) query.Select(string.Format(sql,"OrderPDA")); //else query.Select(string.Format(sql, "OrderBM")); List<DataRows> rows = query.GetRows(); TableInfo ti; foreach (DataRows row in rows) { ti=new TableInfo(); ti.idTransferTable = Convert.ToInt32(row.FieldByName("idTransferTable")); ti.tableName = row.FieldByName("tableName"); ti.isLight = row.FieldByName("isLight"); if(wayType==WayType.LightImport && ti.isLight=="0") continue; ti.needExport = row.FieldByName("needExport"); if (wayType == WayType.Export && ti.needExport == "0") continue; string idSelectBM=row.FieldByName("idQrySelectBM"); string idsql = "select text from QrySelect where idQrySelect={0}"; query.Select(string.Format(idsql, idSelectBM)); List<DataRows> idrows = query.GetRows(); ti.sqlText[QryType.SelectBM] = idrows[0].FieldByName("text"); string idSelectPDA = row.FieldByName("idQrySelectPDA"); idsql = "select text from QrySelect where idQrySelect={0}"; query.Select(string.Format(idsql, idSelectPDA)); idrows = query.GetRows(); ti.sqlText[QryType.SelectPDA] = idrows[0].FieldByName("text"); string idDelete = row.FieldByName("idQryDelete"); idsql = "select text from QryDelete where idQryDelete={0}"; query.Select(string.Format(idsql, idDelete)); idrows = query.GetRows(); ti.sqlText[QryType.Delete] = idrows[0].FieldByName("text"); string idClear = row.FieldByName("idQryClear"); idsql = "select text from QryClear where idQryClear={0}"; query.Select(string.Format(idsql, idClear)); idrows = query.GetRows(); ti.sqlText[QryType.Clear] = idrows[0].FieldByName("text"); string idInsert = row.FieldByName("idQryInsert"); idsql = "select text from QryInsert where idQryInsert={0}"; query.Select(string.Format(idsql, idInsert)); idrows = query.GetRows(); ti.sqlText[QryType.Insert] = idrows[0].FieldByName("text"); ti.fields = FieldInfo.LoadFields(ti.idTransferTable); lt.Add(ti); } return lt; }
// Token: 0x06000332 RID: 818 RVA: 0x0001082C File Offset: 0x0000EC2C public void getEvtTest() { if (this.pathNodeSelect) { this.EventResultText.GetComponent <Text>().text = "\n経路選択中のモードです。\n終了するには再度「経由」ボタンを押してください"; return; } if (this.travelResult.route == null) { this.EventResultText.GetComponent <Text>().text = "\n旅行データがありません。"; return; } this.eventResult = base.GetComponent <TravelSimulator>().getEvt(this.travelResult); string text = "\n経路:\n["; foreach (int num in this.travelResult.route) { text = text + num.ToString() + "-"; } if (this.travelResult.route.Count != 0) { text = text.Remove(text.Length - 1, 1); } text += "]"; string text2 = text; text = string.Concat(new object[] { text2, " [cost:", this.travelResult.cost, "]\n\n" }); text += "イベント:\n"; int num2 = 0; string text3 = string.Empty; foreach (TravelSimulator.Event @event in this.eventResult) { num2 += @event.time; text2 = text; text = string.Concat(new object[] { text2, num2.ToString(), "分(+", @event.time, ")\u3000" }); switch (@event.code) { case TravelSimulator.EventCode.START: text2 = text; text = string.Concat(new object[] { text2, "★ 出発(地点:", @event.val, ")" }); break; case TravelSimulator.EventCode.GOAL: text2 = text; text = string.Concat(new object[] { text2, "★ 目的地到着(地点:", @event.val, ")" }); if (text3 != string.Empty) { text = text + " [" + text3 + "]"; } break; case TravelSimulator.EventCode.TimeUp: text2 = text; text = string.Concat(new object[] { text2, "× 時間切れ(目標地点:", @event.val, ")" }); if (text3 != string.Empty) { text = text + " [" + text3 + "]"; } break; case TravelSimulator.EventCode.Arrival: text2 = text; text = string.Concat(new object[] { text2, "☆ 到着(地点:", @event.val, ")" }); break; case TravelSimulator.EventCode.Rest: text += "○ 休息開始"; break; case TravelSimulator.EventCode.RestComplete: text += "○ 休息終了"; break; case TravelSimulator.EventCode.Camp: text2 = text; text = string.Concat(new object[] { text2, "◆ イベント:野宿(地点:", @event.val, ")" }); break; case TravelSimulator.EventCode.Shortcut: { string str = text; string str2 = "◆ イベント:近道("; WayType val = (WayType)@event.val; text = str + str2 + val.ToString() + ")"; break; } case TravelSimulator.EventCode.Encount: { string str3 = text; string str4 = "◆ イベント:遭遇("; WayType val2 = (WayType)@event.val; text = str3 + str4 + val2.ToString() + ")"; break; } case TravelSimulator.EventCode.Picture_Normal: text2 = text; text = string.Concat(new object[] { text2, "■ 写真:通常(道:", @event.val, ")" }); if (text3 != string.Empty) { text = text + " [" + text3 + "]"; } break; case TravelSimulator.EventCode.Picture_Tools: text2 = text; text = string.Concat(new object[] { text2, "■ 写真:道具(道:", @event.val, ")" }); if (text3 != string.Empty) { text = text + " [" + text3 + "]"; } break; case TravelSimulator.EventCode.Picture_Unique: text2 = text; text = string.Concat(new object[] { text2, "■ 写真:ユニーク(道:", @event.val, ")" }); if (text3 != string.Empty) { text = text + " [" + text3 + "]"; } break; case TravelSimulator.EventCode.Traveler: text3 = SuperGameMaster.sDataBase.get_PictureCharaDB_forId(@event.val).name; text = text + "▲ 道連れ(キャラ:" + text3 + ")"; break; } text += "\n"; } text2 = text; text = string.Concat(new object[] { text2, "\n合計時間:", num2 / 60, "時間 ", num2 % 60, "分\n\n" }); this.EventResultText.GetComponent <Text>().text = text; }
// Token: 0x0600032D RID: 813 RVA: 0x00010150 File Offset: 0x0000E550 public void setResultText(TravelSimulator.Travel travel) { string text = "移動ノード:" + travel.route.Count + " / "; if (travel.route.Count != 0 && travel.route[0] % 1000 != 0) { text += "(テレポート)"; } for (int i = 0; i < travel.route.Count; i++) { text = text + travel.route[i].ToString() + " "; if (i == travel.route.Count - 1) { break; } if (travel.edgeType[i] != WayType.NONE) { WayType wayType = travel.edgeType[i]; if (wayType != WayType.Mountain) { if (wayType != WayType.Sea) { if (wayType == WayType.Cave) { text += "<color=olive>"; } } else { text += "<color=teal>"; } } else { text += "<color=green>"; } text += "> </color>"; } else { text += "> "; } } string text2 = string.Empty; for (int j = 0; j < travel.route.Count; j++) { if (j == travel.route.Count - 1) { break; } switch (travel.edgeType[j]) { case WayType.NONE: text2 += "<color=grey>"; break; case WayType.Mountain: text2 += "<color=green>"; break; case WayType.Sea: text2 += "<color=teal>"; break; case WayType.Cave: text2 += "<color=olive>"; break; } string text3 = text2; text2 = string.Concat(new object[] { text3, "<i>-", travel.edgeRoute[j], "- </i> " }); text2 += "</color>"; } this.MapResultText.GetComponent <Text>().text = string.Concat(new object[] { text, " [cost:", travel.cost, "]\n\n", text2 }); }
public StoneWayInfo(WayType wayTypeType, int x, int y) { WayTypeType = wayTypeType; X = x; Y = y; }
/// <summary> /// Rotation model by angle /// </summary> /// <param name="rotatonWay">Waytype Left/Right/Up/Down</param> /// <param name="rotationAngle">Rotation Angle degree</param> public void RotationByAngle(WayType rotatonWay, double rotationAngle) { try { if (rotatonWay == WayType.INVALID) return; Vector3D rotationaxis = new Vector3D(); if (rotatonWay == WayType.LEFT) rotationaxis = new Vector3D(0, -1, 0); else if (rotatonWay == WayType.RIGHT) rotationaxis = new Vector3D(0, 1, 0); else if (rotatonWay == WayType.UP) rotationaxis = new Vector3D(-1, 0, 0); else if (rotatonWay == WayType.DOWN) rotationaxis = new Vector3D(1, 0, 0); _MachineModel.RotateObjectByAngle(rotationaxis, rotationAngle); if (_IsMachinePostHide && !_IsLargeScale) { _MachineModel.ScaleMachinePost(new Point3D(1, 1, 1)); _IsMachinePostHide = false; } } catch (Exception ex) { _Log4NetClass.ShowError(ex.ToString(), "RotationByAngle"); } }
public Way GetWay(WayType type, PointOnMap start, PointOnMap final, Transform parent) { ClearAllWays(); GameObject goWay = new GameObject("curWay"); goWay.transform.parent = parent; Way retVal = goWay.AddComponent <Way>(); bool end = false; List <PointOnMap> closePoint = new List <PointOnMap>(); List <PointOnMap> openPoint = new List <PointOnMap>(); openPoint.Add(start); while (!end) { foreach (PointOnMap point in openPoint) { foreach (Path path in point.GetAvaliablePaths(type)) { if (openPoint.Contains(path.points[0]) && !openPoint.Contains(path.points[1]) && !closePoint.Contains(path.points[1])) { closePoint.Add(path.points[1]); } else if (!openPoint.Contains(path.points[0]) && openPoint.Contains(path.points[1]) && !closePoint.Contains(path.points[0])) { closePoint.Add(path.points[0]); } } } if (closePoint.Count == 0) { break; } PointOnMap minTimePoint = null; foreach (PointOnMap point in closePoint) { if (!point.shortWay.check) { Path shortPath = null; PointOnMap neaborPoint = null; float shortTime = 0; foreach (Path path in point.GetAvaliablePaths(type)) { if (openPoint.Contains(path.points[0])) { if (shortPath == null || (shortTime > path.timeToWay + path.points[0].shortWay.totalTime)) { shortPath = path; neaborPoint = path.points[0]; shortTime = path.timeToWay + path.points[0].shortWay.totalTime; } } else if (openPoint.Contains(path.points[1])) { if (shortPath == null || (shortTime > path.timeToWay + path.points[1].shortWay.totalTime)) { shortPath = path; neaborPoint = path.points[1]; shortTime = path.timeToWay + path.points[1].shortWay.totalTime; } } } point.shortWay.totalTime = shortTime; foreach (iWayPlace pom in neaborPoint.shortWay.pointsAndPaths) { point.shortWay.pointsAndPaths.Add(pom); } point.shortWay.pointsAndPaths.Add(shortPath); point.shortWay.pointsAndPaths.Add(point); point.shortWay.check = true; } if (minTimePoint == null || minTimePoint.shortWay.totalTime > point.shortWay.totalTime) { minTimePoint = point; } } if (minTimePoint == final) { end = true; retVal.copyFrom(minTimePoint.shortWay); } else { openPoint.Add(minTimePoint); closePoint.Remove(minTimePoint); } } return(retVal); }
/// <summary> /// Функция считавает таблицы на основании типа. /// При LightImport - isLight == true, order by orderBM /// При Import - order by orderBM /// При Export - needExport == true, order by orderPDA /// </summary> /// <param name="wayType">тип выбора таблиц</param> /// <returns>список выбранных таблиц с заполненными полями</returns> public static List<TableInfo> LoadTables(WayType wayType) { List<TableInfo> lt=new List<TableInfo>(); string sql = "select * from Transfer2PDA order by {0}"; switch(wayType) { case WayType.AllImport: case WayType.LightImport: query.Select(string.Format(sql, "OrderBM")); break; case WayType.Export: query.Select(string.Format(sql, "OrderPDA")); break; case WayType.ExportClear: query.Select(string.Format(sql, "OrderPDA desc")); break; } //if(wayType==WayType.Export) query.Select(string.Format(sql,"OrderPDA")); //else query.Select(string.Format(sql, "OrderBM")); List<DataRows> rows = query.GetRows(); TableInfo ti; foreach (DataRows row in rows) { ti=new TableInfo(); ti.idTransferTable = Convert.ToInt32(row.FieldByName("idTransferTable")); ti.tableName = row.FieldByName("tableName"); ti.isLight = row.FieldByName("isLight"); if(wayType==WayType.LightImport && ti.isLight=="0") continue; ti.needExport = row.FieldByName("needExport"); if (wayType == WayType.Export && ti.needExport == "0") continue; string idSelectBM=row.FieldByName("idQrySelectBM"); string idsql = "select text from QrySelect where idQrySelect={0}"; query.Select(string.Format(idsql, idSelectBM)); List<DataRows> idrows = query.GetRows(); ti.sqlText[QryType.SelectBM] = idrows[0].FieldByName("text"); string idSelectPDA = row.FieldByName("idQrySelectPDA"); idsql = "select text from QrySelect where idQrySelect={0}"; query.Select(string.Format(idsql, idSelectPDA)); idrows = query.GetRows(); ti.sqlText[QryType.SelectPDA] = idrows[0].FieldByName("text"); string idDelete = row.FieldByName("idQryDelete"); idsql = "select text from QryDelete where idQryDelete={0}"; query.Select(string.Format(idsql, idDelete)); idrows = query.GetRows(); ti.sqlText[QryType.Delete] = idrows[0].FieldByName("text"); string idClear = row.FieldByName("idQryClear"); idsql = "select text from QryClear where idQryClear={0}"; query.Select(string.Format(idsql, idClear)); idrows = query.GetRows(); ti.sqlText[QryType.Clear] = idrows[0].FieldByName("text"); string idInsert = row.FieldByName("idQryInsert"); idsql = "select text from QryInsert where idQryInsert={0}"; query.Select(string.Format(idsql, idInsert)); idrows = query.GetRows(); ti.sqlText[QryType.Insert] = idrows[0].FieldByName("text"); ti.fields = FieldInfo.LoadFields(ti.idTransferTable); lt.Add(ti); } return lt; }
/// <summary> /// convert csv data to real data plot /// </summary> /// <param name="inputY"></param> /// <returns></returns> private double DataToRealAxisPlot(string plotType, double inputY, WayType wayType, int senserIndex, TargetType targetType) { try { double outp = 0; double datahigh = _SensorsHighValue[senserIndex] - _SensorsLowValue[senserIndex]; //double midpoint = (_SensorsHighValue[senserIndex] + _SensorsLowValue[senserIndex]) / 2; //double datascale = _DataScaleforEachObject[(int)targetType]; if (datahigh <= 0) datahigh = _DefaultDataHigh; if (plotType == "Y") { //outp = ((_MaxOffsetY / _DataHeight) * (inputY - _LowValue)) + (-_MaxOffsetY); outp = ((_MaxOffsetY / datahigh) * (inputY - _SensorsLowValue[senserIndex])) + (-_MaxOffsetY); //outp = (datascale * (inputY - _SensorsLowValue[senserIndex]) / 1000) + (-_MaxOffsetY); //if (outp >= 0) //{ // outp = 0; //} //else if (outp <= -_MaxOffsetY - _UpperModelPositions[3].SizeY) //{ // outp = -_MaxOffsetY - _UpperModelPositions[3].SizeY; //} } else if (plotType == "X" || plotType == "Z") { //outp = ((_MaxOffsetXZ / datahigh) * (inputY - midpoint)); outp = (_MaxOffsetY / datahigh) * (inputY - _SensorsLowValue[senserIndex]); //outp = (datascale * (inputY - _SensorsLowValue[senserIndex]) / 1000); //outp = datascale * (inputY - _SensorsLowValue[senserIndex]); if (plotType == "X") { if (wayType == WayType.RIGHT) { outp *= -1; } //if (outp <= -_MaxOffsetXZ) //{ // outp = -_MaxOffsetXZ; //} //else if (outp >= _MaxOffsetXZ) //{ // outp = _MaxOffsetXZ; //} } else if (plotType == "Z") { if (wayType == WayType.DOWN) outp *= -1; //if (outp >= _MaxOffsetXZ) //{ // outp = _MaxOffsetXZ; //} //else if (outp <= -_MaxOffsetXZ) //{ // outp = -_MaxOffsetXZ; //} } } return outp; } catch (Exception ex) { throw ex; } }