示例#1
0
        private void CacheBindingCollections(SerializedProperty property, DrawerCache cache)
        {
            cache.BindingMap = new Dictionary <string, BindingEntry>();
            List <string> optionIds = new List <string>();
            List <string> options   = new List <string>();

            optionIds.Add("None");
            options.Add("None");

            foreach (Juice.BindingEntry current in BindingUtils.GetBindings(cache.BaseComponent.transform, ResolveTarget(property).Type))
            {
                if (current.ViewModelComponent != cache.BaseComponent)
                {
                    string       id    = GenerateBindingId(current.ViewModelComponent, current.PropertyName);
                    BindingEntry entry = new BindingEntry(
                        optionIds.Count,
                        current.ViewModelComponent,
                        current.PropertyName,
                        current.ObservableType,
                        current.GenericArgument,
                        current.NeedsToBeBoxed);
                    cache.BindingMap.Add(id, entry);
                    optionIds.Add(id);
                    options.Add(GenerateOptionString(id, entry));
                }
            }

            cache.CachedOptionIds = optionIds.ToArray();
            cache.CachedOptions   = options.ToArray();
        }