本文整理汇总了C#中UnityEngine.UI.Image.SetNativeSize方法的典型用法代码示例。如果您正苦于以下问题:C# Image.SetNativeSize方法的具体用法?C# Image.SetNativeSize怎么用?C# Image.SetNativeSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.UI.Image
的用法示例。
在下文中一共展示了Image.SetNativeSize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildObject
private void BuildObject()
{
imageObjectContainer = CreateChild<Transform>("container");
imageObject = CreateChild<Image>("bar", imageObjectContainer);
imageObject.sprite = spriteObject.sprite;
imageObject.SetNativeSize();
}
示例2: InitialiseText
void InitialiseText()
{
// Creates the game text holder in bottom left hand corner
TextHolder = (Instantiate(TextHolder, new Vector3(0,0,0), Quaternion.Euler(new Vector3()))) as Image;
TextHolder.transform.SetParent(this.transform, false);
TextHolder.rectTransform.anchorMax = new Vector2(0,0);
TextHolder.rectTransform.anchorMin = new Vector2(0,0);
TextHolder.rectTransform.anchoredPosition = new Vector2(240,45);
TextHolder.rectTransform.anchorMin = new Vector2(0,0);
TextHolder.SetNativeSize();
// Create the text itself
Texty = (Instantiate(Texty, new Vector3(0,0,0), Quaternion.Euler(new Vector3()))) as Text;
Texty.transform.SetParent(TextHolder.transform, false);
Texty.rectTransform.anchorMax = new Vector2(0,0);
Texty.rectTransform.anchorMin = new Vector2(0,0);
Texty.rectTransform.anchoredPosition = new Vector2(226,75);
}
示例3: Init
public override void Init(ObjectInfo infoo)
{
ImageInfo info = (ImageInfo)infoo;
//load image
GameObject go = Resources.Load<GameObject>(Settings.Instance.PREFAB_PATH + "Image");
go = GameObject.Instantiate(go);
//set tag
go.layer = Settings.Instance.ACTOR_LAYER;
//set name
go.name = info.ObjName;
//add Image
_image = go.GetComponent<Image>();
Sprite sp = Resources.Load<Sprite>(info.Path + info.Name);
if (sp)
{
_image.sprite = sp;
_image.SetNativeSize();
}
else
{
Debug.LogFormat("Actor: {0} not found", info.Path + info.Name);
}
_transform = go.GetComponent<RectTransform>();
//set local position
_transform.anchorMin = Vector2.zero;
_transform.anchorMax = Vector2.zero;
//set parent
_transform.SetParent(Settings.ActorRoot, true);
//set position and scale
_transform.anchoredPosition = info.Position;
_transform.localScale = new Vector3(info.Scale, info.Scale, info.Scale);
go.SetActive(false);
this.Go = go;
IsEnterScene = false;
}
示例4: set_icon
public static void set_icon(Image img,string name)
{
img.overrideSprite = ResourceManager.Load<Sprite>(name);
img.SetNativeSize();
}
示例5: ImgSet
void ImgSet(Image img, Sprite spr, bool enbled)
{
img.sprite = spr;
img.SetNativeSize();
img.enabled = enabled;
}
示例6: BuildBurnBar
private void BuildBurnBar()
{
imageBurn = CreateChild<Image>("burn_bar");
imageBurn.type = Image.Type.Sliced;
imageBurn.sprite = imageBurn.sprite ?? spriteBar;
imageBurn.SetNativeSize();
// imageBurn.growDirection = growDirection;
}
示例7: BuildBar
private void BuildBar()
{
imageBar = CreateChild<Image>("bar");
imageBar.type = Image.Type.Sliced;
imageBar.sprite = spriteBar;
imageBar.SetNativeSize();
// imageBar.growDirection = growDirection;
// imageBar.readable = true;
}
示例8: Init
public override void Init(ObjectInfo infoo)
{
ImageInfo info = (ImageInfo)infoo;
//load image
GameObject go = Resources.Load<GameObject>(Settings.PREFAB_PATH + "Image");
go = GameObject.Instantiate(go);
//set tag
go.layer = Settings.ACTOR_LAYER;
//set name
go.name = info.ObjName;
//add Image
_image = go.GetComponent<Image>();
Sprite sp = Resources.Load<Sprite>(info.Path + info.Name);
if (sp)
{
_image.sprite = sp;
}
else
{
Debug.LogFormat("Actor: {0} not found", info.Path + info.Name);
}
Transform t = go.transform;
//set parent
t.SetParent(Settings.ActorRoot, true);
//set position and scale
t.position = info.Position;
t.localScale = new Vector3(info.Scale, info.Scale, info.Scale);
//set image origin size
_image.SetNativeSize();
//set image size
go.SetActive(false);
this.Go = go;
}
示例9: TurnVisible
private void TurnVisible(Image img, BuildingBlockInfo info)
{
if (img.sprite)
return;
//Hard-coded because there are only three materials. Oooh bad coding practice ~(°O°~)
img.sprite = info.woodIcon;
img.SetNativeSize();
if (img.sprite)
return;
img.sprite = info.iceIcon;
img.SetNativeSize();
if (img.sprite)
return;
img.sprite = info.stoneIcon;
img.SetNativeSize();
if (img.sprite)
return;
}