Ejemplo n.º 1
0
 void Start()
 {
     manager = gameObject.AddComponent<AssetBundleManager>();
     manager.Init(() =>
     {
         LoadObjects();
     });
 }
 // Use this for initialization
 void Start()
 {
     // アセットバンドルマネージャーインスタンス取得
     bundleMng = AssetBundleManager.Instance;
     // キャッシュから読み込み
     string[] bundleNames = { "unitychan_std", "unitychan_crs", "unitychan_baseassets" };
     bundleMng.LoadAssetBundle (bundleNames, ((bool isSuccess, string error) => {
         if (isSuccess) {
             isButtonEnabled = true;
             Debug.Log("ロード成功");
         }
         else {
             Debug.Log("ロード失敗 : "+error);
         }
     }));
 }
Ejemplo n.º 3
0
        public void onEnabled()
        {
            Global.NO_TRACKBUILDER_RESTRICTIONS = true;

            if (Main.configuration == null) {
                Main.configuration = new Configuration (Path);
                Main.configuration.Load ();
                Main.configuration.Save ();

            }

			if (Main.AssetBundleManager == null) {

				AssetBundleManager = new AssetBundleManager (this);
            } 



			ScriptableSingleton<UIAssetManager>.Instance.trackBuilderWindowGO.gameObject.AddComponent <TrackUIHandle>();
           
            //GameObject container = UnityEngine.GameObject.Instantiate (Main.AssetBundleManager.UiContainerWindowGo);
            //container.transform.SetParent(ScriptableSingleton<UIAssetManager>.Instance.trackBuilderWindowGO.gameObject.transform);



            /*Transform headerPanel= UnityEngine.Object.Instantiate (Main.AssetBundleManager.UiHeaderPanelGo).transform;
            headerPanel.transform.SetParent( ScriptableSingleton<UIAssetManager>.Instance.trackBuilderWindowGO.gameObject.transform);
            headerPanel.transform.name = "HeaderPanel";

            Transform mainBody =  UnityEngine.Object.Instantiate (Main.AssetBundleManager.UiContainerWindowGo).transform;
            mainBody.transform.SetParent ( ScriptableSingleton<UIAssetManager>.Instance.trackBuilderWindowGO.gameObject.transform);
            mainBody.SetSiblingIndex (1);
            mainBody.transform.name = "TrackEditPanel";
            UnityEngine.Debug.Log (mainBody.name);*/

		}
Ejemplo n.º 4
0
 public void Clear()
 {
     AssetBundleManager.DeleteAssets(ref achiIconPrefabRes, true);
 }
    void Start()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this.gameObject);
        }

        //Check for unused AssetBundles every 5 seconds
        InvokeRepeating("CheckForUnusedBundles", 5,5);
    }
Ejemplo n.º 6
0
 public bool ReleaseResNode(ResNode _resNode, bool _bImmediate)
 {
     return(AssetBundleManager.ReleaseResNode(this, _resNode, _bImmediate));
 }
Ejemplo n.º 7
0
 // Use this for initialization
 void Start()
 {
     AssetBundleManager.Initialize();
 }
Ejemplo n.º 8
0
        public override void onEnabled()
        {
            hider = new GameObject();
            hider.SetActive(false);

            AssetBundleManager assetBundleManager = new AssetBundleManager(this);

            binder = new TrackRiderBinder("ed7f0bf864bee459f34bc3e1b426c04e");
            var trackedRide =
                binder.RegisterTrackedRide <TrackedRide>("Wooden Coaster", "VirginiaReelCoaster",
                                                         "Virginia Reel Coaster");
            var trackGenerator =
                binder.RegisterMeshGenerator <VirginiaReelTrackGenerator>(trackedRide);

            TrackRideHelper.PassMeshGeneratorProperties(TrackRideHelper.GetTrackedRide("Wooden Coaster").meshGenerator,
                                                        trackedRide.meshGenerator);


            trackGenerator.crossBeamGO =
                GameObjectHelper.SetUV(ProxyObject(Object.Instantiate(assetBundleManager.SideCrossBeamGo)), 15, 14);

            trackedRide.price                      = 1200;
            trackedRide.maxBankingAngle            = 0;
            trackedRide.min90CurveSize             = 1;
            trackedRide.carTypes                   = new CoasterCarInstantiator[] { };
            trackedRide.isSpeedLimited             = true;
            trackedRide.maximumVelocity            = 10;
            trackedRide.meshGenerator.customColors = new[]
            {
                new Color(63f / 255f, 46f / 255f, 37f / 255f, 1), new Color(43f / 255f, 35f / 255f, 35f / 255f, 1),
                new Color(90f / 255f, 90f / 255f, 90f / 255f, 1)
            };
            // trackedRide.canChangeCarRotation = true;

            var coasterCarInstantiator =
                binder.RegisterCoasterCarInstaniator <CoasterCarInstantiator>(trackedRide, "VirginiaReelInstantiator",
                                                                              "Virginia Reel Car", 1, 1, 1);
            var virginiaReelCar = binder.RegisterCar <VirginiaReelCar>(
                ProxyObject(Object.Instantiate(assetBundleManager.CartGo)),
                "VirginiaReelCar", .3f, .1f, true, new[]
            {
                new Color(71f / 255, 71f / 255, 71f / 255),
                new Color(176f / 255, 7f / 255, 7f / 255),
                new Color(26f / 255, 26f / 255, 26f / 255)
            }
                );

            coasterCarInstantiator.vehicleGO = virginiaReelCar;
            coasterCarInstantiator.vehicleGO.gameObject.AddComponent <RestraintRotationController>().closedAngles =
                new Vector3(0, 0, 120);

            binder.Apply();

            //deprecatedMappings
            var oldHash = "asdfasdfabeawefawefv";

            GameObjectHelper.RegisterDeprecatedMapping("virginia_reel_go" + oldHash, trackedRide.name);
            GameObjectHelper.RegisterDeprecatedMapping("Reel_Car@CoasterCarInstantiator" + oldHash,
                                                       coasterCarInstantiator.name);
            GameObjectHelper.RegisterDeprecatedMapping("Reel_Car_Front" + oldHash, virginiaReelCar.name);
        }
