コード例 #1
0
ファイル: Ladder.cs プロジェクト: broding/bunkerhunter
 protected override void DrawCall(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch, ParentNode parentNode)
 {
     for (int y = 0; y < this.LadderHeight; y++)
     {
         base.DrawCall(spriteBatch, parentNode);
         parentNode.Position.Y += this.Texture.Height;
     }
 }
コード例 #2
0
ファイル: ASTBuilder.cs プロジェクト: demyanenko-d/z80asm
        public static ListNode GetParent(ParentNode<Keywords> node)
        {
            var res = node.Parent as ListNode;
            if (res != null) return res;

            var tree = node.Parent;
            return (ListNode)tree.Parent;
        }
コード例 #3
0
        public void ChildReferencingParentTest()
        {
            ParentNode parent = new ParentNode();
            ChildNode child = new ChildNode();

            parent.Children.Add(child);
            Assert.AreSame(parent, child.Parent);

            parent.Children.Remove(child);
            Assert.IsNull(child.Parent);
        }
コード例 #4
0
ファイル: ASTBuilder.cs プロジェクト: demyanenko-d/z80asm
        public void EnterTo(ListNode node, ParentNode<Keywords> tree = null)
        {
            if (tree != null)
            {
                tree.Parent = _currentNode;
                node.Parent = tree;
            }
            else
            {
                node.Parent = _currentNode;
                _currentNode.Childs.Add(node);
            }

            _currentNode = node;
        }
コード例 #5
0
ファイル: Particle.cs プロジェクト: broding/bunkerhunter
        protected override void DrawCall(SpriteBatch spriteBatch, ParentNode parentNode)
        {
            parentNode.Position.X *= this.ScrollFactor.X;
            parentNode.Position.Y *= this.ScrollFactor.Y;

            spriteBatch.Draw(
                this.Emitter.Data.BaseTexture,
                parentNode.Position,
                this.SourceRectangle,
                this.Color * parentNode.Alpha,
                this.Rotation,
                this.Origin,
                this.Scale,
                this.SpriteEffects,
                Node.GetDrawDepth(this.Depth));
        }
コード例 #6
0
        public void ChildReferencingParentTest()
        {
            ParentNode parent = new ParentNode();
            ChildNode child1 = new ChildNode();
            ChildNode child2 = new ChildNode();

            parent.AdoptedChildren.Add(child1);
            parent.AdoptedChildren.Add(child2);
            Assert.AreSame(parent, child1.Parent);
            Assert.AreSame(parent, child2.Parent);

            Assert.AreSame(child1, parent.AdoptedChildren[0]);
            Assert.AreSame(child2, parent.AdoptedChildren[1]);

            parent.AdoptedChildren.Remove(child1);
            Assert.IsNull(child1.Parent);
            Assert.AreSame(parent, child2.Parent);
        }
コード例 #7
0
ファイル: ActionData.cs プロジェクト: DGiroud/JavelinVR
		public override void ExecuteForward()
		{
			ParentNode node = UIUtils.GetNode( m_nodeId ):
			if ( node != null )
				node.Vec2Position = m_nodeFinalPos:
		}
コード例 #8
0
 public void Destroy()
 {
     m_additionalPragmas.Clear();
     m_additionalPragmas = null;
     m_currentOwner      = null;
 }
コード例 #9
0
 public IEnumerable <PackageDependencyNode> GetProjectPackageReferencesAsDependencyNodes()
 {
     return(ParentNode.GetProjectPackageReferencesAsDependencyNodes());
 }
コード例 #10
0
 public override int GetHashCode()
 {
     return(Depth ^ (Move == null ? 0 : Move.GetHashCode()) ^ (ParentNode == null ? 0 : ParentNode.GetHashCode()));
 }
コード例 #11
0
			private SendToGump( int page, Mobile from, LocationTree tree, ParentNode node ) : base( 50, 50 )
			{
				from.CloseGump( typeof( SendToGump ) );

				tree.LastBranch[from] = node;

				m_Page = page;
				m_Tree = tree;
				m_Node = node;

				int x = BorderSize + OffsetSize;
				int y = BorderSize + OffsetSize;

				int count = node.Children.Length - (page * EntryCount);

				if ( count < 0 )
					count = 0;
				else if ( count > EntryCount )
					count = EntryCount;

				int totalHeight = OffsetSize + ((EntryHeight + OffsetSize) * (count + 1));

				AddPage( 0 );

				AddBackground( 0, 0, BackWidth, BorderSize + totalHeight + BorderSize, BackGumpID );
				AddImageTiled( BorderSize, BorderSize, TotalWidth - (OldStyle ? SetWidth + OffsetSize : 0), totalHeight, OffsetGumpID );

				if ( OldStyle )
					AddImageTiled( x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID );
				else
					AddImageTiled( x, y, PrevWidth, EntryHeight, HeaderGumpID );

				if ( node.Parent != null )
				{
					AddButton( x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 1, GumpButtonType.Reply, 0 );

					if ( PrevLabel )
						AddLabel( x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous" );
				}

				x += PrevWidth + OffsetSize;

				int emptyWidth = TotalWidth - (PrevWidth * 2) - NextWidth - (OffsetSize * 5) - (OldStyle ? SetWidth + OffsetSize : 0);

				if ( !OldStyle )
					AddImageTiled( x - (OldStyle ? OffsetSize : 0), y, emptyWidth + (OldStyle ? OffsetSize * 2 : 0), EntryHeight, EntryGumpID );

				AddHtml( x + TextOffsetX, y, emptyWidth - TextOffsetX, EntryHeight, String.Format( "<center>{0}</center>", node.Name ), false, false );

				x += emptyWidth + OffsetSize;

				if ( OldStyle )
					AddImageTiled( x, y, TotalWidth - (OffsetSize * 3) - SetWidth, EntryHeight, HeaderGumpID );
				else
					AddImageTiled( x, y, PrevWidth, EntryHeight, HeaderGumpID );

				if ( page > 0 )
				{
					AddButton( x + PrevOffsetX, y + PrevOffsetY, PrevButtonID1, PrevButtonID2, 2, GumpButtonType.Reply, 0 );

					if ( PrevLabel )
						AddLabel( x + PrevLabelOffsetX, y + PrevLabelOffsetY, TextHue, "Previous" );
				}

				x += PrevWidth + OffsetSize;

				if ( !OldStyle )
					AddImageTiled( x, y, NextWidth, EntryHeight, HeaderGumpID );

				if ( (page + 1) * EntryCount < node.Children.Length )
				{
					AddButton( x + NextOffsetX, y + NextOffsetY, NextButtonID1, NextButtonID2, 3, GumpButtonType.Reply, 1 );

					if ( NextLabel )
						AddLabel( x + NextLabelOffsetX, y + NextLabelOffsetY, TextHue, "Next" );
				}

				for ( int i = 0, index = page * EntryCount; i < EntryCount && index < node.Children.Length; ++i, ++index )
				{
					x = BorderSize + OffsetSize;
					y += EntryHeight + OffsetSize;

					object child = node.Children[index];
					string name = "";

					if ( child is ParentNode )
						name = ((ParentNode)child).Name;
					else if ( child is ChildNode )
						name = ((ChildNode)child).Name;

					AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
					AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, name );

					x += EntryWidth + OffsetSize;

					if ( SetGumpID != 0 )
						AddImageTiled( x, y, SetWidth, EntryHeight, SetGumpID );

					AddButton( x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, index + 4, GumpButtonType.Reply, 0 );
				}
			}
