コード例 #1
0
 public void Setup(ArtmoModel current)
 {
     artmo         = current;
     btnItem.name  = artmo.id.ToString();
     textItem.text = artmo.Name;
     btnPlay.name  = artmo.id.ToString();
     if (PlayerPrefs.GetString("localization") == "english")
     {
         if (Resources.Load("Multimedia/Videos/English/" + artmo.id.ToString()) == null)
         {
             btnPlay.gameObject.SetActive(false);
         }
     }
     else
     {
         if (Resources.Load("Multimedia/Videos/Ilocano/" + artmo.id.ToString()) == null)
         {
             btnPlay.gameObject.SetActive(false);
         }
     }
     if (Resources.Load("Multimedia/Videos/Ext/" + artmo.id.ToString()) != null)
     {
         btnPlay.gameObject.SetActive(true);
     }
 }
コード例 #2
0
    public static List <ArtmoModel> GetListByMarker(int marker)
    {
        List <ArtmoModel> list         = new List <ArtmoModel>();
        XDocument         oXmlDocument = null;

        if (System.IO.File.Exists(Application.persistentDataPath + "/artmo.xml"))
        {
            oXmlDocument = XDocument.Load(Application.persistentDataPath + "/artmo.xml");
        }
        else
        {
            TextAsset _xml = Resources.Load("artmo") as TextAsset;
            oXmlDocument = XDocument.Parse(_xml.text);
        }
        var x = from el in oXmlDocument.Descendants("Artifact")
                where Convert.ToInt32(el.Element("marker").Value) == marker
                select el;

        foreach (XElement el in x)
        {
            ArtmoModel model = new ArtmoModel();
            model.id           = Convert.ToInt32(el.Element("id").Value);
            model.marker       = Convert.ToInt32(el.Element("marker").Value);
            model.Image        = Convert.ToString(el.Element("Image").Value);
            model.Name         = Convert.ToString(el.Element("Name").Value);
            model.GTerm        = Convert.ToString(el.Element("GTerm").Value);
            model.Donor        = Convert.ToString(el.Element("Donor").Value);
            model.EngDesc      = Convert.ToString(el.Element("EngDesc").Value);
            model.DateAcquired = Convert.ToString(el.Element("DateAcquired").Value);
            list.Add(model);
        }
        ;
        return(list);
    }
コード例 #3
0
    private void AddArtifactButtons()
    {
        ArtmoModel        model = new ArtmoModel();
        List <ArtmoModel> list  = ArtmoLoader.GetListByMarker(id);

        for (int i = 0; i < list.Count; i++)
        {
            model = list[i];
            GameObject newBtn = btnObjectPool.GetObject();

            newBtn.transform.SetParent(contentPanel);

            ButtonArtifacts buttonArtifacts = newBtn.GetComponent <ButtonArtifacts>();

            buttonArtifacts.Setup(model);
        }
    }
コード例 #4
0
ファイル: ARScript.cs プロジェクト: Jaydal/ArtmoCapstone2018
    private void GetNone3D(int markerID)
    {
        //getting base 64 image
        var item = ArtmoLoader.GetListByMarker(markerID);

        if (item.Count > 0)
        {
            loadedObj = GameObject.CreatePrimitive(PrimitiveType.Cube);
            noItem    = false;
            for (var i = c; i < item.Count; i++)
            {
                ArtmoModel model = item[i];
                if (model.Image.Length > 10)
                {
                    Debug.Log(model.Image);
                    Texture2D tex = new Texture2D(2, 2);
                    tex.LoadImage(System.Convert.FromBase64String(model.Image));
                    loadedObj.GetComponent <MeshRenderer> ().material.mainTexture = tex;
                    loadedObj.transform.Rotate(0, 90, 0);
                    break;
                }
            }
            if (c + 1 == item.Count)
            {
                c = -1;
            }
        }
        else
        {
            //if there is no items in marker
            btnMore.gameObject.SetActive(false);
            nodata.gameObject.SetActive(true);
            noItem = true;
            c      = -1;
        }
    }