Пример #1
0
    /// <summary>
    /// 加载图片协成
    /// </summary>
    /// <param name="pUrl"></param>
    /// <returns></returns>
    public IEnumerator LoadCurtain(UpParam param)
    {
        IsLoading = true;
        //Debug.Log("isLoaded = " + isLoaded);
        WWW www;

        Dictionary <string, RawImage> .Enumerator em = param.UploadData.GetEnumerator();
        while (em.MoveNext())
        {
            param.UploadData[em.Current.Key].texture = null;
        }

        PagePool.Instance.GetPictureData(param);

        em = param.UploadData.GetEnumerator();
        //Debug.Log(param.Count);
        while (em.MoveNext() && param.UploadData[em.Current.Key].texture == null)
        {
            www = new WWW(GetXml.Instances.LoadUrl + em.Current.Key);
            Debug.Log(GetXml.Instances.LoadUrl + em.Current.Key);
            yield return(www);

            //Debug.Log("Count0 : " + param.Count);
            if (www.isDone && www.error == null)
            {
                param.UploadData[em.Current.Key].texture = www.texture;
            }
            else
            {
                //BookInfomation._isntance.TestText.text += "\n" + www.error + "->>  " + param[i].Url;
                Debug.Log(www.error);
                //Debug.Log(param[i].Url);
            }
        }
        IsLoading = false;
        //Debug.Log("LoadCurtain");
        if (isLoaded)
        {
            Debug.Log("isLoaded: turnPlay = null ? " + (CallBack.turnPlay == null));
            isLoaded = false;
            //CallBack.CurrentState = CurrentState;
            //CallBack.turnPlay = turnPlay;
            CallBack.maxPics  = param.UploadData.Count / 2;
            CallBack.needCall = true;
        }
        IEm = null;
    }
Пример #2
0
    public virtual void SetContent(Page bp)
    {
        //Debug.Log("0");
        UpParam iip = null;

        //Debug.Log("1");
        if (bp is CataloguePage)
        {
            iip = new UpParam(bp.PageTab, true);
        }
        else
        {
            iip = new UpParam(bp.PageTab + BookInfomation._isntance.CatalogueLen, false);
        }

        Debug.Log(gameObject.name + ":SetContent");
        //Debug.Log(bp.PageTab + "; SetContent");
        Debug.Log(Items.Count + ";   param.items.count = " + bp.Items.Count);
        GameObject obj;

        foreach (string code in Items.Keys)
        {
            if (bp.Items.ContainsKey(code))
            {
                switch (Items[code].type)
                {
                case ItemType.Text: (Items[code].target as Text).text = bp.Items[code].target as string;
                    //Debug.Log("code: " + code + "; text = " + bp.Items[code].target as string);
                    break;

                case ItemType.RawImage:
                    if (bp.Items[code].target is string)
                    {
                        //Debug.Log();
                        iip.UploadData.Add(bp.Items[code].target as string, Items[code].target as RawImage);
                    }

                    break;

                case ItemType.Audio:
                    break;

                case ItemType.Video:
                    break;

                case ItemType.None:
                    break;
                }
            }
            else
            {
                Debug.Log("Page not containsKey:" + code);
            }
        }

        if (IEm != null)
        {
            try
            {
                StopCoroutine(IEm);
            }
            catch (System.Exception ex)
            {
                Debug.Log(ex.Message);
            }
            finally
            {
                IEm = null;
            }
        }
        //Debug.Log("PageTable = " + bp.PageTab);
        //Debug.Log("iip.UploadData.Count = " + iip.UploadData.Count);
        gameObject.SetActive(true);
        //Debug.Log(gameObject.transform.parent.parent.gameObject.name + "-> " + gameObject.name);
        IEm = StartCoroutine(LoadCurtain(iip));
        //Debug.Log("wwwwwwwwwwwwwwwwww");
        //OnEnbale();
    }
Пример #3
0
    public override void SetContent(Page bp)
    {
        UpParam iip = null;

        if (bp is CataloguePage)
        {
            iip = new UpParam(bp.PageTab, true);
        }
        else
        {
            iip = new UpParam(bp.PageTab + BookInfomation._isntance.CatalogueLen, false);
        }

        InputField  input;
        RawImage    ri;
        UpdataEvent ue;
        GameObject  obj;

        foreach (string code in Items.Keys)
        {
            Debug.Log("bp.Items.ContainsKey(" + code + ") = " + bp.Items.ContainsKey(code));

            //Debug.Log("[原本]:" + Items[code].type.ToString() + " ;  [内页]:" + bp.Items[code].type.ToString());
            if (bp.Items.ContainsKey(code))
            {
                Debug.Log("[原本]:" + Items[code].type.ToString() + " ;  [内页]:" + bp.Items[code].type.ToString());
                switch (Items[code].type)
                {
                case ItemType.Text:
                    if (Items[code].target is string)
                    {
                        input       = Items[code].target as InputField;
                        input.text  = bp.Items[code].target as string;
                        ue          = input.gameObject.GetComponent <UpdataEvent>();
                        ue.LeyoutID = Items[code].leyoutID;
                        ue.selfType = ItemType.Text;
                    }

                    //Debug.Log("code: " + code + "; text = " + bp.Items[code].target as string);
                    break;

                case ItemType.RawImage:
                    if (bp.Items[code].target is string)
                    {
                        ri          = Items[code].target as RawImage;
                        ue          = ri.transform.GetChild(0).GetComponent <UpdataEvent>();
                        ue.LeyoutID = Items[code].leyoutID;
                        ue.selfType = ItemType.RawImage;
                        iip.UploadData.Add(bp.Items[code].target as string, ri);
                    }

                    break;

                case ItemType.Link:
                    if (Items[code].target is GameObject)
                    {
                        obj = Items[code].target as GameObject;
                        ItemButton btn     = obj.GetComponent <ItemButton>();
                        ButtonItem btnData = bp.Items[code].target as ButtonItem;
                        btn.Url = btnData.url;
                        //btn.LeyoutID = btnData.leyoutID;
                    }

                    break;

                case ItemType.Audio:
                    break;

                case ItemType.Video:
                    break;

                case ItemType.None:
                    break;
                }
            }
            else
            {
                Debug.Log("leyout = " + code);
                Debug.Log("item.count = " + Items.Count);
                string str = "->\n";
                foreach (string key in Items.Keys)
                {
                    str += "; " + key;
                }
                Debug.Log(str);
                str = "-->\n";
                foreach (string key in bp.Items.Keys)
                {
                    str += "; " + key;
                }
                Debug.Log(str);
            }
        }

        if (IEm != null)
        {
            try
            {
                StopCoroutine(IEm);
            }
            catch (System.Exception ex)
            {
                Debug.Log(ex.Message);
            }
            finally
            {
                IEm = null;
            }
        }
        //Debug.Log("PageTable = " + bp.PageTab);
        //Debug.Log("iip.UploadData.Count = " + iip.UploadData.Count);
        gameObject.SetActive(true);
        //Debug.Log(gameObject.transform.parent.parent.gameObject.name + "-> " + gameObject.name);
        IEm = StartCoroutine(LoadCurtain(iip));
    }