Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work on the core of Event Commands #156

Merged
merged 9 commits into from Jan 25, 2021
Merged

Work on the core of Event Commands #156

merged 9 commits into from Jan 25, 2021

Conversation

Ghabry
Copy link
Member

@Ghabry Ghabry commented Jan 24, 2021

I implemented a system that allows to implement the simple event commands with the least amount of code via magic (tm).

The event Ui scans for GUI that ends on _argN where (N = parameter, use X for string). All it finds is auto-attached.


I also invented a OperandWidget that provides these three typical use cases:

  • Value or Variable
  • LCF Object or Variable
  • Entire Party, Actor or Variable

_argN also attached here (uses subsequent values because it takes two args, so 2 will use 2 as operand and 3 as value)


Some GUI

Of course I recycle the RpgComboBox, so you profit from type-to-search and a "..." button to open a database window for direct editing.

3-fs8
2-fs8
1-fs8


Some code examples (boilerplate omitted):

Message Options. Unfortunately QtDesigner has no way to assign a button ID, otherwise this could be omitted :(

int i = 0;
for (auto& button : { ui->buttonTypeNormal, ui->buttonTypeTransparent }) {
	ui->groupWindowType_arg0->setId(button, i++);
}

i = 0;
for (auto& button : { ui->buttonPositionTop, ui->buttonPositionMiddle, ui->buttonPositionBottom }) {
	ui->groupWindowPos_arg1->setId(button, i++);
}

Change Item:

int i = 0;
for (auto& button : { ui->radioOpAdd, ui->radioOpRemove }) {
	ui->groupOp_arg0->setId(button, i++);
}

… the GUI element name

Implemented for Input Number and Message Options
…d in many event commands:

- Value or Variable
- LCF Object or Variable
- Entire Party, Actor or Variable

Implement for ChangeItem and FullHeal Event command
Support automatic attaching for OperandWidget, even less code to write
@Ghabry
Copy link
Member Author

Ghabry commented Jan 25, 2021

Here a screenshot to make it more obvious how it works:

4-fs8

Now it is possible to detect value changes, e.g. when decreasing the Level then the "Show LV up" message box is disabled.
…ds for complex commands that alter more than one event command line.

Show Message: Implement showing the text, applying is more difficult because it alters more than one line.
@Ghabry
Copy link
Member Author

Ghabry commented Jan 25, 2021

Merging. The API is working good enough for me.

For more complex cases Event Widgets can also implement the function "apply()" now. This is useful for events that manipulate the event tree: They can rewrite the tree once on apply.

@Ghabry Ghabry merged commit 874555e into EasyRPG:master Jan 25, 2021
@Ghabry Ghabry deleted the dbgui branch January 25, 2021 17:16
@Ghabry Ghabry added this to the 0.1 milestone Mar 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant