private void ShowLevelSelectUI() { ListUIParams uiparams = new ListUIParams(); uiparams.Title = "Select a Level"; List <string> levels = LevelLoader.GetAllLevels(); for (int i = 0; i < levels.Count; i++) { uiparams.Options.Add(levels[i]); } uiparams.Callback = OnLevelSelected; ListUI ui = Instantiate <ListUI>(ListUITemplate); ui.Create(ListTemplateTextOnly, uiparams); Vector3 uiPos = new Vector3(0.0F, 5.0F, -8.0F); Vector3 uiForward = (uiPos - TargetManager.transform.position).normalized; ui.transform.gameObject.SetActive(true); ui.transform.gameObject.transform.position = uiPos; ui.transform.gameObject.transform.forward = uiForward; }
private void AttemptSelectObjectFromClearState(GameObject go) { if (go.tag.StartsWith("TurretSpace")) { SelectedObject = go; UIState = State.TurretSpaceSelected; TurretUIObject = CreateTurretSelectUI(); ShowUIAttachedToObject(go, TurretUIObject.transform.gameObject); } else if (go.tag.StartsWith("TurretInstance")) { SelectedObject = go; UIState = State.TurretSelected; // Need to get the turret instance MapPos pos = GameObjectFactory.WorldVec3ToMapPos(SelectedObject.transform.position); TurretInstance turretInstance = null; foreach (TurretInstance t in TurretManagerInstance.Turrets) { if (t.Position.x == pos.x && t.Position.z == pos.z) { turretInstance = t; break; } } if (null != turretInstance) { TurretUIObject = CreateTurretOptionUI(turretInstance); ShowUIAttachedToObject(go, TurretUIObject.transform.gameObject); } } }
public void LoadListOfThisBoard() { this.Controls.Clear(); listDTOs.Clear(); listUIs.Clear(); //-------load menu bar--------------------- //this.Controls.Add(lbNameProject); //this.Controls.Add(btnInvite); //this.Controls.Add(btnMode); //this.Controls.Add(btnPersonal); //this.Controls.Add(btnStar); this.Controls.Add(pnMenu); //-------load lits--------------------- ListBLL listBLL = new ListBLL(); listDTOs = listBLL.GetAllList(this.idBoard); foreach (ListDTO l in listDTOs) { ListUI lsUI = new ListUI(l.ListId, l.IndexList, l.Title, l.Color, this); listUIs.Add(lsUI); this.Controls.Add(lsUI); } ListUIButtonCreate btnNewList = new ListUIButtonCreate(listDTOs.Count, this.idBoard); this.Controls.Add(btnNewList); }
private ListUI CreateTurretSelectUI() { ListUI go = Instantiate <ListUI>(ListUITemplate); go.Create(ListTemplateWithCoin, TurretSelectUIParams); return(go); }
private void ActivatePartSelection() { if (_activeListView != null) { _activeListView.Deactivate(); } _state = ConfigurationState.SelectItem; _activeListView = AvailableShipParts; _activeListView.Activate(); }
public void addSomeListItem() { ListUI pList = (ListUI)mManager.findControl("domainlist"); for (int i = 0; i < 15; i++) { ListTextElementUI pListElement = new ListTextElementUI(); pList.add(pListElement); } }
private void ActivateShipSlots() { if (_activeListView != null) { _activeListView.Deactivate(); } _state = ConfigurationState.SelectControlSlot; _activeListView = ShipControls; _activeListView.Activate(); }
void Awake() { if (m_instance == null) { m_instance = this; } else if (m_instance != this) { Destroy(gameObject); return; } }
private void ClearCurrentSelectedObject() { // TODO tear down turret space UI ClearHalo(SelectedObject); SelectedObject = null; if (null != TurretUIObject) { ClearUI(TurretUIObject.transform.gameObject); GameObject.Destroy(TurretUIObject.transform.gameObject); TurretUIObject = null; } }
private ListUI CreateTurretOptionUI(TurretInstance selectedTurret) { ListUI go = Instantiate <ListUI>(ListUITemplate); TurretOptionUIParams.Options.Clear(); TurretOptionUIParams.Options.Add("Sell"); TurretOptionUIParams.Prices.Add((selectedTurret.TurretType.Cost / 2).ToString()); TurretOptionUIParams.Context = selectedTurret; go.Create(ListTemplateWithCoin, TurretOptionUIParams); return(go); }
public void ClearAll() { if (null != SelectedObject) { ClearHalo(SelectedObject); SelectedObject = null; } if (null != CursorObject) { ClearHalo(CursorObject); CursorObject = null; } if (null != TurretUIObject) { GameObject.Destroy(TurretUIObject); TurretUIObject = null; } UIState = State.NothingSelected; }
public MainWindow() { InitializeComponent(); Things = new ListCollectionView(m_things); #if DEBUG PresentationTraceSources.DataBindingSource.Switch.Level = SourceLevels.Critical; #endif m_recent_files.Add("One", false); m_recent_files.Add("Two", false); m_recent_files.Add("Three"); m_recent_files.RecentFileSelected += s => Debug.WriteLine(s); ShowColourPicker = Command.Create(this, () => { new ColourPickerUI().Show(); }); ShowChart = Command.Create(this, () => { new ChartUI().Show(); }); ShowDiagram = Command.Create(this, () => { new DiagramUI().Show(); }); ShowDirectionPicker = Command.Create(this, () => { var win = new Window { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner, }; win.Content = new DirectionPicker(); win.ShowDialog(); }); ShowDockContainer = Command.Create(this, () => { new DockContainerUI().Show(); }); ShowJoystick = Command.Create(this, () => { new JoystickUI().Show(); }); ShowMsgBox = Command.Create(this, () => { var msg = "Informative isn't it\nThis is a really really really long message to test the automatic resizing of the dialog window to a desirable aspect ratio. " + "It's intended to be used for displaying error messages that can sometimes be really long. Once I had a message that was so long, it made the message " + "box extend off the screen and you couldn't click the OK button. That was a real pain so that's why I've added this auto aspect ratio fixing thing. " + "Hopefully it'll do the job in all cases and I'll never have to worry about it again...\n Hopefully..."; var dlg = new MsgBox(this, msg, "Massage Box", MsgBox.EButtons.YesNoCancel, MsgBox.EIcon.Exclamation) { ShowAlwaysCheckbox = true }; dlg.ShowDialog(); }); ShowListUI = Command.Create(this, () => { var dlg = new ListUI(this) { Title = "Listing to the Left", Prompt = "Select anything you like", SelectionMode = SelectionMode.Multiple, AllowCancel = false, }; dlg.Items.AddRange(new[] { "One", "Two", "Three", "Phooore, was that you?" }); if (dlg.ShowDialog() == true) { MsgBox.Show(this, $"{string.Join(",", dlg.SelectedItems.Cast<string>())}! Good Choice!", "Result", MsgBox.EButtons.OK); } }); ShowLogUI = Command.Create(this, () => { var log_ui = new LogControl { LogEntryPattern = new Regex(@"^(?<Tag>.*?)\|(?<Level>.*?)\|(?<Timestamp>.*?)\|(?<Message>.*)", RegexOptions.Singleline | RegexOptions.Multiline | RegexOptions.CultureInvariant | RegexOptions.Compiled) }; var dlg = new Window { Title = "Log UI", Content = log_ui, ResizeMode = ResizeMode.CanResizeWithGrip }; dlg.Show(); }); ShowPatternEditor = Command.Create(this, () => { new PatternEditorUI().Show(); }); ShowProgressUI = Command.Create(this, () => { var dlg = new ProgressUI(this, "Test Progress", "Testicles", System.Drawing.SystemIcons.Exclamation.ToBitmapSource(), CancellationToken.None, (u, _, p) => { for (int i = 0, iend = 100; !u.CancelPending && i != iend; ++i) { p(new ProgressUI.UserState { Description = $"Testicle: {i / 10}", FractionComplete = 1.0 * i / iend, ProgressBarText = $"I'm up to {i}/{iend}", }); Thread.Sleep(100); } }) { AllowCancel = true }; // Modal using (dlg) { var res = dlg.ShowDialog(500); if (res == true) { MessageBox.Show("Completed"); } if (res == false) { MessageBox.Show("Cancelled"); } } // Non-modal //dlg.Show(); }); ShowPromptUI = Command.Create(this, () => { var dlg = new PromptUI(this) { Title = "Prompting isn't it...", Prompt = "I'll have what she's having. Really long message\r\nwith new lines in and \r\n other stuff\r\n\r\nEnter a positive number", Value = "Really long value as well, that hopefully wraps around", Units = "kgs", Validate = x => double.TryParse(x, out var v) && v >= 0 ? ValidationResult.ValidResult : new ValidationResult(false, "Enter a positive number"), Image = (BitmapImage)FindResource("pencil"), MultiLine = true, }; if (dlg.ShowDialog() == true) { double.Parse(dlg.Value); } });
protected async Task <(ListContext listContext, List <(FormEditContext editContext, IEnumerable <SectionUI> sections)> sections)> LoadSectionsAsync(ListUI listUI, IListUIResolver uiResolver) { var query = Query.Create(listUI.PageSize, CurrentState.CurrentPage, CurrentState.SearchTerm, CurrentState.ActiveTab); query.CollectionAlias = CurrentState.CollectionAlias; if (listUI.OrderBys != null) { query.SetOrderBys(listUI.OrderBys); } var request = CurrentState.Related != null ? (GetEntitiesRequestModel) new GetEntitiesOfRelationRequestModel { CollectionAlias = CurrentState.CollectionAlias, Query = query, Related = CurrentState.Related, UsageType = CurrentState.UsageType, VariantAlias = CurrentState.VariantAlias } : (GetEntitiesRequestModel) new GetEntitiesOfParentRequestModel { CollectionAlias = CurrentState.CollectionAlias, ParentPath = CurrentState.ParentPath, Query = query, UsageType = CurrentState.UsageType, VariantAlias = CurrentState.VariantAlias }; var listContext = await PresentationService.GetEntitiesAsync <GetEntitiesRequestModel, ListContext>(request); var sections = await listContext.EditContexts.ToListAsync(async editContext => (editContext, await uiResolver.GetSectionsForEditContextAsync(editContext))); if (!query.MoreDataAvailable) { CurrentState.MaxPage = CurrentState.CurrentPage; if (CurrentState.CurrentPage > 1 && sections?.Any() != true) { CurrentState.CurrentPage--; CurrentState.MaxPage = null; return(await LoadSectionsAsync(listUI, uiResolver)); } } if (CurrentState.MaxPage == CurrentState.CurrentPage && query.MoreDataAvailable) { CurrentState.MaxPage = null; } return(listContext, sections); }
public Task <ListUI> GetListAsync(UsageType usageType, string collectionAlias) { var collection = _collectionProvider.GetCollection(collectionAlias); List <Button>?buttons; List <Pane>? panes; int? pageSize; bool? searchBarVisible; ListType listType; if (usageType == UsageType.List || usageType.HasFlag(UsageType.Add)) { var listView = collection.ListView; if (listView == null) { throw new InvalidOperationException($"Failed to get UI configuration from collection {collectionAlias} for action {usageType}"); } panes = listView.Panes; buttons = listView.Buttons; pageSize = listView.PageSize; searchBarVisible = listView.SearchBarVisible; listType = listView.ListType; } else { var listEditor = collection.ListEditor; if (listEditor == null) { throw new InvalidOperationException($"Failed to get UI configuration from collection {collectionAlias} for action {usageType}"); } panes = listEditor.Panes; buttons = listEditor.Buttons; pageSize = listEditor.PageSize; searchBarVisible = listEditor.SearchBarVisible; listType = listEditor.ListType; } // TODO: this thing naively assumes only one fieldset per type var fieldsPerType = new Dictionary <Type, IEnumerable <FieldUI> >(); var sectionsHaveButtons = panes.Any(x => x.Buttons.Any()); panes?.ForEach(pane => { if (!fieldsPerType.ContainsKey(pane.VariantType) && pane.Fields != null) { fieldsPerType.Add(pane.VariantType, pane.Fields.Select(x => x.ToUI())); } }); var list = new ListUI(ButtonCallAsync, ListCallAsync, TabCallAsync) { ListType = listType, SectionsHaveButtons = sectionsHaveButtons, PageSize = pageSize ?? 1000, // TODO: config setting? SearchBarVisible = searchBarVisible ?? true }; if (fieldsPerType.Any()) { list.MaxUniqueFieldsInSingleEntity = fieldsPerType.Max(x => x.Value.Count()); list.UniqueFields = fieldsPerType.SelectMany(x => x.Value).Distinct(new FieldUIEqualityComparer()).ToList(); list.CommonFields = fieldsPerType.GetCommonValues(new FieldUIEqualityComparer()).ToList(); } return(Task.FromResult(list)); async Task <List <ButtonUI>?> ButtonCallAsync(EditContext editContext) { if (buttons == null) { return(null); } return(await GetButtonsAsync(buttons, editContext)); } async Task <List <SectionUI>?> ListCallAsync(EditContext editContext) { var type = editContext.Entity.GetType(); return(await panes .Where(pane => pane.VariantType.IsSameTypeOrDerivedFrom(type)) .ToListAsync(pane => GetSectionUIAsync(pane, editContext))); } async Task <List <TabUI>?> TabCallAsync(EditContext editContext) { var data = await collection.GetDataViewsAsync(editContext); return(data.ToList(x => new TabUI { Id = x.Id, Label = x.Label })); } }