コード例 #12
0
            public LocationTree(string filePath)
            {
                m_FilePath = filePath;
                XmlTextReader xml = new XmlTextReader(new FileStream(m_FilePath, FileMode.Open));
                xml.WhitespaceHandling = WhitespaceHandling.None;

                m_Root = Parse(xml);

                xml.Close();
            }
コード例 #13
0
 public LocationTree()
 {
     m_Root = new ParentNode(null, "Locations");
 }
コード例 #14
0
		void BuildTreeChildren (Gtk.TreeStore store, Gtk.TreeIter parent, ParentNode p, IList<Block> blocks)
		{
			foreach (Node node in p) {
				if (!(node is TagNode)) {
					var startLoc = new TextLocation (node.Location.BeginLine, node.Location.BeginColumn);
					var endLoc = new TextLocation (node.Location.EndLine, node.Location.EndColumn);
					var doc = defaultDocument.Editor.Document;

					var blocksBetween = blocks.Where (n => n.Start.AbsoluteIndex >= doc.GetOffset (startLoc)
						&& n.Start.AbsoluteIndex <= doc.GetOffset (endLoc));

					foreach (var block in blocksBetween) {
						var outlineNode = new OutlineNode (block) {
							Location = new DomRegion (doc.OffsetToLocation (block.Start.AbsoluteIndex),
								doc.OffsetToLocation (block.Start.AbsoluteIndex + block.Length))
						};
						if (!parent.Equals (Gtk.TreeIter.Zero))
							store.AppendValues (parent, outlineNode);
						else
							store.AppendValues (outlineNode);
					}
					continue;
				}

				Gtk.TreeIter childIter;
				if (!parent.Equals (Gtk.TreeIter.Zero))
					childIter = store.AppendValues (parent, new OutlineNode(node as TagNode));
				else
					childIter = store.AppendValues (new OutlineNode(node as TagNode));

				ParentNode pChild = node as ParentNode;
				if (pChild != null)
					BuildTreeChildren (store, childIter, pChild, blocks);
			}
		}
コード例 #15
0
		public virtual void Leave (ParentNode node)
		{
		}
コード例 #16
0
ファイル: ActionData.cs プロジェクト: DGiroud/JavelinVR
		public DestroyNodeActionData( ParentNode node )
		{
			m_nodeId = node.UniqueId:
			m_nodePos = node.Vec2Position:
			m_nodeType = node.GetType():
		}
コード例 #17
0
 public ParentNode(ParentNode parent, string name = "empty")
     : this(parent, name, Color.FromArgb(0x08, 0x08, 0x08))
 {
 }
コード例 #18
0
 public virtual void Draw(ParentNode owner)
 {
 }
コード例 #19
0
 public ParentNode(ParentNode parent, string name, Color color)
 {
     m_Parent = parent;
     m_Children = new object[0];
     m_Name = name;
     m_Color = color;
 }
コード例 #20
0
        public bool Draw(Rect parentPosition, ParentNode selectedNode, Vector2 mousePosition, int mouseButtonId, bool hasKeyboardFocus)
        {
            bool changeCheck = false;

            base.Draw(parentPosition, mousePosition, mouseButtonId, hasKeyboardFocus);
            if (m_nodePropertiesStyle == null)
            {
                m_nodePropertiesStyle = UIUtils.GetCustomStyle(CustomStyle.NodePropertiesTitle);
                m_nodePropertiesStyle.normal.textColor = m_nodePropertiesStyle.active.textColor = EditorGUIUtility.isProSkin ? new Color(1f, 1f, 1f) : new Color(0f, 0f, 0f);
            }

            if (m_isMaximized)
            {
                KeyCode key = Event.current.keyCode;
                if (m_isMouseInside || hasKeyboardFocus)
                {
                    if (key == ShortcutsManager.ScrollUpKey)
                    {
                        m_currentScrollPos.y -= 10;
                        if (m_currentScrollPos.y < 0)
                        {
                            m_currentScrollPos.y = 0;
                        }
                        Event.current.Use();
                    }

                    if (key == ShortcutsManager.ScrollDownKey)
                    {
                        m_currentScrollPos.y += 10;
                        Event.current.Use();
                    }
                }

                if (m_forceUpdate)
                {
                    if (m_propertyReordableList != null)
                    {
                        m_propertyReordableList.ReleaseKeyboardFocus();
                    }
                    m_propertyReordableList = null;

                    if (m_functionInputsReordableList != null)
                    {
                        m_functionInputsReordableList.ReleaseKeyboardFocus();
                    }
                    m_functionInputsReordableList = null;

                    if (m_functionSwitchesReordableList != null)
                    {
                        m_functionSwitchesReordableList.ReleaseKeyboardFocus();
                    }
                    m_functionSwitchesReordableList = null;

                    if (m_functionOutputsReordableList != null)
                    {
                        m_functionOutputsReordableList.ReleaseKeyboardFocus();
                    }
                    m_functionOutputsReordableList = null;
                    m_forceUpdate = false;
                }

                GUILayout.BeginArea(m_transformedArea, m_content, m_style);
                {
                    //Draw selected node parameters
                    if (selectedNode != null)
                    {
                        // this hack is need because without it the several FloatFields/Textfields/... would show wrong values ( different from the ones they were assigned to show )
                        if (m_lastSelectedNode != selectedNode.UniqueId)
                        {
                            m_lastSelectedNode = selectedNode.UniqueId;
                            GUI.FocusControl("");
                        }

                        EditorGUILayout.BeginVertical();
                        {
                            EditorGUILayout.Separator();
                            if (selectedNode.UniqueId == ParentWindow.CurrentGraph.CurrentMasterNodeId)
                            {
                                m_dummyContent.text = "Output Node";
                            }
                            else
                            {
                                if (selectedNode.Attributes != null)
                                {
                                    m_dummyContent.text = selectedNode.Attributes.Name;
                                }
                                else if (selectedNode is CommentaryNode)
                                {
                                    m_dummyContent.text = "Commentary";
                                }
                                else
                                {
                                    m_dummyContent.text = TitleStr;
                                }
                            }

                            EditorGUILayout.LabelField(m_dummyContent, m_nodePropertiesStyle);

                            EditorGUILayout.Separator();
                            //UIUtils.RecordObject( selectedNode , "Changing properties on node " + selectedNode.UniqueId);
                            m_currentScrollPos = EditorGUILayout.BeginScrollView(m_currentScrollPos, GUILayout.Width(0), GUILayout.Height(0));
                            float labelWidth = EditorGUIUtility.labelWidth;
                            if (selectedNode.TextLabelWidth > 0)
                            {
                                EditorGUIUtility.labelWidth = selectedNode.TextLabelWidth;
                            }

                            changeCheck = selectedNode.SafeDrawProperties();
                            EditorGUIUtility.labelWidth = labelWidth;
                            EditorGUILayout.EndScrollView();
                        }
                        EditorGUILayout.EndVertical();

                        if (changeCheck)
                        {
                            if (selectedNode.ConnStatus == NodeConnectionStatus.Connected)
                            {
                                ParentWindow.SetSaveIsDirty();
                            }
                        }
                    }
                    else
                    {
                        //Draw Graph Params
                        EditorGUILayout.BeginVertical();
                        {
                            EditorGUILayout.Separator();
                            EditorGUILayout.LabelField("Graph Properties", m_nodePropertiesStyle);
                            EditorGUILayout.Separator();

                            m_currentScrollPos = EditorGUILayout.BeginScrollView(m_currentScrollPos, GUILayout.Width(0), GUILayout.Height(0));
                            float labelWidth = EditorGUIUtility.labelWidth;
                            EditorGUIUtility.labelWidth = 90;

                            bool generalIsVisible = m_parentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions;
                            NodeUtils.DrawPropertyGroup(ref generalIsVisible, " General", DrawGeneralFunction);
                            m_parentWindow.InnerWindowVariables.ExpandedGeneralShaderOptions = generalIsVisible;
                            AmplifyShaderFunction function = ParentWindow.CurrentGraph.CurrentShaderFunction;
                            if (function != null)
                            {
                                //function.AdditionalIncludes.Draw( ParentWindow.CurrentGraph.CurrentOutputNode );
                                //function.AdditionalPragmas.Draw( ParentWindow.CurrentGraph.CurrentOutputNode );
                                function.AdditionalDirectives.Draw(ParentWindow.CurrentGraph.CurrentOutputNode);
                            }

                            bool inputIsVisible = m_parentWindow.InnerWindowVariables.ExpandedFunctionInputs;
                            NodeUtils.DrawPropertyGroup(ref inputIsVisible, " Function Inputs", DrawFunctionInputs);
                            m_parentWindow.InnerWindowVariables.ExpandedFunctionInputs = inputIsVisible;

                            bool swicthIsVisible = m_parentWindow.InnerWindowVariables.ExpandedFunctionSwitches;
                            NodeUtils.DrawPropertyGroup(ref swicthIsVisible, " Function Switches", DrawFunctionSwitches);
                            m_parentWindow.InnerWindowVariables.ExpandedFunctionSwitches = swicthIsVisible;

                            bool outputIsVisible = m_parentWindow.InnerWindowVariables.ExpandedFunctionOutputs;
                            NodeUtils.DrawPropertyGroup(ref outputIsVisible, " Function Outputs", DrawFunctionOutputs);
                            m_parentWindow.InnerWindowVariables.ExpandedFunctionOutputs = outputIsVisible;

                            bool properties = ParentWindow.InnerWindowVariables.ExpandedProperties;
                            NodeUtils.DrawPropertyGroup(ref properties, " Material Properties", DrawFunctionProperties);
                            ParentWindow.InnerWindowVariables.ExpandedProperties = properties;

                            EditorGUIUtility.labelWidth = labelWidth;
                            EditorGUILayout.EndScrollView();
                        }
                        EditorGUILayout.EndVertical();
                    }
                }
                // Close window area
                GUILayout.EndArea();
            }

            PostDraw();
            return(changeCheck);
        }
