Example #1
0
        public override void OnEnter()
        {
            if (!MaintainState)
            {
                DefaultFont = Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default);
                GUI         = new DwarfGUI(Game, DefaultFont,
                                           Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default),
                                           Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Small), Input);
                IsInitialized = true;
                Logo          = TextureManager.GetTexture(ContentPaths.Logos.gamelogo);

                ListSelect = new ListSelector(GUI, GUI.RootComponent)
                {
                    Label       = "- Main Menu -",
                    LocalBounds =
                        new Rectangle(Game.GraphicsDevice.Viewport.Width / 2 - 100, Game.GraphicsDevice.Viewport.Height / 2,
                                      150, 150)
                };
                DefaultItems();

                ListSelect.OnItemClicked += ItemClicked;
                Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
                Input  = new InputManager();
            }

            base.OnEnter();
        }
        public override void SetValueFromControl()
        {
            ListSelector ls = (ListSelector)control;

            int[] val = ls.SelectedIndices;
            Value = val;
        }
Example #3
0
 void Awake()
 {
     this.deleteMovePrompt = GameObject.Find("DeleteMovePrompt");
     playText          = GameObject.Find("PlayText");
     character1        = GameObject.Find("Character 1").GetComponent <MovePlayer>();       //Choose the character to use for animating move previews.
     character2        = GameObject.Find("Character 2").GetComponent <MovePlayer>();
     playTextBehaviour = GameObject.Find("Handler").GetComponent <SceneButtonBehaviour>(); //Used to switch scene by pressing Enter.
     listSelector      = GameObject.Find("Handler").GetComponent <ListSelector>();
 }
Example #4
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                ListViewProfile profile;
                if (!String.IsNullOrEmpty(_uid))
                {
                    profile = ListViewProfile.Load(_className, _uid, _placeName);
                }
                else
                {
                    profile = new ListViewProfile();
                }
                //fields
                List <string> fields             = new List <string>();
                ColumnPropertiesCollection coll  = new ColumnPropertiesCollection();
                List <ListItem>            items = ListSelector.GetSelectedItems();
                foreach (ListItem item in items)
                {
                    fields.Add(item.Value);
                    coll.Add(new ColumnProperties(item.Value, "150", String.Empty));
                }
                profile.FieldSet  = fields;
                profile.ColumnsUI = coll;

                string uid = (!String.IsNullOrEmpty(_uid)) ? _uid : Guid.NewGuid().ToString();
                profile.Id = uid;

                profile.Name     = txtTitle.Text;
                profile.ReadOnly = false;

                int currentUserId = Mediachase.Ibn.Data.Services.Security.CurrentUserId;

                if (_isSystem)
                {
                    profile.IsSystem = true;
                    profile.IsPublic = true;
                    ListViewProfile.SaveSystemProfile(_className, _placeName, currentUserId, profile);
                }
                else
                {
                    profile.IsSystem = false;
                    profile.IsPublic = cbIsPublic.Checked;
                    ListViewProfile.SaveCustomProfile(_className, _placeName, currentUserId, profile);
                }
                SaveFilters(uid);

                CommandParameters cp = new CommandParameters(_commandName);
                cp.CommandArguments = new System.Collections.Generic.Dictionary <string, string>();
                cp.AddCommandArgument("ViewUid", uid);
                cp.AddCommandArgument("ClassName", _className);
                cp.AddCommandArgument("PlaceName", _placeName);
                Mediachase.Ibn.Web.UI.WebControls.CommandHandler.RegisterCloseOpenedFrameScript(this.Page, cp.ToString());
            }
        }
        public override void UpdateControlFromValue()
        {
            if (control == null)
            {
                return;
            }
            ListSelector ls = (ListSelector)control;

            ls.SelectedIndices = Value;
        }
 /// <summary>
 /// Resets the current state.
 /// </summary>
 /// <returns>The current instance.</returns>
 public CssSelectorConstructor Reset()
 {
     attrName      = null;
     attrValue     = null;
     attrOp        = String.Empty;
     state         = State.Data;
     combinator    = CssCombinator.Descendent;
     hasCombinator = false;
     temp          = null;
     group         = null;
     complex       = null;
     return(this);
 }
