コード例 #1
0
    public void SaveComponent <T1, T2>(GameObject gameObject, T2 component, string sceneName)
        where T1 : ISave <T2>
    {
        if (gameObject.CheckEmpty())
        {
            return;
        }
        if (component.CheckEmpty())
        {
            return;
        }

        sceneName = string.IsNullOrEmpty(sceneName) == true?SceneManager.GetActiveScene().name : sceneName;

        string ISaveName = typeof(T1).Name;
        T1     ISave     = (T1)ToolUtility.CreateHelperInstance(ISaveName, assemblyNames);
        string value;

        try
        {
            value = ISave.Save(component);
        }
        catch (Exception ex)
        {
            Debug.LogError(ex);
            return;
        }
        SaveComponent <T1, T2>(gameObject.name, value, sceneName);
    }
コード例 #2
0
    public ISave <T2> CreateISave <T1, T2>()
        where T1 : ISave <T2>
    {
        string ISaveName = typeof(T1).Name;
        T1     ISave     = (T1)ToolUtility.CreateHelperInstance(ISaveName, assemblyNames);

        return(ISave);
    }