static void CopyAssetBundlesTo(string outputPath)
    {
        // Clear streaming assets folder.
        FileUtil.DeleteFileOrDirectory(Application.streamingAssetsPath);
        Directory.CreateDirectory(outputPath);

        string outputFolder = BaseLoader.GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget);

        // Setup the source folder for assetbundles.
        var source = Path.Combine(Path.Combine(System.Environment.CurrentDirectory, kAssetBundlesOutputPath), outputFolder);

        if (!System.IO.Directory.Exists(source))
        {
            Debug.Log("No assetBundle output folder, try to build the assetBundles first.");
        }

        // Setup the destination folder for assetbundles.
        var destination = System.IO.Path.Combine(outputPath, outputFolder);

        if (System.IO.Directory.Exists(destination))
        {
            FileUtil.DeleteFileOrDirectory(destination);
        }

        FileUtil.CopyFileOrDirectory(source, destination);
    }
Пример #2
0
 private void Load()
 {
     if (File.Exists(mFileName))
     {
         mUserClassDefinitions = BaseLoader <UserClassDefinitions> .Load(mFileName);
     }
 }
Пример #3
0
    // Start is called before the first frame update
    void Start()
    {
        BaseLoader loader = LoaderManager.Load(ELoaderType.ResourceLoader, "Cube");

        loader.onCompleted += (type, obj) =>
        {
            Instantiate <GameObject>(obj as GameObject);
        };

        loader              = LoaderManager.Load(ELoaderType.ResourceLoader, "Sphere");
        loader.onCompleted += (type, obj) =>
        {
            Instantiate <GameObject>(obj as GameObject);
        };

        for (int i = 0; i < 40; i++)
        {
            loader              = LoaderManager.Load(ELoaderType.ResourceLoader, "Cylinder");
            loader.onCompleted += (type, obj) =>
            {
                GameObject go = Instantiate <GameObject>(obj as GameObject);
                go.name = string.Format("Cylinder{0}", i);
            };
        }
    }
Пример #4
0
        private static void OnHEnd(BaseLoader baseLoader)
        {
            var proc  = baseLoader as HSceneProc;
            var flags = proc?.flags ?? GameObject.FindObjectOfType <HFlag>();

            foreach (var behaviour in _registeredHandlers)
            {
                try
                {
                    if (proc != null)
                    {
                        behaviour.Key.OnEndH(proc, flags.isFreeH);
                    }
                    behaviour.Key.OnEndH(baseLoader, flags, ReferenceEquals(proc, null));
                }
                catch (Exception e)
                {
                    KoikatuAPI.Logger.LogError(e);
                }
            }

            try
            {
                EndH?.Invoke(KoikatuAPI.Instance, EventArgs.Empty);
            }
            catch (Exception e)
            {
                KoikatuAPI.Logger.LogError(e);
            }

            InsideHScene = false;
        }
Пример #5
0
        private static IEnumerator OnHStart(BaseLoader baseLoader)
        {
            InsideHScene = true;
            yield return(null);

            var proc  = baseLoader as HSceneProc;
            var flags = proc?.flags ?? GameObject.FindObjectOfType <HFlag>();

            foreach (var behaviour in _registeredHandlers)
            {
                try
                {
                    if (proc != null)
                    {
                        behaviour.Key.OnStartH(proc, flags.isFreeH);
                    }
                    behaviour.Key.OnStartH(baseLoader, flags, ReferenceEquals(proc, null));
                }
                catch (Exception e)
                {
                    KoikatuAPI.Logger.LogError(e);
                }
            }

            try
            {
                StartH?.Invoke(KoikatuAPI.Instance, EventArgs.Empty);
            }
            catch (Exception e)
            {
                KoikatuAPI.Logger.LogError(e);
            }
        }
Пример #6
0
        public void LoadAssetBundleManifest()
        {
            assetBundleManifest = null;
            BaseLoader loader = BaseLoader.Init <AssetBundleManifestLoader> ("AssetBundleManifest");

            _listSelfLoader.Add(loader);
        }
