Пример #1
0
        public override void EnterState()
        {
            // Init targetPermissions
            targetPermissionNames = MirageAR_AndroidPermissionManager.MirageARPermissions;

            // Init App Banner
            SplashSprite = GetAppBanner();

            Transform splashTsf = UICtr.Instance.Open(UIType.Splash);

            if (SplashSprite != null)
            {
                splashTsf.Find("Splash").GetComponent <Image>().sprite = SplashSprite;
            }

#if UNITY_EDITOR
            PlayerPrefs.DeleteKey("FristEnterARMode");
#endif

            FristEnter = PlayerPrefs.GetInt("FristEnterARMode", 0) == 0;
            MirageAR_UIEventListener.Get(splashTsf.Find(BgName).gameObject).onClick += DoEvent;

            /// 权限申请
            ///
#if UNITY_ANDROID && !UNITY_EDITOR
            RequestMultiPermissions();
#endif
        }
Пример #2
0
 public override void EnterState()
 {
     Debug.Log("XX");
     isBeaconState = true;
     tsf           = UICtr.Instance.Open(UIType.Beacon);
     MirageAR_UIEventListener.Get(tsf.Find("Bg").gameObject).onBeginDrag      += DoDragEvent;
     MirageAR_UIEventListener.Get(tsf.Find(BackButtonName).gameObject).onClick = () => { parent.SetState(MainControl.Transtion.Back); };
     UICtr.Instance.Open(UIType.CornerSelect).SetAsLastSibling();
 }
Пример #3
0
        public override void EnterState()
        {
            PlayerPrefs.SetInt("FristEnterARMode", 1);
            Transform tsf = UICtr.Instance.Open(UIType.Welcome);

            MirageAR_UIEventListener.Get(tsf.Find(BackButtonName).gameObject).onClick += DoBackEvent;
            MirageAR_UIEventListener.Get(tsf.Find(HasButtonName).gameObject).onClick  += DoHasEvent;
            MirageAR_UIEventListener.Get(tsf.Find(BuyButtonName).gameObject).onClick  += DoBuyEvent;

            LanguageChange(LanguageManager.Instance);
        }
Пример #4
0
 public override void EnterState()
 {
     isUsbState = true;
     tsf        = UICtr.Instance.Open(UIType.Usb);
     if (Bg == null)
     {
         Bg = tsf.Find("Bg");
     }
     MirageAR_UIEventListener.Get(Bg.gameObject).onBeginDrag += DoDragEvent;
     MirageAR_UIEventListener.Get(tsf.Find(BackButtonName).gameObject).onClick = DoBackEvent;
     UICtr.Instance.Open(UIType.CornerSelect).SetAsLastSibling();
 }
Пример #5
0
        /// <summary>
        /// Init the Search Text,True Connected,False Not Connected
        /// </summary>
        private void InitSearchText(bool flag)
        {
            SearchTsf.GetComponent <UnityEngine.UI.Button>().interactable = !flag;
            if (!flag)
            {
                MirageAR_UIEventListener.Get(SearchTsf.gameObject).onClick = OnDoSearchEvent;
            }
            else
            {
                MirageAR_UIEventListener.Get(SearchTsf.gameObject).onClick = null;
            }

            textStartSearch.gameObject.SetActive(!flag);
            textConnected.gameObject.SetActive(flag);
            textSearching.gameObject.SetActive(false);
        }
Пример #6
0
        void DoDragEvent(UnityEngine.EventSystems.BaseEventData data)
        {
            tsf.SetAsLastSibling();
            if ((data as UnityEngine.EventSystems.PointerEventData).delta.x < 0)
            {
#if UNITY_IOS
                UICtr.Instance.Open(UIType.Beacon);
#else
                UICtr.Instance.Open(UIType.Usb);
#endif
                MirageAR_UIEventListener.Get(tsf.Find("Bg").gameObject).onBeginDrag -= DoDragEvent;
                tsf.DOLocalMoveX(-(tsf as RectTransform).rect.width + 30, 0.7f)
                .OnComplete(() => {
                    tsf.localPosition = Vector3.zero;

#if UNITY_IOS
                    parent.SetState(MainControl.Transtion.Beacon);
#else
                    parent.SetState(MainControl.Transtion.Usb);
#endif
                });
            }
            else if ((data as UnityEngine.EventSystems.PointerEventData).delta.x > 0)
            {
#if UNITY_IOS
                UICtr.Instance.Open(UIType.Beacon);
#else
                UICtr.Instance.Open(UIType.Beacon);
#endif

                MirageAR_UIEventListener.Get(tsf.Find("Bg").gameObject).onBeginDrag -= DoDragEvent;
                tsf.DOLocalMoveX(((tsf as RectTransform).rect.width) - 30, 0.7f)
                .OnComplete(() => {
                    tsf.localPosition = Vector3.zero;

#if UNITY_IOS
                    parent.SetState(MainControl.Transtion.Beacon);
#else
                    parent.SetState(MainControl.Transtion.Beacon);
#endif
                });
            }
        }
