Exemplo n.º 1
0
	//--------------------------------------
	// INITIALIZE
	//--------------------------------------

	void Awake() {

		instance = this;


		GameCenterManager.OnAuthFinished += OnAuthFinished;
		GameCenterManager.init ();



		b = gameObject.AddComponent<ConnectionButton> ();
		b.enabled = false;

		d = gameObject.AddComponent<DisconnectButton> ();
		d.enabled = false;

		m = gameObject.GetComponent<ClickManager> ();
		m.enabled = false;


		GameCenterMultiplayer.instance.addEventListener (GameCenterMultiplayer.PLAYER_DISCONNECTED, OnGCPlayerDisconnected);

		GameCenterMultiplayer.OnMatchStarted += OnGCMatchStart;

	}
    public ControlVariablesWindow(Rect position, AT_Node node)
        : base(position, "Control Variables", node)
    {
        m_varsNode = node as AT_ControlVariables;
        if (m_varsNode != null)
        {
            m_varsNode.Refresh ();

            m_buttons = new ConnectionButton[m_varsNode.Variables.Count];
            ConnectionPoints = m_buttons;
            int counter = 0;
            foreach (ControlVariable cv in m_varsNode.Variables)
            {
                if (cv != null)
                {
                    m_buttons[counter] = new ConnectionButton (this, ConnectionButton.ConnectionButtonType.kControlDataOut, cv.m_variableName, ConnectionButton.Alignment.kLeft);
                    counter++;
                }
            }
        }

        Rect pos = Position;
        float newHeight = 30 + 25 * m_varsNode.Variables.Count;
        pos.y = pos.y + pos.height - newHeight;
        pos.height = newHeight;
        pos.width = position.width;
        Position = pos;
    }
 public BlendContainerWindow(Rect position, AT_Node node)
     : base(position, "Blend Graph", node)
 {
     m_Out = new ConnectionButton(this, ConnectionButton.ConnectionButtonType.kAnimDataOut,"Out", ConnectionButton.Alignment.kLeft);
     ConnectionPoints = new ConnectionButton[1];
     ConnectionPoints[0] = m_Out;
 }
Exemplo n.º 4
0
 public ResultNodeWindow( Rect position, AT_Node node )
     : base(position, "Output", node)
 {
     m_In = new ConnectionButton( this, ConnectionButton.ConnectionButtonType.kAnimDataIn, "In", ConnectionButton.Alignment.kRight );
     ConnectionPoints = new ConnectionButton[2];
     ConnectionPoints[1] = m_In;
 }
Exemplo n.º 5
0
 private void ConnectionButton_Click(object sender, EventArgs e)
 {
     ipAddress = ipaddress.Text;
     Port      = Int32.Parse(port.Text);
     connect   = new connection(ipAddress, Port);
     KeepUpdating();
     ConnectionButton.Hide();
 }
Exemplo n.º 6
0
    public override void MakeConnection(ConnectionButton src, ConnectionButton dest)
    {
        AT_ContainerNode cont = TreeNode as AT_ContainerNode;
        AT_Node srcNode = src.ParentWindow.GetTreeNode();
        cont.InsertChild(srcNode, 0);

        cont.SetDirty();
        srcNode.SetDirty();
    }
Exemplo n.º 7
0
    public PoseNodeWindow(Rect position, string animation, AT_Node node)
        : base(position, "Pose", node)
    {
        m_AnimationName = animation;
        m_Out = new ConnectionButton(this, ConnectionButton.ConnectionButtonType.kAnimDataOut,"Out", ConnectionButton.Alignment.kLeft);
           // m_controlVariable = new ConnectionButton(this, ConnectionButton.ConnectionButtonType.kControlDataIn, "Time Control", ConnectionButton.Alignment.kRight);

        ConnectionPoints = new ConnectionButton[1];
        ConnectionPoints[0] = m_Out;

        Position = position;
    }
    int FindChildIndexFromButton(ConnectionButton button)
    {
        int targetChild = 0;
        for (int i = 1; i < ConnectionPoints.Length; i++)
        {
            if (ConnectionPoints[i] == button)
            {
                targetChild = i - 1;
            }
        }

        return targetChild;
    }