Пример #7
0
        public void LoadAssetBundleCRC()
        {
            _dictAssetBundleCRC = null;
            BaseLoader loader = BaseLoader.Init <AssetBundleCRCLoader> ("AssetBundleCRC");

            _listSelfLoader.Add(loader);
        }
Пример #8
0
        public HintDatabasePage()
        {
            InitializeComponent();

            //load db
            mFilename = CoreGlobals.getWorkPaths().mGameDataDirectory + "\\concepts.xml";
            if (File.Exists(mFilename))
            {
                mDatabase = BaseLoader <ProtoConceptDatabase> .Load(mFilename);
            }

            mConceptEditor = propertyList1;
            //set metadata
            //mConceptEditor.SetTypeEditor("ProtoConcept", "MessageStringID", typeof(LocStringIDProperty));
            //mConceptEditor.AddMetaDataForProps("ProtoConcept", new string[] { "MessageStringID" }, "Compact", true);
            mConceptEditor.SetTypeEditor("ProtoConcept", "Prerequisites", typeof(TriggerPropConceptList2));
            mConceptEditor.AddMetaDataForProp("ProtoConcept", "Prerequisites", "StringIntSource", GetConceptEnumeration());
            mConceptEditor.AddMetaDataForProp("ProtoConcept", "Prerequisites", "AllowRepeats", false);
            mConceptEditor.AddMetaDataForProp("ProtoConcept", "Prerequisites", "AutoSort", true);

            mConceptEditor.AnyPropertyChanged += new ObjectEditorControl.PropertyChanged(mConceptEditor_AnyPropertyChanged);


            LoadUI();
        }
Пример #9
0
    public static void BuildAssetBundlesBatch()
    {
        // Choose the output path according to the build target.
        string outputPath = Path.Combine(kAssetBundlesOutputPath, BaseLoader.GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget));

        if (!Directory.Exists(outputPath))
        {
            Directory.CreateDirectory(outputPath);
        }

        string [] args = System.Environment.GetCommandLineArgs();
        Debug.Log("ARGS:" + args[9]);
        int startRatio = int.Parse(args[9]);
        int endRatio   = int.Parse(args[10]);

        string [] allAssetBundleNames = AssetDatabase.GetAllAssetBundleNames();
        int       counter             = allAssetBundleNames.Length * startRatio / 100;
        int       counter_end         = allAssetBundleNames.Length * endRatio / 100;

        Debug.Log("Build " + counter + "/" + allAssetBundleNames.Length + " -> " + (counter_end - 1) + "/" + allAssetBundleNames.Length);
        AssetBundleBuild[] buildMap = new AssetBundleBuild[counter_end - counter];
        int num = 0;

        for (int i = counter; i < counter_end; i++)
        {
            string abname = allAssetBundleNames[i];

            buildMap[num].assetBundleName = abname;
            buildMap[num].assetNames      = AssetDatabase.GetAssetPathsFromAssetBundle(abname);
            num++;
        }
        BuildPipeline.BuildAssetBundles(outputPath, buildMap, 0, EditorUserBuildSettings.activeBuildTarget);
    }
        internal static void HScene_PostStart(BaseLoader __instance)
        {
            hSceneProc         = __instance;
            hSceneProcTraverse = Traverse.Create(__instance);

            hSceneStarted = true;
            inHScene      = false;
        }
Пример #11
0
    public static void DeleteOldAsset()
    {
        string outputPath = Path.Combine(kAssetBundlesOutputPath, BaseLoader.GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget));

        if (Directory.Exists(outputPath))
        {
            Directory.Delete(outputPath, true);
        }
    }
