Ejemplo n.º 1
0
 public override void UpdateVal(egVar var)
 {
     if (var.GetType() == typeof(egBool))
     {
         updated = true;
         egBool b = (egBool)var;
         _Value = b;
     }
     else
     {
         Console.WriteLine("Type: " + var.GetType() + " not supported by egBool");
     }
 }
Ejemplo n.º 2
0
 public override void UpdateVal(egVar var)
 {
     if (var.GetType() == typeof(egFloat))
     {
         updated = true;
         egFloat s = (egFloat)var;
         _Value = s;
     }
     else
     {
         Console.WriteLine("Type: " + var.GetType() + " not supported by egString");
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// This method will update all the variables bind to the Alias string with the current newValue
        /// </summary>
        /// <param name="newValue"></param>
        /// <param name="Alias"></param>
        private void UpdateVariables(egVar newValue, string Alias)
        {
            // errorVariableList will collect all the wrong binds and delete them
            List <egVar> errorVariableList = new List <egVar>();

            // foreach element in the dicitonary with the Alias key we will update the variables
            if (varDictionary.ContainsKey(Alias))
            {
                List <egVar> egList = varDictionary[Alias];
                foreach (egVar var in egList)
                {
                    // if the type is correct we will update the variable
                    // there is another control on the type inside the UpdateVal method in the egVar sons
                    if (true)                    //newValue.GetType() == var.GetType())
                    {
                        var.UpdateVal(newValue);
                    }
                    else
                    {
                        //if the type is not correct we will add the variables to the errorVariableList and send a message to the console
                        Debug.Log("Attempting to update a " + var.GetType() + " with a " + newValue.GetType() + " variable. Check the variable type. This registration will be deleted.");
                        errorVariableList.Add(var);
                    }
                }
            }
            // at the end of the routine we will delete all the variables on the errorVariableList will be unbinded
            FixErrorList(errorVariableList, Alias);
        }