Ejemplo n.º 1
0
    IEnumerator TypeSelect()
    {
        var type = Type.Host;

        using (var ui = new UIStream())
        {
            var selectui = ui.Render <SelectListUi, SelectUIModel>(new SelectUIModel()
            {
                PrefabPath   = PrefabModel.Path.VerticalSelectList,
                ChildUIModel = new SelectItemUIModel()
                {
                    PrefabPath = PrefabModel.Path.VerticalSelectItem,
                }
            }.FromEnum <Type>(menu => type = menu));
            yield return(selectui.WaitForSelect());
        }
        switch (type)
        {
        case Type.Host:
            _statemachine.Next(State.Host);
            break;

        case Type.Client:
            _statemachine.Next(State.Client);
            break;
        }
        yield return(null);
    }
Ejemplo n.º 2
0
    IEnumerator Select()
    {
        Debug.Log("[MenuSequence] Select");
        var turnEnd = false;

        while (!turnEnd)
        {
            MenuType selected = MenuType.Dice;
            using (var ui = new UIStream())
            {
                //プレイヤーの情報を表示
                PlayerManager.Instance.CurrentPlayerModel.Parent = PrefabManager.Instance.Canvas.transform;
                var playerUI = ui.Render <PlayerUIView, PlayerModel>(PlayerManager.Instance.CurrentPlayerModel);


                //入力まち
                yield return(InputManager.Instance.WaitForSelect <MenuType>(
                                 PlayerManager.Instance.CurrentPlayerModel,
                                 select =>
                {
                    selected = select;
                }));
            }
            OnSelectMenu?.Invoke();
            switch (selected)
            {
            case MenuType.Dice:
                yield return(new DiceSequence(seq =>
                {
                    seq.Game = Game;
                    seq.OnUseTurnAction.AddListener(() => turnEnd = true);
                }));

                break;

            case MenuType.Item:
                break;

            case MenuType.Magic:
                break;

            case MenuType.Data:
                break;

            case MenuType.WatchMap:
                break;
            }
        }
        //_nestSequence?.Init();
        _statemachine.Next(State.End);
    }
Ejemplo n.º 3
0
 public override IEnumerator WaitForButton(string text, Vector2 pos = default, Action cb = null)
 {
     pos = pos == null ? Vector2.zero : pos;
     using (var ui = new UIStream())
     {
         var button = ui.Render <ButtonUI, ButtonUIModel>(new ButtonUIModel()
         {
             PrefabPath = PrefabModel.Path.Button,
             Label      = text,
             Position   = pos
         });
         yield return(button.WaitForClick());
     }
     cb?.Invoke();
 }
Ejemplo n.º 4
0
 public override IEnumerator WaitForSelect <T>(Action <T> cb)
 {
     using (var ui = new UIStream())
     {
         var select = ui.Render <SelectListUi, SelectUIModel>(new SelectUIModel()
         {
             PrefabPath   = PrefabModel.Path.VerticalSelectList,
             ChildUIModel = new SelectItemUIModel()
             {
                 PrefabPath = PrefabModel.Path.VerticalSelectItem,
             }
         }.FromEnum <T>(cb));
         yield return(select.WaitForSelect());
     }
 }
Ejemplo n.º 5
0
 public override IEnumerator WaitForSelect(string[] list, Action <int> cb)
 {
     using (var ui = new UIStream())
     {
         var select = ui.Render <SelectListUi, SelectUIModel>(new SelectUIModel()
         {
             Labels       = list,
             Callback     = cb,
             PrefabPath   = PrefabModel.Path.VerticalSelectList,
             ChildUIModel = new SelectItemUIModel()
             {
                 PrefabPath = PrefabModel.Path.VerticalSelectItem,
             }
         });
         yield return(select.WaitForSelect());
     }
 }
Ejemplo n.º 6
0
    IEnumerator Select()
    {
        using (var ui = new UIStream())
        {
            var selectui = ui.Render <SelectListUi, SelectUIModel>(new SelectUIModel()
            {
                PrefabPath   = PrefabModel.Path.VerticalSelectList,
                ChildUIModel = new SelectItemUIModel()
                {
                    PrefabPath = PrefabModel.Path.VerticalSelectItem,
                }
            }.FromEnum <MenuType>(OnSelectMenu.Invoke));
            yield return(selectui.WaitForSelect());
        }

        _statemachine.Next(State.End);
        yield return(null);
    }