Esempio n. 1
0
        protected void Init(string name, eFieldType type)
        {
            this.name = name;
            this.type = type;
            switch (type)
            {
            case eFieldType.Primitive:

                break;

            case eFieldType.Array:
                //arrayInfos = new List<CsvNode>(3);
                arrayInfos = m_listPool.Pop();
                break;

            case eFieldType.Class:
                //classInfos = new Dictionary<string, CsvNode>(3);
                classInfos = m_dictPool.Pop();
                break;

            default:
                Debug.LogError("CsvNode unsupport type:" + type);
                break;
            }
        }
Esempio n. 2
0
 private void Set(string baseName, string name, eFieldType type)
 {
     //Debug.Log("subtitle init:" + baseName + " " + name + " " + type);
     this.baseName = baseName;
     this.name     = name;
     this.type     = type;
 }
        private void GetField(out ulong field, out eFieldType type)
        {
            ulong value = GetVariant();

            field = value >> 3;
            type  = (eFieldType)(value & 7);
        }
Esempio n. 4
0
        private void SetCtrlType()
        {
            if (MySampleControl == null)
            {
                return;
            }
            string     tControl  = ThePropertyBag.PropBagGetValue(MySampleControl.PropertyBag, "ControlType", "=");
            eFieldType tCtrlType = eFieldType.SingleEnded;

            if (!string.IsNullOrEmpty(tControl) && TheCommonUtils.CInt(tControl) == 0 && tControl.Length > 0)
            {
                TheControlType tType = TheNMIEngine.GetControlTypeByType(tControl);
                if (tType != null)
                {
                    ThePropertyBag.PropBagUpdateValue(MySampleControl.PropertyBag, "EngineName", "=", tType.BaseEngineName);
                }
                tCtrlType = eFieldType.UserControl;
            }
            else
            {
                tCtrlType = (eFieldType)TheCommonUtils.CInt(tControl);
            }
            MySampleControl.Type  = tCtrlType;
            MySampleControl.Flags = TheCommonUtils.CInt(ThePropertyBag.PropBagGetValue(MySampleControl.PropertyBag, "Flags", "="));
            MySampleControl.UpdateUXProperties(Guid.Empty);
        }
Esempio n. 5
0
        private void SetCtrlType()
        {
            if (CountBar == null)
            {
                return;
            }
            string     tControl  = ThePropertyBag.PropBagGetValue(CountBar.PropertyBag, "ControlType", "=");
            eFieldType tCtrlType = eFieldType.SingleEnded;

            if (!string.IsNullOrEmpty(tControl) && TheCommonUtils.CInt(tControl) == 0 && tControl.Length > 0)
            {
                TheControlType tType = TheNMIEngine.GetControlTypeByType(tControl);
                if (tType != null)
                {
                    ThePropertyBag.PropBagUpdateValue(CountBar.PropertyBag, "EngineName", "=", tType.BaseEngineName);
                }
                tCtrlType = eFieldType.UserControl;
            }
            else
            {
                tCtrlType = (eFieldType)TheCommonUtils.CInt(tControl);
            }
            CountBar.Type        = tCtrlType;
            CountBar.Flags       = TheCommonUtils.CInt(ThePropertyBag.PropBagGetValue(CountBar.PropertyBag, "Flags", "="));
            CountBar.PropertyBag = new TheNMIBaseControl {
                ParentFld = 1
            };
            CountBar.UpdateUXProperties(Guid.Empty);
            CountBar.RegisterUXEvent(MyBaseThing, eUXEvents.OnClick, "click", (sener, para) => {
                TheThing.SetSafePropertyBool(MyBaseThing, "ClickState", !TheThing.GetSafePropertyBool(MyBaseThing, "ClickState"));
            });
        }
Esempio n. 6
0
        public static CsvNode Pop(string title, eFieldType type)
        {
            CsvNode node = m_pool.Pop();

            node.Init(title, type);
            node.frist = true;
            return(node);
        }
