Add item scope sequences for expressions and menueventhandlerset

This commit is contained in:
Jan 2021-11-14 20:05:06 +01:00
parent 9a2e74d083
commit ed329e6453
2 changed files with 166 additions and 0 deletions

View File

@ -4,12 +4,24 @@
#include <string>
#include "CommonMenuTypes.h"
#include "EventHandler/CommonEventHandlerSet.h"
#include "Expression/ICommonExpression.h"
namespace menu
{
class CommonItemDef
{
public:
class ColorExpressions
{
public:
std::unique_ptr<ICommonExpression> m_r_exp;
std::unique_ptr<ICommonExpression> m_g_exp;
std::unique_ptr<ICommonExpression> m_b_exp;
std::unique_ptr<ICommonExpression> m_a_exp;
std::unique_ptr<ICommonExpression> m_rgb_exp;
};
std::string m_name;
std::string m_text;
bool m_text_save_game;
@ -51,5 +63,25 @@ namespace menu
int m_fx_letter_time;
int m_fx_decay_start_time;
int m_fx_decay_duration;
std::unique_ptr<ICommonExpression> m_visible_expression;
std::unique_ptr<ICommonExpression> m_disabled_expression;
std::unique_ptr<ICommonExpression> m_text_expression;
std::unique_ptr<ICommonExpression> m_material_expression;
std::unique_ptr<ICommonExpression> m_rect_x_exp;
std::unique_ptr<ICommonExpression> m_rect_y_exp;
std::unique_ptr<ICommonExpression> m_rect_w_exp;
std::unique_ptr<ICommonExpression> m_rect_h_exp;
ColorExpressions m_forecolor_expressions;
ColorExpressions m_glowcolor_expressions;
ColorExpressions m_backcolor_expressions;
std::unique_ptr<CommonEventHandlerSet> m_on_focus;
std::unique_ptr<CommonEventHandlerSet> m_on_leave_focus;
std::unique_ptr<CommonEventHandlerSet> m_on_mouse_enter;
std::unique_ptr<CommonEventHandlerSet> m_on_mouse_exit;
std::unique_ptr<CommonEventHandlerSet> m_on_mouse_enter_text;
std::unique_ptr<CommonEventHandlerSet> m_on_mouse_exit_text;
std::unique_ptr<CommonEventHandlerSet> m_on_action;
std::unique_ptr<CommonEventHandlerSet> m_on_accept;
};
}

View File

@ -4,9 +4,11 @@
#include <string>
#include "Generic/GenericColorPropertySequence.h"
#include "Generic/GenericExpressionPropertySequence.h"
#include "Generic/GenericFloatingPointPropertySequence.h"
#include "Generic/GenericIntPropertySequence.h"
#include "Generic/GenericKeywordPropertySequence.h"
#include "Generic/GenericMenuEventHandlerSetPropertySequence.h"
#include "Generic/GenericStringPropertySequence.h"
#include "Parsing/Menu/Matcher/MenuMatcherFactory.h"
@ -321,4 +323,136 @@ void ItemScopeSequences::AddSequences(FeatureLevel featureLevel)
state->m_current_item->m_game_message_window_mode = value;
}));
AddSequence(std::make_unique<SequenceDecodeEffect>());
AddSequence(GenericExpressionPropertySequence::WithKeywordAndBool("visible", [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_visible_expression = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywordAndBool("disabled", [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_disabled_expression = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "disabled"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_disabled_expression = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "text"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_text_expression = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "material"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_material_expression = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "material"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_material_expression = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "X"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_rect_x_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "Y"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_rect_y_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "W"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_rect_w_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "rect", "H"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_rect_h_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "R"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_forecolor_expressions.m_r_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "G"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_forecolor_expressions.m_g_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "B"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_forecolor_expressions.m_b_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "A"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_forecolor_expressions.m_a_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "forecolor", "RGB"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_forecolor_expressions.m_rgb_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "R"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_glowcolor_expressions.m_r_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "G"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_glowcolor_expressions.m_g_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "B"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_glowcolor_expressions.m_b_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "A"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_glowcolor_expressions.m_a_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "glowcolor", "RGB"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_glowcolor_expressions.m_rgb_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "R"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_backcolor_expressions.m_r_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "G"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_backcolor_expressions.m_g_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "B"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_backcolor_expressions.m_b_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "A"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_backcolor_expressions.m_a_exp = std::move(value);
}));
AddSequence(GenericExpressionPropertySequence::WithKeywords({"exp", "backcolor", "RGB"}, [](const MenuFileParserState* state, std::unique_ptr<ICommonExpression> value)
{
state->m_current_item->m_backcolor_expressions.m_rgb_exp = std::move(value);
}));
AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("onFocus", [](const MenuFileParserState* state, std::unique_ptr<CommonEventHandlerSet> value)
{
state->m_current_item->m_on_focus = std::move(value);
}));
AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("leaveFocus", [](const MenuFileParserState* state, std::unique_ptr<CommonEventHandlerSet> value)
{
state->m_current_item->m_on_leave_focus = std::move(value);
}));
AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("mouseEnter", [](const MenuFileParserState* state, std::unique_ptr<CommonEventHandlerSet> value)
{
state->m_current_item->m_on_mouse_enter = std::move(value);
}));
AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("mouseExit", [](const MenuFileParserState* state, std::unique_ptr<CommonEventHandlerSet> value)
{
state->m_current_item->m_on_mouse_exit = std::move(value);
}));
AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("mouseEnterText", [](const MenuFileParserState* state, std::unique_ptr<CommonEventHandlerSet> value)
{
state->m_current_item->m_on_mouse_enter_text = std::move(value);
}));
AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("mouseExitText", [](const MenuFileParserState* state, std::unique_ptr<CommonEventHandlerSet> value)
{
state->m_current_item->m_on_mouse_exit_text = std::move(value);
}));
AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("action", [](const MenuFileParserState* state, std::unique_ptr<CommonEventHandlerSet> value)
{
state->m_current_item->m_on_action = std::move(value);
}));
AddSequence(std::make_unique<GenericMenuEventHandlerSetPropertySequence>("accept", [](const MenuFileParserState* state, std::unique_ptr<CommonEventHandlerSet> value)
{
state->m_current_item->m_on_accept = std::move(value);
}));
}