Exemple #1
0
        private static bool IsVector3Valid(ConstructItem constructItem, object value, out string errorMsg)
        {
            bool isValid = true;

            errorMsg = "";

            var valueList = ContentItem.GetSplitValue((string)value);

            if (valueList.Count != 3)
            {
                isValid  = false;
                errorMsg = "类型错误";
            }

            foreach (var valueSingle in valueList)
            {
                isValid = IsFloatValid(constructItem, valueSingle, out errorMsg);
                if (!isValid)
                {
                    break;
                }
            }

            return(isValid);
        }
Exemple #2
0
        private void Init()
        {
            if (_ContentItem != null &&
                _ContentItem.ItemConstruct.ItemType1 == TableConstruct.ConstructConfig.CONSTRUCT_ITEM_TYPE_TABLE_ID &&
                _ContentItem.ItemConstruct.ItemType2.Count > 1)
            {
                ItemIDMultiValue1.Items.Clear();
                foreach (var typeTable in _ContentItem.ItemConstruct.ItemType2)
                {
                    //if (contentRow.ID != ContentConfig.CONTENT_INVALID_ID)
                    {
                        ItemIDMultiValue1.Items.Add(typeTable.Name);
                    }
                }

                ItemIDMultiValue1.Items.Add("None");

                var splitValues = ContentItem.GetSplitValue(_ContentItem.Value);
                if (splitValues.Count == 2)
                {
                    _TableName             = splitValues[0];
                    ItemIDMultiValue1.Text = splitValues[0];
                    _TableID = splitValues[1];
                    ItemIDMultiValue2.Text = splitValues[1];
                }

                ValidValue();
            }
        }
Exemple #3
0
        public static bool IsValueTableMulti(ConstructItem constructItem, object value, out string errorMsg)
        {
            errorMsg = "";

            var valueList = ContentItem.GetSplitValue((string)value);

            if (valueList.Count != 2)
            {
                errorMsg = "格式无效";
                return(false);
            }

            if (string.IsNullOrEmpty(valueList[0]) || string.IsNullOrEmpty(valueList[1]))
            {
                errorMsg = "";
                return(true);
            }

            if (constructItem.ItemType2.GetByName(valueList[0]) == null)
            {
                errorMsg = "不支持该表";
                return(false);
            }

            ContentFile contentFile = TableContentManager.Instance.GetFileByName(valueList[0]);

            if (contentFile == null)
            {
                errorMsg = "表格无效";
                return(false);
            }

            ContentRow contentRow = contentFile.ContentRow.GetRowByID(valueList[1]);

            if (contentRow == null)
            {
                errorMsg = "表格ID无效";
                return(false);
            }

            return(true);
        }
Exemple #4
0
        private void Grid_DataContextChanged_1(object sender, DependencyPropertyChangedEventArgs e)
        {
            _ContentItem = null;
            _ContentItem = e.NewValue as ContentItem;
            if (_ContentItem != null &&
                _ContentItem.ItemConstruct.ItemType1 == TableConstruct.ConstructConfig.CONSTRUCT_ITEM_TYPE_BASE &&
                _ContentItem.ItemConstruct.ItemType2[0].Name == TableConstruct.ConstructConfig.ITEM_TYPE_BASE_VECTOR3)
            {
                var splitValues = ContentItem.GetSplitValue(_ContentItem.Value);
                if (splitValues.Count == 3)
                {
                    _VectorX = splitValues[0];
                    _VectorY = splitValues[1];
                    _VectorZ = splitValues[2];

                    VectorX.Text = _VectorX;
                    VectorY.Text = _VectorY;
                    VectorZ.Text = _VectorZ;
                }

                ValidValue();
            }
        }