GUI 组件
IUIAnimation
IUIAnimator
IUIButton
IUICanvasGroup
IUIDragInside
IUIDropdown
IUIGameObject
IUIIconEffect
IUIImage
IUIInputField
IUIModelImage
IUIPressButton
IUIRawImage
IUIScrollbar
IUIScrollSystem
IUISlider
IUISpriteSelector
IUITabGroup
IUIText
IUIToggle
IUIToggleGroup
IUIAnimation
Play(animName, callback)
- Description
- Params
- animName
string
: 动画名称
- callback
function
: 动画播放结束回调
- Return
Stop(invokeCallBack)
- Description
- Params
- invokeCallBack
bool
: 停止动画后时候执行回调
- Return
IUIAnimator
GetFloat(nameOrId)
- Description
- Params
- nameOrId
string or int
: name or id
- Return
SetFloat(nameOrId,value)
- Description
- Params
- nameOrId
string or int
: name or id
- value
float
: float值
- Return
GetBool(nameOrId)
- Description
- Params
- nameOrId
string or int
: name or id
- Return
SetBool(nameOrId,value)
- Description
- Params
- nameOrId
string or int
: name or id
- value
bool
: bool值
- Return
GetInteger(nameOrId)
- Description
- Params
- nameOrId
string or int
: name or id
- Return
SetInteger(nameOrId,value)
- Description
- Params
- nameOrId
string or int
: name or id
- value
bool
: int值
- Return
SetTrigger(nameOrId)
- Description
- 通过name或者id激活动画触发器,使得动画控制器的状态机中的流程发生变化.
- Params
- nameOrId
string or int
: name or id
- Return
ResetTrigger(nameOrId)
- Description
- Params
- nameOrId
string or int
: name or id
- Return
IUIButton
SetInteractable(state)
- Description
- Params
- Return
GetInteractable()
- Description
- Params
- Return
OnClick()
- Description
- 监听Button的单击事件.单击按钮时触发回调.
- 回调无返回值,function() end.
- Params
- Return
RemoveAllClick()
- Description
- Params
- Return
GetTextValue()
- Description
- 获取button子控件中名字为
Text
的文本控件的文本内容.
- Params
- Return
SetTextValue(txt)
- Description
- 设置button子控件中名字为
Text
的文本控件的文本内容.
- Params
- Return
GetTextColor()
- Description
- 获得button子控件中名字为
Text
的文本控件的颜色.
- Params
- Return
SetTextColor(color)
- Description
- 设置button子控件中名字为
Text
的文本控件的颜色.
- Params
- Return
GetSprite(sprite)
- Description
- 获取image Component的sprite.
- Params
- Return
SetSprite(sprite)
- Description
- 设置image Component的sprite.
- Params
- Return
GetImgColor()
- Description
- Params
- Return
SetImgColor(color)
- Description
- Params
- Return
SetImgColorAlpha(alpha)
- Description
- Params
- Return
IUICanvasGroup
SetGroupAlpha(alpha)
- Description
- Params
- Return
GetGroupAlpha()
- Description
- Params
- Return
SetInteractable(interactable)
- Description
- Params
- Return
GetInteractable()
- Description
- Params
- Return
SetBlocksRaycasts(blocksRaycasts)
- Description
- Params
- Return
GetBlocksRaycasts()
- Description
- Params
- Return
SetIgnoreParentGroups(ignoreParentGroups)
- Description
- Params
- Return
GetIgnoreParentGroups()
- Description
- Params
- Return
IUIDragInside
AddEndDragEvent(func)
- Description
- 监听拖拽结束事件.
- 拖拽结束调用回调并返回PointerEventData数据,function(data) end.
- Params
- Return
IUIDropdown
GetValue()
- Description
- Params
- Return
SetValue(value)
- Description
- Params
- Return
ClearOptions()
- Description
- Params
- Return
AddOptions(args)
- Description
- 根据字符串列表将多个纯文本选项添加到下拉菜单的选项中.
- Params
- Return
AddDropDownValueChanged(callFunc)
- Description
- 监听选项改变事件,在选项更改后执行回调.
- 回调返回选项index,function(index) end.
- Params
- Return
AddDropDownOptionDatas(names,sprites)
- Description
- 根据字符串列表和Sprite列表将选项添加到下拉菜单的选项中.
- Params
- names
string[]
- sprites
Sprite[]
- Return
SetDropDownOption(selectid,data)
- Description
- Params
- selectid
int
- data
table
: {text(type:string),image(type:Sprite)}
- Return
GetDropDownOptionText(selectid)
- Description
- Params
- Return
IUIGameObject
AddClickEvent(func)
- Description
- 监听点击事件,单击这个gameObject后执行回调.
- 回调返回点击的gameObject对象,function(gameObject) end.
- Params
- Return
RemoveClickEvent()
- Description
- Params
- Return
IUIIconEffect
SetEffect(type)
- Description
- 设置当前控件效果,type值是在UISetting里IconEffectDataList的配置.
- 返回值表示当前操作是否成功.
- Params
- Return
SetSprite(sprite)
- Description
- Params
- Return
IUIImage
GetColor()
- Description
- Params
- Return
SetColor(color)
- Description
- Params
- Return
SetColorAlpha(alpha)
- Description
- Params
- Return
GetSprite()
- Description
- Params
- Return
GetOriginSprite()
- Description
- Params
- Return
SetSprite(sprite)
- Description
- Params
- Return
SetMaterial(material)
- Description
- Params
- Return
GetMaterial()
- Description
- Params
- Return
GetRaycastTargetState()
- Description
- Params
- Return
SetRaycastTargetState(raycastTarget)
- Description
- Params
- Return
SetFillAmount(amount)
- Description
- 设置image显示的百分比,需要ImageType为Filled.
- Params
- Return
GetFillAmount()
- Description
- 获取当前image显示的百分比,需要ImageType为Filled.
- Params
- Return
DoFillAmountAnimation(from,to,duration)
- Description
- 播放填充图片显示百分比动画.
- 平滑的从from到to的动画持续时间为duration.
- from、to的取值范围是0~1.
- Params
- from
float
- to
float
- duration
float
- Return
StopFillAmountAnimation()
- Description
- Params
- Return
SetNativeSize()
- Description
- Params
- Return
IUIInputField
GetValue()
- Description
- Params
- Return
SetValue(value)
- Description
- Params
- Return
MoveTextEnd()
- Description
- Params
- Return
MoveTextPosition(caretPos)
- Description
- Params
- Return
GetCaretPosition()
- Description
- Params
- Return
SetCaretPosition(pos)
- Description
- Params
- Return
SetPlaceHolderText(value)
- Description
- Params
- Return
GetPlaceHolderText()
- Description
- Params
- Return
AddEndEditEvent(func)
- Description
- 添加输入结束事件.
- 事件回调返回当前输入框文本内容.
- Params
- Return
- Description
- Params
- Return
OnInputValueChanged(func)
- Description
- 添加输入内容变化事件.
- 事件回调返回当前输入框文本内容.
- Params
- Return
RemoveAllInputValueChanged()
- Description
- Params
- Return
ClearInputFieldEvent()
- Description
- Params
- Return
ActiveInputField(active)
- Description
- active为true,激活该控件,可以处理事件.
- active为false,使控件实现,将不处理任何事件.
- Params
- Return
SetReadOnly(readonly)
- Description
- 设置只读只允许文本的高亮显示,而不允许通过键盘进行修改.
- Params
- Return
IUIModelImage
SetModel(modelView,parentName)
- Description
- 设置3D模型在ui上显示.
- modelView是需要显示的模型实例,parentName可以为空,如果不为空将会去ModelSceneRoot下去查找这个名字的gameObject.
- 如果parentName的gameObject存在将作为modelView的父级,否则ModelSceneRoot将作为modelView的父级.
- Params
- modelView
GameObject
- parentName
string
- Return
IUIPressButton
OnPointerDown(fun)
- Description
- 监听button的按下事件.
- 按下时执行回调,回调返回PointerEventData数据.
- Params
- Return
OnPointerUp(fun)
- Description
- 监听button的抬起事件.
- 抬起时执行回调,回调返回PointerEventData数据.
- Params
- Return
IUIRawImage
GetColor()
- Description
- Params
- Return
SetColor(color)
- Description
- Params
- Return
GetTexture()
- Description
- Params
- Return
SetTexture(texture)
- Description
- Params
- Return
GetMaterial()
- Description
- Params
- Return
SetMaterial(material)
- Description
- Params
- Return
IUIScrollbar
SetValue(value)
- Description
- Params
- Return
SetSize(value)
- Description
- 设置滚动条滑块的大小,取值范围0~1(其中1表示填充整个滚动条).
- Params
- Return
GetSize(value)
- Description
- Params
- Return
IUIScrollSystem
Add(name, data)
- Description
- 添加一个目标为name的item和数据,返回一个唯一id.
- 这个返回的id将作为后面能直接查询和操作这个item或data的唯一办法.
- 如果目标name在这个组件下,则直接克隆它,否则将会尝试加载外部prefab.
- Params
- Return
Insert(handle,prefabName,data)
- Description
- 将一个item插入在handle(id)之前.
- 返回新item的id.
- Params
- handle
int
- prefabName
string
- data
table
- Return
Set(handle,data)
- Description
- 更新handle对应的item的数据.
- data如果为空那仅仅是刷新,如果有值将覆盖源数据.
- Params
- Return
Get(handle)
- Description
- Params
- Return
Remove(handle)
- Description
- Params
- Return
Clear()
- Description
- Params
- Return
ScrollTo(handle,bUseAnim)
- Description
- 滚动到对应的item上.
- 可以选择滚动过程是否使用动画.
- Params
- Return
ScrollToBegin(bUseAnim)
- Description
- Params
- Return
ScrollToEnd(bUseAnim)
- Description
- Params
- Return
OnBeginDrag(func)
- Description
- 监听拖动开始事件.
- 拖动开始是执行回调,返回PointerEventData数据.
- Params
- Return
OnDrag(func)
- Description
- 监听拖动中事件.
- 拖动开始是执行回调,返回PointerEventData数据.
- Params
- Return
OnEndDrag(func)
- Description
- 监听拖动结束事件.
- 拖动开始是执行回调,返回PointerEventData数据.
- Params
- Return
SetScrollDirection(isHorOrVer)
- Description
- 设置滚动反向.
- true为水平方向,false为垂直方向.
- Params
- Return
IUISlider
SetValue(value)
- Description
- Params
- Return
GetValue()
- Description
- Params
- Return
SetMaxValue(value)
- Description
- Params
- Return
SetMinValue(value)
- Description
- Params
- Return
OnValueChanged(fun)
- Description
- Params
- Return
RemoveSliderListener()
- Description
- Params
- Return
SetInteractable(state)
- Description
- Params
- Return
SetFillColor(color)
- Description
- Params
- Return
IUISpriteSelector
SetSpriteByIndex(index)
- Description
- Params
- Return
SetSpriteByName(name)
- Description
- Params
- Return
IUITabGroup
GetActiveIndex()
- Description
- Params
- Return
SetIndex(index, panelName)
- Description
- Params
- index
int
- panelName
string
- Return
SwitchTabOn(index)
- Description
- Params
- Return
IUIText
GetColor()
- Description
- Params
- Return
SetColor(color)
- Description
- Params
- Return
SetColorAlpha(alpha)
- Description
- Params
- Return
SetTextValue(info)
- Description
- Params
- Return
GetTextValue(info)
- Description
- Params
- Return
GetRaycastTargetState()
- Description
- Params
- Return
SetRaycastTargetState(raycastTarget)
- Description
- Params
- Return
SetOutlineGraphicAlpha(useGraphicAlpha)
- Description
- Params
- Return
GetOutlineGraphicAlpha()
- Description
- Params
- Return
SetOutlineEffectColor(effectColor)
- Description
- Params
- Return
GetOutlineEffectColor()
- Description
- Params
- Return
GetOutlineEffectDistance()
- Description
- Params
- Return
SetOutlineEffectDistance(effectDistance)
- Description
- Params
- Return
GetPreferredWidth()
- Description
- Params
- Return
GetPreferredHeight()
- Description
- Params
- Return
SetFontStyle(style)
- Description
- Params
- Return
GetFontStyle()
- Description
- Params
- Return
SetFontSize(size)
- Description
- Params
- Return
GetFontSize()
- Description
- Params
- Return
SetMaterial(material)
- Description
- Params
- Return
IUIToggle
GetTextValue()
- Description
- Params
- Return
SetTextValue(txt)
- Description
- Params
- Return
GetTextColor()
- Description
- Params
- Return
SetTextColor(color)
- Description
- Params
- Return
GetImageColor()
- Description
- 获取子控件名字为Image的Image控件的颜色.
- Params
- Return
SetImageColor(color)
- Description
- 设置子控件名字为Image的Image控件的颜色.
- Params
- Return
SetToggleState(isOn)
- Description
- 设置组件的开关状态.
- 如果在设置之前监听了开关状态切换事件,那设置之后该事件也会触发执行.
- Params
- Return
GetToggleState()
- Description
- Params
- Return
OnStateChanged(fun)
- Description
- 监听开关状态改变的事件.
- 事件执行回调返回当前开关状态function(isOn) end.
- Params
- Return
RemoveAllStateChanged()
- Description
- Params
- Return
SetInteractable(state)
- Description
- Params
- Return
GetInteractable()
- Description
- Params
- Return
IUIToggleGroup
AddToggleEvent(callback)
- Description
- 监听组内Toggle开关状态切换事件.
- 事件触发回调返回toggle的开关状态及toggle在组内的下标,function(isOn,idx) end.
- Params
- Return
SetAllTogglesOff()
- Description
- 将组内所有toggle开关状态全置为false,且通知给每个toggle状态改变的消息.
- Params
- Return
SwitchToggleIndex(index)
- Description
- 切换组内下标为index的toggle为选中状态.
- Params
- Return
SwitchAllowSwitchOff(isOn)
- Description
- isOn为true表示组内toggle可以全部是关闭状态.
- isOn为false表示组内toggle至少有一个是选中状态.
- Params
- Return