示例#1
0
    public void PreListOfObjects()
    {
        string filePath = Application.persistentDataPath + "/data/Json/JsonSettings.json";
        string jsonText = File.ReadAllText(Application.persistentDataPath + "/data/Json/JsonSettings.json");

        ViewListItem = JsonUtility.FromJson <ViewListItem>(jsonText);
        PlayerPrefs.SetString("file_Update_Date", ViewListItem.File_Update_Date);

        for (int i = 1; i <= ViewListItem.Items_Count; i++)
        {
            string savePath = Path.Combine(Application.persistentDataPath, "data");
            savePath = Path.Combine(savePath, "Images");
            savePath = Path.Combine(savePath, ViewListItem.List[i - 1].Item_id);

            string savePathBG = Path.Combine(Application.persistentDataPath, "data");
            savePathBG = Path.Combine(savePathBG, "Backgrounds");
            savePathBG = Path.Combine(savePathBG, ViewListItem.List[i - 1].Item_id + "BG");

            DownloadImage(ViewListItem.List[i - 1].Thumbnail, savePath);
            DownloadImage(ViewListItem.List[i - 1].Bg_Image, savePathBG);
        }

        string savePathBGList = Path.Combine(Application.persistentDataPath, "data");

        savePathBGList = Path.Combine(savePathBGList, "Backgrounds");
        savePathBGList = Path.Combine(savePathBGList, "BGList");

        DownloadImage(ViewListItem.Bg_List, savePathBGList);
    }
示例#2
0
    IEnumerator ChackJsonTemp()
    {
        yield return(new WaitForSeconds(3.0f));

        string jsonText    = File.ReadAllText(Application.persistentDataPath + "/data/Json/JsonSettings.json");
        string jsonTextNew = File.ReadAllText(Application.persistentDataPath + "/data/Json/JsonSettingsTemp.json");

        ViewListItem     = JsonUtility.FromJson <ViewListItem>(jsonText);
        ViewListItemTemp = JsonUtility.FromJson <ViewListItem>(jsonTextNew);

        if (ViewListItem.File_Update_Date != ViewListItemTemp.File_Update_Date)
        {
            if (Directory.Exists(jsonDir))
            {
                Directory.Delete(jsonDir, true);
            }
            if (Directory.Exists(bgDir))
            {
                Directory.Delete(bgDir, true);
            }
            if (Directory.Exists(imgDir))
            {
                Directory.Delete(imgDir, true);
            }
            DownloadFile(jsonfile, savePathJson);
            StartCoroutine(LoaderView());
        }
        else
        {
            File.Delete(savePathJsonNew);
            loader.SetActive(true);
            loader.GetComponent <RPB>().maxAmout = 100.0f;
        }
    }
示例#3
0
    // Use this for initialization
    void Start()
    {
        TextAsset asset = Resources.Load("propertisAndroid") as TextAsset;

        ViewListItem = JsonUtility.FromJson <ViewListItem>(asset.text);
        for (int i = 1; i <= ViewListItem.Items_Count; i++)
        {
            backPath = ViewListItem.List[i - 1].Thumbnail;

            StartCoroutine(LoadBack(backPath));

            gameObject.transform.GetComponent <Image>().material.mainTexture = tex;
        }
    }
示例#4
0
    void Start()
    {
        TextAsset asset = Resources.Load("propertisAndroid") as TextAsset;

        if (asset != null)
        {
            ViewListItem = JsonUtility.FromJson <ViewListItem>(asset.text);
            foreach (List listitem in ViewListItem.List)
            {
            }
        }
        else
        {
            Debug.Log("Asset is null");
        }
    }
示例#5
0
    // Use this for initialization
    void Start()
    {
        downloadOver = false;
        btn_Back_To_List.SetActive(true);

        modelID = transform.name;

        oldModelDataUpdate = PlayerPrefs.GetString("Model_Update_Date" + modelID);

        string filePath = Application.persistentDataPath + "/data/Json/JsonSettings.json";
        string jsonText = File.ReadAllText(Application.persistentDataPath + "/data/Json/JsonSettings.json");

        ViewListItem = JsonUtility.FromJson <ViewListItem>(jsonText);

        savePath = Path.Combine(Application.persistentDataPath, "data");
        savePath = Path.Combine(savePath, "Model" + modelID);
        savePath = Path.Combine(savePath, Path.GetFileName(modelLink));

        savePathDInfo = Path.Combine(Application.persistentDataPath, "data");
        savePathDInfo = Path.Combine(savePathDInfo, "Model" + modelID);


        if (!File.Exists(savePath))
        {
            downloadBtn.SetActive(true);
            ListModelLink();
        }
        else
        {
            downloadBtn.SetActive(false);
            btn_Watch_In_AR.SetActive(true);
        }

        if (oldModelDataUpdate != "" && oldModelDataUpdate != modelDataUpdate && File.Exists(savePath))
        {
            btn_Update_Download.SetActive(true);
            downloadBtn.SetActive(false);
            btn_Watch_In_AR.SetActive(false);
            btn_Update_Download.transform.GetComponent <Button>().onClick.AddListener(BtnPressDownloadModel);
        }

        btn_Watch_In_AR.transform.GetComponent <Button>().onClick.AddListener(WatchInAR);
        btn_Cancel_Download.transform.GetComponent <Button>().onClick.AddListener(CancelDownload);
    }
