先修复一下,错误的场景 删除不必要的钓场资产 修复into场景 update:更新meta文件,修复报错 update:修复资源 修复第一章节建造 修复建造第三章 update:删除多余内容 update:更新README.md update:还原图标 update:更新README update:更新配置
65 lines
1.5 KiB
C#
65 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Coffee.UISoftMask
|
|
{
|
|
public class GraphicProxy
|
|
{
|
|
private static readonly List<GraphicProxy> s_Proxies = new List<GraphicProxy>()
|
|
{
|
|
new GraphicProxy()
|
|
};
|
|
|
|
public static void Register(GraphicProxy proxy)
|
|
{
|
|
// Register only once.
|
|
var count = s_Proxies.Count;
|
|
for (var i = 0; i < count; i++)
|
|
{
|
|
var p = s_Proxies[i];
|
|
if (p.GetType() == proxy.GetType()) return;
|
|
}
|
|
|
|
s_Proxies.Add(proxy);
|
|
}
|
|
|
|
public static GraphicProxy Find(Graphic graphic)
|
|
{
|
|
if (!graphic) return null;
|
|
|
|
var count = s_Proxies.Count;
|
|
for (var i = count - 1; i >= 0; i--)
|
|
{
|
|
var p = s_Proxies[i];
|
|
if (p.IsValid(graphic)) return p;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Check if the graphic is valid for this proxy.
|
|
/// </summary>
|
|
protected virtual bool IsValid(Graphic graphic)
|
|
{
|
|
return graphic;
|
|
}
|
|
|
|
public virtual Texture GetMainTexture(Graphic graphic)
|
|
{
|
|
return graphic.mainTexture;
|
|
}
|
|
|
|
public virtual float GetAlpha(Graphic graphic)
|
|
{
|
|
return graphic.color.a;
|
|
}
|
|
|
|
public virtual void SetMaterialDirty(Graphic graphic)
|
|
{
|
|
graphic.SetMaterialDirty();
|
|
}
|
|
}
|
|
}
|