internal static void GetComponent(BindValue bindValue)
        {
            var types = BindEditorUtility.GetComponentList(bindValue.Source);

            int selectedIndex = 0;

            if (bindValue.ComponentType != null)
            {
                selectedIndex = types.IndexOf(bindValue.ComponentType.Value);
            }

            var index = EditorGUILayout.Popup(
                selectedIndex == -1 ? 0 : selectedIndex,
                types.Select(t => t.FrindlyName()).ToArray());

            if (bindValue.ComponentType == null)
            {
                bindValue.ComponentType = new SType(types[index]);
            }

            if (bindValue.ComponentType.Value != types[index])
            {
                bindValue.ComponentType = new SType(types[index]);
            }
        }
Exemple #2
0
 /// <summary> Get the values from the left side
 /// </summary>
 /// <param name="">facts
 /// </param>
 /// <returns>
 ///
 /// </returns>
 public static BindValue[] getLeftBindValues(Binding[] binds, IFact[] facts)
 {
     BindValue[] vals = new BindValue[binds.Length];
     for (int idx = 0; idx < binds.Length; idx++)
     {
         vals[idx] = new BindValue(facts[binds[idx].LeftRow].getSlotValue(binds[idx].LeftIndex), binds[idx].negated());
     }
     return(vals);
 }
Exemple #3
0
 /// <summary> convienance method for getting the values based on the
 /// bindings
 /// </summary>
 /// <param name="">ft
 /// </param>
 /// <returns>
 ///
 /// </returns>
 public static BindValue[] getRightBindValues(Binding[] binds, IFact ft)
 {
     BindValue[] vals = new BindValue[binds.Length];
     for (int idx = 0; idx < binds.Length; idx++)
     {
         vals[idx] = new BindValue(ft.getSlotValue(binds[idx].RightIndex), binds[idx].negated());
     }
     return(vals);
 }
 internal static List <MemberInfo> NewMembersList(BindValue bindValue)
 {
     return(bindValue
            .FinalType
            .GetMembers(BindingFlags.Instance | BindingFlags.Public)
            .Where(BindEditorUtility.IsValid)
            .OrderBy(m => m.FrindlyName())
            .ToList());
 }
        internal static string GetDescription(this BindValue bindValue)
        {
            if (!bindValue.MemberInfo.Any())
            {
                return("Not Set");
            }

            return(bindValue.MemberInfo
                   .Aggregate(
                       $"{bindValue.Source.name}.{bindValue.ComponentType.Value.FrindlyName()}",
                       (a, m) => $"{a}.{m.ValueName()}"));
        }
Exemple #6
0
 public LinkBindPtr Register(DllFunction function)
 {
     if (this.m_dllNameLookup.TryGetValue($"{function}@{function.Source}", out ulong ptr))
     {
         return(new LinkBindPtr(function.Source, ptr));
     }
     else
     {
         BindValue bv = new BindValue(function.Source, function.ToString());
         this.m_boundMethods.Add(this.m_nextPtr, bv);
         this.m_dllNameLookup.Add($"{function}@{function.Source}", this.m_nextPtr);
         LinkBindPtr nPtr = new LinkBindPtr(function.Source, this.m_nextPtr);
         this.m_nextPtr++;
         return(nPtr);
     }
 }
        private void BindCommandExceute(object o)
        {
            if (_setting.OscAddress == "")
            {
                return;
            }
            _bindValues++;

            var bindValue = new BindValue
            {
                Id         = _bindValues,
                Address    = _setting.OscAddress,
                OscToValue = _setting.OscValue,
                Avg        = _setting.AvgOnSleepTime
            };

            _setting.BindValues.Add(bindValue);

            // reset
            _setting.OscAddress = "";
        }
 private void SetNewTarget(BindValue bindValue)
 {
     _targetBindValue = bindValue;
     _currentValue    = bindValue.Clone();
 }
        public static void Show(BindValue bindValue)
        {
            var bindWindow = GetWindow <BindWindow>();

            bindWindow.SetNewTarget(bindValue);
        }
 internal static void DescriptionGUI(this BindValue bindValue)
 {
     EditorGUILayout.LabelField(bindValue.GetDescription());
 }