Наследование: MonoBehaviour
Пример #1
0
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        if (!rigidbody)
            gameObject.AddComponent<Rigidbody>();

        rigidbody.useGravity = UseGravity;
        rigidbody.freezeRotation = true;

        generator.OnGeneratedLevel += delegate(List<BaseRuleElement.ActorData> actorData,
            List<BaseRuleElement.EventData> eventData,
            List<BaseRuleElement.ReactionData> reactionData,
            string filename)
        {
            currentState = State.RESPAWNING;
            checkpoints = null;
        };

        tag = Tag;

        int selected = 0;
        if (Tag != "")
        {
            selected = System.Array.FindIndex(Checkpoint.PossibleCheckpointTargetTags, item => item == Tag);
        }
        checkpointDropDown = new DropDown(selected, Checkpoint.PossibleCheckpointTargetTags);
    }
Пример #2
0
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        int selected = System.Array.FindIndex(possibleLevels, item => item == CurrentPrefab);
        prefabDropDown = new DropDown(selected, possibleLevels);
    }
Пример #3
0
 public override object VisitDropDown(DropDown dropDown)
 {
     if (!dropDown.SupportsDataType(_currentDataType))
     {
         Report.AddError(dropDown.Position, MessageFormat, "dropdown", StringEnum.GetStringValue(_currentDataType));
     }
     return null;
 }
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        dropdownNames = System.Enum.GetNames(typeof(KeyCode));

        keyDropDown = new DropDown(System.Array.FindIndex(dropdownNames, item => item == InputKey.ToString()), dropdownNames);
    }
        public void Given_a_drop_down_exists()
        {
            _componentFactory = SubstituteFor<IComponentFactory>();
            _dropDown = Substitute.For<DropDown>();

            _componentFactory
                .HtmlControlFor<DropDown>(_dropDownPropertySelector)
                .Returns(_dropDown);    
        }
Пример #6
0
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        trackedButtonDropDown = new DropDown((int)TrackedButton, System.Enum.GetNames(typeof(MouseButton)));

        if (TrackedCamera == null)
            TrackedCamera = FindObjectOfType<PlayerCamera>();
    }
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        if (counter == null)
        {
            counter = Counter.Get(CounterName);
        }

        kindOfChangeDropDown = new DropDown((int)KindOfChange, System.Enum.GetNames(typeof(Change)));
    }
        public void Given_a_drop_down_has_a_selected_option()
        {
            _componentFactory = SubstituteFor<IComponentFactory>();
            _dropDown = Substitute.For<DropDown>();

            _componentFactory
                .HtmlControlFor<DropDown>(_dropDownPropertySelector)
                .Returns(_dropDown);

            _dropDown.SelectedElementText.Returns("Selected option....");
        }
Пример #9
0
        public void Logical_Children_Should_Be_Children_Of_Container()
        {
            var target = new DropDown();

            target.Template = GetTemplate();
            target.ApplyTemplate();

            var childIds = ((ILogical)target).LogicalChildren.Cast<Control>().Select(x => x.Name);

            Assert.Equal(new[] { "contentControl", "toggle", "popup" }, childIds);
        }
Пример #10
0
        public ActionResult ChangePrice(ChangePrice obj)
        {
            var res = ChangePriceindb(obj);

            if (res.Contains("Successfully"))
            {
                ViewBag.Message = res;
                ViewBag.Screen  = DropDown.ScreenList();
                ViewBag.Class   = DropDown.Classid();
            }
            return(View("Adminconsole"));
        }
Пример #11
0
        // Token: 0x0600023B RID: 571 RVA: 0x00015EEC File Offset: 0x000140EC
        public static bool List(string identifier, GUIContent buttonContent, GUIContent[] listContent, params GUILayoutOption[] options)
        {
            Vector2 vector = Prefab._listStyle.CalcSize(buttonContent);
            List <GUILayoutOption> list = options.ToList <GUILayoutOption>();

            list.Add(GUILayout.Height(vector.y));
            list.Add(GUILayout.Width(vector.x + 5f));
            Rect     rect     = GUILayoutUtility.GetRect(vector.x + 5f, vector.y, list.ToArray());
            DropDown dropDown = DropDown.Get(identifier);

            return(Prefab.List(rect, ref dropDown.IsEnabled, ref dropDown.ListIndex, ref dropDown.ScrollView, buttonContent, listContent, "button", "box", Prefab._listStyle));
        }
