using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using YMFrame;
using System;
using System.Collections.Generic;
using Random = UnityEngine.Random;
namespace YMFrame
{
public class Painting : MonoBehaviour
{
private RenderTexture texRender; //画布
public Material _mPaintMaterial = null; //给定的shader新建材质
public Texture brushTypeTexture; //画笔纹理,半透明
public Shader paintShader;
private float brushScale = 0.5f;
public Color brushColor = Color.white; //new Color(219, 174, 68, 255) / 255;
public RawImage raw_paint; //使用UGUI的RawImage显示,方便进行添加UI
public RawImage totalShowRaw;
private float lastDistance;
private Vector3[] PositionArray = new Vector3[3];
private int a = 0;
private Vector3[] PositionArray1 = new Vector3[4];
private int b = 0;
private float[] speedArray = new float[4];
private int s = 0;
public int num = 50;
public bool isPaintMagic;
private int paintTimes;
private float paint_x;
private float raw_height;
private float raw_width;
private float raw_max_y;
private float scale_x;
private float scale_y;
Vector3 startPosition = Vector3.zero;
Vector3 endPosition = Vector3.zero;
private Vector2 canvasSizeDelta;
public void Init(RawImage _raw, Texture _brushType, RawImage _totalShowRaw, bool _isMagic, int _scale)
{
//canvasSizeDelta = GufengxGameSystem.Instance.gameContext.UIList.GetComponent<RectTransform>().sizeDelta;
isPaintMagic = _isMagic;
totalShowRaw = _totalShowRaw;
brushTypeTexture = _brushType;
raw_paint = _raw;
//if (_scale != 1)
//{
// Vector2 _size = raw_paint.GetComponent<RectTransform>().sizeDelta;
// _size.x = canvasSizeDelta.x * _scale;
// raw_paint.GetComponent<RectTransform>().sizeDelta = _size;
// Vector3 recordPos = raw_paint.transform.localPosition;
// recordPos.x = (_size.x - canvasSizeDelta.x) / 2.0f;
//