コード例 #21
0
            public ParentNode(XmlTextReader xml, ParentNode parent)
            {
                m_Parent = parent;

                Parse(xml);
            }
コード例 #22
0
 /// <inheritdoc />
 public override void OnDebugDraw(ViewportDebugDrawData data)
 {
     ParentNode.OnDebugDraw(data);
     data.HighlightBrushSurface(Brush.Surfaces[Index]);
 }
コード例 #23
0
        private void addGroupToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ParentNode node = null;
            if (locationsTreeView.SelectedNode.Tag is ParentNode)
                node = (locationsTreeView.SelectedNode.Tag as ParentNode).Parent;
            if (locationsTreeView.SelectedNode.Tag is ChildNode)
                node = (locationsTreeView.SelectedNode.Tag as ChildNode).Parent;

            int index = locationsTreeView.SelectedNode.Index;

            object[] children = node.Children;
            Array.Resize<object>(ref children, node.Children.Length + 1);
            Array.Copy(node.Children, index, children, index + 1, node.Children.Length - index);
            node.Children = children;

            ParentNode newnode = new ParentNode(node);
            node.Children[index] = newnode;

            locationsTreeView.BeginUpdate();
            TreeNode treeNode = new TreeNode();

            treeNode.Text = newnode.Name;
            treeNode.ForeColor = newnode.Color;
            treeNode.Tag = newnode;

            locationsTreeView.SelectedNode.Parent.Nodes.Insert(index, treeNode);
            locationsTreeView.EndUpdate();
        }
コード例 #24
0
ファイル: BasicEmitter.cs プロジェクト: broding/bunkerhunter
 public override void Draw(SpriteBatch spriteBatch, ParentNode parentNode)
 {
     // we need to pass a zero vector to the draw call, because the particle engine always is at 0,0
     parentNode.Position = Vector2.Zero;
     base.Draw(spriteBatch, parentNode);
 }
コード例 #25
0
        public override void Draw(ParentNode owner)
        {
            bool blendModeIsVisible = EditorVariablesManager.ExpandedBlendModeModule.Value;

            NodeUtils.DrawPropertyGroup(ref blendModeIsVisible, BlendModeStr, () =>
            {
                if (m_blendModeEnabled)
                {
                    // RGB
                    EditorGUI.BeginChangeCheck();
                    m_currentRGBIndex = owner.EditorGUILayoutPopup(BlendModesRGBStr, m_currentRGBIndex, m_commonBlendTypesArr);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (m_currentRGBIndex > 1)
                        {
                            m_sourceFactorRGB = m_commonBlendTypes[m_currentRGBIndex].SourceFactor;
                            m_destFactorRGB   = m_commonBlendTypes[m_currentRGBIndex].DestFactor;
                        }
                    }
                    EditorGUI.BeginDisabledGroup(m_currentRGBIndex == 0);

                    EditorGUI.BeginChangeCheck();
                    float cached = EditorGUIUtility.labelWidth;
                    EditorGUIUtility.labelWidth = 40;

                    EditorGUILayout.BeginHorizontal();
                    m_sourceFactorRGB = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorRGB);
                    EditorGUI.indentLevel--;
                    EditorGUIUtility.labelWidth = 25;
                    m_destFactorRGB             = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorRGB);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.EndHorizontal();

                    EditorGUIUtility.labelWidth = cached;
                    if (EditorGUI.EndChangeCheck())
                    {
                        CheckRGBIndex();
                    }

                    EditorGUI.EndDisabledGroup();
                    // Alpha
                    EditorGUILayout.Separator();

                    EditorGUI.BeginChangeCheck();
                    m_currentAlphaIndex = owner.EditorGUILayoutPopup(BlendModesAlphaStr, m_currentAlphaIndex, m_commonBlendTypesArr);
                    if (EditorGUI.EndChangeCheck())
                    {
                        if (m_currentAlphaIndex > 0)
                        {
                            m_sourceFactorAlpha = m_commonBlendTypes[m_currentAlphaIndex].SourceFactor;
                            m_destFactorAlpha   = m_commonBlendTypes[m_currentAlphaIndex].DestFactor;
                        }
                    }
                    EditorGUI.BeginDisabledGroup(m_currentAlphaIndex == 0);

                    EditorGUI.BeginChangeCheck();
                    cached = EditorGUIUtility.labelWidth;
                    EditorGUIUtility.labelWidth = 40;
                    EditorGUILayout.BeginHorizontal();
                    m_sourceFactorAlpha = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(SourceFactorStr, m_sourceFactorAlpha);
                    EditorGUI.indentLevel--;
                    EditorGUIUtility.labelWidth = 25;
                    m_destFactorAlpha           = (AvailableBlendFactor)owner.EditorGUILayoutEnumPopup(DstFactorStr, m_destFactorAlpha);
                    EditorGUI.indentLevel++;
                    EditorGUILayout.EndHorizontal();
                    EditorGUIUtility.labelWidth = cached;

                    if (EditorGUI.EndChangeCheck())
                    {
                        CheckAlphaIndex();
                    }

                    EditorGUI.EndDisabledGroup();
                    EditorGUILayout.Separator();
                }

                if (m_blendOpEnabled)
                {
                    m_blendOpRGB = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup(BlendOpsRGBStr, m_blendOpRGB);
                    EditorGUILayout.Separator();
                    m_blendOpAlpha = (AvailableBlendOps)owner.EditorGUILayoutEnumPopup(BlendOpsAlphaStr, m_blendOpAlpha);
                }
            });

            EditorVariablesManager.ExpandedBlendModeModule.Value = blendModeIsVisible;
        }
