예제 #1
0
        void OnMouseDown()
        {
            mobilePaint = PaintManager.mobilePaint;

            // send message to clear image
            mobilePaint.ClearImage();
        }
예제 #2
0
		void Awake()
		{
			if (mobilePaintReference==null) Debug.LogError("No MobilePaint assigned at "+transform.name,gameObject);

			mobilePaint = mobilePaintReference;

		}
예제 #3
0
		// Use this for initialization
		void Start () {
			mobilePaint = PaintManager.mobilePaint;

			var button = GetComponent<Button>();
			button.onClick.AddListener(delegate {this.CallClearImage();});


		}
예제 #4
0
		void Start () 
		{
			mobilePaint = PaintManager.mobilePaint;

			if (mobilePaint==null) Debug.LogError("No MobilePaint assigned at "+transform.name,gameObject);

			GetComponent<Toggle>().onValueChanged.AddListener(delegate {this.ToggleZoomPan();});
		}
예제 #5
0
		void Start () 
		{
			mobilePaint = PaintManager.mobilePaint;

			if (mobilePaint==null) Debug.LogError("No MobilePaint assigned",gameObject);

			var toggle=GetComponent<Toggle>();
			if (toggle==null) Debug.LogError("No Toggle component founded",gameObject);
			if (toggle.IsInteractable()) toggle.onValueChanged.AddListener(delegate {this.SetMode();});
		}
예제 #6
0
		void Start () 
		{
			mobilePaint = PaintManager.mobilePaint;

			if (mobilePaint==null) Debug.LogError("No MobilePaint assigned at "+transform.name,gameObject);

			var toggle = GetComponent<Toggle>();
			if (toggle==null) Debug.LogError("No toggle component founded at "+transform.name, gameObject);

			toggle.onValueChanged.AddListener(delegate {this.SetMode();});
		}
예제 #7
0
		void Start () 
		{
			mobilePaint = PaintManager.mobilePaint; // gets reference to mobilepaint through PaintManager

			if (mobilePaint==null) Debug.LogError("No MobilePaint assigned at "+transform.name, gameObject);

			slider = GetComponent<Slider>();
			if (slider==null) 
			{
				Debug.LogError("No Slider component founded",gameObject);
			}else{
				slider.value = mobilePaint.brushSize;
				slider.onValueChanged.AddListener((value) => { mobilePaint.SetBrushSize((int)value); });
			}
		}
예제 #8
0
		void Start () 
		{
			mobilePaint = PaintManager.mobilePaint;

			if (mobilePaint==null) Debug.LogError("No MobilePaint assigned",gameObject);
			if (customBrushPanel==null) Debug.LogError("No customBrushPanel assigned",gameObject);

			var toggle=GetComponent<Toggle>();
			if (toggle==null) Debug.LogError("No Toggle component founded",gameObject);

			// disable button if not using custom brushes
			toggle.interactable = mobilePaint.useCustomBrushes;

			if (toggle.IsInteractable()) toggle.onValueChanged.AddListener(delegate {this.SetMode();});
		}
예제 #9
0
		IEnumerator Start() {
			mobilePaint = PaintManager.mobilePaint;

			// Start a download of the given URL
			WWW www = new WWW(url);
			
			// Wait for download to complete
			yield return www;

			if (!string.IsNullOrEmpty(www.error)) 
			{
				Debug.Log(www.error);
			}else{
				// assign texture, NOTE
				mobilePaint.SetMaskImage(www.texture);
			}
		}
예제 #10
0
		void Start () 
		{
			mobilePaint = PaintManager.mobilePaint;

			if (mobilePaint==null) Debug.LogError("No MobilePaint assigned at "+transform.name, gameObject);
			if (customPanel==null) Debug.LogError("No customPanel assigned at "+transform.name, gameObject);


			var toggle = GetComponent<Toggle>();
			if (toggle==null) Debug.LogError("No toggle component founded at "+transform.name, gameObject);

			if (mobilePaint.useCustomPatterns) {
				toggle.onValueChanged.AddListener(delegate {this.SetMode();});
			}else{
				Debug.LogWarning("No useCustomPatterns enabled, disabling custom brush button", gameObject);
				toggle.interactable=false;
			}
		}