Пример #12
0
        public bool RegisterRequestSet(string label, ResourceRequestSet resourceSet)
        {
            if (_dictRequestSet.ContainsKey(label) == true)
            {
                return(false);
            }

            foreach (var requestItem in resourceSet.GetList())
            {
                BaseLoader loader = null;
                if (_dictLoader.ContainsKey(requestItem.url) == true)
                {
                    continue;
                }

                ResourceItem resourceItem = null;
                switch (requestItem.type)
                {
                case ResourceType.Asset:
                    if (_dictResourceAsset.TryGetValue(requestItem.url, out resourceItem) == false)
                    {
                        loader = BaseLoader.Init <AssetLoader> (requestItem.url);
                    }
                    break;

                case ResourceType.AssetBundle:
                    if (_dictResourceAssetBundle.TryGetValue(requestItem.url, out resourceItem) == false)
                    {
                        loader = BaseLoader.Init <AssetBundleLoader> (requestItem.url);
                    }
                    break;

                case ResourceType.Texture:
                    if (_dictResourceTexture.TryGetValue(requestItem.url, out resourceItem) == false)
                    {
                        loader = BaseLoader.Init <TextureLoader> (requestItem.url);
                    }
                    break;

                default:
                    Debug.LogErrorFormat("{0} {1} NotFound {2}", typeof(ResourceManager).Name, MethodBase.GetCurrentMethod().Name, requestItem.type);
                    break;
                }

                if (resourceItem != null)
                {
                    resourceItem.IncRef();
                }
                if (loader != null)
                {
                    _dictLoader.Add(requestItem.url, loader);
                }
            }
            _dictRequestSet.Add(label, resourceSet);
            return(true);
        }
Пример #13
0
        /// <summary>
        /// Constructor sets the defaults.
        /// </summary>
        public ClientDependencyLoader()
        {
            Paths = new ClientDependencyPathCollection();

            _base = new BaseLoader(new HttpContextWrapper(Context))
            {
                //by default the provider is the default provider
                Provider = ClientDependencySettings.Instance.DefaultFileRegistrationProvider
            };
        }
Пример #14
0
 public static void SetRepogitory(string _url)
 {
     PatchURL = _url;
             #if UNITY_EDITOR
     PatchURL = PatchURL + BaseLoader.GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget) + "/";
             #else
     PatchURL = PatchURL + BaseLoader.GetPlatformFolderForAssetBundles(Application.platform) + "/";
             #endif
     AssetBundleManager.BaseDownloadingURL = PatchURL + CommonPatcherData.lastVersionRepo + "/";
 }
Пример #15
0
    //加载流程中有 asset 加载完毕
    public void OnLoadAssetFinish(BaseLoader loader)
    {
        //AssetLoader assetLoader = (AssetLoader)loader;

        //AssetCache cache = new AssetCache();
        //cache.path = assetLoader.path;
        //cache.asset = assetLoader.asset;
        //cache.finishLoadCallback = assetLoader.finishLoadCallback;

        //EventManager.Broadcast((int)GameEvent.LoadAssetTaskFinish, cache);
    }
    public static void BuildAssetBundles()
    {
        // Choose the output path according to the build target.
        string outputPath = Path.Combine(kAssetBundlesOutputPath, BaseLoader.GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget));

        if (!Directory.Exists(outputPath))
        {
            Directory.CreateDirectory(outputPath);
        }

        BuildPipeline.BuildAssetBundles(outputPath, 0, EditorUserBuildSettings.activeBuildTarget);
    }
Пример #17
0
    //加载流程中有 ab 加载完毕
    public void OnLoadABFinish(BaseLoader loader)
    {
        //AssetBundleLoader abLoader = (AssetBundleLoader)loader;

        //AssetBundleCache cache = new AssetBundleCache();
        //cache.path = abLoader.path;
        //cache.assetBundle = abLoader.assetBundle;
        //cache.finishLoadCallback = abLoader.finishLoadCallback;
        //cache.refCount = abLoader.refCount;

        //EventManager.Broadcast((int)GameEvent.LoadABTaskFinish, cache);
    }
