public override Task OnActivateAsync() { SlotAreas.Add(new CraftingSlotArea(3, this, GrainFactory)); SlotAreas.Add(new InventorySlotArea(this, GrainFactory)); SlotAreas.Add(new HotbarSlotArea(this, GrainFactory)); return(base.OnActivateAsync()); }
public Task SetEntity(IBlockEntity furnaceEntity) { SlotAreas.Clear(); _properties.Clear(); SlotAreas.Add(new FurnaceSlotArea(furnaceEntity, this, GrainFactory)); SlotAreas.Add(new InventorySlotArea(this, GrainFactory)); SlotAreas.Add(new HotbarSlotArea(this, GrainFactory)); _furnaceEntity = furnaceEntity; return(Task.CompletedTask); }
public Task SetEntities(Immutable <IDependencyObject[]> entities) { SlotAreas.Clear(); foreach (var entity in entities.Value) { SlotAreas.Add(new ChestSlotArea(entity, this, GrainFactory)); } SlotAreas.Add(new InventorySlotArea(this, GrainFactory)); SlotAreas.Add(new HotbarSlotArea(this, GrainFactory)); if (entities.Value.Length < 2) { _title = new Chat("Chest"); } else { _title = new Chat("Large chest"); } return(Task.CompletedTask); }
public FootprintEditorViewModel(GenericRCOLResource rcol) { mRcol = rcol; mFootprint = rcol.ChunkEntries[0].RCOLBlock as FTPT; mFootprintAreas = new ObservableCollection <AreaViewModel>(mFootprint.FootprintAreas.Select(x => new AreaViewModel(this, x))); mSlotAreas = new ObservableCollection <AreaViewModel>(mFootprint.SlotAreas.Select(x => new AreaViewModel(this, x))); AddSlotCommand = new UserCommand <FootprintEditorViewModel>(x => x != null, x => x.AddSlotArea()); CloneSlotCommand = new UserCommand <FootprintEditorViewModel>(x => x != null && x.CheckSlotArea(), x => x.CopySlotArea()); DeleteSlotCommand = new UserCommand <FootprintEditorViewModel>(x => x != null && x.CheckSlotArea(), x => x.DeleteArea()); AddFootprintCommand = new UserCommand <FootprintEditorViewModel>(x => x != null, x => x.AddFootprintArea()); CloneFootprintCommand = new UserCommand <FootprintEditorViewModel>(x => x != null && x.CheckFootprintArea(), x => x.CopyFootprintArea()); DeleteFootprintCommand = new UserCommand <FootprintEditorViewModel>(x => x != null && x.CheckFootprintArea(), x => x.DeleteArea()); CommitCommand = new UserCommand <FootprintEditorViewModel>(x => true, y => { mIsSaving = true; Application.Current.Shutdown(); }); CancelCommand = new UserCommand <FootprintEditorViewModel>(x => true, y => { mIsSaving = false; Application.Current.Shutdown(); }); SetBackgroundImageCommand = new UserCommand <FootprintEditorViewModel>( x => true, y => { var d = new OpenFileDialog { CheckFileExists = true, Multiselect = false }; if (d.ShowDialog() == true) { BackgroundImagePath = d.FileName; } } ); ClearBackgroundImageCommand = new UserCommand <FootprintEditorViewModel>( x => x != null && !String.IsNullOrEmpty(x.BackgroundImagePath), y => y.BackgroundImagePath = null ); SetReferenceMeshCommand = new UserCommand <FootprintEditorViewModel>( x => true, y => { var d = new OpenFileDialog { CheckFileExists = true, Multiselect = false }; if (d.ShowDialog() == true) { ReferenceMesh = d.FileName; } } ); ClearReferenceMeshCommand = new UserCommand <FootprintEditorViewModel>( x => x != null && !String.IsNullOrEmpty(x.ReferenceMesh), y => y.ReferenceMesh = null ); SelectedFootprint = FootprintAreas.FirstOrDefault(); if (SelectedArea == null) { SelectedSlot = SlotAreas.FirstOrDefault(); } }