Пример #12
0
        public Maintainance()
        {
            subject  = new DropDown(Resources.Subject, "maintainence");
            building = new Input(Resources.Building, true, false)
            {
                MaxLength = 5
            };
            lab = new Input(Resources.HallOrLab, true, false)
            {
                MaxLength = 5
            };
            details = new Input(Resources.RequestDetails, true, true)
            {
                MaxLength = 250
            };

            panel = new FlowLayoutPanel {
                Dock      = DockStyle.Fill,
                BackColor = Color.Transparent,
                Padding   = new Padding(20, 200, 20, 50),
            };
            panel.Controls.AddRange(new Control[] { subject, building, lab, details });
            panel.ControlAdded += (s, e) => {
                (s as FlowLayoutPanel).SetFlowBreak(e.Control, true);
            };

            //int x = (Screen.PrimaryScreen.Bounds.Width - CommandButton.DefaultWidth) / 2;
            //close = new CommandButton(Resources.Close) {
            //    Location = new Point(x - CommandButton.DefaultWidth - 10, 0),
            //};
            //close.Click += (s, e) => { Close(); };

            //send = new CommandButton(Resources.Send) {
            //    Location = new Point(x + CommandButton.DefaultWidth + 10, 0),
            //};
            //send.Click += OnSend;

            //footer = new Panel {
            //    Dock = DockStyle.Bottom,
            //    Height = CommandButton.DefaultHeight + 2,
            //    BackColor = Color.Transparent,
            //};
            //footer.Controls.Add(close);
            //footer.Controls.Add(send);

            Footer footer = new Footer(CommandButton.DefaultHeight + 120, new Padding(0, 5, 0, 5), Resources.Back, Resources.Send);

            footer.SetCallback(0, (s, e) => { Close(); });
            footer.SetCallback(1, OnSend);

            Controls.Add(footer);
            Controls.Add(panel);
        }
Пример #13
0
        Control ClearButton(DropDown list)
        {
            var control = new Button {
                Text = "Clear"
            };

            control.Click += delegate
            {
                list.Items.Clear();
            };
            return(control);
        }
Пример #14
0
        Control ClearSelected(DropDown list)
        {
            var control = new Button {
                Text = "Clear Selected"
            };

            control.Click += delegate
            {
                list.SelectedIndex = -1;
            };
            return(control);
        }
Пример #15
0
 private void OnTableControlRowSelect(object sender, ListEditorEventArgs e)
 {
     if (TableEditor != null)
     {
         var item = (DBItem)e.Item;
         Value = ParseValue(item);
         ((TextEntry)Editor.Widget).Changed -= OnTextChanged;
         ((TextEntry)Editor.Widget).Text     = item.ToString();
         ((TextEntry)Editor.Widget).Changed += OnTextChanged;
         DropDown.Hide();
     }
 }
Пример #16
0
        public void HideDropDown(ToolStripDropDownCloseReason reason)
        {
            if (_dropDown == null || !DropDown.Visible)
            {
                return;
            }

            // OnDropDownHide is called before actually closing DropDown
            OnDropDownHide(EventArgs.Empty);
            DropDown.Close(reason);
            Invalidate();
        }
Пример #17
0
        public void HienThiDropType()
        {
            DataTable dt = dalType.LayStypeVN();

            if (dt.Rows.Count > 0)
            {
                DropDown.DataSource     = dt;
                DropDown.DataValueField = "Sitemtp";
                DropDown.DataTextField  = "Stpnamevn";
                DropDown.DataBind();
            }
        }
        public IEnumerable <DropDown> GetAllNewsLetterEmails(int?id)
        {
            var newsletterMailList = _dbContext.NewsletterMails.Where(a => a.NewsletterMailId == id || id == null || id.ToString() == "").Select(a => new
            {
                Value = a.NewsletterMailId,
                Text  = a.Subject
            }).ToList();

            DataTable data = Utility.DataTable.GetDataTable(newsletterMailList);

            return(from DataRow row in data.Rows select DropDown.ConvertToModel(row));
        }
        public IEnumerable <DropDown> GetAllSoftwareCategories(int?id)
        {
            var softwareCategoriesList = _dbContext.SoftwareCategories.Where(a => a.SoftwareCategoryId == id || id == null || id.ToString() == "").Select(a => new
            {
                Value = a.SoftwareCategoryId,
                Text  = a.SoftwareCategoryName
            }).ToList();

            DataTable data = Utility.DataTable.GetDataTable(softwareCategoriesList);

            return(from DataRow row in data.Rows select DropDown.ConvertToModel(row));
        }
        /// <summary>
        /// Handles the ShapeSelected event of the control control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        void control_ShapeSelected(object sender, EventArgs e)
        {
            var shapee = (ShapeToolEventArgs)e;

            Tag   = shapee.Command;
            Image = _imgShape[((Core.ShapeBase)shapee.Command.Reserve).GetShapeType()];

            // Fire selected shape changed
            base.OnDropDownItemClicked(new ToolStripItemClickedEventArgs(null));

            DropDown.Close();
        }
