• 大小: 676KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-15
  • 语言: 其他
  • 标签: UGUI  shader  

资源简介

UGUI各种UI shader效果,附带unity工程文件,大概几十种效果

资源截图

代码片段和文件信息

using System;
using System.Linq;
using UnityEditor;
using UnityEngine;
using UnityEngine.UI;

namespace Coffee.UIExtensions
{
using BlurMode = UIEffect.BlurMode;
using ColorMode = UIEffect.ColorMode;
using ToneMode = UIEffect.ToneMode;

public static class ExportPackage
{
const string kPackageName = “UIEffect.unitypackage“;
static readonly string[] kAssetPathes =
{
“Assets/UIEffect“
};

[MenuItem(“Export Package/“ + kPackageName)]
[InitializeonloadMethod]
static void Export()
{
if (EditorApplication.isPlayingOrWillChangePlaymode)
return;

// Export package
AssetDatabase.ExportPackage(kAssetPathes kPackageName ExportPackageOptions.Recurse | ExportPackageOptions.Default);
UnityEngine.Debug.Log(“Export successfully : “ + kPackageName);

// Update readme.
System.IO.File.Copy(“Assets/UIEffect/README.md“ “README.md“ true);
}

[MenuItem(“Export Package/Generate Material Variants“)]
static void GenerateMaterialVariants()
{
#if UIEFFECT_SEPARATE
// On “UIEFFECT_SEPARATE“ mode generate effect materials on demand.
return;
#endif

// Export materials.
AssetDatabase.StartAssetEditing();
{
// For UIEffect
GenerateMaterialVariants(Shader.Find(UIEffect.shaderName));

// For UIEffectCapturedImage
GenerateMaterialVariants(Shader.Find(UIEffectCapturedImage.shaderName));
}
AssetDatabase.StopAssetEditing();
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
}

/// 
/// Generates the material variants.
/// 

static void GenerateMaterialVariants(Shader shader)
{
var combinations = (from tone in (ToneMode[])Enum.GetValues(typeof(ToneMode))
from color in (ColorMode[])Enum.GetValues(typeof(ColorMode))
from blur in (BlurMode[])Enum.GetValues(typeof(BlurMode))
select new { tone color blur }).ToArray();

for (int i = 0; i < combinations.Length; i++)
{
var comb = combinations[i];

EditorUtility.DisplayProgressBar(“Genarate Effect Material“ UIEffect.GetVariantName(shader comb.tone comb.color comb.blur) (float)i / combinations.Length);
UIEffect.GetOrGenerateMaterialVariant(shader comb.tone comb.color comb.blur);
}
EditorUtility.ClearProgressBar();
}
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-01-26 09:06  UIEffect-master\
     文件         354  2018-01-26 09:06  UIEffect-master\.gitignore
     目录           0  2018-01-26 09:06  UIEffect-master\Assets\
     文件         191  2018-01-26 09:06  UIEffect-master\Assets\Editor.meta
     目录           0  2018-01-26 09:06  UIEffect-master\Assets\Editor\
     文件        2259  2018-01-26 09:06  UIEffect-master\Assets\Editor\ExportPackage.cs
     文件         262  2018-01-26 09:06  UIEffect-master\Assets\Editor\ExportPackage.cs.meta
     文件         191  2018-01-26 09:06  UIEffect-master\Assets\UIEffect.meta
     目录           0  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\
     文件         191  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo.meta
     目录           0  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\
     文件        4971  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Alpha.controller
     文件         179  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Alpha.controller.meta
     文件        4951  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Blur.controller
     文件         179  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Blur.controller.meta
     文件       13241  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Color.controller
     文件         179  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Color.controller.meta
     文件      988195  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Demo - UIEffect.unity
     文件         174  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Demo - UIEffect.unity.meta
     文件       18613  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Dialog.controller
     文件         180  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Dialog.controller.meta
     文件      176679  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Pattern.png
     文件        1203  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Pattern.png.meta
     文件        7585  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Shadow.controller
     文件         179  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Shadow.controller.meta
     文件        4968  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\ToneLevel.controller
     文件         179  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\ToneLevel.controller.meta
     文件       21888  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Transition.controller
     文件         180  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\Transition.controller.meta
     文件         468  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\UIEffectDialogDemo.cs
     文件         263  2018-01-26 09:06  UIEffect-master\Assets\UIEffect\Demo\UIEffectDialogDemo.cs.meta
............此处省略53个文件信息

评论

共有 条评论