/// <summary> /// 弹框提示信息,分两类 /// ----第一类:两行内容的=== title:标题, content:内容---- /// 第二类:一行内容的=== title为空, content:内容---- /// </summary> /// <param name="title"></param> /// <param name="content"></param> public void ShowPopup(string title, string content) { if (string.IsNullOrEmpty(title) && content != null) { ContentTextSingle.text = content; SingleTipGo.SetActive(true); if (content.Length < 14) { ContentTextSingle.alignment = TextAnchor.MiddleCenter; } else { ContentTextSingle.alignment = TextAnchor.MiddleLeft; } } else { TitleText.text = title; ContentTextTwice.text = content; TwiceTipGo.SetActive(true); if (content.Length < 14) { ContentTextTwice.alignment = TextAnchor.MiddleCenter; } else { ContentTextTwice.alignment = TextAnchor.MiddleLeft; } } CoroutineWrapper.EXES(4f, () => { Hide(); }); }
public void showtoast(string content) { toastObj.text = content; toastObj.gameObject.SetActive(true); CoroutineWrapper.EXES(1.5f, () => { toastObj.gameObject.SetActive(false); }); }
/// <summary> /// 根据状态码执行 /// </summary> /// <param name="status"></param> public void PopupInfo(string status) { isHit = false; Debug.Log(status); switch (status) { case "200": PP.ShowPopup("请求成功", "密码修改成功,请重新登录"); gameObject.SetActive(false); CoroutineWrapper.EXES(1f, () => { mainUISet.lastpagename = mainUISet.UIname.main; mainUISet.lastpageid = 0; mainui.LogOut(); }); break; case "300": PP.ShowPopup("意见提交成功", "意见提交成功,我们会尽快查看!"); break; case "500": PP.ShowPopup("请求失败", "请求失败,请稍后再试!"); break; case "Error": PP.ShowPopup("请求失败", "请稍候重试"); break; case "null": PP.ShowPopup("格式错误", "昵称不可为空"); break; case "1002": PP.ShowPopup("号码出错", "号码已存在,请更换手机号再试"); break; case "1004": PP.ShowPopup("验证码错误", "请输入正确的验证码"); break; case "1007": PP.ShowPopup("", "密码修改成功,请重新登录"); gameObject.SetActive(false); CoroutineWrapper.EXES(1f, () => { mainUISet.lastpagename = mainUISet.UIname.main; mainUISet.lastpageid = 0; mainui.LogOut(); }); break; default: PP.ShowPopup("请求失败", "请稍候重试"); break; } }
/// <summary> /// 根据状态码执行 /// </summary> /// <param name="status"></param> public void PopupInfo(string status) { Debug.Log(status); isHit = false; switch (status) { case "200": PP.ShowPopup("", "修改成功,请重新登录"); PublicAttribute.UserInfo.PhoneNo = BindingPage_PhoneNoInputField.text; for (int i = 0; i < mainui.photonTxt.Length; i++) { mainui.photonTxt[i].text = PublicAttribute.UserInfo.PhoneNo; } BindingPage_PhoneNoInputField.transform.parent.parent.gameObject.SetActive(false); CoroutineWrapper.EXES(1f, () => { mainUISet.lastpagename = mainUISet.UIname.main; mainUISet.lastpageid = 0; LogOut(); }); break; case "300": PP.ShowPopup("提交成功", "感谢你的宝贵意见!"); break; case "500": PP.ShowPopup("", "请求失败,请稍后再试!"); break; case "Error": PP.ShowPopup("请求失败", "请稍候重试"); break; case "null": PP.ShowPopup("格式错误", "昵称不可为空"); break; case "1002": PP.ShowPopup("号码出错", "号码已存在,请更换手机号再试"); break; case "1004": PP.ShowPopup("验证码错误", "请输入正确的验证码"); break; case "check": PP.ShowPopup("", "当前已是最新版本"); break; default: PP.ShowPopup("请求失败", "请稍候重试"); break; } }
public void LoadScene(string scenename) { for (int i = 0; i < trackerList.Count; i++) { trackerList[i].UnloadAB(); } CoroutineWrapper.EXES(0.2f, () => { UnityHelper.LoadNextScene(scenename); }); }
// Update is called once per frame void Update() { if (Input.GetKeyUp(KeyCode.Escape)) { if (isHelp) { isHelp = false; helppanel.SetActive(false); if (!once) { once = true; if (bgm != null) { bgm.gameObject.SetActive(true); } if (vp2 != null) { if (Screen.width != 750) { vp2.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.height, Screen.width); } vp2.url = GlobalInfo.VideoURL2D; vp2.Play(); CoroutineWrapper.EXES(37f, () => { if (vp != null) { vp2.Stop(); vp.url = GlobalInfo.VideoURL360; vp.Play(); vp2.gameObject.SetActive(false); } }); } else { if (vp != null) { vp.url = GlobalInfo.VideoURL360; vp.Play(); } } } } else { UnityHelper.LoadNextScene("main"); } } }
private void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { Debug.Log(lastpagename + " " + lastpageid); if (isTip) { isTip = false; mainbtn.PP.Hide(); } else if (webrequest.isLoadedWeb) { if (GameObject.Find("webpage") != null) { webrequest.isLoadedWeb = false; if (GameObject.Find("webpage").GetComponent <UniWebView>() != null) { GameObject.Find("webpage").GetComponent <UniWebView>().Stop(); } Destroy(GameObject.Find("webpage").gameObject); } } else if (lastpagename != UIname.main) { HideUI(lastpagename, lastpageid); if (lastpageid != 0) { lastpageid = 0; } } else if (lastpagename == UIname.main) { hit++; quitTip.SetActive(true); CoroutineWrapper.EXES(1f, () => { hit = 0; quitTip.SetActive(false); }); } if (hit >= 2) { Application.Quit(); } } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { hit++; obj.SetActive(true); CoroutineWrapper.EXES(1f, () => { hit = 0; obj.SetActive(false); }); } if (hit >= 2) { Application.Quit(); } }
public void ShotPic() { if (!isShooting) { isShooting = true; btnPanel.SetActive(false); shotclip.Play(); ScreenshotManager.SaveScreenshot("Scan"); CoroutineWrapper.EXES(1.5f, () => { showtoast("照片已保存"); CoroutineWrapper.EXES(1.5f, () => { isShooting = false; btnPanel.SetActive(true); }); }); } }
private void Update() { waittime += Time.deltaTime; if (waittime > 30) { waittime = 0; showtoast("扫描未成功?点击右上角按钮获取帮助"); } if (Input.GetKeyUp(KeyCode.Escape)) { if (isShowHelp) { isShowHelp = false; ShowHelpPanel(false); } else { for (int i = 0; i < trackerList.Count; i++) { trackerList[i].UnloadAB(); } CoroutineWrapper.EXES(0.2f, () => { UnityHelper.LoadNextScene("main"); }); } } // if (ARScanTrackableEventHandler.curCount >= 3 && !showtip) // { // showtip = true; // showtoast("扫描太快啦~"); // CoroutineWrapper.EXES(2, () => // { // showtip = false; // }); // } ShowBtn(); }
public void ShotPic(GameObject obj) { if (!isShooting) { obj.SetActive(false); isShooting = true; // #if UNITY_ANDROID // string destination = "/sdcard/DCIM/AR游"; // //判断目录是否存在,不存在则会创建目录 // if (!Directory.Exists(destination)) // { // Directory.CreateDirectory(destination); // } // // path = destination + "/Panorama"+ GlobalInfo.ShotCount +".png"; // GlobalInfo.ShotCount++; // StartCoroutine(shot()); // // #elif UNITY_IOS || UNITY_IPHONE ScreenshotManager.SaveScreenshot("Panorama"); if (aud != null) { aud.Play(); } CoroutineWrapper.EXES(0.2f, () => { toastObj.SetActive(true); }); CoroutineWrapper.EXES(1.5f, () => { isShooting = false; toastObj.SetActive(false); obj.SetActive(true); }); // #endif } }
private void Start() { AssetBundle.UnloadAllAssetBundles(false); Resources.UnloadUnusedAssets(); mainbtn = GetComponent <mainBtnSet>(); scale = (((float)Screen.height / (float)Screen.width) * 1080f) / 1920f; for (int i = 0; i < ChildPanel.Length; i++) { // ChildPanel[i].sizeDelta=new Vector2(1080,1920 * scale); } //获取景区信息 GetSceneInfo(); if (GlobalParameter.isVisitor) { } else { HttpManager.Instance.GetUserInfoByToken((b => { if (b) { for (int i = 0; i < UserName.Length; i++) { UserName[i].text = PublicAttribute.UserInfo.NickName; } for (int i = 0; i < photonTxt.Length; i++) { photonTxt[i].text = PublicAttribute.UserInfo.PhoneNo; } } else { for (int i = 0; i < UserName.Length; i++) { UserName[i].text = PublicAttribute.UserInfo.NickName; } for (int i = 0; i < photonTxt.Length; i++) { photonTxt[i].text = PublicAttribute.UserInfo.PhoneNo; } } })); } if (ResisDown) { fillamount = 1; CoroutineWrapper.EXES(0.5f, () => { ChangeList.instance.GetImageList(); }); } else { //获取动态资源信息 CoroutineWrapper.EXES(1.5f, () => { PublicAttribute.AreaResoucesDic.TryGetValue(SceneID.id, out curScenicInfo); ChangeList.instance.GetImageList(); }); //自动下载动态资源 CoroutineWrapper.EXES(5f, () => { if (!ischecking) { Debug.LogError("自动下载"); ischecking = true; HttpManager.Instance.DynamicCheekUpdateByArea(SceneID.id); } }); HttpManager.Instance.DownloadPercent = f => { Debug.LogError("进度: " + f.ToString("#0.000")); fillamount = f; }; } ReLoadPage(); }
/// <summary> /// Implementation of the ITrackableEventHandler function called when the /// tracking state changes. /// </summary> public void OnTrackableStateChanged( TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus) { if (newStatus == TrackableBehaviour.Status.DETECTED || newStatus == TrackableBehaviour.Status.TRACKED) { OnTrackingFound(); ARScanManager.instance.waittime = 0; istracking = true; unloadtime = 5; name = mTrackableBehaviour.TrackableName; transform.name = name; Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found"); if (!isLoading && !isloaded && !ARScanManager.instance.isGuide) { ARScanManager.instance.showtoast("扫描成功,精彩里面呈现..."); loadingImg.transform.localScale = Vector3.one * 0.03f; LoadAssetbundle(); isLoading = true; } else if (isloaded) { ARScanManager.instance.isScan = true; ShowInfo(); } if (!addcount) { addcount = true; curCount++; CoroutineWrapper.EXES(2, () => { curCount--; addcount = false; }); } if (curCount >= 3) { ARScanManager.instance.showtoast("扫描太快啦~请慢点操作哦~"); } // ARScanManager.instance.ShowShotBtn(); } else if (previousStatus == TrackableBehaviour.Status.TRACKED && newStatus == TrackableBehaviour.Status.NO_POSE || newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) { OnTrackingLost(); istracking = false; if (child != null) { if (child.GetComponent <Targets>() != null) { Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " lost"); ARScanManager.instance.isScan = false; HideInfo(); } } // ARScanManager.instance.HideShotBtn(); } else { istracking = false; OnTrackingLost(); if (child != null) { if (child.GetComponent <Targets>() != null) { ARScanManager.instance.isScan = false; HideInfo(); } } // ARScanManager.instance.HideShotBtn(); } }
// Use this for initialization void Start() { if (PlayerPrefs.GetInt("Panorama") == 0) { PlayerPrefs.SetInt("Panorama", 1); helppanel.SetActive(true); isHelp = true; if (bgm != null) { bgm.gameObject.SetActive(false); } } else { isHelp = false; } backBtn.onClick.AddListener((() => { UnityHelper.LoadNextScene("main"); })); helpbtn.onClick.AddListener((() => { isHelp = true; helppanel.SetActive(true); })); shottbtn.onClick.AddListener((() => { ShotPic(UIpanel); })); helphidebtn.onClick.AddListener((() => { isHelp = false; helppanel.SetActive(false); if (bgm != null) { bgm.gameObject.SetActive(true); } if (!once) { once = true; if (vp2 != null) { if (Screen.width != 750) { vp2.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.height, Screen.width); } vp2.url = GlobalInfo.VideoURL2D; vp2.Play(); CoroutineWrapper.EXES(37f, () => { if (vp != null) { vp2.Stop(); vp.url = GlobalInfo.VideoURL360; vp.Play(); vp2.gameObject.SetActive(false); } }); } else { if (vp != null) { vp.url = GlobalInfo.VideoURL360; vp.Play(); } } } })); if (shottbtn2 != null) { shottbtn2.onClick.AddListener((() => { ShotPic(UIpanel2); })); } if (videoback != null) { videoback.onClick.AddListener((() => { UnityHelper.LoadNextScene("main"); })); } if (!isHelp) { if (vp2 != null) { if (Screen.width != 750) { vp2.GetComponent <RectTransform>().sizeDelta = new Vector2(Screen.height, Screen.width); } vp2.url = GlobalInfo.VideoURL2D; vp2.Play(); CoroutineWrapper.EXES(37f, () => { if (vp != null) { vp2.Stop(); vp.url = GlobalInfo.VideoURL360; vp.Play(); vp2.gameObject.SetActive(false); } }); } else { if (vp != null) { vp.url = GlobalInfo.VideoURL360; vp.Play(); } } } }
/// <summary> /// 获取图片列表 /// </summary> public void GetImageList(float type) { //景点加载 if (type == 0) { if (JsonClass.Instance.TraitScenicSpotInfoS.Count == 0) { CoroutineWrapper.EXES(1f, () => { GetImageList(type); }); return; } if (pageCount[0] > 0) { return; } Debug.LogWarning("GG::::" + JsonClass.Instance.TraitScenicSpotInfoS.Count); for (int i = 0; i < JsonClass.Instance.TraitScenicSpotInfoS.Count; i++) { ListItem item = GameObject.Instantiate <ListItem>(pageItemPrefab); item.transform.SetParent(ShowContent[0].transform); item.transform.localScale = Vector3.one; item.transform.localPosition = Vector3.zero; item.id = JsonClass.Instance.TraitScenicSpotInfoS[i].id; item.name = JsonClass.Instance.TraitScenicSpotInfoS[i].name; item.thumbnail = JsonClass.Instance.TraitScenicSpotInfoS[i].thumbnail; item.address = JsonClass.Instance.TraitScenicSpotInfoS[i].address; item.dynamicFlag = JsonClass.Instance.TraitScenicSpotInfoS[i].dynamicFlag; HttpManager.Instance.Download(item.thumbnail, (() => { Loom.QueueOnMainThread((() => { pageCount[0]++; SetContent(pageCount[0]); item.gameObject.SetActive(true); item._init(item.thumbnail.localPath); })); })); } } //特产加载 if (type == 1) { if (JsonClass.Instance.LocalSpecialtyS.Count == 0) { CoroutineWrapper.EXES(1f, () => { GetImageList(type); }); return; } if (pageCount[1] > 0) { return; } for (int i = 0; i < JsonClass.Instance.LocalSpecialtyS.Count; i++) { //SetContent(pageCount); ListItem item = GameObject.Instantiate <ListItem>(pageItemPrefab); item.transform.SetParent(ShowContent[1].transform); item.transform.localScale = Vector3.one; item.transform.localPosition = Vector3.zero; item.id = JsonClass.Instance.LocalSpecialtyS[i].id; item.name = JsonClass.Instance.LocalSpecialtyS[i].name; item.thumbnail = JsonClass.Instance.LocalSpecialtyS[i].thumbnail; item.address = JsonClass.Instance.LocalSpecialtyS[i].address; item.dynamicFlag = JsonClass.Instance.LocalSpecialtyS[i].dynamicFlag; HttpManager.Instance.Download(item.thumbnail, (() => { Loom.QueueOnMainThread((() => { pageCount[1]++; SetContent(pageCount[1]); item.gameObject.SetActive(true); item._init(item.thumbnail.localPath); })); })); } } //商家加载 if (type == 2) { if (JsonClass.Instance.ShopInfoS.Count == 0) { CoroutineWrapper.EXES(1f, () => { GetImageList(type); }); return; } if (pageCount[2] > 0) { return; } for (int i = 0; i < JsonClass.Instance.ShopInfoS.Count; i++) { // ListItem item = GameObject.Instantiate <ListItem>(pageItemPrefab); item.transform.SetParent(ShowContent[2].transform); item.transform.localScale = Vector3.one; item.transform.localPosition = Vector3.zero; item.id = JsonClass.Instance.ShopInfoS[i].id; item.name = JsonClass.Instance.ShopInfoS[i].name; item.thumbnail = JsonClass.Instance.ShopInfoS[i].thumbnail; item.address = JsonClass.Instance.ShopInfoS[i].address; item.dynamicFlag = JsonClass.Instance.ShopInfoS[i].dynamicFlag; HttpManager.Instance.Download(item.thumbnail, (() => { Loom.QueueOnMainThread((() => { pageCount[2]++; SetContent(pageCount[2] + pageCount[3]); item.gameObject.SetActive(true); item._init(item.thumbnail.localPath); })); })); } } if (type == 3) { if (JsonClass.Instance.HotelInfoS.Count == 0) { CoroutineWrapper.EXES(1f, () => { GetImageList(type); }); return; } if (pageCount[3] > 0) { return; } for (int i = 0; i < JsonClass.Instance.HotelInfoS.Count; i++) { ListItem item = GameObject.Instantiate <ListItem>(pageItemPrefab); item.transform.SetParent(ShowContent[2].transform); item.transform.localScale = Vector3.one; item.transform.localPosition = Vector3.zero; item.id = JsonClass.Instance.HotelInfoS[i].id; item.name = JsonClass.Instance.HotelInfoS[i].name; item.thumbnail = JsonClass.Instance.HotelInfoS[i].thumbnail; item.address = JsonClass.Instance.HotelInfoS[i].address; item.dynamicFlag = JsonClass.Instance.HotelInfoS[i].dynamicFlag; HttpManager.Instance.Download(item.thumbnail, (() => { Loom.QueueOnMainThread((() => { pageCount[3]++; SetContent(pageCount[2] + pageCount[3]); item.gameObject.SetActive(true); item._init(item.thumbnail.localPath); })); })); } } }