private void OverrideFinalDecision(BasicResult another)
 {
     if (type2Decision_.ContainsKey(another.GetType()))
     {
         type2Decision_[another.GetType()].BeOverrided(another);
     }
 }
Example #2
0
    public static void Serialize(BasicResult _condition, ref XmlElement result)
    {
        if (result == null || _condition == null)
        {
            return;
        }
        if (result.Name != BasicResult.xmlNodeName)
        {
            return;
        }

        Type cType = _condition.GetType();

        result.SetAttribute("Type", cType.Name);
        FieldInfo[] variables = cType.GetFields(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

        for (int vi = 0; vi < variables.Length; ++vi)
        {
            FieldInfo var = variables[vi];
            if (!Attribute.IsDefined(var, typeof(DtVariable)))
            {
                continue;
            }

            object     value    = var.GetValue(_condition);
            string     valueStr = ParseUtil.SerializeValue(value);
            DtVariable varAtr   = (DtVariable)Attribute.GetCustomAttribute(var, typeof(DtVariable));
            result.SetAttribute(varAtr.xmlAtrName, valueStr);
        }
    }
Example #3
0
    }  // for editor only

    public virtual void BeOverrided(BasicResult another)
    {
        if (this.GetType() != another.GetType())
        {
            throw new UnityException("cannot override different type of result");
        }
    }