//------------------------------------------------------------------------/
 // Methods
 //------------------------------------------------------------------------/
 public StratusValidation Set(IEnumerable <EntryType> entries)
 {
     if (layoutGroup == null)
     {
         string msg = "No layout group has been set";
         this.LogError(msg);
         return(new StratusValidation(false, msg));
     }
     Reset();
     if (_instances == null)
     {
         _instances = new List <ElementType>();
     }
     foreach (EntryType entry in entries)
     {
         ElementType element = Instantiate(prefab, layoutGroup.transform);
         element.Initialize(entry, style);
         element.onSelect += () => OnLayoutElementSelected(element);
         _instances.Add(element);
     }
     navigator = new StratusArrayNavigator <ElementType>(_instances, true);
     if (explicitNavigation)
     {
         SetExplicitNavigation();
     }
     return(true);
 }
        //--------------------------------------------------------------------------------------------/
        // Messages
        //--------------------------------------------------------------------------------------------/
        private void Awake()
        {
            movePersistentInput  = new StratusPersistentInputAction <Vector2>(Move);
            this.cameraTransform = this.camera.transform;
            this.ConfigureCameraPresets();
            this.cameraNavigation = new StratusArrayNavigator <Preset>(this.presets.ToArray(), true);
            this.cameraNavigation.onIndexChanged += this.ChangeCamera;
            this.presetsMap.AddRange((Preset preset) => preset.label, this.presets);

            this.ChangeCamera(this.presets[0]);
        }
        protected override void OnInitialize()
        {
            pages                = canvasGroup.GetComponentsInChildrenNotIncludeSelf <BehaviourType>(true);
            navigator            = new StratusArrayNavigator <BehaviourType>(pages, false);
            navigator.onChanged += this.OnPageChanged;

            foreach (var page in pages)
            {
                TogglePage(page, false);
            }
        }
예제 #4
0
        protected override void OnSet(StratusRuntimeInspectorDrawerSettings settings)
        {
            (string[] values, int index)setup = GetValues(settings.field);
            values                 = new StratusArrayNavigator <string>(setup.values, setup.index, false);
            valueLabel.text        = values.values[setup.index];
            values.onIndexChanged += this.OnValueChanged;

            nextValueButton.onClick.RemoveAllListeners();
            previousValueButton.onClick.RemoveAllListeners();
            nextValueButton.onClick.AddListener(values.NavigateToNext);
            previousValueButton.onClick.AddListener(values.NavigateToPrevious);
        }
예제 #5
0
        public StratusGridNavigationSelectionRange(Vector3Int origin,
                                                   IStratusGridManager grid,
                                                   IEnumerable <Vector3Int> cells,
                                                   Color highlightColor,
                                                   Color navigationColor)

            : base(origin, grid)
        {
            this.cells           = new HashSet <Vector3Int>(cells);
            cellNavigator        = new StratusArrayNavigator <Vector3Int>(cells.ToArray(), true);
            this.highlightColor  = highlightColor;
            this.navigationColor = navigationColor;
        }
        private void GenerateCategories()
        {
            dataCategories = GetDataCategories(prefs.data);
            if (dataCategories == null)
            {
                dataCategories = new StratusLabeledObject[] { new StratusLabeledObject(prefs.dataTypeName, prefs.data) };
            }
            dataCategoryNavigator = new StratusArrayNavigator <StratusLabeledObject>(dataCategories, lastDataCategoryIndex);
            dataCategoryNavigator.onIndexChanged += this.OnDataCategoryChanged;

            List <StratusLayoutTextElementEntry> entries = new List <StratusLayoutTextElementEntry>();

            for (int i = 0; i < dataCategories.Length; i++)
            {
                StratusLabeledObject category = dataCategories[i];
                entries.Add(new StratusLayoutTextElementEntry(category.label, () =>
                {
                    dataCategoryNavigator.NavigateToElement(category);
                }
                                                              ));
            }
            dataCategoryLayout.Set(entries);
        }
예제 #7
0
 private void Start()
 {
     this.checkpointNavigator = StratusPositionCheckpoint.GetNavigator();
     this.checkpointNavigator.onIndexChanged += this.CheckpointNavigator_onIndexChanged;
 }
        //------------------------------------------------------------------------/
        // Static Methods
        //------------------------------------------------------------------------/
        /// <summary>
        /// Returns a navigator, which allows easy navigation between instances of this class
        /// </summary>
        /// <returns></returns>
        public static StratusArrayNavigator <T> GetNavigator(bool loop = true)
        {
            var navigator = new StratusArrayNavigator <T>(instances, loop);

            return(navigator);
        }