Ejemplo n.º 1
0
    static public bool LoadAsset(ENTITY_ID dressId, ENTITY_ID weaponId, AssetLoader.AssetLoadCallback CallBack, ParamData paramData)
    {
        // id to name
        string weaponName = GlobalInstanceFunction.Instance.GetAssetsName((int)weaponId, AssetLoader.EAssetType.ASSET_WEAPON);

        if (!GlobalInstanceFunction.Instance.IsValidName(weaponName))
        {
            return(false);
        }
        string dressName = "";
        string assName   = "";

        if ((int)dressId != 0)
        {
            dressName = GlobalInstanceFunction.Instance.GetAssetsName((int)dressId, AssetLoader.EAssetType.ASSET_PLAYER);
            //去掉性别
            dressName = dressName.Remove(dressName.Length - 1, 1);
            assName   = string.Format("{0}_{1}", dressName, weaponName);
        }
        else
        {
            assName = weaponName;
        }

        //Load Asset
        AssetLoader.LoadAssetBundle(assName,
                                    AssetLoader.EAssetType.ASSET_WEAPON,
                                    CallBack,
                                    paramData);
        return(true);
    }
Ejemplo n.º 2
0
    public AssetBundle Open(AssetLoader.AssetLoadCallback callback)
    {
        refCount_ += 1;
        callback_  = callback;
        CalcParam();

        return(uiBundle_);
    }
Ejemplo n.º 3
0
 public void CallFuncWithParam(AssetBundle bundle, ParamData data)
 {
     uiBundle_ = bundle;
     if (callback_ != null)
     {
         callback_(uiBundle_, data);
     }
     callback_ = null;
 }
Ejemplo n.º 4
0
    public AssetBundle Set(AssetLoader.AssetLoadCallback callback, ParamData data)
    {
        refCount_ += 1;
        callbacks_.Add(callback);
        datas_.Add(data);
        CalcParam();

        return(uiBundle_);
    }
Ejemplo n.º 5
0
    static public bool LoadAsset(ENTITY_ID ID, AssetLoader.AssetLoadCallback CallBack, ParamData paramData)
    {
        // id to name
        string AssetsName = GlobalInstanceFunction.Instance.GetAssetsName((int)ID, AssetLoader.EAssetType.ASSET_PLAYER);

        if (!GlobalInstanceFunction.Instance.IsValidName(AssetsName))
        {
            return(false);
        }

        string[]      depFiles = PlayerDepedenceData.GetRefAssets(AssetsName);
        PlayerLoadReq info     = new PlayerLoadReq();

        info.name_     = AssetsName;
        info.callback_ = CallBack;
        info.pdata_    = paramData;
        if (depFiles != null)
        {
            info.status_ = new Dictionary <string, PlayerDepLoader.PlayerDepStatus>();
            PlayerDepLoader.PlayerDepStatus[] refStatus = PlayerDepLoader.Instance.LoadAtlas(depFiles);
            for (int i = 0; i < depFiles.Length; ++i)
            {
                info.status_.Add(depFiles[i], refStatus[i]);
            }
            if (!LoadCheck(info))
            {
                loadLst.Add(info);
            }
        }
        else
        {
            if (pdRefDic_.ContainsKey(AssetsName))
            {
                if (pdRefDic_[AssetsName].hasBundle)
                {
                    CallBack(pdRefDic_[AssetsName].Open(), paramData);
                }
                else
                {
                    pdRefDic_[AssetsName].Set(CallBack, paramData);
                    AssetLoader.LoadAssetBundle(AssetsName, AssetLoader.EAssetType.ASSET_PLAYER, LoadPlayerCallback, paramData);
                }
            }
            else
            {
                PlayerBundleRef bundleRef = new PlayerBundleRef();
                bundleRef.Set(CallBack, paramData);
                pdRefDic_.Add(AssetsName, bundleRef);
                pdRef4For_.Add(bundleRef);
                AssetLoader.LoadAssetBundle(AssetsName, AssetLoader.EAssetType.ASSET_PLAYER, LoadPlayerCallback, paramData);
            }
        }

        return(true);
    }