示例#6
0
    void Start()
    {
        file_Update_Date = PlayerPrefs.GetString("file_Update_Date");

        PlayerPrefs.SetString("removeModelID", "");
        download = false;

        jsonDir = Path.Combine(Application.persistentDataPath, "data");
        jsonDir = Path.Combine(jsonDir, "Json");

        bgDir = Path.Combine(Application.persistentDataPath, "data");
        bgDir = Path.Combine(bgDir, "Backgrounds");

        imgDir = Path.Combine(Application.persistentDataPath, "data");
        imgDir = Path.Combine(imgDir, "Images");

        dataDir = Path.Combine(Application.persistentDataPath, "data");

        savePathJson = Path.Combine(Application.persistentDataPath, "data");
        savePathJson = Path.Combine(savePathJson, "Json");
        savePathJson = Path.Combine(savePathJson, "JsonSettings" + ".json");

        savePathJsonNew = Path.Combine(Application.persistentDataPath, "data");
        savePathJsonNew = Path.Combine(savePathJsonNew, "Json");
        savePathJsonNew = Path.Combine(savePathJsonNew, "JsonSettingsTemp" + ".json");

        if (Application.internetReachability != NetworkReachability.NotReachable)
        {
            if (File.Exists(savePathJson))
            {
                string jsonText = File.ReadAllText(Application.persistentDataPath + "/data/Json/JsonSettings.json");
                ViewListItem = JsonUtility.FromJson <ViewListItem>(jsonText);

                if (Directory.Exists(jsonDir) && Directory.Exists(bgDir) && Directory.Exists(imgDir))
                {
                    currentFileSize = Directory.GetFiles(jsonDir).Length + Directory.GetFiles(bgDir).Length + Directory.GetFiles(imgDir).Length;
                }

                if (currentFileSize == (ViewListItem.Items_Count * 2) + 2)
                {
                    DownloadFile(jsonfile, savePathJsonNew);
                    StartCoroutine(ChackJsonTemp());
                }
                else
                {
                    if (Directory.Exists(jsonDir))
                    {
                        Directory.Delete(jsonDir, true);
                    }
                    if (Directory.Exists(bgDir))
                    {
                        Directory.Delete(bgDir, true);
                    }
                    if (Directory.Exists(imgDir))
                    {
                        Directory.Delete(imgDir, true);
                    }
                    DownloadFile(jsonfile, savePathJson);
                    download = true;
                }
            }
            else
            {
                if (Directory.Exists(jsonDir))
                {
                    Directory.Delete(jsonDir, true);
                }
                if (Directory.Exists(bgDir))
                {
                    Directory.Delete(bgDir, true);
                }
                if (Directory.Exists(imgDir))
                {
                    Directory.Delete(imgDir, true);
                }
                DownloadFile(jsonfile, savePathJson);
                download = true;
            }


            //DownloadFile(jsonfile, savePathJsonNew);
            //DownloadFile(jsonfile, savePathJson);
            //download = true;
            noConection.SetActive(false);
            //if (!File.Exists(savePathJson))
            //{
            //    DownloadFile(jsonfile, savePathJson);
            //    download = true;
            //}
            //else
            //{
            //    StartCoroutine(ChackJsonTemp());
            // }
        }
        else
        {
            loader.SetActive(false);
            loader.GetComponent <RPB>().currentAmount = 0f;
            noConection.SetActive(true);
            textInternet.text = "Check your internet connection";
        }
        // else if (HtmlText == "" && !File.Exists(Application.persistentDataPath + "/data/Json/JsonSettings.json"))
        // {
        //     loader.SetActive(false);
        //     loader.GetComponent<RPB>().currentAmount = 0f;
        //     noConection.SetActive(true);
        //     textInternet.text = "JSON-file is not found";
        // }
    }
