NGUI所见即所得之UICamera

Unity NGUI UICamera总结 阅读详情

http://dsqiu.iteye.com/blog/1971866


 UI,除了界面的显示,还有一个重要的元素:事件响应。MoneBehaviour提供一些事件提供了一些函数接口(OnMouseUp,OnMouseDown等),只要MonBehaviour的子类实现这相应的方法以及方法执行的条件达到,Unity底层就会分发调用执行这个函数。一般地,UI事件响应处理机制会有4个基本元素:

 

      1.event object:事件对象,即当前事件的类型,如鼠标左键按下等。

      2.event source:事件源,或事件的触发器,比如说,鼠标左键单击点击一个button,那么button就是event source,鼠标左键单击就是event source。

      3.event handle:事件处理方法。

      4.event listener:事件的监听,比如上面说的鼠标左键点击一个button,event listener就是监听打button的一个mouse click事件,然后分发调用对应的event handle进行处理。

 

        一般event source不会单独存在,经常会跟event handle绑定在一起,其实就是指定了不同的event handle就是不同event source,如Button就有单击双击事件,Input就有输入焦点事件,event listener就好像人的大脑,监控这个所有的事件,同时作出不同的响应。

     NGUI自己组织了一套UI事件响应处理机制, 不是对MonoBehaviour的方法的封装调用,UICamera就是NGUI框架中的event listener,原理很简单:在Update中捕获鼠标,键盘等设备的输入(也可以狭义的认为UICamera就是event listener),判断不同event object 和event source,然后“广播”分发执行event handle,下面附上分发的函数:

C#代码  收藏代码
  1. /// <summary>  
  2. /// Generic notification function. Used in place of SendMessage to shorten the code and allow for more than one receiver.  
  3. /// </summary>  
  4.   
  5. static public void Notify (GameObject go, string funcName, object obj)  
  6. {  
  7.     if (go != null)  
  8.     {  
  9.         go.SendMessage(funcName, obj, SendMessageOptions.DontRequireReceiver);  
  10.   
  11.         if (genericEventHandler != null && genericEventHandler != go)  
  12.         {  
  13.             genericEventHandler.SendMessage(funcName, obj, SendMessageOptions.DontRequireReceiver);  
  14.         }  
  15.     }  
  16. }  

       知道的谁是event listener,那要怎么实现event handle。实现NGUI的事件的方法有很多种,③给了三种方式监听NGUI的事件方法。文末贴了NGUI支持的event handle。

                                                                                                                                                                                                                   增补于:11/10/2013 8:45,感觉之前的没头没尾的,就加了上面的铺垫

 

       记得刚开始用NGUI的时候,就有心思要去琢磨下UICamera,那个时候NGUI还是2.6的版本,现在已经到了3.0.3f,NGUI更新真的很强劲, 当然改动也挺大的,特性也越来越多了。之前本来研究下UICamera最后还是放弃了,因为UICamera的代码太复杂了,很凌乱,也就放下去了,这几天重新翻看了下,发现UICamera的可读性太强了,代码的组织逻辑很强,完全可以当做文本来从上到下来阅读,所以才会有这篇文章。

       UICamera做了很多有优化,新增了一些特性,之前可能觉得NGUI只是做一个工具,现在越来越完美了,少废话,下面把看到的亮点呈上。

ClickNotification

C#代码  收藏代码
  1.        /// <summary>  
  2. /// Whether the touch event will be sending out the OnClick notification at the end.  
  3. /// </summary>  
  4.   
  5. public enum ClickNotification  
  6. {  
  7.     None,  
  8.     Always,  
  9.     BasedOnDelta,  
  10. }  

       ClickNotification定义了OnClick响应的条件,后面也定义了ClickNotification变量 public ClickNotification clickNotification = ClickNotification.Always;

       ClickNotification.None: 不响应OnClick事件

       ClickNotification.Always:总是响应OnClick事件

       ClickNotification.BaseOnDelta:依据移动的delta的距离判断是否响应OnClick函数,如果移动距离大于float click  = isMouse ? mouseClickThreshold : touchClickThreshold;则不响应OnClick事件

下面这部分代码是当响应了OnDrag事件就把currentTouch.clickNotification = ClickNotification.None;就不在会响应OnClick事件了。

