public TerraformWindow(GUISystem system, GUITheme theme)
            : base(system, new UDim2(0.25f, 0, 0.25f, 0), "Terraform Options", theme, false)
        {
            Position = new UDim2(0, 0, 0.75f, 0);
            MinSize  = new UDim2(0, 200, 0, 250);
            MaxSize  = new UDim2(0, 475, 0, 350);

            GUIForm form = new GUIForm(UDim2.Zero, new UDim2(1f, 0, 1f, 0), theme);

            GUILabel     brushSizeLabel;
            GUITextField brushSizeField;

            form.AddLabledTextField("Brush Size:", BrushSize.ToString(), new UDim2(0, 5, 0, 25),
                                    out brushSizeLabel, out brushSizeField);
            brushSizeField.OnTextChanged += BrushSizeField_OnTextChanged;

            GUILabel     riseHeightLabel;
            GUITextField riseHeightField;

            form.AddLabledTextField("Rise Height:", RiseHeight.ToString(), new UDim2(0, 5, 0, 30 + brushSizeLabel.Size.Y.Offset),
                                    out riseHeightLabel, out riseHeightField);
            riseHeightField.OnTextChanged += RiseHeightField_OnTextChanged;

            AddTopLevel(form);
        }
示例#2
0
 private void BrushSizeConnect(SpriteButton spriteButton, BrushSize brushSize)
 {
     spriteButton.Button.Connect("pressed", this, nameof(SetBrushSizeInternal),
                                 new Godot.Collections.Array {
         brushSize
     });
 }
示例#3
0
    void Awake()
    {
        Screen.showCursor = false;
        material = cursor.GetComponentInChildren<Renderer>().material;
        buildController = GetComponent<BuildController>();
        buildController.InputModeSelected += (sender, args) => 
        {
            currentBuildMode = args.buildMode;
            if (currentBuildMode == BuildMode.Blast) { material.color = blastColor; }
            else { material.color = buildColor; }
        };

        buildController.BrushSizeChanged += (sender, args) =>
        {
            currentBrushSize = args.brushSize;
            if (currentBrushSize == BrushSize.Normal)
            {
                cursor.localScale = Vector3.one;
                cursor.localPosition = Vector3.zero;
            }
            else
            {
                cursor.localScale = Vector3.one * 3;
                cursor.localPosition = Vector3.forward;
            }
        };
    }
示例#4
0
 public StrokeDto(StrokeData strokeData)
 {
     Id    = strokeData.Id;
     Path  = strokeData.Path;
     Brush = strokeData.Color;
     Size  = strokeData.Size;
 }
示例#5
0
        public Stroke(Note owner, BrushColor color, BrushSize size, Vector2[] path)
        {
            Id    = Guid.NewGuid();
            Owner = owner;

            Color = color;
            Size  = size;
            Path  = path;
        }
示例#6
0
        public LineElement(Note owner, Vector2 start, Vector2 end, BrushColor color, BrushSize size)
        {
            Id    = Guid.NewGuid();
            Owner = owner;

            StartPosition = start;
            EndPosition   = end;

            Color = color;
            Size  = size;
        }
示例#7
0
 private BrushSize GetNextBrushSize()
 {
     switch (currentBrushSize)
     {
         case BrushSize.Normal:
             return currentBrushSize = BrushSize.Large;
         case BrushSize.Large:
             return currentBrushSize = BrushSize.Normal;
         default:
             throw new Exception("BlockBuilder: Brush size not implemented");
     }
 }
示例#8
0
    void SprayCam_BrushSizeChanged(BrushSize brushSize)
    {
        image.texture = textureMap[brushSize];

        StopAllCoroutines();
        if (isFadeEnabled)
        {
            StartCoroutine(FadeBrushPreview());
        }
        else
        {
            image.color = new Color(1f, 1f, 1f, 1f);
        }
    }
示例#9
0
文件: Note.cs 项目: reddenx/web_notes
        public LineElement AddLine(Vector2 start, Vector2 end, BrushSize size, BrushColor color)
        {
            if (start != null && end != null && size != null && color != null)
            {
                var line = new LineElement(this, start, end, color, size);
#warning change concat addition to lists eventually
                LineElements = LineElements.Concat(new LineElement[] { line }).ToArray();
                OnChanged.SafeInvoke(this);
                return(line);
            }
            else
            {
                throw new ArgumentException("AddLine input arguments not valid");
            }
        }
示例#10
0
文件: Note.cs 项目: reddenx/web_notes
        public Stroke AddStroke(BrushColor color, BrushSize size, Vector2[] path)
        {
            if (color != null && size != null && path != null && path.Length > 1)
            {
                var stroke = new Stroke(this, color, size, path);
#warning change concat addition to lists eventually
                Strokes = Strokes.Concat(new Stroke[] { stroke }).ToArray();
                OnChanged.SafeInvoke(this);
                return(stroke);
            }
            else
            {
                throw new ArgumentException("AddStroke input arguments are not valid");
            }
        }
