Exemplo n.º 1
0
        private void num_B_Click(object sender, EventArgs e)
        {
            ClearB();
            var n  = new Number(0);
            var nc = new NumberControl(n, pnlB);

            nc.Grid.ContextMenuStrip = cntxMenu;
            nc.Grid.Focus();
            ArrangeControls();
            RecordState();
        }
Exemplo n.º 2
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.CheckPathExists  = true;
            saveFileDialog.Filter           = languageSupportManager.GetStringValue("Main_SaveButton_Filter_estm") + "|*.estm";
            saveFileDialog.FileName         = languageSupportManager.GetStringValue("Main_SaveButton_DefaultFileNameTemplate") + $".{DateTime.Now.ToString("yyyyMMdd")}";
            saveFileDialog.Title            = languageSupportManager.GetStringValue("SaveDialogTitle");
            saveFileDialog.InitialDirectory = Environment.CurrentDirectory;


            if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                Template usedTemplate = new Template();
                usedTemplate.Base           = template.Base;
                usedTemplate.PriceHour      = template.PriceHour;
                usedTemplate.CustomControls = new List <CustomControl>();

                foreach (ICustomControl usedControl in controlContainer.Controls)
                {
                    CustomControl customControl = new CustomControl();
                    customControl.Category    = usedControl.Category;
                    customControl.Description = usedControl.Description;
                    customControl.ControlType = usedControl.ControlType;
                    customControl.Effort      = usedControl.Effort;
                    customControl.Weight      = usedControl.Weight;

                    if (usedControl.GetType() == typeof(NumberControl))
                    {
                        NumberControl numberControl = (NumberControl)usedControl;
                        customControl.DefaultValue = numberControl.SelectedNumber.ToString();
                    }
                    else if (usedControl.GetType() == typeof(OptionBoolControl))
                    {
                        OptionBoolControl optionBoolControl = (OptionBoolControl)usedControl;
                        customControl.DefaultValue = optionBoolControl.SelectedOption.ToString();
                    }
                    else if (usedControl.GetType() == typeof(PercentControl))
                    {
                        PercentControl percentControl = (PercentControl)usedControl;
                        int            percent        = Convert.ToInt32(percentControl.EstimatedWeight * 100);

                        customControl.DefaultValue = percent.ToString();
                    }

                    usedTemplate.CustomControls.Add(customControl);
                }

                templateBO.SaveTemplate(usedTemplate, saveFileDialog.FileName);
            }
        }
Exemplo n.º 3
0
        public WorkbenchPanel(GameState state, int workbenchID)
            : base(((int)MessagePanel.Instance.GetBodySize().X / 2) - 300, ((int)Renderer.GetResoultion().Y / 2) - 325, 600, 400, BarMode.Close, state)
        {
            if (Instance != null)
            {
                Instance.Close();
            }
            Instance = this;

            _gameState   = state;
            _workbenchID = workbenchID;
            this.SetPanelLabel(CraftableData.GetWorkbench(workbenchID));

            _craftableIDs = new List <int>();
            for (int i = 0; i < CraftableData.GetCraftableDataCount(); i++)
            {
                if (CraftableData.GetCraftableData(i).WorkbenchID == workbenchID)
                {
                    _craftableIDs.Add(i);
                }
            }

            _craftingSelectionPanel = new ScrollPanel(0, 0, GetContentWidth() / 2, GetContentHeight(), BarMode.Empty, state);
            _craftingInfoPanel      = new ScrollPanel(GetContentWidth() / 2, 0, GetContentWidth() / 2, GetContentHeight(), BarMode.Empty, state);

            _craftingSelectionPanel.OnTrigger       += SelectCraftable;
            _craftingSelectionPanel.OnRenderContent += RenderCraftables;
            _craftingInfoPanel.OnRenderContent      += RenderCraftableInfo;

            _craftingSelectionPanel.DisableHorizontalScroll();
            _craftingInfoPanel.DisableHorizontalScroll();

            _countControl = new NumberControl(10, 10, state);
            _countControl.SetMinimum(1);
            _craftButton            = new Button("Craft", 20 + (int)_countControl.GetBodySize().X, 10, _craftingInfoPanel.GetContentWidth() - 30 - (int)_countControl.GetBodySize().X, 40, state);
            _craftButton.OnTrigger += CraftTrigger;

            _craftingInfoPanel.AddControl(_countControl);
            _craftingInfoPanel.AddControl(_craftButton);

            this.AddControl(_craftingSelectionPanel);
            this.AddControl(_craftingInfoPanel);

            int slotSize = _craftingSelectionPanel.GetContentWidth() / 5;
            int rows     = (int)Math.Ceiling(_craftableIDs.Count / 5f);

            _craftingSelectionPanel.SetScrollableHeight(slotSize * rows);
        }
