Ejemplo n.º 1
0
    public override void OnStateEnter()
    {
        TilesInRange = new List <Tile>();
        ButtonsContainer.DOScale(new Vector3(1.1f, 1.1f, 1.1f), 0.1f).OnComplete(() => ButtonsContainer.DOScale(new Vector3(0, 0, 0), 0.08f));

        foreach (Tile t in GManager.Tiles)
        {
            t.OnDefault();
        }

        foreach (Unit u in GManager.Units)
        {
            if (!u.FinishedAttack)
            {
                u.OnDefault();
            }

            if (u.Owner != 0 && u.RedHighlighted)
            {
                u.GetComponent <SpriteRenderer>().color = Color.white;
            }
        }

        UIMan.MoveIcon.onClick.RemoveAllListeners();
        UIMan.AttackIcon.onClick.RemoveAllListeners();
    }
Ejemplo n.º 2
0
 private void load()
 {
     ButtonsContainer.Add(new CancelButton
     {
         Anchor = Anchor.CentreRight,
         Origin = Anchor.CentreRight,
         Action = () => OnCancel?.Invoke()
     });
 }
Ejemplo n.º 3
0
 private void load()
 {
     if (allowEdit)
     {
         ButtonsContainer.Add(editButton = new PurpleTriangleButton
         {
             RelativeSizeAxes = Axes.Y,
             Size             = new Vector2(100, 1),
             Text             = CommonStrings.ButtonsEdit,
             Action           = () => OnEdit?.Invoke()
         });
     }
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ElasticLookupControlTemplate" /> class.
 /// </summary>
 public ElasticLookupControlTemplate()
     : base()
 {
     typeAndFindPanel.SuspendLayout();
     typeAndFindPanel.Root.BeginInit();
     typeAndFindPanel.Root.Remove(searchActionContainerLayoutItem);
     typeAndFindPanel.Root.Remove(typeValueLayoutItem);
     typeAndFindPanel.Height          += 5;
     elasticActionContainerLayoutGroup = new LayoutControlGroup();
     elasticActionContainerLayoutItem  = new LayoutControlItem();
     elasticActionContainer            = new ButtonsContainer();
     elasticActionContainerLayoutGroup.BeginInit();
     elasticActionContainerLayoutItem.BeginInit();
     elasticActionContainer.BeginInit();
     elasticActionContainerLayoutGroup.TextVisible         = false;
     elasticActionContainerLayoutGroup.GroupBordersVisible = false;
     elasticActionContainerLayoutGroup.DefaultLayoutType   = LayoutType.Horizontal;
     elasticActionContainerLayoutItem.Control          = elasticActionContainer;
     elasticActionContainerLayoutItem.Padding          = new Padding(0);
     elasticActionContainerLayoutItem.Name             = nameof(elasticActionContainerLayoutItem);
     elasticActionContainerLayoutItem.TextVisible      = false;
     elasticActionContainerLayoutItem.ControlAlignment = ContentAlignment.MiddleRight;
     elasticActionContainer.AllowCustomization         = false;
     elasticActionContainer.ContainerId                      = "ElasticActionContainer";
     elasticActionContainer.Name                             = nameof(elasticActionContainer);
     elasticActionContainer.HideItemsCompletely              = false;
     elasticActionContainer.Dock                             = System.Windows.Forms.DockStyle.Fill;
     elasticActionContainer.PaintStyle                       = ActionItemPaintStyle.Caption;
     elasticActionContainer.Root.DefaultLayoutType           = LayoutType.Horizontal;
     elasticActionContainer.Root.EnableIndentsWithoutBorders = DefaultBoolean.True;
     elasticActionContainer.Root.GroupBordersVisible         = false;
     elasticActionContainer.Root.Location                    = new Point(0, 0);
     elasticActionContainer.Root.Name                        = "elasticActionContainerLayoutControlGroup";
     elasticActionContainer.Root.Padding                     = new Padding(0, 0, 0, 0);
     elasticActionContainer.Root.Spacing                     = new Padding(0, 0, 0, 0);
     elasticActionContainer.TabStop                          = false;
     ActionContainersManager.ActionContainerComponents.Add(elasticActionContainer);
     elasticActionContainerLayoutGroup.AddItem(typeValueLayoutItem);
     elasticActionContainerLayoutGroup.AddItem(elasticActionContainerLayoutItem);
     typeAndFindPanel.Root.AddItem(elasticActionContainerLayoutGroup);
     typeAndFindPanel.Root.AddItem(searchActionContainerLayoutItem);
     elasticActionContainer.EndInit();
     elasticActionContainerLayoutItem.EndInit();
     elasticActionContainerLayoutGroup.EndInit();
     typeAndFindPanel.Root.EndInit();
     typeAndFindPanel.ResumeLayout(false);
 }
Ejemplo n.º 5
0
        /// <inheritdoc/>
        protected override void OnDeactivated()
        {
            _FillActionContainersController.CustomFillContainers -= FillActionContainersController_CustomFillContainers;
            var control = View.Editor.Control as Forms.Control;

            if (control != null)
            {
                control.HandleCreated -= GridControlHandleCreated;
            }
            if (Frame != null)
            {
                Frame.TemplateChanged -= Frame_TemplateChanged;
            }
            if (oldFilterFieldsAction != null)
            {
                oldFilterFieldsAction.Active.SetItemValue(FilterPanelGroup, true);
                filterController.FilterFieldsAction = oldFilterFieldsAction;
                oldFilterFieldsAction = null;
            }
            if (buttonsContainer != null)
            {
                var template = Frame?.Template as IDynamicContainersTemplate;
                if (template != null)
                {
                    template.UnregisterActionContainers(new IActionContainer[] { buttonsContainer });
                }
                if (!buttonsContainer.IsDisposed)
                {
                    buttonsContainer.Dispose();
                }
                buttonsContainer = null;
            }
            if (_FilterPanel != null && !_FilterPanel.IsDisposed)
            {
                _FilterPanel.Dispose();
                _FilterPanel = null;
            }
            _GridControl = null;
            newFilterFieldsAction.Active.SetItemValue(FilterPanelGroup, false);
            if (filterController != null)
            {
                filterController.Activated -= FilterControllerActivated;
            }
            base.OnDeactivated();
        }
Ejemplo n.º 6
0
        public override void Reset()
        {
            base.Reset();

            AddInternal(testContainer = new Container()
            {
                RelativeSizeAxes = Axes.Both,
            });
            ButtonsContainer.Add(selectionDropdown = new TestCaseDropdown
            {
                Width         = 150,
                Position      = new Vector2(10, 10),
                Description   = @"Drop-down menu",
                Items         = null,
                SelectedIndex = 0,
            });
            changeTest(FlowTestCase.RightDown);
        }
Ejemplo n.º 7
0
        public override void Reset()
        {
            base.Reset();

            playbackSpeed.TriggerChange();

            AddButton(@"circles", () => load(HitObjectType.Circle));
            AddButton(@"slider", () => load(HitObjectType.Slider));
            AddButton(@"spinner", () => load(HitObjectType.Spinner));

            AddToggle(@"auto", () => { auto = !auto; load(mode); });

            ButtonsContainer.Add(new SpriteText {
                Text = "Playback Speed"
            });
            ButtonsContainer.Add(new BasicSliderBar <double>
            {
                Width          = 150,
                Height         = 10,
                SelectionColor = Color4.Orange,
                Bindable       = playbackSpeed
            });

            framedClock.ProcessFrame();

            var clockAdjustContainer = new Container
            {
                RelativeSizeAxes = Axes.Both,
                Clock            = framedClock,
                Children         = new[]
                {
                    playfieldContainer = new Container {
                        RelativeSizeAxes = Axes.Both
                    },
                    approachContainer = new Container {
                        RelativeSizeAxes = Axes.Both
                    }
                }
            };

            Add(clockAdjustContainer);

            load(mode);
        }
Ejemplo n.º 8
0
        public override void Reset()
        {
            base.Reset();

            KeyCounterCollection kc = new KeyCounterCollection
            {
                Origin     = Anchor.Centre,
                Anchor     = Anchor.Centre,
                IsCounting = true,
                Children   = new KeyCounter[]
                {
                    new KeyCounterKeyboard(Key.Z),
                    new KeyCounterKeyboard(Key.X),
                    new KeyCounterMouse(MouseButton.Left),
                    new KeyCounterMouse(MouseButton.Right),
                },
            };
            BindableInt bindable = new BindableInt {
                MinValue = 0, MaxValue = 200, Default = 50
            };

            bindable.ValueChanged += delegate { kc.FadeTime = bindable.Value; };
            AddButton("Add Random", () =>
            {
                Key key = (Key)((int)Key.A + RNG.Next(26));
                kc.Add(new KeyCounterKeyboard(key));
            });
            ButtonsContainer.Add(new SpriteText {
                Text = "FadeTime"
            });
            ButtonsContainer.Add(new TestSliderBar <int>
            {
                Width          = 150,
                Height         = 10,
                SelectionColor = Color4.Orange,
                Bindable       = bindable
            });
            Add(kc);
        }
Ejemplo n.º 9
0
        private FillFlowContainer buildTest(FillDirection dir, Vector2 spacing)
        {
            ButtonsContainer.RemoveAll(btn => btn != selectionDropdown);

            FillFlowContainer fc;
            var cnt = new Container()
            {
                Padding = new MarginPadding(25f)
                {
                    Top = 100f
                },
                RelativeSizeAxes = Axes.Both,
                Children         = new[]
                {
                    fc = new FillFlowContainer()
                    {
                        RelativeSizeAxes = Axes.Both,
                        AutoSizeAxes     = Axes.None,
                        Direction        = dir,
                        Spacing          = spacing,
                    }
                }
            };

            Add(cnt);

            var rotateBtn = AddButton("Rotate Container", () =>
            {
                if (fc.Rotation > 0)
                {
                    fc.RotateTo(0f, 1000);
                }
                else
                {
                    fc.RotateTo(45f, 1000);
                }
            });

            AddButton("Scale Container", () =>
            {
                if (fc.Scale.X == 1f)
                {
                    fc.ScaleTo(1.2f, 1000);
                }
                else
                {
                    fc.ScaleTo(1f, 1000);
                }
            });
            AddButton("Shear Container", () =>
            {
                if (fc.Shear.X == 0)
                {
                    fc.Shear = new Vector2(0.5f, 0f);
                }
                else
                {
                    fc.Shear = new Vector2(0f, 0f);
                }
            });
            AddToggle("Center Container Anchor", (state) =>
            {
                if (state)
                {
                    fc.Anchor = Anchor.Centre;
                }
                else
                {
                    fc.Anchor = Anchor.TopLeft;
                }
            });
            AddToggle("Center Container Origin", (state) =>
            {
                if (state)
                {
                    fc.Origin = Anchor.Centre;
                }
                else
                {
                    fc.Origin = Anchor.TopLeft;
                }
            });
            AddToggle("Autosize Container", (state) =>
            {
                if (state)
                {
                    fc.RelativeSizeAxes = Axes.None;
                    fc.AutoSizeAxes     = Axes.Both;
                }
                else
                {
                    fc.AutoSizeAxes     = Axes.None;
                    fc.RelativeSizeAxes = Axes.Both;
                    fc.Width            = 1;
                    fc.Height           = 1;
                }
            });
            AddToggle("Anchor TopCenter children", (state) =>
            {
                if (state)
                {
                    foreach (var child in fc.Children)
                    {
                        child.Anchor = Anchor.TopCentre;
                    }
                }
                else
                {
                    foreach (var child in fc.Children)
                    {
                        child.Anchor = Anchor.TopLeft;
                    }
                }
            });
            AddToggle("Rotate children", (state) =>
            {
                if (state)
                {
                    foreach (var child in fc.Children)
                    {
                        child.RotateTo(45f, 1000);
                    }
                }
                else
                {
                    foreach (var child in fc.Children)
                    {
                        child.RotateTo(0f, 1000);
                    }
                }
            });
            AddToggle("Shear children", (state) =>
            {
                if (state)
                {
                    foreach (var child in fc.Children)
                    {
                        child.Shear = new Vector2(0.2f, 0.2f);
                    }
                }
                else
                {
                    foreach (var child in fc.Children)
                    {
                        child.Shear = Vector2.Zero;
                    }
                }
            });
            AddToggle("Scale children", (state) =>
            {
                if (state)
                {
                    foreach (var child in fc.Children)
                    {
                        child.ScaleTo(1.25f, 1000);
                    }
                }
                else
                {
                    foreach (var child in fc.Children)
                    {
                        child.ScaleTo(1f, 1000);
                    }
                }
            });
            AddToggle("Change children origin", (state) =>
            {
                if (state)
                {
                    foreach (var child in fc.Children)
                    {
                        child.Origin = Anchor.Centre;
                    }
                }
                else
                {
                    foreach (var child in fc.Children)
                    {
                        child.Origin = Anchor.TopLeft;
                    }
                }
            });
            var addChildrenBtn = AddToggle("Stop adding children", (state) => { });

            cnt.Position = new Vector2(rotateBtn.Width, 0f);
            cnt.Padding  = new MarginPadding(25f)
            {
                Top = cnt.Padding.Top, Right = 25f + cnt.Position.X
            };
            Add(new Box {
                Colour = Color4.HotPink, Width = 3, Height = 3, Position = fc.Parent.ToSpaceOfOtherDrawable(fc.BoundingBox.TopLeft, this), Origin = Anchor.Centre
            });
            Add(new Box {
                Colour = Color4.HotPink, Width = 3, Height = 3, Position = fc.Parent.ToSpaceOfOtherDrawable(fc.BoundingBox.TopRight, this), Origin = Anchor.Centre
            });
            Add(new Box {
                Colour = Color4.HotPink, Width = 3, Height = 3, Position = fc.Parent.ToSpaceOfOtherDrawable(fc.BoundingBox.BottomLeft, this), Origin = Anchor.Centre
            });
            Add(new Box {
                Colour = Color4.HotPink, Width = 3, Height = 3, Position = fc.Parent.ToSpaceOfOtherDrawable(fc.BoundingBox.BottomRight, this), Origin = Anchor.Centre
            });

            ScheduledDelegate d = null;

            d = Scheduler.AddDelayed(
                () =>
            {
                if (fc.Parent == null)
                {
                    d.Cancel();
                }

                if (addChildrenBtn.State)
                {
                    fc.Invalidate();
                }

                if (fc.Children.Count() < 1000 && !addChildrenBtn.State)
                {
                    fc.Add(new Container
                    {
                        AutoSizeAxes = Axes.Both,
                        Children     = new Drawable[]
                        {
                            new Box
                            {
                                Width  = 50,
                                Height = 50,
                                Colour = new Color4(255, 255, 255, 255)
                            },
                            new SpriteText
                            {
                                Colour = Color4.Black,
                                RelativePositionAxes = Axes.Both,
                                Position             = new Vector2(0.5f, 0.5f),
                                Origin = Anchor.Centre,
                                Text   = fc.Children.Count().ToString()
                            }
                        }
                    });
                }
            },
                100,
                true
                );

            return(fc);
        }
Ejemplo n.º 10
0
        //Buttons
        private void LoadButtons()
        {
            this._buttonList = new List<ButtonsContainer>(4);
            for (int i = 0; i < 4; i++)
            {
                ButtonsContainer bContainer = new ButtonsContainer();
                switch (i)
                {
                    case (int)ButtonSizes.Large:
                        bContainer.EnergyButtonNonPressed = (Image)global::PowerPlanChanger.Properties.Resources.EnergyButton_large;
                        bContainer.PerformanceButtonNonPressed = (Image)global::PowerPlanChanger.Properties.Resources.PerformanceButton_large;
                        bContainer.EnergyButtonPressed = (Image)global::PowerPlanChanger.Properties.Resources.EnergyButtonPressed_large;
                        bContainer.PerformanceButtonPressed = (Image)global::PowerPlanChanger.Properties.Resources.PerformanceButtonPressed_large;
                        break;

                    case (int)ButtonSizes.Medium:
                        bContainer.EnergyButtonNonPressed = (Image)global::PowerPlanChanger.Properties.Resources.EnergyButton_medium;
                        bContainer.PerformanceButtonNonPressed = (Image)global::PowerPlanChanger.Properties.Resources.PerformanceButton_medium;
                        bContainer.EnergyButtonPressed = (Image)global::PowerPlanChanger.Properties.Resources.EnergyButtonPressed_medium;
                        bContainer.PerformanceButtonPressed = (Image)global::PowerPlanChanger.Properties.Resources.PerformanceButtonPressed_medium;
                        break;

                    case (int)ButtonSizes.Small:
                        bContainer.EnergyButtonNonPressed = (Image)global::PowerPlanChanger.Properties.Resources.EnergyButton_small;
                        bContainer.PerformanceButtonNonPressed = (Image)global::PowerPlanChanger.Properties.Resources.PerformanceButton_small;
                        bContainer.EnergyButtonPressed = (Image)global::PowerPlanChanger.Properties.Resources.EnergyButtonPressed_small;
                        bContainer.PerformanceButtonPressed = (Image)global::PowerPlanChanger.Properties.Resources.PerformanceButtonPressed_small;
                        break;

                    case (int)ButtonSizes.XSmall:
                        bContainer.EnergyButtonNonPressed = (Image)global::PowerPlanChanger.Properties.Resources.EnergyButton_xsmall;
                        bContainer.PerformanceButtonNonPressed = (Image)global::PowerPlanChanger.Properties.Resources.PerformanceButton_xsmall;
                        bContainer.EnergyButtonPressed = (Image)global::PowerPlanChanger.Properties.Resources.EnergyButtonPressed_xsmall;
                        bContainer.PerformanceButtonPressed = (Image)global::PowerPlanChanger.Properties.Resources.PerformanceButtonPressed_xsmall;
                        break;
                }
                this._buttonList.Add(bContainer);
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ButtonsContainersParametrizedActionComboItem"/> class.
 /// </summary>
 /// <param name="action">Parametrized Action instance</param>
 /// <param name="owner">Buttons Container</param>
 public ButtonsContainersParametrizedActionComboItem(ParametrizedAction action, ButtonsContainer owner)
     : base(action, owner)
 {
 }
Ejemplo n.º 12
0
        private void GridControlHandleCreated(object sender, EventArgs e)
        {
            if (_GridControl != sender)
            {
                _GridControl = sender as GridControl;
                if (_GridControl != null)
                {
                    _FilterPanel     = new PanelControl();
                    buttonsContainer = new ButtonsContainer();
                    _FilterPanel.BeginInit();
                    _FilterPanel.SuspendLayout();

                    // buttonsContainer
                    buttonsContainer.Location            = new Point(0, 0);
                    buttonsContainer.AllowCustomization  = false;
                    buttonsContainer.ContainerId         = FilterPanelGroup;
                    buttonsContainer.HideItemsCompletely = false;
                    buttonsContainer.Name              = "filterPanelButtonsContainer";
                    buttonsContainer.ActionItemAdding += ButtonsContainer_ActionItemAdding;

                    // _FilterPanel
                    _FilterPanel.Controls.Add(buttonsContainer);
                    _FilterPanel.Padding  = new Forms.Padding(2, 6, 2, 6);
                    buttonsContainer.Dock = Forms.DockStyle.Fill;
                    _FilterPanel.Name     = nameof(_FilterPanel);
                    _FilterPanel.Height   = 40;
                    _FilterPanel.TabIndex = 1;
                    _FilterPanel.Dock     = ((IModelFilterPanel)View.Model).FilterPanelPosition;

                    if (!_GridControl.FormsUseDefaultLookAndFeel)
                    {
                        _FilterPanel.LookAndFeel.Assign(_GridControl.LookAndFeel);
                        buttonsContainer.LookAndFeel.Assign(_GridControl.LookAndFeel);
                    }

                    _FilterPanel.EndInit();
                    _FilterPanel.ResumeLayout(false);

                    if (Frame != null && Frame.Template != null)
                    {
                        var template = Frame.Template as IDynamicContainersTemplate;
                        if (template != null)
                        {
                            template.RegisterActionContainers(new IActionContainer[] { buttonsContainer });
                        }
                    }
                    var ff = buttonsContainer.ActionItems.FirstOrDefault(t => t.Key.Id == newFilterFieldsAction.Id);
                    if (ff.Value != null && ff.Value.LayoutItem != null)
                    {
                        ff.Value.LayoutItem.Spacing = new DevExpress.XtraLayout.Utils.Padding(12, 0, 0, 0);
                    }

                    if (_GridControl.Parent != null)
                    {
                        _GridControl.Parent.Controls.Add(_FilterPanel);
                    }
                    else
                    {
                        _GridControl.ParentChanged += GridControlParentChanged;
                    }

                    UpdateActionState();
                    OnFilterControlCreated(EventArgs.Empty);
                }
            }
        }
Ejemplo n.º 13
0
        private void ChangeFont(WinActionContainerViewItem winActionContainerViewItem, ButtonsContainer buttonsContainer, ActionItemEventArgs e)
        {
            var buttonsContainersSimpleActionItem = e.Item as ButtonsContainersSimpleActionItem;

            if (buttonsContainersSimpleActionItem != null)
            {
                SimpleButton simpleButton = (buttonsContainersSimpleActionItem.Control);
                if (simpleButton != null)
                {
                    var actionLink = (IModelActionLinkFont)winActionContainerViewItem.Model.ActionContainer.First(link => link.ActionId == e.Item.Action.Id);
                    simpleButton.Font = GetFont(actionLink.Font, simpleButton.Font);
                }
            }
        }