Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KACWrapper: Exception for getRemaining in the VAB #219

Open
yalov opened this issue Jan 19, 2019 · 0 comments
Open

KACWrapper: Exception for getRemaining in the VAB #219

yalov opened this issue Jan 19, 2019 · 0 comments

Comments

@yalov
Copy link

yalov commented Jan 19, 2019

I believe this cast to double in the KACWrapper

public Double Remaining { get { return (Double)RemainingField.GetValue(actualAlarm); } }

throw

[EXC 01:04:08.717] InvalidCastException: Cannot cast from source type to destination type.
	SKA_KACWrapper.KACWrapper+KACAPI+KACAlarm.get_Remaining ()
	SKA.SKA.IsAlarmFinished (System.String id)
	SKA.SKA+<>c.<.ctor>b__13_0 ()
	UnityEngine.Events.InvokableCall.Invoke ()
	UnityEngine.Events.UnityEvent.Invoke ()
	UnityEngine.UI.Button.Press ()
	UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData)
	UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor)
	UnityEngine.EventSystems.EventSystem:Update()

in the VAB.

my code:

private static bool IsAlarmFinished(string id)
{
    if (KACWrapper.APIReady)
    {
        foreach (var alarm in KACWrapper.KAC.Alarms)
        {
            if (alarm.ID == id)
            {
                Log("L1");
                if (alarm.Remaining < 0.0)
                {
                    Log("L2a");
                    return true;
                }
                else
                {
                    Log("L2b");
                    return false;
                }
                //...

L1 is showed up, but either L2 aren't

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant