/// <summary> /// 开始加载 /// </summary> private IEnumerator Load(LoadRequest request) { Texture2D[] textures = new Texture2D[m_FilePathStrs.Length]; for (int i = 0; i < m_FilePathStrs.Length; i++) { var file = string.Format(m_FilePathStrs[i], request.PageX >> request.MipLevel, request.PageY >> request.MipLevel, request.MipLevel); var www = UnityWebRequestTexture.GetTexture(file); yield return(www.SendWebRequest()); if (!www.isNetworkError && !www.isHttpError) { textures[i] = ((DownloadHandlerTexture)www.downloadHandler).texture; Stat.TotalDownladSize += (float)www.downloadedBytes / 1024.0f / 1024.0f; } else { Debug.LogWarningFormat("Load file({0}) failed: {1}", file, www.error); Stat.TotalFailCount++; } } m_RuningRequests.Remove(request); OnLoadComplete?.Invoke(request, textures); }
public void LoadExcelDataToJsonFile() { if (!File.Exists(spreadSheetDocumentPath)) { throw new FileNotFoundException("spread sheet file cannot be found."); } EmployeeJsonSerializer.ClearJsonFilesContent(); var oledbParser = new OleDbParser(spreadSheetDocumentPath); var emps = oledbParser.GetSheetData("Emps_Info"); var slips = oledbParser.GetSheetData("Slips"); var advances = oledbParser.GetSheetData("CashAdvances"); var transfers = oledbParser.GetSheetData("Transfers"); var misc = oledbParser.GetSheetData("Miscellaneous"); LoadObjectToJson <EmployeeInfo>(emps); OnLoadPercentageChanged?.Invoke(30); LoadObjectToJson <Slip>(slips); OnLoadPercentageChanged?.Invoke(40); LoadObjectToJson <EmpCashAdvances>(advances); OnLoadPercentageChanged?.Invoke(50); LoadObjectToJson <EmpTransfers>(transfers); OnLoadPercentageChanged?.Invoke(70); LoadObjectToJson <EmpMiscellaneous>(misc); OnLoadPercentageChanged?.Invoke(100); OnLoadComplete?.Invoke(); }
public void LoadData() { var str = isPersistent ? KeychainAccess.GetKeychainString() : PlayerPrefs.GetString("SaveSystem.LocalSave"); if (string.IsNullOrEmpty(str)) { Debug.Log("No save found. Creating first save."); SetupInitialValues(); SaveData(); return; } var buffer = Convert.FromBase64String(str); Stream binaryStream = new MemoryStream(buffer); var reader = new BinaryReader(binaryStream); foreach (ISavable savable in savablesList) { savable.Load(reader); } reader.Close(); OnLoadComplete?.Invoke(); }
public void Load() { foreach (GameObject prefab in prefabLevels) { GameObject levelObject = Instantiate(prefab); levelObject.SetActive(false); levelObject.transform.SetParent(transform); levelObject.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity); levelObject.GetComponent <LevelMap>().Load(gameData.cellSize); levelObjects.Add(levelObject); } OnLoadComplete?.Invoke(); }
/// <summary> /// Set the status and error of the asset, this is used internally by RetroBlit during asset loading. /// </summary> /// <param name="newStatus">New status code</param> /// <param name="newError">New error code</param> public void InternalSetErrorStatus(RB.AssetStatus newStatus, RB.Result newError) { if ((newStatus == RB.AssetStatus.Ready || newStatus == RB.AssetStatus.Failed) && (mStatus != RB.AssetStatus.Ready && mStatus != RB.AssetStatus.Failed)) { mStatus = newStatus; mError = newError; if (OnLoadComplete != null) { OnLoadComplete.Invoke(this, null); } } mStatus = newStatus; mError = newError; }
private void LoadComplete() { gameObjectFactory.OnLoadComplete -= LoadComplete; OnLoadComplete?.Invoke(); }
public void Load() { Transform pParent = transform; // Prefabs for (int i = 0; i < 100; ++i) { // tree GameObject goTree = Instantiate(prefabTree); TreeHandler treeHandler = goTree.GetComponent <TreeHandler>(); treeHandler.Load(pParent); treeObjectPool.Enqueue(goTree); // stone GameObject goStone = Instantiate(prefabStone); StoneHandler stoneHandler = goStone.GetComponent <StoneHandler>(); stoneHandler.Load(pParent); stoneObjectPool.Enqueue(goStone); // food GameObject goFood = Instantiate(prefabFood); FoodHandler foodHandler = goFood.GetComponent <FoodHandler>(); foodHandler.Load(pParent); foodObjectPool.Enqueue(goFood); } // Preloads PlayController pc = PlayController.main; BuildingsHandler buildingsHandler = buildingsHandlerObject.GetComponent <BuildingsHandler>(); buildingsHandler.Load(); // houses BuildingClicker houseClicker = houseSmallClickerObject.GetComponent <BuildingClicker>(); houseClicker.Load(pc.gameData.houseSmallResourceCost); houseClicker = houseMediumClickerObject.GetComponent <BuildingClicker>(); houseClicker.Load(pc.gameData.houseMediumResourceCost); houseClicker = houseLargeClickerObject.GetComponent <BuildingClicker>(); houseClicker.Load(pc.gameData.houseLargeResourceCost); // resources BuildingClicker satisfactionClicker = farmClickerObject.GetComponent <BuildingClicker>(); satisfactionClicker.Load(pc.gameData.farmResourceCost); BuildingClicker resourceClicker = foresterClickerObject.GetComponent <BuildingClicker>(); resourceClicker.Load(pc.gameData.foresterResourceCost); resourceClicker = quarryClickerObject.GetComponent <BuildingClicker>(); resourceClicker.Load(pc.gameData.quarryResourceCost); // satisfaction resourceClicker = cemeteryClickerObject.GetComponent <BuildingClicker>(); resourceClicker.Load(pc.gameData.cemeteryResourceCost); satisfactionClicker = clinicClickerObject.GetComponent <BuildingClicker>(); satisfactionClicker.Load(pc.gameData.clinicResourceCost); satisfactionClicker = tavernClickerObject.GetComponent <BuildingClicker>(); satisfactionClicker.Load(pc.gameData.tavernResourceCost); OnLoadComplete?.Invoke(); }
/// <summary> /// invoked when the <see cref="UiElement"/> has finished its transition load /// </summary> /// <param name="uiElement">the loaded menu</param> public void InvokeLoadComplete(UiElement uiElement) { OnLoadComplete?.Invoke(uiElement); }