C#代码  收藏代码
  1.                                           bool isDisabled = (currentTouch.clickNotification == ClickNotification.None);  
  2. Notify(currentTouch.dragged, "OnDrag", currentTouch.delta);  
  3. isDragging = false;  
  4.   
  5. if (isDisabled)  
  6. {  
  7.     // If the notification status has already been disabled, keep it as such  
  8.     currentTouch.clickNotification = ClickNotification.None;  
  9. }  
  10. else if (currentTouch.clickNotification == ClickNotification.BasedOnDelta && click < mag)  
  11. {  
  12.     // We've dragged far enough to cancel the click  
  13.     currentTouch.clickNotification = ClickNotification.None;  
  14. }  

 然后再执行OnClick和OnDoubleClick事件先判断条件currentTouch.clickNotification != ClickNotification.None 是否成立:

C#代码  收藏代码
  1. // If the touch should consider clicks, send out an OnClick notification  
  2.                     if (currentTouch.clickNotification != ClickNotification.None)  
  3.                     {  
  4.                         float time = Time.realtimeSinceStartup;  
  5.   
  6.                         Notify(currentTouch.pressed, "OnClick", null);  
  7.   
  8.                         if (currentTouch.clickTime + 0.35f > time)  
  9.                         {  
  10.                             Notify(currentTouch.pressed, "OnDoubleClick", null);  
  11.                         }  
  12.                         currentTouch.clickTime = time;  
  13.                     }  

 EventType

C#代码  收藏代码
  1. public enum EventType  
  2.     {  
  3.         World,  // Perform a Physics.Raycast and sort by distance to the point that was hit.  
  4.         UI,     // Perform a Physics.Raycast and sort by widget depth.  
  5.     }  

        这个很简单就是定义当前射线和碰撞体碰撞的判断标准,如果是UI则以Depth来判断,如果是World是以实际距离来判断。

List<UICamera> list

C#代码  收藏代码
  1.        /// <summary>  
  2. /// List of all active cameras in the scene.  
  3. /// </summary>  
  4.   
  5. static public List<UICamera> list = new List<UICamera>();  

        UICamera在初始化的时候会被加入 mList这个链表中,然后对链表进行排序,根据相机的深度,深度值越小的相机排位靠前,最靠前的相机为场景的主UICamera,然后只有只有主UICamera才会去监测场景中的事件,其他的UICamera并不执行监测任务。UICamera利用Unity的Raycast去监测事件发生的对象,因为发射出去的Ray对象必须碰撞到Collider才会有反应,所以NGUI中所有需要响应事件的控件均需要添加Collider,同时Ray只会碰撞到深度最小的Collider,Ray射线的最大深度为rangeDistance,当这个值为-1时则发射深度和相机深度一样,主UICamera每一帧都会主动去发射Ray检测鼠标此时触碰到的对象并将其记录在对应的鼠标按键事件中,这是能监测到OnHover这个动作的关键(当然只有在useMouse为true时才会有此操作)。

        在游戏场景初始化阶段,每个UICamera都会根据平台义useMouse、useTouch、useKeyboard和useController 这些属性,分别对应的是能否在场景使用鼠标、触摸屏、键盘以及摇杆。

C#代码  收藏代码
  1.        public bool useMouse = true;  
  2.   
  3. public bool useTouch = true;  
  4.   
  5. public bool allowMultiTouch = true;  
  6.   
  7. public bool useKeyboard = true;  
  8.   
  9. public bool useController = true;  

 

MouseOrTouch

