Ejemplo n.º 1
0
        private void NewSelection(DialogEventListItem selection)
        {
            if (lastSelected && selection.transform != lastSelected)
            {
                lastSelected.Select(false);
            }
            lastSelected = selection;

            selection.Select(true);

            durationInput.text = selection.dialogEvent.duration.ToString();

            toggleL.SetIsOnWithoutNotify(selection.dialogEvent.leftCharacter);

            eventTypeDropdown.SetValueWithoutNotify((int)selection.dialogEvent.type);
            eventTypeDropdown.RefreshShownValue();

            if (selection.dialogEvent.CharacterData)
            {
                int index = characterDropdown.options.FindIndex(
                    x => x.text.Equals(selection.dialogEvent.CharacterData.name));
                characterDropdown.SetValueWithoutNotify(index);
                characterDropdown.RefreshShownValue();
            }

            textInput.text          = selection.dialogEvent.text;
            animTriggerInput.text   = selection.dialogEvent.animationTrigger;
            spriteTriggerInput.text = selection.dialogEvent.spriteTrigger;

            targetXInput.text = selection.dialogEvent.target.x.ToString();
            targetYInput.text = selection.dialogEvent.target.y.ToString();

            ToggleInputs(selection.dialogEvent.type);
        }
Ejemplo n.º 2
0
        private void MoveItem(DialogEventListItem item, int direction)
        {
            List <DialogEvent> events = dialogScript.dialogEvents.ToList();

            int index = events.FindIndex(x => x.Equals(item.dialogEvent));

            events.Swap(index, index + direction);
            dialogScript.dialogEvents = new Queue <DialogEvent>(events);
            DrawList();
        }
Ejemplo n.º 3
0
        private void DrawList()
        {
            for (int i = eventList.childCount; i-- > 0;)
            {
                Destroy(eventList.GetChild(i).gameObject);
            }
            foreach (DialogEvent dialogEvent in dialogScript.dialogEvents)
            {
                DialogEventListItem item = Instantiate(listItem, eventList);
                item.SetText(dialogEvent.type + " Event");
                item.dialogEvent = dialogEvent;

                item.button.onClick.AddListener(delegate { NewSelection(item); });
                item.upButton.onClick.AddListener(delegate { MoveItem(item, -1); });
                item.downButton.onClick.AddListener(delegate { MoveItem(item, 1); });
            }
        }