示例#1
0
    private void Awake()
    {
        item = transform.GetComponent <GPSItem>();
        Transform iconRoot = GameObject.Find("Canvas/Markers").transform;

        state = Instantiate(Resources.Load(stateIconPrefab)) as GameObject;
        GpsConvert.icon.Add(state);
        state.name   = item.name;
        recTransform = state.GetComponent <RectTransform>();
        recTransform.SetParent(iconRoot);

        web = GameObject.Find(GlobalInfo.websiterequest).GetComponent <webrequest>();

        webbtn = state.transform.Find("infobg").GetComponent <Button>();
        webbtn.onClick.AddListener(delegate()
        {
            web.LoadWebSetTitle(item.address, item.name);
        });

        raw = state.transform.Find("infobg/pic").GetComponent <RawImage>();

        infodisText       = state.transform.Find("infobg/pic/bottom/distance").GetComponent <Text>();
        infonameText      = state.transform.Find("infobg/pic/bottom/name").GetComponent <Text>();
        infonameText.text = item.name;
        describeText      = state.transform.Find("infobg/info").GetComponent <Text>();
        describeText.text = item.content;

        infobg  = state.transform.Find("infobg").GetComponent <Transform>();
        iconbg  = state.transform.Find("iconbg").GetComponent <Transform>();
        namebg1 = state.transform.Find("namebg1").GetComponent <Transform>();
        namebg2 = state.transform.Find("namebg2").GetComponent <Transform>();
        LoadType(item.typeName);

        StartCoroutine(LoadImgFromCache(item.thumbnail.localPath, raw));
    }
示例#2
0
 public void OpenWeb()
 {
     Debug.Log(address);
     web.LoadWebSetTitle(address, title);
 }
示例#3
0
 public void OpenWeb()
 {
     web.LoadWebSetTitle(address, name);
 }
示例#4
0
    IEnumerator Start()
    {
#if UNITY_IOS || UNITY_IPHONE
        if (isUnzipOver != "true" && FirstEnter != GlobalInfo.APPversion)
        {
            unzip._inst.unzipres((b =>
            {
                if (b)
                {
                    isUnzipOver = "true";
                }
                else
                {
                    isUnzipOver = "false";
                }
            }));
        }
#endif

        //屏幕常亮
        Screen.sleepTimeout = SleepTimeout.NeverSleep;

        DownloadProp.Instance.UpdateCategoryInfo();
        DownloadProp.Instance.UpdateComponentInfo();

        for (int i = 0; i < pages.Length; i++)
        {
#if UNITY_ANDROID || UNITY_EDITOR
            pages[i].sizeDelta        = new Vector2(Screen.width, Screen.height);
            pages[i].anchoredPosition = new Vector2(0, 1920 - Screen.height);
#elif UNITY_IOS || UNITY_IPHONE
#endif
        }
        if (GlobalInfo.LastAdsUrl.Length > 5 && GlobalInfo.LastAdsImgPath.Length > 5 && File.Exists(GlobalInfo.LastAdsImgPath))
        {
            ads.GetComponent <Button>().onClick.AddListener(delegate
            {
                isLookingAds = true;
                web.LoadWebSetTitle(GlobalInfo.LastAdsUrl, "特产详情");
            });
            StartCoroutine(LoadImgFromCache(GlobalInfo.LastAdsImgPath, ads.GetComponent <RawImage>()));

            yield return(new WaitForEndOfFrame());

            HttpManager.Instance.GetAds((b =>
            {
                if (b)
                {
                    foreach (var page in JsonClass.Instance.AdsPages)
                    {
                        HttpManager.Instance.Download(page.Thumbnail, (() =>
                        {
                            GlobalInfo.LastAdsUrl = page.address;
                            GlobalInfo.LastAdsImgPath = page.Thumbnail.localPath;
                        }));
                    }
                }
            }));
        }
        else
        {
            HttpManager.Instance.GetAds((b =>
            {
                if (b)
                {
                    foreach (var page in JsonClass.Instance.AdsPages)
                    {
                        ads.GetComponent <Button>().onClick.AddListener(delegate
                        {
                            if (page.address.Length > 6)
                            {
                                isLookingAds = true;
                                web.LoadWebSetTitle(page.address, "特产详情");
                            }
                        });
                        HttpManager.Instance.Download(page.Thumbnail, (() =>
                        {
                            GlobalInfo.LastAdsUrl = page.address;
                            GlobalInfo.LastAdsImgPath = page.Thumbnail.localPath;
                            StartCoroutine(LoadImgFromCache(GlobalInfo.LastAdsImgPath, ads.GetComponent <RawImage>()));
                        }));
                    }
                }
            }));
        }
        yield return(new WaitForEndOfFrame());

        root.SetActive(true);

#if UNITY_ANDROID || UNITY_EDITOR
        yield return(new WaitForSeconds(3));

        if (FirstEnter != GlobalInfo.APPversion)
        {
            FirstEnter = GlobalInfo.APPversion;
        }
        else if (!isLookingAds)
        {
            EnterMain();
        }
#elif UNITY_IOS || UNITY_IPHONE
        if (isUnzipOver == "true")
        {
            yield return(new WaitForSeconds(3));

            if (FirstEnter != GlobalInfo.APPversion)
            {
                FirstEnter = GlobalInfo.APPversion;
            }
            else if (!isLookingAds)
            {
                EnterMain();
            }
        }
        else
        {
            zipPanel.SetActive(true);
            canchange = true;
        }
#endif
    }