static public void Init() { if (layersTagsData == null) { layersTagsData = ScriptableObjectUtils.LoadCreateScriptableObject <AssetsLayersTagsData>(AssetsLayersTagsDataPath); } }
private void OnEnable() { LoadSettings(); if (EditorApplication.isPlayingOrWillChangePlaymode) { return; } RefreshFiles(); _data = ScriptableObjectUtils.LoadOrCreateAsset <TodoData>(_dataPath); RefreshEntriesToShow(); if (!_autoScan) { return; } _watcher = new FileSystemWatcher(Application.dataPath, "*.cs"); _watcher.Changed += OnChanged; _watcher.Deleted += OnDeleted; _watcher.Renamed += OnRenamed; _watcher.Created += OnCreated; _watcher.EnableRaisingEvents = true; _watcher.IncludeSubdirectories = true; }
public static void ExportPresets(List <ScreenshotResolution> resolutions) { foreach (ScreenshotResolution res in resolutions) { string name = res.m_ResolutionName == "" ? res.m_Width.ToString() + "x" + res.m_Height.ToString() : res.m_ResolutionName; ScreenshotResolutionAsset preset = ScriptableObjectUtils.CreateAsset <ScreenshotResolutionAsset> (name, "Presets/Custom"); preset.m_Resolution = new ScreenshotResolution(res); EditorUtility.SetDirty(preset); } AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); }
public static T RequestResource <T>(string resourcePath) where T : ScriptableObject { var t = Resources.Load <T>(resourcePath); if (t != null) { return(t); } t = ScriptableObjectUtils.Create <T>(RESOURCES_DEFAULT_PATH + resourcePath); Debug.LogWarning("Created new Resource at " + RESOURCES_DEFAULT_PATH + resourcePath); return(t); }
public void ForceAwake() { var shopItems = ScriptableObjectUtils.GetAllInstances <ShopItem>() .Where(x => x.PurchaseType == shopType && x.IsActive == true) .OrderBy(x => x.BasePrice); foreach (var item in shopItems) { var row = Instantiate(shopRowPrefab, shopContainer.transform); row.item = item; row.ForceAwake(); rows.Add(row); } }
private static void CreateColumnMap(string sheetPath) { string assetPath = "Assets/Scripts/DataObjects"; if (!string.IsNullOrEmpty(sheetPath)) { if (!File.Exists(sheetPath)) { Debug.LogWarning(string.Format("Sheet Path {0} does not exist.", sheetPath)); return; } ExcelQuery q = new ExcelQuery(sheetPath); q.GetNewSheet(q.GetSheetNames()[0]); string err = string.Empty; string[] titles = q.GetTitle(0, ref err); if (err != string.Empty) { Debug.LogError(string.Format("Could not read sheet titles from first sheet {0} of {1}", q.GetSheetNames()[0], sheetPath)); return; } else { var bar = ScriptableObjectUtils.ObservableCreateAsset <ColumnMap>(Path.GetFileNameWithoutExtension(sheetPath) + "_ColumnMap", assetPath) .Do(map => { ScriptableObjectUtils.ObservableCreateAsset <RuleConstant>("WriteNothing", assetPath) .Subscribe(defaultRule => { int len = titles.Length; for (int i = 0; i < len; i++) { map.rules.Add(new RuleInfo() { description = string.Format("{0} - {1}", SheetUtils.GetColumnLettersFromIndex(i + 1), titles[i]), rule = defaultRule }); } }); map.header.AddRange(titles); }); bar.Subscribe(); } } }
public static bool Draw(Rect r, SerializedProperty prop, System.Type type, string path = null, bool ignoreIdentation = true) { var createdNewSO = false; var obj = prop.objectReferenceValue; if (obj == null) { var iconSize = 16; var create = GUI.Button(new Rect(r.x, r.y + (r.height - iconSize) / 2, iconSize, iconSize), IconCache.Get("match").Texture, new GUIStyle()); if (create) { var target = prop.serializedObject.targetObject; if (prop.serializedObject.targetObject is MonoBehaviour) { target = MonoScript.FromMonoBehaviour((MonoBehaviour)prop.serializedObject.targetObject); } var selectedAssetPath = System.IO.Path.GetDirectoryName(AssetDatabase.GetAssetPath(target)); var go = ScriptableObjectUtils.CreateSequential(selectedAssetPath + "\\" + prop.ToFileName(), type); prop.objectReferenceValue = go; prop.serializedObject.ApplyModifiedProperties(); createdNewSO = true; } r = r.CutLeft(iconSize + 2); } if (ignoreIdentation) { EditorGuiIndentManager.New(0); } var newObj = EditorGUI.ObjectField(r, obj, type, false); if (ignoreIdentation) { EditorGuiIndentManager.Revert(); } if (newObj != obj) { prop.objectReferenceValue = newObj; prop.serializedObject.ApplyModifiedProperties(); } return(createdNewSO); }
private void Init() { oldGUIColor = GUI.color; if (!Directory.Exists(assetPath)) { Directory.CreateDirectory(assetPath); } settingData = ScriptableObjectUtils.LoadCreateScriptableObject <AssetBundleSettingData>(assetPath + settingDataPath); settingData.Init(); UpdateFileExtension(); UpdatePackageController.Init(); gameVersionInfo = UpdatePackageController.GetGameVersionInfo(PlayerSettings.productName); if (gameVersionInfo == null) { gameVersionInfo = new GameVersionInfo(); gameVersionInfo.forceUpdateVersion = PlayerSettings.bundleVersion; gameVersionInfo.latestVersion = PlayerSettings.bundleVersion; } versionControlInfo = UpdatePackageController.GetVersionControlInfo(PlayerSettings.productName, PlayerSettings.bundleVersion); if (versionControlInfo == null) { versionControlInfo = new VersionControlInfo(); } int num = GetMaxNumber(versionControlInfo.assetBundleVersions); if (num == -1) { assetBundleInfo = new AssetBundleInfo(); assetBundleInfo.gameName = PlayerSettings.productName; assetBundleInfo.gameVersion = PlayerSettings.bundleVersion; assetBundleInfo.assetBundleVersion = 0; } else { assetBundleInfo = UpdatePackageController.GetAssetBundleInfo(PlayerSettings.productName, PlayerSettings.bundleVersion, num); assetBundleInfo.assetBundleVersion = assetBundleInfo.assetBundleVersion + 1; } }
public static bool Draw <T>(Rect r, SerializedProperty prop, string newFolderPath) where T : ScriptableObject { var createdNewSO = false; var obj = prop.objectReferenceValue; if (obj == null) { var iconSize = 16; var create = GUI.Button(new Rect(r.x, r.y + (r.height - iconSize) / 2, iconSize, iconSize), IconCache.Get("match").Texture, new GUIStyle()); if (create) { var go = ScriptableObjectUtils.CreateSequential <T>(newFolderPath + prop.ToFileName()); prop.objectReferenceValue = go; prop.serializedObject.ApplyModifiedProperties(); createdNewSO = true; } r = r.CutLeft(iconSize + 2); } Draw <T>(r, prop, false); return(createdNewSO); }
private IEnumerator LoadDataFromFile() { yield return(new WaitForEndOfFrame()); // SaveController.Load(gameData); ScriptableObjectUtils.Reset(gameData); gameData.OnApplicationOpen(); // if (gameData.IsExistingUser) // gameData.ShowWelcomeBackData(); animalObject.Initialize(gameData.Animal); gameData.CurrentLevel = 1; timeController.TogglePause(false); IsInitializeDone = true; // test //testObject.SetTarget(Camera.main.ScreenToWorldPoint(testSpot.transform.position)); //testObject.StartMoving(); }
public static bool Layout <T>(SerializedProperty prop, string newFolderPath, params GUILayoutOption[] options) where T : ScriptableObject { var createdNewSO = false; var obj = prop.objectReferenceValue; GUILayout.BeginHorizontal(); if (obj == null) { var icon = IconCache.Get("match").Texture; var slh = EditorGUIUtility.singleLineHeight; var create = GUILayout.Button(icon, new GUIStyle(), GUILayout.Width((icon.width / icon.height) * slh), GUILayout.Height(slh)); if (create) { var go = ScriptableObjectUtils.CreateSequential <T>(newFolderPath + prop.ToFileName()); prop.objectReferenceValue = go; prop.serializedObject.ApplyModifiedProperties(); createdNewSO = true; } } Layout <T>(prop, false, options); GUILayout.EndHorizontal(); return(createdNewSO); }
private void Awake() { spawners = ScriptableObjectUtils.GetAllInstances <Spawner>().ToList(); }
public static void CreateAsset() { ProjectWindowUtil.ShowCreatedAsset(ScriptableObjectUtils.CreateAsset <PresetCollectionAsset> ("Custom collection", "Presets/Collections")); }
void Init() { msData = ScriptableObjectUtils.LoadCreateScriptableObject <MessageStringData>(LogicSystemConstData.LogicObjectBackUpData); }
public static void CreateAsset() { ScriptableObjectUtils.CreateAsset <PuzzleSister.VoiceSuite>(); }
public static void CreateAsset() { ProjectWindowUtil.ShowCreatedAsset(ScriptableObjectUtils.CreateAsset <ScreenshotResolutionAsset> ("Custom preset", "Presets/Custom")); }
public static void CreateAsset() { ScriptableObjectUtils.CreateAsset <DialogBase>(); }
public static void CreateAsset() { ProjectWindowUtil.ShowCreatedAsset(ScriptableObjectUtils.CreateAsset <PopularityPresetAsset> ("Custom popularity", "Presets/Popularity")); }
public void ResetData() { ScriptableObjectUtils.Reset(this); }
public override void OnInspectorGUI() { EditorGUILayout.Separator(); if (m_IDs == null) { SimpleLocalizationLanguagesAsset[] l = Resources.LoadAll <SimpleLocalizationLanguagesAsset> (""); if (l.Length > 0) { m_IDs = l [0]; } else { m_IDs = ScriptableObjectUtils.CreateAsset <SimpleLocalizationLanguagesAsset> ("LocalizationLanguages"); } } if (m_IDs == null) { return; } SimpleTextLocalizer obj = (SimpleTextLocalizer)target; // Default text if (SimpleLocalizationLanguagesAsset.m_CurrentLanguageID == "" && obj.GetComponent <Text> ().text != obj.m_OriginalText) { obj.Save(); } EditorGUILayout.LabelField("Default (" + m_IDs.m_DefaultLanguage + "): " + obj.m_OriginalText); // Localizations if (m_IDs.m_Languages.Count == 0) { EditorGUILayout.HelpBox("Languages list is empty. Please add languages in the global localization settings.", MessageType.Warning); } foreach (string id in m_IDs.m_Languages) { // Init localization value if needed if (!obj.m_Localisations.ContainsKey(id)) { obj.m_Localisations [id] = ""; EditorUtility.SetDirty(obj); } // Localization edit field EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField(id, GUILayout.MaxWidth(50)); string newLoc = EditorGUILayout.TextField(obj.m_Localisations [id]); EditorGUILayout.EndHorizontal(); // Set new localization if needed if (newLoc != obj.m_Localisations [id]) { obj.m_Localisations [id] = newLoc; EditorUtility.SetDirty(obj); } } // Global LanguagesDrawer.DrawGUI(m_IDs); }
public static ScriptableObject CreateInstance() { return(ScriptableObjectUtils.CreateAsset <TutorialCallbacks>(DefaultFileName)); }
public static MessageStringData GetMessageStringData() { return(ScriptableObjectUtils.LoadCreateScriptableObject <MessageStringData>(LogicSystemConstData.LogicSystemEditorPath)); }