Example #7
0
        public override void OnEnter()
        {
            if (!MaintainState)
            {
                DefaultFont = Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default);
                GUI         = new DwarfGUI(Game, DefaultFont,
                                           Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Default),
                                           Game.Content.Load <SpriteFont>(ContentPaths.Fonts.Small), Input);
                IsInitialized = true;
                Logo          = TextureManager.GetTexture(ContentPaths.Logos.gamelogo);
                GUIComponent mainComponent = new GUIComponent(GUI, GUI.RootComponent)
                {
                    LocalBounds = new Rectangle(0, 0, Logo.Width, Logo.Height + 180)
                };

                AlignLayout layout = new AlignLayout(GUI, GUI.RootComponent)
                {
                    HeightSizeMode = GUIComponent.SizeMode.Fit,
                    WidthSizeMode  = GUIComponent.SizeMode.Fit,
                    Mode           = AlignLayout.PositionMode.Percent
                };

                ListSelect = new ListSelector(GUI, mainComponent)
                {
                    Label       = "- Main Menu -",
                    LocalBounds =
                        new Rectangle(Logo.Width / 2 - 150 / 2, Logo.Height + 20,
                                      150, 150)
                };


                ImagePanel logoPanel = new ImagePanel(GUI, mainComponent, Logo)
                {
                    KeepAspectRatio = true,
                    ConstrainSize   = true,
                    LocalBounds     = new Rectangle(0, 0, Logo.Width, Logo.Height)
                };

                layout.Add(mainComponent, AlignLayout.Alignment.Center, AlignLayout.Alignment.Top, Vector2.Zero);
                DefaultItems();

                ListSelect.OnItemClicked += ItemClicked;
                Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
                Input  = new InputManager();
            }

            base.OnEnter();
        }
Example #8
0
 /// <summary>
 /// Resets the current state.
 /// </summary>
 /// <returns>The current instance.</returns>
 public CssSelectorConstructor Reset()
 {
     attrName  = null;
     attrValue = null;
     attrNs    = null;
     attrOp    = String.Empty;
     state     = State.Data;
     combinators.Clear();
     temp     = null;
     group    = null;
     complex  = null;
     valid    = true;
     IsNested = false;
     ready    = true;
     return(this);
 }
Example #9
0
 public CssSelectorConstructor Reset(IAttributeSelectorFactory attributeSelector, IPseudoClassSelectorFactory pseudoClassSelector, IPseudoElementSelectorFactory pseudoElementSelector)
 {
     _attrName  = null;
     _attrValue = null;
     _attrNs    = null;
     _attrOp    = String.Empty;
     _state     = State.Data;
     _combinators.Clear();
     _temp                  = null;
     _group                 = null;
     _complex               = null;
     _valid                 = true;
     _nested                = false;
     _ready                 = true;
     _attributeSelector     = attributeSelector;
     _pseudoClassSelector   = pseudoClassSelector;
     _pseudoElementSelector = pseudoElementSelector;
     return(this);
 }
Example #10
0
        public static void TrySelect(ListSelector selector, IEnumerable <string> strings)
        {
            if (!strings.Any())
            {
                return;
            }
            int index = -1;

            for (int i = 0; i < selector.Items.Count; i++)
            {
                string x = (string)selector.Items[i];
                if (StringUtils.ContainsAll(x, strings))
                {
                    index = i;
                    break;
                }
            }
            if (index != -1)
            {
                selector.SelectedItems.Add(selector.Items[index]);
            }
        }
        /// <summary>
        /// Inserts a comma.
        /// </summary>
        void InsertOr()
        {
            if (temp != null)
            {
                if (group == null)
                {
                    group = new ListSelector();
                }

                if (complex != null)
                {
                    complex.ConcludeSelector(temp);
                    group.Add(complex);
                    complex = null;
                }
                else
                {
                    group.Add(temp);
                }

                temp = null;
            }
        }
