void OnMouseDown() { mobilePaint = PaintManager.mobilePaint; // send message to clear image mobilePaint.ClearImage(); }
void Awake() { if (mobilePaintReference==null) Debug.LogError("No MobilePaint assigned at "+transform.name,gameObject); mobilePaint = mobilePaintReference; }
// Use this for initialization void Start () { mobilePaint = PaintManager.mobilePaint; var button = GetComponent<Button>(); button.onClick.AddListener(delegate {this.CallClearImage();}); }
void Start () { mobilePaint = PaintManager.mobilePaint; if (mobilePaint==null) Debug.LogError("No MobilePaint assigned at "+transform.name,gameObject); GetComponent<Toggle>().onValueChanged.AddListener(delegate {this.ToggleZoomPan();}); }
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();}); }
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();}); }
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); }); } }
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();}); }
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); } }
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; } }
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);}); } } }
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);}); } } }
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);}); } }
public BrushSettings (MobilePaint paintingController, Color32 color, Brush brush) { this.paintingController = paintingController; this.Color = color; this.Brush = brush; }
void Start() { mobilePaint = PaintManager.mobilePaint; }
} // awake void Start() { instance = this; }
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); }
protected override void InitCanvas () { this.paintingController = this.drawingCanvas.GetComponent<MobilePaint>(); }