Ejemplo n.º 6
0
    public static bool LoadUI(UIASSETS_ID ID, AssetLoader.AssetLoadCallback CallBack, ParamData paramData)
    {
        string AssetsName = GlobalInstanceFunction.Instance.GetAssetsName((int)ID, AssetLoader.EAssetType.ASSET_UI);

        if (!GlobalInstanceFunction.Instance.IsValidName(AssetsName))
        {
            return(false);
        }

        LoadUI(AssetsName, CallBack, paramData);
        return(true);
    }
Ejemplo n.º 7
0
    static public bool LoadAsset(ENTITY_ID ID, AssetLoader.AssetLoadCallback CallBack, ParamData paramData)
    {
        // id to name
        string AssetsName = GlobalInstanceFunction.Instance.GetAssetsName((int)ID, AssetLoader.EAssetType.ASSET_WEAPON);

        if (!GlobalInstanceFunction.Instance.IsValidName(AssetsName))
        {
            return(false);
        }
        //Load Asset
        AssetLoader.LoadAssetBundle(AssetsName,
                                    AssetLoader.EAssetType.ASSET_WEAPON,
                                    CallBack,
                                    paramData);
        return(true);
    }
Ejemplo n.º 8
0
    public static bool LoadUI(string assetsName, AssetLoader.AssetLoadCallback CallBack, ParamData paramData)
    {
        LoadInfo info = new LoadInfo();

        info.name_     = assetsName;
        info.callback_ = CallBack;
        info.pdata_    = paramData;
        string[] refAtlas = UIDepedenceData.GetRefAtlas(assetsName);
        if (refAtlas == null)
        {
            //因为MessageBoxPanel界面打开时,处于混沌伊始状态(无数据,无网络) 所以在此写死其所需的图集 囧
            if (assetsName.Equals("MessageBoxPanel") || assetsName.Equals("ItemCell") || assetsName.Equals("BabyCell") || assetsName.Equals("StateCell") || assetsName.Equals("SkillCell"))
            {
                refAtlas = new string[] { "CommomAtlas" }
            }
            ;
            if (assetsName.Equals("Notice"))
            {
                refAtlas = new string[] { "noticeAtlas" }
            }
            ;
            if (assetsName.Equals("LoginPanel"))
            {
                refAtlas = new string[] { "NewLoginAtlas", "CommomAtlas" }
            }
            ;
        }

        if (refAtlas != null)
        {
            info.status_ = new Dictionary <string, AtlasLoader.AtlasStatus>();
            AtlasLoader.AtlasStatus[] refStatus = AtlasLoader.Instance.LoadAtlas(refAtlas);
            for (int i = 0; i < refAtlas.Length; ++i)
            {
                info.status_.Add(refAtlas[i], refStatus[i]);
            }
            if (!LoadCheck(info))
            {
                loadLst.Add(info);
            }
        }
        else
        {
            if (uiRefDic_.ContainsKey(assetsName))
            {
                if (uiRefDic_[assetsName].hasBundle)
                {
                    CallBack(uiRefDic_[assetsName].Open(), paramData);
                }
                else
                {
                    uiRefDic_[assetsName].Open(CallBack);
                    AssetLoader.LoadAssetBundle(assetsName, AssetLoader.EAssetType.ASSET_UI, LoadUICallback, paramData);
                }
            }
            else
            {
                UIBundleRef bundleRef = new UIBundleRef();
                bundleRef.Open(CallBack);
                uiRefDic_.Add(assetsName, bundleRef);
                uiRef4For_.Add(bundleRef);
                AssetLoader.LoadAssetBundle(assetsName, AssetLoader.EAssetType.ASSET_UI, LoadUICallback, paramData);
            }
        }

        return(true);
    }