Esempio n. 1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="type">数据类型</param>
        /// <param name="defValue">默认值</param>
        /// <param name="iRowUI">属性条目UI接口</param>
        /// <param name="isEnum">是否是枚举类型</param>
        /// <param name="mapEnum">枚举单选UI字典</param>
        public DataAttr(DataAttrGroup parent, string type = "int", string defValue = "", IAttrRow iRowUI = null,
			bool isEnum = false, Dictionary<string, ComboBoxItem> mapEnum = null)
        {
            m_parent = parent;
            m_iAttrRowUI = iRowUI;
            m_type = type;
            m_defValue = defValue;
            m_isEnum = isEnum;
            m_mapEnum = mapEnum;
            m_lstWeight = null;
        }
Esempio n. 2
0
        public AttrList(string name = "", DataAttrGroup attrDefGroup = null)
        {
            Dictionary<string, DataAttr> mapAttrDef = null;

            m_attrDefGroup = attrDefGroup;
            if (m_attrDefGroup != null)
            {
                mapAttrDef = m_attrDefGroup.m_mapDataAttr;
            }
            m_name = name;
            this.InitializeComponent();

            if(mapAttrDef != null)
            {
                foreach (KeyValuePair<string, DataAttr> pairAttrDef in mapAttrDef.ToList())
                {
                    if (pairAttrDef.Value.m_isEnum == false)
                    {
                        switch (pairAttrDef.Value.m_type)
                        {
                            case "bool":
                                {
                                    pairAttrDef.Value.m_iAttrRowUI = new RowBool(pairAttrDef.Value, pairAttrDef.Key, "", this);
                                }
                                break;
                            case "weight":
                                {
                                    pairAttrDef.Value.m_iAttrRowUI = new RowWeight(pairAttrDef.Value, pairAttrDef.Key, "", this);
                                }
                                break;
                            default:
                                {
                                    pairAttrDef.Value.m_iAttrRowUI = new RowNormal(pairAttrDef.Value, pairAttrDef.Key, "", this);
                                }
                                break;
                        }
                    }
                    else
                    {
                        pairAttrDef.Value.m_iAttrRowUI = new RowEnum(pairAttrDef.Value, pairAttrDef.Key, "", this);
                    }
                    mx_frame.Children.Add((Grid)pairAttrDef.Value.m_iAttrRowUI);
                }
            }

            string ctrlWord = MainWindow.s_pW.m_strDic.getWordByKey(m_name);

            if (ctrlWord == "")
            {
                ctrlWord = m_name;
            }
            this.Header = ctrlWord;
            mx_title.Content = ctrlWord;
        }