コード例 #26
0
ファイル: NodeExporterUtils.cs プロジェクト: jjm3414/utils
        public void Update()
        {
            if (m_takingShots)
            {
                m_window.Focus();
                switch (m_screenShotState)
                {
                case DebugNodeState.CreateNode:
                {
                    m_node            = m_window.CreateNode(m_screenshotList[0].NodeType, Vector2.zero, null, false);
                    m_screenShotState = DebugNodeState.FocusOnNode;
                }
                break;

                case DebugNodeState.FocusOnNode:
                {
                    m_window.FocusOnNode(m_node, 1, false);
                    m_screenShotState = DebugNodeState.TakeScreenshot;
                }
                break;

                case DebugNodeState.TakeScreenshot:
                {
                    if (m_screenshotRT != null && Event.current.type == EventType.repaint)
                    {
                        m_screenshotTex2D.ReadPixels(new Rect(0, 0, m_screenshotRT.width, m_screenshotRT.height), 0, 0);
                        m_screenshotTex2D.Apply();

                        byte[] bytes           = m_screenshotTex2D.EncodeToPNG();
                        string pictureFilename = UIUtils.ReplaceInvalidStrings(m_screenshotList[0].Name);
                        pictureFilename = UIUtils.RemoveInvalidCharacters(pictureFilename);

                        System.IO.File.WriteAllBytes(m_pathname + pictureFilename + ".png", bytes);
                        m_screenShotState = DebugNodeState.WaitFrame;
                    }
                }
                break;

                case DebugNodeState.WaitFrame: { Debug.Log("Wait Frame"); m_screenShotState = DebugNodeState.DeleteNode; } break;

                case DebugNodeState.DeleteNode:
                {
                    m_window.DestroyNode(m_node);
                    m_screenshotList.RemoveAt(0);
                    m_takingShots = m_screenshotList.Count > 0;
                    Debug.Log("Destroy Node " + m_screenshotList.Count);

                    if (m_takingShots)
                    {
                        m_screenShotState = DebugNodeState.CreateNode;
                    }
                    else
                    {
                        RenderTexture.active = null;
                        m_screenshotRT.Release();
                        UnityEngine.Object.DestroyImmediate(m_screenshotRT);
                        m_screenshotRT = null;
                        UnityEngine.Object.DestroyImmediate(m_screenshotTex2D);
                        m_screenshotTex2D = null;
                    }
                }
                break;
                }
                ;
            }
        }
コード例 #27
0
ファイル: ParentInfo.cs プロジェクト: jgrisham/Power-Fx
 public ParentInfo(ParentNode node, DPath path, IExternalControl data)
     : base(node, path, data)
 {
 }
コード例 #28
0
        public void VisitNode(JSUnaryOperatorExpression uoe)
        {
            var type       = uoe.Expression.GetActualType(TypeSystem);
            var isIntegral = TypeUtil.Is32BitIntegral(type);

            if (isIntegral && (uoe.Operator is JSUnaryMutationOperator))
            {
                if (
                    (uoe.Operator == JSOperator.PreIncrement) ||
                    (uoe.Operator == JSOperator.PreDecrement)
                    )
                {
                    var assignment = MakeUnaryMutation(
                        uoe.Expression,
                        (uoe.Operator == JSOperator.PreDecrement)
                            ? JSOperator.Subtract
                            : JSOperator.Add,
                        type
                        );

                    ParentNode.ReplaceChild(uoe, assignment);
                    VisitReplacement(assignment);
                    return;
                }
                else if (
                    (uoe.Operator == JSOperator.PostIncrement) ||
                    (uoe.Operator == JSOperator.PostDecrement)
                    )
                {
                    // FIXME: Terrible hack
                    var tempVariable = TemporaryVariable.ForFunction(
                        Stack.Last() as JSFunctionExpression, type
                        );
                    var makeTempCopy = new JSBinaryOperatorExpression(
                        JSOperator.Assignment, tempVariable, uoe.Expression, type
                        );
                    var assignment = MakeUnaryMutation(
                        uoe.Expression,
                        (uoe.Operator == JSOperator.PostDecrement)
                            ? JSOperator.Subtract
                            : JSOperator.Add,
                        type
                        );

                    var comma = new JSCommaExpression(
                        makeTempCopy,
                        assignment,
                        tempVariable
                        );

                    ParentNode.ReplaceChild(uoe, comma);
                    VisitReplacement(comma);
                    return;
                }
                else
                {
                    throw new NotImplementedException("Unary mutation not supported: " + uoe);
                }
            }

            VisitChildren(uoe);
        }
コード例 #29
0
		public override void Leave (ParentNode node)
		{
			indent--;
		}
コード例 #30
0
 public void Destroy()
 {
     m_availableTags.Clear();
     m_availableTags = null;
     m_currentOwner  = null;
 }
