Пример #1
0
        private static bool OnToggle(UnityModManager.ModEntry modEntry, bool value)
        {
            if (Enabled == value)
            {
                return(true);
            }
            Enabled = value;

            if (Enabled)
            {
                Harmony = new Harmony(modEntry.Info.Id);
                Harmony.PatchAll(Assembly.GetExecutingAssembly());

                UserInterfaceHelper.CreateObjectDropperButton();
                UserInterfaceHelper.LoadUserInterface();

                PlayerController.Instance.StartCoroutine(AssetBundleHelper.LoadDefaultBundles());
                PlayerController.Instance.StartCoroutine(AssetBundleHelper.LoadUserBundles());
            }
            else
            {
                Harmony.UnpatchAll(Harmony.Id);
            }

            return(true);
        }
Пример #2
0
        private void AssetBundleLoadingHook(IAssetBundleLoadingContext context)
        {
            if (context.Parameters.LoadType != AssetBundleLoadType.LoadFromFile)
            {
                return;
            }

            var path = context.Parameters.Path;

            if (path == null)
            {
                return;
            }

            var abdataIndex = path.IndexOf("/abdata/");

            if (abdataIndex == -1)
            {
                return;
            }

            string bundle = path.Substring(abdataIndex).Replace("/abdata/", "");

            if (!File.Exists(path))
            {
                if (BundleManager.Bundles.TryGetValue(bundle, out List <LazyCustom <AssetBundle> > lazyList))
                {
                    context.Bundle      = lazyList[0].Instance;
                    context.Bundle.name = bundle;
                    context.Complete();
                }
                else
                {
                    //Create a placeholder asset bundle for png files without a matching asset bundle
                    if (IsPngFolderOnly(bundle))
                    {
                        context.Bundle      = AssetBundleHelper.CreateEmptyAssetBundle();
                        context.Bundle.name = bundle;
                        context.Complete();
                    }
                    //Placeholder for .csv excel data
                    else if (Lists.ExternalExcelData.ContainsKey(bundle))
                    {
                        context.Bundle      = AssetBundleHelper.CreateEmptyAssetBundle();
                        context.Bundle.name = bundle;
                        context.Complete();
                    }
                }
            }
            else
            {
                var ab = AssetBundle.LoadFromFile(context.Parameters.Path, context.Parameters.Crc, context.Parameters.Offset);
                if (ab != null)
                {
                    context.Bundle      = ab;
                    context.Bundle.name = bundle;
                    context.Complete();
                }
            }
        }
