public IEnumerator TakeLayoutCap()
    { // take a capture of the created custom traffic layout on myPanelRect
        PartManipulator.itemToMove = null;
        Rect myLayoutRect = new Rect(guix, guiy, guiw, guih);

        yield return(new WaitForEndOfFrame());

        Texture2D myTex = new Texture2D((int)guiw, (int)guih);

        myTex.ReadPixels(myLayoutRect, 0, 0);
        myTex.Apply();
        imageToReceive.texture = myTex;
        layoutChosen           = true;
        ChosenLayout chosenLayout = GameObject.FindObjectOfType <ChosenLayout>();

        chosenLayout.SetImage(myTex);
    }
示例#2
0
    public void ConfirmChosenLayout()   // call from TLpicker page button to choose the centered layout to bring to traffic control page.
    {
        byte[]    chosenPNG = File.ReadAllBytes(myLayout);
        Texture2D chosenTex = new Texture2D(450, 700);

        chosenTex.LoadImage(chosenPNG);
        chosenTex.Apply();
        imageToReceive.texture = chosenTex;

        ChosenLayout chosenLayout = GameObject.FindObjectOfType <ChosenLayout>();

        chosenLayout.SetImage(chosenTex);
        //layoutGO = null;
        //chosenPNG = null;
        //distance = null;
        //distanceReposition = null;
        //Destroy(imageList.gameObject);
        layoutChosen = true;
    }