コード例 #31
0
        public void VisitNode(JSBinaryOperatorExpression boe)
        {
            var leftType     = boe.Left.GetActualType(TypeSystem);
            var leftIsEnum   = IsEnumOrNullableEnum(leftType);
            var rightType    = boe.Right.GetActualType(TypeSystem);
            var rightIsEnum  = IsEnumOrNullableEnum(rightType);
            var resultType   = boe.GetActualType(TypeSystem);
            var resultIsEnum = IsEnumOrNullableEnum(resultType);

            var eitherIsEnum = leftIsEnum || rightIsEnum;

            var assignmentOperator = boe.Operator as JSAssignmentOperator;
            JSBinaryOperator           replacementOperator;
            JSBinaryOperatorExpression replacement;

            if (LogicalOperators.Contains(boe.Operator))
            {
                if (eitherIsEnum)
                {
                    if (leftIsEnum)
                    {
                        var cast = JSInvocationExpression.InvokeMethod(
                            JS.valueOf(TypeSystem.Int32), boe.Left, null, true
                            );

                        boe.ReplaceChild(boe.Left, cast);
                    }

                    if (rightIsEnum)
                    {
                        var cast = JSInvocationExpression.InvokeMethod(
                            JS.valueOf(TypeSystem.Int32), boe.Right, null, true
                            );

                        boe.ReplaceChild(boe.Right, cast);
                    }
                }
            }
            else if (BitwiseOperators.Contains(boe.Operator))
            {
                var parentCast        = ParentNode as JSCastExpression;
                var parentReinterpret = Stack.Skip(2).FirstOrDefault() as JSChangeTypeExpression;

                if (resultIsEnum &&
                    ((parentCast == null) || (parentCast.NewType != resultType)) &&
                    ((parentReinterpret == null) || (parentReinterpret.NewType != resultType))
                    )
                {
                    var cast = CastToEnumType(boe, resultType);

                    ParentNode.ReplaceChild(boe, cast);
                    VisitReplacement(cast);
                }
            }
            else if (
                leftIsEnum &&
                ((replacement = DeconstructMutationAssignment(boe, TypeSystem, TypeSystem.Int32)) != null)
                )
            {
                ParentNode.ReplaceChild(boe, replacement);
                VisitReplacement(replacement);
                return;
            }

            VisitChildren(boe);
        }
コード例 #32
0
		public override void ShowUnreadableDataMessage( ParentNode owner )
		{
			bool foldoutValue = owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth:
			NodeUtils.DrawPropertyGroup( ref foldoutValue, ZBufferOpHelper.DepthParametersStr, base.ShowUnreadableDataMessage ):
			owner.ContainerGraph.ParentWindow.InnerWindowVariables.ExpandedDepth = foldoutValue:
		}
コード例 #33
0
        public void VisitNode(JSInvocationExpression invocation)
        {
            FunctionAnalysis2ndPass sa = null;

            if (invocation.JSMethod != null)
            {
                sa = GetSecondPass(invocation.JSMethod);
            }

            CloneArgumentsIfNecessary(invocation.Parameters, invocation.Arguments, sa);

            var thisReference = invocation.ThisReference;

            if (
                (thisReference != null) &&
                (sa != null) &&
                !(ParentNode is JSCommaExpression) &&
                !(thisReference is JSStructCopyExpression) &&
                !(
                    (ParentNode is JSResultReferenceExpression) &&
                    Stack.OfType <JSCommaExpression>().Any()
                    ) &&
                (
                    sa.ViolatesThisReferenceImmutability ||
                    sa.ModifiedVariables.Contains("this") ||
                    sa.EscapingVariables.Contains("this")
                )
                )
            {
                // The method we're calling violates immutability so we need to clone the this-reference
                //  before we call it.
                var thisReferenceType = thisReference.GetActualType(TypeSystem);

                if (TypeUtil.IsStruct(thisReferenceType) && !TypeUtil.IsStructImmutable(thisReferenceType))
                {
                    if ((thisReference is JSVariable) || (thisReference is JSFieldAccess))
                    {
                        var rre       = ParentNode as JSResultReferenceExpression;
                        var cloneExpr = new JSBinaryOperatorExpression(
                            JSOperator.Assignment, thisReference, new JSStructCopyExpression(thisReference), thisReferenceType
                            );
                        var commaExpression = new JSCommaExpression(
                            cloneExpr,
                            (rre != null)
                                ? (JSExpression) new JSResultReferenceExpression(invocation)
                                : (JSExpression)invocation
                            );

                        if (rre != null)
                        {
                            ResultReferenceReplacement = commaExpression;
                        }
                        else
                        {
                            ParentNode.ReplaceChild(invocation, commaExpression);
                            VisitReplacement(commaExpression);
                        }
                    }
                    else
                    {
                        invocation.ReplaceChild(thisReference, new JSStructCopyExpression(thisReference));
                        VisitChildren(invocation);
                    }

                    return;
                }
            }

            VisitChildren(invocation);
        }
コード例 #34
0
ファイル: ActionData.cs プロジェクト: DGiroud/JavelinVR
		public override void ExecuteReverse()
		{
			ParentNode node = UIUtils.GetNode( m_nodeId ):
			if ( node != null )
				node.Vec2Position = m_nodeInitalPos:
		}