Пример #3
0
        // Register new prefabs
        private void RegisterPrefabs(object sender, EventArgs e)
        {
            var testdoorsBundle    = AssetBundleHelper.GetAssetBundleFromResources("testdoors");
            var testgate           = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/wood_gate 1.prefab");
            var testdoors          = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/wood_door 1.prefab");
            var testdoors2         = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/wood_door 2.prefab");
            var testirongate       = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/iron_grate 1.prefab");
            var testirongatebig    = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/iron_grate 2.prefab");
            var teststonewindow    = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/stone_arch 1.prefab");
            var teststonewindowbig = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/stone_arch 2.prefab");
            var teststonepillar    = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/stone_pillar 1.prefab");
            var surtlinglamp       = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/surtling_lamp.prefab");
            var surtlinglantern    = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/wood_lantern.prefab");
            var surtlinglantern2   = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/wood_lantern 1.prefab");
            var candle             = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/candle 1.prefab");
            var stonedoor          = testdoorsBundle.LoadAsset <GameObject>("Assets/CustomItems/stone_wall_door.prefab");

            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { testgate, "TestGate" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { testdoors, "TestDoors" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { testdoors2, "TestDoors2" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { testirongate, "TestIronGate" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { testirongatebig, "TestIronGateBig" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { teststonewindow, "TestStoneWindow" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { teststonewindowbig, "TestStoneWindowBig" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { teststonepillar, "TestStonePillar" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { surtlinglamp, "SurtlingLamp" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { surtlinglantern, "SurtlingLantern" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { surtlinglantern2, "SurtlingLantern2" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { candle, "Candle" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { stonedoor, "StoneDoor" });
        }
Пример #4
0
        private void Start()
        {
            if (!popoutPanel)
            {
                return;
            }

            var popoutController = popoutPanel.GetComponent <HGPopoutPanel>();

            popoutController.popoutPanelTitleText.token = LanguageTokens.IN_LOBBY_CONFIG_POPOUT_PANEL_NAME;
            popoutController.popoutPanelDescriptionText.transform.parent.gameObject.SetActive(false);

            var popoutChildLocator = popoutPanel.GetComponent <ChildLocator>();

            popoutChildLocator.FindChild("RandomButtonContainer")?.gameObject?.SetActive(false);

            var contentContainer = popoutController.popoutPanelContentContainer;

            DestroyImmediate(contentContainer.GetComponent <GridLayoutGroup>());

            var rectTransform = contentContainer.GetComponent <RectTransform>();

            rectTransform.sizeDelta = new Vector2(0, 700);
            rectTransform.anchorMin = new Vector2(0, 1);
            rectTransform.anchorMax = new Vector2(1, 1);
            rectTransform.pivot     = new Vector2(0.5F, 1);
            rectTransform.offsetMin = new Vector2();
            rectTransform.offsetMax = new Vector2();

            var layoutElement = contentContainer.gameObject.AddComponent <LayoutElement>();

            layoutElement.minHeight = 700;

            //If SLUI is loaded content container's height is limmited to 425px, changing it to 700
            if (InLobbyConfigPlugin.IsScrollableLobbyUILoaded)
            {
                ModifyIfSLUILoaded(contentContainer);
            }

            contentContainer.gameObject.AddComponent <RectMask2D>();

            scrollContent = Instantiate(AssetBundleHelper.LoadPrefab("ScrollContent"), contentContainer.transform);
            var scrollbar = Instantiate(AssetBundleHelper.LoadPrefab("ScrollBar"), contentContainer.transform);

            var scrollRect = contentContainer.gameObject.AddComponent <ScrollRect>();

            scrollRect.content                     = scrollContent.GetComponent <RectTransform>();
            scrollRect.movementType                = ScrollRect.MovementType.Clamped;
            scrollRect.horizontal                  = false;
            scrollRect.vertical                    = true;
            scrollRect.viewport                    = contentContainer;
            scrollRect.scrollSensitivity           = 30;
            scrollRect.verticalScrollbar           = scrollbar.GetComponent <Scrollbar>();
            scrollRect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHide;

            if (popoutPanel.activeSelf)
            {
                InitContent();
            }
        }
Пример #5
0
 public LoadAssetTask(string assetName, string bundleName, AssetBundleHelper helper, Action <bool, T> action)
 {
     mAssetName         = assetName;
     mBundleName        = bundleName;
     mCallback          = action;
     mAssetBundleHelper = helper;
 }
Пример #6
0
        private void RegisterPrefabs(object sender, EventArgs e)
        {
            var boar2Bundle = AssetBundleHelper.GetAssetBundleFromResources("boar2");
            var boar2       = boar2Bundle.LoadAsset <GameObject>("Assets/CustomItems/Boar2/Boar2.prefab");

            PrefabManager.Instance.RegisterPrefab(boar2, "Boar2");
        }
Пример #7
0
        private void InitContent()
        {
            if (initialized)
            {
                return;
            }

            foreach (var configEntry in ModConfigCatalog.ReadonlyList)
            {
                if (configEntry == null)
                {
                    InLobbyConfigPlugin.InstanceLogger.LogWarning($"Skipping over null ModConfigEntry");
                    continue;
                }
                if (configEntry.EnableField == null && (configEntry.SectionFields.Count == 0 || configEntry.SectionFields.All(row => row.Value.Count() == 0)))
                {
                    InLobbyConfigPlugin.InstanceLogger.LogWarning($"Skipping over `{configEntry.DisplayName}` because it has no fields assigned");
                    continue;
                }
                var modConfigInstance = Instantiate(AssetBundleHelper.LoadPrefab("ModConfigPrefab"), scrollContent.transform);
                if (!modConfigInstance)
                {
                    InLobbyConfigPlugin.InstanceLogger.LogWarning("Failed to instantiate `ModConfigPrefab`");
                    continue;
                }
                var configController = modConfigInstance.GetComponent <ModConfigController>();
                configController.configEntry = configEntry;
            }

            initialized = true;
        }
Пример #8
0
    // Use this for initialization
    IEnumerator Start()
    {
        // GameObject loadingEffect =GameObject.Instantiate(AssetDataDase.LoadAssetAtPath("Assets/Prefabs/myPrefab.prefab", typeof(GameObject)) as GameObject;
        //GameObject textObject = (GameObject)Instantiate(Resources.Load("RichTextUi_1"));
        //  GameObject instance = Instantiate(Resources.Load("RichTextUi_1", typeof(GameObject))) as GameObject;


        if (assetBundleName == null || assetBundleName == "")
        {
            //assetBundleName = "test_book";
            assetBundleName = "solar_system_book";
        }
        yield return(AssetBundleHelper.getInstance().InitializeAssetBunder(assetBundleName));

        try
        {
            //DebugOnScreen.Log("BookLoader Start assetBundleName=" + assetBundleName);
            BookSceneLoader sceneLoader = gameObject.AddComponent <BookSceneLoader>();
            sceneLoader.assetBundleName = assetBundleName;
            sceneLoader.sceneName       = "page1";
        }
        catch (System.Exception ex)
        {
            DebugOnScreen.Log(ex.ToString());
        }
    }
Пример #9
0
        public static void LoadUserInterface()
        {
            if (UIManager.Instance == null)
            {
                AssetBundleHelper.LoadUIBundle();

                UserInterface = Object.Instantiate(AssetBundleHelper.UIPrefab);
                Object.DontDestroyOnLoad(UserInterface);

                UserInterface.SetActive(false);

                UIManager.Instance.Player = PlayerController.Instance.inputController.player;

                ObjectMovementController.MovementUI = UserInterface.GetComponentInChildren <ObjectPlacementUI>(true);
                OptionsMenuController.OptionsMenu   = UserInterface.GetComponentInChildren <OptionsMenuUI>(true);
                LoadSavedController.LoadSavedUI     = UserInterface.GetComponentInChildren <LoadSavedUI>(true);
                SaveController.SaveUI = UserInterface.GetComponentInChildren <SaveUI>(true);
                ObjectSelectionController.ObjectSelection = UserInterface.GetComponentInChildren <ObjectSelectionUI>(true);
                QuickMenuController.QuickMenu             = UserInterface.GetComponentInChildren <QuickMenuUI>(true);
                ObjectEditController.ObjectEdit           = UserInterface.GetComponentInChildren <ObjectEditUI>(true);

                CustomPass = Object.Instantiate(AssetBundleHelper.CustomPassPrefab);
                Object.DontDestroyOnLoad(CustomPass);

                CustomPassVolume = CustomPass.GetComponent <CustomPassVolume>();
            }
        }
Пример #10
0
    static void FindNewBundle()
    {
        string originalBundlePath = AssetBundleHelper.GetOriginalBundlesPath().Replace("\\", "/") + "/";

        string[] files = Directory.GetFiles(PackageManager.GetAssetBundleDir(), "*", SearchOption.AllDirectories);

        int count = 0;

        for (int i = 0; i < files.Length; i++)
        {
            string filePath = files[i];
            if (filePath.EndsWith(".manifest"))
            {
                continue;
            }

            string relatePath = filePath.Replace("\\", "/").Replace(originalBundlePath, "");

            FileInfo file     = new FileInfo(filePath);
            TimeSpan nowSpan  = new TimeSpan(DateTime.Now.Ticks);
            TimeSpan lastSpan = new TimeSpan(file.LastWriteTime.Ticks);
            if (nowSpan.TotalMilliseconds - lastSpan.TotalMilliseconds < 1000 * 60 * _minutes)
            {
                count++;
                CopyFileToHotfix(file, relatePath);
            }
        }

        Debug.Log("FindNewBundle Count=>" + count);
    }
Пример #11
0
    // Use this for initialization
    IEnumerator Start()
    {
        if (Debug.isDebugBuild)
        {
            Debug.Log("BookLoaderScript Start assetBundleName=" + assetBundleName);
        }

        uiEventHandler = gameObject.GetComponent <UiEventHandler>();
        if (assetBundleName == null || assetBundleName == "")
        {
            //assetBundleName = "test_book";
            assetBundleName = "solar_system_book";
        }
        metadataAssetBundleName = assetBundleName + ".metadata";
        // Add DisplayTextUiController
        displayTextUiController = gameObject.AddComponent <DisplayTextUiController>();

        displayTextUiController.mainCanvas = mainCanvas;
        displayTextUiController.metadataAssetBundleName = metadataAssetBundleName;
        //end
        //DontDestroyOnLoad(gameObject);
        yield return(StartCoroutine(AssetBundleHelper.getInstance().InitializeAssetBunder(assetBundleName)));

        yield return(StartCoroutine(loadAssetBundleMetaData()));

        string jsonFileName = jsonSceneDataFileName + currentSceneIdx.ToString();

        yield return(StartCoroutine(loadSceneMetaData(jsonFileName)));

        //SceneInfo sceneInfo = new SceneInfo();
        //sceneInfo.name = "page1";
        // yield return StartCoroutine(LoadScence(sceneInfo));
        // Load level.
        //yield return StartCoroutine(InitializeLevelAsync("page1", true));
    }
Пример #12
0
 public override void Load()
 {
     base.Load();
     loadScreen.Show();
     loadScreen.SetTitle("Загрузка");
     loadScreen.StartCoroutine(AssetBundleHelper.GetAssetBundle(ModelId, value => OnGetAssetBundleCompleted(value)));
 }
Пример #13
0
 protected IEnumerator loadSceneMetaData(string jsonFileName)
 {
     if (!loadedSceneInfo.ContainsKey(jsonFileName))
     {
         yield return(AssetBundleHelper.getInstance().LoadAsset <TextAsset>(metadataAssetBundleName, jsonFileName, textAssetLoaded =>
         {
             if (Debug.isDebugBuild)
             {
                 Debug.Log("json string= " + textAssetLoaded.text);
             }
             currentScene = JsonUtility.FromJson <SceneInfo>(textAssetLoaded.text);
             loadedSceneInfo.Add(jsonFileName, currentScene);
             if (Debug.isDebugBuild)
             {
                 Debug.Log("Finished loading currentScene name= " + currentScene.name + ", title=" + currentScene.title + ", info= " + currentScene.info);
             }
         }));
     }
     else
     {
         currentScene = loadedSceneInfo[jsonFileName];
         if (Debug.isDebugBuild)
         {
             Debug.Log("Loaded from catch currentScene name= " + currentScene.name + ", title=" + currentScene.title + ", info= " + currentScene.info);
         }
     }
     yield return(StartCoroutine(LoadScence(currentScene)));
 }
Пример #14
0
    static void SwitchAssetDelteData()
    {
        string[] files = Directory.GetFiles(AssetBundleHelper.GetOuterStreamingAssetsPath(), "*.*",
                                            SearchOption.AllDirectories);
        foreach (var file in files)
        {
            string filePath = file.Replace("\\", "/");
            if (filePath.Contains("StreamingAssets/AssetBundles"))
            {
                continue;
            }

            File.Delete(filePath);
        }

        files = Directory.GetDirectories(AssetBundleHelper.GetOuterStreamingAssetsPath(), "*.*",
                                         SearchOption.AllDirectories);
        foreach (var file in files)
        {
            string filePath = file.Replace("\\", "/");
            if (filePath.Contains("StreamingAssets/AssetBundles") || Directory.Exists(filePath) == false)
            {
                continue;
            }

            Directory.Delete(filePath, true);
        }

        Debug.Log("<color='#00ff00'>删除StreamingAssets Other资源完成</color>");
    }
Пример #15
0
 private static void CleanIndexFiles()
 {
     if (Directory.Exists(AssetBundleHelper.GetOuterStreamingAssetsPath() + "/IndexFiles"))
     {
         Directory.Delete(AssetBundleHelper.GetOuterStreamingAssetsPath() + "/IndexFiles", true);
     }
 }
Пример #16
0
    // Use this for initialization

    IEnumerator Start()
    {
        GlobalVar.shareContext.loadingIndicator.SetActive(true);
        yield return(AssetBundleHelper.getInstance().LoadScene(assetBundleName, sceneName, true));

        DestroyObject(this);
        GlobalVar.shareContext.loadingIndicator.SetActive(false);
    }
Пример #17
0
 public static AssetBundleHelper getInstance()
 {
     if (_instance == null)
     {
         _instance = new AssetBundleHelper();
     }
     return(_instance);
 }
Пример #18
0
    private static void DownloadOriginalBundles()
    {
        CleanOriginalBundles();

        Stopwatch sw = Stopwatch.StartNew();

        FileUtil.CopyFolder(GetPackagePcRoot + "/" + Folder + "/OriginalBundles", AssetBundleHelper.GetOriginalBundlesPath(), ".manifest");
        Debug.LogWarning("复制OriginalBundles文件时间:" + sw.ElapsedMilliseconds / 1000.0f + "ms");
    }
Пример #19
0
 void OnDestroy()
 {
     if (Debug.isDebugBuild)
     {
         Debug.Log("BookLoaderScript  was destroyed <====================");
     }
     AssetBundleHelper.getInstance().unLoadAssetBundleManager();
     loadedSceneInfo.Clear();
 }
Пример #20
0
        private void RegisterPrefabs(object sender, EventArgs e)
        {
            var swordBlockBundle = AssetBundleHelper.GetAssetBundleFromResources("two");
            var cape1            = swordBlockBundle.LoadAsset <GameObject>("Assets/CustomItems/Two/Cape1.prefab");
            var cape2            = swordBlockBundle.LoadAsset <GameObject>("Assets/CustomItems/Two/Cape2.prefab");

            PrefabManager.Instance.RegisterPrefab(cape1, "Cape1");
            PrefabManager.Instance.RegisterPrefab(cape2, "Cape2");
        }
Пример #21
0
 /// <summary>
 /// Run all necessary startup functions.
 /// </summary>
 void InitialiseGame()
 {
     IOHelper.Initialize();
     AssetBundleHelper.InitializeAssetBundles();
     InitialiseConfigFile();
     //LocalizationManager.Instance.LoadLocalizedText(GameConfig.CurrentLanguage);
     AttributeHelper.InitializeAttributeDictionary();
     PathMeshGenerationTool.Initialize();
 }
Пример #22
0
        private void RegisterPrefabs(object sender, EventArgs e)
        {
            var boar2Bundle = AssetBundleHelper.GetAssetBundleFromResources("boar2");
            var boar2       = boar2Bundle.LoadAsset <GameObject>("Assets/CustomItems/Boar2/Boar2.prefab");

            // when this is fixed, the call should be:
            // PrefabManager.Instance.RegisterPrefab(swordBlock, "SwordBlock");
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { boar2, "Boar2" });
        }
Пример #23
0
    private static void CleanOriginalBundles()
    {
        string dir = AssetBundleHelper.GetOriginalBundlesPath();

        if (Directory.Exists(dir))
        {
            Directory.Delete(dir, true);
        }
    }
Пример #24
0
    public static void DeleteOuterStreamingAssets_AssetBundles()
    {
        if (Directory.Exists(AssetBundleHelper.GetOuterStreamingAssetsPath() + "/AssetBundles") == false)
        {
            return;
        }

        Directory.Delete(AssetBundleHelper.GetOuterStreamingAssetsPath() + "/AssetBundles", true);
        Debug.Log("<color='#00ff00'>删除StreamingAssets AssetBundles资源完成</color>");
    }
Пример #25
0
    // Use this for initialization
    IEnumerator Start()
    {
        Debug.Log("RUN PLATFORM WEBGL 1");
        // GameObject loadingEffect =GameObject.Instantiate(AssetDataDase.LoadAssetAtPath("Assets/Prefabs/myPrefab.prefab", typeof(GameObject)) as GameObject;
        //GameObject textObject = (GameObject)Instantiate(Resources.Load("RichTextUi_1"));
        //  GameObject instance = Instantiate(Resources.Load("RichTextUi_1", typeof(GameObject))) as GameObject;

        //Caching.CleanCache();
        if (assetBundleName == null || assetBundleName == "")
        {
            //assetBundleName = "test_book";
            assetBundleName = "solar_system_book";
        }
#if !UNITY_WEBGL
        // DebugOnScreen.Log("init mainfest 10");
        yield return(AssetBundleHelper.getInstance().InitializeAssetBunder(assetBundleName));

        try
        {
            //DebugOnScreen.Log("BookLoader Start assetBundleName=" + assetBundleName);
            BookSceneLoader sceneLoader = gameObject.AddComponent <BookSceneLoader>();
            sceneLoader.assetBundleName = assetBundleName;
            sceneLoader.sceneName       = "page1";
        }
        catch (System.Exception ex)
        {
            DebugOnScreen.Log(ex.ToString());
        }
#else
        /*
         *
         * homeButton.SetActive(false);
         * string url = Application.absoluteURL;
         * Dictionary<string, string> httpGetData=null;
         * if(url != null)
         * {
         *  httpGetData = parseHttpGetData(url);
         * }
         * string assetBundleUrl = "vn/books/science/230002_solar_system_book/";
         * assetBundleName = "solar_system_book";
         *      DebugOnScreen.Log("assetBundleUrl: " + assetBundleUrl);
         * if (httpGetData!=null && httpGetData.ContainsKey("assetBundleName")&& httpGetData.ContainsKey("assetBundleUrl"))
         * {
         *
         *  assetBundleName = httpGetData["assetBundleName"];
         *  assetBundleUrl = httpGetData["assetBundleUrl"];
         * DebugOnScreen.Log("getted assetBundleName=" + assetBundleName+ ", assetBundleUrl=" + assetBundleUrl);
         * }
         *      yield return AssetBundleHelper.getInstance().InitializeAssetBunderWebGL(assetBundleName, assetBundleUrl);
         */
        //DebugOnScreen.Log("RUN PLATFORM WEBGL 5");
        Debug.Log("RUN PLATFORM WEBGL 2");
        yield return(null);
#endif
    }
Пример #26
0
        private void RegisterPrefabs(object sender, EventArgs e)
        {
            var swordBlockBundle = AssetBundleHelper.GetAssetBundleFromResources("two");
            var cape1            = swordBlockBundle.LoadAsset <GameObject>("Assets/CustomItems/Two/Cape1.prefab");
            var cape2            = swordBlockBundle.LoadAsset <GameObject>("Assets/CustomItems/Two/Cape2.prefab");

            // when this is fixed, the call should be:
            // PrefabManager.Instance.RegisterPrefab(cape1, "Cape1");
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { cape1, "Cape1" });
            AccessTools.Method(typeof(PrefabManager), "RegisterPrefab", new Type[] { typeof(GameObject), typeof(string) }).Invoke(PrefabManager.Instance, new object[] { cape2, "Cape2" });
        }
Пример #27
0
        private void RegisterPrefabs(object sender, EventArgs e)
        {
            var magicBoxBundle = AssetBundleHelper.GetAssetBundleFromResources("magicbox");
            var magicBox       = magicBoxBundle.LoadAsset <GameObject>("Assets/CustomItems/MagicBox/piece_magic_box.prefab");

            // edit additional properties here

            PrefabManager.Instance.RegisterPrefab(magicBox, "MagicBox");

            PrefabManager.Instance.RegisterPrefab(new MagicArmor());
        }
Пример #28
0
        private static void AddPieces()
        {
            AssetBundle assetBundle = AssetBundleHelper.GetFromResources("signed_chest");

            lockers.Add(new BigWoodenLocker(assetBundle));
            lockers.Add(new SignedLocker(assetBundle));
            lockers.Add(new IronLocker(assetBundle));
            lockers.Add(new HiddenStoneLocker(assetBundle));

            assetBundle.Unload(false);
        }
Пример #29
0
    public static void FiltrateCoaxSleepAudio()
    {
        string needDeleteCoaxSleepAudioPath = AssetBundleHelper.NeedDeleteCoaxSleepAudioPath();

        //先把StreamingAssets下的资源删掉
        if (Directory.Exists(needDeleteCoaxSleepAudioPath))
        {
            UnityEditor.FileUtil.DeleteFileOrDirectory(needDeleteCoaxSleepAudioPath);
        }



        string originalBundlePath = AssetBundleHelper.GetOriginalBundlesPath().Replace("\\", "/") + "/";

        string outPathRoot = AssetBundleHelper.GetOutCoaxSleepAudioFolderPath();
        bool   isExists    = Directory.Exists(outPathRoot);

        if (isExists)
        {
            UnityEditor.FileUtil.DeleteFileOrDirectory(outPathRoot);
        }


        Directory.CreateDirectory(outPathRoot);


        //把OriginalBundles的资源拷贝出来
        string findPath = AssetBundleHelper.CopyCoaxSleepAudioPath();

        string[] files = Directory.GetFiles(findPath, "*", SearchOption.AllDirectories);


        for (int i = 0; i < files.Length; i++)
        {
            string filePath = files[i];
            if (filePath.EndsWith(".manifest"))
            {
                continue;
            }
            string relatePath = filePath.Replace("\\", "/").Replace(originalBundlePath, "");

            string destFile = outPathRoot + "/" + relatePath;
            var    fileInfo = new FileInfo(destFile);
            if (fileInfo.Directory.Exists == false)
            {
                fileInfo.Directory.Create();
            }
            File.Copy(filePath, destFile, true);
        }

        CreateCoaxSleepAudioJson(outPathRoot);
    }
Пример #30
0
 /// <summary>
 /// 读取一个资源,不需要加载依赖文件的使用该方法
 /// </summary>
 /// <param name="loadName"></param>
 /// <param name="suffixalName"></param>
 /// <param name="action"></param>
 public void GetObjWithParams(string loadName, string suffixalName, Action <AssetbundleParams> action)
 {
     StartCoroutine(AssetBundleHelper.LoadAssetObject("Devices", loadName, suffixalName, (obj) =>
     {
         if (action != null)
         {
             AssetbundleParams args = new AssetbundleParams();
             args.name = loadName;
             args.obj  = obj;
             action(args);
         }
     }));
 }