Esempio n. 1
0
    public void OpenPanelRegular(POIData data, double distance)
    {
        currentData = data;

        if (data.typeOfPOI == POIData.TypeOfPOI.AR)
        {
            ARInfoLayout.instance.RefreshInfoAR_FromPOI();
        }
        else if (data.typeOfPOI == POIData.TypeOfPOI.OldPicture)
        {
            ARInfoLayout.instance.RefreshInfoOldPhoto_FromPOI();
        }
        else if (data.typeOfPOI == POIData.TypeOfPOI.Bus)
        {
            ARInfoLayout.instance.RefreshInfoBus_FromPOI();
        }
        else if (data.typeOfPOI == POIData.TypeOfPOI.ArtGallery)
        {
            ARInfoLayout.instance.RefreshInfoGallery_FromPOI();
        }

        ARInfoLayout.instance.SetMeterDistanceDisplay(distance);
        CheckOpenARReady();
        OpenSelf(null);
    }
Esempio n. 2
0
        private static void LoadPointsOfinterest()
        {
            string query =
                "SELECT ID, PositionX, PositionY, Icon, Flags, Importance, Name " +
                $"FROM {Settings.TDBDatabase}.points_of_interest ORDER BY ID;";

            using (var reader = SQLConnector.ExecuteQuery(query))
            {
                if (reader == null)
                {
                    return;
                }

                while (reader.Read())
                {
                    var poiData = new POIData()
                    {
                        ID         = Convert.ToUInt32(reader["ID"]),
                        PositionX  = Convert.ToSingle(reader["PositionX"]),
                        PositionY  = Convert.ToSingle(reader["PositionY"]),
                        Icon       = Convert.ToUInt32(reader["Icon"]),
                        Flags      = Convert.ToUInt32(reader["Flags"]),
                        Importance = Convert.ToUInt32(reader["Importance"]),
                        Name       = Convert.ToString(reader["Name"])
                    };

                    POIs.Add(poiData);
                }
            }
        }
Esempio n. 3
0
    // Update is called once per frame
    void CreateTextObjects(string xmlFileText)
    {
        XmlDocument xmlDoc = new XmlDocument();

        xmlDoc.LoadXml(xmlFileText);

        var nodes = xmlDoc.GetElementsByTagName("node");

        poiData = new POIData[nodes.Count];

        var i = 0;

        foreach (XmlNode node in nodes)
        {
            float lat = float.Parse(node.Attributes["lat"].Value);
            float lng = float.Parse(node.Attributes["lon"].Value);

            var name = GetNodeName(node);


            poiData[i] = new POIData
            {
                location = new Location(lat, lng, height),
                name     = name
            };

            i++;
        }


        for (var k = 0; k < poiData.Length; k++)
        {
            AddPOI(poiData[k].location, poiData[k].name);
        }
    }
Esempio n. 4
0
    void SpawnPOI(SelectableTile tile)
    {
        GameObject prefabObject;

        switch (tile.PointOfInterest)
        {
        case POIkind.Altar:
            prefabObject = AltarIslandPrefab;
            break;

        case POIkind.Portal:
            prefabObject = PortalIslandPrefab;
            break;

        case POIkind.Mission:
            prefabObject = MissionPrefab;
            break;

        case POIkind.Chest:
            prefabObject = ChestPrefab;
            break;

        case POIkind.Current:
            prefabObject = CurrentPrefab;
            break;

        case POIkind.Obstacle:
            prefabObject = ObstaclePrefab;
            break;

        case POIkind.Observatory:
            prefabObject = ObservatoryPrefab;
            break;

        default:
            prefabObject = null;
            break;
        }
        if (prefabObject != null)
        {
            GameObject poiOBject = Instantiate(prefabObject) as GameObject;
            poiOBject.transform.SetParent(tile.transform);
            poiOBject.transform.position = new Vector3(tile.transform.position.x, tile.transform.position.y, 0);
            if (!Player.Instance.POIDataByTiles.ContainsKey(tile.BoardCoordsAsString))
            {
                POIData poiData = poiOBject.GetComponentInChildren <PointOfInterest> ().POIData;
                Player.Instance.POIDataByTiles.Add(tile.BoardCoordsAsString, poiData);
                Player.Instance.POIDatas.Add(poiData);
            }
            else
            {
                poiOBject.GetComponentInChildren <PointOfInterest> ().POIData = Player.Instance.POIDataByTiles [tile.BoardCoordsAsString];
                if (poiOBject.GetComponentInChildren <PointOfInterest> ().POIData.POIkind == POIkind.Chest && poiOBject.GetComponentInChildren <PointOfInterest> ().POIData.Interacted)
                {
                    poiOBject.SetActive(false);
                }
            }
        }
    }