Пример #21
0
        public string GetConfigurationTemplate(string template, IDictionary <string, string> parameters)
        {
            var settings = Settings.Parse(template);

            new Populator(parameters).Populate(settings);
            TextBox SQLServer = settings.Find("SQLServer") as TextBox;

            SQLServer.HelpText = string.Empty;
            TextBox  SQLUser       = settings.Find("SQLUser") as TextBox;
            CheckBox SQLUseSQLAuth = settings.Find("SQLUseSQLAuth") as CheckBox;
            TextBox  SQLPassword   = settings.Find("SQLPassword") as TextBox;

            SQLPassword.Visible = SQLUseSQLAuth.Value;
            string errorMessage = "";

            IList <string> databases   = SQLHelpers.GetDatabases(SQLServer, SQLUser, SQLUseSQLAuth, this.decrypt(SQLPassword.Value), out errorMessage);
            DropDown       SQLDatabase = settings.Find("SQLDatabase") as DropDown;

            SQLDatabase.Options = databases.Select(i => new Option()
            {
                DisplayMemeber = i, ValueMemeber = i
            }).ToList();

            CheckBox CreateTable = settings.Find("CreateTable") as CheckBox;
            TextBox  SQLTableNew = settings.Find("SQLTableNew") as TextBox;

            SQLTableNew.Visible = (CreateTable.Value == true);

            DropDown SQLTable = settings.Find("SQLTable") as DropDown;

            SQLTable.Visible = (CreateTable.Value == false);

            if (!String.IsNullOrWhiteSpace(SQLDatabase.Value))
            {
                IList <string> tables = SQLHelpers.GetTables(SQLServer, SQLUser, SQLUseSQLAuth, this.decrypt(SQLPassword.Value), SQLDatabase, out errorMessage);
                SQLTable.Options = tables.Select(i => new Option()
                {
                    DisplayMemeber = i, ValueMemeber = i
                }).ToList();
                if (tables.Contains(SQLTable.Value) == false)
                {
                    SQLTable.Value = "";
                }
            }

            if (!String.IsNullOrWhiteSpace(errorMessage))
            {
                SQLServer.HelpText = errorMessage;
            }

            return(settings.ToString());
        }
Пример #22
0
        void OnIsDropDownOpenChanged(bool newValue)
        {
            if (DropDown != null)
            {
                if (newValue)
                {
                    DropDown.PlacementTarget = this;
                    DropDown.Placement       = PlacementMode.Bottom;
                    DropDown.SetBinding(ContextMenu.IsOpenProperty, new Binding()
                    {
                        Source = this, Path = new PropertyPath(IsDropDownOpenProperty), Mode = BindingMode.TwoWay
                    });
                }
                else
                {
                    DropDown.ClearValue(ContextMenu.IsOpenProperty);
                    DropDown.ClearValue(ContextMenu.PlacementTargetProperty);
                    DropDown.ClearValue(ContextMenu.PlacementProperty);
                }
            }
            else
            {
                if (newValue)
                {
                    if (_contextMenu != null)
                    {
                        return;
                    }

                    _contextMenu = new ContextMenu();
                    _contextMenu.PlacementTarget = this;
                    _contextMenu.Placement       = PlacementMode.Bottom;
                    _contextMenu.SetBinding(ContextMenu.ItemsSourceProperty, new Binding()
                    {
                        Source = this, Path = new PropertyPath(DropDownItemsSourceProperty)
                    });
                    _contextMenu.SetBinding(ContextMenu.ItemContainerStyleProperty, new Binding()
                    {
                        Source = this, Path = new PropertyPath(DropDownItemStyleProperty)
                    });
                    _contextMenu.SetBinding(ContextMenu.IsOpenProperty, new Binding()
                    {
                        Source = this, Path = new PropertyPath(IsDropDownOpenProperty), Mode = BindingMode.TwoWay
                    });
                }
                else
                {
                    _contextMenu.ClearValue(ContextMenu.IsOpenProperty);
                    _contextMenu = null;
                }
            }
        }
Пример #23
0
        public JsonResult getFamilyPosition()
        {
            var jsondata = context.FamilyPosition.ToList();
            List <DropdownValues> list = new List <DropdownValues>();

            foreach (Models.FamilyPosition obj in jsondata)
            {
                list.Add(new DropdownValues(obj.FamilyPositionID, obj.Position));
            }
            DropDown dd = new DropDown(list);

            return(Json(dd, JsonRequestBehavior.AllowGet));
        }
