Exemple #1
0
        public static string StringFromType(eColorType i_ColorType)
        {
            string result;

            switch (i_ColorType)
            {
            case eColorType.Black:
                result = "Black";
                break;

            case eColorType.Green:
                result = "Green";
                break;

            case eColorType.Red:
                result = "Red";
                break;

            case eColorType.Silver:
                result = "Silver";
                break;

            default:
                throw new ArgumentException("Unknown color");
            }

            return(result);
        }
        protected Color GetColorOfType(eColorType colorType)
        {
            switch (colorType)
            {
            case eColorType.RED:
                return(new Color(0.78f, 0.08f, 0.08f));

            case eColorType.ORANGE:
                return(new Color(0.9686275f, 0.5960785f, 0.3843138f));

            case eColorType.YELLOW:
                return(new Color(1f, 0.9686275f, 0.5058824f));

            case eColorType.GREEN:
                return(new Color(0.08f, 0.78f, 0.08f));

            case eColorType.BLUE:
                return(new Color(0.08f, 0.08f, 0.78f));

            case eColorType.NONE:
                return(new Color(0.07450981f, 0.003921569f, 0.003921569f));

            default:
                return(Color.black);
            }
        }
Exemple #3
0
        /// <summary>
        /// Returns fill color type for geometry
        /// </summary>
        public static eColorType GeometryToFillColorType(BaseRectangleGeometry geom)
        {
            eColorType colorType = eColorType.eUndefined;

            if (geom is Block)
            {
                colorType = eColorType.eFill_Block;
            }
            else if (geom is AisleSpace)
            {
                colorType = eColorType.eFill_AisleSpace;
            }
            else if (geom is Column)
            {
                colorType = eColorType.eFill_Column;
            }
            else if (geom is Shutter)
            {
                colorType = eColorType.eFill_Shutter;
            }
            else if (geom is TieBeam)
            {
                colorType = eColorType.eFill_TieBeam;
            }
            else if (geom is Wall)
            {
                colorType = eColorType.eFill_Wall;
            }
            else if (geom is SheetElevationGeometry)
            {
                colorType = eColorType.eFill_SheetElevations;
            }

            return(colorType);
        }
Exemple #4
0
 public FuelCar(string i_ModelName, string i_LicenseNumber, float i_CurrentFuel, float i_MaxFuel, eFuelType i_FuelType, eNumOfDoors i_NumOfDoors, eColorType i_Color)
     : base(i_ModelName, i_LicenseNumber, i_CurrentFuel, i_MaxFuel, i_FuelType)
 {
     m_Color      = i_Color;
     m_NumOfDoors = i_NumOfDoors;
     UpdateEnergyPercentage();
 }
 /* Constructor */
 // Default constructor for the use of VehicleMaker class
 public ElectricBasedCar() : base()
 {
     this.m_Color      = eColorType.Unknown;
     this.m_NumOfDoors = eNumOfDoors.Unknown;
     MaxBatteryLife    = k_MaxBatteryLife;
     Type = eVehicleType.ElectricBasedCar;
     InitWheels();
 }
        internal void ColorByChar(char i_Char)
        {
            eColorType colorValue = (eColorType)i_Char;

            BackColor   = Color.FromName(colorValue.ToString());
            m_CharValue = i_Char;
            m_IsColored = true;
        }
        public void SetGeometryColor(eColorType colorType, Color colorValue)
        {
            if (m_ColorsDictionary == null)
            {
                m_ColorsDictionary = new Dictionary <eColorType, Color>();
            }

            m_ColorsDictionary[colorType] = colorValue;
        }
        public void ChangeColor(eColorType colorType)
        {
            this.ColorType = colorType;

            foreach (var renderer in renderers)
            {
                renderer.material.color = GetColorOfType(this.ColorType);
            }
        }
 /* Constructor */
 // Default constructor for the use of VehicleMaker class
 public FuelBasedCar() : base()
 {
     this.m_Color      = eColorType.Unknown;
     this.m_NumOfDoors = eNumOfDoors.Unknown;
     MaxAmountOfFuel   = k_MaxAmountOfFuel;
     Type     = eVehicleType.FuelBasedCar;
     FuelType = k_FuelType;
     InitWheels();
 }
        /// <summary>
        /// Add color info to m_GeometryColorsDictionary
        /// </summary>
        protected bool AddGeometryColor(eColorType colorType, Color value)
        {
            if (m_GeometryColorsTheme == null)
            {
                return(false);
            }

            m_GeometryColorsTheme.SetGeometryColor(colorType, value);
            return(true);
        }
        /// <summary>
        /// Converts eColorType to description
        /// </summary>
        public static string ColorTypeToDescription(eColorType colorType)
        {
            InitializeDict();

            if (m_ColorTypeToDescriptionDict == null || !m_ColorTypeToDescriptionDict.ContainsKey(colorType))
            {
                return(string.Empty);
            }

            return(m_ColorTypeToDescriptionDict[colorType]);
        }
        /// <summary>
        /// Converts eColorType to system name
        /// </summary>
        public static string ColorTypeToSystemName(eColorType colorType)
        {
            InitializeDict();

            if (m_ColorTypeToSystemNameDict == null || !m_ColorTypeToSystemNameDict.ContainsKey(colorType))
            {
                return(string.Empty);
            }

            return(m_ColorTypeToSystemNameDict[colorType]);
        }
