Esempio n. 1
0
        public override void Open(DialogShowMenuSettings settings, Action <int> onSelected)
        {
            activationTarget?.SetActive(true);
            Items      = settings.Items;
            Labels     = new Text[Items.Length];
            OnSelected = onSelected;

            //Clear
            int childCount = menuRoot.childCount;

            for (int i = 0; i < childCount; i++)
            {
                Destroy(menuRoot.GetChild(i).gameObject);
            }

            //Add
            for (int i = 0; i < Items.Length; i++)
            {
                var item = Instantiate(menuItemTemplate, menuRoot);
                item.SetActive(true);
                Labels[i] = item.GetComponent <Text>();
            }

            CursorPosition = 0;
            UpdateLabels();
            openTimer = Time.time;
        }
Esempio n. 2
0
 public void ShowMenu(DialogShowMenuSettings settings, Action <int> onSelected)
 {
     if (CurrentProvider == null)
     {
         throw new NullReferenceException("有効なDialogPlayerがありません。");
     }
     CurrentProvider.ShowMenu(settings, onSelected);
 }
Esempio n. 3
0
        public override void Execute(EventExecutionContext context, CommandExecutionHandle handle)
        {
            var dialog = context.GetModule <DialogModule>();

            if (dialog == default)
            {
                context.RaiseError(new ScriptExecutionException("DialogSessionが登録されていません。"));
                return;
            }

            string[] items    = bifurcations.Select(b => b.Label).ToArray();
            var      settings = new DialogShowMenuSettings(items);

            dialog.ShowMenu(settings, (index) =>
            {
                var script = new EventScript();
                script.WaitForAllCommands = false;
                script.CommandList        = bifurcations[index].CommandList;
                context.InsertInherit(script, handle.Complete);
            });
        }
Esempio n. 4
0
 public abstract void ShowMenu(DialogShowMenuSettings settings, Action <int> onSelected);
Esempio n. 5
0
 public override void ShowMenu(DialogShowMenuSettings settings, Action <int> onSelected)
 {
     menuWindow.Open(settings, onSelected);
 }