Пример #24
0
        public JsonResult getCities()
        {
            var jsondata = context.Cities.ToList();
            List <DropdownValues> list = new List <DropdownValues>();

            foreach (Models.Cities obj in jsondata)
            {
                list.Add(new DropdownValues(obj.CitiesID, obj.CityName));
            }
            DropDown dd = new DropDown(list);

            return(Json(dd, JsonRequestBehavior.AllowGet));
        }
Пример #25
0
        public ActionResult Complient(ComplientStatus obj)
        {
            obj.cusid = 26; //Session["UserID"];
            string val = RaiseComplient(obj);

            if (val.Contains("Successfully"))
            {
                ViewBag.Message = "Successfully";
            }
            ViewBag.IssueList = DropDown.IssueList();

            return(View());
        }
Пример #26
0
        private Point GetPostionDropDown()
        {
            var p = Parent.PointToScreen(Location);

            switch (Direction)
            {
            case DockStyle.Left:
                p.X -= DropDown.GetPreferredSize(Size.Empty).Width + 10;
                break;
            }

            return(p);
        }
Пример #27
0
        public ActionResult getJobtags()
        {
            DropDown objData = new DropDown();

            //create object data for DropdownModel
            objData.ParentDataModel = new List <Parent>();
            objData.ClildDataModel  = new List <Child>();

            objData.ParentDataModel = GetParentData_Jobs();
            objData.ClildDataModel  = GetChildData_Jobs();

            return(View(objData));
        }
        public void Debug()
        {
            IWebDriver drv = new ChromeDriver();

            drv.Manage().Window.Maximize();

            var amazonHomePage = new AmazonHomePage(drv);

            amazonHomePage.NavigateTo();
            var drp = new DropDown(drv, "", "#searchDropdownBox");

            drp.SelectItemByName("Pet Supplies");
        }
Пример #29
0
        // get checked flags in UI
        private long GetCheckedFlags()
        {
            long ret = 0;

            for (int i = 0; i < DropDown.items.Length; i++)
            {
                if (DropDown.GetChecked(i))
                {
                    ret |= (DropDown.GetItemUserData(i) as IConvertible).ToInt64();
                }
            }
            return(ret);
        }
Пример #30
0
 public ActionResult BooKMovie()
 {
     ViewBag.Movie     = BooKMovieDetails();
     ViewBag.Classid   = DropDown.Classid();
     ViewBag.Showid    = DropDown.Showid();
     ViewBag.NoTickets = DropDown.NoTickets();
     //BookMovie objcollege = new CollegeDetails();
     //if (Request.HttpMethod != "POST")
     //{
     //    ViewBag.Movie = BooKMovieDetails();
     //}
     return(View());
 }
Пример #31
0
        DropDown Items()
        {
            var control = new DropDown();

            LogEvents(control);
            for (int i = 0; i < 20; i++)
            {
                control.Items.Add(new ListItem {
                    Text = "Item " + i
                });
            }
            return(control);
        }
        public Dialog_ScheduleTypeLimit()
        {
            Padding     = new Padding(5);
            Resizable   = true;
            Title       = $"Schedule type limits - {DialogHelper.PluginName}";
            WindowStyle = WindowStyle.Default;
            Width       = 350;
            this.Icon   = DialogHelper.HoneybeeIcon;

            var layout = new DynamicLayout();

            layout.DefaultSpacing = new Size(5, 5);
            layout.DefaultPadding = new Padding(5);

            var dropDowns = new DropDown();

            foreach (var item in _typeLimitLib)
            {
                var dropItem = new ListItem();
                dropItem.Text = item.Key;
                dropItem.Tag  = item.Value;
                dropDowns.Items.Add(dropItem);
            }
            dropDowns.SelectedIndex = 0;
            layout.Add("Select a schedule type limit:");
            layout.Add(dropDowns);

            DefaultButton = new Button {
                Text = "OK"
            };
            DefaultButton.Click += (sender, e) =>
            {
                var sel = (dropDowns.SelectedValue as ListItem)?.Tag as ScheduleTypeLimit;
                if (sel == null)
                {
                    MessageBox.Show("Failed to select a ScheduleTypeLimit");
                    return;
                }
                Close(sel);
            };


            AbortButton = new Button {
                Text = "Cancel"
            };
            AbortButton.Click += (sender, e) => Close();
            layout.AddSeparateRow(null, DefaultButton, AbortButton, null);
            layout.AddRow(null);

            this.Content = layout;
        }
