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


C# Event.GetTypeForControl方法代码示例

本文整理汇总了C#中UnityEngine.Event.GetTypeForControl方法的典型用法代码示例。如果您正苦于以下问题:C# Event.GetTypeForControl方法的具体用法?C# Event.GetTypeForControl怎么用?C# Event.GetTypeForControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Event的用法示例。


在下文中一共展示了Event.GetTypeForControl方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SplitGUI

 public void SplitGUI(Event evt)
 {
   if (this.splitState == null)
     this.SetupSplitter();
   SplitView parent = this.parent as SplitView;
   if ((bool) ((Object) parent))
   {
     Event evt1 = new Event(evt);
     evt1.mousePosition += new Vector2(this.position.x, this.position.y);
     parent.SplitGUI(evt1);
     if (evt1.type == EventType.Used)
       evt.Use();
   }
   float num1 = !this.vertical ? evt.mousePosition.x : evt.mousePosition.y;
   int controlId = GUIUtility.GetControlID(546739, FocusType.Passive);
   this.controlID = controlId;
   switch (evt.GetTypeForControl(controlId))
   {
     case EventType.MouseDown:
       if (this.children.Length == 1)
         break;
       int num2 = !this.vertical ? (int) this.children[0].position.x : (int) this.children[0].position.y;
       for (int index = 0; index < this.children.Length - 1; ++index)
       {
         if (index >= this.splitState.realSizes.Length)
         {
           DockArea current = GUIView.current as DockArea;
           string str = "Non-dock area " + (object) GUIView.current.GetType();
           if ((bool) ((Object) current) && current.m_Selected < current.m_Panes.Count && (bool) ((Object) current.m_Panes[current.m_Selected]))
             str = current.m_Panes[current.m_Selected].GetType().ToString();
           if (Unsupported.IsDeveloperBuild())
             Debug.LogError((object) ("Real sizes out of bounds for: " + str + " index: " + (object) index + " RealSizes: " + (object) this.splitState.realSizes.Length));
           this.SetupSplitter();
         }
         if ((!this.vertical ? new Rect((float) (num2 + this.splitState.realSizes[index] - this.splitState.splitSize / 2), this.children[0].position.y, (float) this.splitState.splitSize, this.children[0].position.height) : new Rect(this.children[0].position.x, (float) (num2 + this.splitState.realSizes[index] - this.splitState.splitSize / 2), this.children[0].position.width, (float) this.splitState.splitSize)).Contains(evt.mousePosition))
         {
           this.splitState.splitterInitialOffset = (int) num1;
           this.splitState.currentActiveSplitter = index;
           GUIUtility.hotControl = controlId;
           evt.Use();
           break;
         }
         num2 += this.splitState.realSizes[index];
       }
       break;
     case EventType.MouseUp:
       if (GUIUtility.hotControl != controlId)
         break;
       GUIUtility.hotControl = 0;
       break;
     case EventType.MouseDrag:
       if (this.children.Length <= 1 || GUIUtility.hotControl != controlId || this.splitState.currentActiveSplitter < 0)
         break;
       int diff = (int) num1 - this.splitState.splitterInitialOffset;
       if (diff != 0)
       {
         this.splitState.splitterInitialOffset = (int) num1;
         this.splitState.DoSplitter(this.splitState.currentActiveSplitter, this.splitState.currentActiveSplitter + 1, diff);
       }
       this.SetupRectsFromSplitter();
       evt.Use();
       break;
   }
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:64,代码来源:SplitView.cs

示例2: SplitGUI

		public void SplitGUI(Event evt)
		{
			if (this.splitState == null)
			{
				this.SetupSplitter();
			}
			SplitView splitView = base.parent as SplitView;
			if (splitView)
			{
				Event @event = new Event(evt);
				@event.mousePosition += new Vector2(base.position.x, base.position.y);
				splitView.SplitGUI(@event);
				if (@event.type == EventType.Used)
				{
					evt.Use();
				}
			}
			float num = (!this.vertical) ? evt.mousePosition.x : evt.mousePosition.y;
			int num2 = GUIUtility.GetControlID(546739, FocusType.Passive);
			this.controlID = num2;
			switch (evt.GetTypeForControl(num2))
			{
			case EventType.MouseDown:
				if (base.children.Length != 1)
				{
					int num3 = (!this.vertical) ? ((int)base.children[0].position.x) : ((int)base.children[0].position.y);
					for (int i = 0; i < base.children.Length - 1; i++)
					{
						if (i >= this.splitState.realSizes.Length)
						{
							DockArea dockArea = GUIView.current as DockArea;
							string text = "Non-dock area " + GUIView.current.GetType();
							if (dockArea && dockArea.m_Selected < dockArea.m_Panes.Count && dockArea.m_Panes[dockArea.m_Selected])
							{
								text = dockArea.m_Panes[dockArea.m_Selected].GetType().ToString();
							}
							if (Unsupported.IsDeveloperBuild())
							{
								Debug.LogError(string.Concat(new object[]
								{
									"Real sizes out of bounds for: ",
									text,
									" index: ",
									i,
									" RealSizes: ",
									this.splitState.realSizes.Length
								}));
							}
							this.SetupSplitter();
						}
						if (((!this.vertical) ? new Rect((float)(num3 + this.splitState.realSizes[i] - this.splitState.splitSize / 2), base.children[0].position.y, (float)this.splitState.splitSize, base.children[0].position.height) : new Rect(base.children[0].position.x, (float)(num3 + this.splitState.realSizes[i] - this.splitState.splitSize / 2), base.children[0].position.width, (float)this.splitState.splitSize)).Contains(evt.mousePosition))
						{
							this.splitState.splitterInitialOffset = (int)num;
							this.splitState.currentActiveSplitter = i;
							GUIUtility.hotControl = num2;
							evt.Use();
							break;
						}
						num3 += this.splitState.realSizes[i];
					}
				}
				break;
			case EventType.MouseUp:
				if (GUIUtility.hotControl == num2)
				{
					GUIUtility.hotControl = 0;
				}
				break;
			case EventType.MouseDrag:
				if (base.children.Length > 1 && GUIUtility.hotControl == num2 && this.splitState.currentActiveSplitter >= 0)
				{
					int num4 = (int)num - this.splitState.splitterInitialOffset;
					if (num4 != 0)
					{
						this.splitState.splitterInitialOffset = (int)num;
						this.splitState.DoSplitter(this.splitState.currentActiveSplitter, this.splitState.currentActiveSplitter + 1, num4);
					}
					this.SetupRectsFromSplitter();
					evt.Use();
				}
				break;
			}
		}
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:83,代码来源:SplitView.cs

示例3: SplitGUI

 public void SplitGUI(Event evt)
 {
     if (this.splitState == null)
     {
         this.SetupSplitter();
     }
     SplitView parent = base.parent as SplitView;
     if (parent != null)
     {
         Event event2 = new Event(evt);
         event2.mousePosition += new Vector2(base.position.x, base.position.y);
         parent.SplitGUI(event2);
         if (event2.type == EventType.Used)
         {
             evt.Use();
         }
     }
     float num = !this.vertical ? evt.mousePosition.x : evt.mousePosition.y;
     int controlID = GUIUtility.GetControlID(0x857b3, FocusType.Passive);
     this.controlID = controlID;
     EventType typeForControl = evt.GetTypeForControl(controlID);
     if (typeForControl == EventType.MouseDown)
     {
         if (base.children.Length != 1)
         {
             int num3 = !this.vertical ? ((int) base.children[0].position.x) : ((int) base.children[0].position.y);
             for (int i = 0; i < (base.children.Length - 1); i++)
             {
                 if (i >= this.splitState.realSizes.Length)
                 {
                     DockArea current = GUIView.current as DockArea;
                     string str = "Non-dock area " + GUIView.current.GetType();
                     if (((current != null) && (current.m_Selected < current.m_Panes.Count)) && (current.m_Panes[current.m_Selected] != null))
                     {
                         str = current.m_Panes[current.m_Selected].GetType().ToString();
                     }
                     if (Unsupported.IsDeveloperBuild())
                     {
                         Debug.LogError(string.Concat(new object[] { "Real sizes out of bounds for: ", str, " index: ", i, " RealSizes: ", this.splitState.realSizes.Length }));
                     }
                     this.SetupSplitter();
                 }
                 Rect rect5 = !this.vertical ? new Rect((float) ((num3 + this.splitState.realSizes[i]) - (this.splitState.splitSize / 2)), base.children[0].position.y, (float) this.splitState.splitSize, base.children[0].position.height) : new Rect(base.children[0].position.x, (float) ((num3 + this.splitState.realSizes[i]) - (this.splitState.splitSize / 2)), base.children[0].position.width, (float) this.splitState.splitSize);
                 if (rect5.Contains(evt.mousePosition))
                 {
                     this.splitState.splitterInitialOffset = (int) num;
                     this.splitState.currentActiveSplitter = i;
                     GUIUtility.hotControl = controlID;
                     evt.Use();
                     break;
                 }
                 num3 += this.splitState.realSizes[i];
             }
         }
     }
     else if (typeForControl == EventType.MouseDrag)
     {
         if (((base.children.Length > 1) && (GUIUtility.hotControl == controlID)) && (this.splitState.currentActiveSplitter >= 0))
         {
             int diff = ((int) num) - this.splitState.splitterInitialOffset;
             if (diff != 0)
             {
                 this.splitState.splitterInitialOffset = (int) num;
                 this.splitState.DoSplitter(this.splitState.currentActiveSplitter, this.splitState.currentActiveSplitter + 1, diff);
             }
             this.SetupRectsFromSplitter();
             evt.Use();
         }
     }
     else if ((typeForControl == EventType.MouseUp) && (GUIUtility.hotControl == controlID))
     {
         GUIUtility.hotControl = 0;
     }
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:74,代码来源:SplitView.cs


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