Ejemplo n.º 1
0
    private void SetEquipedTool(Tools equipedTool)
    {
        //play sound
        SoundFX.instance.playSound(ref SoundFX.instance.click, 0.5f, true);

        // Deactivate all tools
        Drawable.drawable.SetActivation(false);
        zoomTool.SetActive(false);

        // Remove all selection outlines
        ResetOutlineMaterials();

        // Activate selected tool and outline
        switch (equipedTool)
        {
        case Tools.zoom:
            zoomTool.SetActive(true);
            zoomImage.material.SetFloat("_OutlineEnabled", 1);

            break;

        case Tools.marker:
            markerImage.material.SetFloat("_OutlineEnabled", 1);
            ChangeDrawColor();
            Drawable.drawable.SetActivation(true);

            break;

        case Tools.eraser:
            eraserImage.material.SetFloat("_OutlineEnabled", 1);
            settings.SetEraser();
            Drawable.drawable.SetActivation(true);
            break;
        }
    }
Ejemplo n.º 2
0
    /// <summary>
    /// 그림을 그리기 위한 데이터를 수신한다.
    /// 추가적으로 Drawing Room에 존재할 때 처리해야 하는 모든 동작을 포함한다.
    /// </summary>
    public void ReceiveDrawingData()
    {
        var msg = _networkManager.Receive();

        if (msg == null)
        {
            return;
        }

        msg = msg.TrimEnd('\0');
        var tokens = msg.Split(AppData.Delimiter);

        foreach (var token in tokens)
        {
            if (token == "")
            {
                continue;
            }

            if (token.Contains(char.ToString(AppData.ServerCommand)))
            {
                if (token == CommendBook.ROOM_CLOSED)
                {
                    _warningOverlayManager.ShowOverlay("RoomServer-Closed");
                    _drawingCover.StopDrawing();
                    _networkManager.ReconnectToNameServer();
                }
            }
            else if (token.Contains(char.ToString(AppData.ClientCommand)))
            {
                if (token == CommendBook.END_OF_LINE)
                {
                    _drawable.RemoteRelease();
                    continue;
                }
                else if (token == CommendBook.COLOR_COMMEND + "RED")
                {
                    _drawingSettings.SetMarkerRed();
                    continue;
                }
                else if (token == CommendBook.COLOR_COMMEND + "BLUE")
                {
                    _drawingSettings.SetMarkerBlue();
                    continue;
                }
                else if (token == CommendBook.COLOR_COMMEND + "GREEN")
                {
                    _drawingSettings.SetMarkerGreen();
                    continue;
                }
                else if (token == CommendBook.COLOR_COMMEND + "BLACK")
                {
                    _drawingSettings.SetMarkerBlack();
                    continue;
                }
                else if (token == CommendBook.COLOR_COMMEND + "ERASE")
                {
                    _drawingSettings.SetEraser();
                    continue;
                }
                else if (token == CommendBook.CLEAR_BACKGROUND_COMMEND)
                {
                    _drawable.ResetCanvas();
                    continue;
                }
            }
            else
            {
                var pos = token.Split(',');
                //var vec = new Vector2(float.Parse(pos[0]) * resolutionX, float.Parse(pos[1]) * resolutionY);
                //FIXME : 상하 240, 좌우 5 정도의 크기차 발생 -> 1920-240*2 이후 240만큼을 보상함
                //현재는 아주 정확하게 맞지만 하드코딩상태. 여유가 있으면 바꾸자.
                var vec = new Vector2(float.Parse(pos[0]), float.Parse(pos[1]) - 240);
                _drawable.ReceiveCoordinateData(vec);
                _drawable.RemoteDrag();
            }
        }
    }