Ejemplo n.º 1
0
        public ListItemUi AddDialogOption(Dialog.DialogOption option, bool scrollAllTheWayDown)
        {
            if (!initialized)
            {
                Init();
            }
            ListItemUi li = null;

            switch (option)
            {
            case Dialog.Choice c: AddDialogOption_Choice(c, out li, option); break;

            case Dialog.Text t: AddDialogOption_Text(t, out li, option); break;

            case Dialog.Command cmd: AddDialogOption_Command(cmd, out li, option); break;
            }
            if (li != null)
            {
                Dialog.Text txt = option as Dialog.Text;
                if (txt != null)
                {
                    li.TextAlignment = txt.anchorText;
                }
            }
            if (scrollAllTheWayDown && !goingToScrollAllTheWayDown)
            {
                goingToScrollAllTheWayDown = true;
                // we want scroll all the way down, and can't control when the UI updates enough to realize it can scroll
                Proc.Delay(100, () => {
                    goingToScrollAllTheWayDown = false; scrollRect.verticalNormalizedPosition = 0;
                });
                // 100ms (1/10th of a second) is not bad for UI lag, and should be enough time for the UI to update itself
            }
            return(li);
        }
Ejemplo n.º 2
0
 private void AddDialogOption_Text(Dialog.Text t, out ListItemUi listItem, Dialog.DialogOption option)
 {
     listItem = listUi.AddItem(option, DialogManager.Instance.GetScriptScope().Format(t.text), null, prefab_textUi);
 }