当前位置: 首页>>代码示例>>C#>>正文


C# Image.SetNativeSize方法代码示例

本文整理汇总了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();
        }
开发者ID:2757777,项目名称:comiket,代码行数:8,代码来源:TransformRendererUGUI.cs

示例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);
    }
开发者ID:mcoirad,项目名称:ShadowsofAton,代码行数:18,代码来源:UIController.cs

示例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;
        }
开发者ID:weimingtom,项目名称:SVNovelEngine,代码行数:47,代码来源:ActorObject.cs

示例4: set_icon

 public static void set_icon(Image img,string name)
 {
     img.overrideSprite = ResourceManager.Load<Sprite>(name);
     img.SetNativeSize();
 }
开发者ID:GaoKaiHaHa,项目名称:MyUnityFrameWork,代码行数:5,代码来源:UGUITool.cs

示例5: ImgSet

 void ImgSet(Image img, Sprite spr, bool enbled)
 {
     img.sprite = spr;
     img.SetNativeSize();
     img.enabled = enabled;
 }
开发者ID:tpghks98,项目名称:Pjdo,代码行数:6,代码来源:ShowNumber.cs

示例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;
 }
开发者ID:SunriseHirame,项目名称:Arcade,代码行数:8,代码来源:SlicedRendererUGUI.cs

示例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;
 }
开发者ID:SunriseHirame,项目名称:Arcade,代码行数:9,代码来源:SlicedRendererUGUI.cs

示例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;
        }
开发者ID:funcodes,项目名称:AirGame,代码行数:44,代码来源:ActorObject.cs

示例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;
    }
开发者ID:Schadek,项目名称:SlingShooter,代码行数:21,代码来源:BuildingBlockMenu.cs


注:本文中的UnityEngine.UI.Image.SetNativeSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。