public override void Initialize(AssetHelper assets) { if (isPartOfStaticBatch) { return; } filter = (MeshFilter)GetComponent(typeof(MeshFilter)); Material[] mats = materials; if (mats.HasElements()) { mats = mats.Where(m => m != null).ToArray(); } if (filter.meshToRender != null && mats.HasElements()) { bounds = filter.meshToRender.bounds; if (!ApplicationSettings.UseFallbackRendering) { // TODO: The thought is that this can actually be done at compile time so the initialization will occur at runtime renderItems = new RenderItem[mats.Length]; for (int i = 0; i < mats.Length; i++) { RenderItem item = RenderItem.Create(mats[i], filter.meshToRender, i, transform); item.Initialize(Camera.Device); renderItems[i] = item; } } } }
internal void LoadAsset(AssetHelper assetHelper) { if (!_isLoaded) { DoLoadAsset(assetHelper); _isLoaded = true; } }
internal static void LoadLayerNames(AssetHelper helper) { if (layerNames == null) { helper.AddStaticAsset("LayerNames"); layerNames = new List<string>(); string[] names = helper.Load<String[]>("LayerNames"); if (names != null) { layerNames.AddRange(names); } } }
private static void LoadAssetBundle() { QuickLogger.Debug("GetPrefabs"); AssetBundle assetBundle = AssetHelper.Asset($"FCS_MarineTurbine", "aimarineturbinemodbundle"); //If the result is null return false. if (assetBundle == null) { QuickLogger.Error($"AssetBundle is Null!"); throw new FileLoadException(); } Bundle = assetBundle; }
public AssetTypeValueField GetMonoBaseField(AssetContainer cont, string managedPath) { var file = cont.FileInstance.file; var item = cont.Item; var baseTemp = new AssetTypeTemplateField(); baseTemp.FromClassDatabase(Am.classFile, AssetHelper.FindAssetClassByID(Am.classFile, item.TypeID), 0); var mainAti = new AssetTypeInstance(baseTemp, cont.FileReader, item.Position); var scriptIndex = item.MonoID; if (scriptIndex != 0xFFFF) { var monoScriptCont = GetAssetContainer(mainAti.GetBaseField().Get("m_Script")); if (monoScriptCont == null) { return(null); } var scriptBaseField = monoScriptCont.TypeInstance.GetBaseField(); var scriptName = scriptBaseField.Get("m_Name").GetValue().AsString(); var scriptNamespace = scriptBaseField.Get("m_Namespace").GetValue().AsString(); var assemblyName = scriptBaseField.Get("m_AssemblyName").GetValue().AsString(); var assemblyPath = Path.Combine(managedPath, assemblyName); if (scriptNamespace != string.Empty) { scriptName = scriptNamespace + "." + scriptName; } if (File.Exists(assemblyPath)) { if (!LoadedAssemblies.ContainsKey(assemblyName)) { LoadedAssemblies.Add(assemblyName, MonoDeserializer.GetAssemblyWithDependencies(assemblyPath)); } var asmDef = LoadedAssemblies[assemblyName]; var mc = new MonoDeserializer(); mc.Read(scriptName, asmDef, file.header.format); var monoTemplateFields = mc.children; var templateField = baseTemp.children.Concat(monoTemplateFields).ToArray(); baseTemp.children = templateField; baseTemp.childrenCount = baseTemp.children.Length; mainAti = new AssetTypeInstance(baseTemp, cont.FileReader, item.Position); } } return(mainAti.GetBaseField()); }
public ActionResult Create(SystemModel model, HttpPostedFileBase file) { if (AclHelper.hasAccess(User, currentAction, currentController)) { if (ModelState.IsValid) { model.Step = 2; model.System.CreatedDate = DateTime.Now; model.System.UpdatedDate = DateTime.Now; model.System.CurrentLocId = model.CurrentLocId; model.System.OriginLocId = model.OriginLocId; model.System.OwnedBy = model.OwnerId; model.System.DivId = model.DivId; model.System.OwnerShipId = model.OwnerShipId; model.System.Availability = model.Availability; ViewBag.Availability = new SelectList(db.rs_assetstatus, "StatusId", "Status"); string ownerShip = db.rs_ownership.Find(model.OwnerShipId).OwnerType; int divNo = db.rs_division.Find(model.DivId).DivisionNo; model.System.TrackingNo = AssetHelper.GenerateTrackingNo(ownerShip, divNo, model.System.IsSystem, model.System.PurchaseDate); if (AssetHelper.IsImage(file)) { file.SaveAs(HttpContext.Server.MapPath("~/AssetsImg/") + file.FileName); model.System.ImageLink = file.FileName; } db.rs_assets.Add(model.System); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OriginLocId = new SelectList(db.rs_locations, "LocationId", "LocationName", model.System.OriginLocId); ViewBag.CurrentLocId = new SelectList(db.rs_locations, "LocationId", "LocationName", model.System.CurrentLocId); ViewBag.OwnerId = new SelectList(db.rs_user, "UserId", "Username"); ViewBag.DivId = new SelectList(db.rs_division, "DivId", "DivisionNo"); ViewBag.OwnerShipId = new SelectList(db.rs_ownership, "OwnerShipId", "OwnerType"); ViewBag.Availability = new SelectList(db.rs_assetstatus, "StatusId", "Status"); return(View("Assets", model)); } else { return(RedirectToAction("NotAuthenticated", "Home")); } }
private static AnimatorOverrideController CreateAnimatorOverride(Sprite[] sprites, AnimationClip[] overrideClips) { var settings = DefaultAnimationsSettings.Instance; var animatorOverride = AssetHelper.GetAsset <AnimatorOverrideController>(sprites.GetSpritesheetName()); animatorOverride.runtimeAnimatorController = settings.AnimatorController; animatorOverride.ApplyOverrides( settings.AnimationsMapping.Select(m => m.ClipToOverride).ToArray(), overrideClips); animatorOverride.SaveAsset(); return(animatorOverride); }
public static void PatchSMLHelper() { if (!Singleton.GetPrefabs()) { throw new FileNotFoundException($"Failed to retrieve the {Singleton.FriendlyName} prefab from the asset bundle"); } Singleton.Patch(); string savedDataJson = File.ReadAllText(Path.Combine(AssetHelper.GetConfigFolder($"FCS_MarineTurbine"), $"{Singleton.ClassID}.json")).Trim(); JetStreamT242Config = JsonConvert.DeserializeObject <JetStreamT242Config>(savedDataJson); QuickLogger.Debug($"Biome Speeds Count {JetStreamT242Config.BiomeSpeeds.Count}"); }
private static void AddTechFabricatorItems() { if (AssetBundle == null) { QuickLogger.Debug("GetPrefabs"); AssetBundle = AssetHelper.Asset(Mod.ModName, Mod.BundleName); } var icon = ImageUtils.LoadSpriteFromFile(Path.Combine(Mod.GetAssetFolder(), $"{Mod.ModClassName}.png")); var craftingTab = new CraftingTab(Mod.ModTabID, Mod.ModFriendlyName, icon); var cucKit = new FCSKit(Mod.CyclopsUpgradeConsoleKitClassID, Mod.ModFriendlyName, craftingTab, Mod.CyclopsUpgradeConsoleIngredients); cucKit.Patch(FcTechFabricatorService.PublicAPI, FcAssetBundlesService.PublicAPI); }
/// <summary> /// Create a Sorted list of bootstrap engines from the data matrix /// </summary> /// <param name="logger">The logger.</param> /// <param name="cache">The cache.</param> /// <param name="nameSpace">The client namespace</param> /// <param name="properties">The properties, including the engine handle.</param> /// <param name="forecastCurve">The forecast rate curve.</param> /// <param name="discountCurve">The discount rate curve.</param> /// <param name="instruments">An array of instrument types.</param> /// <param name="rawVolatilityGrid">The raw grid used to build the engines. Assume that all volatility and strike values are 100x true</param> /// <returns></returns> private SortedList <decimal, CapVolatilityCurve> CreateCurves(ILogger logger, ICoreCache cache, string nameSpace, NamedValueSet properties, IRateCurve discountCurve, IRateCurve forecastCurve, String[] instruments, Decimal[] rawVolatilityGrid) { var clonedProperties = properties.Clone(); // Create engine var quotedAssetSet = AssetHelper.Parse(instruments, rawVolatilityGrid, null); var engines = new SortedList <decimal, CapVolatilityCurve>(); // Create a new ATM CapletBootstrap engine. The default decimal should be 0 var engine = new CapVolatilityCurve(logger, cache, nameSpace, clonedProperties, quotedAssetSet, discountCurve, forecastCurve, null, null); // Add engine engines.Add(0, engine); return(engines); }
private void BuildBundleContent(ref List <string> result, string fileUrl, AssetFile file, AssetToolUtils assetToolUtils) { foreach (AssetFileInfoEx info in file.fileInstance.table.assetFileInfo) { ClassDatabaseType type = AssetHelper.FindAssetClassByID(file.classDBFile, info.curFileType); if (type == null) { continue; } string typeName = type.name.GetString(file.classDBFile); if (typeName != "MonoBehaviour") { continue; } AssetTypeValueField baseField = AssetToolUtils.GetATI(file, info).GetBaseField(); List <AssetTypeValueField> targetFields = AssetToolUtils.GetFieldAtPath(file, baseField, configPath.Split(':')); if (targetFields.Count == 0) { continue; } if (!AssetToolUtils.IsMatchingPathConstraints(file, baseField, pathConstraints)) { continue; } Console.WriteLine("found " + targetFields.Count + " matches in mono-behaviour at path: " + configPath); foreach (AssetTypeValueField targetField in targetFields) { List <AssetTypeValueField> fileNameFields = AssetToolUtils.GetFieldAtPath(file, targetField, fileNamePath.Split(':')); Console.WriteLine("found " + fileNameFields.Count + " fileNameFields in targetField at path: " + fileNamePath); foreach (string value in fileNameFields .Select(fileNameField => fileNameField.GetValue().AsString().Trim()) .Where(fileName => CustomRegex.AllMatching(fileName, fileNameRegexFilters)) .SelectMany(fileName => ApplySubFilters(fileName, baseField, targetField, file, assetToolUtils))) { if (!result.Contains(value)) { result.Add(value); } } } } }
private static AssetFileInfoEx FindGameObject(AssetsManager am, AssetsFileInstance inst, string name) { foreach (AssetFileInfoEx info in inst.table.pAssetFileInfo) { if (info.curFileType == 0x01) { ClassDatabaseType type = AssetHelper.FindAssetClassByID(am.classFile, info.curFileType); string infoName = AssetHelper.GetAssetNameFast(inst.file, am.classFile, info); if (infoName == name) { return(info); } } } return(null); }
//[MenuItem("穿山甲/创建参数")] static void create() { var tp = AScriptableObject.Get <TPPama>(); if (!tp) { var m = AssetHelper.CreateAsset <TPPama>(); Debug.Log($"创建成功 保存至 Resouses/{m.filePath}"); } GradleHelper.CombineProguard(AssetDatabase.GUIDToAssetPath("6de1926d664a3435e9e357fd75876a60"), "TTSDK"); //AssetDatabase.Refresh(); //else //{ // Debug.Log($"文件已存在 Resouses/{tp.filePath}"); //} }
public SabGenerator(Minimap map) { sabDb = new Dictionary <SystemTypes, MapRoom>(); addedIds = new List <long>(); overlayObj = map.prefab.transform.FindChild("InfectedOverlay").gameObject; overlay = overlayObj.GetComponent <InfectedOverlay>(); overlay.rooms = new UnhollowerBaseLib.Il2CppReferenceArray <MapRoom>(0); //overlay.doors = ShipStatus.Instance.Systems[SystemTypes.Doors].Cast<IActivatable>(); commsBackup = BackupRoom("Comms", "bomb"); // um...BOMB!? reactorBackup = BackupRoom("Laboratory", "meltdown"); doorsBackup = BackupRoom("Office", "Doors"); lightsBackup = BackupRoom("Electrical", "lightsOut"); AssetHelper.ClearChildren(overlayObj.transform); }
public MyAssetsViewModel() { using (var uow = new UnitOfWork()) { User = uow.UserRepository.GetById(Logic.UserContext.Current.UserId); var assetHepler = new AssetHelper(User.Id); var assets = assetHepler.GetAssets(); Assets = new ObservableCollection <AssetViewModel>(assets); } AddTransactionCommand = new Microsoft.Practices.Prism.Commands.DelegateCommand <AssetViewModel>(OnAddTransactionClick); AddAssetCommand = new DelegateCommand(OnAddAsset); NavigateToTransactionList = new DelegateCommand <AssetViewModel>(OnNavigateToTransactionList); NavigateToDeleteTransaction = new Microsoft.Practices.Prism.Commands.DelegateCommand <AssetViewModel>(OnNavigateToDeleteTransaction); }
public static string GetTypeName(long id) { AssetsManager helper = AssetsManager; AssetsFileInstance correctAti = AssetsFileInstance; AssetFileInfoEx info = correctAti.table.GetAssetInfo(id); var assetClass = AssetHelper.FindAssetClassByID(helper.classFile, info.curFileType); if (assetClass != null) { return(assetClass.name.GetString(helper.classFile)); } else { return(""); } }
private void BuildZoneList() { var zoneList = AssetHelper.GetAssetList <Zone>(false, false); if (zoneList != _zoneList) { _zoneNames = new GUIContent[zoneList.Names.Length + 3]; _zoneList = zoneList; Array.Copy(zoneList.Names, 0, _zoneNames, 3, zoneList.Names.Length); _zoneNames[0] = _activeZoneOptionContent; _zoneNames[1] = _savedZoneOptionContent; _zoneNames[2] = new GUIContent(string.Empty); } }
public bool GetPrefabs() { try { QuickLogger.Debug($"AssetBundle Set"); QuickLogger.Debug("GetPrefabs"); AssetBundle assetBundle = AssetHelper.Asset(Mod.ModName, Mod.BundleName); //We have found the asset bundle and now we are going to continue by looking for the model. GameObject prefab = assetBundle.LoadAsset <GameObject>(Mod.PrefabName); //If the prefab isn't null lets add the shader to the materials if (prefab != null) { _prefab = prefab; //Lets apply the material shader ApplyShaders(prefab, assetBundle); QuickLogger.Debug($"{this.FriendlyName} Prefab Found!"); } else { QuickLogger.Error($"{this.FriendlyName} Prefab Not Found!"); return(false); } GameObject colorItem = QPatch.GlobalBundle.LoadAsset <GameObject>("ColorItem"); if (colorItem != null) { ColorItemPrefab = colorItem; } else { QuickLogger.Error($"Color Item Not Found!"); return(false); } return(true); } catch (Exception e) { QuickLogger.Error <Buildables.GaspodCollectorBuildable>(e.Message); return(false); } }
public static AssetTypeValueField GetMonoBaseFieldCached(this AssetsManager am, AssetsFileInstance inst, AssetFileInfoEx info, string managedPath, List <string> fileNames, Dictionary <AssetID, long> aidToPid) { AssetsFile file = inst.file; ushort scriptIndex = file.typeTree.unity5Types[info.curFileTypeOrIndex].scriptIndex; if (scriptIndex != 0xFFFF && inst.templateFieldCache.ContainsKey(scriptIndex)) { AssetTypeTemplateField baseTemplateField = inst.templateFieldCache[scriptIndex]; AssetTypeInstance baseAti = new AssetTypeInstance(baseTemplateField, file.reader, info.absoluteFilePos); return(baseAti.GetBaseField()); } else { AssetTypeTemplateField baseField = new AssetTypeTemplateField(); baseField.FromClassDatabase(am.classFile, AssetHelper.FindAssetClassByID(am.classFile, info.curFileType), 0); AssetTypeInstance mainAti = new AssetTypeInstance(baseField, file.reader, info.absoluteFilePos); if (file.typeTree.unity5Types[info.curFileTypeOrIndex].scriptIndex != 0xFFFF) { AssetTypeValueField m_Script = mainAti.GetBaseField().Get("m_Script"); int m_ScriptFileId = m_Script.Get("m_FileID").GetValue().AsInt(); long m_ScriptPathId = m_Script.Get("m_PathID").GetValue().AsInt64(); AssetID id = new AssetID(fileNames[-m_ScriptFileId], m_ScriptPathId); long m_ScriptRealPathId = aidToPid[id]; AssetTypeInstance scriptAti = am.GetExtAsset(inst, 0, m_ScriptRealPathId).instance; string scriptName = scriptAti.GetBaseField().Get("m_Name").GetValue().AsString(); string assemblyName = scriptAti.GetBaseField().Get("m_AssemblyName").GetValue().AsString(); string assemblyPath = Path.Combine(managedPath, assemblyName); Console.WriteLine("checking " + scriptName + " in " + assemblyName + " from id " + info.index); if (File.Exists(assemblyPath)) { MonoDeserializer mc = new MonoDeserializer(); mc.Read(scriptName, assemblyPath, inst.file.header.format); List <AssetTypeTemplateField> monoTemplateFields = mc.children; AssetTypeTemplateField[] templateField = baseField.children.Concat(monoTemplateFields).ToArray(); baseField.children = templateField; baseField.childrenCount = baseField.children.Length; mainAti = new AssetTypeInstance(baseField, file.reader, info.absoluteFilePos); } } AssetTypeValueField baseValueField = mainAti.GetBaseField(); inst.templateFieldCache[scriptIndex] = baseValueField.templateField; return(baseValueField); } }
// GET: Assets/Details/5 public ActionResult Details(int?id) { if (AclHelper.hasAccess(User, currentAction, currentController)) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ViewBag.OriginLocId = new SelectList(db.rs_locations, "LocationId", "LocationName"); ViewBag.CurrentLocId = new SelectList(db.rs_locations, "LocationId", "LocationName"); ViewBag.OwnerId = new SelectList(db.rs_user, "UserId", "Username"); ViewBag.DivId = new SelectList(db.rs_division, "DivId", "DivisionNo"); ViewBag.OwnerShipId = new SelectList(db.rs_ownership, "OwnerShipId", "OwnerType"); ViewBag.Availability = new SelectList(db.rs_assetstatus, "StatusId", "Status"); if (AclHelper.IsAdmin(User.Identity.Name)) { ViewBag.SubAssetId = new SelectList(db.rs_assets.Where(x => x.IsSystem == false), "AssetId", "Model"); } else { ViewBag.SubAssetId = new SelectList(db.rs_assets.Where(x => x.IsSystem == false && x.OwnedBy == AclHelper.GetUserId(User.Identity.Name)), "AssetId", "Model"); } SystemModel system = new SystemModel(); system = AssetHelper.GetSystemModel((int)id); if (system.System == null) { return(HttpNotFound()); } system.SystemId = system.System.AssetId; if (TempData["errorMessage"] != null) { TempData["Notification"] = NotificationHelper.Inform(TempData["errorMessage"].ToString()); TempData.Remove("errorMessage"); } system.Step = 3; return(View("Assets", system)); } else { return(RedirectToAction("NotAuthenticated", "Home")); } }
public static SceneLoaderState GetCurrentState() { var zonePath = ZonePreference.Value; var spawn = SpawnPreference.Value; var zoneType = ZoneTypePreference.Value; var state = new SceneLoaderState { Scenes = SceneHelper.CaptureState(), StartSpawn = spawn }; if (zoneType == LoadActiveZone) { var zone = FindZone(); if (zone == null) { var manager = FindWorldManager(); if (manager != null && manager.World != null) { zone = manager.World.Zones.Count > 0 ? manager.World.Zones[0] : null; } } if (zone != null) { state.SetZone(zone); } } else if (zoneType == LoadSpecificZone) { var zones = AssetHelper.ListAssets <Zone>(); var zone = GetZone(zones, zonePath); if (zone != null) { state.SetZone(zone); } } else { state.LoadWorld = zoneType == LoadSavedZone; } return(state); }
private void RecurseForResourcesInfo(FSDirectory dir, AssetsFileInstance afi) { foreach (FSAsset asset in dir.children.OfType <FSAsset>()) { AssetFileInfoEx info = afi.table.GetAssetInfo(asset.details.pointer.pathID); ClassDatabaseType type = AssetHelper.FindAssetClassByID(helper.classFile, info.curFileType); string typeName = type.name.GetString(helper.classFile); asset.details.type = typeName; asset.details.size = (int)info.curFileSize; asset.details.icon = GetIconForName(typeName); } foreach (FSDirectory directory in dir.children.OfType <FSDirectory>()) { RecurseForResourcesInfo(directory, afi); } }
public static AssetTypeValueField GetField(long id, out string className) { className = ""; string path = DirctoryPath; AssetsManager helper = AssetsManager; ClassDatabaseFile classFile = helper.classFile; AssetsFileInstance correctAti = AssetsFileInstance; AssetFileInfoEx info = correctAti.table.GetAssetInfo(id); if (info == null) { Console.WriteLine($"path_id:{id} is not found,maybe in other file"); return(null); } ClassDatabaseType classType = AssetHelper.FindAssetClassByID(classFile, info.curFileType); string typeName = classType.name.GetString(classFile); AssetTypeValueField baseField = helper.GetATI(correctAti.file, info).GetBaseField(); className = AssetHelper.FindAssetClassByID(helper.classFile, info.curFileType) .name.GetString(helper.classFile); AssetTypeValueField targetBaseField = baseField; if (className == "MonoBehaviour") { if (AssetUtils.AllDependenciesLoaded(helper, correctAti)) { className += $"--{GetClassName(helper, correctAti, targetBaseField)}--{targetBaseField[3].value.AsString().TrimEnd('\0')}--"; string managedPath = Path.Combine(Path.GetDirectoryName(correctAti.path), "Managed"); if (Directory.Exists(managedPath)) { targetBaseField = helper.GetMonoBaseFieldCached(correctAti, info, managedPath); } } else { MessageBox.Show("Can't display MonoBehaviour data until dependencies are loaded", "Assets View"); return(null); } } else { className += "--"; } return(targetBaseField); }
private AssetFileInfoEx FindGameObject(string name) { foreach (AssetFileInfoEx info in assetsTable.pAssetFileInfo) { //faster check for GameObject if (info.curFileType == 0x01) { ClassDatabaseType type = AssetHelper.FindAssetClassByID(am.classFile, info.curFileType); string infoName = UABEExtras.GetAssetNameFast(info, am.classFile, type, assetsFile.reader); if (infoName == name) { return(info); } } } return(null); }
public AssetTypeValueField GetConcatMonoBaseField(AssetContainer cont, string managedPath) { AssetsFile file = cont.FileInstance.file; AssetTypeTemplateField baseTemp = new AssetTypeTemplateField(); baseTemp.FromClassDatabase(am.classFile, AssetHelper.FindAssetClassByID(am.classFile, cont.ClassId), 0); AssetTypeInstance mainAti = new AssetTypeInstance(baseTemp, cont.FileReader, cont.FilePosition); ushort scriptIndex = cont.MonoId; if (scriptIndex != 0xFFFF) { AssetContainer monoScriptCont = GetAssetContainer(cont.FileInstance, mainAti.GetBaseField().Get("m_Script"), false); if (monoScriptCont == null) return null; AssetTypeValueField scriptBaseField = monoScriptCont.TypeInstance.GetBaseField(); string scriptName = scriptBaseField.Get("m_Name").GetValue().AsString(); string scriptNamespace = scriptBaseField.Get("m_Namespace").GetValue().AsString(); string assemblyName = scriptBaseField.Get("m_AssemblyName").GetValue().AsString(); string assemblyPath = Path.Combine(managedPath, assemblyName); if (scriptNamespace != string.Empty) scriptName = scriptNamespace + "." + scriptName; if (File.Exists(assemblyPath)) { AssemblyDefinition asmDef; if (!LoadedAssemblies.ContainsKey(assemblyName)) { LoadedAssemblies.Add(assemblyName, MonoDeserializer.GetAssemblyWithDependencies(assemblyPath)); } asmDef = LoadedAssemblies[assemblyName]; MonoDeserializer mc = new MonoDeserializer(); mc.Read(scriptName, asmDef, file.header.format); List<AssetTypeTemplateField> monoTemplateFields = mc.children; AssetTypeTemplateField[] templateField = baseTemp.children.Concat(monoTemplateFields).ToArray(); baseTemp.children = templateField; baseTemp.childrenCount = baseTemp.children.Length; mainAti = new AssetTypeInstance(baseTemp, cont.FileReader, cont.FilePosition); } } return mainAti.GetBaseField(); }
public IObservable <Unit> LoadAssetFromServer <TJson, TAsset>(TAsset asset, string behaviorName) { var url = new StringBuilder(); url.Append("http://oniongames.jp/test/api/danmaku_trial/"); url.Append(behaviorName); url.Append(".json"); return(DownloadText(url.ToString()) .ForEachAsync(text => { if (text != null) { Debug.Log("Download Succeeded"); var jsonAsset = JsonUtility.FromJson <TJson>(text); AssetHelper.Write(jsonAsset, asset); } })); }
private static BBI_Settings FindInstance() { BBI_Settings result; AssetHelper.LoadAsset(out result, BuildInfoPaths.Settings); if (!result) { AssetHelper.LoadAsset(out result, BuildInfoPaths.LegacySettings); } if (!result) { result = AssetHelper.FindAssetsOfType <BBI_Settings>().FirstOrDefault(); } return(result); }
/// <summary> /// Create a Sortedlist of volatility curves from the data matrix /// </summary> /// <param name="logger">The logger.</param> /// <param name="cache">The cache.</param> /// <param name="nameSpace">The client namespace</param> /// <param name="properties">The properties, including the engine handle.</param> /// <param name="instruments">An array of instrument types.</param> /// <param name="rawVolatilityGrid">The raw grid used to build the engines. Assume that all volatility and strike values are 100x true</param> /// <returns></returns> private SortedList <decimal, VolatilityCurve> VolatilityCurveCreate(ILogger logger, ICoreCache cache, string nameSpace, NamedValueSet properties, String[] instruments, Decimal[] rawVolatilityGrid) { var clonedProperties = properties.Clone(); // Create engine var quotedAssetSet = AssetHelper.Parse(instruments, rawVolatilityGrid, null); var engines = new SortedList <decimal, VolatilityCurve>(); // Create a new ATM CapletBootstrap engine. The default decimal should be 0 var volatilityCurve = PricingStructureFactory.CreateCurve(logger, cache, nameSpace, null, null, clonedProperties, quotedAssetSet); // Add engine if (volatilityCurve is VolatilityCurve vCurve) { engines.Add(0, vCurve); } return(engines); }
public AssetTypeValueField GetByteArrayTexture(AssetWorkspace workspace, AssetExternal tex) { ClassDatabaseType textureType = AssetHelper.FindAssetClassByID(workspace.am.classFile, tex.info.curFileType); AssetTypeTemplateField textureTemp = new AssetTypeTemplateField(); textureTemp.FromClassDatabase(workspace.am.classFile, textureType, 0); AssetTypeTemplateField image_data = textureTemp.children.FirstOrDefault(f => f.name == "image data"); if (image_data == null) { return(null); } image_data.valueType = EnumValueTypes.ByteArray; AssetTypeInstance textureTypeInstance = new AssetTypeInstance(new[] { textureTemp }, tex.file.file.reader, tex.info.absoluteFilePos); AssetTypeValueField textureBase = textureTypeInstance.GetBaseField(); return(textureBase); }
public AssetTypeTemplateField GetTemplateField(AssetItem item, bool forceFromCldb = false) { var file = LoadedFiles[item.FileID].file; var hasTypeTree = file.typeTree.hasTypeTree; var baseField = new AssetTypeTemplateField(); var scriptIndex = item.MonoID; var fixedId = AssetHelper.FixAudioID(item.TypeID); if (hasTypeTree && !forceFromCldb) { baseField.From0D(AssetHelper.FindTypeTreeTypeByScriptIndex(file.typeTree, scriptIndex), 0); } else { baseField.FromClassDatabase(Am.classFile, AssetHelper.FindAssetClassByID(Am.classFile, fixedId), 0); } return(baseField); }
public void Generate(MapAsset asset) { // Object GameObject sabRoomObj = new GameObject(asset.name); sabRoomObj.transform.localScale = new Vector3(0.8f, 0.8f, 1.0f); sabRoomObj.transform.SetParent(overlayObj.transform); sabRoomObj.transform.localPosition = new Vector3(0, 0, -25.0f); // MapRoom MapRoom sabMapRoom = sabRoomObj.AddComponent <MapRoom>(); sabMapRoom.room = ShipRoomBuilder.db[asset.id]; sabMapRoom.Parent = overlay; overlay.rooms = AssetHelper.AddToArr(overlay.rooms, sabMapRoom); sabDb.Add(sabMapRoom.room, sabMapRoom); }
public static bool GetPrefabs() { try { if (!_initialized) { QuickLogger.Debug($"AssetBundle Set"); QuickLogger.Debug("GetPrefabs"); _assetBundle = AssetHelper.Asset(Mod.ModFolderName, Mod.BundleName); Bundle = _assetBundle; //We have found the asset bundle and now we are going to continue by looking for the model. GameObject prefab = _assetBundle.LoadAsset <GameObject>(Mod.ModPrefabName); //If the prefab isn't null lets add the shader to the materials if (prefab != null) { //Lets apply the material shader ApplyShaders(prefab, _assetBundle); Prefab = prefab; QuickLogger.Debug($"{Mod.ModFriendlyName} Prefab Found!"); } else { QuickLogger.Error($"{Mod.ModFriendlyName} Gen Prefab Not Found!"); return(false); } _initialized = true; } return(true); } catch (Exception e) { QuickLogger.Error(e.Message); return(false); } }
public void OpenAsset(long id) { ClassDatabaseFile classFile = helper.classFile; AssetsFileInstance correctAti = currentFile; AssetFileInfoEx info = correctAti.table.GetAssetInfo(id); //todo this won't work for assets with typetrees ClassDatabaseType classType = AssetHelper.FindAssetClassByID(classFile, info.curFileType); string typeName = classType.name.GetString(classFile); bool hasGameobjectField = classType.fields.Any(f => f.fieldName.GetString(classFile) == "m_GameObject"); bool parentPointerNull = false; if (typeName != "GameObject" && hasGameobjectField) { //get gameobject parent AssetTypeValueField componentBaseField = helper.GetATI(correctAti.file, info).GetBaseField(); AssetFileInfoEx newInfo = helper.GetExtAsset(correctAti, componentBaseField["m_GameObject"], true).info; if (newInfo != null && newInfo.index != 0) { info = newInfo; } else { parentPointerNull = true; } } if ((typeName == "GameObject" || hasGameobjectField) && !parentPointerNull) { AssetTypeValueField baseField = helper.GetATI(correctAti.file, info).GetBaseField(); AssetTypeValueField transformPtr = baseField["m_Component"]["Array"][0]["component"]; AssetTypeValueField transform = helper.GetExtAsset(correctAti, transformPtr).instance.GetBaseField(); baseField = GetRootTransform(helper, currentFile, transform); AssetTypeValueField gameObjectPtr = baseField["m_GameObject"]; AssetTypeValueField gameObject = helper.GetExtAsset(correctAti, gameObjectPtr).instance.GetBaseField(); GameObjectViewer view = new GameObjectViewer(helper, correctAti, gameObject, info.index, id); view.Show(); } else { AssetTypeValueField baseField = helper.GetATI(correctAti.file, info).GetBaseField(); GameObjectViewer view = new GameObjectViewer(helper, correctAti, baseField, info); view.Show(); } }
public virtual void Initialize(AssetHelper assets) { }
protected override void DoLoadAsset(AssetHelper assetHelper) { shader = Shader.GetShader(this); // NOTE: We have hardcoded shader values here that should be configurable in some other way blendState = BlendState.Opaque; if (shaderName == "iPhone/Particles/Additive Culled" || shaderName == "Particles/Additive") { blendState = BlendState.Additive; } else if (renderQueue == 3000 || (shaderName ?? "").StartsWith("Trans") || shaderName == "Particles/VertexLit Blended" || shaderName == "Particles/Alpha Blended") { blendState = BlendState.AlphaBlend; } if (shaderName == "Particles/Multiply (Double)") { color = new Color(color.r, color.g, color.b, 0.5f); } //if (name == "Default-Particle") //{ // color = Color.white; //} CalculateRenderQueue(); }
internal static void LoadRenderIndices(AssetHelper helper) { textureRenderIndexes.Clear(); helper.AddStaticAsset("TextureRenderIndexes"); string[] names = helper.Load<String[]>("TextureRenderIndexes"); if (names != null) { for (int i = 0; i < names.Length; i++) { textureRenderIndexes.Add(names[i], i); } } }
protected override void DoLoadAsset(AssetHelper assetHelper) { if (!String.IsNullOrEmpty(name) && _vertices == null) { Mesh mesh = assetHelper.LoadAsset<Mesh>(name); if (mesh != null) { mesh.FlattenTriangleSets(); CloneTo(mesh, this); } } }
protected override void DoLoadAsset(AssetHelper assetHelper) { }
protected override void DoLoadAsset(AssetHelper assetHelper) { if (name == null) { return; } if (tex == null) { tex = assetHelper.LoadAsset<Microsoft.Xna.Framework.Graphics.Texture2D>(name); } }
protected abstract void DoLoadAsset(AssetHelper assetHelper);
protected override void DoLoadAsset(AssetHelper assetHelper) { if (sound == null) { sound = assetHelper.Load<SoundEffect>("Sounds/" + clip); name = clip; if (sound != null) { Instance = sound.CreateInstance(); } } }
public void Initialize(AssetHelper assets) { Lights.Add(this); }
protected override void DoLoadAsset(AssetHelper assetHelper) { if (!String.IsNullOrEmpty(name) && _vertices == null) { Mesh[] meshes = assetHelper.LoadAsset<Mesh[]>(asset); if (meshes.HasElements()) { Mesh mesh = meshes.FirstOrDefault(m => m.name == name); if (mesh != null) { mesh.FlattenTriangleSets(); CloneTo(mesh, this); } } } }