Esempio n. 5
0
    public void ImportPOIData(string csvFile)
    {
        //讀入 CSV 檔案,使其分為 string 二維陣列
        CsvParser csvParser = new CsvParser();

        string[][] csvTable = csvParser.Parse(csvFile);

        var tempList = transform.Cast <Transform>().ToList();

        foreach (var child in tempList)
        {
            DestroyImmediate(child.gameObject);
        }

        for (int i = 1; i < csvTable.Length; i++)
        {
            string poiName = csvTable[i][(int)CSVIndex.NAME];
            string fileName_now = csvTable[i][(int)CSVIndex.NOW_PIC];
            string fileName_old = csvTable[i][(int)CSVIndex.OLD_PIC];
            string description = csvTable[i][(int)CSVIndex.DESCRIPTION];
            string m_color = csvTable[i][(int)CSVIndex.MARKER_COLOR];
            string youtube = csvTable[i][(int)CSVIndex.YOUTUBE];
            double Lat_User, Lon_User, Lat_Goal, Lon_Goal;
            double.TryParse(csvTable[i][(int)CSVIndex.LAT_USER], out Lat_User);
            double.TryParse(csvTable[i][(int)CSVIndex.LON_USER], out Lon_User);
            double.TryParse(csvTable[i][(int)CSVIndex.LAT_GOAL], out Lat_Goal);
            double.TryParse(csvTable[i][(int)CSVIndex.LON_GOAL], out Lon_Goal);

            //Debug.Log(poiName + "\n" + Lat_User + "\n" + Lon_User + "\n" + Lat_Goal + "\n" + Lon_Goal + "\n" + description + "\n");

            GameObject poi = new GameObject();
            poi.tag = "POI";
            POIData data = poi.AddComponent <POIData>();
            data.POI_Name       = poiName;
            data.Latitude_User  = Lat_User;
            data.Longitude_User = Lon_User;
            data.Latitude_Goal  = Lat_Goal;
            data.Longitude_Goal = Lon_Goal;
            data.nowPictureName = fileName_now;
            data.oldPictureName = fileName_old;
            data.description    = description;
            data.YoutubeURL     = youtube;
            data.ColorMarker    = IconPack.Find((x) => x.name == m_color);

            if (!string.IsNullOrEmpty(fileName_now))
            {
                StartCoroutine(DownloadImage(fileName_now, data.NowPictureSetter));
            }
            if (!string.IsNullOrEmpty(fileName_old))
            {
                StartCoroutine(DownloadImage(fileName_old, data.OldPictureSetter));
            }

            poi.transform.parent = transform;
            poi.name             = string.Format("POI_{0}", poiName);
        }
    }
Esempio n. 6
0
 public TestContext Clone()
 {
     return(new TestContext()
     {
         SIRInfo = SIRInfo.Clone(),
         Persons = Persons.Clone(),
         MoveStatus = MoveStatus.Clone(),
         POIData = POIData.Clone(),
         WorldClock = WorldClock,
         Size = Size
     });
 }
Esempio n. 7
0
    public void OpenInfoBoxWithPOI(POIData data)
    {
        currentData = data;

        Title.text     = data.POI_Name;
        MapIcon.sprite = data.ColorMarker == null? MapIcon.sprite : data.ColorMarker;
        ContentYoutube.gameObject.SetActive(false);
        ContentPhoto.gameObject.SetActive(true);
        ContentPhoto.sprite = data.nowPicture;
        ContentText.text    = data.description;

        if (string.IsNullOrEmpty(data.YoutubeURL))
        {
            PlayTip.gameObject.SetActive(false);
            YoutubeManager.instance.currentURL = string.Empty;
        }
        else
        {
            PlayTip.gameObject.SetActive(true);
            YoutubeManager.instance.currentURL = data.YoutubeURL;
        }

        if (locationService != null)
        {
            OnDistanceChange(locationService.position);
        }

        if (distanceBetweenPOI < MinimunDistanceForLook)
        {
            AlertMessage.gameObject.SetActive(false);
        }
        else
        {
            AlertMessage.gameObject.SetActive(true);
        }

        contentHeightController.ResizeContent();

        DoTreasureAnim();
    }
Esempio n. 8
0
 public void InitInfomations(POIData data)
 {
     ArtistPhoto.sprite = data.ArtistPhoto;
     ContentText.text   = data.ArtistContent;
     CopyrightText.text = data.ArtistCopyright;
 }
Esempio n. 9
0
 public void FinishedNaving(POIData data, double distance)
 {
     CloseSelf();
     ARInfoLayout.instance.Stop2DGo();
     ARInfoLayout.instance.OpenPanelRegular(data, distance);
 }