Пример #33
0
 protected void Awake()
 {
     try
     {
         this.categoryList = this.gameObject.AddComponent <DropDown>();
         this.categoryList.DrawCallback = this.DrawCategories;
         this.presetList = this.gameObject.AddComponent <DropDown>();
         this.presetList.DrawCallback = this.DrawPresets;
     }
     catch (Exception ex)
     {
         Logger.Exception(ex);
     }
 }
        private void InitializeControls()
        {
            _fontsDropDown = this.FindControl <DropDown>("FontsDropDown");
            _fontsDropDown.SelectionChanged += UpdateFont;

            _glyphsListBox       = this.FindControl <ListBox>("GlyphsListBox");
            _glyphsListBox.Items = Glyphs;

            _inputTextBox = this.FindControl <TextBox>("InputTextBox");
            //_inputTextBox.TextInput += UpdateRenderImage;
            _inputTextBox.KeyDown += UpdateRenderImage;

            _outputImage = this.FindControl <Image>("OutputImage");
        }
        public IEnumerable <DropDown> GetAllProductCategories(int?id)
        {
            var productCategoriesList = _dbContext.ProductCategories.Where(a => a.ProductCategoryId == id || id == null || id.ToString() == "").Select(a => new
            {
                Value = a.ProductCategoryId,
                Text  = a.ProductCategoryName
            }).ToList();
            //DataTable data = Utility.DataTable.GetDataTable(designationList);

            //var designationList = _dbContext.Database.SqlQuery<DropDown>(" Select CAST(DesignationId as nchar(10)) as Value, DesignationName as Text from Designations").ToList();
            DataTable data = Utility.DataTable.GetDataTable(productCategoriesList);

            return(from DataRow row in data.Rows select DropDown.ConvertToModel(row));
        }
Пример #36
0
        public override void InitGrid()
        {
            DropDown dropGX = new DropDown();

            Initialize.InitDropDown(dropGX, "GX", new G.BLL.ERP.BaseData.DM_GXLogic(), "ID", "GXNAME");

            gGrid1.AddGridColumn("SORTID", "序号", "Int32", 40, true);
            gGrid1.AddGridColumn("ITEMTYPENAME", "物品类型", "String", 120, true);
            gGrid1.AddGridColumn("GXID", "工序", "Int32", 100, dropGX, "GXNAME");
            gGrid1.AddGridColumn("ISASSIST", "是否外协", "Boolean", 60);
            gGrid1.FrozenCell          = 2;
            gGrid1.AutoGenerateColumns = false;
            gGrid1.InitGrid();
        }
Пример #37
0
        void CustomTagKeyUp(object sender, KeyEventArgs e)
        {
            string tag = ((ToolStripTextBox)sender).Text.Trim();

            if (e.KeyCode != Keys.Enter || string.IsNullOrEmpty(tag))
            {
                return;
            }

            list.Tag(tag);
            DropDown.Close();
            ((ToolStripTextBox)sender).Clear();
            e.Handled = true;
        }
Пример #38
0
        private void SetupViewModel(UserViewModel model)
        {
            var user = _userService.GetAllUser();

            model.Users = DropDown.GetDropDownPappingGeneric(
                user,
                nameof(UserViewModel.Id),
                nameof(UserViewModel.FullName)
                );

            model.Users.Insert(0, (new SelectListItem {
                Text = "USER NAME (Default '--')", Value = "0"
            }));
        }
Пример #39
0
        private void RefreshIndexesDropDown(DropDown drop)
        {
            drop.Items.Clear();

            foreach (var i in Titan.Instance.AccountManager.Accounts)
            {
                if (i.Key != -1)
                {
                    drop.Items.Add("#" + i.Key + " (" + i.Value.Count + " accounts)");
                }
            }

            drop.SelectedIndex = Titan.Instance.AccountManager.Index;
        }
Пример #40
0
        public void SelectionBoxItem_Is_Rectangle_With_VisualBrush_When_Selection_Is_Control()
        {
            var items = new[] { new Canvas() };
            var target = new DropDown
            {
                Items = items,
                SelectedIndex = 0,
            };

            var rectangle = target.GetValue(DropDown.SelectionBoxItemProperty) as Rectangle;
            Assert.NotNull(rectangle);

            var brush = rectangle.Fill as VisualBrush;
            Assert.NotNull(brush);
            Assert.Same(items[0], brush.Visual);
        }
