コード例 #1
0
 public DreamValue OnVariableGet(DreamObject dreamObject, string varName, DreamValue value)
 {
     return(varName switch
     {
         "type" => new DreamValue(dreamObject.ObjectDefinition.Type),
         "parent_type" => new DreamValue(_dreamManager.ObjectTree.GetTreeEntry(dreamObject.ObjectDefinition.Type)
                                         .ParentEntry.ObjectDefinition.Type),
         "vars" => new DreamValue(DreamListVars.Create(dreamObject)),
         _ => ParentType?.OnVariableGet(dreamObject, varName, value) ?? value
     });
コード例 #2
0
 public override DreamValue OnVariableGet(DreamObject dreamObject, string variableName, DreamValue variableValue)
 {
     if (variableName == "type")
     {
         return(new DreamValue(dreamObject.ObjectDefinition.Type));
     }
     else if (variableName == "parent_type")
     {
         return(new DreamValue(_dreamManager.ObjectTree.GetTreeEntry(dreamObject.ObjectDefinition.Type).ParentEntry.ObjectDefinition.Type));
     }
     else if (variableName == "vars")
     {
         return(new DreamValue(DreamListVars.Create(dreamObject)));
     }
     else
     {
         return(base.OnVariableGet(dreamObject, variableName, variableValue));
     }
 }