コード例 #1
0
 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));
     }
 }
コード例 #2
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     isActive = true;
     //ShowSize();
     //ActiveBtn();
     cmd.AddCmd(this.gameObject, Operation.Drag, this.gameObject.transform.position);
 }
コード例 #3
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     if (workSpace.activeTool == "MouseTool")
     {
         cmd.AddCmd(this.gameObject, Operation.Drag, this.gameObject.transform.position);
     }
 }
コード例 #4
0
    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);
            }
        }
    }
コード例 #5
0
 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;
     }
 }
コード例 #6
0
    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");
    }
コード例 #7
0
 public void OnPointerUp(PointerEventData eventData)
 {
     if (tmp != null)
     {
         cmd.AddCmd(tmp, Operation.Create);
         if (tt.sizeDelta.x < 12)
         {
             Destroy(tmp);
         }
     }
     //tmp = null;
     //tt = null;
 }
コード例 #8
0
    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);
        }
    }
コード例 #9
0
ファイル: Drag.cs プロジェクト: FeverGrayVan/GBAUSA
    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);
    }
コード例 #10
0
 public void DeleteBtn()
 {
     Destroy(gObj);
     cmd.AddCmd(this.gameObject, Operation.Delete, this.gameObject.transform.position);
 }