Esempio n. 1
0
        private void CreateNodes()
        {
            if (root_action == null)
            {
                Debug.LogWarning("action is null");
                return;
            }

            _winMinX = 50f;
            _winMinY = 50f;

            NodeLevelCounter.Clear();
            rectangles.Clear();
            ActionEditorNode.ID = 0;

            if (root_action_node != null)
            {
                root_action_node.Clear();
            }

            root_action_node = ActionEditorNode.InstantiateNode(root_action);

            rectangles.Add(root_action_node.rectangle);

            root_action_node.AddChildren(ref rectangles);
            root_action_node.CountLevels(0);
            root_action_node.RepositionNodes(0);
            //NodeLevelCounter.DebugLevels();

            //_resizeHandle = AssetDatabase.LoadAssetAtPath("Assets/Sprites/NodeEditor/ResizeHandle.png", typeof(Texture2D)) as Texture2D;
            _aaLine = AssetDatabase.LoadAssetAtPath("Assets/Sprites/NodeEditor/AA1x5.png", typeof(Texture2D)) as Texture2D;
            //_icon = new GUIContent(_resizeHandle);
            //_mainwindowID = GUIUtility.GetControlID(FocusType.Native); //grab primary editor window controlID
        }
Esempio n. 2
0
        public virtual void RepositionNodes(int level)
        {
            rectangle = new Rect();

            rectangle.x = NodeLevelCounter.GetLevelX(level) * mod_x;
            rectangle.y = NodeLevelCounter.GetLevelY(level) * mod_y;

            rectangle.width  = width;
            rectangle.height = height;

            if (level != 0)
            {
                button_rect = new Rect(rectangle);

                button_rect.x += button_rect.width * 0.70f;
                //button_rect.y        += button_rect.height * 0.70f;
                button_rect.width  *= 0.30f;
                button_rect.height *= 0.30f;
            }

            foreach (ActionEditorNode child in children)
            {
                child.RepositionNodes(level + 1);
            }
        }
Esempio n. 3
0
        public void CountLevels(int level)
        {
            NodeLevelCounter.CountLevel(level);

            foreach (ActionEditorNode child in children)
            {
                child.CountLevels(level + 1);
            }
        }
Esempio n. 4
0
            public float GetX()
            {
                if (run_x == -1)
                {
                    //x_array = new float[count];

                    run_x = NodeLevelCounter.GetLargerLevel() * 0.5f - ((float)count * 0.5f);
                }

                float return_value = run_x + getters;

                getters++;

                return(return_value);
            }