Пример #7
0
        void OnDoSearchEvent()
        {
            if (isPairing)
            {
                return;
            }

            //m_Text.text ="正在搜索";
            TempTime  = 0;
            isPairing = true;
            VisionSDK.Instance.Tracking.StartPairing();

            textStartSearch.gameObject.SetActive(false);
            textConnected.gameObject.SetActive(false);
            textSearching.GetComponent <UnityEngine.UI.Text>().text = LanguageManager.Instance.GetTextValue(CommunalText.TitleSearching);
            textSearching.gameObject.SetActive(true);
            SearchTsf.GetComponent <UnityEngine.UI.Button>().interactable = false;
            MirageAR_UIEventListener.Get(SearchTsf.gameObject).onClick    = null;
        }
Пример #8
0
        void ModelNull()
        {
            UnityEngine.UI.Text m_Model = tsf.Find("ModelName").GetComponent <UnityEngine.UI.Text>();
            m_Model.text = devices[currentIndex].Name;

            MirageAR_UIEventListener.Get(tsf.Find("Left").gameObject).onClick = () => { currentIndex--; if (currentIndex < 0)
                                                                                        {
                                                                                            currentIndex = devices.Count - 1;
                                                                                        }
                                                                                        m_Model.text = devices[currentIndex].Name; SetSize(devices[currentIndex]); };
            MirageAR_UIEventListener.Get(tsf.Find("Right").gameObject).onClick = () => { currentIndex++; if (currentIndex >= devices.Count)
                                                                                         {
                                                                                             currentIndex = 0;
                                                                                         }
                                                                                         m_Model.text = devices[currentIndex].Name; SetSize(devices[currentIndex]); };
            MirageAR_UIEventListener.Get(tsf.Find("Button").gameObject).onClick = () => {
#if UNITY_ANDROID && !UNITY_EDITOR
                MirageAR_DeviceApi.PutServiceString("SelectModel", devices[currentIndex].SettingsFile);
#endif
                parent.SetState(MainControl.Transtion.Start);
            };
        }
Пример #9
0
        public override void EnterState()
        {
            isControllstate = true;
            tsf             = UICtr.Instance.Open(UIType.Control);

            SettingHint.CtrState += SetText;

            if (SearchTsf == null)
            {
                SearchTsf = tsf.Find(SearchName);
                //m_Text = SearchTsf.GetComponentInChildren<UnityEngine.UI.Text>();
            }

            if (textStartSearch == null)
            {
                textStartSearch = SearchTsf.Find("Text");
            }
            if (textSearching == null)
            {
                textSearching = SearchTsf.Find("Text (1)");
            }
            if (textConnected == null)
            {
                textConnected = SearchTsf.Find("Text (2)");
            }

            MirageAR_UIEventListener.Get(tsf.Find("Bg").gameObject).onBeginDrag      += DoDragEvent;
            MirageAR_UIEventListener.Get(SearchTsf.gameObject).onClick                = OnDoSearchEvent;
            MirageAR_UIEventListener.Get(tsf.Find(BackButtonName).gameObject).onClick = DoBackEvent;
            isPairing = false;

            Transform tsf2 = UICtr.Instance.Open(UIType.CornerSelect);

            tsf2.SetAsLastSibling();

            //Init UI
            InitUI();
        }
