Example #1
0
        private void Awake()
        {
            // Important to not crash in editor
            if (Application.isEditor)
            {
                GameObject.Find("ARCore Device").active = false;
            }


            ActiveScreens = new List <GameObject>();

            logger = LogManager.GetInstance().GetLogger(GetType());
            logger.Debug("Awake!");
            currentState = State.IDLE;

            // Use Awake instead of ctor
            nativeLocation = LocationAwarenessPlugin.GetInstance();
            logger.Debug("Created LocationAwarenessPlugin");

            gameObject.AddComponent <UnityLocationService>();
            unityLocation = gameObject.GetComponent <UnityLocationService>();
            logger.Debug("Added UnityLocationService to Controller");


            gameObject.AddComponent <CineastApi>();
            cineast = gameObject.GetComponent <CineastApi>();
            logger.Debug("Added CineastApi to Controller");

            headingDictionary = new HeadingDictionary();

            uiManager.controller = this;

            logger.Debug("CineastApi Config: " + JsonUtility.ToJson(CineastUtils.Configuration));
        }
    public static IEnumerator getMorelikeThisOne(int exhibitNumber)
    {
        CineastApi myApi = CineastApi.FindObjectOfType <CineastApi>();
        Action <List <MultimediaObject> > handlernew =
            new Action <List <MultimediaObject> >(delegate(List <MultimediaObject> list) { });

        //feature list for MLT query
        String[] categories = { "globalcolor", "localcolor", "edge" };

        myApi.RequestMoreLikeThisAndThen(
            QueryFactory.buildMoreLikeThisQuery(categories, randomIds[exhibitNumber] + "_1"), handlernew);

        yield return(new WaitUntil(myApi.HasFinished));


        similarIds = myApi.GetMoreLikeThisResultIds(5);

        randomIds = similarIds;

        myexhibitionManager.GetRoomByIndex(0).Walls[0].WallData.exhibits = getExhibits(5, similarIds);

        myexhibitionManager.GetRoomByIndex(0).DeleteOldandUpdate();

        isFinished = true;
    }
    public static IEnumerator getMorelikeMyMasterpiece()
    {
        CineastApi myApi = CineastApi.FindObjectOfType <CineastApi>();
        Action <List <MultimediaObject> > handlernew =
            new Action <List <MultimediaObject> >(delegate(List <MultimediaObject> list) { });
        String imgData;

        Paintable[] p = GameObject.FindObjectsOfType <Paintable>();

        imgData = p[0].GetBase64();
        byte[] bytes;
        String b64;

        imgData = "data:image/jpeg;base64," + imgData;


        // features for Masterpiece query
        String[] categories = { "globalcolor", "localcolor" };

        myApi.RequestSimilarThanMasterpiece(QueryFactory.BuildMultiCategoryQuery(categories, imgData), handlernew);


        yield return(new WaitUntil(myApi.HasFinished));

        yield return(similarIds = myApi.GetMoreLikeThisResultIds(5));

        randomIds = similarIds;

        myexhibitionManager.GetRoomByIndex(0).Walls[0].WallData.exhibits = getExhibits(5, similarIds);

        myexhibitionManager.GetRoomByIndex(0).DeleteOldandUpdate();
    }
    private IEnumerator getCineastImg(int numb)
    {
        CineastApi api = GetComponent <CineastApi>();
        Action <List <MultimediaObject> > handlernew =
            new Action <List <MultimediaObject> >(delegate(List <MultimediaObject> list) { });

        api.RequestIds(numb, handlernew);

        yield return(new WaitUntil(api.HasFinished));

        randomIds = api.GetRandomObjectIds();


        createExhibition(numb);

        TimeForTrigger = Time.time;
    }