Exemple #1
0
        public static void Show <TView, TValue>(string title, TValue current, Action <TValue> changed)
            where TView : ISelectorView
        {
            ISelectorView view = Activator.CreateInstance <TView>();

            Show(title, view, current, changed);
        }
 public void Initialize(ISelectorView view)
 {
     _view = view;
     _selectorInput.Begin += Input_Begin;
     _selectorInput.Moved += Input_Moved;
     _selectorInput.Ended += Input_Ended;
 }
 private void Start()
 {
     CreateUnits();
     _view = Camera.main.GetComponent <ISelectorView>();
     _selector.Initialize(_view);
     _selector.UpdateSelectables(BaseUnit.FirstCreated);
     _selector.OnSelected        += OnSelectorSelected;
     _inputControllable.Begin    += Input_Begin;
     _inputControllable.IsEnabled = true;
 }
Exemple #4
0
        public static void Show <TValue>(string title, ISelectorView view, TValue current, Action <TValue> changed)
        {
            IViewService viewService = Services.Get <IViewService>();

            view.Selector.Value             = current;
            view.Selector.SelectionChanged += () =>
            {
                changed?.Invoke((TValue)view.Selector.Value);
            };

            Task.Run(() =>
            {
                viewService.ShowDrawer(view, title);
            });
        }
Exemple #5
0
        public static void Show <TValue>(string title, ISelectorView view, TValue?current, Action <TValue> changed)
            where TValue : class
        {
            view.Selector.Value             = current;
            view.Selector.SelectionChanged += () =>
            {
                object?v = view.Selector.Value;

                if (v is TValue tval)
                {
                    changed?.Invoke(tval);
                }
            };

            Task.Run(() =>
            {
                ViewService.ShowDrawer(view, title);
            });
        }
 public SelectorController(ISelectorView view)
 {
     _view           = view ?? throw new ArgumentException(nameof(view));
     _dataModelsList = new List <DataModel>();
 }