Ejemplo n.º 1
0
    public void ProcessBundleCallBack(IDownloadedItem wItem, object kParamObj)
    {
        if (wItem == null || kParamObj == null)
        {
            return;
        }
        NkBundleParam nkBundleParam = kParamObj as NkBundleParam;
        string        bundleKey     = nkBundleParam.GetBundleKey();

        if (!wItem.canAccessAssetBundle)
        {
            switch (nkBundleParam.GetBundleType())
            {
            case NkBundleParam.eBundleType.BUNDLE_CHAR_BONE:
            case NkBundleParam.eBundleType.BUNDLE_CHAR_BONEPRELOAD:
            case NkBundleParam.eBundleType.BUNDLE_CHAR_SWITCHPART:
            case NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHPART:
            case NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHITEM:
            case NkBundleParam.eBundleType.BUNDLE_CHAR_RIDE:
            case NkBundleParam.eBundleType.BUNDLE_CHAR_NONEPART:
            case NkBundleParam.eBundleType.BUNDLE_CHAR_OBJECT:
            {
                if (nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_BONEPRELOAD)
                {
                    this.m_fPreloadCount -= 1f;
                }
                int          id           = int.Parse(bundleKey);
                Nr3DCharBase nr3DCharBase = this.Get3DChar(id);
                if (nr3DCharBase == null)
                {
                    return;
                }
                bool itembundle = nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHITEM;
                nr3DCharBase.InitBundleLoadFailed(itembundle, wItem.indexParam);
                if (nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_NONEPART || nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_OBJECT)
                {
                    nr3DCharBase.Set3DCharLoadFailed(true);
                }
                if (Scene.IsCurScene(Scene.Type.SELECTCHAR))
                {
                    MsgHandler.Handle("SetCreateCharPartInfo", new object[]
                        {
                            true,
                            false
                        });
                }
                break;
            }
            }
            return;
        }
        WWWItem wWWItem = wItem as WWWItem;

        if (wWWItem != null)
        {
            wWWItem.SetIndexParam(nkBundleParam.GetNumParam());
            wWWItem.SetStringParam(nkBundleParam.GetStrParam());
        }
        switch (nkBundleParam.GetBundleType())
        {
        case NkBundleParam.eBundleType.BUNDLE_CHAR_BONE:
        case NkBundleParam.eBundleType.BUNDLE_CHAR_BONEPRELOAD:
            this.FinishDownloadAsync(wItem, nkBundleParam);
            if (nkBundleParam.GetBundleType() == NkBundleParam.eBundleType.BUNDLE_CHAR_BONEPRELOAD)
            {
                this.m_fPreloadCount -= 1f;
            }
            break;

        case NkBundleParam.eBundleType.BUNDLE_CHAR_ANIMATION:
            NrTSingleton <Nr3DCharSystem> .Instance.FinishDownloadAnimation(wItem);

            break;

        case NkBundleParam.eBundleType.BUNDLE_CHAR_SWITCHPART:
        {
            int           id2           = int.Parse(bundleKey);
            Nr3DCharActor nr3DCharActor = this.Get3DChar(id2) as Nr3DCharActor;
            if (nr3DCharActor == null)
            {
                return;
            }
            nr3DCharActor.FinishDownloadPart(ref wItem);
            break;
        }

        case NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHPART:
        case NkBundleParam.eBundleType.BUNDLE_CHAR_ATTACHITEM:
        {
            int          id3           = int.Parse(bundleKey);
            Nr3DCharBase nr3DCharBase2 = this.Get3DChar(id3);
            if (nr3DCharBase2 == null)
            {
                return;
            }
            nr3DCharBase2.FinishDownloadItem(ref wItem);
            break;
        }

        case NkBundleParam.eBundleType.BUNDLE_CHAR_RIDE:
        {
            int           id4            = int.Parse(bundleKey);
            Nr3DCharActor nr3DCharActor2 = this.Get3DChar(id4) as Nr3DCharActor;
            if (nr3DCharActor2 == null)
            {
                return;
            }
            nr3DCharActor2.FinishDownloadRide(ref wItem);
            break;
        }

        case NkBundleParam.eBundleType.BUNDLE_CHAR_NONEPART:
        case NkBundleParam.eBundleType.BUNDLE_CHAR_OBJECT:
        {
            int          id5           = int.Parse(bundleKey);
            Nr3DCharBase nr3DCharBase3 = this.Get3DChar(id5);
            if (nr3DCharBase3 == null)
            {
                return;
            }
            nr3DCharBase3.FinishDownloadBase(ref wItem);
            break;
        }

        case NkBundleParam.eBundleType.BUNDLE_UI_DIALOG:
        {
            int  indexParam = wItem.indexParam;
            Form form       = NrTSingleton <FormsManager> .Instance.GetForm((G_ID)indexParam);

            if (form == null)
            {
                return;
            }
            form.FinishDownloadBundle(ref wItem);
            break;
        }

        case NkBundleParam.eBundleType.BUNDLE_NORMAL_CALLBACK:
            nkBundleParam.funcCallBack(ref wItem);
            break;

        case NkBundleParam.eBundleType.BUNDLE_OBJECTPARAM_CALLBACK:
            nkBundleParam.funcParamCallBack(ref wItem, nkBundleParam.GetParamObject());
            break;

        default:
            return;
        }
    }