コード例 #35
0
ファイル: ReplaceMethodCalls.cs プロジェクト: dzeitlin/JSIL
        public void VisitNode(JSInvocationExpression ie)
        {
            var type           = ie.JSType;
            var method         = ie.JSMethod;
            var thisExpression = ie.ThisReference;

            if (method != null)
            {
                if (
                    (type != null) &&
                    (type.Type.FullName == "System.Object")
                    )
                {
                    switch (method.Method.Member.Name)
                    {
                    case ".ctor": {
                        var replacement = new JSNullExpression();
                        ParentNode.ReplaceChild(ie, replacement);
                        VisitReplacement(replacement);

                        return;
                    }

                    case "ReferenceEquals": {
                        var lhs = ie.Arguments[0];
                        var rhs = ie.Arguments[1];

                        var lhsType = lhs.GetActualType(TypeSystem);
                        var rhsType = rhs.GetActualType(TypeSystem);

                        JSNode replacement;

                        // Structs can never compare equal with ReferenceEquals
                        if (TypeUtil.IsStruct(lhsType) || TypeUtil.IsStruct(rhsType))
                        {
                            replacement = JSLiteral.New(false);
                        }
                        else
                        {
                            replacement = new JSBinaryOperatorExpression(
                                JSOperator.Equal,
                                lhs, rhs,
                                TypeSystem.Boolean
                                );
                        }

                        ParentNode.ReplaceChild(ie, replacement);
                        VisitReplacement(replacement);

                        return;
                    }

                    case "GetType": {
                        JSNode replacement;

                        var thisType = JSExpression.DeReferenceType(thisExpression.GetActualType(TypeSystem), false);
                        if ((thisType is GenericInstanceType) && thisType.FullName.StartsWith("System.Nullable"))
                        {
                            var git = (GenericInstanceType)thisType;

                            replacement = new JSTernaryOperatorExpression(
                                new JSBinaryOperatorExpression(
                                    JSOperator.NotEqual,
                                    thisExpression, new JSNullLiteral(thisType),
                                    TypeSystem.Boolean
                                    ),
                                new JSTypeOfExpression(git.GenericArguments[0]),
                                JSIL.ThrowNullReferenceException(),
                                new TypeReference("System", "Type", TypeSystem.Object.Module, TypeSystem.Object.Scope, false)
                                );
                        }
                        else
                        {
                            replacement = JSIL.GetTypeOf(thisExpression);
                        }

                        ParentNode.ReplaceChild(ie, replacement);
                        VisitReplacement(replacement);

                        return;
                    }
                    }
                }
                else if (
                    (type != null) &&
                    (type.Type.FullName == "System.ValueType")
                    )
                {
                    switch (method.Method.Member.Name)
                    {
                    case "Equals": {
                        var replacement = JSIL.StructEquals(ie.ThisReference, ie.Arguments.First());
                        ParentNode.ReplaceChild(ie, replacement);
                        VisitReplacement(replacement);

                        return;
                    }
                    }
                }
                else if (
                    (type != null) &&
                    IsNullable(type.Type)
                    )
                {
                    var t        = (type.Type as GenericInstanceType).GenericArguments[0];
                    var @null    = JSLiteral.Null(t);
                    var @default = new JSDefaultValueLiteral(t);

                    switch (method.Method.Member.Name)
                    {
                    case ".ctor":
                        JSExpression value;
                        if (ie.Arguments.Count == 0)
                        {
                            value = @null;
                        }
                        else
                        {
                            value = ie.Arguments[0];
                        }

                        var boe = new JSBinaryOperatorExpression(
                            JSOperator.Assignment, ie.ThisReference, value, type.Type
                            );
                        ParentNode.ReplaceChild(ie, boe);
                        VisitReplacement(boe);

                        break;

                    case "GetValueOrDefault": {
                        var replacement = JSIL.ValueOfNullableOrDefault(
                            ie.ThisReference,
                            (ie.Arguments.Count == 0)
                                    ? @default
                                    : ie.Arguments[0]
                            );

                        if (ParentNode is JSResultReferenceExpression)
                        {
                            // HACK: Replacing the invocation inside a result reference is incorrect, so we need to walk up the stack
                            //  and replace the result reference with the ternary instead.
                            _ResultReferenceReplacement = replacement;
                        }
                        else
                        {
                            ParentNode.ReplaceChild(ie, replacement);
                            VisitReplacement(replacement);
                        }

                        break;
                    }

                    case "get_HasValue": {
                        var replacement = JSIL.NullableHasValue(ie.ThisReference);
                        if (ParentNode is JSResultReferenceExpression)
                        {
                            _ResultReferenceReplacement = replacement;
                        }
                        else
                        {
                            ParentNode.ReplaceChild(ie, replacement);
                            VisitReplacement(replacement);
                        }

                        break;
                    }

                    case "get_Value": {
                        var replacement = JSIL.ValueOfNullable(ie.ThisReference);
                        if (ParentNode is JSResultReferenceExpression)
                        {
                            _ResultReferenceReplacement = replacement;
                        }
                        else
                        {
                            ParentNode.ReplaceChild(ie, replacement);
                            VisitReplacement(replacement);
                        }

                        break;
                    }

                    case "Equals":
                        JSBinaryOperatorExpression equality = new JSBinaryOperatorExpression(JSOperator.Equal, ie.ThisReference, ie.Parameters.First().Value, type.Type);
                        ParentNode.ReplaceChild(ie, equality);
                        VisitReplacement(equality);
                        break;

                    default:
                        throw new NotImplementedException(method.Method.Member.FullName);
                    }

                    return;
                }
                else if (
                    (type != null) &&
                    TypeUtil.TypesAreEqual(TypeSystem.String, type.Type) &&
                    (method.Method.Name == "Concat")
                    )
                {
                    if (ie.Arguments.Count > 2)
                    {
                        if (ie.Arguments.All(
                                (arg) => TypeUtil.TypesAreEqual(
                                    TypeSystem.String, arg.GetActualType(TypeSystem)
                                    )
                                ))
                        {
                            var boe = JSBinaryOperatorExpression.New(
                                JSOperator.Add,
                                ie.Arguments,
                                TypeSystem.String
                                );

                            ParentNode.ReplaceChild(
                                ie,
                                boe
                                );

                            VisitReplacement(boe);
                        }
                    }
                    else if (
                        // HACK: Fix for #239, only convert concat call into + if both sides are non-null literals
                        (ie.Arguments.Count == 2)
                        )
                    {
                        var lhs = ie.Arguments[0];
                        var rhs = ie.Arguments[1];

                        var isAddOk = (lhs is JSStringLiteral) && (rhs is JSStringLiteral);

                        var lhsType = TypeUtil.DereferenceType(lhs.GetActualType(TypeSystem));
                        if (!(
                                TypeUtil.TypesAreEqual(TypeSystem.String, lhsType) ||
                                TypeUtil.TypesAreEqual(TypeSystem.Char, lhsType)
                                ))
                        {
                            lhs     = JSInvocationExpression.InvokeMethod(lhsType, JS.toString, lhs, null);
                            isAddOk = true;
                        }

                        var rhsType = TypeUtil.DereferenceType(rhs.GetActualType(TypeSystem));
                        if (!(
                                TypeUtil.TypesAreEqual(TypeSystem.String, rhsType) ||
                                TypeUtil.TypesAreEqual(TypeSystem.Char, rhsType)
                                ))
                        {
                            rhs     = JSInvocationExpression.InvokeMethod(rhsType, JS.toString, rhs, null);
                            isAddOk = true;
                        }

                        if (isAddOk)
                        {
                            var boe = new JSBinaryOperatorExpression(
                                JSOperator.Add, lhs, rhs, TypeSystem.String
                                );

                            ParentNode.ReplaceChild(
                                ie, boe
                                );

                            VisitReplacement(boe);
                        }
                    }
                    else if (
                        TypeUtil.GetTypeDefinition(ie.Arguments[0].GetActualType(TypeSystem)).FullName == "System.Array"
                        )
                    {
                    }
                    else
                    {
                        var firstArg = ie.Arguments.FirstOrDefault();

                        ParentNode.ReplaceChild(
                            ie, firstArg
                            );

                        if (firstArg != null)
                        {
                            VisitReplacement(firstArg);
                        }
                    }
                    return;
                }
                else if (
                    TypeUtil.IsDelegateType(method.Reference.DeclaringType) &&
                    (method.Method.Name == "Invoke")
                    )
                {
                    var newIe = new JSDelegateInvocationExpression(
                        thisExpression, ie.GetActualType(TypeSystem), ie.Arguments.ToArray()
                        );
                    ParentNode.ReplaceChild(ie, newIe);

                    VisitReplacement(newIe);
                    return;
                }
                else if (
                    (method.Reference.DeclaringType.Name == "RuntimeHelpers") &&
                    (method.Method.Name == "InitializeArray")
                    )
                {
                    var array       = ie.Arguments[0];
                    var arrayType   = array.GetActualType(TypeSystem);
                    var field       = ie.Arguments[1].SelfAndChildrenRecursive.OfType <JSField>().First();
                    var initializer = JSArrayExpression.UnpackArrayInitializer(arrayType, field.Field.Member.InitialValue);

                    var copy = JSIL.ShallowCopy(array, initializer, arrayType);
                    ParentNode.ReplaceChild(ie, copy);
                    VisitReplacement(copy);
                    return;
                }
                else if (
                    method.Reference.DeclaringType.FullName == "System.Reflection.Assembly"
                    )
                {
                    switch (method.Reference.Name)
                    {
                    case "GetExecutingAssembly": {
                        var assembly = Method.DeclaringType.Module.Assembly;
                        var asmNode  = new JSReflectionAssembly(assembly);
                        ParentNode.ReplaceChild(ie, asmNode);
                        VisitReplacement(asmNode);

                        return;
                    }
                    }
                }
                else if (
                    method.Method.DeclaringType.Definition.FullName == "System.Array" &&
                    (ie.Arguments.Count == 1)
                    )
                {
                    switch (method.Method.Name)
                    {
                    case "GetLength":
                    case "GetUpperBound": {
                        var index = ie.Arguments[0] as JSLiteral;
                        if (index != null)
                        {
                            var newDot = JSDotExpression.New(thisExpression, new JSStringIdentifier(
                                                                 String.Format("length{0}", Convert.ToInt32(index.Literal)),
                                                                 TypeSystem.Int32
                                                                 ));

                            if (method.Method.Name == "GetUpperBound")
                            {
                                var newExpr = new JSBinaryOperatorExpression(
                                    JSOperator.Subtract, newDot, JSLiteral.New(1), TypeSystem.Int32
                                    );
                                ParentNode.ReplaceChild(ie, newExpr);
                            }
                            else
                            {
                                ParentNode.ReplaceChild(ie, newDot);
                            }
                        }
                        break;
                    }

                    case "GetLowerBound":
                        ParentNode.ReplaceChild(ie, JSLiteral.New(0));
                        break;
                    }
                }
            }

            VisitChildren(ie);
        }
