コード例 #1
0
        protected void Reload(ScrollDataView.ReloadEventArgs p_args)
        {
            var v_oldArgs = _cachedReloadEventArgs;

            _cachedReloadEventArgs = p_args;

            //Cancel previous reloads
            if (_reloadRoutine != null)
            {
                StopCoroutine(_reloadRoutine);
                _reloadRoutine = null;
            }

            var v_routine = ReloadRoutine(v_oldArgs, p_args);

            //Execure Delayed
            if (m_delayedReload && enabled && gameObject.activeInHierarchy)
            {
                _reloadRoutine = StartCoroutine(v_routine);
            }
            else
            {
                //Execute Synchronously
                while (v_routine.MoveNext())
                {
                }
            }
        }
コード例 #2
0
        protected virtual IEnumerator ReloadRoutine(ScrollDataView.ReloadEventArgs p_oldArgs, ScrollDataView.ReloadEventArgs p_newArgs)
        {
            yield return(null);

            ApplyReload(p_oldArgs, p_newArgs);
            if (OnReload != null)
            {
                OnReload.Invoke();
            }

            _reloadRoutine = null;
        }
コード例 #3
0
        protected override void ApplyReload(ScrollDataView.ReloadEventArgs p_oldArgs, ScrollDataView.ReloadEventArgs p_newArgs)
        {
            var v_data   = p_newArgs.Data as GenericMenuElementData;
            var v_sender = p_newArgs.Sender != null?p_newArgs.Sender.GetComponentInParent <GenericMenuUI>() : null;

            if (v_sender == null && p_newArgs.Sender != null)
            {
                var v_config = p_newArgs.Sender.GetComponentInParent <GenericMenuUIPage>();
                if (v_config != null)
                {
                    v_sender = v_config.Parent;
                }
            }
            if (v_data != null)
            {
                if (m_text != null)
                {
                    m_text.text = v_data.Name;
                }
                if (m_image != null)
                {
                    m_image.sprite = v_data.Icon;
                }
                if (m_toggle != null)
                {
                    var v_index = v_sender != null && v_sender != null?v_sender.IndexOf(v_data) : -1;

                    if (v_data.IsFolder)
                    {
                        var v_item = v_sender != null?v_sender.GetCurrentSelectedItem() : null;

                        m_toggle.isOn = v_item != null && v_item.GetPath().StartsWith(v_data.GetPath());
                    }
                    else
                    {
                        m_toggle.isOn = v_sender != null && v_sender != null && v_index >= 0 && v_sender.SelectedIndex == v_index;
                    }
                }
                if (m_folderIconContainer != null)
                {
                    m_folderIconContainer.gameObject.SetActive(v_data.IsFolder);
                }
            }
        }
コード例 #4
0
 void IReloadableDataViewElement.Reload(ScrollDataView.ReloadEventArgs p_args)
 {
     Reload(p_args);
 }
コード例 #5
0
 /// <summary>
 /// Override this function to implement your own custom logic to reload
 /// </summary>
 protected virtual void ApplyReload(ScrollDataView.ReloadEventArgs p_oldArgs, ScrollDataView.ReloadEventArgs p_newArgs)
 {
 }