public void ToolTipResize() { if (widthToolTip.text != "" && heightToolTip.text != "") { cmd.AddCmd(this.img, Operation.Resize, this.img.transform.position, new Vector2(imageRect.sizeDelta.x, imageRect.sizeDelta.y)); imageRect.sizeDelta = new Vector2(Convert.ToInt32(widthToolTip.text), Convert.ToInt32(heightToolTip.text)); } }
public void OnBeginDrag(PointerEventData eventData) { isActive = true; //ShowSize(); //ActiveBtn(); cmd.AddCmd(this.gameObject, Operation.Drag, this.gameObject.transform.position); }
public void OnBeginDrag(PointerEventData eventData) { if (workSpace.activeTool == "MouseTool") { cmd.AddCmd(this.gameObject, Operation.Drag, this.gameObject.transform.position); } }
public void OnPointerDown(PointerEventData eventData) { //garage.transform.SetAsLastSibling(); if (resizeCol == true) { if (Mathf.Abs(distance.x) > Mathf.Abs(distance.y)) { xDrag = true; } else { xDrag = false; } resizeNew = true; cmd.AddCmd(garage, Operation.Resize, garage.transform.position, new Vector2(garageRect.sizeDelta.x, garageRect.sizeDelta.y)); } if (settings != null) { if (isActive) { settings.SetActive(false); isActive = false; } else { isActive = true; settings.SetActive(true); } } }
public void OnPointerUp(PointerEventData eventData) { if (workSpace.activeTool == "WallTool") { GarageItemController garageScript = tmp.transform.GetComponent <GarageItemController>(); garageScript.inputHeight.text = objRect.sizeDelta.y.ToString("F" + 1); garageScript.inputWidth.text = objRect.sizeDelta.x.ToString("F" + 1); workSpace.ToolSwitch("MouseTool"); cmd.AddCmd(tmp, Operation.Create); tmp = null; } }
public void CreateTextElem(Vector2 pos) { var tmp = GameObject.Instantiate(Resources.Load <GameObject>("Prefabs/TextElem")); tmp.transform.position = pos; tmp.transform.SetParent(GameObject.Find("Area").transform); tmp.transform.GetComponent <RectTransform>().localScale = new Vector3(1, 1, 1); tmp.transform.SetAsLastSibling(); cmd.AddCmd(tmp, Operation.Create); tmp = null; workSpace.ToolSwitch("MouseTool"); }
public void OnPointerUp(PointerEventData eventData) { if (tmp != null) { cmd.AddCmd(tmp, Operation.Create); if (tt.sizeDelta.x < 12) { Destroy(tmp); } } //tmp = null; //tt = null; }
public void OnDrop(PointerEventData data) { Sprite dropSprite = GetDropSprite(data); if (dropSprite != null) { var dropObj = (GameObject)Instantiate(Resources.Load("Prefabs/ObjItem")); var itemObj = dropObj.GetComponent <ObjItemController>(); dropObj.transform.position = new Vector2(data.position.x, data.position.y); Sprite sp = Sprite.Create(dropSprite.texture, dropSprite.textureRect, new Vector2(0.5f, 0.5f)); itemObj.image.texture = sp.texture; dropObj.name = "ObjItem(" + sp.texture.name + ")"; dropObj.transform.SetParent(GameObject.Find("Area").transform); dropObj.transform.SetAsLastSibling(); itemObj.image.rectTransform.sizeDelta = ManualSizes(dropSprite.texture.name); itemObj.image.transform.localScale = new Vector3(1, 1, 1); dropObj.transform.localScale = new Vector3(1, 1, 1); cmd.AddCmd(dropObj, Operation.Create); } }
public void OnPointerClick(PointerEventData data) { var dropObj = (GameObject)Instantiate(Resources.Load("Prefabs/ObjItem")); var itemObj = dropObj.GetComponent <ObjItemController>(); var originalObj = data.pointerDrag; var srcImage = originalObj.GetComponent <Image>(); Sprite sp = srcImage.sprite; itemObj.image.texture = sp.texture; dropObj.name = "ObjItem(" + sp.texture.name + ")"; dropObj.transform.SetParent(GameObject.Find("Area").transform); itemObj.image.rectTransform.sizeDelta = drop.ManualSizes(sp.texture.name); itemObj.image.transform.localScale = new Vector3(1, 1, 1); dropObj.transform.localScale = new Vector3(1, 1, 1); dropObj.transform.localPosition = new Vector2(0, 0); cmd.AddCmd(dropObj, Operation.Create); }
public void DeleteBtn() { Destroy(gObj); cmd.AddCmd(this.gameObject, Operation.Delete, this.gameObject.transform.position); }