当前位置:网站首页>(12) Interactive component selectable
(12) Interactive component selectable
2022-06-12 08:59:00 【81192_ csdn】
List of articles
1. Preface
Just briefly unity Interactive components of Selectable, This component is the base class for all component interactions , That is, it realizes the mouse hover、 Click on 、 The state of departure and other events . yes button、toggle、slider And so on , Relatively simple .
2. Realization
It's easier to implement , That is, simply inherit some event interfaces ( Such as IPointerDownHandler), Then get the event , Deal with different logic according to events . This component looks more complex (1000+ Lines of code ), To deal with some special situations , The more complex functions are the following two :
1、Transition The choice of , That is, different forms of expression are selected according to their different values .
2、 Receive the father CanvasGroup Control of . This function is inherited UIBehavior Get listening , Then do logical processing , such as CanvasGroup How to deal with the replacement :
protected override void OnCanvasGroupChanged()
{
// Figure out if parent groups allow interaction
// If no interaction is alowed... then we need
// to not do that :)
var groupAllowInteraction = true;
Transform t = transform;
while (t != null)
{
t.GetComponents(m_CanvasGroupCache);
bool shouldBreak = false;
for (var i = 0; i < m_CanvasGroupCache.Count; i++)
{
// if the parent group does not allow interaction
// we need to break
if (!m_CanvasGroupCache[i].interactable)
{
groupAllowInteraction = false;
shouldBreak = true;
}
// if this is a 'fresh' group, then break
// as we should not consider parents
if (m_CanvasGroupCache[i].ignoreParentGroups)
shouldBreak = true;
}
if (shouldBreak)
break;
t = t.parent;
}
if (groupAllowInteraction != m_GroupsAllowInteraction)
{
m_GroupsAllowInteraction = groupAllowInteraction;
OnSetProperty();
}
}
3. Last
This class is simple , If we define components by ourselves, we can simply inherit relevant interfaces to implement our own logic ,unity Of selectable Also to achieve “unity type ” Of ui And definition .
边栏推荐
- Analysis of 43 cases of MATLAB neural network: Chapter 7 regression of RBF Network -- Realization of nonlinear function regression
- Set up redis sentinel cluster (instance):
- MFS详解(四)——MFS管理服务器安装与配置
- 2022.6.11-----leetcode.926
- [data storage] storage of floating point data in memory
- 最少换乘次数
- Background position - mixed units
- [GUI development] browsing function implementation model of image processing software
- Chapter VI - procedures with multiple segments
- Loading circling effect during loading
猜你喜欢
![(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit](/img/c1/d56ec09663857afa52f20848aeadac.png)
(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit

Popular understanding of time domain sampling and frequency domain continuation

torch. logical_ And() method

解压缩zip文件的工具类

Background location case II

Use NVM to dynamically adjust the nodejs version to solve the problem that the project cannot be run and packaged because the node version is too high or too low

机器学习笔记 - 循环神经网络备忘清单

The database doesn't know what went wrong
![[compilation principle] understand BNF](/img/64/9a0e7507606781336fdc44116ba423.jpg)
[compilation principle] understand BNF

Chapter 8 - two basic problems of data processing
随机推荐
Implementing architecture caching in MySQL under redis server environment
Random acquisition of 4-digit non repeated verification code
(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit
Analysis of 43 cases of MATLAB neural network: Chapter 7 regression of RBF Network -- Realization of nonlinear function regression
【无标题】Task3 多路召回
UMI packaging and subcontracting, and compressing to gzip
Method to limit the input box to only numbers
动态线段树leetcode.699
Background fixing effect
[open source project] easycmd command graphical software
QT realizes multi screen and multi-resolution adaptation
机器学习笔记 - 循环神经网络备忘清单
(node:22344) [DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permit
MFS详解(四)——MFS管理服务器安装与配置
Xshell startup encountered "unable to continue code execution because mfc110.dll cannot be found"
2024. maximum difficulty of the exam - sliding window
(十二)交互组件Selectable
【字符集八】char8_t、char16_t、char32_t、wchar、char
Get last month, current time and next month
Background color translucent