コード例 #1
0
ファイル: LevelDraw.cs プロジェクト: a-j-z/code_idle_idol
 void Update()
 {
     if ((Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1)) && !PlayManager.GetIsPlay() &&
         !paletteMenuManager.IsPaletteMenuActive() && currentPalette != -1)
     {
         if (currentTool == Tools.Draw)
         {
             currMousePos = MouseUtilities.GridSpace(buildCam);
             prevMousePos = currMousePos;
         }
         else if (currentTool == Tools.Rect)
         {
             prevMousePos = MouseUtilities.GridSpace(buildCam);
         }
     }
     if ((Input.GetMouseButton(0) || Input.GetMouseButton(1)) && !PlayManager.GetIsPlay() &&
         !paletteMenuManager.IsPaletteMenuActive() && currentPalette != -1)
     {
         bool draw;
         draw = Input.GetMouseButton(0);
         if (currentTool == Tools.Draw)
         {
             currMousePos = MouseUtilities.GridSpace(buildCam);
             DrawTileLine(tileTypes[currentPalette], currMousePos, prevMousePos, draw);
             prevMousePos = MouseUtilities.GridSpace(buildCam);
         }
         else if (currentTool == Tools.Rect)
         {
             currMousePos = MouseUtilities.GridSpace(buildCam);
             rect.SetActive(true);
             rect.GetComponent <RectDraw>().Draw(currMousePos, prevMousePos);
         }
     }
     else
     {
         rect.SetActive(false);
     }
     if ((Input.GetMouseButtonUp(0) || Input.GetMouseButtonUp(1)) && !PlayManager.GetIsPlay() &&
         !paletteMenuManager.IsPaletteMenuActive() && currentPalette != -1)
     {
         bool draw;
         draw = Input.GetMouseButtonUp(0);
         if (currentTool == Tools.Rect)
         {
             DrawTileRect(tileTypes[currentPalette], currMousePos, prevMousePos, draw);
         }
     }
     if (PlayManager.GetIsPlay())
     {
         camBoundsRect.SetActive(false);
     }
     else
     {
         camBoundsRect.SetActive(true);
     }
 }
コード例 #2
0
    void Update()
    {
        worldPoint  = MouseUtilities.GridSpace(cam);
        screenPoint = RectTransformUtility.WorldToScreenPoint(cam, worldPoint);

        cursorSize          = (Screen.height / 100f) / (cam.orthographicSize * 2);
        rt.localScale       = new Vector3(cursorSize, cursorSize, 0);
        rt.sizeDelta        = draw.GetCurrentPaletteSize();
        rt.anchoredPosition = screenPoint - canvasRt.sizeDelta / 2f + new Vector2(
            (rt.sizeDelta.x % 200 == 0) ? (50f * rt.localScale.x) : 0, (rt.sizeDelta.y % 200 == 0) ? (50f * rt.localScale.y) : 0);
    }