Exemplo n.º 4
0
    public void DrawNumber(Vector2 _Pos, long _Number, float _Width, float _Height)
    {
        long[] array    = NumberControl.SeparateNum(_Number, this.mEmptyUnit);
        int    num      = array.Length;
        Rect   position = new Rect(_Pos.x, _Pos.y, _Width, _Height);

        for (int i = 0; i < num; i++)
        {
            position.x = _Pos.x + (float)i * _Width + (float)i * this.mSpacing - _Width;
            long      num2      = array[i];
            Texture2D texture2D = this.mTexNums[(int)(checked ((IntPtr)num2))];
            if (texture2D)
            {
                GUI.color = this.TintColor;
                GUI.DrawTexture(position, texture2D);
            }
        }
    }
Exemplo n.º 5
0
        private void RefreshTemplate(string path)
        {
            template = templateBO.LoadTemplate(path);
            int y = 0;

            controlContainer.Controls.Clear();
            foreach (CustomControl customControl in template.CustomControls)
            {
                if (customControl.ControlType.ToUpper().Trim() == "NUMBER")
                {
                    NumberControl numberControl = new NumberControl();
                    numberControl.EstimatedWeigthChanged += CustomControl_EstimatedWeigthChanged;
                    numberControl.Top = y;
                    MapControl(customControl, numberControl);

                    controlContainer.Controls.Add(numberControl);
                    y += numberControl.Height + numberControl.Margin.Bottom;
                }
                else if (customControl.ControlType.ToUpper().Trim() == "PERCENT")
                {
                    PercentControl percentControl = new PercentControl();
                    percentControl.EstimatedWeigthChanged += CustomControl_EstimatedWeigthChanged;
                    percentControl.Top = y;
                    MapControl(customControl, percentControl);

                    controlContainer.Controls.Add(percentControl);
                    y += percentControl.Height + percentControl.Margin.Bottom;
                }
                else if (customControl.ControlType.ToUpper().Trim() == "OPTIONBOOL")
                {
                    OptionBoolControl optionControl = new OptionBoolControl();
                    optionControl.EstimatedWeigthChanged += CustomControl_EstimatedWeigthChanged;
                    optionControl.Top = y;
                    MapControl(customControl, optionControl);

                    controlContainer.Controls.Add(optionControl);
                    y += optionControl.Height + optionControl.Margin.Bottom;
                }
            }

            CustomControl_EstimatedWeigthChanged();
        }
        public NumberBinding(NumberAttribute numberAttribute, MemberInfo memberInfo, object target) : base(numberAttribute, memberInfo, target)
        {
            Group = numberAttribute.Group;

            _control = new NumberControl
            {
                Text    = numberAttribute.TooltipText,
                Title   = numberAttribute.TooltipText,
                Minimum = numberAttribute.Min,
                Maximum = numberAttribute.Max,
                Step    = numberAttribute.Step,
                Value   = (float)_propertyInfo.GetValue(Target)
            };

            _control.ValueChanged += () =>
            {
                _propertyInfo.SetValue(Target, _control.Value);
                OnPropertyChanged();
            };
        }
Exemplo n.º 7
0
        private void InitializeOutputControls()
        {
            int outputAmount = 10;

            numbers = new NumberControl[outputAmount];
            for (int i = 0; i < outputAmount; ++i)
            {
                numbers[i] = new NumberControl()
                {
                    BackColor = Color.White,
                    Name      = "numberControl" + i.ToString(),
                    Size      = new Size(109, 29),
                    TabIndex  = i + 10,
                    Margin    = new Padding(0),

                    Number = i,
                    Value  = 0,
                };
                numbers[i].ControlChanged += (o, e) => (o as NumberControl)?.Refresh();
            }

            numberFlp.Controls.AddRange(numbers);
        }
Exemplo n.º 8
0
        private AritmeticControl CreateAritmeticControl(BaseMathEntity entity, Control container)
        {
            AritmeticControl ac = null;

            if (entity is Number)
            {
                ac = new NumberControl((Number)entity, container);
            }
            else if (entity is Vector)
            {
                ac = new VectorControl((Vector)entity, container);
            }
            else if (entity is Matrix)
            {
                ac = new MatrixControl((Matrix)entity, container);
            }

            if (ac != null)
            {
                ac.Grid.ContextMenuStrip = cntxMenu;
            }

            return(ac);
        }
 public virtual void DeleteNumberControl(NumberControl entity)
 {
     Delete(entity);
 }
 public virtual void UpdateNumberControl(NumberControl entity)
 {
     Update(entity);
 }
 public virtual void CreateNumberControl(NumberControl entity)
 {
     Create(entity);
 }
Exemplo n.º 12
0
 public void Awake()
 {
     this.numberComponent = base.GetComponent <NumberControl>();
     this.clearCompoent   = base.GetComponent <NumberClear>();
 }
