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


C# Action.DrawOutWires方法代码示例

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


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

示例1: DrawSockets

        private void DrawSockets(Action action, bool isAsset)
        {
            List<Action> actionList = new List<Action>();
            if (isAsset)
            {
                actionList = windowData.targetAsset.actions;
            }
            else
            {
                actionList = windowData.target.actions;
            }

            int i = actionList.IndexOf (action);
            Event e = Event.current;

            if (action.numSockets == 0)
            {
                return;
            }

            if (!action.isDisplayed && (action is ActionCheck || action is ActionCheckMultiple || action is ActionParallel))
            {
                action.DrawOutWires (actionList, i, 0);
                return;
            }

            int offset = 0;

            if (action is ActionCheck)
            {
                ActionCheck actionCheck = (ActionCheck) action;
                if (actionCheck.resultActionFail != ResultAction.RunCutscene)
                {
                    Rect buttonRect = new Rect (action.nodeRect.x + action.nodeRect.width - 2, action.nodeRect.y - 22 + action.nodeRect.height, 16, 16);

                    if (e.isMouse && actionChanging == null && e.type == EventType.MouseDown && action.isEnabled && buttonRect.Contains(e.mousePosition))
                    {
                        offsetChanging = 10;
                        resultType = false;
                        actionChanging = action;
                    }

                    GUI.Button (buttonRect, "", nodeSkin.customStyles[10]);

                    if (actionCheck.resultActionFail == ResultAction.Skip)
                    {
                        offset = 17;
                    }
                }
                if (actionCheck.resultActionTrue != ResultAction.RunCutscene)
                {
                    Rect buttonRect = new Rect (action.nodeRect.x + action.nodeRect.width - 2, action.nodeRect.y - 40 - offset + action.nodeRect.height, 16, 16);

                    if (e.isMouse && actionChanging == null && e.type == EventType.MouseDown && action.isEnabled && buttonRect.Contains(e.mousePosition))
                    {
                        offsetChanging = 30 + offset;
                        resultType = true;
                        actionChanging = action;
                    }

                    GUI.Button (buttonRect, "", nodeSkin.customStyles[10]);
                }
            }
            else if (action is ActionCheckMultiple)
            {
                ActionCheckMultiple actionCheckMultiple = (ActionCheckMultiple) action;

                int totalHeight = 20;
                for (int j = actionCheckMultiple.endings.Count-1; j>=0; j--)
                {
                    ActionEnd ending = actionCheckMultiple.endings [j];

                    if (ending.resultAction != ResultAction.RunCutscene)
                    {
                        Rect buttonRect = new Rect (action.nodeRect.x + action.nodeRect.width - 2,
                                                    action.nodeRect.y + action.nodeRect.height
                                                    - totalHeight,
                                                    16, 16);

                        if (e.isMouse && actionChanging == null && e.type == EventType.MouseDown && action.isEnabled && buttonRect.Contains(e.mousePosition))
                        {
                            offsetChanging = totalHeight - 10;
                            multipleResultType = actionCheckMultiple.endings.IndexOf (ending);
                            actionChanging = action;
                        }

                        GUI.Button (buttonRect, "", nodeSkin.customStyles[10]);
                    }

                    if (ending.resultAction == ResultAction.Skip)
                    {
                        totalHeight += 44;
                    }
                    else
                    {
                        totalHeight += 26;
                    }
                }
            }
            else if (action is ActionParallel)
//.........这里部分代码省略.........
开发者ID:WastNotWantNot,项目名称:WasteNotWantNot,代码行数:101,代码来源:ActionListEditorWindow.cs

示例2: DrawSockets


//.........这里部分代码省略.........
			{
				Rect buttonRect = new Rect (action.nodeRect.x + action.nodeRect.width, action.nodeRect.y - 22 + action.nodeRect.height, 20, 20);
				
				if (e.isMouse && actionChanging == null && e.type == EventType.MouseDown && action.isEnabled && buttonRect.Contains(e.mousePosition))
				{
					offsetChanging = 10;
					resultType = false;
					actionChanging = action;
				}
				
				if (actionChanging == null && action.isEnabled && buttonRect.Contains (e.mousePosition))
				{
					GUI.Button (buttonRect, socketIn, "Label");
				}
				else
				{
					GUI.Button (buttonRect, socketOut, "Label");
				}
				
				if (actionCheck.resultActionFail == ResultAction.Skip)
				{
					offset = 17;
				}
			}
			if (actionCheck.resultActionTrue != ResultAction.RunCutscene)
			{
				Rect buttonRect = new Rect (action.nodeRect.x + action.nodeRect.width, action.nodeRect.y - 40 - offset + action.nodeRect.height, 20, 20);
				
				if (e.isMouse && actionChanging == null && e.type == EventType.MouseDown && action.isEnabled && buttonRect.Contains(e.mousePosition))
				{
					offsetChanging = 30 + offset;
					resultType = true;
					actionChanging = action;
				}
				
				if (actionChanging == null && action.isEnabled && buttonRect.Contains (e.mousePosition))
				{
					GUI.Button (buttonRect, socketIn, "Label");
				}
				else
				{
					GUI.Button (buttonRect, socketOut, "Label");
				}
			}
		}
		else if (action is ActionCheckMultiple)
		{
			ActionCheckMultiple actionCheckMultiple = (ActionCheckMultiple) action;
			
			foreach (ActionEnd ending in actionCheckMultiple.endings)
			{
				int j = actionCheckMultiple.endings.IndexOf (ending);
				
				if (ending.resultAction != ResultAction.RunCutscene)
				{
					Rect buttonRect = new Rect (action.nodeRect.x + action.nodeRect.width, action.nodeRect.y + (j * 43) - (actionCheckMultiple.endings.Count * 43) + action.nodeRect.height, 20, 20);
					
					if (e.isMouse && actionChanging == null && e.type == EventType.MouseDown && action.isEnabled && buttonRect.Contains(e.mousePosition))
					{
						offsetChanging = (actionCheckMultiple.endings.Count - j) * 43 - 13;
						multipleResultType = actionCheckMultiple.endings.IndexOf (ending);
						actionChanging = action;
					}
					
					if (actionChanging == null && action.isEnabled && buttonRect.Contains (e.mousePosition))
					{
						GUI.Button (buttonRect, socketIn, "Label");
					}
					else
					{
						GUI.Button (buttonRect, socketOut, "Label");
					}
				}
			}
		}
		else
		{
			if (action.endAction != ResultAction.RunCutscene)
			{
				Rect buttonRect = new Rect (action.nodeRect.x + action.nodeRect.width, action.nodeRect.y - 22 + action.nodeRect.height, 20, 20);
				
				if (e.isMouse && actionChanging == null && e.type == EventType.MouseDown && action.isEnabled && buttonRect.Contains(e.mousePosition))
				{
					offsetChanging = 10;
					actionChanging = action;
				}
				
				if (actionChanging == null && action.isEnabled && buttonRect.Contains (e.mousePosition))
				{
					GUI.Button (buttonRect, socketIn, "Label");
				}
				else
				{
					GUI.Button (buttonRect, socketOut, "Label");
				}
			}
		}
		
		action.DrawOutWires (actionList, i, offset);
	}
开发者ID:amutnick,项目名称:CrackTheCode_Repo,代码行数:101,代码来源:ActionListEditorWindow.cs


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