C#代码  收藏代码
  1.        /// <summary>  
  2. /// Ambiguous mouse, touch, or controller event.  
  3. /// </summary>  
  4.   
  5. public class MouseOrTouch  
  6. {  
  7.     public Vector2 pos;             // Current position of the mouse or touch event  
  8.     public Vector2 delta;           // Delta since last update  
  9.     public Vector2 totalDelta;      // Delta since the event started being tracked  
  10.   
  11.     public Camera pressedCam;       // Camera that the OnPress(true) was fired with  
  12.   
  13.     public GameObject current;      // The current game object under the touch or mouse  
  14.     public GameObject pressed;      // The last game object to receive OnPress  
  15.     public GameObject dragged;      // The last game object to receive OnDrag  
  16.   
  17.     public float clickTime = 0f;    // The last time a click event was sent out  
  18.   
  19.     public ClickNotification clickNotification = ClickNotification.Always;  
  20.     public bool touchBegan = true;  
  21.     public bool pressStarted = false;  
  22.     public bool dragStarted = false;  
  23. }  

       MouseOrTouch是一个很重要的类,是一个事件的结构体,然后就定义了不同平台的事件,记录Camera监测的事件:MouseOrTouch只是记录“鼠标”等的移动的“物理”信息——位置,移动距离等,只有鼠标是否按下只有在Update中每帧监测。

       下面定义不同平台的事件,例如鼠标事件,mMouse记录鼠标左键,右键和中键的事件(因为鼠标这里只记录鼠标的三个按键,所以mMouse才是有三个元素,现在明白为啥了吧)。

C#代码  收藏代码
  1.        // Mouse events  
  2. static MouseOrTouch[] mMouse = new MouseOrTouch[] { new MouseOrTouch(), new MouseOrTouch(), new MouseOrTouch() };  
  3.   
  4. // The last object to receive OnHover  
  5. static GameObject mHover;  
  6.   
  7. // Joystick/controller/keyboard event  
  8. static MouseOrTouch mController = new MouseOrTouch();  
  9.   
  10. // Used to ensure that joystick-based controls don't trigger that often  
  11. static float mNextEvent = 0f;  
  12.   
  13. // List of currently active touches  
  14. static Dictionary<int, MouseOrTouch> mTouches = new Dictionary<int, MouseOrTouch>();  

 currentTouch

C#代码  收藏代码
  1.        /// <summary>  
  2. /// ID of the touch or mouse operation prior to sending out the event. Mouse ID is '-1' for left, '-2' for right mouse button, '-3' for middle.  
  3. /// </summary>  
  4.   
  5. static public int currentTouchID = -1;  
  6.   
  7. /// <summary>  
  8. /// Current touch, set before any event function gets called.  
  9. /// </summary>  
  10.   
  11. static public MouseOrTouch currentTouch = null;  

       currentTouch这个变量是整个UICamera中控制事件监测的关键所在,记录了当前事件的触发对象和一些其他诸如position位置、dealta时间、totaldealta总时间等属性,然后用currentTouchID记录当前事件的类型,这些类型包括鼠标事件、键盘控制器事件以及触摸屏事件。

 

ProcessTouch

       ProcessTouch这个函数就是根据currentTouch来针对不同的情况响应不同的函数,被ProcessMouse,ProcessTouch和ProcessOthers调用,如ProcessMouse,分别捕获鼠标三个按键的状态,然后调用ProcessTouch来响应:

C#代码  收藏代码
  1.               // Process all 3 mouse buttons as individual touches  
  2. if (useMouse)  
  3. {  
  4.     for (int i = 0; i < 3; ++i)  
  5.     {  
  6.         bool pressed = Input.GetMouseButtonDown(i);  
  7.         bool unpressed = Input.GetMouseButtonUp(i);  
  8.   
  9.         currentTouch = mMouse[i];  
  10.         currentTouchID = -1 - i;  
  11.   
  12.         // We don't want to update the last camera while there is a touch happening  
  13.         if (pressed) currentTouch.pressedCam = currentCamera;  
  14.         else if (currentTouch.pressed != null) currentCamera = currentTouch.pressedCam;  
  15.   
  16.         // Process the mouse events  
  17.         ProcessTouch(pressed, unpressed);  
  18.     }  

『ProcessMouse分析

         因为之前版本升级到NGUI3.0.6时,UICamera出现了一个Bug:当Time.ScaleTime != 1f 的时候,事件响应有问题,当时由于时间关系,只是和之前的版本进行比对,增加了些代码解决的。但是还是感觉没有能对UICamera具体细节没能完全掌握,挺蹩脚的,还不能达到“自主”的处理目的,所以一直都想有时间好好把UICamera的事件分发流程细节清理下。

C#代码  收藏代码
  1.        /// <summary>  
  2. /// Update mouse input.  
  3. /// </summary>  
  4.   
  5. public void ProcessMouse ()  
  6. {  
  7.     // No need to perform raycasts every frame  
  8.     if (mNextRaycast < RealTime.time)     //更新鼠标current为当前的 hoveredObject,如果时间间隔小于 20毫秒,就不更新  
  9.     {  
  10.         mNextRaycast = RealTime.time + 0.02f;  
  11.         if (!Raycast(Input.mousePosition, out lastHit)) hoveredObject = fallThrough;  
  12.         if (hoveredObject == null) hoveredObject = genericEventHandler;  
  13.         for (int i = 0; i < 3; ++i) mMouse[i].current = hoveredObject;  
  14.     }  
  15.   
  16.     lastTouchPosition = Input.mousePosition;  
  17.     bool highlightChanged = (mMouse[0].last != mMouse[0].current);  
  18.     if (highlightChanged) currentScheme = ControlScheme.Mouse;  
  19.   
  20.     // Update the position and delta                  更新三个鼠标按键的位置 delta 和pos ,  
  21.     mMouse[0].delta = lastTouchPosition - mMouse[0].pos;  
  22.     mMouse[0].pos = lastTouchPosition;  
  23.     bool posChanged = mMouse[0].delta.sqrMagnitude > 0.001f;  
  24.   
  25.     // Propagate the updates to the other mouse buttons  
  26.     for (int i = 1; i < 3; ++i)      
  27.     {  
  28.         mMouse[i].pos = mMouse[0].pos;  
  29.         mMouse[i].delta = mMouse[0].delta;  
  30.     }  
  31.   
  32.     // Is any button currently pressed?  
  33.     bool isPressed = false;  
  34.   
  35.     for (int i = 0; i < 3; ++i)  
  36.     {  
  37.         if (Input.GetMouseButton(i))  
  38.         {  
  39.             currentScheme = ControlScheme.Mouse;  
  40.             isPressed = true;  
  41.             break;  
  42.         }  
  43.     }  
  44.   
  45.     if (isPressed)  
  46.     {  
  47.         // A button was pressed -- cancel the tooltip  
  48.         mTooltipTime = 0f;  
  49.     }  
  50.     else if (posChanged && (!stickyTooltip || highlightChanged))    //更新Tip显示  
  51.     {  
  52.         if (mTooltipTime != 0f)  
  53.         {  
  54.             // Delay the tooltip  
  55.             mTooltipTime = RealTime.time + tooltipDelay;  
  56.         }  
  57.         else if (mTooltip != null)  
  58.         {  
  59.             // Hide the tooltip  
  60.             ShowTooltip(false);  
  61.         }  
  62.     }  
  63.   
  64.     // The button was released over a different object -- remove the highlight from the previous  
  65.     if (!isPressed && mHover != null && highlightChanged)   //更新hover GameObject ,并分发 OnHover事件  
  66.     {  
  67.         currentScheme = ControlScheme.Mouse;  
  68.         if (mTooltip != null) ShowTooltip(false);  
  69.         Notify(mHover, "OnHover", false);  
  70.         mHover = null;  
  71.     }  
  72.   
  73.     // Process all 3 mouse buttons as individual touches   分别处理鼠标的三个按键,获取按键状态,进行事件分发  
  74.     for (int i = 0; i < 3; ++i)  
  75.     {  
  76.         bool pressed = Input.GetMouseButtonDown(i);  
  77.         bool unpressed = Input.GetMouseButtonUp(i);  
  78.   
  79.         if (pressed || unpressed) currentScheme = ControlScheme.Mouse;  
  80.   
  81.         currentTouch = mMouse[i];  
  82.         currentTouchID = -1 - i;  
  83.         currentKey = KeyCode.Mouse0 + i;  
  84.   
  85.         // We don't want to update the last camera while there is a touch happening  
  86.         if (pressed) currentTouch.pressedCam = currentCamera;  
  87.         else if (currentTouch.pressed != null) currentCamera = currentTouch.pressedCam;  
  88.   
  89.         // Process the mouse events  
  90.         ProcessTouch(pressed, unpressed);  
  91.         currentKey = KeyCode.None;  
  92.     }  
  93.     currentTouch = null;  
  94.   
  95.     // If nothing is pressed and there is an object under the touch, highlight it  
  96.     if (!isPressed && highlightChanged)  
  97.     {  
  98.         currentScheme = ControlScheme.Mouse;  
  99.         mTooltipTime = RealTime.time + tooltipDelay;  
  100.         mHover = mMouse[0].current;  
  101.         Notify(mHover, "OnHover", true);  
  102.     }  
  103.   
  104.     // Update the last value  
  105.     mMouse[0].last = mMouse[0].current;  
  106.     for (int i = 1; i < 3; ++i) mMouse[i].last = mMouse[0].last;  
  107. }  

  这次回看UICamera的代码,更加UICamera优化了很多,代码逻辑清晰简单了,之前的一直感觉很乱(一堆条件判断)才一直没有细看。虽然上面代码还是有加点注释,其实已经完全没必要了。然后在NGUI3.0.7版本还增加了 在Editor下用鼠标做屏幕Touch的操作的功能:

/// Process fake touch events where the mouse acts as a touch device.

/// Useful for testing mobile functionality in the editor.』

                                                                                                                                                                                                                    增补于 2013,12,29 15:15

其他

        UICamera还提供其他一些“特性”,能够让开发者实现更多的功能(就不解释了吧, 有注释):

C#代码  收藏代码
  1. /// <summary>  
  2.     /// If 'true', once a press event is started on some object, that object will be the only one that will be  
  3.     /// receiving future events until the press event is finally released, regardless of where that happens.  
  4.     /// If 'false', the press event won't be locked to the original object, and other objects will be receiving  
  5.     /// OnPress(true) and OnPress(false) events as the touch enters and leaves their area.  
  6.     /// </summary>  
  7.   
  8.     public bool stickyPress = true;  
  9.   
  10. /// <summary>  
  11.     /// If set, this game object will receive all events regardless of whether they were handled or not.  
  12.     /// </summary>  
  13.   
  14.     static public GameObject genericEventHandler;  
  15.   
  16.     /// <summary>  
  17.     /// If events don't get handled, they will be forwarded to this game object.  
  18.     /// </summary>  
  19.   
  20.     static public GameObject fallThrough;  

 

最后,NGUI一共支持一下事件:

 

C#代码  收藏代码
  1. void OnHover (bool isOver) – Sent out when the mouse hovers over the collider or moves away from it. Not sent on touch-based devices.  
  2. void OnPress (bool isDown) – Sent when a mouse button (or touch event) gets pressed over the collider (with ‘true’) and when it gets released (with ‘false’, sent to the same collider even if it’s released elsewhere).  
  3. void OnClick() — Sent to a mouse button or touch event gets released on the same collider as OnPress. UICamera.currentTouchID tells you which button was clicked.  
  4. void OnDoubleClick () — Sent when the click happens twice within a fourth of a second. UICamera.currentTouchID tells you which button was clicked.  
  5. void OnSelect (bool selected) – Same as OnClick, but once a collider is selected it will not receive any further OnSelect events until you select some other collider.  
  6. void OnDrag (Vector2 delta) – Sent when the mouse or touch is moving in between of OnPress(true) and OnPress(false).  
  7. void OnDrop (GameObject drag) – Sent out to the collider under the mouse or touch when OnPress(false) is called over a different collider than triggered the OnPress(true) event. The passed parameter is the game object of the collider that received the OnPress(true) event.  
  8. void OnInput (string text) – Sent to the same collider that received OnSelect(true) message after typing something. You likely won’t need this, but it’s used by UIInput  
  9. void OnTooltip (bool show) – Sent after the mouse hovers over a collider without moving for longer than tooltipDelay, and when the tooltip should be hidden. Not sent on touch-based devices.  
  10. void OnScroll (float delta) is sent out when the mouse scroll wheel is moved.  
  11. void OnKey (KeyCode key) is sent when keyboard or controller input is used.  

 

小结:

       最近由于项目要用到FastGUI,然后手上的FastGUI不支持NGUI(NGUI变动太大了),然后自己要升级下FastGUI,就要更多的掌握NGUI的原理,所以才会一直不断的写一些文章。写文章主要是记录下自己从中看到的东西,当然D.S.Qiu最喜欢和大家分享,希望能对读者有帮助,哪怕只有一个人,D.S.Qiu也会很兴奋的,因为很多次D.S.Qiu都不打算写的(文章写的太烂,没有深度,逻辑差,每次都要熬夜等),但当我看到别人文章的亮点时,我就觉得自己还是可以分享些的。

       今天把FastGUI 兼容到了NGUI3.0.3f,还增加一些功能,然后要写一个文档给美术的同事,我感觉头就大了,感觉如果要我口述一定能让听者完全明白,但是写起来就完全不着调,所以觉得D.S.Qiu的文字很渣,马上就是凌晨1:30,睡觉,晚安!

浅谈NGUI中的UIRoot,UIPanel,UICamera组件 在我们用NGUI创建的UI中我们经常可以看见这几个组件,UIRoot物体上有UIRoot和UIPanel组件,其子物体Camera带有UICamera,这三个组件是NGUI中的核心主键。 UIRoot UIRoot通过屏幕的比例来缩放UI控件,让UI的比例看起来比较合适 Scaling Style中有三种选项,分别是Flexible,Constrained,ConstrainedOn... 阅读详情

相关推荐

NGUI 的 UICamera 脚本工作机制

UICamera 是 NGUI 事件系统的核心,负责输入采集、事件封装、射线检测和事件分发。理解 UICamera 的输入模式、射线检测和事件分发机制,对于高效开发 NGUI UI 交互至关重要。合理配置 eventReceiverMask、rangeDistance 和 UIWidget 的 raycastDepth,能有效提升性能和交互体验。接下来我将继续深入讲解NGUI 的 UICamera。

本博客聚焦游戏开发技巧、创业实战心得及大学热门课程干货。这里既有技术深度,也有思维广度,无论你是开发者、创业者还是高校学子,都能在这里找到适合自己的成长之路! 199

NGUI 组件 UIRoot和UICamera

UIRoot:   public class UIRoot : MonoBehaviour { static public List&lt;UIRoot&gt; list = new List&lt;UIRoot&gt;(); public enum Scaling { PixelPerfect, // 像素不变,大小变 FixedSize, // 大小不变,...

l1987021的专栏 304

银河麒麟V10系统下,手把手解决Ollama安装报错‘GLIBCXX_3.4.25 not found’

本文详细介绍了在银河麒麟V10系统下解决Ollama安装报错‘GLIBCXX_3.4.25 not found’的实战指南。通过隔离编译新版libstdc++、环境变量引导和服务化封装等安全方案,确保在不破坏系统稳定性的前提下顺利运行Ollama,适用于国产操作系统与AI工具的兼容性需求。

weixin_42556197的博客 484

【Unity插件】NGUI核心组件之UICamera

NGUI:UICamera UICamera脚本是所有功能性UI的关键组件。它的责任是向它所在的摄像机渲染出来的所有有碰撞体的对象发送NGUI事件。如果在场景中你有一个摄像机,确保它上面挂载了UICamera脚本。如果你有多个摄像机,确保至少有一个用于渲染UI的摄像机挂载了UICamera。将这个脚本挂载在场景的主摄像机上,你场景中具有碰撞和的物体就可以接收到诸如OnClick,On...

SunRaIN_的专栏 329

WinCC ActiveX控件“许可证缺失”故障排查:从注册表修复到系统兼容性全解析

本文深入解析WinCC ActiveX控件报错“未找到许可证信息”的根本原因与解决方案。核心在于系统注册表中控件的设计时许可证密钥丢失或损坏。文章提供了从手动修复注册表、排查64位系统兼容性,到预防性环境部署的全流程专业指南,帮助工程师彻底解决这一常见故障。

oil88的博客 646

RLHF的数学表示

RLHF(Reinforcement Learning with Human Feedback)是一种结合了强化学习和人类反馈的机器学习方法。它通常用于训练智能体(agent)在复杂环境中做出决策,同时利用人类的反馈来指导和改进学习过程。RLHF 没有一个统一的数学表示式,因为它依赖于具体的应用场景和实现细节。然而,我们可以从强化学习和人类反馈的角度来描述RLHF的一些关键数学概念。

xw555666的博客 687

camera.ui 开源项目使用教程

camera.ui 开源项目使用教程 1. 项目介绍 camera.ui 是一个类似NVR(网络视频录像机)的Progressive Web Application(PWA),用于控制和查看支持RTSP协议的摄像头。它提供了实时流、摄像头概览、多语言支持、移动检测、图像识别、通知、快照/视频录制等功能。camera.ui 具有美观的用户界面,支持多种主题,包括暗模式,且易于扩展多语言支持。 2. ...

gitblog_00170的博客 714

电力电子技术进阶:从基础到实战的完整学习路径

本文系统阐述了电力电子技术从基础到实战的完整学习路径。首先解析了电力电子作为“电能魔术师”的核心作用,随后深入剖析了数学工具、电路电磁场与半导体器件三大基础支柱。文章重点讲解了DC-DC、DC-AC、AC-DC等核心变换拓扑,并探讨了从经典PID到现代模型预测控制(MPC)的控制策略。最后,分享了硬件设计、软件调试、电磁兼容(EMC)等实战经验与前沿趋势,为学习者提供了清晰的进阶指南。

weixin_29204205的博客 446

Camera.UI 项目安装与使用指南

Camera.UI 项目的目录结构如下所示: ``` camera.ui/ ├── .gitignore # 忽略文件列表 ├── README.md # 项目说明文件 ├── package.json # 项目配置文件 ├── src/ # 源代码目录 │ ├── components/ #

gitblog_01027的博客 465

带你学习Android中的ContentObserver

通过使用,开发者可以有效地监听系统设置的变化,例如屏幕亮度等。这种机制使得应用能够动态响应系统设置的更改,提升用户体验。在实现需要与系统设置交互的应用时,合理使用是非常重要的。

执剑人 1311

Sigrity Power SI 3D-EM Full Wave Extraction模式如何进行S参数提取和观测3D电磁场和远场实例分析(一)-差分过孔结构

Sigrity Power SI 3D-EM Full Wave Extraction模式如何进行S参数提取和观测3D电磁场和远场操作指导(一)详细介绍了3D-EM Full Wave Extraction全波S参数提取,下面以一个差分过孔结构进行实例分析,以下图为例。模式如何进行S参数提取和观测3D电磁场和远场实例分析(一)-差分过孔结构。是一个简单的4层板,top换层到bottom层的差分过孔结构。起始频率为100Mhz,截止频率为20Ghz,线性扫描。上面那根曲线是插损,下面那根线是回损。

weixin_54787054的博客 343

NGUI所见即所得--UICamera

UI,除了界面的显示,还有一个重要的元素:事件响应。MoneBehaviour提供一些事件提供了一些函数接口(OnMouseUp,OnMouseDown等),只要MonBehaviour的子类实现这相应的方法以及方法执行的条件达到,Unity底层就会分发调用执行这个函数。一般地,UI事件响应处理机制会有4个基本元素:

xiaodiao062的专栏 1025

GPT-5.5 是真好用!SCI论文润色与学术写作能力上全面提升,全流程指令已整理好!

输出规范:先输出完整的摘要正文,不添加额外说明,以Markdown表格形式提供中文自检说明,表格包含两列,列标题为“检查项”和“说明”,逐项说明是否已覆盖背景、研究问题、方法、结果及贡献,并简要评价摘要结构与表达是否符合要求,除上述内容外不输出其他信息。:你是一位(学术写作专家/期刊审稿人/论文评审专家),精通学术写作规范、逻辑结构、语法准确性及学术表达方式,你的任务是帮助提升论文的质量,包括语言润色、语法检查、逻辑优化和降低重复率。语言需简洁、正式、具有概括性,不展开具体论述,仅提供结构与要点说明。

智能AI让学术科研更容易 289

Unity3D开发(七):NGUI之UICamera控制触摸,鼠标事件

先给论坛做个广告:点击打开链接 1. UICamera 功能介绍 主要包括UI事件的监听,分发,覆盖范围为此Camera渲染的所有GameObject。 事件源包括:鼠标,触摸,键盘,手柄。 事件包括:悬停,按下/抬起,选中/取消选中,点击,双击,拖拽,释放,文本输入,Tips显示,滚轮滑动,键盘输入。   2. UICamera 实现流程 (1)属性   Event T

oneRain88的专栏 3万+

在 SAP 资产模块跨 2024 和 2025 两个年度操作后,运行 AFAB 测试无数据,大概率是折旧已完全过账、跨期配置异常或资产数据异常等原因

SAP资产模块跨年度操作AFAB测试无数据的排查方案:首先检查折旧是否已完全计提,确认资产主数据价值;其次验证跨年度配置是否合规,包括全局配置、折旧范围和账期状态;然后重新执行AFAR折旧计算刷新数据;排查资产主数据异常或业务操作冲突;最后核对AFAB运行参数是否正确设置,包括会计年度、期间范围和运行模式等。

金牌架构师 866

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

NGUI源码学习——UICamera

转载自 UICamera NGUI源码学习_UICamera 0 前言 UICamera是NGUI中专门用于捕获和分发交互事件的脚本,和UI渲染无关,需要挂在UI摄像机上。 其核心思想是在Update中检测Input的各种输入情况,并对屏幕做raycast投射,以决定是哪个go的collider触发事件,最终将事件分发出去。 Q: 检测各种输入在哪里做? Update()中. Q: UIC...

【黑键】 911

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

NGUI UICamera组件:摄像机控制

在Unity中使用NGUI(Next-Gen UI)构建用户界面时,UICamera是一个关键组件,它负责管理UI元素的摄像机视角和渲染。UICamera确保UI在不同设备和屏幕尺寸上正确显示,同时提供深度控制和摄像机效果。本文将深入探讨UICamera的作用、特性以及如何在你的Unity项目中使用它。

Unity打怪升级 1596

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

NGUI控件说明—— UICamera

NGUI版本:3.0.x UICamera这个名字不是很合适,保留的原因仅仅是为了兼容以前的版本。 UICamera真正做的事情是发送NGUI事件给所有被当前camera渲染的object,camera是UICamera脚本所在的那个。 其实这个脚本做的事情和UI无关。事实上如果你想让游戏里面的object接收OnPress、OnClick、OnDrag等这类事件,你需要把UICamera挂在

鬼眼邪神 574

NGUI UICamera属性介绍

NGUI:UICamera UICamera脚本是所有功能性UI的关键组件。它的责任是向它所在的摄像机渲染出来的所有有碰撞体的对象发送NGUI事件,如果在场景中你有一个摄像机,确保它上面挂载了UICamera脚本。如果你有多个摄像机,确保至少有一个用于渲染UI的Camera 挂载了UICamera。将这个脚本挂载在场景的Main Camera上,your Scene中具有碰撞的物体就可以接收到诸

杜甲同学的专栏 2165

NGUI的UIRoot、UICamera、UIPanel、UIRect、UIWidget、UITexture、UISprite、UILabel、Scroll View等

用NGUI也有几个月了,但一直没有系统性地学习过NGUI,今天来了解下~ UIRoot:https://blog.youkuaiyun.com/kakashi8841/article/details/20480717 UICamera:https://blog.youkuaiyun.com/kakashi8841/article/details/20548429 UIPanel:https://blog.youkuaiyun.com...

陈云佳的专栏 959

NGUI的UICamera

参考 https://blog.youkuaiyun.com/kakashi8841/article/details/20548429 全文请查看:http://note.youdao.com/noteshare?id=a0eead01036d4b20c44908e19928fa30 1. UICamera脚本需要挂接在所有的和UI有关的摄像机上,这样才能够有通知事件。 2. UI...

ali013719291765的博客 239

NGUI之UICamera控制触摸,鼠标事件

1. UICamera 功能介绍 主要包括UI事件的监听,分发,覆盖范围为此Camera渲染的所有GameObject。 事件源包括:鼠标,触摸,键盘,手柄。 事件包括:悬停,按下/抬起,选中/取消选中,点击,双击,拖拽,释放,文本输入,Tips显示,滚轮滑动,键盘输入。 2. UICamera 实现流程 (1)属性 Event Type:包括UI,World,用于区分

xiaodiao062的专栏 1051

NGUI -- UICamera

注意:本文翻译时NGUI版本已经更新到3.0.7 原文地址:http://www.tasharen.com/forum/index.php?topic=6711 总览 UICamera是一个命名不太好的组件。实际上,它的名字某种原因只是为了保持向后兼容。 UICamera脚本实际做的事是发送NGUI事件给所有被它所附加的摄像机所看见的对象。除此之外,它不对UI做任何事情了。实际

游戏开发者 1万+
上一篇: Unity3D之AssetBundle资源加载封装
下一篇: OpenGL阴影,Shadow Mapping
CCCStudyer
博客等级 码龄16年 14粉丝 9原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值