コード例 #36
0
ファイル: NavLinkNode.cs プロジェクト: storm32600/FlaxEngine
 /// <inheritdoc />
 public override void OnDebugDraw(ViewportDebugDrawData data)
 {
     ParentNode.OnDebugDraw(data);
 }
コード例 #37
0
		public void Draw( ParentNode owner, TemplateModulesData currentModule , TemplateModulesHelper parent = null )
		{
			if( currentModule.ShaderModel.DataCheck == TemplateDataCheck.Valid )
				m_shaderModelHelper.Draw( owner ):

			m_isDirty = m_shaderModelHelper.IsDirty:

			if( currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid )
				m_cullModeHelper.Draw( owner ):

			m_isDirty = m_isDirty || m_cullModeHelper.IsDirty:

			if( currentModule.ColorMaskData.DataCheck == TemplateDataCheck.Valid )
				m_colorMaskHelper.Draw( owner ):

			m_isDirty = m_isDirty || m_colorMaskHelper.IsDirty:

			if( currentModule.DepthData.DataCheck == TemplateDataCheck.Valid )
				m_depthOphelper.Draw( owner, false ):

			m_isDirty = m_isDirty || m_depthOphelper.IsDirty:

			if( currentModule.BlendData.DataCheck == TemplateDataCheck.Valid )
				m_blendOpHelper.Draw( owner, false ):

			m_isDirty = m_isDirty || m_blendOpHelper.IsDirty:


			if( currentModule.StencilData.DataCheck == TemplateDataCheck.Valid )
			{
				CullMode cullMode = CullMode.Back:
				if( currentModule.CullModeData.DataCheck == TemplateDataCheck.Valid )
				{
					cullMode = m_cullModeHelper.CurrentCullMode:
				}
				else if( parent != null && parent.CullModeHelper.ValidData )
				{
					cullMode = parent.CullModeHelper.CurrentCullMode:
				}
				m_stencilBufferHelper.Draw( owner, cullMode, false ):
			}

			m_isDirty = m_isDirty || m_stencilBufferHelper.IsDirty:

			if( currentModule.TagData.DataCheck == TemplateDataCheck.Valid )
				m_tagsHelper.Draw( owner, false ):

			m_isDirty = m_isDirty || m_tagsHelper.IsDirty:

			if( currentModule.PragmaTag.IsValid )
			{
				//m_additionalDefines.Draw( owner ):
				//m_additionalIncludes.Draw( owner ):
				//m_additionalPragmas.Draw( owner ):
				m_additionalDirectives.Draw( owner , false):
			}

			m_isDirty = m_isDirty ||
						//m_additionalDefines.IsDirty ||
						//m_additionalIncludes.IsDirty ||
						//m_additionalPragmas.IsDirty || 
						m_additionalDirectives.IsDirty:
		}
コード例 #38
0
 public virtual void ShowUnreadableDataMessage(ParentNode owner)
 {
     ShowUnreadableDataMessage();
 }
コード例 #39
0
        public void DuplicateMe()
        {
            bool previewOpen = m_showPreview;

            string allOptions = m_allFunctionSwitches.Count.ToString();

            for (int i = 0; i < m_allFunctionSwitches.Count; i++)
            {
                allOptions += "," + m_allFunctionSwitches[i].UniqueId + "," + m_allFunctionSwitches[i].GetCurrentSelectedInput();
            }

            ReadOptionsHelper = allOptions.Split(',');

            ParentGraph cachedGraph = ContainerGraph.ParentWindow.CustomGraph;

            ContainerGraph.ParentWindow.CustomGraph = null;
            if (ContainerGraph.ParentWindow.CurrentGraph.CurrentStandardSurface != null)
            {
                ContainerGraph.ParentWindow.CurrentGraph.CurrentStandardSurface.InvalidateMaterialPropertyCount();
            }
            ContainerGraph.ParentWindow.CustomGraph = cachedGraph;

            ParentNode newNode = ContainerGraph.CreateNode(m_function, false, Vec2Position);

            newNode.ShowPreview = previewOpen;
            (newNode as FunctionNode).ReadOptionsHelper = ReadOptionsHelper;
            newNode.RefreshExternalReferences();
            if ((newNode as FunctionNode).m_reordenator && m_reordenator)
            {
                (newNode as FunctionNode).m_reordenator.OrderIndex = m_reordenator.OrderIndex;
            }

            for (int i = 0; i < m_outputPorts.Count; i++)
            {
                if (m_outputPorts[i].IsConnected)
                {
                    OutputPort newOutputPort = newNode.GetOutputPortByUniqueId(m_outputPorts[i].PortId);
                    if (newNode.OutputPorts != null && newOutputPort != null)
                    {
                        for (int j = m_outputPorts[i].ExternalReferences.Count - 1; j >= 0; j--)
                        {
                            ContainerGraph.CreateConnection(m_outputPorts[i].ExternalReferences[j].NodeId, m_outputPorts[i].ExternalReferences[j].PortId, newOutputPort.NodeId, newOutputPort.PortId);
                        }
                    }
                }
                //else
                //{
                //if( newNode.OutputPorts != null && newNode.OutputPorts[ i ] != null )
                //{
                //    ContainerGraph.DeleteConnection( false, newNode.UniqueId, newNode.OutputPorts[ i ].PortId, false, false, false );
                //}
                //}
            }

            for (int i = 0; i < m_inputPorts.Count; i++)
            {
                if (m_inputPorts[i].IsConnected)
                {
                    InputPort newInputPort = newNode.GetInputPortByUniqueId(m_inputPorts[i].PortId);
                    if (newNode.InputPorts != null && newInputPort != null)
                    {
                        ContainerGraph.CreateConnection(newInputPort.NodeId, newInputPort.PortId, m_inputPorts[i].ExternalReferences[0].NodeId, m_inputPorts[i].ExternalReferences[0].PortId);
                    }
                }
            }

            ContainerGraph.OnDuplicateEvent -= DuplicateMe;

            if (Selected)
            {
                ContainerGraph.DeselectNode(this);
                ContainerGraph.SelectNode(newNode, true, false);
            }

            ContainerGraph.DestroyNode(this, false);
        }
