Skip to content

feat: UI - Глава 4 - Виджет подтверждения действия + вернула виджеты паузы и hud#346

Open
PosAlina wants to merge 4 commits intodevelopfrom
dev-267-BaseUIWidgetCommon
Open

feat: UI - Глава 4 - Виджет подтверждения действия + вернула виджеты паузы и hud#346
PosAlina wants to merge 4 commits intodevelopfrom
dev-267-BaseUIWidgetCommon

Conversation

@PosAlina
Copy link
Owner

1 часть (UI система): #309
2 часть (Текстовые строки настроек): #327
3 часть (Числовые строки настроек): #336

Главное - здесь заливаю виджет подтверждения действия
(Например, при нажатии "выйти в главное меню" вылезет "уверены ли вы";
Или при нажатии "выйти из настроек" вылезет "хотите ли вы сохранить перед выходом?" и т.п.)

Также возвращаю виджет паузы (логика только у кнопки продолжить) и виджет hud временный который.

Ну и правлю бажины.

Подробнее:

1. G2IConfirmationWidget

TFunction<void()> OnConfirm; - Действие, которое должно выполниться при подтверждении. Заполняется из виджета, который вызывает текущий в зависимости от нужного действия.
TFunction<void()> OnCancel; - Действие, которое должно выполняться при отмене. Аналогично заполняется из вызывающего виджета.

2. G2IUIManager

Заполнение виджета подтверждения.
Вернула открытие HUD.
Добавила функцию закрыть все UI виджеты.

3. G2IPlayerController

Вызов паузы

4. G2IUIDisplayManager

Поправила бажину с закрытием виджетов.

5. TrainingScreen

Всё ещё времянка, то же самое, только по новой системе и в новой папке

6. PauseWidget

Прост перенесла в другую папку

7. Виджеты со строками настроек

Чуть бажину поправила

1. Widget for confirmation after pushing target buttons
1. Add PauseWidget
2. Change showing Pause Widget
Copy link
Collaborator

@Keendaj Keendaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Шизо предложения, и хайпуля по красоте кода


if (!ensure(UIManager))
{
UE_LOG(LogG2I, Warning, TEXT("%s isn't defined in %s"),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это же ошибка, нет? Буквально манагер помер.

{
CharactersDescriptionsSwitcher->SetActiveWidget(EngineerDescription);
}
else
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Здесь просто return и без else можно обойтись, чтобы дополнительной вложенности не было?


void UG2IConfirmationWidget::OnConfirmButtonClicked()
{
if (ensure(OnConfirm))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мб вначале закрывать виджет, а потом уже вызывать конфирм и с отменой также

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Не уверена, стремаюсь

Если бы ссылки на этот виджет нигде не хранилось, то после Remov-а виджета не было бы гарантии, что выполниться эта лямбда-функция. Т.к. Garbage collector удалил бы виджет.

В текущей системе ссылка в DisplayManager-е есть, поэтому действие выполнится. Но мне спокойнее будет, если выполнение действия не будет зависеть от того, как хранятся виджеты, и в любом случае будет выполняться

if (TSet<EG2IWidgetNames> *ActiveWidgetsNamesByType = AllActiveWidgetsNames.Find(WidgetsType))
{
for (const EG2IWidgetNames WidgetName : *ActiveWidgetsNamesByType)
for (auto Iterator = ActiveWidgetsNamesByType->CreateIterator(); Iterator; ++Iterator)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут по-хорошему const auto&, если я правильно помню как разрешается auto

for (auto Iterator = ActiveWidgetsNamesByType->CreateIterator(); Iterator; ++Iterator)
{
CloseWidget(WidgetName);
if (const auto WidgetInfo = AllWidgets.Find(*Iterator))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Аналогично

Widget->RemoveFromParent();
}
}
Iterator.RemoveCurrent();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А, или нет, что за функция RemoveCurrent, мне, честно, лень искать

Copy link
Collaborator

@Keendaj Keendaj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Так и быть попрошу изменения

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: UI - все виджеты, их переключение и их элементы без частной логики в настройках

2 participants