Exemple #1
0
        public void LoadTarget()
        {
            int design = PlayerPrefs.GetInt("design", 0);
            var imageTargetName_FileDic = pathManager.GetDirectoryName_FileDic();

            imageTargets.Clear();
            foreach (var obj in imageTargetName_FileDic.Where(obj => !imageTargetDic.ContainsKey(obj.Key)))
            {
                Debug.Log("!!!!!!!!!imageTargetName_FileDic = " + obj.Key);
                GameObject imageTarget = new GameObject(obj.Key);
                imageTargets.Add(imageTarget);
                var behaviour = imageTarget.AddComponent <ImageTargetController>();
                behaviour.TargetName   = obj.Key;
                behaviour.TargetPath   = obj.Value.Replace(@"\", "/");
                behaviour.Type         = PathType.Absolute;
                behaviour.ImageTracker = Tracker;
                imageTargetDic.Add(obj.Key, behaviour);
                var cube = Instantiate(Resources.Load("HelloAR_TargetOnFly/Prefabs/Cube")) as GameObject;
                cube.transform.parent = imageTarget.transform;
                cube.transform.GetChild(design == 0 ? 1 : 0).gameObject.SetActive(false);

                //cube.AddComponent<WallCube>();
                ImageOnFly canvas = GameObject.Find("Canvas").GetComponent <ImageOnFly>();
                float      mul    = 0.5f;
                cube.transform.localPosition = new Vector3(canvas.valx * mul, canvas.valy * mul, cube.transform.localPosition.z);
                Debug.Log(canvas.valx + ", " + canvas.valy + " !!!!!!!!!cube Name~~~  " + cube.name);
            }
        }
Exemple #2
0
        void Awake()
        {
            ui = FindObjectOfType <ImageOnFly>();
#if UNITY_ANDROID && !UNITY_EDITOR
            using (var unityPlayerClass = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
                using (var currentActivity = unityPlayerClass.GetStatic <AndroidJavaObject>("currentActivity"))
                    using (var file = currentActivity.Call <AndroidJavaObject>("getFilesDir"))
                    {
                        MarksDirectory = file.Call <string>("getAbsolutePath");
                    }
#else
            MarksDirectory = Application.persistentDataPath;
#endif
            Debug.Log("MarkPath:" + MarksDirectory);
            Debug.Log("MarkPath:" + Application.persistentDataPath);
        }