Esempio n. 7
0
        public static TheFieldInfo Add4x2Edit(TT MyBaseThing, TheFormInfo pForm, eFieldType pType, int StartFld, int ParentFld, int flg, string pLabel, string pUpdateName, ThePropertyBag pBag = null)
        {
            NMI.AddSmartControl(MyBaseThing, pForm, eFieldType.TileGroup, StartFld, 0, 0, null, null, new nmiCtrlTileGroup {
                ParentFld = ParentFld, TileWidth = 6
            });
            NMI.AddSmartControl(MyBaseThing, pForm, eFieldType.SmartLabel, StartFld + 1, 0, 0, null, null, new nmiCtrlSmartLabel {
                Style = "width:80%; font-size:20px; text-align:left; padding:20px;", NoTE = true, Text = pLabel, ParentFld = StartFld, TileWidth = 4
            });
            var fld = NMI.AddSmartControl(MyBaseThing, pForm, pType, StartFld + 2, flg, 0, null, pUpdateName, new nmiCtrlNumber {
                ParentFld = StartFld, TileWidth = 2
            });

            if (pBag != null)
            {
                fld.PropertyBag = pBag;
            }
            return(fld);
        }
Esempio n. 8
0
        private void ChangeField(string Name, Object Type, short Size, short Decimal)
        {
            short nFieldSize    = 0;
            short nFieldDecimal = 0;

            // Exit if there is nothing to do
            //if ((Type == missing))
            //{
            //    if ((Size == -1))
            //    {
            //        if (Decimal == -1)
            //        { return; }
            //    }
            //}

            // Do nothing to deleted records
            if (mvarStatus == "D")
            {
                return;
            }

            //Change the FieldName
            if ((Name != null) & mvarFieldName != Name.ToUpper())
            {
                // Set change flag
                mvarStatus    = mvarStatus + "N";
                mvarFieldName = Name.ToUpper();
            }

            if (Type != missing)
            {
                // Set change flag
                mvarStatus = mvarStatus + "T";

                if ((Size == -1))
                {
                    nFieldSize = 10;
                }
                else if (Size == 0)
                {
                    nFieldSize = 10;
                }

                switch ((eFieldType)Type)
                {
                case eFieldType.shpBoolean:
                    nFieldDecimal = 0;
                    nFieldSize    = 1;
                    break;

                case eFieldType.shpDate:
                    nFieldDecimal = 0;
                    nFieldSize    = 8;
                    break;

                case eFieldType.shpDouble:
                    nFieldDecimal = 10;
                    nFieldSize    = 30;
                    break;

                case eFieldType.shpLong:
                    nFieldDecimal = 0;
                    nFieldSize    = 10;
                    break;

                case eFieldType.shpInteger:
                    nFieldDecimal = 0;
                    nFieldSize    = 5;
                    break;

                case eFieldType.shpSingle:
                    nFieldDecimal = 5;
                    nFieldSize    = 20;
                    break;

                case eFieldType.shpText:
                    nFieldDecimal = 0;
                    break;
                }

                if (nFieldSize != mvarFieldSize)
                {
                    mvarStatus    = mvarStatus + "S";
                    mvarFieldSize = nFieldSize;
                }
                mvarFieldType = (eFieldType)Type;
            }

            if ((Size != -1))
            {
                if (Size != mvarFieldSize)
                {
                    mvarStatus   += "S";
                    mvarFieldSize = Size;
                }
            }

            if ((Decimal != -1))
            {
                if (Decimal != mvarFieldDecimal)
                {
                    mvarStatus      += ".";
                    mvarFieldDecimal = Decimal;
                }
            }
            else
            {
                mvarFieldDecimal = nFieldDecimal;
            }
        }
Esempio n. 9
0
 ///<summary>Change the field type, size and decimal placing of a particular field</summary>
 /// <param name="Type">The new Type of field to be created</param>
 /// <param name="Size">The new length of the field</param>
 /// <param name="Decimal">The new number of digits to be stored right of the decimal point</param>
 /// <remarks>You can change the details of any field in the Fields collection using this method.  One thing to be aware of though is that
 /// once you've changed to the details you still have to write them out to the DBF file.  This is done with the <see cref="ArcShapeFile.ShapeFile.ModifyShape">ModifyShape</see>
 /// method.  If you don't do this and start writing out ShapeFile records then you will corrupt your database - so use some common sense here.</remarks>
 public void Modify(eFieldType Type, short Size, short Decimal)
 {
     ChangeField(null, missing, Size, Decimal);
 }
Esempio n. 10
0
 ///<summary>Change the field name, type, size and decimal placing of a particular field</summary>
 /// <param name="Name">The new Field name of the ShapeFile Database record</param>
 /// <param name="Type">The new Type of field to be created</param>
 /// <param name="Size">The new length of the field</param>
 /// <param name="Decimal">The new number of digits to be stored right of the decimal point</param>
 /// <remarks>You can change the details of any field in the Fields collection using this method.  One thing to be aware of though is that
 /// once you've changed to the details you still have to write them out to the DBF file.  This is done with the <see cref="ArcShapeFile.ShapeFile.ModifyShape">ModifyShape</see>
 /// method.  If you don't do this and start writing out ShapeFile records then you will corrupt your database - so use some common sense here.</remarks>
 public void Modify(string Name, eFieldType Type, short Size, short Decimal)
 {
     ChangeField(Name, Type, Size, Decimal);
 }