Пример #18
0
    void Awake()
    {
        if (Instance != null)
        {
            GameObject.Destroy(Instance.gameObject);
        }

        Instance = this;

        // Don't destroy the game object as we base on it to run the loading script.
        DontDestroyOnLoad(gameObject);
    }
Пример #19
0
    public static void BuildAssetBundles()
    {
        string outputPath = Path.Combine(kAssetBundlesOutputPath, BaseLoader.GetPlatformFolderForAssetBundles(EditorUserBuildSettings.activeBuildTarget));

        if (!Directory.Exists(outputPath))
        {
            Directory.CreateDirectory(outputPath);
        }

        BuildPipeline.BuildAssetBundles(outputPath, 0, EditorUserBuildSettings.activeBuildTarget);
        Md5MenuItems.GenMd5();
    }
Пример #20
0
 private void CollectAssetFromLoader(BaseLoader loader)
 {
     if (loader is AssetBundleLoader)
     {
         if (_dictResourceAssetBundle.ContainsKey(loader.path) == true)
         {
             return;
         }
         AssetBundleLoader assetBundleLoader = loader as AssetBundleLoader;
         if (assetBundleLoader.asset != null)
         {
             _dictResourceAssetBundle.Add(loader.path, new ResourceItem(assetBundleLoader.asset));
         }
         foreach (var sub in assetBundleLoader.assetDependencies)
         {
             if (sub.asset != null)
             {
                 _dictResourceAsset.Add(sub.path, new ResourceItem(sub.asset));
             }
         }
     }
     else if (loader is AssetBundleManifestLoader)
     {
         assetBundleManifest = ((AssetBundleManifestLoader)loader).assetBundleManifest;
     }
     else if (loader is AssetBundleCRCLoader)
     {
         _dictAssetBundleCRC = ((AssetBundleCRCLoader)loader).crcDict;
     }
     else if (loader is TextureLoader)
     {
         if (_dictResourceTexture.ContainsKey(loader.path) == true)
         {
             return;
         }
         ResourceItem r = new ResourceItem(((TextureLoader)loader).texture);
         _dictResourceTexture.Add(loader.path, r);
     }
     else if (loader is AssetLoader)
     {
         if (_dictResourceAsset.ContainsKey(loader.path) == true)
         {
             return;
         }
         ResourceItem r = new ResourceItem(((AssetLoader)loader).asset);
         _dictResourceAsset.Add(loader.path, r);
     }
     else
     {
         Debug.LogErrorFormat("Loader Error {0}", loader.GetType());
     }
 }
Пример #21
0
        protected override void OnEndH(BaseLoader proc, HFlag hFlag, bool vr)
        {
            InsideHScene = false;
            Destroy(proc.GetComponent <LactationController>());

            // Figure out if conception happened at end of h scene
            // bug Don't know which character is which
            if (hFlag.mode == HFlag.EMode.houshi3P || hFlag.mode == HFlag.EMode.sonyu3P)
            {
                return;
            }

            var heroine        = hFlag.lstHeroine.First(x => x != null);
            var isDangerousDay = HFlag.GetMenstruation(heroine.MenstruationDay) == HFlag.MenstruationType.危険日;

            if (!isDangerousDay)
            {
                return;
            }

            var cameInside     = PregnancyPlugin.ConceptionEnabled.Value && hFlag.count.sonyuInside > 0;
            var cameInsideAnal = PregnancyPlugin.AnalConceptionEnabled.Value && hFlag.count.sonyuAnalInside > 0;

            if (cameInside || cameInsideAnal)
            {
                var controller = heroine.chaCtrl.GetComponent <PregnancyCharaController>();
                if (controller == null)
                {
                    throw new ArgumentNullException(nameof(controller));
                }

                //Allow pregnancy if enabled, or overridden, and is not currently pregnant
                if (!controller.Data.GameplayEnabled || controller.Data.IsPregnant)
                {
                    return;
                }

                var fertility = Mathf.Max(PregnancyPlugin.FertilityOverride.Value, controller.Data.Fertility);

                var winThreshold = Mathf.RoundToInt(fertility * 100);
                var childLottery = Random.Range(1, 100);
                //Logger.Log(LogLevel.Debug, $"Preg - OnEndH calc pregnancy chance {childLottery} to {winThreshold}");
                var wonAChild = winThreshold >= childLottery;
                if (wonAChild)
                {
                    //Logger.Log(LogLevel.Debug, "Preg - child lottery won, pregnancy will start");
                    StartPregnancy(heroine);
                }
            }
        }