Пример #41
0
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        generator.OnActorGOChanged += delegate(ActorData data, Actor newActor, RuleGenerator ruleGenerator)
        {
            if (WinningActor != null && WinningActor.Id == data.id)
            {
                WinningActor = newActor;
            }

            if (LosingActor != null && LosingActor.Id == data.id)
            {
                LosingActor = newActor;
            }
        };

        int selected = 0;

        string[] endingNames = System.Enum.GetNames(typeof(GameEnd));
        endingDropDown = new DropDown(0, endingNames);

        if (WinningActor != null)
            selected = System.Array.FindIndex(generator.Gui.ActorNames, item => item == WinningActor.Label);

        winningDropDown = new ActorDropDown(selected,
            generator.Gui.ActorNames,
            ref generator.Gui.OnAddedActor,
            ref generator.Gui.OnRenamedActor,
            ref generator.Gui.OnDeletedActor);

        selected = 0;
        if (LosingActor != null)
            selected = System.Array.FindIndex(generator.Gui.ActorNames, item => item == LosingActor.Label);

        losingDropDown = new ActorDropDown(selected,
            generator.Gui.ActorNames,
            ref generator.Gui.OnAddedActor,
            ref generator.Gui.OnRenamedActor,
            ref generator.Gui.OnDeletedActor);
    }
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        this.generator = generator;

        generator.OnActorGOChanged += delegate(ActorData data, Actor newActor, RuleGenerator ruleGenerator)
        {
            if (CollideWithActor != null && CollideWithActor.Id == data.id)
                CollideWithActor = newActor;
        };

        // setting up gui elements - actors
        string[] actors = generator.Gui.ActorNames;
        actorDropDown = new ActorDropDown(
            System.Array.FindIndex(actors, item => item == Actor.Label),
            actors,
            ref generator.Gui.OnAddedActor, ref generator.Gui.OnRenamedActor, ref generator.Gui.OnDeletedActor);

        // gui - tags
        tagDropDown = new DropDown(PossibleCollisionTags.FindIndex(item => item == CollideWithTag), PossibleCollisionTags.ToArray());

        // gui - collision with other actor
        int index = 0;
        if (CollideWithActor != null)
            index = System.Array.FindIndex(actors, item => item == CollideWithActor.Label);
        collisionActorDropDown = new ActorDropDown(index, actors,
            ref generator.Gui.OnAddedActor, ref generator.Gui.OnRenamedActor, ref generator.Gui.OnDeletedActor);

        // gui - triggering
        triggerDropDown = new DropDown((int)TriggerOn, System.Enum.GetNames(typeof(CollisionPhase)));

        // gui - choosing which kinds of objects to trigger
        int init = 0;
        if (CollideWithActor != null)
            init = 1;
        chooseObjectKindDropDown = new DropDown(init, new string[] { "any object which is a", "the actor" });

        SubscribeRelay();
    }
Пример #43
0
        public void SelectionBoxItem_Rectangle_Is_Removed_From_Logical_Tree()
        {
            var target = new DropDown
            {
                Items = new[] { new Canvas() },
                SelectedIndex = 0,
                Template = GetTemplate(),
            };

            var root = new TestRoot { Child = target };
            target.ApplyTemplate();
            target.Presenter.ApplyTemplate();

            var rectangle = target.GetValue(DropDown.SelectionBoxItemProperty) as Rectangle;
            Assert.True(((ILogical)target).IsAttachedToLogicalTree);
            Assert.True(((ILogical)rectangle).IsAttachedToLogicalTree);

            rectangle.DetachedFromLogicalTree += (s, e) => { };

            root.Child = null;

            Assert.False(((ILogical)target).IsAttachedToLogicalTree);
            Assert.False(((ILogical)rectangle).IsAttachedToLogicalTree);
        }
Пример #44
0
    /// <summary>
    /// Collects all events, so that they can be updated when appropriate
    /// </summary>
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        RuleGenerator = generator;

        // get all events
        ScanEvents();
        InitializeEvents();

        // get all reactions
        ScanReactions();
        InitializeReactions();

        OldPrefab = CurrentPrefab;

        int selected;
        if (CurrentPrefab == "")
            selected = 0;
        else
        {
            selected = System.Array.FindIndex(possiblePrefabs, item => item == CurrentPrefab);
        }

        prefabDropDown = new DropDown(selected, possiblePrefabs);

        pausedEvents = false;
    }