示例#11
0
        public override void Draw(BaseScreen.Resources screenResources, SmartSpriteBatch spriteBatch, ScreenAbstractor screen, float opacity, FloatRectangle?clip = null, Texture2D bgTexture = null, Vector2?scrollOffset = null)
        {
            if (clip.HasValue && ParentPosition.HasValue)
            {
                clip = clip.Value.ConstrainTo(ParentPosition.Value);
            }

            clip = screen.Translate(clip);

            var t = Position.Value();

            FloatRectangle tmp = screen.Translate(ActualPosition.AdjustForMargin(Margin)).Value;

            if (clip.HasValue)
            {
                if (tmp.Right < clip.Value.X || tmp.X > clip.Value.Right)
                {
                    return;
                }
            }

            if (BlurAmount.Value() > 0)
            {
                Solids.GaussianBlur.DoBlur(bgTexture, BlurAmount.Value(), (BackgroundColor.Value().Value *opacity) * ((BlurAmount.Value() / Solids.MaxBlur)), tmp.ToRectangle, ScissorRect, clip, NoisePerc.Value());
            }

            if (BackgroundColor.Value().HasValue&& FillTexture.Value() == null)
            {
                spriteBatch.DrawSolidRectangle(tmp, BackgroundColor.Value().Value *opacity, clip);
            }

            if (FillTexture.Value() != null)
            {
                using (new SmartSpriteBatchManager(Solids.Instance.SpriteBatch))
                {
                    spriteBatch.DrawTexturedRectangle(tmp, BackgroundColor.Value().Value *opacity, Solids.Instance.AssetLibrary.GetTexture(FillTexture.Value()), TilingMode.Value, clip);
                }
            }

            if (BrushSize.Value() > 0)
            {
                spriteBatch.DrawBorder(tmp, BorderColor.Value() * opacity, BrushSize.Value(), clip);
            }

            this.ActualSize = new Vector2(Position.Value().Width, Position.Value().Height).PadForMargin(Margin);

            SetChildrenOriginToMyOrigin();
        }
示例#12
0
    public void SelectBrush(int index)
    {
        switch (index)
        {
        case 0:
            brush = BrushSize.SMALL;
            break;

        case 1:
            brush = BrushSize.MEDIUM;
            break;

        case 2:
            brush = BrushSize.BIG;
            break;
        }
    }
示例#13
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            currentBuildMode = GetNextInputMode();
            InputModeSelected(this, new BuildModeArgs(currentBuildMode));

            if (currentBuildMode == BuildMode.Blast)
            {
                currentBrushSize = BrushSize.Normal;
                BrushSizeChanged(this, new BrushSizeArgs(currentBrushSize));
            }
        }

        if (currentBuildMode == BuildMode.Build && Input.GetKeyDown(KeyCode.LeftControl))
        {
            currentBrushSize = GetNextBrushSize();
            BrushSizeChanged(this, new BrushSizeArgs(currentBrushSize));
        }
    }
示例#14
0
    private void Paint(Texture2D texture, Vector2 position, Color color, BrushSize brush = BrushSize.SMALL)
    {
        /*
         * Dado uma textura, uma posicao, uma cor e um tipo de pincel, esta funcao chama PaintWithBrush com parametros dependendo do tamanho do pincel.
         */
        lastPosition = position;
        switch (brush)
        {
        case BrushSize.SMALL:
            PaintWithBrush(smallBrush, (int)position.x, (int)position.y, color);
            break;

        case BrushSize.MEDIUM:
            PaintWithBrush(mediumBrush, (int)position.x, (int)position.y, color);
            break;

        case BrushSize.BIG:
            PaintWithBrush(bigBrush, (int)position.x, (int)position.y, color);
            break;
        }
    }
示例#15
0
        public LineElementDto AddLine(Guid noteId, [FromBody] NewLineElementInput input)
        {
            var user = AuthorizationHelper.GetAuthorizedUser();
            var note = user?.Notes.FirstOrDefault(n => n.Id == noteId);

            if (note == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            var color = new BrushColor(input.R, input.B, input.G, input.A)
            {
            };
            var size = new BrushSize(input.Radius)
            {
            };

            var line = note.AddLine(input.Start, input.End, size, color);

            return(new LineElementDto(line.ToData()));
        }
示例#16
0
        void ReleaseDesignerOutlets()
        {
            if (BrushColor != null)
            {
                BrushColor.Dispose();
                BrushColor = null;
            }

            if (BrushSize != null)
            {
                BrushSize.Dispose();
                BrushSize = null;
            }

            if (ClearBT != null)
            {
                ClearBT.Dispose();
                ClearBT = null;
            }

            if (DrawView != null)
            {
                DrawView.Dispose();
                DrawView = null;
            }

            if (infoBrushSize != null)
            {
                infoBrushSize.Dispose();
                infoBrushSize = null;
            }

            if (undoBT != null)
            {
                undoBT.Dispose();
                undoBT = null;
            }
        }
示例#17
0
        private void toolStripButton_Click_ChangeBrushSize(object sender, EventArgs e)
        {
            toolStripButton1.Checked = false;
            toolStripButton2.Checked = false;
            toolStripButton3.Checked = false;

            ((ToolStripButton)sender).Checked = true;


            if (toolStripButton1.Checked)
            {
                brushSize = BrushSize.Small;
            }

            if (toolStripButton2.Checked)
            {
                brushSize = BrushSize.Nomal;
            }

            if (toolStripButton3.Checked)
            {
                brushSize = BrushSize.Big;
            }
        }
示例#18
0
 void Start()
 {
     currentBuildMode = BuildMode.Blast;
     currentBrushSize = BrushSize.Normal;
     InputModeSelected(this, new BuildModeArgs(currentBuildMode));
 }
示例#19
0
 public BrushSizeArgs (BrushSize brushSize)
 {
     this.brushSize = brushSize;
 }
示例#20
0
 private void SetBrushSizeInternal(BrushSize brushSize)
 {
     _brushSize = brushSize;
     EmitSignal(nameof(SetBrushSize), brushSize);
 }
示例#21
0
 // Update is called once per frame
 void UpdateBrushSize(BrushSize brushSize)
 {
     image.texture = textureMap[brushSize];
 }
示例#22
0
 protected override void Awake()
 {
     base.Awake();
     buildController.BrushSizeChanged += (sender, args) => { currentBrushSize = args.brushSize; };
 }