Пример #22
0
        //public void SetUserClasses(List<UserClassDefinition> userClasses)
        //{
        //   mUserClassDefinitions = userClasses;// new List<UserClassDefinition>();
        //   LoadUI();
        //}
        private void Load()
        {
            if (File.Exists(mFileName))
            {
                mUserClassDefinitions = BaseLoader <UserClassDefinitions> .Load(mFileName);

                TriggerSystemMain.mTriggerDefinitions.mUserClassDefinitions = mUserClassDefinitions;
                LoadUI();
            }
            else
            {
                mUserClassDefinitions = new UserClassDefinitions();
            }
        }
Пример #23
0
    public override void OnLoadFinish(BaseLoader loader)
    {
        var assetBundleLoader = (AssetBundleLoader)loader;
        ////Logx.Logz("AssetBundleLoadProcess OnLoadFinish : " + assetBundleLoader.path);
      
        //通知 正在准备的所有 loader 在这里指的是正在等依赖加载的 loader
        for (int i = 0; i < this.preparingList.Count; i++)
        {
            var prepareLoader = (AssetBundleLoader)this.preparingList[i];
            prepareLoader.OnLoadOtherABFinish(assetBundleLoader.path);
        }

        abLoaderDic.Remove(assetBundleLoader.path);
        base.OnLoadFinish(loader);
    }
Пример #24
0
        public bool Contains(string path, ResourceType type)
        {
            if (IsLoadedExist(path, type) == true)
            {
                return(true);
            }

            BaseLoader loader = null;

            if (_dictLoader.TryGetValue(path, out loader) == true)
            {
                return(true);
            }

            return(loader.Contains(path));
        }
Пример #25
0
        /// <summary>
        /// Typically not used, but it is possible to create a <see ref="ShopifyClient">ShopifyClient </see> by passing an instance
        /// that implements <see ref="BaseLoader">BaseLoader </see>. <see ref="BaseLoader">BaseLoaders </see> handle network communicationication with
        /// the Storefront API. This functionality is useful if you'd like to use the Shopify SDK for Unity in a C# environment
        /// outside of Unity. The <c>domain</c> string used to access specific initialized clients is inferred from
        /// <see ref="BaseLoader">BaseLoader.Domain</see> which can be used to request a specific client.
        /// </summary>
        /// <param name="loader">a loader which will handle network communicationication with the Storefront API</param>
        /// \code
        /// // Mock example using a custom loader for another C# platform
        /// string accessToken = "b8d417759a62f7b342f3735dbe86b322";
        /// string shopDomain = "unity-buy-sdk.myshopify.com";
        ///
        /// CustomLoaderForNonUnityPlatform loader = new CustomLoaderForNonUnityPlatform(accessToken, shopDomain);
        ///
        /// // Init only needs to be called once
        /// ShopifyBuy.Init(loader);
        /// \endcode
        public static ShopifyClient Init(BaseLoader loader)
        {
            string domain = loader.Domain;

            if (!ClientByDomain.ContainsKey(domain))
            {
                ClientByDomain[domain] = new ShopifyClient(loader);

                if (DefaultClient == null)
                {
                    DefaultClient = ClientByDomain[domain];
                }
            }

            return(ClientByDomain[domain]);
        }
