/// <summary>
    /// 移动巡检
    /// </summary>
    /// <param name="hub"></param>
    /// <param name="methodCall"></param>
    private void GetInspectionTrack(Hub hub, MethodCallMessage methodCall)
    {
        try
        {
            //Debug.LogError("GetInspectionTrack");
            var arg0 = methodCall.Arguments[0];
            //Debug.LogError(arg0);
            string json = JsonMapper.ToJson(arg0);
            //Debug.LogError(json);
            InspectionTrackList inspection = JsonMapper.ToObject <InspectionTrackList>(json);

            //List<InspectionTrack> inspections = JsonMapper.ToObject<List<InspectionTrack>>(json);
            //Debug.LogError(inspection == null);
            //if (inspection != null)
            //{
            //    Debug.LogError(inspection.Count);
            //}

            if (OnInspectionTrackRecieved != null)
            {
                OnInspectionTrackRecieved(inspection);
            }
        }
        catch (Exception ex)
        {
            //Debug.LogError("GetInspectionTrack:" + ex);
        }
    }
예제 #2
0
    /// <summary>
    /// 获取巡检轨迹数据
    /// </summary>
    public void OnInspectionRecieved(InspectionTrackList info)
    {
        //Debug.Log("OnInspectionRecieved");
        InspectionTrack[] AddTrack    = info.AddTrack;    //添加巡检轨迹
        InspectionTrack[] ReviseTrack = info.ReviseTrack; //修改
        InspectionTrack[] DeleteTrack = info.DeleteTrack; //删除
        for (int i = 0; i < AddTrack.Length; i++)
        {
            InspectionTrack item = AddTrack[i];
            InspectionTrack it   = InspectionTrackList.Find(p => p.Id == item.Id);
            if (it == null)
            {
                InspectionTrackList.Add(item);
            }
            else
            {
                Debug.LogError("OnInspectionRecieved AddTrack it != null");
            }
        }

        for (int i = 0; i < ReviseTrack.Length; i++)
        {
            InspectionTrack item = ReviseTrack[i];
            InspectionTrack it   = InspectionTrackList.Find(p => p.Id == item.Id);
            if (it != null)
            {
                int id = InspectionTrackList.IndexOf(it);
                InspectionTrackList [id] = item;
            }
            else
            {
                Debug.LogError("OnInspectionRecieved ReviseTrack it == null");
            }
        }

        for (int i = 0; i < DeleteTrack.Length; i++)
        {
            InspectionTrack item = DeleteTrack[i];
            InspectionTrack it   = InspectionTrackList.Find(p => p.Id == item.Id);
            if (it != null)
            {
                InspectionTrackList.Remove(it);
            }
            else
            {
                Debug.LogError("OnInspectionRecieved DeleteTrack it == null");
            }
        }
        //Debug.Log(InspectionTrackList.Count);
        DisplayInspectionTrackList();
    }
예제 #3
0
 public void Trys(InspectionTrackList aa)
 {
     throw new NotImplementedException();
 }
 public void Trys(InspectionTrackList aa)
 {
 }