Exemple #13
0
        public override void SetUniqueProperties(List <string> i_Properties)
        {
            if (Validator.InColorTypeValues(i_Properties[0]))
            {
                m_Color = (eColorType)Enum.Parse(typeof(eColorType), i_Properties[0]);
            }

            if (Validator.InDoorsAmountValues(i_Properties[1]))
            {
                m_NumOfDoors = (eDoorAmount)Enum.Parse(typeof(eDoorAmount), i_Properties[1]);
            }
        }
        public bool GetGeometryColor(eColorType colorType, out Color colorValue)
        {
            colorValue = Colors.Black;

            if (m_ColorsDictionary != null && m_ColorsDictionary.ContainsKey(colorType))
            {
                colorValue = m_ColorsDictionary[colorType];
                return(true);
            }

            return(false);
        }
        public static Component ParseColor()
        {
            Console.WriteLine("Choose a color: ");
            Console.WriteLine("1. Green");
            Console.WriteLine("2. Black");
            Console.WriteLine("3. Red");
            Console.WriteLine("4. Silver");

            int        result = ParseIntWithinRange(1, 4);
            eColorType color  = (eColorType)result;

            return(new ColorComponent(color));
        }
        public static string StringFromType(eColorType i_ColorType)
        {
            string result;

            switch (i_ColorType)
            {
                case eColorType.Black:
                    result = "Black";
                    break;
                    case eColorType.Green:
                    result = "Green";
                    break;
                    case eColorType.Red:
                    result = "Red";
                    break;
                    case eColorType.Silver:
                    result = "Silver";
                    break;
                default:
                    throw new ArgumentException("Unknown color");
            }

            return result;
        }
Exemple #17
0
 internal Car(eColorType i_Color, int i_NumOfDoors, string i_Model, string i_LicensePlate, Dictionary <Vehicle.eWheelData, string> i_Wheel, Energy i_EnergyType) : base(i_Model, i_LicensePlate, 4, i_Wheel, i_EnergyType)
 {
     m_Color      = i_Color;
     m_NumOfDoors = i_NumOfDoors;
 }
 public void Init(Piece piece, eColorType type)
 {
     this.piece = piece;
     renderers  = this.piece.GetComponentsInChildren <Renderer>();
     ChangeColor(type);
 }
Exemple #19
0
        /// <summary>
        /// Returns rack fill color type, which depends on rack index.
        /// </summary>
        public static eColorType RackToFillColorType(int rackSizeIndex)
        {
            eColorType colorType = eColorType.eFillRackDefault;

            if (0 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_00;
            }
            else if (1 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_01;
            }
            else if (2 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_02;
            }
            else if (3 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_03;
            }
            else if (4 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_04;
            }
            else if (5 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_05;
            }
            else if (6 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_06;
            }
            else if (7 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_07;
            }
            else if (8 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_08;
            }
            else if (9 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_09;
            }
            else if (10 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_10;
            }
            else if (11 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_11;
            }
            else if (12 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_12;
            }
            else if (13 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_13;
            }
            else if (14 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_14;
            }
            else if (15 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_15;
            }
            else if (16 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_16;
            }
            else if (17 == rackSizeIndex)
            {
                colorType = eColorType.eFillRackIndex_17;
            }

            return(colorType);
        }
 public ColorComponent(eColorType i_Value)
 {
     r_ColorType     = i_Value;
     m_ComponentType = eComponentType.ColorComponent;
 }
