public void SetAudioCaptions(string name, string filePath)
    {
        var newText = UIB_FileManager.ReadTextAssetBundle(name, filePath);

        if (newText == null || newText == "")
        {
            Debug.LogWarning("Null Text Given for Captions");
            //CaptionsCanvas.transform.GetChild(0).gameObject.GetComponent<TextMeshProUGUI>().enabled = false;
            hasCaptions = false;

            //no captions so no screen readable button
            // Debug.Log("turning captions reader off");

            StartCoroutine("TurnOffCaptionsReader");

            return;
        }
        //        Debug.Log("new " + newText);
        hasCaptions   = true;
        AudioCaptions = new TextAsset(newText);

        //        Debug.Log("turning captions reader on");
        CaptionsToggle.GetComponent <Special_AccessibleButton>().enabled = true;
        CaptionsToggle.GetComponent <Button>().enabled = true;
    }
示例#2
0
    void PlayVideoFromFile(string src)
    {
        var    filename    = "/hld-general/MeOnDisplay/VideoCaptions/" + src.Replace(" ", "_") + ".txt";
        string videoSource = Application.persistentDataPath + "/hld-general/MeOnDisplay/" + src.Replace(" ", "_") + ".mov";

        TextAsset captions = new TextAsset(UIB_FileManager.ReadTextAssetBundle(filename, "hld/displayed/narratives/video"));

        var vp = GameObject.FindWithTag("App_VideoPlayer").GetComponent <VideoPlayer>();

        vp.GetComponent <UIB_VideoPlayer>().SetVideoCaptions(captions);

        vp.url = videoSource;
        StartCoroutine("PlayVideoCoroutine");
    }
示例#3
0
    public void LoadNotes(string ShowName)
    {
        var tmp  = GetComponent <TextMeshProUGUI>();
        var name = ShowName + "ProgramNotes";

        var text = UIB_FileManager.ReadTextAssetBundle(ShowName + "ProgramNotes", "hld/general");

        tmp.text = text;

        if (tmp.text.Length <= 0)
        {
            tmp.enabled = false;
        }
        else
        {
            tmp.enabled = true;
        }
    }
        /// <summary>
        /// Get Object from S3 Bucket
        /// </summary>
        public void GetObject(string filename, string S3BucketName)
        {
            InitializationManager.DownloadCount++;

            Client.GetObjectAsync(S3BucketName, filename, (responseObj) =>
            {
                var response = responseObj.Response;
                if (response.ResponseStream != null)
                {
                    //Debug.Log("response " + response.ResponseStream);
                    filename = S3BucketName + "/" + filename;
                    UIB_FileManager.WriteFileFromResponse(response, filename);
                    Directory.SetLastAccessTime(UIB_PlatformManager.persistentDataPath, DateTime.Now);
                    InitializationManager.DownloadCount--;
                    InitializationManager.ReloadAssetBundle(filename);
                }
            });
        }
示例#5
0
    public void SetAudioCaptions(string name, string filePath)
    {
        if (name == null || name == "")
        {
            return;
        }

        var newText = UIB_FileManager.ReadTextAssetBundle(name, filePath);

        if (newText == null)
        {
            Debug.LogWarning("Null Text Given for Captions");
            captionsCanvas.enabled = false;
            hasCaptions            = false;

            return;
        }
        hasCaptions   = true;
        AudioCaptions = new TextAsset(newText);
    }
示例#6
0
    public void SetImageFromPath(string PathToImage)
    {
        byte[] fileData = null;

        if (UIB_FileManager.FileExists(PathToImage))
        {
            fileData = UIB_FileManager.ReadFromBytes(PathToImage, UIB_FileTypes.Images);
            if (fileData == null)
            {
                return;
            }
            Texture2D tex = new Texture2D(2, 2);
            tex.LoadImage(fileData);
            var newSprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0, 0), 100.0f);
            if (BioImage != null)
            {
                BioImage.sprite = newSprite;
                BioImage.rectTransform.sizeDelta = new Vector2(1000, 1000);
            }
        }
    }
