3.0.0-preview.7
# [3.0.0-preview.7](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.6...v3.0.0-preview.7) (2020-03-02) ### Bug Fixes * add package keywords ([49d8f3f](pull/77/head49d8f3fe4c
)) * fix sample path ([57ee210](57ee21005e
))
parent
5b40341984
commit
8cd1b9e46b
|
@ -1,3 +1,11 @@
|
|||
# [3.0.0-preview.7](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.6...v3.0.0-preview.7) (2020-03-02)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* add package keywords ([49d8f3f](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/49d8f3fe4c76cf6bd2cd5b6134ee23134532da8e))
|
||||
* fix sample path ([57ee210](https://github.com/mob-sakai/ParticleEffectForUGUI/commit/57ee21005e114fdf186b5db55ca2b77b7b7c441a))
|
||||
|
||||
# [3.0.0-preview.6](https://github.com/mob-sakai/ParticleEffectForUGUI/compare/v3.0.0-preview.5...v3.0.0-preview.6) (2020-02-21)
|
||||
|
||||
|
||||
|
|
|
@ -2,41 +2,59 @@
|
|||
#if !UNITY_2019_1_OR_NEWER
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
|
||||
namespace Coffee.UIExtensions
|
||||
{
|
||||
public class UIParticleMenu
|
||||
{
|
||||
[MenuItem("Assets/Samples/Import UIParticle Sample")]
|
||||
static void ImportSample()
|
||||
static string GetPreviousSamplePath(string displayName, string sampleName)
|
||||
{
|
||||
const string sampleGuid = "dc0fe9e7fe61947fab1522ab29e2fc88";
|
||||
const string jsonGuid = "823dc693d087a4b559c7e1547274cc7d";
|
||||
const string SAMPLE_NAME = "Demo";
|
||||
string sampleRoot = $"Assets/Samples/{displayName}";
|
||||
var sampleRootInfo = new DirectoryInfo(sampleRoot);
|
||||
if (!sampleRootInfo.Exists) return null;
|
||||
|
||||
string jsonPath = AssetDatabase.GUIDToAssetPath(jsonGuid);
|
||||
foreach (var versionDir in sampleRootInfo.GetDirectories())
|
||||
{
|
||||
var samplePath = Path.Combine(versionDir.ToString(), sampleName);
|
||||
if (Directory.Exists(samplePath))
|
||||
return samplePath;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
static void ImportSample(string packageName, string sampleName)
|
||||
{
|
||||
string jsonPath = $"Packages/{packageName}/package.json";
|
||||
string json = File.ReadAllText(jsonPath);
|
||||
string version = Regex.Match(json, "\"version\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value;
|
||||
string displayName = Regex.Match(json, "\"displayName\"\\s*:\\s*\"([^\"]+)\"").Groups[1].Value;
|
||||
string src = Path.GetDirectoryName(jsonPath) + "/Samples~/" + SAMPLE_NAME;
|
||||
string dst = string.Format("Assets/Samples/{0}/{1}/{2}",displayName, version, SAMPLE_NAME);
|
||||
string src = $"{Path.GetDirectoryName(jsonPath)}/Samples~/{sampleName}";
|
||||
string dst = $"Assets/Samples/{displayName}/{version}/{sampleName}";
|
||||
string previous = GetPreviousSamplePath(displayName, sampleName);
|
||||
|
||||
// Remove old samples
|
||||
string samplePath = AssetDatabase.GUIDToAssetPath(sampleGuid);
|
||||
if (samplePath.StartsWith("Assets/") && FileUtil.PathExists(samplePath))
|
||||
if (!string.IsNullOrEmpty(previous))
|
||||
{
|
||||
FileUtil.DeleteFileOrDirectory(samplePath);
|
||||
FileUtil.DeleteFileOrDirectory(samplePath + ".meta");
|
||||
string msg = "A different version of the sample is already imported at\n\n"
|
||||
+ previous
|
||||
+ "\n\nIt will be deleted when you update. Are you sure you want to continue?";
|
||||
if (!EditorUtility.DisplayDialog("Sample Importer", msg, "OK", "Cancel"))
|
||||
return;
|
||||
|
||||
FileUtil.DeleteFileOrDirectory(previous);
|
||||
FileUtil.DeleteFileOrDirectory(previous + ".meta");
|
||||
}
|
||||
|
||||
FileUtil.CopyDirectoryRecursive(src, dst);
|
||||
FileUtil.CopyFileOrDirectory(src + ".meta", dst + ".meta");
|
||||
AssetDatabase.ImportAsset(dst, ImportAssetOptions.ImportRecursive);
|
||||
}
|
||||
|
||||
[MenuItem("Assets/Samples/Import UIParticle Sample")]
|
||||
static void ImportSample()
|
||||
{
|
||||
ImportSample("com.coffee.ui-particle", "Demo");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
"name": "com.coffee.ui-particle",
|
||||
"displayName": "UI Particle",
|
||||
"description": "This plugin provide a component to render particle effect for uGUI.\nThe particle rendering is maskable and sortable, without Camera, RenderTexture or Canvas.",
|
||||
"version": "3.0.0-preview.6",
|
||||
"version": "3.0.0-preview.7",
|
||||
"unity": "2018.2",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
|
@ -11,6 +11,10 @@
|
|||
},
|
||||
"author": "mob-sakai <sakai861104@gmail.com> (https://github.com/mob-sakai)",
|
||||
"dependencies": {},
|
||||
"keywords": [
|
||||
"ui",
|
||||
"particle"
|
||||
],
|
||||
"samples": [
|
||||
{
|
||||
"displayName": "Demo",
|
||||
|
|
Loading…
Reference in New Issue