Ejemplo n.º 9
0
 void Awake()
 {
     Instance = this;
 }
Ejemplo n.º 10
0
 public static Object LoadSync(string path, System.Type type)
 {
     path = path.ToLower();
     return(AssetBundleManager.LoadSync(path, type));
 }
Ejemplo n.º 11
0
 public override void Destroy()
 {
     AssetBundleManager.DeleteAssets(ref popUpMenuPrefabRes, true);
     base.Destroy();
 }
Ejemplo n.º 12
0
    public static string[] GetAllAssetName(
        string assetBundleName,
        bool _WithExtension            = true,
        string manifestAssetBundleName = null,
        bool isAllCheck = false)
    {
        if (manifestAssetBundleName == null && isAllCheck && AssetBundleManager.AllLoadedAssetBundleNames.Contains(assetBundleName))
        {
            foreach (KeyValuePair <string, AssetBundleManager.BundlePack> keyValuePair in AssetBundleManager.ManifestBundlePack)
            {
                LoadedAssetBundle loadedAssetBundle;
                if (keyValuePair.Value.LoadedAssetBundles.TryGetValue(assetBundleName, out loadedAssetBundle))
                {
                    if (_WithExtension)
                    {
                        string[] allAssetNames = loadedAssetBundle.m_AssetBundle.GetAllAssetNames();
                        // ISSUE: reference to a compiler-generated field
                        if (AssetBundleCheck.\u003C\u003Ef__mg\u0024cache0 == null)
                        {
                            // ISSUE: reference to a compiler-generated field
                            AssetBundleCheck.\u003C\u003Ef__mg\u0024cache0 = new Func <string, string>(Path.GetFileName);
                        }
                        // ISSUE: reference to a compiler-generated field
                        Func <string, string> fMgCache0 = AssetBundleCheck.\u003C\u003Ef__mg\u0024cache0;
                        return(((IEnumerable <string>)allAssetNames).Select <string, string>(fMgCache0).ToArray <string>());
                    }
                    string[] allAssetNames1 = loadedAssetBundle.m_AssetBundle.GetAllAssetNames();
                    // ISSUE: reference to a compiler-generated field
                    if (AssetBundleCheck.\u003C\u003Ef__mg\u0024cache1 == null)
                    {
                        // ISSUE: reference to a compiler-generated field
                        AssetBundleCheck.\u003C\u003Ef__mg\u0024cache1 = new Func <string, string>(Path.GetFileNameWithoutExtension);
                    }
                    // ISSUE: reference to a compiler-generated field
                    Func <string, string> fMgCache1 = AssetBundleCheck.\u003C\u003Ef__mg\u0024cache1;
                    return(((IEnumerable <string>)allAssetNames1).Select <string, string>(fMgCache1).ToArray <string>());
                }
            }
        }
        LoadedAssetBundle loadedAssetBundle1 = AssetBundleManager.GetLoadedAssetBundle(assetBundleName, out string _, manifestAssetBundleName);
        AssetBundle       assetBundle        = loadedAssetBundle1 == null?AssetBundle.LoadFromFile(AssetBundleManager.BaseDownloadingURL + assetBundleName) : loadedAssetBundle1.m_AssetBundle;

        string[] array;
        if (_WithExtension)
        {
            string[] allAssetNames = assetBundle.GetAllAssetNames();
            // ISSUE: reference to a compiler-generated field
            if (AssetBundleCheck.\u003C\u003Ef__mg\u0024cache2 == null)
            {
                // ISSUE: reference to a compiler-generated field
                AssetBundleCheck.\u003C\u003Ef__mg\u0024cache2 = new Func <string, string>(Path.GetFileName);
            }
            // ISSUE: reference to a compiler-generated field
            Func <string, string> fMgCache2 = AssetBundleCheck.\u003C\u003Ef__mg\u0024cache2;
            array = ((IEnumerable <string>)allAssetNames).Select <string, string>(fMgCache2).ToArray <string>();
        }
        else
        {
            string[] allAssetNames = assetBundle.GetAllAssetNames();
            // ISSUE: reference to a compiler-generated field
            if (AssetBundleCheck.\u003C\u003Ef__mg\u0024cache3 == null)
            {
                // ISSUE: reference to a compiler-generated field
                AssetBundleCheck.\u003C\u003Ef__mg\u0024cache3 = new Func <string, string>(Path.GetFileNameWithoutExtension);
            }
            // ISSUE: reference to a compiler-generated field
            Func <string, string> fMgCache3 = AssetBundleCheck.\u003C\u003Ef__mg\u0024cache3;
            array = ((IEnumerable <string>)allAssetNames).Select <string, string>(fMgCache3).ToArray <string>();
        }
        if (loadedAssetBundle1 == null)
        {
            assetBundle.Unload(true);
        }
        return(array);
    }