Esempio n. 11
0
 ///<summary>Change the field name, type and size of a particular field</summary>
 /// <param name="Name">The new Field name of the ShapeFile Database record</param>
 /// <param name="Type">The new Type of field to be created</param>
 /// <param name="Size">The new length of the field</param>
 /// <remarks>You can change the details of any field in the Fields collection using this method.  One thing to be aware of though is that
 /// once you've changed to the details you still have to write them out to the DBF file.  This is done with the <see cref="ArcShapeFile.ShapeFile.ModifyShape">ModifyShape</see>
 /// method.  If you don't do this and start writing out ShapeFile records then you will corrupt your database - so use some common sense here.</remarks>
 public void Modify(string Name, eFieldType Type, short Size)
 {
     ChangeField(Name, Type, Size, -1);
 }
Esempio n. 12
0
    public void GetFieldEffect(eFieldType fieldtype, int cycle, double cycleValue, int condition, double conditionValue)
    {
        for (int i = 0; i < mPlayerSpawnedList.Count; i++)
        {
            if (mPlayerSpawnedList[i].PlayerState == ePlayerState.Battle)
            {
                switch (fieldtype)
                {
                case eFieldType.Normal:
                    break;

                case eFieldType.Fire:

                    mPlayerSpawnedList[i].FieldCycle++;
                    if (mPlayerSpawnedList[i].FieldCycle >= cycle)
                    {
                        mPlayerSpawnedList[i].ATK       *= (100 - cycleValue) / 100;
                        mPlayerSpawnedList[i].FieldCycle = 0;
                        mPlayerSpawnedList[i].FieldCondition++;
                    }
                    if (mPlayerSpawnedList[i].FieldCondition >= condition)
                    {
                        mPlayerSpawnedList[i].GetDamage(mPlayerSpawnedList[i].HPmax * (conditionValue / 100));
                        mPlayerSpawnedList[i].FieldCondition = 0;
                    }

                    break;

                case eFieldType.Ice:
                    if (!mPlayerSpawnedList[i].IsMove)
                    {
                        if (mPlayerSpawnedList[i].FieldCondition >= 3)
                        {
                            mPlayerSpawnedList[i].MoveChange();
                        }

                        mPlayerSpawnedList[i].FieldCondition++;
                    }

                    mPlayerSpawnedList[i].FieldCycle++;
                    if (mPlayerSpawnedList[i].FieldCycle >= cycle)
                    {
                        mPlayerSpawnedList[i].DEF       *= (100 - cycleValue) / 100;
                        mPlayerSpawnedList[i].FieldCycle = 0;
                        mPlayerSpawnedList[i].FieldCondition++;
                    }
                    if (mPlayerSpawnedList[i].FieldCondition >= condition)
                    {
                        mPlayerSpawnedList[i].MoveChange();
                        mPlayerSpawnedList[i].FieldCondition = 0;
                    }

                    break;

                case eFieldType.Poison:

                    mPlayerSpawnedList[i].FieldCycle++;
                    if (mPlayerSpawnedList[i].FieldCycle >= cycle)
                    {
                        mPlayerSpawnedList[i].GetDamage(cycleValue);
                        mPlayerSpawnedList[i].FieldCycle = 0;
                        mPlayerSpawnedList[i].FieldCondition++;
                    }
                    if (mPlayerSpawnedList[i].FieldCondition >= condition)
                    {
                        mPlayerSpawnedList[i].GetDamage(cycleValue * (1 + conditionValue / 100));
                        mPlayerSpawnedList[i].FieldCondition = 0;
                    }

                    break;

                default:
                    Debug.LogError("Wrong Field Type : " + fieldtype);
                    break;
                }
            }
        }
    }
