Skip to content

Commit 3fffb26

Browse files
committed
Update 16.5
1 parent 1cc8f91 commit 3fffb26

File tree

15 files changed

+117
-87
lines changed

15 files changed

+117
-87
lines changed

develnext-bundles/dn-game2d-bundle/src/ide/formats/form/elements/GameBackgroundFormElement.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,5 @@
55

66
<property code="velocityX" name="Скорость (Гориз.)" editor="float" tooltip="Скорость перемещения фона по X" virtual="1" />
77
<property code="velocityY" name="Скорость (Верт.)" editor="float" tooltip="Скорость перемещения фона по Y" virtual="1" />
8-
9-
<property code="flipX" name="Отразить по X" editor="boolean" tooltip="Отразить изображение по оси X" />
10-
<property code="flipY" name="Отразить по Y" editor="boolean" tooltip="Отразить изображение по оси Y" />
118
</properties>
129
</element>

develnext-bundles/dn-game2d-bundle/src/ide/formats/form/tags/GameBackgroundFormElementTag.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,5 @@ public function writeAttributes($node, DomElement $element)
3030

3131
$element->setAttribute('width', $node->width);
3232
$element->setAttribute('height', $node->height);
33-
34-
if ($node->flipX) {
35-
$element->setAttribute('flipX', 'true');
36-
}
37-
38-
if ($node->flipY) {
39-
$element->setAttribute('flipY', 'true');
40-
}
4133
}
4234
}

develnext/launcher/DevelNext.exe

0 Bytes
Binary file not shown.

develnext/src/ide/commands/CreateGameSpriteProjectCommand.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
namespace ide\commands;
33

4+
use develnext\bundle\game2d\Game2DBundle;
45
use Dialog;
56
use Files;
67
use ide\editors\AbstractEditor;
@@ -11,6 +12,7 @@
1112
use ide\forms\InputMessageBoxForm;
1213
use ide\Ide;
1314
use ide\misc\AbstractCommand;
15+
use ide\project\behaviours\BundleProjectBehaviour;
1416
use ide\project\behaviours\GradleProjectBehaviour;
1517
use ide\project\behaviours\GuiFrameworkProjectBehaviour;
1618
use ide\systems\FileSystem;
@@ -70,4 +72,13 @@ public function onExecute($e = null, AbstractEditor $editor = null)
7072
}
7173
}
7274
}
75+
76+
public function onBeforeShow($item, AbstractEditor $editor = null)
77+
{
78+
parent::onBeforeShow($item, $editor);
79+
80+
$bundle = BundleProjectBehaviour::get();
81+
82+
$item->enabled = $bundle && $bundle->hasBundleInAnyEnvironment(Game2DBundle::class);
83+
}
7384
}

develnext/src/ide/editors/FormEditor.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -935,10 +935,10 @@ public function refreshNode(UXNode $node)
935935
$e->consume();
936936
}, __CLASS__);
937937

