Пример #1
0
        IEnumerator DoLoadAtlas(UIAtlas atlas, int aid, string atlasResName)
        {
            while (mUIAtlasLoading)
            {
                yield return(new WaitForFixedUpdate());
            }
            mUIAtlasLoading = true;
            if (null == atlas.texture)
            {
                WWW ui = StreamAssetHelper.LoadAsset(StreamAssetRoot.UIATLASTEX_ROOT, atlasResName + ".tex", 1);
                ui.threadPriority = ThreadPriority.High;
                yield return(ui);

                AssetBundle ab = ui.assetBundle;
                if (null == atlas.texture)
                {
                    if (!string.IsNullOrEmpty(ui.error))
                    {
                        PopupDialogView.PopupAB(PopupDialogType.Confirm, SharedResources.Inst.UIPopup, "错误", ui.error);
                        Debug.LogError(ui.error);
                    }
                    else
                    {
                        if (null == ab)
                        {
                            string error = "图包:" + atlas.name + "[" + atlasResName + "]的assetBundle为空!";
                            PopupDialogView.PopupAB(PopupDialogType.Confirm, SharedResources.Inst.UIPopup, "错误", error);
                            Debug.LogError(error);
                        }
                        else
                        {
                            //float sTime = Time.realtimeSinceStartup;
                            atlas.spriteMaterial.mainTexture = ab.mainAsset as Texture2D;
                            ab.Unload(false);
                            //LogSys.Debug("~~~inst atlas[" + atlasObj.name + "]used:" + (Time.realtimeSinceStartup - sTime).ToString());
                            //mAtlasRefCounts.Add(atlas.name, 0);
                            LogSys.Debug("成功载入图包:" + atlas.name);
                        }
                    }
                }
                else if (null != ab)
                {
                    ab.Unload(false);
                }
                ui.Dispose();
            }
            if (!mAtlasRefCounts.ContainsKey(aid))
            {
                mAtlasRefCounts.Add(aid, 0);
            }
            mUIAtlasLoading = false;
        }
Пример #2
0
        //IEnumerator DoLoadFont(UIHlp.动态字体类型 t, Object lbl)
        //{
        //    string fontName = t.ToString();
        //    if (!mFontList.ContainsKey(fontName))
        //    {
        //        string fontResName = LogicModel.GetResName(ResourceType.Font, fontName);
        //        if (string.IsNullOrEmpty(fontResName))
        //            Debug.LogError("找不到字体[" + t.ToString() + "]对应的资源!");
        //        else
        //            yield return StartCoroutine(DoLoadFont(fontName, fontResName));
        //    }
        //    if (null != lbl)
        //    {
        //        //lblEx.OnFontLoaded(fontName, mFontList[fontName]);
        //    }
        //}
        IEnumerator DoLoadTexture(string path)
        {
            while (mTextureLoading)
            {
                yield return(new WaitForFixedUpdate());
            }
            mTextureLoading = true;
            if (!mTextureList.ContainsKey(path))
            {
                WWW file = StreamAssetHelper.LoadAsset(StreamAssetRoot.TEXTURE_ROOT, path);
                file.threadPriority = ThreadPriority.High;
                yield return(file);

                if (!string.IsNullOrEmpty(file.error))
                {
                    PopupDialogView.PopupAB(PopupDialogType.Confirm, SharedResources.Inst.UIPopup, "错误", file.error);
                    Debug.LogError(file.error);
                }
                else
                {
                    AssetBundle ab  = file.assetBundle;
                    Texture2D   tex = file.texture;
                    if (null == tex)
                    {
                        string error = "贴图" + path + "的texture为空!";
                        PopupDialogView.PopupAB(PopupDialogType.Confirm, SharedResources.Inst.UIPopup, "错误", error);
                        Debug.LogError(error);
                    }
                    else
                    {
                        mTextureList.Add(path, new TwoData <Texture, int>(tex, 0));
                        if (null != ab)
                        {
                            ab.Unload(false);
                        }
                        LogSys.Debug("成功载入贴图:" + path);
                    }
                }
                file.Dispose();
            }
            mTextureLoading = false;
        }
Пример #3
0
    // 购买道具回调
    // 返回错误编号,0 为成功。只有账号 PP 币余额大于 商品价格时会有回调。
    void U3D_payResultCallBack(string s)
    {
        Debug.Log("回调:返回购买道具编号:" + s);
        int c = -1;

        if (int.TryParse(s, out c))
        {
            Common.PPPayResultCode code = (Common.PPPayResultCode)c;
            switch (code)
            {
            case Common.PPPayResultCode.PPPayResultCodeCommunicationFail:
            case Common.PPPayResultCode.PPPayResultCodeUntreatedBillNo:
            {
                PopupDialogView.Popup(弹框类型.错误提示, Text.SharedShowStrings.充值提醒.ToString(),
                                      Text.SharedShowStrings.购买商品请求处理成功.ToString() + "!" +
                                      Text.SharedShowStrings.如果长时间未收到商品请联系PP充值客服.ToString() + "。" +
                                      Text.SharedShowStrings.电话.ToString() + ":020-38276673");
            }
            break;
            }
        }
    }
Пример #4
0
        public void ClearUI(params UIViewType[] ps)
        {
            List <UIViewType> list = new List <UIViewType>();

            list.AddRange(ps);
            UIBaseView[] uis = mActivedChilden.ToArray();
            for (int i = 0; i < uis.Length; ++i)
            {
                if (uis[i].UI类型 > UIViewType.Root2D && uis[i].UI类型 < UIViewType.弹出框)
                {
                    if (list.Contains(uis[i].UI类型))
                    {
                        continue;
                    }
                    if (null != uis[i])
                    {
                        Destroy(uis[i].gameObject);
                    }
                }
            }
            uis = mFadeInedChilden.ToArray();
            for (int i = 0; i < uis.Length; ++i)
            {
                if (uis[i].UI类型 > UIViewType.Root2D && uis[i].UI类型 < UIViewType.弹出框)
                {
                    if (list.Contains(uis[i].UI类型))
                    {
                        continue;
                    }
                    if (null != uis[i])
                    {
                        Destroy(uis[i].gameObject);
                    }
                }
            }
            uis = mFadeOutedChilden.ToArray();
            for (int i = 0; i < uis.Length; ++i)
            {
                if (uis[i].UI类型 > UIViewType.Root2D && uis[i].UI类型 < UIViewType.弹出框)
                {
                    if (list.Contains(uis[i].UI类型))
                    {
                        continue;
                    }
                    if (null != uis[i])
                    {
                        Destroy(uis[i].gameObject);
                    }
                }
            }
            uis = mDisableedChilden.ToArray();
            for (int i = 0; i < uis.Length; ++i)
            {
                if (uis[i].UI类型 > UIViewType.Root2D && uis[i].UI类型 < UIViewType.弹出框)
                {
                    if (list.Contains(uis[i].UI类型))
                    {
                        continue;
                    }
                    if (null != uis[i])
                    {
                        Destroy(uis[i].gameObject);
                    }
                }
            }
            mActivedChilden.Clear();
            mFadeInedChilden.Clear();
            mFadeOutedChilden.Clear();
            mDisableedChilden.Clear();
            PopupDialogView.CloseDialogs();
            //mUnlockFuncID = -1;
            mInterchangeParams = null;
            //BetterDataCacheing<Vector2>.ClearCache();
            //BetterDataCacheing<Vector3>.ClearCache();
            //BetterDataCacheing<Vector4>.ClearCache();
            //BetterDataCacheing<Color32>.ClearCache();
        }