Esempio n. 13
0
 /// <summary>
 /// Creates a new ShapeFile Database field using name, type and size
 /// </summary>
 /// <param name="Name">Field name of the ShapeFile Database record</param>
 /// <param name="Type">Type of field to be created</param>
 /// <param name="Size">The length of the field</param>
 /// <remarks>
 /// Use the Add method to append a field definition into the collection.  To physically write the definition to the DBF file you must use the
 /// <see cref="ArcShapeFile.ShapeFile.WriteFieldDefs">WriteFieldDefs</see> method.  You can aren't limited to adding field definitions to new shapefiles - you can append them to existing ones too.
 /// </remarks>
 public void Add(string Name, eFieldType Type, short Size)
 {
     CreateField(Name, Type, Size, -1);
 }
Esempio n. 14
0
        private void CreateField(string Name, eFieldType Type, short Size, short Decimal)
        {
            //Check existance of Field Name
            if (Name.Length > 10)
            {
                Name = Name.Substring(0, 10);
            }

            foreach (Field testField in List)
            {
                if (testField.Name == Name.ToUpper() & testField.Name != "SHAPE_ID")
                {
                    if (mvarFixFieldDupls == false)
                    {
                        throw new System.ArgumentException("A Field already exists with this name", Name);
                    }
                    else
                    {
                        bool   lvarFoundName = true;
                        int    i             = 0;
                        string newName       = null;
                        while (lvarFoundName == true)
                        {
                            lvarFoundName = false;
                            i++;
                            newName = Name.Substring(0, Name.Length - i.ToString().Length) + i.ToString();
                            foreach (Field nameField in List)
                            {
                                if (nameField.Name == newName)
                                {
                                    break;
                                }
                            }
                        }
                        Name = newName;
                    }
                }
            }
            //create a new object
            Field objNewMember = default(Field);

            objNewMember = new Field();

            //set the properties passed into the method
            objNewMember.Name   = Name.ToUpper();
            objNewMember.Status = "A";
            objNewMember.Type   = Type;
            switch (Type)
            {
            case eFieldType.shpBoolean:
                objNewMember.Decimal = 0;
                objNewMember.Size    = 1;
                break;

            case eFieldType.shpDate:
                objNewMember.Decimal = 0;
                objNewMember.Size    = 8;
                break;

            case eFieldType.shpDouble:
                if (Decimal == -1)
                {
                    objNewMember.Decimal = 10;
                }
                else
                {
                    objNewMember.Decimal = Decimal;
                }
                if (Size == -1)
                {
                    objNewMember.Size = 30;
                }
                else
                {
                    objNewMember.Size = Size;
                }
                break;

            case eFieldType.shpLong:
                objNewMember.Decimal = 0;
                if (Size == -1)
                {
                    objNewMember.Size = 10;
                }
                else
                {
                    objNewMember.Size = Size;
                }
                break;

            case eFieldType.shpInteger:
                objNewMember.Decimal = 0;
                if (Size == -1)
                {
                    objNewMember.Size = 5;
                }
                else
                {
                    objNewMember.Size = Size;
                }
                break;

            case eFieldType.shpFloat:
                if (Decimal == -1)
                {
                    objNewMember.Decimal = 11;
                }
                else
                {
                    objNewMember.Decimal = Decimal;
                }
                if (Size == -1)
                {
                    objNewMember.Size = 19;
                }
                else
                {
                    objNewMember.Size = Size;
                }
                break;

            case eFieldType.shpSingle:
                if (Decimal == -1)
                {
                    objNewMember.Decimal = 5;
                }
                else
                {
                    objNewMember.Decimal = Decimal;
                }
                if (Size == -1)
                {
                    objNewMember.Size = 20;
                }
                else
                {
                    objNewMember.Size = Size;
                }
                break;

            case eFieldType.shpText:
                objNewMember.Decimal = 0;
                if (Size == -1)
                {
                    objNewMember.Size = 10;
                }
                else
                {
                    objNewMember.Size = Size;
                }
                break;

            default:
                if (Decimal == -1)
                {
                    objNewMember.Decimal = 0;
                }
                else
                {
                    objNewMember.Decimal = Decimal;
                }
                if (Size == -1)
                {
                    objNewMember.Size = 10;
                }
                else
                {
                    objNewMember.Size = Size;
                }
                break;
            }
            List.Add(objNewMember);
            objNewMember = null;
        }