Example #12
0
        void InsertOr()
        {
            if (_temp != null)
            {
                if (_group == null)
                {
                    _group = new ListSelector();
                }

                if (_complex != null)
                {
                    _complex.ConcludeSelector(_temp);
                    _group.Add(_complex);
                    _complex = null;
                }
                else
                {
                    _group.Add(_temp);
                }

                _temp = null;
            }
        }
        public FileListViewModel(IWindowManager windowManager, IEventAggregator events, ISidebarViewModel sidebar = null)
        {
            Events = events;
            var entryHelper = new EntriesHelper <IEntryViewModel>(loadEntriesTask)
            {
                ClearBeforeLoad = false
            };

            ProcessedEntries = new EntriesProcessor <IEntryViewModel>(entryHelper, evm => evm.EntryModel);
            Columns          = new ColumnsHelper(ProcessedEntries,
                                                 (col, direction) =>
                                                 new EntryViewModelComparer(
                                                     col.Comparer != null ? col.Comparer : CurrentDirectory.Profile.GetComparer(col),
                                                     direction)
                                                 );
            Selection  = new ListSelector <IEntryViewModel, IEntryModel>(entryHelper);
            DropHelper = new FileListDropHelper(this);
            DragHelper = new FileListDragHelper(this);

            Selection.SelectionChanged += (o, e) =>
            { events.PublishOnUIThread(new SelectionChangedEvent(this, Selection.SelectedItems)); };

            if (events != null)
            {
                events.Subscribe(this);
            }

            Sidebar = sidebar ?? new SidebarViewModel(events);
            Sidebar.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == "IsVisible")
                {
                    NotifyOfPropertyChange(() => ShowSidebar);
                }
            };
            Commands = new FileListCommandManager(this, windowManager, events, Selection, Sidebar.Commands);
        }
 public ListHandler(RedisObjectManager demgelRedis) : base(demgelRedis)
 {
     _listSelector = new ListSelector();
 }
Example #15
0
        /// <summary>
        /// Called whenever the escape button is pressed. Opens a small menu for saving/loading, etc.
        /// </summary>
        public void OpenPauseMenu()
        {
            if (PausePanel != null && PausePanel.IsVisible) return;

            Paused = true;

            int w = 200;
            int h = 200;

            PausePanel = new Panel(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(GraphicsDevice.Viewport.Width / 2 - w / 2, GraphicsDevice.Viewport.Height / 2 - h / 2, w, h)
            };

            GridLayout pauseLayout = new GridLayout(GUI, PausePanel, 1, 1);

            ListSelector pauseSelector = new ListSelector(GUI, pauseLayout)
            {
                Label = "-Menu-",
                DrawPanel = false,
                Mode = ListItem.SelectionMode.Selector
            };
            pauseLayout.SetComponentPosition(pauseSelector, 0, 0, 1, 1);
            pauseLayout.UpdateSizes();
            pauseSelector.AddItem("Continue");
            pauseSelector.AddItem("Options");
            pauseSelector.AddItem("Save");
            pauseSelector.AddItem("Quit");

            pauseSelector.OnItemClicked += () => pauseSelector_OnItemClicked(pauseSelector);
        }
Example #16
0
        /// <summary>
        /// Called whenever the pause menu is clicked.
        /// </summary>
        /// <param name="selector">The list of things the user could have clicked on.</param>
        void pauseSelector_OnItemClicked(ListSelector selector)
        {
            string selected = selector.SelectedItem.Label;
            switch(selected)
            {
                case "Continue":
                    GUI.RootComponent.RemoveChild(PausePanel);
                    Paused = false;
                    PausePanel.Destroy();
                    PausePanel = null;
                    break;
                case "Options":
                    StateManager.PushState("OptionsState");
                    break;
                case "Save":
                    SaveGame(Overworld.Name + "_" + GameID);
                    break;
                case "Quit":
                    QuitGame();
                    break;

            }
        }
Example #17
0
        public override void OnEnter()
        {
            if (!MaintainState)
            {
                DefaultFont = Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default);
                GUI = new DwarfGUI(Game, DefaultFont,
                    Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default),
                    Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input);
                IsInitialized = true;
                Logo = TextureManager.GetTexture(ContentPaths.Logos.gamelogo);

                ListSelect = new ListSelector(GUI, GUI.RootComponent)
                {
                    Label = "- Main Menu -",
                    LocalBounds =
                        new Rectangle(Game.GraphicsDevice.Viewport.Width/2 - 100, Game.GraphicsDevice.Viewport.Height/2,
                            150, 150)
                };
                DefaultItems();

                ListSelect.OnItemClicked += ItemClicked;
                Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
                Input = new InputManager();
            }

            base.OnEnter();
        }