public List <DBTrack> GetTrackInfoByRoundID(string roundID) { DBTrack track = new DBTrack(); DataSet dataSet = track.GetList(" roundID = \"" + roundID + "\""); List <DBTrack> list = track.Fill(dataSet); return(list); }
public TrackInfo GetTrackInfoFromDB(string trackID) { DBTrack track = DBAccessor.Instance.GetTrackInfoByID(trackID); if (track == null || string.IsNullOrEmpty(track.ID)) { Debug.LogWarning("没有轨迹资料" + trackID); return(null); } return(RoundInfoTransformer.Instance.GetTrackInfo(track)); }
public TrackInfo GetTrackInfoFromDB(int trackIndex) { if (m_TrackInfoDic.ContainsKey(trackIndex)) { return(m_TrackInfoDic[trackIndex]); } else { DBTrack track = DBAccessor.Instance.GetTrackInfoByIndexID(trackIndex); if (track == null || string.IsNullOrEmpty(track.ID)) { Debug.LogWarning("没有轨迹Index资料" + trackIndex); return(null); } TrackInfo trackInfo = RoundInfoTransformer.Instance.GetTrackInfo(track); m_TrackInfoDic.Add(trackIndex, trackInfo); return(trackInfo); } }
public TrackInfo GetTrackInfo(DBTrack trackinfo) { TrackInfo info = new TrackInfo(); info.RoundID = trackinfo.roundID; info.ID = trackinfo.ID; info.Index = trackinfo.Index; string[] horizonSplit = trackinfo.traceString.Split('|'); string sign = horizonSplit[0]; string frameString = horizonSplit[1]; string touchPointsString = horizonSplit[2]; string timesString = horizonSplit[3]; string touchAreaString = horizonSplit[4]; string rotationSpeedString = horizonSplit[5]; if (sign != "1") { Debug.LogError("字符串不是以1开头, 不是轨迹格式:" + trackinfo.traceString); return(null); } //落地点 info.TouchTablePoints = new List <Vector3>(); info.TouchTablePoints.Add(GetPoint(trackinfo.touchdown_p1)); info.TouchTablePoints.Add(GetPoint(trackinfo.touchdown_p2)); //开始结束时间 string[] times = timesString.Split(';'); info.StartTimeStamp = float.Parse(times[0]); info.EndTimeStamp = float.Parse(times[1]); info.OverNetHeight = (int)trackinfo.overNetHeight.Value; info.Speed = (int)trackinfo.maxSpeed.Value; info.Rotate = (int)trackinfo.maxRotateSpeed.Value; //帧信息 info.FrameInfos = ParseFrameString(frameString, info.RoundID, info.Index); //touch point所在的frame位置, 先检测有几个合法的touch点 List <Vector3> validTouchPointList = new List <Vector3>(); for (int i = 0; i < info.TouchTablePoints.Count; i++) { Vector3 point = info.TouchTablePoints[i]; if (ValidTouchPoint(point)) { if (validTouchPointList.Count == 0 || Vector3.Distance(validTouchPointList[validTouchPointList.Count - 1], point) > 1f) { validTouchPointList.Add(point); } } } info.TouchTableFrameNumber = new List <int>(); if (validTouchPointList.Count > 0) { //记录距离touch point最近的Frame, index就是touchPoint在validTouchPointList的索引 List <int> touchPointToFrameNumber = new List <int>(); List <float> touchPointToDistance = new List <float>(); for (int i = 0; i < validTouchPointList.Count; i++) { touchPointToDistance.Add(float.MaxValue); touchPointToFrameNumber.Add(0); } for (int i = 0; i < info.FrameInfos.Count; i++) { FrameInfo frame = info.FrameInfos[i]; for (int j = 0; j < validTouchPointList.Count; j++) { float dis = Vector3.Distance(frame.FramePos, validTouchPointList[j]); if (dis < touchPointToDistance[j]) { touchPointToDistance[j] = dis; touchPointToFrameNumber[j] = i; } if (dis < 1f) { info.TouchTableFrameNumber.Add(i); } } } if (info.TouchTableFrameNumber.Count != validTouchPointList.Count) { #if UNITY_EDITOR Debug.LogWarning("落地点 不在球轨迹中, 落地点数量: " + validTouchPointList.Count + " 轨迹中有的落地点: " + info.TouchTableFrameNumber.Count); if (validTouchPointList.Count > 0) { for (int i = 0; i < validTouchPointList.Count; i++) { Debug.LogWarning("落地点: " + validTouchPointList[i]); } } if (info.TouchTableFrameNumber.Count > 0) { for (int i = 0; i < info.TouchTableFrameNumber.Count; i++) { Debug.LogWarning("轨迹中落地点: " + info.FrameInfos[info.TouchTableFrameNumber[i]].FramePos); } } for (int i = 0; i < touchPointToFrameNumber.Count; i++) { Debug.LogWarning("记录的距离落地点最近的: " + info.FrameInfos[touchPointToFrameNumber[i]].FramePos); } #endif info.TouchTableFrameNumber.Clear(); for (int i = 0; i < touchPointToFrameNumber.Count; i++) { info.TouchTableFrameNumber.Add(touchPointToFrameNumber[i]); } } } return(info); }
public DBTrack GetTrackInfoByIndexID(int indexID) { DBTrack track = new DBTrack(indexID); return(track); }
public DBTrack GetTrackInfoByID(string trackID) { DBTrack track = new DBTrack(trackID); return(track); }