示例#7
0
    // Use this for initialization
    void Start()
    {
        string filePath = Application.persistentDataPath + "/data/Json/JsonSettings.json";
        string jsonText = File.ReadAllText(Application.persistentDataPath + "/data/Json/JsonSettings.json");

        ViewListItem = JsonUtility.FromJson <ViewListItem>(jsonText);

        remModelID = PlayerPrefs.GetString("removeModelID");


        for (int i = 1; i <= ViewListItem.Items_Count; i++)
        {
            GameObject buttonModel = Instantiate(prebafObj, contentButtons.transform) as GameObject;
            buttonModel.name = ViewListItem.List[i - 1].Item_id;
            buttonModel.transform.SetParent(contentButtons.transform);

            buttonModel.transform.Find("Description/DescriptionMode/Description_Title").GetComponent <Text>().text = ViewListItem.List[i - 1].Title;
            buttonModel.transform.Find("Description/DescriptionMode/Description_Text").GetComponent <Text>().text  = ViewListItem.List[i - 1].Short_Description;

            GameObject downloadsMenu = Instantiate(prebafDM, canvas.transform) as GameObject;
            downloadsMenu.name = ViewListItem.List[i - 1].Item_id;
            downloadsMenu.transform.SetParent(canvas.transform);

            downloadsMenu.GetComponent <DownloadModel>().modelID         = ViewListItem.List[i - 1].Item_id;
            downloadsMenu.GetComponent <DownloadModel>().modelLink       = ViewListItem.List[i - 1].Model_Link;
            downloadsMenu.GetComponent <DownloadModel>().modelTexture    = ViewListItem.List[i - 1].TextureArray;
            downloadsMenu.GetComponent <DownloadModel>().modelDataUpdate = ViewListItem.List[i - 1].Model_Update_Date;

            downloadsMenu.transform.Find("dwn/VerticalMoveText/Content/Description_Title").GetComponent <Text>().text = ViewListItem.List[i - 1].Title;
            downloadsMenu.transform.Find("dwn/VerticalMoveText/Content/Description_bg/Description/Content/Description_Text").GetComponent <Text>().text = ViewListItem.List[i - 1].Full_Description;

            backPath = ViewListItem.List[i - 1].Thumbnail;

            string savePathBGList = Path.Combine(Application.persistentDataPath, "data");
            savePathBGList = Path.Combine(savePathBGList, "Backgrounds");
            savePathBGList = Path.Combine(savePathBGList, "BGList");

            byte[] imageBytesBGList = loadImage(savePathBGList);

            Texture2D textureBGList;
            textureBGList = new Texture2D(2, 2);
            textureBGList.LoadImage(imageBytesBGList);

            bg_list_img.sprite = Sprite.Create(textureBGList, new Rect(0.0f, 0.0f, textureBGList.width, textureBGList.height), new Vector2(0.5f, 0.5f), 100.0f);

            string savePath = Path.Combine(Application.persistentDataPath, "data");
            savePath = Path.Combine(savePath, "Images");
            savePath = Path.Combine(savePath, ViewListItem.List[i - 1].Item_id);

            byte[] imageBytes = loadImage(savePath);

            Texture2D texture;
            texture = new Texture2D(2, 2);
            texture.LoadImage(imageBytes);

            buttonModel.transform.Find("Description/Logo_Model").GetComponent <Image>().sprite = Sprite.Create(texture, new Rect(0.0f, 0.0f, texture.width, texture.height), new Vector2(0.5f, 0.5f), 100.0f);

            string savePathBG = Path.Combine(Application.persistentDataPath, "data");
            savePathBG = Path.Combine(savePathBG, "Backgrounds");
            savePathBG = Path.Combine(savePathBG, ViewListItem.List[i - 1].Item_id + "BG");

            byte[] imageBytesBG = loadImage(savePathBG);

            Texture2D textureBG;
            textureBG = new Texture2D(2, 2);
            textureBG.LoadImage(imageBytesBG);

            downloadsMenu.transform.Find("dwn/BG").GetComponent <Image>().sprite = Sprite.Create(textureBG, new Rect(0.0f, 0.0f, textureBG.width, textureBG.height), new Vector2(0.5f, 0.5f), 100.0f);

            //itemID = ViewListItem.List[i - 1].Item_id;

            //buttonModel.transform.GetComponent<Button>().onClick.AddListener(PressButton);

            //buttonModel.transform.Find(itemID).GetComponent<Button>().onClick.AddListener(PressButton);
        }

        if (remModelID != "")
        {
            canvas.transform.Find(remModelID + "/dwn").gameObject.SetActive(true);
        }
    }