public override void OnInspectorGUI() { base.OnInspectorGUI(); AudioButtonClickComponent component = (AudioButtonClickComponent)target; if (string.IsNullOrEmpty(component.audioName)) { EditorGUILayout.HelpBox("不能为空!!!", MessageType.Error); return; } ResourcesConfigManager.Initialize(); if (!ResourcesConfigManager.GetIsExitRes(component.audioName)) { EditorGUILayout.HelpBox("没有资源!!!", MessageType.Error); return; } if (GUILayout.Button("Play", GUILayout.Height(60))) { AudioClip clip = ResourceManager.Load <AudioClip>(component.audioName); AudioEditorUtils.PlayClip(clip); } }
public static void SetText(Text text, string name, SystemLanguage language) { if (ContainsData(name, language)) { TextStyleData data = GetTextStyleData(name, language); if (!ResourcesConfigManager.GetIsExitRes(data.fontName)) { Debug.LogError("dont find font :" + data.fontName); } else { text.font = ResourceManager.Load <Font>(data.fontName); } text.fontSize = data.fontSize; text.fontStyle = data.fontStyle; text.resizeTextForBestFit = data.bestFit; text.resizeTextMinSize = data.minSize; text.resizeTextMaxSize = data.maxSize; text.alignment = data.alignment; text.supportRichText = data.richText; text.horizontalOverflow = data.horizontalOverflow; text.verticalOverflow = data.verticalOverflow; text.lineSpacing = data.lineSpacing; } }
public static LanguageSettingConfig LoadRuntimeConfig() { if (ResourcesConfigManager.GetIsExitRes(LanguageManager.c_configFileName)) { LanguageSettingConfig config; string json = ResourceManager.LoadText(LanguageManager.c_configFileName); ResourceManager.DestoryAssetsCounter(LanguageManager.c_configFileName); if (!string.IsNullOrEmpty(json)) { config = JsonUtils.FromJson <LanguageSettingConfig>(json); } else { config = null; //config.defaultLanguage = SystemLanguage.ChineseSimplified; //config.gameExistLanguages.Add(SystemLanguage.ChineseSimplified); } return(config); } else { return(null); } }
public static bool GetResourceIsExist(string name) { if (name == null) { throw new Exception("ResourceManager GetResourceIsExist -> name is null !"); } return(ResourcesConfigManager.GetIsExitRes(name)); }
public static void DisposeAll() { foreach (var item in recycleAssets) { if (ResourcesConfigManager.GetIsExitRes(item.name)) { ResourceManager.UnLoad(item.name); } } recycleAssets.Clear(); }
private void OnClick() { if (ResourcesConfigManager.GetIsExitRes(audioName)) { AudioPlayManager.PlaySFX2D(audioName, volume); } else { Debug.LogError("不存在音频文件:" + audioName); } }
private object DrawTextureGUI(string text, object value) { if (editTextureValue != null) { value = editTextureValue; editTextureValue = null; } GUILayout.BeginHorizontal(); value = EditorDrawGUIUtil.DrawBaseValue(text, value); if (GUILayout.Button("o", GUILayout.Width(20))) { ObjectSelectorWindow.Show(GeneralDataModificationWindow.GetInstance(), value.ToString(), new string[] { "Assets/Resources" }, typeof(GameObject), (assetName, obj) => { editTextureValue = assetName; } ); } GUILayout.EndHorizontal(); string content = value.ToString(); bool isHave = false; try { ResourcesConfigManager.Initialize(); if (ResourcesConfigManager.GetIsExitRes(content)) { Texture2D obj = ResourceManager.Load <Texture2D>(content); if (obj) { if (obj != previewTex) { previewEditor1 = Editor.CreateEditor(obj); previewTex = obj; } previewEditor1.OnPreviewGUI(GUILayoutUtility.GetRect(300, 300), EditorStyles.helpBox); isHave = true; } } } catch { } if (!isHave) { EditorGUILayout.HelpBox("没有图片 [" + value + "] !!", MessageType.Error); } return(value); }
public static void DestoryAssetsCounter(string name, int times = 1) { if (!ResourcesConfigManager.GetIsExitRes(name)) { return; } string path = ResourcesConfigManager.GetLoadPath(loadType, name); if (times <= 0) { times = 1; } for (int i = 0; i < times; i++) { loadAssetsController.DestoryAssetsCounter(path); } }
protected void PlayClip(AudioAsset au, string audioName, bool isLoop = true, float volumeScale = 1, float delay = 0f, float pitch = 1) { if (!ResourcesConfigManager.GetIsExitRes(audioName)) { Debug.LogError("不存在音频:" + audioName); return; } //if (au.PlayState == AudioPlayState.Playing) // au.Stop(); UnloadClip(au); au.assetName = audioName; AudioClip ac = GetAudioClip(au.assetName); au.audioSource.clip = ac; au.audioSource.loop = isLoop; au.audioSource.pitch = pitch; au.VolumeScale = volumeScale; au.Play(delay); }
public void SetImageSprite(Image img, string name, bool is_nativesize = false) { if (ResourcesConfigManager.GetIsExitRes(name)) { UGUITool.SetImageSprite(img, name, is_nativesize); if (!loadSpriteNames.ContainsKey(name)) { loadSpriteNames.Add(name, 1); } else { loadSpriteNames[name]++; } //if (name == "CLT_border_TagBg_Hunter") // Debug.Log("UIBase 加载图片:" + name + " ==>" + loadSpriteNames[name]); } else { Debug.LogError("SetImageSprite 资源不存在! ->" + name + "<-"); } }
public static void DisposeOne() { removeItems.Clear(); foreach (var item in recycleAssets) { if (ResourcesConfigManager.GetIsExitRes(item.name)) { ResourceManager.UnLoad(item.name); removeItems.Add(item); break; } else { removeItems.Add(item); } } foreach (var item in removeItems) { recycleAssets.Remove(item); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); ImageLoadComponent component = (ImageLoadComponent)target; if (string.IsNullOrEmpty(component.iconName)) { EditorGUILayout.HelpBox("不能为空!!!", MessageType.Error); return; } //ResourcesConfigManager.Initialize(); if (!ResourcesConfigManager.GetIsExitRes(component.iconName)) { EditorGUILayout.HelpBox("没有资源!!!", MessageType.Error); return; } // if (GUI.changed) { Image image = component.LoadImage(); image.sprite = null; } }
public static bool GetResourceIsExist(string name) { return(ResourcesConfigManager.GetIsExitRes(name)); }
public static bool GetIsExistData(string DataName) { return ResourcesConfigManager.GetIsExitRes(DataName); }
public static bool GetIsExistConfig(string ConfigName) { return(ResourcesConfigManager.GetIsExitRes(ConfigName)); }