Пример #26
0
        /// <summary>
        /// Download large file request
        /// </summary>
        /// <param name="uris"></param>
        /// <param name="downLoadPath">Local download path</param>
        /// <param name="onLoadingUpdate"></param>
        /// <param name="loader">Text, to show progress</param>
        /// <param name="stringFormat">String format for progress {0}:File name {1}:Downloaded bytes {2}: File length</param>
        public RequestDownLoad(List <string> uris, string downLoadPath, LoaderAdapter.ProgressUpdate onLoadingUpdate,
                               BaseLoader loader = null, string stringFormat = null)
        {
            Uri              = uris.ToString();
            _uris            = uris;
            _loader          = loader;
            _stringFormat    = stringFormat;
            _downLoadPath    = downLoadPath;
            _onLoadingUpdate = onLoadingUpdate;
            OnUpdate        += Update;

            Response = new ResponseDownLoad
            {
                LocalFilesPathes = new List <string>(), DownLoadedData = new Dictionary <string, List <byte> >()
            };
            RequestManager.AddRequest(this);
        }
Пример #27
0
        public RequestDownLoad(string uri, string downLoadPath, BaseLoader loader = null,
                               string stringFormat = null)
        {
            Uri   = uri;
            _uris = new List <string> {
                uri
            };
            _loader       = loader;
            _stringFormat = stringFormat;
            _downLoadPath = downLoadPath;
            OnUpdate     += Update;

            Response = new ResponseDownLoad
            {
                LocalFilesPathes = new List <string>(), DownLoadedData = new Dictionary <string, List <byte> >()
            };
            RequestManager.AddRequest(this);
        }
Пример #28
0
    private BaseLoader GetLoader(Def.ModulesType type)
    {
        BaseLoader loader = null;

#if UNITY_EDITOR
        if (Main.Inst.UseABLoad)
        {
            loader = new AssetBundleLoader(type);
        }
        else
        {
            loader = new EditorLoader(type);
        }
#else
        loader = new AssetBundleLoader(type);
#endif
        return(loader);
    }
Пример #29
0
        private bool IsCompleteLoader(BaseLoader loader)
        {
            if (loader.isComplete == false)
            {
                return(false);
            }

            if (loader.isSuccessed == true)
            {
                CollectAssetFromLoader(loader);
            }
            else
            {
                Debug.LogError("Error");
            }

            return(true);
        }
Пример #30
0
    // Use this for initialization
    void Start()
    {
        scenarioDetails = new List <ScenarioDetail>();

        scenesFolderPath = Path.Combine(Path.Combine("AssetBundles", BaseLoader.GetPlatformFolderForAssetBundles(Application.platform)), "scenario");

        sceneBundlePaths = Directory.GetFiles(Path.Combine(Application.streamingAssetsPath, scenesFolderPath))
                           .Where(file => file.Substring(file.Length - 8) != "manifest" && file.Substring(file.Length - 4) != "meta").ToList();

        int i = 0;

        foreach (var sceneBundlePath in sceneBundlePaths)
        {
            var sceneListItem = (GameObject)Instantiate(listItemPrefab, transform, false);

            var path = sceneBundlePath.Replace('\\', '/').Split('/');

            var sceneName = path[path.Length - 1];

            var detail = ScenarioParser.ParseScenario(sceneName);

            sceneListItem.transform.Find("Text").GetComponent <Text>().text = detail.Phobia + " : " + detail.Name;

            scenarioDetails.Add(detail);

            //The first scene is selected by default
            if (i == 0)
            {
                selectedSceneName = sceneName;
            }

            int currentIndex = i;
            sceneListItem.GetComponent <Button>().onClick.AddListener(() => {
                selectedSceneName = sceneName;
                detailPanel.ShowScenarioDetail(scenarioDetails[currentIndex]);
            });
            i++;
        }

        if (scenarioDetails.Count > 0)
        {
            detailPanel.ShowScenarioDetail(scenarioDetails[0]);
        }
    }