Ejemplo n.º 1
0
        /// <summary>
        /// 获取参数值
        /// </summary>
        /// <typeparam name="TData"></typeparam>
        /// <param name="key"></param>
        /// <returns></returns>
        public TData GetData <TData>(string key)
        {
            VariableBase itemBase = null;

            if (m_ParamDic.TryGetValue(key, out itemBase))
            {
                Variable <TData> item = itemBase as Variable <TData>;
                return(item.Value);
            }
            return(default(TData));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 参数值设置
        /// </summary>
        /// <typeparam name="TData">泛型的类型</typeparam>
        /// <param name="key"></param>
        /// <param name="value"></param>
        public void SetData <TData>(string key, TData value)
        {
            VariableBase itemBase = null;

            if (m_ParamDic.TryGetValue(key, out itemBase))
            {
                Debug.Log("修改已有值");
                Variable <TData> item = itemBase as Variable <TData>;
                item.Value      = value;
                m_ParamDic[key] = item;
            }
            else
            {
                //参数原来不存在
                Debug.Log("参数原来不存在 实例化新对象");
                Variable <TData> item = new Variable <TData>();
                item.Value      = value;
                m_ParamDic[key] = item;
            }
        }