Exemple #1
0
    public void UpdateTexture(Texture2D texture, int painterIndex = 0, bool isKeepCheckerStatus = false)
    {
        if (_operation == Operation.Replace)
        {
            RenderTexturePainter mainPainter = _listPainter[0];
            RenderTexturePainter tempPainter = _listPainter[1];
            mainPainter.SourceTex = texture;
            tempPainter.SourceTex = texture;
            UpdatePainterSetting(mainPainter);
            UpdatePainterSetting(tempPainter);
            return;
        }
        RenderTexturePainter painter = _listPainter[painterIndex];

        painter.SourceTex = texture;
        UpdatePainterSetting(painter);
        if (isKeepCheckerStatus)
        {
            return;
        }
        painter.ResetCanvas();
        PainterChecker checker = _listChecker[_dicCheckerIndex[painter]];

        if (null != checker && true == checker._isUseChecker)
        {
            checker.Reset();
        }
    }
Exemple #2
0
 public void ResetPainter()
 {
     if (_operation == Operation.Replace)
     {
         RenderTexturePainter painter = _listPainter[0];
         painter.IsErase = true;
         painter.ResetCanvas();
         return;
     }
     LoopPainter((RenderTexturePainter painter) =>
     {
         painter.ResetCanvas();
     });
 }
    void OnGUI()
    {
        if (painter)
        {
            if (GUI.Button(new Rect(10, 10, 100, 40), "Reset Canvas"))
            {
                painter.ResetCanvas();
                if (enableCheckComplete && checker)
                {
                    checker.Reset();
                }
            }
            m_isEraser = GUI.Toggle(new Rect(120, 10, 100, 40), m_isEraser, "Is Earse", "Button");
            if (m_isEraser != painter.isEraser)
            {
                painter.SetIsEraser(m_isEraser);
            }
            m_clickDraw = GUI.Toggle(new Rect(240, 10, 100, 40), m_clickDraw, "Click Draw", "Button");

            GUI.color = Color.white;
            GUI.Label(new Rect(10, 60, 200, 40), "Brush Scale :" + painter.brushScale.ToString("N2"));
            painter.brushScale = GUI.HorizontalSlider(new Rect(10, 80, 200, 40), painter.brushScale, 0.1F, 5F);

            GUI.color = Color.white;
            GUI.Label(new Rect(10, 100, 200, 40), "Canvas Alpha :" + m_alpha.ToString("N2"));
            m_alpha = GUI.HorizontalSlider(new Rect(10, 120, 200, 40), m_alpha, 0F, 1F);
            painter.SetCanvasAlpha(m_alpha);

            if (penTexs.Length > 1 && GUI.Button(new Rect(220, 60, 150, 40), "Change PenTexture"))
            {
                ++m_penTexIndex;
                if (m_penTexIndex >= penTexs.Length)
                {
                    m_penTexIndex = 0;
                }
                painter.penTex = penTexs[m_penTexIndex];
            }

            enableCheckComplete = GUI.Toggle(new Rect(220, 110, 150, 40), enableCheckComplete, "Check Progress", "Button");


            if (enableCheckComplete && checker)
            {
                GUI.Label(new Rect(10, 140, 200, 40), "Progress:" + checker.Progress.ToString("N2"));
            }
        }
    }