示例#1
0
    public void SaveGobal <T1, T2>(string componentName, string value)
        where T1 : ISave <T2>
    {
        if (string.IsNullOrEmpty(componentName))
        {
            return;
        }
        string ISaveName = typeof(T1).Name;

        GobalData gobalData = GameSaveUtility.GetGobalObjectData(componentName);

        if (null == gobalData)
        {
            gobalData = GameSaveUtility.AddGobalObjectData(componentName);
        }

        if (gobalData.SetValues.CheckEmpty())
        {
            gobalData.SetValues = new Dictionary <string, Dictionary <string, SetValue> >();
        }
        Dictionary <string, SetValue> setValues;

        if (gobalData.SetValues.ContainsKey(componentName))
        {
            setValues = gobalData.SetValues[componentName];
        }
        else
        {
            setValues = new Dictionary <string, SetValue>();
            gobalData.SetValues.Add(componentName, setValues);
        }

        SetValue setValue = new SetValue
        {
            FunOpera = ISaveName,
            Value    = value
        };

        if (setValues.ContainsKey(ISaveName))
        {
            setValues[ISaveName] = setValue;
        }
        else
        {
            setValues.Add(ISaveName, setValue);
        }
    }