Example #1
0
 public FigurePoint(Point point, LineDrawType lineType, bool isNode)
 {
     x             = point.X;
     y             = point.Y;
     this.lineType = lineType;
     isFigureNode  = isNode;
 }
Example #2
0
 public FigurePoint(Point point)
 {
     x             = point.X;
     y             = point.Y;
     this.lineType = LineDrawType.Solid;
     isFigureNode  = false;
 }
Example #3
0
 public FigurePoint(int x, int y, LineDrawType lineType, bool isNode)
 {
     this.x        = x;
     this.y        = y;
     this.lineType = lineType;
     isFigureNode  = isNode;
 }
    private void OnGUI()
    {
        //GUI.DrawTexture(new Rect(0,0,maxSize.x,maxSize.y), Texture2D.blackTexture,ScaleMode.StretchToFill);
        if (coreData == null)
        {
            foreach (string guid in AssetDatabase.FindAssets("t: CoreData"))
            {
                coreData = AssetDatabase.LoadAssetAtPath <CoreData>(AssetDatabase.GUIDToAssetPath(guid));
            }
        }
        MoveList currentMovelist = coreData.moveLists[coreData.currentMovelistIndex];

        GUILayout.Label("");
        currentMovelist.name = GUILayout.TextField(currentMovelist.name);


        coreData.currentMovelistIndex = Mathf.Clamp(coreData.currentMovelistIndex, 0, coreData.moveLists.Count - 1);
        GUILayout.BeginHorizontal();
        coreData.currentMovelistIndex = GUILayout.Toolbar(coreData.currentMovelistIndex, coreData.GetMovelistNames());

        if (GUILayout.Button("New Move List", GUILayout.Width(175)))
        {
            coreData.moveLists.Add(new MoveList());
        }
        GUILayout.EndHorizontal();



        CommandState currentCommandStateObject = currentMovelist.commandStates[currentCommandStateIndex];

        currentCommandStateIndex = Mathf.Clamp(currentCommandStateIndex, 0, currentMovelist.commandStates.Count - 1);
        GUILayout.BeginHorizontal();
        currentCommandStateIndex = GUILayout.Toolbar(currentCommandStateIndex, coreData.GetCommandStateNames());

        if (GUILayout.Button("New Command State", GUILayout.Width(175)))
        {
            currentMovelist.commandStates.Add(new CommandState());
        }
        GUILayout.EndHorizontal();
        currentCommandStateObject.stateName = GUILayout.TextField(currentCommandStateObject.stateName, GUILayout.Width(200));
        //coreData.commandStates[currentCommandState].stateName = GUI.TextField(new Rect(0, 0, 300, 50), coreData.commandStates[currentCommandState].stateName);

        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Add Command", GUILayout.Width(120)))
        {
            if (currentCommandStateObject.commandSteps == null)
            {
                currentCommandStateObject.commandSteps = new List <CommandStep>();
            }
            currentCommandStateObject.AddCommandStep();
            currentCommandStateObject.CleanUpBaseState();

            //coreData.commandStates[currentCommandState].chainSteps.Add(new ChainStep(coreData.commandStates[currentCommandState].chainSteps.Count));
        }
        GUILayout.Label("Draw Style:", GUILayout.Width(75));
        currentLineType = (LineDrawType)EditorGUILayout.EnumPopup(currentLineType, GUILayout.Width(150));
        drawBaseToggle  = GUILayout.Toggle(drawBaseToggle, "Draw Base Node", EditorStyles.miniButton, GUILayout.Width(150));
        if (drawBaseToggle)
        {
            drawBase = -1;
        }
        else
        {
            drawBase = 0;
        }
        GUILayout.EndHorizontal();
        scrollView = EditorGUILayout.BeginScrollView(scrollView);

        GUILayout.Label("", GUILayout.Height(2000), GUILayout.Width(2000));

        //draw your nodes here


        Handles.BeginGUI();

        int sCounter = 0;

        //foreach (CommandStep s in coreData.commandStates[currentCommandState].commandSteps)
        foreach (CommandStep s in currentCommandStateObject.commandSteps)
        {
            if (sCounter > drawBase)
            {
                int deleteMe = -1;
                int fCounter = 0;
                foreach (int f in s.followUps)
                {
                    CommandStep t = currentCommandStateObject.commandSteps[f];

                    if (t.activated)
                    {
                        switch (currentLineType)
                        {
                        case LineDrawType.CENTER:
                            Handles.DrawBezier(
                                s.myRect.center,
                                t.myRect.center,
                                s.myRect.center,
                                t.myRect.center,
                                Color.white, null, 3f);
                            break;

                        case LineDrawType.END_TO_END:
                            Handles.DrawBezier(
                                new Vector2(s.myRect.xMax - 2f, s.myRect.center.y),
                                new Vector2(t.myRect.xMin + 2, t.myRect.center.y),
                                new Vector2(s.myRect.xMax, s.myRect.center.y),
                                new Vector2(t.myRect.xMin, t.myRect.center.y),
                                Color.white, null, 3f);
                            break;

                        case LineDrawType.BEZIER_END_TO_END:
                            Handles.DrawBezier(
                                new Vector2(s.myRect.xMax - 2f, s.myRect.center.y),
                                new Vector2(t.myRect.xMin + 2f, t.myRect.center.y),
                                new Vector2(s.myRect.xMax + 30f, s.myRect.center.y),
                                new Vector2(t.myRect.xMin - 30f, t.myRect.center.y),
                                Color.white, null, 3f);
                            break;
                        }



                        if (GUI.Button(new Rect((t.myRect.center + s.myRect.center) * 0.5f + (xButton * -0.5f), xButton), "X"))
                        {
                            deleteMe = fCounter;
                        }
                    }
                    fCounter++;
                }
                if (deleteMe > -1)
                {
                    s.followUps.RemoveAt(deleteMe); currentCommandStateObject.CleanUpBaseState();
                }
            }
            sCounter++;
        }

        Handles.EndGUI();


        BeginWindows();
        sizerStep = 30;
        //GUI.backgroundColor = Color.black;
        int cCounter = 0;

        foreach (CommandStep c in currentCommandStateObject.commandSteps)
        {
            if (c.activated && cCounter > drawBase)
            {
                c.myRect = GUI.Window(c.idIndex, c.myRect, WindowFunction, "", EditorStyles.miniButton);
            }
            cCounter++;
        }

        EndWindows();
        EditorGUILayout.EndScrollView();
        EditorUtility.SetDirty(coreData);
    }
Example #5
0
		private Pen GetPen(DrawType moveType, LineDrawType drawtype)
		{
			switch (moveType)
			{
				default:
				case DrawType.NoMove: return _noMovePen;
				case DrawType.Fast: return _fastPen;
				case DrawType.Cut: return _cutPens[(int)drawtype];
				case DrawType.LaserFast: return _laserFastPen;
				case DrawType.LaserCut: return _laserCutPen;
			}
		}