Пример #45
0
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        this.generator = generator;

        generator.OnActorGOChanged += delegate(ActorData data, Actor newActor, RuleGenerator ruleGenerator)
        {
            if (WatchedObject == null || WatchedObject.Id == data.id)
                WatchedObject = newActor;
        };

        string[] actors = generator.Gui.ActorNames;
        actorDropDown = new ActorDropDown(
            System.Array.FindIndex(actors, item => item == Actor.Label), actors,
            ref generator.Gui.OnAddedActor, ref generator.Gui.OnRenamedActor, ref generator.Gui.OnDeletedActor);

        if (WatchedObject == null)
        {
            WatchedObject = generator.GetActor(0); // dont get global actor bec it could be anywhere
        }

        watchedActorDropDown = new ActorDropDown(
            System.Array.FindIndex(actors, item => item == WatchedObject.Label), actors,
            ref generator.Gui.OnAddedActor, ref generator.Gui.OnRenamedActor, ref generator.Gui.OnDeletedActor);

        comparisonDropDown = new DropDown(
            (int)TriggerWhenDistance,
            System.Enum.GetNames(typeof(Comparison)));
    }
Пример #46
0
        protected void Awake()
        {
            try
            {
                Instance = this;
                bodiesList = gameObject.AddComponent<DropDown>();
                bodiesList.DrawCallback = DrawBodiesList;
                Load();

                SimManager.UpdateModSettings();
                SimManager.OnReady -= GetStageInfo;
                SimManager.OnReady += GetStageInfo;
            }
            catch (Exception ex)
            {
                Logger.Exception(ex, "BuildAdvanced.Awake()");
            }
        }
Пример #47
0
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        this.generator = generator;

        generator.OnActorGOChanged += delegate(ActorData data, Actor newActor, RuleGenerator ruleGenerator)
        {
            if (ActorDirectionIsRelativeTo != null && ActorDirectionIsRelativeTo.Id == data.id)
            {
                ActorDirectionIsRelativeTo = newActor;
            }
        };

        if (Reactor.rigidbody == null)
            Reactor.gameObject.AddComponent<Rigidbody>();

        Reactor.rigidbody.freezeRotation = true;
        Reactor.rigidbody.useGravity = false;

        string[] actors = generator.Gui.ActorNames;
        actorDropDown = new ActorDropDown(
            System.Array.FindIndex(actors, item => item == Reactor.Label),
            actors,
            ref generator.Gui.OnAddedActor, ref generator.Gui.OnRenamedActor, ref generator.Gui.OnDeletedActor);

        moveDirectionDropdown = new DropDown((int)MoveDirection, System.Enum.GetNames(typeof(Direction)));
        relativeToDropdown = new DropDown((int)DirectionRelativeTo, System.Enum.GetNames(typeof(RelativeTo)));

        relativeActorDropDown = new ActorDropDown(
            ActorDirectionIsRelativeTo != null ?
                System.Array.FindIndex(actors, item => item == ActorDirectionIsRelativeTo.Label) :
                0,
            actors,
            ref generator.Gui.OnAddedActor, ref generator.Gui.OnRenamedActor, ref generator.Gui.OnDeletedActor);
    }
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        this.generator = generator;

        generator.OnActorGOChanged += delegate(ActorData data, Actor newActor, RuleGenerator ruleGenerator)
        {
            if (ObjectToDeactivate != null && ObjectToDeactivate.Id == data.id)
            {
                ObjectToDeactivate = newActor;
            }
        };

        if (ObjectToDeactivate == null)
        {
            ObjectToDeactivate = Reactor;
        }

        actorDropDown = new ActorDropDown(
            System.Array.FindIndex(generator.Gui.ActorNames, item => item == Reactor.Label),
            generator.Gui.ActorNames,
            ref generator.Gui.OnAddedActor, ref generator.Gui.OnRenamedActor, ref generator.Gui.OnDeletedActor);

        targetObjectDropDown = new DropDown(
            (int)TargetObj,
            System.Enum.GetNames(typeof(TargetObject)));
    }
Пример #49
0
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        int selected = 0;
        if (TagForSpawnedObjects != "")
            selected = System.Array.FindIndex(possibleSpawnTags, item => item == TagForSpawnedObjects);

        tagDropDown = new DropDown(selected, possibleSpawnTags);
    }
Пример #50
0
    public override void Initialize(RuleGenerator generator)
    {
        base.Initialize(generator);

        comparisonDropDown = new DropDown((int)Compare, System.Enum.GetNames(typeof(Comparison)));
    }
