示例#1
0
        private bool HasListenerFor(Interpolator interpolator)
        {
            int persistentEventCount = innerEvent.GetPersistentEventCount();

            for (int i = 0; i < persistentEventCount; i++)
            {
                if (innerEvent.GetPersistentTarget(i) == interpolator)
                {
                    return(true);
                }
            }

            return(false);
        }
        public override string GetSummary()
        {
            if (!string.IsNullOrEmpty(description))
            {
                return(description);
            }

            string summary = invokeType.ToString() + " ";

            switch (invokeType)
            {
            default:
            case InvokeType.Static:
                summary += staticEvent.GetPersistentEventCount();
                break;

            case InvokeType.DynamicBoolean:
                summary += booleanEvent.GetPersistentEventCount();
                break;

            case InvokeType.DynamicInteger:
                summary += integerEvent.GetPersistentEventCount();
                break;

            case InvokeType.DynamicFloat:
                summary += floatEvent.GetPersistentEventCount();
                break;

            case InvokeType.DynamicString:
                summary += stringEvent.GetPersistentEventCount();
                break;
            }

            return(summary + " methods");
        }
    public void OnEventRaised(GameEvent ge)
    {
        if (ge is BasicGameEvent && basicResponse.GetPersistentEventCount() >= 1)
        {
            basicResponse.Invoke();
        }

        if (ge is FloatGameEvent && floatResponse.GetPersistentEventCount() >= 1)
        {
            floatResponse.Invoke(((FloatGameEvent)ge).SentFloat);
        }

        if (ge is StatsGameEvent && statsResponse.GetPersistentEventCount() >= 1)
        {
            statsResponse.Invoke(((StatsGameEvent)ge).SentStats, ((StatsGameEvent)ge).SentFloat);
        }
    }
示例#4
0
        protected virtual void Start()
        {
            // Get references to all KnobListeners that this knob will call to update
            knobListeners = GetComponents <KnobListener>();
            if (knobListeners.Length < 1 && Action.GetPersistentEventCount() < 1)
            {
                Debug.LogWarning(name + " has no attached listeners, and no assigned actions, meaning this knob will have no effect", this);
            }

            // get the handle of the knob
            handle = transform.Find("handle");
            if (handle == null)
            {
                Debug.LogException(new MissingComponentException("Knob needs to have a child called \"handle\""), this);
                return;
            }
            baseScale = handle.localScale;
        }
示例#5
0
 public override void Apply()
 {
     MidiDriver.KnobDelegate action = (MidiChannel ch, int knob, float val) =>
     {
         if ((ch == channel || channel == MidiChannel.All) && knob == knobNumber)
         {
             onKnob.Invoke(val);
         }
     };
     info = new MidiCcEventInfo()
     {
         knobName   = knobName,
         channel    = channel,
         knobNumber = knobNumber,
         methods    = Enumerable.Range(0, onKnob.GetPersistentEventCount())
                      .Select(idx => onKnob.GetPersistentTarget(idx).ToString() + "." + onKnob.GetPersistentMethodName(idx))
                      .ToArray()
     };
     MidiController.AddCcAction(action, info);
 }
 protected override bool InvokeParsedValueChange(string input)
 {
     OnValueChanged?.Invoke(float.Parse(input));
     return(OnValueChanged.GetPersistentEventCount() > 0);
 }