private void refreshListAndSelectId(int newId) { placementMode = PlacementMode.Manage; manageObjectList.Clear(); UIElement selectedItem = null; switch (placementType) { case PlacementType.BlockPlacement: foreach (var item in BlockType.lookup) { var newItem = new BlockListItem(item.Value); if (item.Value.ID == newId) { selectedItem = newItem; } manageObjectList.AddElement(newItem); } break; case PlacementType.AmbientObjectPlacement: foreach (var item in AmbientObjectType.lookup) { var newItem = new AmbientObjectListItem(item.Value); if (item.Value.ID == newId) { selectedItem = newItem; } manageObjectList.AddElement(newItem); } break; case PlacementType.AmbientHitableObjectPlacement: foreach (var item in AmbientHitableObjectType.lookup) { var newItem = new AmbientHitableObjectListItem(item.Value); if (item.Value.ID == newId) { selectedItem = newItem; } manageObjectList.AddElement(newItem); } break; case PlacementType.LivingEntityPlacement: foreach (var item in LivingEntityType.lookup) { var newItem = new LivingEntityListItem(item.Value); if (item.Value.ID == newId) { selectedItem = newItem; } manageObjectList.AddElement(newItem); } break; } manageObjectList.SelectElement(selectedItem); }
private void handleShowInstanceTypeBtnClick() { var selectedObject = inspectView.SelectedGameObjects[0]; placementMode = PlacementMode.Manage; manageObjectList.Clear(); UIElement selectedItem = null; if (selectedObject is AmbientObject) { placementType = PlacementType.AmbientObjectPlacement; var selectedObjectType = ((AmbientObject)selectedObject).GetObjectType(); foreach (var item in AmbientObjectType.lookup) { var newItem = new AmbientObjectListItem(item.Value); if (item.Value == selectedObjectType) { selectedItem = newItem; } manageObjectList.AddElement(newItem); } } else if (selectedObject is AmbientHitableObject) { placementType = PlacementType.AmbientHitableObjectPlacement; var selectedObjectType = ((AmbientHitableObject)selectedObject).GetObjectType(); foreach (var item in AmbientHitableObjectType.lookup) { var newItem = new AmbientHitableObjectListItem(item.Value); if (item.Value == selectedObjectType) { selectedItem = newItem; } manageObjectList.AddElement(newItem); } } else if (selectedObject is LivingEntity) { placementType = PlacementType.LivingEntityPlacement; var selectedObjectType = ((LivingEntity)selectedObject).GetObjectType(); foreach (var item in LivingEntityType.lookup) { var newItem = new LivingEntityListItem(item.Value); if (item.Value == selectedObjectType) { selectedItem = newItem; } manageObjectList.AddElement(newItem); } } manageObjectList.SelectElement(selectedItem); }