Esempio n. 15
0
        private void Init(string title)
        {
            if (string.IsNullOrEmpty(title) || title[0] == CsvConfig.skipFlag)
            {
                skip = true;
                return;
            }
            name     = title;
            baseName = title;
            if (!NeedParse(ref title))
            {
                return;
            }
            //UnityEngine.Debug.Log("title init:" + title);
            string[]         subTitles = title.Split(CsvConfig.classSeparator);
            CsvHeader        header;
            List <CsvHeader> subList = new List <CsvHeader>(subTitles.Length);

            for (int i = 0; i < subTitles.Length; i++)
            {
                string[] itemTitles = subTitles[i].Split(CsvConfig.arraySeparator);
                if (itemTitles.Length > 1)
                {
                    if (i == 0)
                    {
                        type     = eFieldType.Array;
                        baseName = itemTitles[0];
                    }

                    int subindex = 0;
                    //解析数组结构
                    for (int j = 1; j < itemTitles.Length; j++)
                    {
                        if (!int.TryParse(itemTitles[j], out subindex))
                        {
                            Debug.LogError("CsvHeader.Init TryParse error:" + title + " " + itemTitles[j]);
                            continue;
                        }
                        subindex -= 1;
                        header    = Pop();
                        header.Set(itemTitles[0], subTitles[i], eFieldType.Array);
                        header.index = subindex;
                        subList.Add(header);
                    }
                }
                else
                {
                    if (i == 0)
                    {
                        type     = eFieldType.Class;
                        baseName = itemTitles[0];
                    }
                }

                eFieldType subtype = eFieldType.Class;
                if (i == subTitles.Length - 1)
                {
                    subtype = eFieldType.Primitive;
                }
                header = Pop();
                header.Set(itemTitles[0], subTitles[i], subtype);
                subList.Add(header);
            }
            subs = subList.ToArray();
        }
        private void AddField(ulong field, eFieldType type)
        {
            ulong value = (field << 3) | (ulong)type;

            AddVariant(value);
        }
Esempio n. 17
0
 /// <summary>
 /// Creates a new ShapeFile Database field using name and predetermined type
 /// </summary>
 /// <param name="Name">Field name of the ShapeFile Database record</param>
 /// <param name="Type">Type of field to be created</param>
 /// <remarks>
 /// Use the Add method to append a field definition into the collection.  To physically write the definition to the DBF file you must use the
 /// <see cref="ArcShapeFile.ShapeFile.WriteFieldDefs">WriteFieldDefs</see> method.  You can aren't limited to adding field definitions to new shapefiles - you can append them to existing ones too.
 /// </remarks>
 public void Add(string Name, eFieldType Type)
 {
     CreateField(Name, Type, -1, -1);
 }
Esempio n. 18
0
 public AuditDataReportColumn()
 {
     _fieldType   = eFieldType.asset;
     _fieldName   = "";
     _columnLabel = "";
 }
Esempio n. 19
0
 /// <summary>
 /// Creates a new ShapeFile Database field by defining the field in detail
 /// </summary>
 /// <param name="Name">Field name of the ShapeFile Database record</param>
 /// <param name="Type">Type of field to be created</param>
 /// <param name="Size">The length of the field</param>
 /// <param name="Decimal">The number of digits to be stored right of the decimal point</param>
 /// <remarks>
 /// Use the Add method to append a field definition into the collection.  To physically write the definition to the DBF file you must use the
 /// <see cref="ArcShapeFile.ShapeFile.WriteFieldDefs">WriteFieldDefs</see> method.  You can aren't limited to adding field definitions to new shapefiles - you can append them to existing ones too.
 /// </remarks>
 public void Add(string Name, eFieldType Type, short Size, short Decimal)
 {
     CreateField(Name, Type, Size, Decimal);
 }
Esempio n. 20
0
 public AuditDataReportColumn(eFieldType fieldType, string fieldName, string columnLabel)
 {
     _fieldType   = fieldType;
     _fieldName   = fieldName;
     _columnLabel = columnLabel;
 }
Esempio n. 21
0
 ///<summary>Change the field name and type of a particular field</summary>
 /// <param name="Name">The new Field name of the ShapeFile Database record</param>
 /// <param name="Type">The new Type of field to be created</param>
 /// <remarks>You can change the details of any field in the Fields collection using this method.  One thing to be aware of though is that
 /// once you've changed to the details you still have to write them out to the DBF file.  This is done with the <see cref="ArcShapeFile.ShapeFile.ModifyShape">ModifyShape</see>
 /// method.  If you don't do this and start writing out ShapeFile records then you will corrupt your database - so use some common sense here.</remarks>
 public void Modify(string Name, eFieldType Type)
 {
     ChangeField(Name, Type, -1, -1);
 }
Esempio n. 22
0
 public bool HasType(eFieldType type)
 {
     if (_parentQuery.FieldType(this.Number) == type)
     {
         return true;
     }
     else
     {
         return false;
     }
 }