本文整理汇总了C#中UIAtlas类的典型用法代码示例。如果您正苦于以下问题:C# UIAtlas类的具体用法?C# UIAtlas怎么用?C# UIAtlas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIAtlas类属于命名空间,在下文中一共展示了UIAtlas类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
/// <summary>
/// Show the selection wizard.
/// </summary>
public static void Show (UIAtlas atlas, UISprite selectedSprite)
{
SpriteSelector comp = ScriptableWizard.DisplayWizard<SpriteSelector>("Select a Sprite");
comp.mAtlas = atlas;
comp.mSprite = selectedSprite;
comp.mCallback = null;
}
示例2: initialization
public void initialization()
{
itemAtlas = Resources.Load("Atlas/ItemIcon Atlas", typeof(UIAtlas)) as UIAtlas;
// 임의로한거
/* if(itemID == 0)
{
itemSpriteName = "Orc Armor - Boots";
}
else if(itemID == 1)
{
itemSpriteName = "Orc Armor - Bracers";
}
else if(itemID == 2)
{
itemSpriteName = "Orc Armor - Shoulders";
}
else if(itemID == 3)
{
itemSpriteName = "NGUI";
}
else if(itemID == 4)
{
itemSpriteName = "Window";
}*/
}
示例3: AtlasUsages
public AtlasUsages(UIAtlas Atlas)
{
this.Atlas = Atlas;
UsedSprites = new Dictionary<string, SpriteLink>();
initUnusedSprites();
}
示例4: ChangeAtlas
void ChangeAtlas(UIAtlas currentAtlas)
{
if(spriteName != "")
sprite.spriteName = spriteName;
sprite.atlas = currentAtlas;
sprite.MakePixelPerfect();
}
示例5: Validate
public bool Validate(UIAtlas atlas)
{
if (atlas == null)
{
return false;
}
if (!this.mIsValid)
{
if (string.IsNullOrEmpty(this.spriteName))
{
return false;
}
this.mSprite = (atlas == null) ? null : atlas.GetSprite(this.spriteName);
if (this.mSprite != null)
{
Texture texture = atlas.texture;
if (texture == null)
{
this.mSprite = null;
}
else
{
this.mUV = new Rect((float) this.mSprite.x, (float) this.mSprite.y, (float) this.mSprite.width, (float) this.mSprite.height);
this.mUV = NGUIMath.ConvertToTexCoords(this.mUV, texture.width, texture.height);
this.mOffsetX = this.mSprite.paddingLeft;
this.mOffsetY = this.mSprite.paddingTop;
this.mWidth = this.mSprite.width;
this.mHeight = this.mSprite.height;
this.mAdvance = this.mSprite.width + (this.mSprite.paddingLeft + this.mSprite.paddingRight);
this.mIsValid = true;
}
}
}
return (this.mSprite != null);
}
示例6: Load
static void Load ()
{
mLoaded = true;
mPartial = EditorPrefs.GetString("NGUI Partial");
mFontName = EditorPrefs.GetString("NGUI Font Name");
mAtlasName = EditorPrefs.GetString("NGUI Atlas Name");
mFontData = GetObject("NGUI Font Asset") as TextAsset;
mFontTexture = GetObject("NGUI Font Texture") as Texture2D;
mFont = GetObject("NGUI Font") as UIFont;
mAtlas = GetObject("NGUI Atlas") as UIAtlas;
mAtlasPadding = EditorPrefs.GetInt("NGUI Atlas Padding", 1);
mAtlasTrimming = EditorPrefs.GetBool("NGUI Atlas Trimming", true);
mAtlasPMA = EditorPrefs.GetBool("NGUI Atlas PMA", true);
mUnityPacking = EditorPrefs.GetBool("NGUI Unity Packing", true);
mForceSquare = EditorPrefs.GetBool("NGUI Force Square Atlas", true);
mPivot = (UIWidget.Pivot)EditorPrefs.GetInt("NGUI Pivot", (int)mPivot);
mLayer = EditorPrefs.GetInt("NGUI Layer", -1);
mDynFont = GetObject("NGUI DynFont") as Font;
mDynFontSize = EditorPrefs.GetInt("NGUI DynFontSize", 16);
mDynFontStyle = (FontStyle)EditorPrefs.GetInt("NGUI DynFontStyle", (int)FontStyle.Normal);
if (mLayer < 0 || string.IsNullOrEmpty(LayerMask.LayerToName(mLayer))) mLayer = -1;
if (mLayer == -1) mLayer = LayerMask.NameToLayer("UI");
if (mLayer == -1) mLayer = LayerMask.NameToLayer("GUI");
if (mLayer == -1) mLayer = 5;
EditorPrefs.SetInt("UI Layer", mLayer);
LoadColor();
}
示例7: NGUIImage
/// <summary>
/// Ctor
/// </summary>
/// <param name="source">src attribute from img tag</param>
/// <param name="fps">fps attribute from img tag</param>
public NGUIImage(string source, int fps) {
if ("#time".Equals(source, StringComparison.InvariantCultureIgnoreCase)) {
isTime = true;
timeFont = HtEngine.Device.LoadFont("code", 16, false, false, 0, 0);
} else {
string atlasName = source.Substring(0, source.LastIndexOf(':'));
spriteName = source.Substring(source.LastIndexOf(':') + 1);
isAnim = fps >= 0;
FPS = fps;
if (HtEngine.m_loadRes != null)
{
UnityEngine.GameObject _asset = HtEngine.m_loadRes(atlasName) as UnityEngine.GameObject;
if (_asset != null)
{
uiAtlas = _asset.GetComponent<UIAtlas>();
}
}
else
{
uiAtlas = Resources.Load(atlasName, typeof(UIAtlas)) as UIAtlas;
}
if (uiAtlas == null)
{
Debug.LogWarning("Could not load html image atlas from " + atlasName + ":" + spriteName);
}
}
}
示例8: VerifyValidAtlas
public bool VerifyValidAtlas(UIAtlas atlas)
{
if (atlas == currentCurrencyIcon.atlas)
return true;
else
return false;
}
示例9: CheckIfRelated
public static bool CheckIfRelated(UIAtlas a, UIAtlas b)
{
if ((a == null) || (b == null))
{
return false;
}
return (((a == b) || a.References(b)) || b.References(a));
}
示例10: init
/// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void init()
{
atlas_tile = Resources.Load<UIAtlas> (GameCon.basePipeAtlasPath);
atlas_bgTiles = Resources.Load<UIAtlas> ("Atlases/BackgroundTiles");
atlas_clockTiles = Resources.Load<UIAtlas> ("Atlases/TopClockTiles");
atlas_counterTiles = Resources.Load<UIAtlas> ("Atlases/TopCounterTiles");
atlas_textTiles = Resources.Load<UIAtlas> ("Atlases/TopTextTiles");
}
示例11: Add
/// <summary>
/// Add a sprite appropriate for the specified atlas sprite.
/// It will be a UISlicedSprite if the sprite has an inner rect, and a regular sprite otherwise.
/// </summary>
public static UISprite Add(GameObject go, UIAtlas atlas, string spriteName)
{
UIAtlas.Sprite sp = (atlas != null) ? atlas.GetSprite(spriteName) : null;
UISprite sprite = (sp == null || sp.inner == sp.outer) ? NGUITools.AddWidget<UISprite>(go) : (UISprite)NGUITools.AddWidget<UISlicedSprite>(go);
sprite.atlas = atlas;
sprite.spriteName = spriteName;
return sprite;
}
示例12: Set
public static void Set(UIAtlas atlas, string sprite)
{
if (UICursor.instance != null && UICursor.instance.mSprite)
{
UICursor.instance.mSprite.atlas = atlas;
UICursor.instance.mSprite.spriteName = sprite;
UICursor.instance.mSprite.MakePixelPerfect();
UICursor.instance.Update();
}
}
示例13: Set
/// <summary>
/// Override the cursor with the specified sprite.
/// </summary>
static public void Set(UIAtlas atlas, string sprite)
{
if (instance != null && instance.currentSprite)
{
instance.currentSprite.atlas = atlas;
instance.currentSprite.spriteName = sprite;
//instance.currentSprite.MakePixelPerfect();
instance.Update();
}
}
示例14: Show
/// <summary>
/// 鏂板閫夋嫨绮剧伒 淇敼锛氭睙蹇楃ゥ 2013銆?4銆?4
/// </summary>
/// <param name="atlas"></param>
/// <param name="selectedSprite"></param>
/// <param name="callback"></param>
public static void Show(UIAtlas atlas, string selectedSprite, SpriteArrayCallback callback, int ArrayID)
{
SpriteSelector comp = ScriptableWizard.DisplayWizard<SpriteSelector>("Select a Sprite");
comp.mAtlas = atlas;
comp.mSprite = null;
comp.mName = selectedSprite;
comp.mCallback = comp.OnSelectSpriteCallBackFuntion;
comp.mArrayCallBack = callback;
comp.SpriteID = ArrayID;
}
示例15: Set
/// <summary>
/// Override the cursor with the specified sprite.
/// </summary>
public static void Set(UIAtlas atlas, string sprite)
{
if (mInstance != null)
{
mInstance.mSprite.atlas = atlas;
mInstance.mSprite.spriteName = sprite;
mInstance.mSprite.MakePixelPerfect();
mInstance.Update();
}
}