예제 #1
0
        public PaintStyle(FieldList source, Enum sourceID)
            : this()
        {
            if ((source != null) && (sourceID != null))
            {
                PaletteEntryType pst = (PaletteEntryType)(source[sourceID].AsByte() ?? (byte)PaletteEntryType.Inherited);

                switch (pst)
                {
                case PaletteEntryType.Inherited:
                default:
                    StyleType = PaletteEntryType.Inherited;
                    break;

                case PaletteEntryType.DoNotPaint:
                    StyleType = PaletteEntryType.DoNotPaint;
                    break;

                case PaletteEntryType.Colour:
                {
                    StyleType = PaletteEntryType.Colour;

                    Int32Field field = source.GetNextItemAfter <Int32Field>(sourceID, DefAgentFieldID.PaintStyleData);

                    if (field != null)
                    {
                        Data = field.Data;
                    }

                    break;
                }

                case PaletteEntryType.PaletteReference:
                {
                    StyleType = PaletteEntryType.PaletteReference;

                    Int32Field field = source.GetNextItemAfter <Int32Field>(sourceID, DefAgentFieldID.PaintStyleData);

                    if (field != null)
                    {
                        Data = field.Data;
                    }

                    break;
                }
                }
            }
        }