Пример #1
0
 public static void SetCreatedType(ScriptableObject scriptable, created_type_enum new_created_type)
 {
     if (scriptable is IntVariable int_var)
     {
         int_var.created_type = new_created_type;
     }
     else if (scriptable is StringVariable string_var)
     {
         string_var.created_type = new_created_type;
     }
     else if (scriptable is BoolVariable bool_var)
     {
         bool_var.created_type = new_created_type;
     }
     else if (scriptable is FloatVariable float_var)
     {
         float_var.created_type = new_created_type;
     }
     else if (scriptable is SODict sodict)
     {
         sodict.created_type = new_created_type;
     }
     else if (scriptable is SOList solist)
     {
         solist.created_type = new_created_type;
     }
     else
     {
         throw new Exception(scriptable.name + " is not supported type!");
     }
 }
Пример #2
0
    private static MetaData GetMetadataFromSOD(ScriptableObject scriptable)
    {
        string            type_string     = scriptable.GetType().ToString();
        string            scriptable_guid = GetFirstGUIDByScriptable(root_data, scriptable);
        data_changes_enum data_changes    = GetDataChanges(scriptable);
        created_type_enum created_type    = GetCreatedType(scriptable);

        if (scriptable_guid == "")
        {
            // It should not happen under any circumstances, because
            // editor_created stuff is always in root_data / or it goes through CreateCustomSOD
            // code_created stuff goes through CreateSOD
            // and so all data inside SODict is added in root_data before this method

            Debug.LogError(scriptable.name + " scriptable does not exist in root_data!");
        }

        return(new MetaData(scriptable_guid, type_string, data_changes, created_type));
    }
Пример #3
0
 public MetaData(string guid, string type_string, data_changes_enum data_changes, created_type_enum created_type)
 {
     this.guid         = guid;
     this.type_string  = type_string;
     this.data_changes = data_changes;
     this.created_type = created_type;
 }