示例#1
0
        public void AddContentItem(ContentItem item)
        {
            if (item.ItemConstruct.ItemCode == ConstructConfig.NEW_FILE_DEFAULT_ID_CODE)
            {
                _IDItem = item;

                Name = _IDItem.Value;
            }
            else if (item.ItemConstruct.ItemCode == ConstructConfig.NEW_FILE_DEFAULT_NAME_CODE)
            {
                _NameItem = item;

                //默认的 id的初始化在name之前
                if (_IDItem != null)
                {
                    if (ContentConfig.IsContentIDInvalid(_IDItem.Value))
                    {
                        Name = _IDItem.Value + "." + _NameItem.Value;
                    }
                    else
                    {
                        Name = _IDItem.Value;
                    }
                }
            }
            else if (item.ItemConstruct.ItemCode == ConstructConfig.NEW_FILE_DEFAULT_DESC_CODE)
            {
                _DescItem = item;
            }

            ContentItems.AddNewItem(item);
        }
示例#2
0
        public void AddNewItem(ContentRow contentRow)
        {
            base.AddNewItem(contentRow);

            if (ContentConfig.IsContentIDInvalid(contentRow.ID))
            {
                _ContentFilesDic.Add(contentRow.ID, contentRow);
            }
        }
示例#3
0
        private void InitTableIdType()
        {
            ItemTextValue.Visibility     = System.Windows.Visibility.Collapsed;
            ItemEnmuValue.Visibility     = System.Windows.Visibility.Collapsed;
            ItemIDSingleValue.Visibility = System.Windows.Visibility.Collapsed;
            ItemIDMultiValue.Visibility  = System.Windows.Visibility.Collapsed;
            ItemBoolValue.Visibility     = System.Windows.Visibility.Collapsed;
            ItemVector3Value.Visibility  = System.Windows.Visibility.Collapsed;

            if (_ContentItem.ItemConstruct.ItemType2.Count > 1)
            {
                ItemIDMultiValue.Visibility = System.Windows.Visibility.Visible;

                //foreach (var typeTable in _ContentItem.ItemConstruct.ItemType2)
                //{
                //    //if (contentRow.ID != ContentConfig.CONTENT_INVALID_ID)
                //    {
                //        ItemIDMultiValue1.Items.Add(typeTable.Name);
                //    }
                //}

                //_ContentItem.SplitValue();
                //ItemIDMultiValue1.Text = _ContentItem.GetSplitValue(0);
                //ItemIDMultiValue2.Text = _ContentItem.GetSplitValue(1);
            }
            else if (_ContentItem.ItemConstruct.ItemType2.Count == 1)
            {
                ItemIDSingleValue.Visibility = System.Windows.Visibility.Visible;

                ContentFile contentFile = TableContentManager.Instance.GetFileByName(_ContentItem.ItemConstruct.ItemType2[0].Name);
                if (contentFile == null)
                {
                    return;
                }

                ItemIDSingleValue.Items.Clear();
                foreach (ContentRow contentRow in contentFile.ContentRow)
                {
                    if (ContentConfig.IsContentIDInvalid(contentRow.ID))
                    {
                        ItemIDSingleValue.Items.Add(contentRow);
                    }
                }

                //空选择
                ItemIDSingleValue.Items.Add("None");

                ContentRow selectRow = contentFile.GetRowByID(_ContentItem.Value);
                if (selectRow != null)
                {
                    ItemIDSingleValue.Text = selectRow.DisplayName;
                }
                ItemIDSingleValue.SelectedValuePath = "WriteValue";
                ItemIDSingleValue.DisplayMemberPath = "DisplayName";
            }
        }
示例#4
0
        private void ItemIDMultiValue1_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            if (e.AddedItems.Count == 0)
            {
                return;
            }

            string selectedTable = e.AddedItems[0] as string;

            if (string.IsNullOrEmpty(selectedTable))
            {
                return;
            }

            _TableName = selectedTable;

            ContentFile contentFile = TableContentManager.Instance.GetFileByName(selectedTable);

            if (contentFile != null)
            {
                ItemIDMultiValue2.Items.Clear();
                foreach (ContentRow contentRow in contentFile.ContentRow)
                {
                    if (ContentConfig.IsContentIDInvalid(contentRow.ID))
                    {
                        ItemIDMultiValue2.Items.Add(contentRow.ID);
                    }
                }
            }
            else if (selectedTable == "None")
            {
                _TableName             = "";
                _TableID               = "";
                ItemIDMultiValue1.Text = _TableName;
                ItemIDMultiValue2.Text = _TableID;
                ValidValue();
            }

            //ItemIDMultiValue2.DisplayMemberPath = "DisplayName";
        }