本文整理汇总了C#中UISprite.SetDimensions方法的典型用法代码示例。如果您正苦于以下问题:C# UISprite.SetDimensions方法的具体用法?C# UISprite.SetDimensions怎么用?C# UISprite.SetDimensions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UISprite
的用法示例。
在下文中一共展示了UISprite.SetDimensions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
void Start()
{
m_sprite = GetComponent<UISprite>();
Vector3 size = new Vector3(Screen.width, Screen.height, 1);
m_sprite.SetDimensions((int)size.x, (int)size.y);
}
示例2: Start
void Start()
{
m_sprite = GetComponent<UISprite>();
m_width = UISetup.Instance.m_background_width;
m_height = UISetup.Instance.m_background_heght;
m_sprite.SetDimensions(m_width, m_height);
}
示例3: CreateImage
//UISprite CreateByIndex(int _index)
//{
// UISprite sprite;
// Debug.Log("AtlasSpr/" + SpriteSingleton.I.Sprite[_index, 1] + "spr");
// atlas = Resources.Load("AtlasSpr/" + SpriteSingleton.I.Sprite[_index, 1] + "Spr") as GameObject;
//
// sprite = (Instantiate(atlas) as GameObject).GetComponent<UISprite>();
// sprite.transform.parent = uiRoot.transform;
// sprite.spriteName = SpriteSingleton.I.Sprite[_index, 2];
//
// sprite.transform.localScale = Vector3.one;
//
// sprite.transform.localPosition = new Vector3(float.Parse(SpriteSingleton.I.Sprite[_index, 5]),
// float.Parse(SpriteSingleton.I.Sprite[_index, 6]), float.Parse(SpriteSingleton.I.Sprite[_index, 7]));
//
//
// //sprite.localSize.Set(float.Parse(SpriteSingleton.I.Sprite[_index, 3]),
// // float.Parse(SpriteSingleton.I.Sprite[_index, 4]));
// sprite.SetDimensions(int.Parse(SpriteSingleton.I.Sprite[_index, 3]),
// int.Parse(SpriteSingleton.I.Sprite[_index, 4]));
// return sprite;
//}
UISprite CreateImage(int _index)
{
for(int i=0;i<29;i++)
{
Debug.Log("AtlasSpr/" + SpriteSingleton.I.Sprite[i, i] + "spr");
atlas = Resources.Load("AtlasSpr/" + SpriteSingleton.I.Sprite[1, i] + "spr") as GameObject;
sprite = (Instantiate(atlas) as GameObject).GetComponent<UISprite>();
sprite.transform.parent = uiRoot.transform;
sprite.spriteName = SpriteSingleton.I.Sprite[2, i];
sprite.transform.localScale = Vector3.one;
sprite.transform.localPosition = new Vector3(float.Parse(SpriteSingleton.I.Sprite[5, i]),
float.Parse(SpriteSingleton.I.Sprite[6, i]), float.Parse(SpriteSingleton.I.Sprite[7, i]));
sprite.SetDimensions(int.Parse(SpriteSingleton.I.Sprite[3, i]),
int.Parse(SpriteSingleton.I.Sprite[4, i]));
}
return sprite;
}