示例#1
0
 void DrawExtraGUI(DrawingLine script)
 {
     if (GUILayout.Button("Create Line"))
     {
         script.createLine();
     }
 }
示例#2
0
        static public int HelperExport(string L)
        {
            Testing.Initialize();


            var testObj2 = new DrawingLine
            {
                name       = "testName2",
                parentName = "",
                x          = 1111,
                y          = 222,
                x2         = 123,
                y2         = 312,
                zOrder     = 311,
                visible    = true,
                color      = 231
            };

            EventHandler.AddEventHandler(ElmaFunction.SetLGR, 0, new[] { "army" });

            EventHandler.AddEventHandler(ElmaFunction.SetAcceleration, 0, new[] { "1200" });
            while (true)
            {
                Draw.DrawObject(testObj2);

                Thread.Sleep(1000);
            }
            return(0);
        }
示例#3
0
    public override void OnInspectorGUI()
    {
        DrawingLine drawingLineScript = (DrawingLine)target;

        DrawDefaultInspector();
        DrawExtraGUI(drawingLineScript);
    }
示例#4
0
 public void StopDrawing()
 {
     if (currentLine == null)
     {
         return;
     }
     currentLine = null;
 }
示例#5
0
文件: Level.cs 项目: Manquia/Sandbox
            static public DrawingLine Construct()
            {
                DrawingLine dl = new DrawingLine
                {
                    input = new Annal <InputData>(8, InputData.Construct()),
                    go    = null
                };

                return(dl);
            }
示例#6
0
    void Start()
    {
        _board = transform.Find("Whiteboard").gameObject;

        HMDInputManager.LeftGetTouchPadClickDown  += CleanWhiteboard;
        HMDInputManager.RightGetTouchPadClickDown += WhiteboardSwitch;

        GameObject gameObject = transform.Find("DrawingLine").gameObject;

        _drawingLine = gameObject.GetComponent <DrawingLine>();
    }
示例#7
0
    IEnumerator hideAfter(DrawingLine line)
    {
        yield return(new WaitForSeconds(0.0f));

        unlockOrder[currentIndex].gameObject.SetActive(false);
        //show the elements
        foreach (GameObject obj in line.allObjectsToShow)
        {
            obj.SetActive(true);
        }
    }
示例#8
0
    void StartLine(Vector3 position, Quaternion rotation)
    {
        if (currentLine != null)
        {
            return;
        }
        var currentLineObject = GameObject.Instantiate(linePrefab, position, rotation);

        currentLine = currentLineObject.GetComponent <DrawingLine>();
        if (currentLine == null)
        {
            Debug.LogError("Missconfigured line prefab");
        }
    }
示例#9
0
    public static DrawingLine ReadDrawingLine(string text)
    {
        DrawingLine line = new DrawingLine();

        string[] pairs       = text.Split(new char[] { '\n' }, System.StringSplitOptions.RemoveEmptyEntries);
        string   colorString = pairs[0];

        line.Color = ParseColor(colorString);
        for (int i = 1; i < pairs.Length; i++)
        {
            Vector2 point = ParsePoint(pairs[i]);
            line.Points.Add(point);
        }
        return(line);
    }
示例#10
0
    public static DrawingData ParseDrawing(string file)
    {
        DrawingData drawFile = new DrawingData();

        string[] lines = file.Replace("\r\n", "\n")
                         .Replace("\r", "\n")
                         .Split(new string[] { "line\n" }, System.StringSplitOptions.RemoveEmptyEntries);
        //string[] lines = file.Split(new string[] { "line" }, System.StringSplitOptions.RemoveEmptyEntries);
        for (int i = 0; i < lines.Length; i++)
        {
            DrawingLine line = ReadDrawingLine(lines[i]);
            drawFile.Lines.Add(line);
        }
        return(drawFile);
    }
示例#11
0
    public static void replacePoints()
    {
        //get the selected obj
        Transform[] selectedObjs = Selection.GetTransforms(SelectionMode.Unfiltered);

        foreach (Transform selectedObj in selectedObjs)
        {
            //selected drawing line
            DrawingLine drawLine = selectedObj.GetComponent <DrawingLine>();

            //get all the linepoints inside it
            LinePoint[] allLinePoints = selectedObj.GetComponentsInChildren <LinePoint>(true);

            print("size of all line POints are " + allLinePoints.Length);

            //step through all line points
            int counter = 0;
            foreach (LinePoint lp in allLinePoints)
            {
                GameObject newObj = PrefabUtility.InstantiatePrefab(Resources.Load("point", typeof(GameObject))) as GameObject;
                newObj.name = "point_" + (counter + 1).ToString("00");

                //and replace the point with an instance from the prefab
                newObj.transform.SetParent(selectedObj);

                //set the position
                newObj.transform.position = lp.transform.position;

                //set the drawing line to the point
                LinePoint newLinePoint = newObj.GetComponent <LinePoint>();
                newLinePoint.mDrawingLine = drawLine;
                newLinePoint.ID           = counter + 1;
                newLinePoint.idText.text  = (counter + 1).ToString();

                //set the linepoint in the drawing line
                drawLine.allPoints[counter] = newLinePoint;

                counter++;
            }

            //step through the original line points and destroy them
            foreach (LinePoint lp in allLinePoints)
            {
                //delete the lp
                DestroyImmediate(lp.gameObject);
            }
        }
    }
示例#12
0
    public void unlockNext(DrawingLine line)
    {
        //if we still have to show a curve we show the next
        if (currentIndex < unlockOrder.Count - 1)
        {
            StartCoroutine(unlockNextAfter(line));
        }
        else
        {
            //here we would show the final unlock
            StartCoroutine(hideAfter(line));

            //plays the level finsihed sequence
            StartCoroutine(levelFinishedSequence());
        }
    }
示例#13
0
    /// <summary>
    /// Shows the next line
    /// </summary>
    IEnumerator unlockNextAfter(DrawingLine line)
    {
        //hide the curve
        unlockOrder[currentIndex].gameObject.SetActive(false);
        //show the elements
        foreach (GameObject obj in line.allObjectsToShow)
        {
            obj.SetActive(true);
        }

        currentIndex += 1;

        //wait a bit before we show the next curve
        yield return(new WaitForSeconds(0.1f));

        unlockOrder[currentIndex].gameObject.SetActive(true);
    }
示例#14
0
        /// <summary>
        ///     Applies Vertices into the Graphical Pipeline and draws them onto the screen buffer.
        /// </summary>
        public void Draw()
        {
            var aa    = DrawingLine.Antialias;
            var width = DrawingLine.Width;
            var lines = DrawingLine.GLLines;

            DrawingLine.Antialias = Antialias;
            DrawingLine.Width     = Width;
            DrawingLine.GLLines   = true;

            DrawingLine.Begin();
            DrawingLine.Draw(Vertices, Color);
            DrawingLine.End();

            DrawingLine.Antialias = aa;
            DrawingLine.Width     = width;
            DrawingLine.GLLines   = lines;
        }
示例#15
0
 /// <summary>
 ///     Line Dispose.
 /// </summary>
 public void Dispose()
 {
     _line.Dispose();
     DrawingLine.Dispose();
 }
示例#16
0
 public void DrawLine(DrawingLine line, int padNumber)
 {
     throw new NotImplementedException();
 }