Ejemplo n.º 13
0
 public void UnloadAssetBundle(string bundleName)
 {
     AssetBundleManager.UnloadAssetBundle(bundleName);
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Removes a list of downloadingAssetItems from the downloadingItems List.
        /// </summary>
        /// <param name="itemsToRemove"></param>
        public IEnumerator RemoveDownload(List <DownloadingAssetItem> itemsToRemove)
        {
            //Not used any more UMAs check the status of stuff they asked for themselves
            //Dictionary<UMAAvatarBase, List<string>> updatedUMAs = new Dictionary<UMAAvatarBase, List<string>>();
            foreach (DownloadingAssetItem item in itemsToRemove)
            {
                item.isBeingRemoved = true;
            }

            foreach (DownloadingAssetItem item in itemsToRemove)
            {
                string error = "";
                //we need to check everyitem in this batch belongs to an asset bundle that has actually been loaded
                LoadedAssetBundle loadedBundleTest   = AssetBundleManager.GetLoadedAssetBundle(item.containingBundle, out error);
                AssetBundle       loadedBundleABTest = loadedBundleTest.m_AssetBundle;
                if (loadedBundleABTest == null && (String.IsNullOrEmpty(error)))
                {
                    while (loadedBundleTest.m_AssetBundle == null)
                    {
                        //could say we are unpacking here
                        yield return(null);
                    }
                }
                if (!String.IsNullOrEmpty(error))
                {
                    if (Debug.isDebugBuild)
                    {
                        Debug.LogError(error);
                    }

                    yield break;
                }
            }
            //Now every item in the batch should be in a loaded bundle that is ready to use.
            foreach (DownloadingAssetItem item in itemsToRemove)
            {
                if (item != null)
                {
                    string error          = "";
                    var    loadedBundle   = AssetBundleManager.GetLoadedAssetBundle(item.containingBundle, out error);
                    var    loadedBundleAB = loadedBundle.m_AssetBundle;
                    if (!String.IsNullOrEmpty(error))
                    {
                        if (Debug.isDebugBuild)
                        {
                            Debug.LogError(error);
                        }

                        yield break;
                    }
                    var assetType = item.tempAsset.GetType();
                    //deal with RuntimeAnimatorController funkiness
                    //the actual type of an instantiated clone of a RuntimeAnimatorController in the editor is UnityEditor.Animations.AnimatorController
                    if (assetType.ToString().IndexOf("AnimatorController") > -1)
                    {
                        assetType = typeof(RuntimeAnimatorController);
                    }
                    var itemFilename = AssetBundleManager.AssetBundleIndexObject.GetFilenameFromAssetName(item.containingBundle, item.requiredAssetName, assetType.ToString());
                    if (assetType == typeof(RaceData))
                    {
                        RaceData actualRace = loadedBundleAB.LoadAsset <RaceData>(itemFilename);
                        UMAContext.Instance.raceLibrary.AddRace(actualRace);
                        UMAContext.Instance.raceLibrary.UpdateDictionary();
                        //Refresh DCS so that anything that this race is cross compatible with gets added to its list of available recipes
                        (UMAContext.Instance.dynamicCharacterSystem as DynamicCharacterSystem).RefreshRaceKeys();
                    }
                    else if (assetType == typeof(SlotDataAsset))
                    {
                        SlotDataAsset thisSlot = null;
                        thisSlot = loadedBundleAB.LoadAsset <SlotDataAsset>(itemFilename);
                        if (thisSlot != null)
                        {
                            UMAContext.Instance.slotLibrary.AddSlotAsset(thisSlot);
                        }
                        else
                        {
                            if (Debug.isDebugBuild)
                            {
                                Debug.LogWarning("[DynamicAssetLoader] could not add downloaded slot" + item.requiredAssetName);
                            }
                        }
                    }
                    else if (assetType == typeof(OverlayDataAsset))
                    {
                        OverlayDataAsset thisOverlay = null;
                        thisOverlay = loadedBundleAB.LoadAsset <OverlayDataAsset>(itemFilename);
                        if (thisOverlay != null)
                        {
                            UMAContext.Instance.overlayLibrary.AddOverlayAsset(thisOverlay);
                        }
                        else
                        {
                            if (Debug.isDebugBuild)
                            {
                                Debug.LogWarning("[DynamicAssetLoader] could not add downloaded overlay" + item.requiredAssetName + " from assetbundle " + item.containingBundle);
                            }
                        }
                    }
                    else if (assetType == typeof(UMATextRecipe))
                    {
                        UMATextRecipe downloadedRecipe = loadedBundleAB.LoadAsset <UMATextRecipe>(itemFilename);
                        (UMAContext.Instance.dynamicCharacterSystem as DynamicCharacterSystem).AddRecipe(downloadedRecipe);
                    }
                    else if (assetType == typeof(UMAWardrobeRecipe))
                    {
                        UMAWardrobeRecipe downloadedRecipe = loadedBundleAB.LoadAsset <UMAWardrobeRecipe>(itemFilename);
                        (UMAContext.Instance.dynamicCharacterSystem as DynamicCharacterSystem).AddRecipe(downloadedRecipe);
                    }
                    else if (item.dynamicCallback.Count > 0)
                    {
                        //get the asset as whatever the type of the tempAsset is
                        //send this as an array to the dynamicCallback
                        var downloadedAsset      = loadedBundleAB.LoadAsset(itemFilename, assetType);
                        var downloadedAssetArray = Array.CreateInstance(assetType, 1);
                        downloadedAssetArray.SetValue(downloadedAsset, 0);
                        for (int i = 0; i < item.dynamicCallback.Count; i++)
                        {
                            item.dynamicCallback[i].DynamicInvoke(downloadedAssetArray);
                        }
                    }
                    if (!String.IsNullOrEmpty(error))
                    {
                        if (Debug.isDebugBuild)
                        {
                            Debug.LogError(error);
                        }
                    }
                }
                downloadingItems.Remove(item);
            }
            if (downloadingItems.Count == 0)
            {
                areDownloadedItemsReady = true;
                //AssetBundleManager.UnloadAllAssetBundles();//we cant do this yet
            }
            //yield break;
        }
Ejemplo n.º 15
0
        //TODO 资源管理
        public void LoadAssetbundleDirectly(string path, string assetName, System.Type type)
        {
            Object asset = AssetBundleManager.GetResources().LoadAssetbundleDirectly(path, assetName, type);

            Loaded(asset, path);
        }
Ejemplo n.º 16
0
 private void Awake()
 {
     dicAsset    = new Dictionary <string, Dictionary <string, object> >();
     abManager   = this.transform.parent.GetComponent <AssetBundleManager>();
     timeManager = this.transform.parent.Find("_AssetBundleTimeManager").GetComponent <AssetBundleTimeManager>();
 }
 public override AssetBundleLoadAssetOperation LoadAllBundleAsync <T>()
 {
     return(!this.isFile ? (AssetBundleLoadAssetOperation)null : this.request ?? (this.request = AssetBundleManager.LoadAllAssetAsync(this, typeof(T))));
 }
Ejemplo n.º 18
0
 public static T LoadSync <T>(string path) where T : Object
 {
     path = path.ToLower();
     return(AssetBundleManager.LoadSync(path, typeof(T)) as T);
 }
Ejemplo n.º 19
0
 public override void Start()
 {
     base.Start();
     popUpMenuPrefabRes = AssetBundleManager.GetAssets(AssetType.Asset_Prefab, UPath.UPrefabsPath + "CommomState/PopupMenu/PopupMenu");
 }
Ejemplo n.º 20
0
 public static void Unload(Object obj)
 {
     AssetBundleManager.Release(obj);
 }
Ejemplo n.º 21
0
    // 编辑器模式下采用明文 XML 读取
    // 发包时需要把XML转成二进制读取
    private bool ReadPlainXml <T>(string path, System.Action <T> rowHandler)
    {
        const string XmlConfigBundle = "configxml.bundle";
        //const string XmlConfigAssetPrefix = "Assets/Config/";

        //path = string.Format("{0}{1}", XmlConfigAssetPrefix, path);
        //TextAsset data = ResourceManager.LoadAsset<TextAsset>(path);

        TextAsset data = AssetBundleManager.LoadAsset <TextAsset>(XmlConfigBundle, System.IO.Path.GetFileNameWithoutExtension(path));

        if (data == null)
        {
            Debug.LogErrorFormat("Failed to load config from {0}", path);
            return(false);
        }

        Dictionary <string, FieldInfo> fields = GetFields(typeof(T));

        if (fields == null || fields.Count == 0)
        {
            return(false);
        }

        XmlDocument doc = new XmlDocument();

        try
        {
            doc.LoadXml(data.text);
        }
        catch (System.Exception ex)
        {
            Debug.LogErrorFormat("Failed to read xml from {0}. ({1})", path, ex.Message);
            return(false);
        }

        var table = doc.SelectSingleNode("Object");

        if (table == null)
        {
            return(false);
        }

        var rows = table.SelectNodes("Property");

        for (int i = 0; i < rows.Count; i++)
        {
            var row = rows[i] as XmlElement;
            if (row == null)
            {
                continue;
            }

            T rowInstance = (T)System.Activator.CreateInstance(typeof(T));
            if (rowInstance == null)
            {
                return(false);
            }

            var attribs = row.Attributes;

            for (int j = 0; j < attribs.Count; j++)
            {
                var attribName = attribs[j].Name.ToLower();
                var attribVal  = attribs[j].Value;


                FieldInfo field = null;
                if (!fields.TryGetValue(attribName, out field))
                {
                    continue;
                }

                SetField(field, rowInstance, attribVal);
            }

            rowHandler(rowInstance);
        }

        return(false);
    }
Ejemplo n.º 22
0
 public static void Unload(string path)
 {
     path = path.ToLower();
     AssetBundleManager.Release(path);
 }
Ejemplo n.º 23
0
 public override void UnloadImpl()
 {
     Resources.UnloadAsset(Asset);
     AssetBundleManager.UnloadAssetBundle(BundleName);
 }
Ejemplo n.º 24
0
        private IEnumerator StartUpMgrs()
        {
            // start up StateMgr
            yield return(YieldFactory.GetWaitForEndOfFrame());

            GStateManager.Instance.ForceStateInfo(_stateInfo);

            // warmup shaders inside /Resources/Shaders/ (do this once)
            Shader.WarmupAllShaders();

            // ensure the rest are setup
            yield return(YieldFactory.GetWaitForEndOfFrame());

            GCore.Instance.EnsureMgrsAreSetup();

            while (!GCore.Instance.IsInitialized)
            {
                yield return(YieldFactory.GetWaitForEndOfFrame());
            }

            // play music
            //GSoundMgr.Instance.PlayMusic("commonMusic");

#if ENABLE_ASSET_BUNDLES
#if SMRJ_HACK
            AssetBundleManager.SetDevelopmentAssetBundleServer();
#else
            // LIVE URL
            if (GCore.Wrapper.Client.AppId == "30015")
            {
                AssetBundleManager.SetSourceAssetBundleURL(ASSET_BUNDLE_URL_LIVE);
            }
            // TEST URL
            else
            {
                AssetBundleManager.SetSourceAssetBundleURL(ASSET_BUNDLE_URL);
            }
#endif

#if UNITY_EDITOR
            if (!AssetBundleManager.SimulateAssetBundleInEditor)
#endif
            {
                AssetBundleLoadManifestOperation request = AssetBundles.AssetBundleManager.Initialize();
                if (request != null)
                {
                    yield return(StartCoroutine(request));
                }

                while (AssetBundleManager.AssetBundleManifestObject == null)
                {
                    yield return(YieldFactory.GetWaitForEndOfFrame());
                }
            }

            AssetBundleManager.LoadAssetBundle("eggiesslotstate");
            while (AssetBundleManager.IsDownloadingBundles())
            {
                GStateManager.Instance.ForcedUpdatedLoadingAssetBundle();
                yield return(YieldFactory.GetWaitForEndOfFrame());
            }
            GStateManager.Instance.EnableLoadingScreen(false);
#endif

            yield return(StartCoroutine(loadCommonSounds()));

            yield return(YieldFactory.GetWaitForEndOfFrame());
        }
Ejemplo n.º 25
0
    /// <summary>
    /// 创建通用逻辑模块,主场景和战斗场景均使用,依赖配置表,通常情况下需要更新资源后再执行
    /// </summary>
    public IEnumerator CreateEnumerator()
    {
        bCreated = false;

        Type[] types = new Type[]
        {
            typeof(AssetSystem),
            typeof(ShaderLib),
            typeof(SceneManager),
            typeof(NatureManager),
            typeof(WarFogManager),
        };

        CreateModulesAsyn(types);

        //wait another coroutine finish
        while (true)
        {
            yield return(new WaitForEndOfFrame());

            bool bOK = (CreatingModules.Count == 0);
            if (bOK)
            {
                break;
            }
        }

        yield return(new WaitForSeconds(0.1f));

        if (!Application.isEditor && System.IO.File.Exists("BreakPoint.txt"))
        {
            GameUtil.MsgBox(m_WindowHwnd, "挂断点", "调试", 0);
        }

        if (!RenderViewAPI.Start())
        {
            Trace.LogError("Game Start Service failure");
            yield break;
        }
        Trace.Log("Game Start Service successed");
        // 初始化
        gameObject.AddComponent <GameViewCommandHandler>();

        OnDeviceStateChage += OnDeviceStateChange;

        // 初始化游戏接口
        IntPtrHelper helper = new IntPtrHelper();

        //GameLogicAPI.Start(ASpeedGame.Data.GameSettingsXml.GameSettingsXmlManager.Instance.GameSettingsModel.enableMultiThread.AValue,
        //    helper.toPtr(ref RenderViewAPI.g_RenderView));
        GameLogicAPI.Start(helper.toPtr(ref RenderViewAPI.g_RenderView));
        yield return(new WaitForSeconds(1.0f));

        PrintTickCheck("初始化逻辑层API,至少等了1秒", CostThreshold_Lv1, _bStart: true);

        // 显示层配置价值
        ViewConfigManager.Init();
        PrintTickCheck("ViewConfigManager.Init");


        //资源是要配置初始化
        AssetBundleManager.Init();
        PrintTickCheck("AssetBundleManager.Init");



        LogicDataCenter.Init();
        PrintTickCheck("LogicDataCenter.Init");



        ImageSetting.Init();
        PrintTickCheck("ImageSetting.Init");

        ImageEffectManager.API_GameStart();
        PrintTickCheck("ImageEffectManager.Init");

        //GameViewCommandHandler.Instance.Start();
        MouseCursorManager.Instance.InitMouseCursorManager();
        PrintTickCheck("MouseCursorManager.Init");

        // 初始化实体接口,依赖上面的物件管理器所以顺序不能换
        EntityFactory.Init();
        PrintTickCheck("EntityFactory.Init");


        PrefabManager.Init();
        PrintTickCheck("PrefabManager.Init");


        SkinManager.Init();
        PrintTickCheck("SkinManager.Init");



        SoundManager.Init();
        PrintTickCheck("SoundManager.Init");

        UISystem.Init();
        PrintTickCheck("UISystem.Init");

        UTopNameManager.Init();
        PrintTickCheck("UTopNameManager.Init");

        USpeedUI.Blood.UBloodManager.Init();
        PrintTickCheck("UBloodManager.Init");



        InputManager.Init();
        PrintTickCheck("InputManager.Init");



        Effect.EffectNode.InitTargetCache();
        PrintTickCheck("Effect.EffectNode.InitTargetCache.Init");

        GUIDE.GuideManager.Init();
        PrintTickCheck(" GUIDE.GuideManager.Init");

        SceneEffectManager.Init();
        PrintTickCheck("SceneEffectManager.Init");
        if (LightingEffectFactory.Instance)
        {
            LightingEffectFactory.Instance.InitWhenGameStart();
        }
        PrintTickCheck("LightingEffectFactory.Init");

        SafeZoneEffectManager.Init();
        PrintTickCheck("SafeZoneEffectManager.Init");

        ImageSetting.TraceSettings();

        bCreated = true;

        List <string> argList = new List <string>();

        argList.AddRange(System.Environment.GetCommandLineArgs());

        CkeckUpdateOk(ref argList);
        PrintTickCheck("CkeckUpdateOk");

        CheckMultclient();
        PrintTickCheck("CheckMultclient");

        StageManager.Init();
        AssetBundleManager.DeleteAssets(ref LoadingWaitngResNode, true);
    }
Ejemplo n.º 26
0
 //卸载
 public void UnloadBundle(GameObject obj)
 {
     Destroy(obj);
     AssetBundleManager.UnloadAssetBundle("cube.unity3d");
 }
Ejemplo n.º 27
0
 internal static T AssetBundleManagerLoadAssetLoader(string assetBundle, string assetName, string manifest)
 {
     return(AssetBundleManager.LoadAsset(assetBundle, assetName, typeof(T), manifest).GetAsset <T>());
 }
Ejemplo n.º 28
0
    // Load AssetBundleManifest.
    public static AssetBundleLoadManifestOperation StartLoading(string manifestAssetBundleName)
    {
        if (_instance == null){
            var go = new GameObject("AssetBundleManager", typeof(AssetBundleManager));
            _instance = go.GetComponent<AssetBundleManager>();
            DontDestroyOnLoad(go);
        }

        #if UNITY_EDITOR
        // If we're in Editor simulation mode, we don't need the manifest assetBundle.
        if (SimulateAssetBundleInEditor)
            return null;
        #endif

        Debuger.Log("StartLoading " + manifestAssetBundleName);
        LoadAssetBundle(manifestAssetBundleName, true);
        var operation = new AssetBundleLoadManifestOperation (manifestAssetBundleName, "AssetBundleManifest", typeof(AssetBundleManifest));
        m_InProgressOperations.Add (operation);
        return operation;
    }
Ejemplo n.º 29
0
 public void Init()
 {
     actorStatistic    = new Dictionary <int, ActorStatisticInfo>();
     warStatistic      = new Dictionary <long, WarStatisticInfo>();
     achiIconPrefabRes = AssetBundleManager.GetAssets(AssetType.Asset_Prefab, UPath.UPrefabsPath + "PlayerWarStatistic/AchiIconItem");
 }
Ejemplo n.º 30
0
 protected override void DestroyAll()
 {
     base.DestroyAll();
     AssetBundleManager.DisposeAsset(_bundleUrlUI);
 }
    /// <summary>
    /// Initiates the download of the asset bundle. Only works if properties have been set with QueueBundleDownload first.
    /// </summary>
    public void DownloadAsset()
    {
        assetManager = AssetBundleManager.Instance;
        //Check from in the assetBundleManager if this bundle is already downloaded.
        AssetBundleContainer thisBundle = assetManager.GetAssetBundle(bundleName);

        if (thisBundle == null)
        {
            //if not, download it
            StartCoroutine(DownloadAssetBundle(assetName, bundleName, version));
        }
        else
        {
            //if it is, just load the asset directly
            loadedAsset = thisBundle.ThisAssetBundle.Load(assetName, typeof(GameObject));
            isDone = true;
        }
    }
Ejemplo n.º 32
0
    private IEnumerator StartUp()
    {
        KernelManager kernelMgr = KernelManager.Instance();

        if (kernelMgr == null)
        {
            kernelMgr = new KernelManager();
        }
        HotFixUpdate hotFixUpdater = kernelMgr.AddKernel <HotFixUpdate>();

        if (!AppDefine.IsAppStartUped)
        {
            kernelMgr.AddKernel <GameManager>();
            kernelMgr.AddKernel <TimeManager>();
            kernelMgr.AddKernel <SMSManager>();
            kernelMgr.AddKernel <JPushManager>();
            kernelMgr.AddKernel <ShareSDKManager>();
            // QRCode 所需初始化
            IOSAlbumCamera.Init();
            WindowManager.InitWindowManager();

            if (isOpenHotFix)// 判断是否需要拷贝初始资源
            {
                HotFixUpdate.HotfixProgressChangedEvent += HotFixUpdate_HotfixProgressChangedEvent;
                yield return(StartCoroutine(HotFixUpdate.Instance().TryUpdateAssetFromStreamingAssets()));

                HotFixUpdate.HotfixProgressChangedEvent -= HotFixUpdate_HotfixProgressChangedEvent;
                if (m_FirstHandleProgressTips != null)
                {
                    m_FirstHandleProgressTips.gameObject.SetActive(false);
                }
            }
        }
        else
        {
            WindowManager.Instance.CloseAllWindows();
        }

        // 注册资源管理器
        AssetBundleManager assetBundleMgr = AssetBundleManager.Instance;

        while (!assetBundleMgr.IsReady)
        {
            yield return(1);
        }

        if (assetBundleMgr.LaunchFailed)
        {
            Application.Quit();
        }

        LoadingUI.Show();

        if (isOpenHotFix)
        {
            hotFixUpdater.TryStartUpdateRemoteAssetsToLocal();
            while (hotFixUpdater.IsWorking)
            {
                yield return(1);
            }
            // 更新管理器完成了
            if (hotFixUpdater.UpdaterState == HotFixUpdaterState.Done)
            {
                if (!hotFixUpdater.IsValidatedAssets)
                {
                    Debug.LogError("HotfixUpdate error, the assets was not validated!");
                    Application.Quit();
                    yield break;
                }
                // 有更新资源,需要重新加载资源管理器
                if (hotFixUpdater.IsLoadedNewAsset)
                {
                    //WindowManager.Instance.CloseWindow(LoadingUI.UIAssetName, false);
                    LoadingUI.Hide();
                    HotFixUpdate_HotfixProgressChangedEvent(null, new HotfixProgressChangedEventArgs(50, "载入新的游戏资源..."));
                    AssetBundleManager.Instance.ReLaunch();
                    while (!AssetBundleManager.Instance.IsReady)
                    {
                        yield return(1);
                    }
                    if (AssetBundleManager.Instance.LaunchFailed)
                    {
                        Application.Quit();
                    }
                    LoadingUI.Show();
                }
            }
        }

        // 初始化网络管理器
        kernelMgr.AddKernel <Net.ConnectManager>();
        Net.ConnectManager.Instance().CloseAllNetworkClient();
        // 初始化对象池管理器
        LuaAsynFuncMgr.Instance.Init();

        // 初始化Lua管理器
        if (!AppDefine.IsAppStartUped)
        {
            LuaManager.Instance.Launch();
        }
        else
        {
            LuaManager.Instance.ReLaunch();
        }

        while (!LuaManager.Instance.IsReady)
        {
            yield return(1);
        }
        if (LuaManager.Instance.LaunchFailed)
        {
            Application.Quit();
        }
        yield return(1);

        LuaManager.Instance.StartUp();

        kernelMgr.DeleteKernel <HotFixUpdate>();
        GameObject.Destroy(this);

        GameObject splashObj = GameObject.Find("SplashUI");

        if (splashObj != null)
        {
            GameObject.Destroy(splashObj);
        }

        AppDefine.IsAppStartUped = true;
    }
Ejemplo n.º 33
0
    public void Start()
    {
        if (!CheckMultclient())
        {
            Application.Quit();
            return;
        }

        if (!CkeckUpdateOk())
        {
            Application.Quit();
            return;
        }
        Instance = this;
        Initialize.m_WindowHwnd = GameLogicAPI.getMainWindHwnd();
        AssetBundleManager.Init();


        UIResNode = AssetBundleManager.GetAssets(AssetType.Asset_Prefab, "f8aafccc7fff6e34490e09b186458dd8", true);

        if (ResNode.isNullOrEmpty(UIResNode))
        {
            Debug.LogError("找不到性能检测UI资源,以最低配置运行");
            if (AssetBundleManager.isCanLoadLevel(LoginSceneName))
            {
                AssetBundleManager.LoadLevel(LoginSceneName);
            }


            return;
        }
        flowShareData.CheckUI = UIResNode.InstanceMainRes <PerformanceCheck_UI>();
        if (!flowShareData.CheckUI)
        {
            Debug.LogError("找不到性能检测UI,以最低配置运行");
            if (AssetBundleManager.isCanLoadLevel(LoginSceneName))
            {
                AssetBundleManager.LoadLevel(LoginSceneName);
            }
            return;
        }

        ImageEffects.ImageEffectManager.API_ResetSceneBrightness();

        FlowTable.Add(CheckFlow.HardWareSupport, new PerformanceCheckFlow_HardWareSupport());
        FlowTable.Add(CheckFlow.GeometricRender, new PerformanceCheckFlow_RenderingLevel());
        FlowTable.Add(CheckFlow.Finish, new PerformanceCheckFlow_Finish());
        ViewConfigManager.SetDefaultViewConfigPath();

        if (flowShareData.CheckUI)
        {
            flowShareData.CheckUI.Init();
        }

        //本地已经有这个配置了,直接进游戏
        if (GetPerformanceCheckVersion() == currPerformanceCheckVersion)
        {
            if (AssetBundleManager.isCanLoadLevel(LoginSceneName))
            {
                AssetBundleManager.LoadLevel(LoginSceneName);
            }
        }
        else
        {
            InitData();
            if (flowShareData.CheckUI)
            {
                flowShareData.CheckUI.StartCheck();
            }

            ChangeFlow(CheckFlow.HardWareSupport);
            StartCoroutine(RunPerformanceCheck());
        }
    }
Ejemplo n.º 34
0
 public static void CleanInstance()
 {
     m_instance = null;
 }
Ejemplo n.º 35
0
    private void InitData()
    {
        Camera m_Camera = Camera.main;

        flowShareData.shareCamera      = m_Camera;
        RenderSettings.ambientMode     = UnityEngine.Rendering.AmbientMode.Flat;
        RenderSettings.ambientSkyColor = Color.white;
        //int ScreenPixels = Mathf.FloorToInt(Screen.width * Screen.height / 4f);
        //float[] ScreenWidthPoints = new float[ScreenPixels];
        //float[] ScreenHeightPoints = new float[ScreenPixels];
        //for (int i = 0; i < ScreenPixels; i++)
        //{
        //    ScreenWidthPoints[i] = HaltonSequence(i, 2);
        //    ScreenHeightPoints[i] = HaltonSequence(i, 3);
        //}

        int posIndex = 0;
        int cout     = flowShareData.OpaqueModelList.Count;

        for (int i = 0; i < cout; i++)
        {
            MeshRenderer re = flowShareData.OpaqueModelList[i];

            string shaderName = OpaqueShaderArray[i % OpaqueShaderArray.Length];
            if (shaderName.Contains("LightingMap"))
            {
                re.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off;
            }
            Material mat = new Material(re.sharedMaterial);
            mat.shader = AssetBundleManager.GetShader(shaderName);
            mat.color  = new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f));
            mat.SetColor("_EmissionColor", re.material.color);
            re.sharedMaterial = mat;
            Vector3 pos = Vector3.zero;
            pos.x = 0.5f;
            pos.y = 0.5f;
            pos.z = Random.Range(m_Camera.nearClipPlane + 15, m_Camera.nearClipPlane + 100);

            re.transform.position = m_Camera.ViewportToWorldPoint(pos);
        }
        posIndex += flowShareData.OpaqueModelList.Count;
        cout      = flowShareData.TransparentModelList.Count;

        for (int i = 0; i < cout; i++)
        {
            MeshRenderer re  = flowShareData.TransparentModelList[i];
            Material     mat = new Material(re.sharedMaterial);
            mat.shader = AssetBundleManager.GetShader(TransparentShaderArray[i % TransparentShaderArray.Length]);
            mat.color  = new Color(Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f), Random.Range(0.0f, 1.0f));
            mat.SetColor("_EmissionColor", re.material.color);
            re.sharedMaterial = mat;
            Vector3 pos = Vector3.zero;
            pos.x = 0.5f;
            pos.y = 0.5f;
            pos.z = Random.Range(m_Camera.nearClipPlane + 15, m_Camera.nearClipPlane + 100);
            re.transform.position = m_Camera.ViewportToWorldPoint(pos);
        }
        posIndex += flowShareData.TransparentModelList.Count;
        cout      = flowShareData.SkinnedMeshModelList.Count;

        cout = flowShareData.SkinnedObjList.Count;

        for (int i = 0; i < cout; i++)
        {
            Vector3 pos = Vector3.zero;
            pos.x = 0.5f;
            pos.y = 0.5f;
            pos.z = Random.Range(m_Camera.nearClipPlane + 15, m_Camera.nearClipPlane + 100);
            flowShareData.SkinnedObjList[i].transform.position = m_Camera.ViewportToWorldPoint(pos);
        }
    }
