unity战斗卡牌视频教程 第一课 - NGUI基础组件使用及代码修改获取【补录】
前言
这一课为补录教程。之前第一课舍弃。大家有兴趣也可以去看下。
本节主要讲了NGUI的导入。
1.常用组件如UILabel UIsprite UITexture的使用及代码获取并修改属性设置属性内容如修改字体大小。修改颜色。赋值换图片资源等等
2.图集的打包与制作。界面搭建。
视频时长:44分钟。
脚本
using UnityEngine; using System.Collections; public class Test : MonoBehaviour { UILabel label; UISprite sprite; void Start() { label = gameObject.GetComponent<UILabel>(); label.text = "Hello world!"; label.color = Color.red; label.alpha = 0.5f; label.depth = 1; label.effectStyle = UILabel.Effect.Shadow; label.effectColor = Color.yellow; sprite = transform.Find("Sprite").GetComponent<UISprite>(); sprite.spriteName = "74"; sprite.pivot = UIWidget.Pivot.BottomLeft; } void Update() { } }
教程下载地址
系列教程目录汇总:http://www.bobsong.net/886.html