コード例 #40
0
        public void Draw(ParentNode owner, GUIStyle toolbarstyle, Material mat)
        {
            Color cachedColor = GUI.color;

            GUI.color = new Color(cachedColor.r, cachedColor.g, cachedColor.b, 0.5f);
            EditorGUILayout.BeginHorizontal(toolbarstyle);
            GUI.color = cachedColor;
            owner.ContainerGraph.ParentWindow.InnerWindowVariables.OutlineActiveMode = owner.GUILayoutToggle(owner.ContainerGraph.ParentWindow.InnerWindowVariables.OutlineActiveMode, EditorVariablesManager.OutlineActiveMode.LabelName, UIUtils.MenuItemToggleStyle, GUILayout.ExpandWidth(true));
            EditorGUI.BeginChangeCheck();
            m_enabled = owner.EditorGUILayoutToggle(string.Empty, m_enabled, UIUtils.MenuItemEnableStyle, GUILayout.Width(16));
            if (EditorGUI.EndChangeCheck())
            {
                if (m_enabled)
                {
                    UpdateToMaterial(mat);
                }

                UIUtils.RequestSave();
            }
            EditorGUILayout.EndHorizontal();

            if (owner.ContainerGraph.ParentWindow.InnerWindowVariables.OutlineActiveMode)
            {
                cachedColor = GUI.color;
                GUI.color   = new Color(cachedColor.r, cachedColor.g, cachedColor.b, (EditorGUIUtility.isProSkin ? 0.5f : 0.25f));
                EditorGUILayout.BeginVertical(UIUtils.MenuItemBackgroundStyle);
                GUI.color = cachedColor;

                EditorGUILayout.Separator();
                EditorGUI.BeginDisabledGroup(!m_enabled);

                EditorGUI.indentLevel += 1;
                {
                    m_mode = (OutlineMode)owner.EditorGUILayoutEnumPopup(ModePropertyStr, m_mode);

                    EditorGUI.BeginChangeCheck();
                    m_outlineColor = owner.EditorGUILayoutColorField(OutlineColorLabel, m_outlineColor);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(ColorPropertyName))
                        {
                            mat.SetColor(ColorPropertyName, m_outlineColor);
                        }
                    }

                    EditorGUI.BeginChangeCheck();
                    m_outlineWidth = owner.EditorGUILayoutFloatField(OutlineWidthLabel, m_outlineWidth);
                    if (EditorGUI.EndChangeCheck() && mat != null)
                    {
                        if (mat.HasProperty(WidthPropertyName))
                        {
                            mat.SetFloat(WidthPropertyName, m_outlineWidth);
                        }
                    }

                    m_noFog = owner.EditorGUILayoutToggle(NoFogStr, m_noFog);
                }

                EditorGUI.indentLevel -= 1;
                EditorGUI.EndDisabledGroup();
                EditorGUILayout.Separator();
                EditorGUILayout.EndVertical();
            }
        }
コード例 #41
0
        public void Remove(int index)
        {
            User user = this[index];

            ParentNode.RemoveChild(user.Node);
        }
コード例 #42
0
 private void OnCheckBoxChanged(CheckBox checkBox)
 {
     ParentNode.SetValue(Archetype.ValueIndex, checkBox.Checked);
 }
コード例 #43
0
        public void Remove(string name)
        {
            User user = this[name];

            ParentNode.RemoveChild(user.Node);
        }
コード例 #44
0
 public void Destroy()
 {
     m_additionalIncludes.Clear();
     m_additionalIncludes = null;
     m_currentOwner       = null;
 }
コード例 #45
0
 /// <summary>
 /// create the parentnode of the chart
 /// </summary>
 /// <param name="objectlink"></param>
 public XElement CreateParentNode(string objectlink)
 {
     ParentNode.SetAttributeValue(Ns.XLink + "href", objectlink);
     return(ParentNode);
 }
コード例 #46
0
        public void Remove(int index)
        {
            Element element = this[index];

            ParentNode.RemoveChild(element.Node);
        }
コード例 #47
0
 public IEnumerable <TargetFrameworkNode> GetTargetFrameworkNodes()
 {
     return(ParentNode.GetTargetFrameworkNodes(sdkDependencies: false));
 }
コード例 #48
0
 public ChildNode(ParentNode parent)
 {
     _parent = parent;
 }
コード例 #49
0
    public void UpdateShape(ShapeType goalShape, ParentNode p)
    {
        this.gameObject.GetComponent<ColorBehavior>().Set_Color(goalShape);
        //Transform to goal shape
        bool changed = false;

        if (_meshRenderer != null)
        {
            if (goalShape != ShapeType.Circle)
            {
                float currentGoalWeight = _meshRenderer.GetBlendShapeWeight(ShapeToInt(goalShape));
                if(currentGoalWeight < 100)
                {
                    float newval = currentGoalWeight + 2f / (p!=null?((float)p.ChildCount()):1f);
                    _meshRenderer.SetBlendShapeWeight(ShapeToInt(goalShape), newval);
                }
                else
                {
                    changed = true;
                }
            }
            else
            {
                changed = true;
            }

            for (int i = 0; i < 5; i++)
            {
                if (i != ShapeToInt(goalShape))
                {
                    float currentWeight = _meshRenderer.GetBlendShapeWeight(i);
                    if(currentWeight > 0)
                    {
                        float newval = currentWeight - 2f / (p!=null?((float)p.ChildCount()):1f);
                        _meshRenderer.SetBlendShapeWeight(i, newval);
                    }

                }
            }
            if (changed && InCorrectShape(goalShape))
            {

                if(this.gameObject.tag == "Player" && p != null)
                {
                    p.SetTargetForChildren(this.gameObject);
                    this.gameObject.GetComponent<PlayerController>()._currentShape = goalShape;
                    this._shapeType = goalShape;

                }
                else if(p!= null)
                {
                    p.SetTargetForChildren(GameObject.FindGameObjectWithTag("Player"));
                    this._shapeType = goalShape;
                }
                else if(this.gameObject.tag != "Player" && _target == _originalParentNode)
                {
                    this.transform.parent = _originalParentNode.transform;
                    _originalParentNode.GetComponent<CircleCollider2D>().isTrigger = false;
                    if(GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>()._followers.Remove(this.gameObject))
                    {
                        GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerController>()._followerCount--;
                        _shapeType = goalShape;
                    }

                }
            }

        }
    }