59 lines
1.8 KiB
C++
59 lines
1.8 KiB
C++
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Widgets/SCompoundWidget.h"
|
|
|
|
class SWorldMap;
|
|
class UWorldMapDefinition;
|
|
template <typename T> class SComboBox;
|
|
|
|
/**
|
|
* The World Map tab: the same SWorldMap the game draws, with a strip of controls above it and a click that
|
|
* takes the viewport camera somewhere.
|
|
*
|
|
* The map widget is shared rather than reimplemented, which is the point of it being Slate. What differs here
|
|
* is only what an editor has and a game does not: a choice of which world's map to look at, and a viewport to
|
|
* send somewhere. There are no markers, because markers come from a UWorldMapSubsystem and an editor world
|
|
* has none - that is not a gap, it is that nobody is playing.
|
|
*/
|
|
class SWorldMapPanel : public SCompoundWidget
|
|
{
|
|
public:
|
|
SLATE_BEGIN_ARGS(SWorldMapPanel) {}
|
|
SLATE_END_ARGS()
|
|
|
|
void Construct(const FArguments& InArgs);
|
|
|
|
private:
|
|
/** Every UWorldMapDefinition in the project, by asset registry. Editor-only, which is why it may do this. */
|
|
void FindDefinitions();
|
|
|
|
void SelectDefinition(TWeakObjectPtr<UWorldMapDefinition> Choice);
|
|
void HandleMapClicked(FVector2D WorldCm);
|
|
|
|
TSharedRef<SWidget> MakeToolbar();
|
|
FText DefinitionLabel() const;
|
|
FText LayerLabel() const;
|
|
FText StatusLabel() const;
|
|
|
|
TArray<TWeakObjectPtr<UWorldMapDefinition>> Definitions;
|
|
TWeakObjectPtr<UWorldMapDefinition> Selected;
|
|
|
|
TArray<TSharedPtr<FName>> LayerOptions;
|
|
|
|
TSharedPtr<SWorldMap> Map;
|
|
TSharedPtr<SComboBox<TSharedPtr<FName>>> LayerCombo;
|
|
|
|
/** What the last click did, so a click that could not move a camera says why rather than doing nothing. */
|
|
FText Status;
|
|
};
|
|
|
|
/** Registers and unregisters the tab with the global tab manager. Called by the module. */
|
|
namespace SaltyWorldMapTab
|
|
{
|
|
extern const FName TabId;
|
|
|
|
void Register();
|
|
void Unregister();
|
|
}
|