private List <string> GrabThemeItemList(string themeName)
    {
        // get a reference of pictureLoader
        PictureLoader pictureLoader = GameObject.Find(Constants.PICTURE_LOADER_NAME).GetComponent <PictureLoader>();

        // select random theme -> returns a list of names for the pictures in that theme.
        return(pictureLoader.GetTheme(themeName));
    }
Exemple #2
0
    private void Init()
    {
        m_objects = GameObject.Find(Constants.PARENT_OBJECT_NAME);
        m_rows    = new List <RowScript>();

        m_selectItemsManager = GameObject.Find(Constants.SELECT_ITEMS_MANAGER_NAME).GetComponent <SelectItemsManager>();
        m_pictureLoader      = GameObject.Find(Constants.PICTURE_LOADER_NAME).GetComponent <PictureLoader>();
        m_showReel           = GameObject.Find(Constants.SHOW_REEL_NAME).GetComponent <ShowReelScript>();

        AddSounds();
    }
Exemple #3
0
 private void Awake()
 {
     if (instance)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
Exemple #4
0
        public Loader OnCreateLoader(int id, Bundle args)
        {
            Context context = mContext.Get();

            if (context == null)
            {
                return(null);
            }
            if (!(args.GetParcelable(ARGS_ALBUM) is Album album))
            {
                return(null);
            }
            return(PictureLoader.NewInstance(context, album, selectionSpec));
        }
Exemple #5
0
        public void SetContext(Object context)
        {
            if (!(context is Photo))
            {
                throw new ArgumentException();
            }

            if (Context == context)
            {
                return;
            }

            Context = (Photo)context;
            PictureLoader.SetSource(ImageControl, Context.Preview);
        }
    private IEnumerator StartScripts()
    {
        yield return(new WaitForSeconds(Constants.SECONDS_BEFORE_INIT_SCRIPTS));

        // point to a game object.
        GameObject sampleObject;

        // Start Picture Loader.
        sampleObject = new GameObject(Constants.PICTURE_LOADER_NAME);
        sampleObject.AddComponent <PictureLoader>();
        m_pictureLoader = sampleObject.GetComponent <PictureLoader>();

        // Start Rows Manager.
        sampleObject = new GameObject(Constants.ROW_MANAGER_NAME);
        sampleObject.AddComponent <RowsManager>();
        m_rowsManager = sampleObject.GetComponent <RowsManager>();
        sampleObject.transform.parent = transform;

        // Start Select Items Manager.
        sampleObject = new GameObject(Constants.SELECT_ITEMS_MANAGER_NAME);
        sampleObject.AddComponent <SelectItemsManager>();
        sampleObject.transform.parent = transform;
        m_selectItemsManager          = sampleObject.GetComponent <SelectItemsManager>();

        // Start Show Reel.
        sampleObject = new GameObject(Constants.SHOW_REEL_NAME);
        sampleObject.AddComponent <ShowReelScript>();
        sampleObject.transform.parent = transform;
        m_showReel = sampleObject.GetComponent <ShowReelScript>();

        // Start Kinect Input.
        m_kinectMouseInput = new GameObject(Constants.KINECT_MOUSE_INPUT_NAME);
        m_kinectMouseInput.AddComponent <KinectMouseInput>();

        // and finally, lock mouse.
        Global.lockMouse = true;
    }
Exemple #7
0
    /// <summary>
    /// Sets up the manager and creates all the selectable items.
    /// Makes sure one of the items is the correct one to complete the row.
    /// </summary>
    public void SetUp()
    {
        DestroyOldItems();

        // List to make sure that the items on the bar are from different themes.
        m_currentThemes = new List <string>();

        // int to pick one of the four items that will match with current row.
        int randomItemPosition = Random.Range(0, Constants.NUMBER_OF_SELECTABLE_ITEMS);

        m_currentRowScript = m_rowsManager.GetCurrentRowScript();

        // What is the current theme name?
        string currentTheme = m_currentRowScript.GetThemeName();

        // Add it on used themes.
        List <string> itemThemes = new List <string>();

        for (int i = 0; i < Constants.NUMBER_OF_SELECTABLE_ITEMS; i++)
        {
            string itemName;
            string selectTheme = currentTheme;

            GameObject item = (GameObject)Instantiate(m_itemHolder);
            item.AddComponent <SelectItemScript>();            // selectable item.

            // this is the item that matches.
            if (randomItemPosition == i)
            {
                itemName = m_currentRowScript.GetMissingElement();

                item.GetComponent <SelectItemScript>().SetUpItem(itemName, selectTheme, i, m_currentRowScript.gameObject.transform, m_showReel);

                m_selectItemsNames.Add(itemName);
                correctItemPos = item.transform.position;
            }
            // this is a random item.
            else
            {
                GameObject    pictureLoaderObject = GameObject.Find(Constants.PICTURE_LOADER_NAME);
                PictureLoader pictureLoader       = pictureLoaderObject.GetComponent <PictureLoader>();

                // Make sure it's not an item of the same theme! Item should be unique.
                if (Game.SuperMode != Game.Difficulty.Hard)
                {
                    do
                    {
                        selectTheme = pictureLoader.SelectRandomTheme();
                    }while (selectTheme == currentTheme || itemThemes.IndexOf(selectTheme) != -1);

                    itemName = pictureLoader.SelectRandomURL(selectTheme);
                }
                else
                {
                    selectTheme = currentTheme;

                    do
                    {
                        itemName = pictureLoader.SelectRandomURL(selectTheme);
                    }while (m_selectItemsNames.IndexOf(itemName) != -1 ||
                            itemName == m_currentRowScript.GetMissingElement());
                }

                item.GetComponent <SelectItemScript>().SetUpItem(itemName, selectTheme, i, gameObject.transform, m_showReel);
                itemThemes.Add(selectTheme);
                m_selectItems.Add(item);
                m_selectItemsNames.Add(itemName);
            }
        }
    }
Exemple #8
0
 protected override void OnNavigatedFrom(NavigationEventArgs args)
 {
     base.OnNavigatedFrom(args);
     PictureLoader.Remove("PhotoList");
 }