/// <summary>
        ///     Take a variable and update the value of that node
        /// </summary>
        /// <param name="variable"></param>
        /// <param name="sim"></param>
        public async Task <bool> TryOptimizeVariable(IVariable variable, SimSpecs sim)
        {
            if (variable == null)
            {
                throw new ArgumentNullException(nameof(variable));
            }


            if (await variable.TryOptimize(false, sim) || variable.Equation.Expression?.ParsedExpression == null)
            {
                return(true);
            }

            foreach (var childName in variable.Children.Where(x => !Variables.Exists(x)).ToImmutableList())
            {
                if (!ReferenceVariables.ContainsKey(childName))
                {
                    // For Time & Dt
                    continue;
                }

                var childValue = ReferenceVariables[childName].ToString(CultureInfo.InvariantCulture);
                variable.Equation.Replace(childName, childValue);
                variable.Children.Remove(childName);
            }

            variable.Updated = true;
            return(await variable.TryOptimize(true, sim));
        }
Exemple #2
0
 public void Clear()
 {
     Simulation.Clear();
     Results.Clear();
     ReferenceVariables.Clear();
     _isPrepared = false;
 }
Exemple #3
0
    private void Awake()
    {
        rv = transform.GetChild(0).GetComponent <ReferenceVariables>();

        //rv.reqURL = "http://localhost:3000";
        rv.reqURL = "2acef084.ngrok.io";
        //rv.reqURL = "https://solopro.herokuapp.com";

        email = transform.GetComponent <LoadManager>().LoadEmail();

        rv.maLogoutButton.onClick.AddListener(delegate { StartCoroutine(logout(bttnClick: true)); });
    }
Exemple #4
0
    private void Awake()
    {
        rv          = transform.GetChild(0).GetComponent <ReferenceVariables>();
        saveManager = transform.GetComponent <SaveManager>();

        rv.signinPanel.SetActive(true);

        rv.siPasswordInput.contentType = InputField.ContentType.Password;

        rv.siLoginButton.onClick.AddListener(delegate { OnLoginClick(); });

        rv.siSignupPrButton.onClick.AddListener(delegate { OnSignupClick(); });
    }
Exemple #5
0
    private void Awake()
    {
        Initialize();
        rv = transform.GetChild(0).GetComponent <ReferenceVariables>();

        rv.maPlayButton.onClick.AddListener(delegate { OnMainPlayClick(); });

        rv.ntCloseButton.onClick.AddListener(delegate { OnNotifPanelClose(); });

        rv.ntChallengeButton.onClick.AddListener(delegate { OnChallengeClick(); });

        rv.chCloseButton.onClick.AddListener(delegate { OnChallPageClose(); });

        rv.gaAns1.onClick.AddListener(delegate { OnAnswerButtonClick(buttonNum: 1); });
        rv.gaAns2.onClick.AddListener(delegate { OnAnswerButtonClick(buttonNum: 2); });
        rv.gaAns3.onClick.AddListener(delegate { OnAnswerButtonClick(buttonNum: 3); });
        rv.gaAns4.onClick.AddListener(delegate { OnAnswerButtonClick(buttonNum: 4); });
    }
Exemple #6
0
    // Set button, input and other behaviors at the beginning of the application
    private void Awake()
    {
        // Get a reference to the class containing the references to most of the variables
        rv = transform.GetChild(0).GetComponent <ReferenceVariables>();

        rv.suUsernameInput.onEndEdit.AddListener(delegate { ValidateUsername(); });
        rv.suUsernameInput.characterLimit = 15;

        rv.suEmailInput.onEndEdit.AddListener(delegate { ValidateEmail(); });
        rv.suEmailInput.characterLimit = 30;

        rv.suPasswordInput.onEndEdit.AddListener(delegate { ValidatePassword(); CheckPassMatch(); });
        rv.suPasswordInput.characterLimit = 30;
        rv.suPasswordInput.contentType    = InputField.ContentType.Password;

        rv.suPassConfInput.onEndEdit.AddListener(delegate { CheckPassMatch(); });
        rv.suPassConfInput.characterLimit = 30;
        rv.suPassConfInput.contentType    = InputField.ContentType.Password;

        rv.suCrAccountButton.onClick.AddListener(delegate { OnCreateAccountClick(); });

        rv.suSigninPrButton.onClick.AddListener(delegate { OnSigninClick(); });
    }