Exemplo n.º 9
0
        private async void Scan()
        {
            host = Dns.GetHostName();
#pragma warning disable CS0618 // Тип или член устарел
            IPAddress[] IPs = Dns.GetHostByName(host).AddressList;
#pragma warning restore CS0618 // Тип или член устарел
            string[] sub;
            var      tasks = new List <Task>();
            foreach (var addr in IPs)
            {
                IP  = addr.ToString();
                sub = IP.Split('.');
                IP  = sub[0] + "." + sub[1] + "." + sub[2] + ".";

                for (var i = 1; i < 255; i++)
                {
                    string subnet = IP + i.ToString();
                    tasks.Add(PingAndUpdateAsync(new Ping(), subnet));
                    //Thread.Sleep(5);
                }
            }

            await Task.WhenAll(tasks).ContinueWith(t =>
            {
                ConnectionButton.Invoke((MethodInvoker) delegate
                {
                    ConnectionButton.Enabled = true;
                });

                scanButton.Invoke((MethodInvoker) delegate
                {
                    scanButton.Enabled = true;
                });

                StopScanButton.Invoke((MethodInvoker) delegate
                {
                    StopScanButton.Enabled = false;
                });

                savedAddrs = addrs;
                this.CheckNameMatches();

                listBox1.Invoke((MethodInvoker) delegate
                {
                    foreach (string ad in addrs)
                    {
                        listBox1.Items.Add(ad);
                    }
                });
            });
        }
    public override void MakeConnection(ConnectionButton src, ConnectionButton dest)
    {
        if (src.m_type == ConnectionButton.ConnectionButtonType.kAnimDataOut)
        {
            int targetChild = FindChildIndexFromButton(dest);

            AT_ContainerNode cont = TreeNode as AT_ContainerNode;

            AT_Node srcNode = src.ParentWindow.GetTreeNode();
            cont.InsertChild(srcNode, targetChild);

            cont.SetDirty();
            srcNode.SetDirty();
        }
    }
Exemplo n.º 11
0
        void ReleaseDesignerOutlets()
        {
            if (StatusField != null)
            {
                StatusField.Dispose();
                StatusField = null;
            }

            if (ContextBox != null)
            {
                ContextBox.Dispose();
                ContextBox = null;
            }

            if (ConnectionBox != null)
            {
                ConnectionBox.Dispose();
                ConnectionBox = null;
            }

            if (ConnectionButton != null)
            {
                ConnectionButton.Dispose();
                ConnectionButton = null;
            }

            if (ResultTextBox != null)
            {
                ResultTextBox.Dispose();
                ResultTextBox = null;
            }

            if (ResultTable != null)
            {
                ResultTable.Dispose();
                ResultTable = null;
            }

            if (EditorBox != null)
            {
                EditorBox.Dispose();
                EditorBox = null;
            }
        }
    public AdditiveBlendNodeWindow(Rect position, AT_Node node)
        : base(position, "Additive Blend", node)
    {
        m_Out = new ConnectionButton( this, ConnectionButton.ConnectionButtonType.kAnimDataOut, "Out", ConnectionButton.Alignment.kLeft );

        AT_AdditiveBlend blendNode = (AT_AdditiveBlend)node;
        int childCount = blendNode.Children.Count;

        position.height = 30 + (30 * childCount);
        Position = position;

        ConnectionPoints = new ConnectionButton[childCount + 1];
        ConnectionPoints[0] = m_Out;

        for (int i = 0; i < childCount; i++)
        {
            ConnectionPoints[i + 1] = new ConnectionButton(this, ConnectionButton.ConnectionButtonType.kAnimDataIn, "In " + (i + 1), ConnectionButton.Alignment.kRight);
        }
    }
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    void Awake()
    {
        instance = this;


        GameCenterManager.OnAuthFinished += OnAuthFinished;
        GameCenterManager.Init();



        b         = gameObject.AddComponent <ConnectionButton> ();
        b.enabled = false;

        d         = gameObject.AddComponent <DisconnectButton> ();
        d.enabled = false;

        m         = gameObject.GetComponent <ClickManagerExample> ();
        m.enabled = false;


        GameCenter_RTM.ActionPlayerStateChanged += HandleActionPlayerStateChanged;;
        GameCenter_RTM.ActionMatchStarted       += HandleActionMatchStarted;
    }
Exemplo n.º 14
0
    public AnimationNodeWindow(Rect position, string animation, AT_Node node)
        : base(position, "Animation", node)
    {
        m_AnimationName = animation;
        m_Out = new ConnectionButton(this, ConnectionButton.ConnectionButtonType.kAnimDataOut,"Out", ConnectionButton.Alignment.kLeft);
        m_controlVariable = new ConnectionButton(this, ConnectionButton.ConnectionButtonType.kControlDataIn, "Time Control", ConnectionButton.Alignment.kRight);
        m_speedControlVariable = new ConnectionButton(this, ConnectionButton.ConnectionButtonType.kControlDataIn, "Speed Control", ConnectionButton.Alignment.kRight);

        ConnectionPoints = new ConnectionButton[1];
        ConnectionPoints[0] = m_Out;

        if ((node as AT_Animation).m_animTimeControlled)
        {
            position.height = 100;
        }

        if ((node as AT_Animation).animSpeedControlled)
        {
            position.height = 100;
        }

        Position = position;
    }
Exemplo n.º 15
0
	//--------------------------------------
	// INITIALIZE
	//--------------------------------------

	void Awake() {

		instance = this;


		GameCenterManager.OnAuthFinished += OnAuthFinished;
		GameCenterManager.Init ();



		b = gameObject.AddComponent<ConnectionButton> ();
		b.enabled = false;

		d = gameObject.AddComponent<DisconnectButton> ();
		d.enabled = false;

		m = gameObject.GetComponent<ClickManager> ();
		m.enabled = false;


		GameCenter_RTM.ActionPlayerStateChanged += HandleActionPlayerStateChanged;;
		GameCenter_RTM.ActionMatchStarted += HandleActionMatchStarted;

	}
Exemplo n.º 16
0
    //--------------------------------------
    // INITIALIZE
    //--------------------------------------

    void Awake()
    {
        instance = this;


        GameCenterManager.OnAuthFinished += OnAuthFinished;
        GameCenterManager.init();



        b         = gameObject.AddComponent <ConnectionButton> ();
        b.enabled = false;

        d         = gameObject.AddComponent <DisconnectButton> ();
        d.enabled = false;

        m         = gameObject.GetComponent <ClickManager> ();
        m.enabled = false;


        GameCenterMultiplayer.instance.addEventListener(GameCenterMultiplayer.PLAYER_DISCONNECTED, OnGCPlayerDisconnected);

        GameCenterMultiplayer.OnMatchStarted += OnGCMatchStart;
    }
Exemplo n.º 17
0
 public override void MakeConnection(ConnectionButton src, ConnectionButton dest)
 {
     if (dest == m_controlVariable)
     {
         //ControlVariablesWindow win = src.ParentWindow as ControlVariablesWindow;
         AT_Animation anim = TreeNode as AT_Animation;
         anim.m_animTimeControlVar = anim.ParentTree.m_controlVarsNode.GetVariable(src.Label);
         //blend.m_var = blend.ParentTree.ControlVariables[src.Label];
     }
     else if ( dest == m_speedControlVariable )
     {
         AT_Animation anim = TreeNode as AT_Animation;
         anim.m_animSpeedControlVar = anim.ParentTree.m_controlVarsNode.GetVariable(src.Label);
     }
 }
Exemplo n.º 18
0
    public override void MakeConnection(ConnectionButton src, ConnectionButton dest)
    {
        if (src.m_type == ConnectionButton.ConnectionButtonType.kAnimDataOut)
        {
            int targetChild = FindChildIndexFromButton(dest);

            AT_ContainerNode cont = TreeNode as AT_ContainerNode;

            AT_Node srcNode = src.ParentWindow.GetTreeNode();
            cont.InsertChild(srcNode, targetChild);

            cont.SetDirty();
            srcNode.SetDirty();
        }
        else
        {
            if (dest == m_controlVariable)
            {
                //ControlVariablesWindow win = src.ParentWindow as ControlVariablesWindow;
                AT_Blend blend = TreeNode as AT_Blend;
                blend.m_controlVariable = blend.ParentTree.m_controlVarsNode.GetVariable(src.Label);
                //blend.m_var = blend.ParentTree.ControlVariables[src.Label];
            }
        }
    }
Exemplo n.º 19
0
    // Create a new data connection in a blend graph
    public void MakeConnection(ConnectionButton button)
    {
        if (ConnectionStart == null)
        {
            // Start new connection
            ConnectionStart = button;
        }
        else
        {
            // Finish and create a new connection
            ConnectionEnd = button;

            ConnectionButton[] buttons = new ConnectionButton[2];
            buttons[0] = ConnectionStart;
            buttons[1] = ConnectionEnd;

            ConnectionButton inConnection = null;
            ConnectionButton outConnection = null;

            // Get references to the in and out connections
            for (int i = 0; i < 2; i++)
            {
                if (buttons[i].m_type == ConnectionButton.ConnectionButtonType.kAnimDataOut || buttons[i].m_type == ConnectionButton.ConnectionButtonType.kControlDataOut)
                {
                    outConnection = buttons[i];
                }
                if (buttons[i].m_type == ConnectionButton.ConnectionButtonType.kAnimDataIn || buttons[i].m_type == ConnectionButton.ConnectionButtonType.kControlDataIn)
                {
                    inConnection = buttons[i];
                }
            }

            // Make sure that we are connecting the same types of data paths together
            bool valid = false;
            if ( inConnection != null && outConnection != null )
            {
                if ((inConnection.m_type == ConnectionButton.ConnectionButtonType.kAnimDataIn && outConnection.m_type == ConnectionButton.ConnectionButtonType.kAnimDataOut) ||
                   (inConnection.m_type == ConnectionButton.ConnectionButtonType.kControlDataIn && outConnection.m_type == ConnectionButton.ConnectionButtonType.kControlDataOut))
                {
                    if (inConnection.ParentWindow != outConnection.ParentWindow)
                    {
                        inConnection.ParentWindow.MakeConnection(outConnection, inConnection);
                        valid = true;
                    }
                }
            }

            if (valid)
            {
                ConnectionStart = null;
            }

            ConnectionEnd = null;

        }
    }
Exemplo n.º 20
0
    // Draw the editor GUI
    public void OnGUI()
    {
        // Refresh active Anim trees list
        switch (Event.current.type)
        {
            case EventType.MouseDown:
                // Left button
                if (Event.current.button == 0)
                {
                    m_activeAnimationTrees = GameObject.FindObjectsOfType(typeof(AnimationTree)) as AnimationTree[];
                }
            break;
        }

        Matrix4x4 matrixBackup = GUI.matrix;

        if ( m_editorWindow != null )
        {
            bool earlyOut = false;

            // Haven't selected an animation tree
            if (m_selectedAnimationTree == null)
            {
                TextAnchor origAnchor = GUI.skin.label.alignment;
                GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                GUI.Label(new Rect(0, 0, m_editorWindow.position.width, m_editorWindow.position.height), "No Animation Tree Selected");
                if (GUI.Button(new Rect(m_editorWindow.position.width * 0.5f - 50, m_editorWindow.position.height * 0.5f + 20, 100, 30), "Add New Tree"))
                {
                    AddNewAnimTree();
                }
                GUI.skin.label.alignment = origAnchor;
                earlyOut = true;
            }
            else
            {
                // Selected animation tree doesn't have a subject assigned
                if (m_selectedAnimationTree.m_subject == null)
                {
                    TextAnchor origAnchor = GUI.skin.label.alignment;
                    GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                    GUI.Label(new Rect(0, 0, m_editorWindow.position.width, m_editorWindow.position.height), "Set up the animation tree's subject before editing the tree\n\nDrag the 'Animation' onto 'Subject' in the inspector");
                    GUI.skin.label.alignment = origAnchor;
                    earlyOut = true;
                }
            }

            // If we're not going to draw this tree...
            if (earlyOut)
            {
                Rect winPos = m_editorWindow.position;

                GUI.skin = null;

                // Top info bar
                GUI.Box(new Rect(0, 0, winPos.width, 24), "");
                GUILayout.BeginArea(new Rect(9, 4, winPos.width, 20));

                GUILayout.BeginVertical(GUILayout.ExpandHeight(true));

                GUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
                DrawAnimTreeSelectionGUI();
                GUILayout.EndHorizontal();

                GUILayout.EndVertical();

                GUILayout.EndArea();
                return;
            }
        }

        // Handle the GUI events
        switch (Event.current.type)
        {
            case EventType.MouseDown:
                // Left button
                if (Event.current.button == 0)
                {
                    // Make sure we're not clicking in the top or bottom GUI portions of the editor.
                    // (This hardcoded method is fairly ass, but right now I don't care)
                    if ((Event.current.mousePosition.y < m_editorWindow.position.height - 90) && ( Event.current.mousePosition.y > 24 ) )
                    {
                        SelectWindow(Event.current.mousePosition);
                    }
                }

                // Middle button
                if (Event.current.button == 2)
                {
                    m_panningCamera = true;
                }

                break;
            case EventType.MouseUp:
                // Left button
                if (Event.current.button == 0)
                {
                    // Stop dragging the current window
                    Dragging = false;

                    // Finished drawing the transition if we were drawing one
                    if (m_drawingNewTransition)
                    {
                        SelectWindow(Event.current.mousePosition);
                        m_drawingNewTransition = false;
                    }
                }

                // Right button
                if (Event.current.button == 1)
                {
                    // Cancel creation of connection
                    ConnectionStart = null;
                    ConnectionEnd = null;
                }

                // Middle button
                if (Event.current.button == 2)
                {
                    m_panningCamera = false;
                }
                break;

            case EventType.MouseDrag:
                if (Dragging)
                {
                    // Send dragged values to active window
                    ActiveWindow.DeltaMove(Event.current.delta);
                }
                if (m_panningCamera)
                {
                    m_cameraOffset += new Vector3(Event.current.delta.x, Event.current.delta.y, 0);
                }
                m_currentMousePos = Event.current.mousePosition;
                break;
            case EventType.MouseMove:
                m_currentMousePos = Event.current.mousePosition;
                break;

            case EventType.ScrollWheel:
                // Zoom camera
                m_camerScaleAmount += new Vector3(-Event.current.delta.y, -Event.current.delta.y, 0) * 0.01f;
                break;

            case EventType.KeyDown:
                // Delete currently selected node
                if (Event.current.keyCode == KeyCode.Backspace || Event.current.keyCode == KeyCode.Delete)
                {
                    DeleteCurrentSelection();
                }
                break;
        }

        // Handle camera movement and zooming.
        // TODO: Fix all the issues with having an adjustable camera
        //GUI.matrix = Matrix4x4.TRS(m_cameraOffset, Quaternion.identity, new Vector3(m_camerScaleAmount.x, m_camerScaleAmount.x, 1)) * GUI.matrix;

        // Set the positions that the transitions connect to on each window
        AdjustTransitionPositions();

        // Draw each window
        foreach (NodeWindow nodeWin in m_Windows)
        {
            if (nodeWin as ControlVariablesWindow == null)
            {
                nodeWin.Draw();
            }
        }

        //Matrix4x4 beforeControls = GUI.matrix;

        //GUI.matrix = matrixBackup;

        Vector2 offsetBackup = m_cameraOffset;
        m_cameraOffset = Vector2.zero;

        // Draw the control variables window
        if (m_controlVarsWindow != null)
        {
            m_controlVarsWindow.Draw();
        }

        m_cameraOffset = offsetBackup;

        //GUI.matrix = beforeControls;

        GraphConnections();

        // Draw the transition that is currently being made
        if (m_drawingNewTransition)
        {
            DrawConnectionLine(m_newTransitionStart, m_currentMousePos, Color.white, false);
        }

        // Draw connection in progress
        if (ConnectionStart != null)
        {
            Vector2 startPos = ConnectionStart.LastPosition;
            Vector2 endPos = m_currentMousePos;

            if (ConnectionEnd != null)
            {
                endPos = ConnectionEnd.LastPosition;
            }

           /* Vector3 diff = endPos - startPos;
            Vector3 startTan = new Vector3(startPos.x + diff.x * 0.5f, startPos.y);
            Vector3 endTan = new Vector3(endPos.x - diff.x * 0.5f, endPos.y);*/

            //Handles.DrawBezier(startPos, endPos, startTan, endTan, Color.white, m_lineTexture, 0.75f);
            Color col = Color.white;
            switch (ConnectionStart.m_type)
            {
                case ConnectionButton.ConnectionButtonType.kAnimDataIn:
                case ConnectionButton.ConnectionButtonType.kAnimDataOut:
                    col = new Color(0.5f, 1.0f, 0.5f, 1);
                    break;
                case ConnectionButton.ConnectionButtonType.kControlDataIn:
                case ConnectionButton.ConnectionButtonType.kControlDataOut:
                    col = new Color(0.5f, 0.5f, 1, 1);
                    break;
            }

            DrawConnectionLine(startPos, endPos, col);
        }

        GUI.matrix = matrixBackup;

        // Draw global GUI
        DrawInterface();

        GUI.matrix = Matrix4x4.identity;//beforeControls.inverse;
    }