示例#7
0
 public void InitJsonList()
 {
     ShowName = name.Split('-')[0];
     if (ShowName == "CompanyDancers_Page")
     {
         SourceJson = UIB_FileManager.ReadTextAssetBundle("bios", "hld/bios/json");
         if (SourceJson == null || SourceJson == "")
         {
             return;
         }
         myObject      = JsonUtility.FromJson <BiographyArray>(SourceJson);
         OrderedByName = myObject.data.OrderBy(x => x.Name.Split(' ')[1]);
     }
     else
     {
         SourceJson = UIB_FileManager.ReadTextAssetBundle(ShowName + "ListOfDancers", "hld/general");
         if (SourceJson == null || SourceJson == "")
         {
             return;
         }
         listOfDancers = SourceJson.Replace("\n", "").Split(',');
     }
 }
    private void CheckIsCorrect(string arg0)
    {
        if (TouchScreenKeyboard.isSupported)
        {
            if (GetComponent <InputField>().touchScreenKeyboard.status != TouchScreenKeyboard.Status.Done)
            {
                return;
            }
        }
        var ShowName = name.Split('_')[0];

        var res = "";

        res = UIB_FileManager.ReadTextAssetBundle(ShowName + "AccessCode", "hld/general");

        if (res != "")
        {
            if (arg0.ToLower() == res.ToString().ToLower())
            {
                StartCoroutine("OnCorrectCode1");
            }
            else
            {
                Debug.Log("Correct Code is:" + res);
                if (UAP_AccessibilityManager.IsActive())
                {
                    UAP_AccessibilityManager.Say(" \n\r");
                    GameObject.Find("Accessibility Manager").GetComponent <UAP_AccessibilityManager>().SayPause(.1f);
                    UAP_AccessibilityManager.SayAs("Incorrect Code: Enter Code again", UAP_AudioQueue.EAudioType.App);
                }
            }
        }
        else
        {
            Debug.Log("res is not assigned " + gameObject.name);
        }
    }
    private void TryDownloadFile(string filename, bool fallbackUsingBundle = false)
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        if (!(UIB_FileManager.FileExists(UIB_PlatformManager.persistentDataPath + "android/assets/" + UIB_PlatformManager.platform + filename)))
        {
            //We don't have the file, first thing is to copy it from streaming assets
            //On Android, streaming assets are zipped so we need a special accessor
            print("file does not exist");
            GameObject.Find("FileManager").GetComponent <UIB_FileManager>().StartCoroutine("CreateStreamingAssetDirectories", filename);
            //record here that we have never updated files from the internet;
            PlayerPrefs.SetString("LastUpdated", new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToString());

            if (CheckInternet() && !DebugLocalAssetBundles)
            {
                print("Just copied all asset bundle files, checking for update");
                db_Manager.CheckIfObjectHasUpdate(UIB_PlatformManager.platform + filename, "heidi-latsky-dance");
            }
            else
            {
            }
        }
        else
        {
            //we have the file check for update
            if (CheckInternet() && !DebugLocalAssetBundles)
            {
                print("we have the file checking for update");
                db_Manager.CheckIfObjectHasUpdate(UIB_PlatformManager.platform + filename, "heidi-latsky-dance");
            }
        }
#else
        if (!(UIB_FileManager.FileExists(UIB_PlatformManager.persistentDataPath + UIB_PlatformManager.platform + filename)))
        {
            //we don't have the file, firs thing to do is copy it from streaming assets
            UIB_FileManager.WriteFromStreamingToPersistent(filename);
            // AssetBundle.LoadFromFile(Application.streamingAssetsPath + "/" + UIB_PlatformManager.platform + filename);

            //record here that we have never updated files from the internet;
            PlayerPrefs.SetString("LastUpdated", new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).ToString());

            if (CheckInternet() && !DebugLocalAssetBundles)
            {
                db_Manager.CheckIfObjectHasUpdate(UIB_PlatformManager.platform + filename, "heidi-latsky-dance");
            }
            else
            {
            }
        }
        else
        {
            //we have the file check for update
            if (CheckInternet() && !DebugLocalAssetBundles)
            {
                db_Manager.CheckIfObjectHasUpdate(UIB_PlatformManager.platform + filename, "heidi-latsky-dance");
            }
        }
#endif
        //delete the streaming asset files
        UIB_FileManager.DeleteFile(filename);
        UIB_AssetBundleHelper.InsertAssetBundle(filename);
    }