Пример #51
0
        public Control CreateControl(ControlType controlType)
        {
            var result = default(Control);

            switch (controlType)
            {
                case ControlType.FreeText:
                    result = new FreeText
                    {
                        ControlType = ControlType.FreeText,
                        Text = Resource.FreeTextDefaultText,
                        FontSize = 12,
                        Color = "#000000",
                        Strong = false
                    };
                    break;
                case ControlType.TextBox:
                    result = new TextBox
                    {
                        ControlType = ControlType.TextBox,
                        Label = Resource.TextBoxLabel,
                        Size = 200,
                        ValidationRules = new List<ValidationRule>
                        {
                            new ValidationRules.Required
                            {
                                ValidationType = ValidationType.Required,
                                IsRequired = false
                            },
                            new ValidationRules.Length
                            {
                                ValidationType = ValidationType.Length
                            }
                        }
                    };
                    break;
                case ControlType.Number:
                    result = new Number
                    {
                        ControlType = ControlType.Number,
                        Label = Resource.NumberLabel,
                        Size = 200,
                        ValidationRules = new List<ValidationRule>
                        {
                            new ValidationRules.Required
                            {
                                ValidationType = ValidationType.Required,
                                IsRequired = false
                            },
                            new ValidationRules.Length
                            {
                                ValidationType = ValidationType.Length
                            },
                            new ValidationRules.Number
                            {
                                ValidationType = ValidationType.Number
                            }
                        }
                    };
                    break;
                case ControlType.Email:
                    result = new Email
                    {
                        ControlType = ControlType.Number,
                        Label = Resource.EmailLabel,
                        Size = 200,
                        ValidationRules = new List<ValidationRule>
                        {
                            new ValidationRules.Required
                            {
                                ValidationType = ValidationType.Required,
                                IsRequired = false
                            },
                            new ValidationRules.Length
                            {
                                ValidationType = ValidationType.Length
                            },
                            new ValidationRules.Email
                            {
                                ValidationType = ValidationType.Email
                            }
                        }
                    };
                    break;
                case ControlType.FormattedNumber:
                    result = new FormattedNumber
                    {
                        ControlType = ControlType.FormattedNumber,
                        Label = Resource.FormattedNumberLabel,
                        Separator = FormSettings.DEFAULT_FORMAT_SEPARATOR,
                        ValidationRules = new List<ValidationRule>
                        {
                            new ValidationRules.Required
                            {
                                ValidationType = ValidationType.Required,
                                IsRequired = false
                            },
                            new ValidationRules.FormattedNumber
                            {
                                ValidationType = ValidationType.FormattedNumber
                            }
                        }
                    };
                    break;
                case ControlType.DropDown:
                    result = new DropDown
                    {
                        ControlType = ControlType.DropDown,
                        Label = Resource.DropDownLabel,
                        Value = 0.ToString(),
                        EmptyOption = new Option{Id = -1, Value = string.Empty},
                        Options = new List<Option>
                        {
                           new Option{Id = 1, Value = Resource.FirstOption},
                           new Option{Id = 2, Value = Resource.SecondOption},
                           new Option{Id = 3, Value = Resource.ThirdOption}
                        },
                        ValidationRules = new List<ValidationRule>
                        {
                            new ValidationRules.Required
                            {
                                IsRequired = false,
                                ValidationType = ValidationType.Required
                            }
                        }

                    };
                    break;
                case ControlType.CheckList:
                    result = new CheckList
                    {
                        ControlType = ControlType.CheckList,
                        Label = Resource.CheckListLabel,
                        OptionLayoutType = OptionLayoutType.OneColumn,
                        SelectedValues = new List<int>{},
                        Options = new List<Option>
                        {
                            new Option{Id = 1, Value = Resource.FirstOption},
                            new Option{Id = 2, Value = Resource.SecondOption},
                            new Option{Id = 3, Value = Resource.ThirdOption}
                        },
                        ValidationRules = new List<ValidationRule>
                        {
                            new ValidationRules.Required
                            {
                                IsRequired = false,
                                ValidationType = ValidationType.Required
                            }
                        }

                    };
                    break;
                case ControlType.OptionList:
                    result = new OptionList
                    {
                        ControlType = ControlType.OptionList,
                        Label = Resource.OptionListLabel,
                        OptionLayoutType = OptionLayoutType.OneColumn,
                        AllowOther = false,
                        OtherValue = string.Empty,
                        OtherOption = new Option { Id = -1, Value = Resource.OtherValue },
                        Options = new List<Option>
                        {
                            new Option{Id = 1, Value = Resource.FirstOption},
                            new Option{Id = 2, Value = Resource.SecondOption},
                            new Option{Id = 3, Value = Resource.ThirdOption}
                        },
                        ValidationRules = new List<ValidationRule>
                        {
                            new ValidationRules.Required
                            {
                                IsRequired = false,
                                ValidationType = ValidationType.Required
                            }
                        }

                    };
                    break;
                default:
                    throw new Exception(Resource.InvalidControlType);
                    break;
            }

            return result;
        }
Пример #52
0
 public void Setup()
 {
     _sut = DropDown.Create("MyDropDown");
 }