Exemplo n.º 21
0
 public virtual void MakeConnection(ConnectionButton src, ConnectionButton dest)
 {
 }
Exemplo n.º 22
0
    public void Init( EditorWindow window )
    {
        // Load in texture resources
        m_lineTexture = ( Texture2D )Resources.Load( "Line Texture 2" );
        m_arrowTexture = ( Texture2D )Resources.Load( "ArrowHead" );
        m_icons = new Texture2D[6];
        m_icons[0] = (Texture2D)Resources.Load("Icon - StateMachine");
        m_icons[1] = (Texture2D)Resources.Load("Icon - BlendGraph");
        m_icons[2] = (Texture2D)Resources.Load("Icon - Animation");
        m_icons[3] = (Texture2D)Resources.Load("Icon - Blend");
        m_icons[4] = (Texture2D)Resources.Load("Icon - AddBlend");
        m_icons[5] = (Texture2D)Resources.Load("Icon - Pose");

        // Init editor to safe state
        m_editorWindow = window;
        m_selectedAnimationTree = null;
        m_Windows.Clear();
        m_activeContainer = null;
        ActiveWindow = null;
        Dragging = false;
        ConnectionStart = null;
        ConnectionEnd = null;
        m_camerScaleAmount = new Vector2(1, 1);

        // Find all the enabled animation trees
        m_activeAnimationTrees = GameObject.FindObjectsOfType(typeof(AnimationTree)) as AnimationTree[];
    }