938-
$node->on('click', function (UXMouseEvent $e) {
938+
$node->on('click', function (UXMouseEvent $e) use ($node) {
939939
if ($e->clickCount >= 2) {
940940
//$this->leftTabPane->selectEventList();
941-
$this->eventListPane->doAddEvent();
941+
$this->eventListPane->showEventMenu(true, $node);
942942
}
943943
}, __CLASS__);
944944
}
@@ -1631,7 +1631,7 @@ protected function makeDesignerDragOverHandler(UXNode $parent = null)
16311631
if ($e->dragboard->string) {
16321632
$data = Json::decode($e->dragboard->string);
16331633

1634-
if ($data['create'] && ($element = $this->format->getFormElement($data['type']))) {
1634+
if ($data['create'] && ($data['prototype'] || $this->format->getFormElement($data['type']))) {
16351635
$e->acceptTransferModes(['MOVE']);
16361636
$e->consume();
16371637
return;
@@ -1698,9 +1698,11 @@ protected function makeDesignerDragDropHandler(UXNode $parent = null)
16981698
if ($e->dragboard->string) {
16991699
$data = Json::decode($e->dragboard->string);
17001700

1701-
if ($data['create'] && ($element = $this->format->getFormElement($data['type']))) {
1701+
if ($data['create']) {
17021702
$parent = $parentElement && $parentElement->isLayout() ? $parent : null;
17031703

1704+
$element = $data['prototype'] ?: $this->format->getFormElement($data['type']);
1705+
17041706
$node = $this->createElement($element, $e->screenX, $e->screenY, $parent);
17051707

17061708
if ($node) {
@@ -1982,9 +1984,14 @@ protected function createElement($element, $screenX, $screenY, $parent = null)
19821984

19831985
$isClone = false;
19841986

1985-
if ($element instanceof ObjectListEditorItem) {
1987+
if ($element instanceof ObjectListEditorItem || is_string($element)) {
19861988
$isClone = true;
1987-
$node = $this->createClone($element->value);
1989+
$node = $this->createClone(is_string($element) ? $element : $element->value);
1990+
1991+
if (!$node) {
1992+
Logger::error("Unable to createElement($element)");
1993+
return null;
1994+
}
19881995

19891996
$size = $node->size;
19901997
} else {
@@ -2369,7 +2376,6 @@ protected function updateProperties($node, array $onlyProperties = [])
23692376
$this->leftPaneUi->update($this->getNodeId($node), $element ? $element->getTarget($node) : $node);
23702377
}
23712378

2372-
23732379
if (!$element && !$factoryId) {
23742380
$this->leftPaneUi->hideBehaviourPane();
23752381
$this->leftPaneUi->hideEventListPane();

develnext/src/ide/editors/WelcomeEditor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function isCloseable()
1717

1818
public function getTitle()
1919
{
20-
return 'Welcome';
20+
return 'Добро пожаловать';
2121
}
2222

2323
public function isAutoClose()

develnext/src/ide/editors/form/IdeEventListPane.php

Lines changed: 58 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ protected function makeContextMenu()
419419
$this->contextMenu->add(new IdeEventListPaneDeleteCommand($this));
420420
}
421421

422-
protected function makeContextMenuForEdit(callable $onAction)
422+
protected function makeContextMenuForEdit(callable $onAction, $withEdit = false)
423423
{
424424
$menu = new UXContextMenu();
425425
$prevKind = null;
@@ -433,13 +433,19 @@ protected function makeContextMenuForEdit(callable $onAction)
433433
$variants = $kind->getParamVariants($this->contextEditor);
434434

435435
if (!$variants) {
436-
$menuItem->on('action', function () use ($type, $onAction) {
437-
$onAction($type, $type['code']);
438-
});
439-
440-
if ($this->manager->findBind($this->targetId, $type['code'])) {
441-
$menuItem->disable = true;
436+
if ($bind = $this->manager->findBind($this->targetId, $type['code'])) {
437+
if ($withEdit) {
438+
$menuItem->style = '-fx-font-weight: bold;';
439+
$menuItem->enabled = true;
440+
} else {
441+
$menuItem->style = '';
442+
$menuItem->enabled = false;
443+
}
442444
}
445+
446+
$menuItem->on('action', function () use ($type, $onAction, $bind) {
447+
$onAction($type, $type['code'], $bind);
448+
});
443449
} else {
444450
$menuItem = new UXMenu($menuItem->text, $menuItem->graphic);
445451
}
@@ -455,7 +461,7 @@ protected function makeContextMenuForEdit(callable $onAction)
455461
}
456462

457463
if ($variants) {
458-
$appendVariants = function ($variants, UXMenu $menuItem) use ($type, &$appendVariants, $onAction) {
464+
$appendVariants = function ($variants, UXMenu $menuItem) use ($type, &$appendVariants, $onAction, $withEdit) {
459465
foreach ($variants as $name => $param) {
460466
if ($param === '-') {
461467
$menuItem->items->add(UXMenuItem::createSeparator());
@@ -482,14 +488,23 @@ protected function makeContextMenuForEdit(callable $onAction)
482488
$item->disable = true;
483489
}
484490

485-
$item->on('action', function () use ($type, $code, $onAction) {
486-
$onAction($type, $code);
487-
});
491+
if ($bind = $this->manager->findBind($this->targetId, $code)) {
492+
if ($withEdit) {
493+
$item->style = '-fx-font-weight: bold;';
494+
$item->enabled = true;
495+
} else {
496+
$item->style = '';
497+
$item->enabled = false;
498+
}
488499

489-
if ($this->manager->findBind($this->targetId, $code)) {
490-
$item->disable = true;
500+
$item->userData = $bind;
491501
}
492502

503+
504+
$item->on('action', function () use ($type, $code, $onAction, $bind) {
505+
$onAction($type, $code, $bind);
506+
});
507+
493508
$menuItem->items->add($item);
494509
}
495510
};
@@ -820,41 +835,51 @@ public function doChangeEvent(UXEvent $event = null)
820835
}
821836
}
822837

823-
public function doAddEvent(UXEvent $event = null)
838+
/**
839+
* @param bool $editable
840+
* @param UXNode|null $target
841+
*/
842+
public function showEventMenu($editable = false, UXNode $target = null)
824843
{
825-
$menu = $this->makeContextMenuForEdit(function (array $type, $code) {
826-
$this->manager->addBind($this->targetId, $code, $type['kind']);
827-
828-
$this->trigger('add', [$code, $type]);
844+
$menu = $this->makeContextMenuForEdit(function (array $type, $code, $bind) {
845+
if ($bind) {
846+
$editor = $this->openEventSource($code);
829847

830-
uiLater(function () use ($code, $type) {
831-
if ($this->codeEditor) {
832-
$this->codeEditor->loadContentToArea(false);
833-
$this->codeEditor->doChange(true);
834-
}
848+
$this->trigger('edit', [$code, $editor ?: $this->getDefaultEventEditor()]);
849+
} else {
850+
$this->manager->addBind($this->targetId, $code, $type['kind']);
835851

836-
$this->manager->load();
852+
uiLater(function () use ($code, $type) {
853+
if ($this->codeEditor) {
854+
$this->codeEditor->loadContentToArea(false);
855+
$this->codeEditor->doChange(true);
856+
}
837857

838-
$this->update($this->targetId);
858+
$this->manager->load();
839859

840-
$this->setSelectedCode($code);
841-
$this->openEventSource($code);
860+
$this->update($this->targetId);
842861

843-
$this->trigger('add', [$code, $type]);
844-
});
845-
});
862+
$this->setSelectedCode($code);
863+
$editor = $this->openEventSource($code);
846864

847-
if ($event) {
848-
/** @var UXButton $target */
849-
$target = $event->sender;
865+
$this->trigger('add', [$code, $editor]);
866+
});
867+
}
868+
}, $editable);
850869

870+
if ($target) {
851871
$offsetX = $target->boundsInParent['width'] / 4;
852872

853873
$menu->showByNode($target, $offsetX, $target->boundsInParent['height']);
854874
} else {
855875
$menu->show($this->ui->form, Mouse::x(), Mouse::y());
856876
}
857877
}
878+
879+
public function doAddEvent(UXEvent $event = null)
880+
{
881+
$this->showEventMenu(false, $event ? $event->sender : null);
882+
}
858883
}
859884

860885
// ---------------------------------------------------------------------------------------------------------------------

develnext/src/ide/editors/form/IdeTabPane.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public function makeUi()
359359
$ui = new UXTabPane();
360360
UXAnchorPane::setAnchor($ui, 0);
361361

362-
$ui->tabs->addAll($this->tabs);
362+
$ui->tabs->setAll($this->tabs);
363363

364364
$box = new UXVBox();
365365
$box->spacing = 2;

develnext/src/ide/formats/form/context/PasteMenuCommand.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ public function onExecute($e = null, AbstractEditor $editor = null)
174174
}
175175
}
176176

177-
$type->refreshNode($uiNode, $editor->getDesigner());
178-
179177
if ($behaviours && !$factoryId) {
180178
BehaviourLoader::loadOne($oldId, $behaviours, $editor->getBehaviourManager(), $id);
181179
}
180+
181+
$editor->refreshNode($uiNode);
182182
}
183183
};
184184

develnext/src/ide/forms/InputMessageBoxForm.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function doSave()
7878
}
7979

8080
/**
81+
* @event close
8182
* @event cancelButton.action
8283
*/
8384
public function doCancel()

0 commit comments

Comments
 (0)