示例#1
0
        public List <GPSItem> GetGpsListByUser(GPSItem userGpsItem)
        {
            //玩家
            if (userGpsItem.userType == 0)
            {
                int            roomId  = GetRoomByUser(userGpsItem.userId);
                List <GPSItem> gpsList = GetGpsListByRoomId(roomId.ToString());
                return(gpsList);
            }
            //管理员
            else if (userGpsItem.userType == 1)

            {
                //查询所有用户的grounp
                List <int>     grounpIDs = searchGrounpDao.SearchGrounpListByUser(userGpsItem.userId);
                List <GPSItem> result    = new List <GPSItem>();
                grounpIDs.ForEach((item) => {
                    int[] roomIds = GetRoomListByGrounpId(item);

                    for (int k = 0; k < roomIds.Length; k++)
                    {
                        List <GPSItem> gpsList = GetGpsListByRoomId(roomIds[k].ToString());
                        if (gpsList != null)
                        {
                            result.AddRange(gpsList);
                        }
                    }
                });
                return(result);
            }

            return(null);
        }
示例#2
0
    void GetPoint()
    {
        Debug.Log("开始导览点1");
        foreach (var info in JsonClass.Instance.NavigationInfos)
        {
            Debug.Log("开始导览点2");
            Debug.Log(info.type);
            HttpManager.Instance.Download(info.baseEntity.thumbnail, (() =>
            {
                Debug.Log("生成实景导览点");
                GPSItem item = GameObject.Instantiate <GPSItem>(obj);
                item.id = info.baseEntity.id;
                item.locationX = info.baseEntity.locationX;
                item.locationY = info.baseEntity.locationY;
                item.name = info.baseEntity.name;
                item.height = info.baseEntity.height;
                item.typeName = info.type;
                item.content = info.baseEntity.content;
                item.thumbnail = info.baseEntity.thumbnail;
                item.address = info.baseEntity.address;

                GPSItems.Add(item);
            }));
        }
    }
示例#3
0
 public ResponseModel AddCar(string carNum)
 {
     var obj = _context.GPSItems.FirstOrDefault(x => x.CardNum == carNum);
     if(obj!=null)
     {
         _response.Msg = "该车牌已存在!";
         return _response;
     }
     try
     {
         GPSItem item = new GPSItem();
         item.Id = Guid.NewGuid();
         item.CardNum = carNum;
         item.Code = carNum;
         item.Lat = 0;
         item.Lng = 0;
         item.LastUpdateTime = DateTime.Now;
         item.Name = carNum;
         _context.GPSItems.Add(item);
         _response.Stutas = _context.SaveChanges()>0;
     }
     catch(Exception ex)
     {
         _response.Msg = ex.Message;
     }
     return _response;
 }
示例#4
0
    private void Awake()
    {
        item = transform.GetComponent <GPSItem>();
        Transform iconRoot = GameObject.Find("Canvas/Markers").transform;

        state = Instantiate(Resources.Load(stateIconPrefab)) as GameObject;
        GpsConvert.icon.Add(state);
        state.name   = item.name;
        recTransform = state.GetComponent <RectTransform>();
        recTransform.SetParent(iconRoot);

        web = GameObject.Find(GlobalInfo.websiterequest).GetComponent <webrequest>();

        webbtn = state.transform.Find("infobg").GetComponent <Button>();
        webbtn.onClick.AddListener(delegate()
        {
            web.LoadWebSetTitle(item.address, item.name);
        });

        raw = state.transform.Find("infobg/pic").GetComponent <RawImage>();

        infodisText       = state.transform.Find("infobg/pic/bottom/distance").GetComponent <Text>();
        infonameText      = state.transform.Find("infobg/pic/bottom/name").GetComponent <Text>();
        infonameText.text = item.name;
        describeText      = state.transform.Find("infobg/info").GetComponent <Text>();
        describeText.text = item.content;

        infobg  = state.transform.Find("infobg").GetComponent <Transform>();
        iconbg  = state.transform.Find("iconbg").GetComponent <Transform>();
        namebg1 = state.transform.Find("namebg1").GetComponent <Transform>();
        namebg2 = state.transform.Find("namebg2").GetComponent <Transform>();
        LoadType(item.typeName);

        StartCoroutine(LoadImgFromCache(item.thumbnail.localPath, raw));
    }
        public override void ExecuteCommand(PubgSession session, StringRequestInfo requestInfo)
        {
            SessionItem sessionItem = null;

            PubgSession.mOnLineConnections.TryGetValue(session, out sessionItem);
            if (sessionItem != null)
            {
                GPSItem gpsItem = Utils.CollectionsConvert.ToObject <GPSItem>(requestInfo.Body.ToString());
                sessionItem.gpsItem = gpsItem;
            }
            // Console.WriteLine("收到客户端位置更新:" + session.RemoteEndPoint);
        }
示例#6
0
 public bool AddCar(string carNum,string location)
 {
     try
     {
         GPSItem item = new GPSItem();
         item.Id = Guid.NewGuid();
         item.CardNum = carNum;
         item.Code = carNum;
         item.Lat = 0;
         item.Lng = 0;
         item.LastUpdateTime = DateTime.Now;
         item.Name = carNum;
         item.LoacationInfo = location;
         _context.GPSItems.Add(item);
         return  _context.SaveChanges() > 0;
     }
     catch (Exception ex)
     {
         _response.Msg = ex.Message;
     }
     return false;
 }
示例#7
0
 private void SendData()
 {
     //  TestData();
   //  MessageShow.instance.ShowMesage("isEnabledByUser="******":"+ Application.internetReachability);
     if (Input.location.isEnabledByUser && Application.internetReachability != NetworkReachability.NotReachable)
     {
         
         float lat = Input.location.lastData.latitude;
         float lon = Input.location.lastData.longitude;
         double[] datas = GPSTools.gps84_To_Gcj02(lat, lon);
         double _lat = datas[0];
         double _lon = datas[1];
         GPSItem gpsItem = new GPSItem();
        // gpsItem.telephone = LoginInfo.Userinfo.telephone;
         gpsItem.userName = LoginInfo.Userinfo.name;
         gpsItem.userId = LoginInfo.Userinfo.id;
         gpsItem.lat = _lat;
         gpsItem.lon = _lon;
         gpsItem.userType = LoginInfo.Userinfo.type;
         string json = Utils.CollectionsConvert.ToJSON(gpsItem);
         string sendData = CommandName.UpdatePosition.ToString() + Constant.START_SPLIT + json;
         SocketService.instance.SendData(sendData);
     }
     else
     {
         GPSItem gpsItem = new GPSItem();
         // gpsItem.telephone = LoginInfo.Userinfo.telephone;
         gpsItem.userName = LoginInfo.Userinfo.name;
         gpsItem.userId = LoginInfo.Userinfo.id;
         gpsItem.lat = 34.218229;
         gpsItem.lon = 108.964176;
         gpsItem.userType = LoginInfo.Userinfo.type;
         string json = Utils.CollectionsConvert.ToJSON(gpsItem);
         string sendData = CommandName.UpdatePosition.ToString() + Constant.START_SPLIT + json;
         SocketService.instance.SendData(sendData);
     }
 }
