@rpg-engine/long-bow 0.2.8 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,14 @@
1
1
  import { IQuest } from '@rpg-engine/shared';
2
2
  import React from 'react';
3
- export interface IQuestInfoProps {
4
- onClose?: () => void;
5
- button?: Array<IQuestsButtonProps>;
6
- quests: IQuest[];
7
- }
8
3
  export interface IQuestsButtonProps {
9
4
  disabled: boolean;
10
5
  title: string;
11
- onClick: (QuestId: string, NPCId: string) => void;
6
+ onClick: (questId: string, npcId: string) => void;
7
+ }
8
+ export interface IQuestInfoProps {
9
+ onClose?: () => void;
10
+ buttons?: IQuestsButtonProps[];
11
+ quests: IQuest[];
12
+ onChangeQuest: (currentQuestIndex: number, currentQuestId: string) => void;
12
13
  }
13
14
  export declare const QuestInfo: React.FC<IQuestInfoProps>;
@@ -27075,13 +27075,19 @@ var img$8 = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCA
27075
27075
  var QuestInfo = function QuestInfo(_ref) {
27076
27076
  var quests = _ref.quests,
27077
27077
  onClose = _ref.onClose,
27078
- button = _ref.button;
27078
+ buttons = _ref.buttons,
27079
+ onChangeQuest = _ref.onChangeQuest;
27079
27080
 
27080
27081
  var _useState = React.useState(0),
27081
27082
  currentIndex = _useState[0],
27082
27083
  setCurrentIndex = _useState[1];
27083
27084
 
27084
27085
  var questsLength = quests.length - 1;
27086
+ React.useEffect(function () {
27087
+ if (onChangeQuest) {
27088
+ onChangeQuest(currentIndex, quests[currentIndex]._id);
27089
+ }
27090
+ }, [currentIndex]);
27085
27091
 
27086
27092
  var onLeftClick = function onLeftClick() {
27087
27093
  if (currentIndex === 0) setCurrentIndex(questsLength);else setCurrentIndex(function (index) {
@@ -27115,16 +27121,16 @@ var QuestInfo = function QuestInfo(_ref) {
27115
27121
  }))), React__default.createElement(Content, null, React__default.createElement("p", null, quests[currentIndex].description)), React__default.createElement(QuestColumn, {
27116
27122
  className: "dark-background",
27117
27123
  justifyContent: "flex-end"
27118
- }, button && button.map(function (item, index) {
27124
+ }, buttons && buttons.map(function (button, index) {
27119
27125
  return React__default.createElement(Button, {
27120
27126
  key: index,
27121
27127
  onClick: function onClick() {
27122
- return item.onClick(quests[currentIndex]._id, quests[currentIndex].npcId);
27128
+ return button.onClick(quests[currentIndex]._id, quests[currentIndex].npcId);
27123
27129
  },
27124
- disabled: item.disabled,
27130
+ disabled: button.disabled,
27125
27131
  buttonType: exports.ButtonTypes.RPGUIButton,
27126
27132
  id: "button-" + index
27127
- }, item.title);
27133
+ }, button.title);
27128
27134
  })))) : React__default.createElement(QuestsContainer, null, React__default.createElement(QuestContainer, null, React__default.createElement(TitleContainer$1, {
27129
27135
  className: "drag-handler"
27130
27136
  }, React__default.createElement(Title$1, null, React__default.createElement(Thumbnail, {
@@ -27134,22 +27140,22 @@ var QuestInfo = function QuestInfo(_ref) {
27134
27140
  }))), React__default.createElement(Content, null, React__default.createElement("p", null, quests[0].description)), React__default.createElement(QuestColumn, {
27135
27141
  className: "dark-background",
27136
27142
  justifyContent: "flex-end"
27137
- }, button && button.map(function (item, index) {
27143
+ }, buttons && buttons.map(function (button, index) {
27138
27144
  return React__default.createElement(Button, {
27139
27145
  key: index,
27140
27146
  onClick: function onClick() {
27141
- return item.onClick(quests[0]._id, quests[0].npcId);
27147
+ return button.onClick(quests[0]._id, quests[0].npcId);
27142
27148
  },
27143
- disabled: item.disabled,
27149
+ disabled: button.disabled,
27144
27150
  buttonType: exports.ButtonTypes.RPGUIButton,
27145
27151
  id: "button-" + index
27146
- }, item.title);
27152
+ }, button.title);
27147
27153
  })))));
27148
27154
  };
27149
27155
  var QuestDraggableContainer = /*#__PURE__*/styled(DraggableContainer).withConfig({
27150
27156
  displayName: "QuestInfo__QuestDraggableContainer",
27151
27157
  componentId: "sc-15s2boc-0"
27152
- })(["border:1px solid black;width:600px;height:500px;padding:0 0 0 0 !important;.DraggableContainer__TitleContainer-sc-184mpyl-2{height:auto;}.container-close{position:sticky;margin-left:auto;top:20px;padding-right:5px;}img{display:inline-block;vertical-align:middle;line-height:normal;}"]);
27158
+ })(["border:1px solid black;width:600px;padding:0 0 0 0 !important;.DraggableContainer__TitleContainer-sc-184mpyl-2{height:auto;}.container-close{position:absolute;margin-left:auto;top:20px;padding-right:5px;}img{display:inline-block;vertical-align:middle;line-height:normal;}"]);
27153
27159
  var QuestContainer = /*#__PURE__*/styled.div.withConfig({
27154
27160
  displayName: "QuestInfo__QuestContainer",
27155
27161
  componentId: "sc-15s2boc-1"