Exemplo n.º 1
0
    // Use this for initialization
    IEnumerator Start()
    {
        yield return(new WaitForEndOfFrame());

        Application.targetFrameRate = 60;
        if (painter)
        {
            painter.canvasWidth  = Mathf.CeilToInt(Native2dScreenUtil.GetScreenWidth()) * 100;
            painter.canvasHeight = Mathf.CeilToInt(Native2dScreenUtil.GetScreenHeight()) * 100;
            painter.Init();
            m_isEraser = painter.isErase;
        }
    }
Exemplo n.º 2
0
    private void InitPainterAndChecker(RenderTexturePainter[] arrayPainter = null, PainterChecker[] arrayChecker = null)
    {
        _listPainter.Clear();

        RenderTexturePainter[] arrayTempPainter = _arrayPainter;
        if (null != arrayPainter)
        {
            arrayTempPainter = _arrayPainter.Concat(arrayPainter).ToArray();
        }
        for (int i = 0; i < arrayTempPainter.Length; i++)
        {
            _listPainter.Add(arrayTempPainter[i]);
        }

        if (_operation == Operation.Erase && true == _isCleanOtherPaintTool)
        {
            _listScribbleTool.Clear();
            for (int i = 0; i < _arrayScribbleTool.Length; i++)
            {
                ScribbleTool tool = _arrayScribbleTool[i];
                for (int j = 0; j < tool.ListPainter.Count; j++)
                {
                    _listPainter.Add(tool.ListPainter[j]);
                }
                _listScribbleTool.Add(tool);
            }
        }

        if (_operation == Operation.Replace && _listPainter.Count == 2)
        {
            RenderTexturePainter mainPainter = _listPainter[0];
            RenderTexturePainter tempPainter = _listPainter[1];
            if (false == mainPainter.IsInited)
            {
                mainPainter.Init();
            }
            tempPainter.SourceTex = mainPainter.SourceTex;
        }
        LoopPainter((RenderTexturePainter painter) =>
        {
            if (false == painter.IsInited)
            {
                painter.Init();
            }
            UpdatePainterSetting(painter);
            if (false == painter._isShowSource)
            {
                painter.ResetCanvas();
            }
            PainterChecker checker = painter.GetComponent <PainterChecker>();
            if (null != checker)
            {
                checker.Init();
                checker.SetDataByTexture(painter.SourceTex.ToTexture2D(), painter._penTex, painter._brushScale, 0);
                _listChecker.Add(checker);
                _dicCheckerIndex.Add(painter, _listChecker.IndexOf(checker));
            }
        });

        PainterChecker[] arrayTempChecker = _arrayChecker;
        if (null != arrayChecker)
        {
            arrayTempChecker = _arrayChecker.Concat(arrayChecker).ToArray();
        }

        for (int i = 0; i < arrayTempChecker.Length; i++)
        {
            PainterChecker checker = arrayTempChecker[i];
            checker.Init();
            _listChecker.Add(checker);
        }
    }