예제 #11
0
		void Awake()
		{
            //mobilePaint = PaintManager.mobilePaint;
            mobilePaint = FindObjectOfType<OverrideTestForUI>();
			if (mobilePaint==null) Debug.LogError("No MobilePaint assigned at "+transform.name, gameObject);
			if (colorpickers.Length<1) Debug.LogWarning("No colorpickers assigned at "+transform.name, gameObject);

			currentColorImage = GetComponent<Image>();
			if (currentColorImage==null) Debug.LogError("No image component founded at "+transform.name, gameObject);


			// Add event listeners to pencil buttons
			for (int i=0;i<colorpickers.Length;i++)
			{
				var button = colorpickers[i];
				if (button!=null)
				{
					button.onClick.AddListener(delegate {this.SetCurrentColor(button);});
				}
			}
		}
예제 #12
0
		void Awake()
		{
			mobilePaint = PaintManager.mobilePaint;

			if (mobilePaint==null) Debug.LogError("No MobilePaint assigned at "+transform.name, gameObject);
			if (colorpickers.Length<1) Debug.LogWarning("No colorpickers assigned at "+transform.name, gameObject);

			currentColorImage = GetComponent<Image>();
			if (currentColorImage==null) Debug.LogError("No image component founded at "+transform.name, gameObject);


			// Add event listeners to pencil buttons
			for (int i=0;i<colorpickers.Length;i++)
			{
				var button = colorpickers[i];
				if (button!=null)
				{
					button.onClick.AddListener(delegate {this.SetCurrentColor(button);});
				}
			}
		}
예제 #13
0
		void Start () 
		{
			mobilePaint = PaintManager.mobilePaint;

			if (mobilePaint==null) Debug.LogError("No MobilePaint assigned at "+transform.name);
			if (buttonTemplate==null) Debug.LogError("No buttonTemplate assigned at "+transform.name);
			
			// build custom brush buttons for each custom brush
			Vector2 newPos = new Vector2(padding,-padding);
			
			for(int i=0;i<mobilePaint.customPatterns.Length;i++)
			{
				// instantiate buttons
				var newButton = Instantiate(buttonTemplate,Vector3.zero,Quaternion.identity) as Button;
				newButton.transform.SetParent(transform,false);
				
				RectTransform rectTrans = newButton.GetComponent<RectTransform>();
				
				// wrap inside panel width
				if (newPos.x+rectTrans.rect.width>=GetComponent<RectTransform>().rect.width)
				{
					newPos.x=0+padding;
					newPos.y -= rectTrans.rect.height+padding;
					// NOTE: maximum Y is not checked..so dont put too many custom brushes.. would need to add paging or scrolling
				}
				rectTrans.anchoredPosition = newPos;
				newPos.x += rectTrans.rect.width+padding;
				
				// assign brush image
				// NOTE: have to use rawimage, instead of image (because cannot cast Texture2D into Image)
				// i've read that rawimage causes extra drawcall per drawimage, thats not nice if there are tens of images..
				newButton.GetComponent<RawImage>().texture = mobilePaint.customPatterns[i];
				var index = i;
				
				// event listener for button clicks, pass custom brush array index number as parameter
				newButton.onClick.AddListener(delegate {this.SetCustomPattern(index);});
				
				
			}
		}
예제 #14
0
	public BrushSettings (MobilePaint paintingController, Color32 color, Brush brush) {
		this.paintingController = paintingController;
		this.Color = color;
		this.Brush = brush;
	}
		void Start() {
			mobilePaint = PaintManager.mobilePaint;
		}
예제 #16
0
        }         // awake

        void Start()
        {
            instance = this;
        }
예제 #17
0
		void Start () 
		{
			mobilePaint = PaintManager.mobilePaint;
			if (mobilePaint==null) Debug.LogError("MobilePaint not assigned", gameObject);
			if (images==null || images.Length<1) Debug.LogError("No mask images assigned to array", gameObject);
		}
예제 #18
0
	protected override void InitCanvas () {
		this.paintingController = this.drawingCanvas.GetComponent<MobilePaint>();
	}