Ejemplo n.º 36
0
    private void OnGUI()
    {
        // 指定したアセットのダウンロード処理
        #region DOWNLOAD_ASSETBUNDLES
        if (GUILayout.Button("Download AssetBundles", GUILayout.MinWidth(256)))
        {
            // ダウンロード開始
            AssetBundleManager.DownloadAssetBundle(downloadAssetBundles, autoLoadAssetBundle, Downloading);
        }
        #endregion DOWNLOAD_ASSETBUNDLES


        // ダウンロードしたアセットのロード処理
        #region ASSETBUNDLE_LIST
        GUILayout.Label("Loaded AssetBundle List");
        List <string> bundleList = new List <string>();
        foreach (var bundle in AssetBundle.GetAllLoadedAssetBundles())
        {
            bundleList.Add(bundle.name);
        }
        if (bundleList.Count <= selGridInt)
        {
            selGridInt = bundleList.Count - 1;
        }
        selGridInt = GUILayout.SelectionGrid(selGridInt, bundleList.ToArray(), 2);
        #endregion ASSETBUNDLE_LIST


        // GameObjectのInstantiate
        #region PREFAB_INSTANTIATE
        GUILayout.Space(8);
        if (GUILayout.Button("Instantiate"))
        {
            // ロード処理
            string abName    = bundleList[selGridInt];
            string assetName = abName;
            if (assetName.Contains("/"))     // 子階層になっている場合
            {
                string[] n = assetName.Split('/');
                assetName = n[n.Length - 1];
            }
            else
            {
                assetName = abName;
            }
            GameObject go = AssetBundleManager.GetAsset <GameObject>(abName, assetName);

            // Instantiate
            InstantiateAsset(go);
        }
        #endregion PREFAB_INSTANTIATE


        // AssetBundleのUnload
        #region UNLOAD_ASSETBUNDLES
        if (GUILayout.Button("Unload"))
        {
            string name = bundleList[selGridInt];
            AssetBundleManager.Unload(name);
        }
        #endregion UNLOAD_ASSETBUNDLES

        // ログ
        #region OUTPUT_LOG
        GUILayout.Space(32);
        GUILayout.Box(output, GUILayout.Height(128));
        #endregion OUTPUT_LOG
    }