示例#8
0
    // Use this for initialization
    private void Awake()
    {
        instance = this;
        n        = (equatorialRadius - polarRadius) / (equatorialRadius + polarRadius);
        rm       = POW(equatorialRadius * polarRadius, 1 / 2.0);
        e        = Math.Sqrt(1 - POW(polarRadius / equatorialRadius, 2));
        e1sq     = e * e / (1 - e * e);

        if (!isDown)
        {
            HttpManager.Instance.GetNavigationInfo((b =>
            {
                if (b)
                {
                    isDown = true;
                    Debug.Log(JsonClass.Instance.NavigationInfos.Count);
                    int totalCount = 0;
                    int curCount = 0;
                    totalCount = JsonClass.Instance.NavigationInfos.Count;
                    foreach (var info in JsonClass.Instance.NavigationInfos)
                    {
                        // Debug.Log(info.type);
                        HttpManager.Instance.Download(info.baseEntity.thumbnail, (() =>
                        {
                            // Debug.Log("下载实景导览图片");
                            GPSItem item = GameObject.Instantiate <GPSItem>(obj);
                            item.id = info.baseEntity.id;
                            item.locationX = info.baseEntity.locationX;
                            item.locationY = info.baseEntity.locationY;
                            item.name = info.baseEntity.name;
                            item.height = info.baseEntity.height;
                            item.typeName = info.type;
                            item.content = info.baseEntity.description;
                            item.thumbnail = info.baseEntity.thumbnail;
                            item.address = info.baseEntity.address;
                            GPSItems.Add(item);
                        }));

                        curCount++;
                        if (curCount == totalCount)
                        {
                            StartCoroutine(StartGPS());
                        }
                    }
                }
            }));
        }
        else
        {
            int totalCount = 0;
            int curCount   = 0;
            totalCount = JsonClass.Instance.NavigationInfos.Count;
            foreach (var info in JsonClass.Instance.NavigationInfos)
            {
                Debug.Log(info.type);
                HttpManager.Instance.Download(info.baseEntity.thumbnail, (() =>
                {
                    GPSItem item = GameObject.Instantiate <GPSItem>(obj);
                    item.id = info.baseEntity.id;
                    item.locationX = info.baseEntity.locationX;
                    item.locationY = info.baseEntity.locationY;
                    item.name = info.baseEntity.name;
                    item.height = info.baseEntity.height;
                    item.typeName = info.type;
                    item.content = info.baseEntity.description;
                    item.thumbnail = info.baseEntity.thumbnail;
                    item.address = info.baseEntity.address;
                    GPSItems.Add(item);
                }));

                curCount++;
                if (curCount == totalCount)
                {
                    StartCoroutine(StartGPS());
                }
            }
        }


        point = getLocation();
    }
示例#9
0
    public object ExecuteCommand(string body, string[] parameter)
    {
        Dictionary <string, object> resultDic = Utils.CollectionsConvert.ToObject <Dictionary <string, object> >(body);
        string         gpsJson  = Utils.CollectionsConvert.ToJSON(resultDic["gpsData"]);
        List <GPSItem> gpsItems = Utils.CollectionsConvert.ToObject <List <GPSItem> >(gpsJson);

        string grounpJson = Utils.CollectionsConvert.ToJSON(resultDic["grounp"]);

        Grounp grounp = Utils.CollectionsConvert.ToObject <Grounp>(grounpJson);

        string roomJson = Utils.CollectionsConvert.ToJSON(resultDic["room"]);
        Room   room     = Utils.CollectionsConvert.ToObject <Room>(roomJson);


        string lifeJson = Utils.CollectionsConvert.ToJSON(resultDic["life"]);
        Life   life     = Utils.CollectionsConvert.ToObject <Life>(lifeJson);


        if (grounp == null)
        {
            grounp = new Grounp();
        }
        //if (gpsItems==null || gpsItems.Count==0)
        //{
        //   // MessageShow.instance.ShowMesage("发送数据为空");
        //    return null;
        //}
        GPSItem currentUser = null;

        for (int i = 0; gpsItems != null && i < gpsItems.Count; i++)
        {
            if (gpsItems[i].userId.Equals(LoginInfo.Userinfo.id))
            {
                gpsItems[i].color = colors[0];
                currentUser       = gpsItems[i];
            }
            else
            {
                gpsItems[i].color = colors[1];
            }
        }
        if (currentUser == null)
        {
            currentUser = new GPSItem();
            float    lat   = Input.location.lastData.latitude;
            float    lon   = Input.location.lastData.longitude;
            double[] datas = GPSTools.gps84_To_Gcj02(lat, lon);
            currentUser.lat      = datas[0];
            currentUser.lon      = datas[1];
            currentUser.userId   = LoginInfo.Userinfo.id;
            currentUser.userName = LoginInfo.Userinfo.name;
            currentUser.userType = 1;
        }

        Dictionary <string, object> result = new Dictionary <string, object>();

        result.Add("currentUser", currentUser);
        result.Add("gpsData", gpsItems);
        result.Add("grounp", grounp);
        result.Add("room", room);
        result.Add("life", life);
        result.Add("ip", Config.parse("ServerIP"));

        string sendJson = Utils.CollectionsConvert.ToJSON(result);

        //Debug.Log(sendJson);
        ShowMapPoint.instacne.Show(Utils.CollectionsConvert.ToJSON(sendJson));
        return(null);
    }