Exemplo n.º 13
0
        public TestState()
            : base()
        {
            //*
            ScrollPanel scrollPanel = new ScrollPanel(10, 400, 400, 400, Panel.BarMode.Close_Drag, this);

            scrollPanel.SetScrollDimensions(1000, 1000);

            TextBox textBox = new TextBox(10, 10, 290, 310, this);

            scrollPanel.AddControl(textBox);

            Button button = new Button("Button", 420, 10, 80, 32, this);

            button.OnTrigger += ButtonPress;
            scrollPanel.AddControl(button);

            TextField textField = new TextField(420, 52, 100, 32, this);

            scrollPanel.AddControl(textField);

            NumberControl numberControl = new NumberControl(420, 94, this);

            numberControl.SetMinimum(10);
            numberControl.SetMaximum(20);
            scrollPanel.AddControl(numberControl);

            RadioButton radioButton = new RadioButton(520, 100, this);

            scrollPanel.AddControl(radioButton);

            string[] items = new string[]
            {
                "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10", "Item 11"
            };
            DropDownBox dropDownBox = new DropDownBox(420, 146, 120, items, this);

            scrollPanel.AddControl(dropDownBox);

            string[] menuOptions = new string[]
            {
                "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 6", "Item 7", "Item 8", "Item 9", "Item 10"
            };
            DropDownMenu dropDownMenu = new DropDownMenu(560, 146, 120, "Test Menu", menuOptions, this);

            scrollPanel.AddControl(dropDownMenu);

            ListBox listBox = new ListBox(310, 10, 100, 200, 10, this);

            scrollPanel.AddControl(listBox);

            string[] radioItems = new string[]
            {
                "option 1", "option 2", "option 3"
            };
            RadioControl radioControl = new RadioControl(550, 10, radioItems, this);

            scrollPanel.AddControl(radioControl);

            Label label = new Label(550, 80, 100, 60, this);

            label.SetText("A label." + '\n' + "Line 2.");
            scrollPanel.AddControl(label);

            this.AddControl(scrollPanel);

            string message = "";

            for (int i = 0; i < 20; i++)
            {
                message += "this is a message box" + '\n';
            }
            MessageBox messageBox = new MessageBox(message, this);

            this.AddControl(messageBox);

            Entity entity = Entity.CreateInstance(this.EntityManager, Vector3.Zero);

            this.EntityManager.AddEntity(entity);

            Entity entity2 = Entity.CreateInstance(this.EntityManager, new Vector3(400, 600, 0));

            spriteComponent = new SpriteComponent(entity2);
            spriteComponent.SetXFrames(3);
            spriteComponent.Transform.Parent = entity.GetTransform();
            //spriteComponent.SetTexture(Assets.GetTexture("sprite.png"));
            //spriteComponent.SetSpriteCenter(SpriteComponent.SpriteCenter.Top);

            //*/

            Entity particleEntity            = Entity.CreateInstance(this.EntityManager, new Vector3(400, 400, 0));
            ParticleEmitterData particleData = new ParticleEmitterData();

            particleData.EmitterShape    = PaticleEmitterShape.Rectangle;
            particleData.ParticleTexture = "smoke.png";
            particleData.EmissionRate    = 1000;
            particleData.AngleMin        = 0;
            particleData.AngleMax        = 360;
            particleData.OffsetMin       = 10;
            particleData.OffsetMax       = 120;
            particleData.StartVelocity   = 10;
            particleData.EndVelocity     = 100;
            particleData.StartScale      = 3;
            particleData.EndScale        = 50;
            particleData.RotationSpeed   = 45f;
            particleData.StartColour     = Color4.White;
            particleData.EndColour       = Color4.Transparent;
            //particleData.EndColour.A = 0f;
            particleData.MaxLife = 5;

            new ParticleEmitterComponent(particleEntity, particleData);
            this.EntityManager.AddEntity(particleEntity);
        }
Exemplo n.º 14
0
 public virtual void UpdateNumberControl(NumberControl entity)
 {
     entityDao.UpdateNumberControl(entity);
 }
 public virtual void DeleteNumberControl(NumberControl entity)
 {
     Delete(entity);
 }
 public virtual void CreateNumberControl(NumberControl entity)
 {
     Create(entity);
 }
Exemplo n.º 17
0
 public static long[] SeparateNum(long _Number)
 {
     return(NumberControl.SeparateNum(_Number, -1));
 }
 public virtual void UpdateNumberControl(NumberControl entity)
 {
     Update(entity);
 }
 public virtual void CreateNumberControl(NumberControl entity)
 {
     entityDao.CreateNumberControl(entity);
 }
Exemplo n.º 20
0
 public virtual void CreateNumberControl(NumberControl entity)
 {
     entityDao.CreateNumberControl(entity);
 }
 public virtual void UpdateNumberControl(NumberControl entity)
 {
     entityDao.UpdateNumberControl(entity);
 }
Exemplo n.º 22
0
 public virtual void DeleteNumberControl(NumberControl entity)
 {
     entityDao.DeleteNumberControl(entity);
 }
 public virtual void DeleteNumberControl(NumberControl entity)
 {
     entityDao.DeleteNumberControl(entity);
 }