Пример #10
0
        public override void EnterState()
        {
            // Save The Time When Enter This Page
            tempTime = Time.timeSinceLevelLoad;

            Transform tsf = UICtr.Instance.Open(UIType.Setting);

            if (HorizontalSettingGroup == null)
            {
                HorizontalSettingGroup = tsf.Find(SettingGroup);
            }

            if (HorizontalBtnGroup == null)
            {
                HorizontalBtnGroup = tsf.Find(ButtonGroup);
            }
            if (Ctr == null)
            {
                Ctr = HorizontalSettingGroup.Find("Ctr");
            }
            if (CtrText == null)
            {
                CtrText = Ctr.Find("Text").GetComponent <UnityEngine.UI.Text>();
            }

            if (Usb == null)
            {
                Usb = HorizontalSettingGroup.Find("Usb");
#if UNITY_IOS
                Usb.gameObject.SetActive(false);
                HorizontalSettingGroup.GetComponent <UnityEngine.UI.HorizontalLayoutGroup>().spacing = -461f;
#endif
            }
            if (UsbText == null)
            {
                UsbText = Usb.Find("Text").GetComponent <UnityEngine.UI.Text>();
            }

            if (Beacon == null)
            {
                Beacon = HorizontalSettingGroup.Find("Beacon");
            }
            if (BeginButton == null)
            {
                BeginButton = HorizontalBtnGroup.Find(BeginButtonName);
            }
            if (DownBtn == null)
            {
                DownBtn = HorizontalBtnGroup.Find("DownStore");

                bool Launcher = false;
#if !UNITY_EDITOR && UNITY_ANDROID
                ///判断是否存在包名
                AndroidJavaObject   packageManager = AndroidUtil.GetActivity().Call <AndroidJavaObject>("getPackageManager");
                AndroidJavaObject   packageInfos   = packageManager.Call <AndroidJavaObject>("getInstalledPackages", 0);
                AndroidJavaObject[] packages       = packageInfos.Call <AndroidJavaObject[]>("toArray");
                for (int i = 0; i < packages.Length; i++)
                {
                    AndroidJavaObject applicationInfo = packages[i].Get <AndroidJavaObject>("applicationInfo");
                    if ((applicationInfo.Get <int>("flags") & applicationInfo.GetStatic <int>("FLAG_SYSTEM")) == 0)
                    {
                        string packageName = applicationInfo.Get <string>("packageName");
                        if (packageName == MirageAR_SDK.mLauncherPackageName)
                        {
                            Launcher = true;
                        }
                    }
                }
#elif !UNITY_EDITOR && UNITY_IOS
                //TODO:iOS Check The Launcher Whether Installed
#endif
                if (Launcher)
                {
                    ///如果存在则下载按钮隐藏
                    DownBtn.gameObject.SetActive(false);
                }
                else
                {
                    MirageAR_UIEventListener.Get(DownBtn.gameObject).onClick = () => { Application.OpenURL(DownAppUrl); };
                }
            }

            ChangeTitleLanguage(LanguageManager.Instance);

            if (BackButton == null)
            {
                BackButton = tsf.Find("Back");
            }

            InitSet();

#if (UNITY_ANDROID || UNITY_IOS) && !UNITY_EDITOR
            BeginButton.GetComponent <UnityEngine.UI.Button>().interactable = false;
            MirageAR_UIEventListener.Get(BackButton.gameObject).onClick     = () => { DeviceUtils.ShowDialog(Title, null, YesBtn, () => { Application.Quit(); }, NoBtn, () => { }); };
#else
            MirageAR_UIEventListener.Get(BackButton.gameObject).onClick = () => { UnityEditor.EditorApplication.isPlaying = false; };
#endif
            MirageAR_UIEventListener.Get(BeginButton.gameObject).onClick += DoEnterGameEvent;
            MirageAR_UIEventListener.Get(Ctr.gameObject).onClick          = () => { parent.SetState(MainControl.Transtion.Ctr); };
            MirageAR_UIEventListener.Get(Usb.gameObject).onClick          = () => { parent.SetState(MainControl.Transtion.Usb); };
            MirageAR_UIEventListener.Get(Beacon.gameObject).onClick       = () => { parent.SetState(MainControl.Transtion.Beacon); };

            bool CanEnterGame;
#if !UNITY_IOS
            CanEnterGame = CtrFlag && UsbState.Usbflag;
#else
            CanEnterGame = CtrFlag;
#endif

            if (CanEnterGame)
            {
                BeginButton.GetComponent <UnityEngine.UI.Button>().interactable = true;
            }
            else
            {
#if !UNITY_EDITOR
                MirageAR_UIEventListener.Get(BeginButton.gameObject).onClick -= DoEnterGameEvent;
#endif
            }

            // Init
            UpdateCtrBattery();
            UpdateUsbBattery();
        }