Exemple #21
0
 public ElectricCar(string i_ModelName, string i_LicenseNumber, float i_RemainingBattery, float i_MaxBattery, eNumOfDoors i_NumOfDoors, eColorType i_Color)
     : base(i_ModelName, i_LicenseNumber, i_RemainingBattery, i_MaxBattery)
 {
     m_Color      = i_Color;
     m_NumOfDoors = i_NumOfDoors;
 }
        /// <summary>
        /// Read colors from stream
        /// </summary>
        public bool ReadFromStream(StreamReader sr)
        {
            if (sr == null)
            {
                return(false);
            }

            bool bInterfaceColor = false;
            bool bGeometryColor  = false;

            string line;

            while ((line = sr.ReadLine()) != null)
            {
                if (HEADER_INTERFACE_COLORS == line)
                {
                    bInterfaceColor = true;
                    bGeometryColor  = false;
                }
                else if (HEADER_GEOMETRY_COLORS == line)
                {
                    bInterfaceColor = false;
                    bGeometryColor  = true;
                }
                else
                {
                    string[] arr = line.Split(COLORINFO_VALUES_DELIMITER);
                    if (arr.Count() >= 2)
                    {
                        string sysname   = arr[0];
                        string value     = arr[1];
                        string localname = string.Empty;
                        if (arr.Count() >= 3)
                        {
                            localname = arr[2];
                        }
                        string description = string.Empty;
                        if (arr.Count() >= 4)
                        {
                            description = arr[3];
                        }

                        if (string.IsNullOrEmpty(sysname))
                        {
                            continue;
                        }

                        Color colorValue = Colors.Black;
                        try
                        {
                            colorValue = (Color)ColorConverter.ConvertFromString(value);
                        }
                        catch
                        {
                            continue;
                        }

                        if (bInterfaceColor)
                        {
                            ColorInfo colorInfo = new ColorInfo(sysname, colorValue, localname, description);
                            AddInterfaceColor(colorInfo);
                        }
                        else if (bGeometryColor)
                        {
                            eColorType colorType = ColorTheme.SystemNameToColorType(sysname);
                            AddGeometryColor(colorType, colorValue);
                            //// replace local name and descriptions
                            //if (m_ColorTypeToDescriptionDict != null && m_ColorTypeToDescriptionDict.ContainsKey(colorType))
                            //	m_ColorTypeToDescriptionDict[colorType] = description;
                            //if (m_ColorTypeToLocalNameDict != null && m_ColorTypeToLocalNameDict.ContainsKey(colorType))
                            //	m_ColorTypeToLocalNameDict[colorType] = localname;
                        }
                    }
                }
            }

            return(true);
        }
Exemple #23
0
 public GeomColorViewModel(eColorType colorType, IGeometryColorsTheme geomColorTheme)
 {
     m_ColorType            = colorType;
     m_ParentGeomColorTheme = geomColorTheme;
 }
 public ColorComponent(eColorType i_Value)
 {
     r_ColorType = i_Value;
     m_ComponentType = eComponentType.ColorComponent;
 }
 public void UpdateCurrentColor(eColorType i_Color)
 {
     m_CurrentColor = i_Color;
 }
    public void SetGemSprite(GameObject go, eColorType ctype)
    {
        gemSprite.GetComponent <SpriteRenderer>().sprite = go.GetComponent <SpriteRenderer>().sprite;

        ColorType = ctype;
    }
Exemple #27
0
 public void UpdateCurrentColor(eColorType i_Color)
 {
     m_CurrentColor.BackColor = r_TypeToColorMap[i_Color];
 }