Example #1
0
        public List <BodyColor> GetAll()
        {
            List <BodyColor> bodyColors = new List <BodyColor>();

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("BodyColorSelectAll", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                cn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        BodyColor currentRow = new BodyColor();
                        currentRow.BodyColorID   = (int)dr["BodyColorID"];
                        currentRow.BodyColorName = dr["BodyColorName"].ToString();

                        bodyColors.Add(currentRow);
                    }
                }
            }
            return(bodyColors);
        }
Example #2
0
        public void ResetCarFilter()
        {
            RefreshContext();
            if (Session.UserController.IsAuthorized)
            {
                _BrandFilter            = null;
                _ModelFilter            = null;
                _YearOfIssueMinFilter   = 1975;
                _YearOfIssueMaxFilter   = 2020;
                _BodyTypeFilter         = 0;
                _EngineVolumeMinFilter  = 0.8f;
                _EngineVolumeMaxFilter  = 10.0f;
                _EngineTypeFilter       = 0;
                _TransmissionTypeFilter = 0;
                _WheelDriveTypeFilter   = 0;
                _MileageMinFilter       = 0;
                _MileageMaxFilter       = 1000000M;
                _BodyColorFilter        = 0;
                _InteriorMaterialFilter = 0;
                _InteriorColorFilter    = 0;
                _PriceMinFilter         = 0;
                _PriceMaxFilter         = 1000000M;

                _BinaryFormatter.Serialize(_NetworkStream, MessageType.Success);
                IsFilteringEnabled = false;
            }
            else
            {
                Session.SendErrorMessage("Для этого действия требуется авторизация!");
            }
            RefreshContext();
        }
Example #3
0
 public PlayerOptions(HairColor hairColor, HairLength hairLength, BodyColor bodyColor, TailColor tailColor)
 {
     this.hairColor  = hairColor;
     this.hairLength = hairLength;
     this.bodyColor  = bodyColor;
     this.tailColor  = tailColor;
 }
Example #4
0
        public void SetCarFilter()
        {
            RefreshContext();

            _BrandFilter            = (string)_BinaryFormatter.Deserialize(_NetworkStream);
            _ModelFilter            = (string)_BinaryFormatter.Deserialize(_NetworkStream);
            _YearOfIssueMinFilter   = (int)_BinaryFormatter.Deserialize(_NetworkStream);
            _YearOfIssueMaxFilter   = (int)_BinaryFormatter.Deserialize(_NetworkStream);
            _BodyTypeFilter         = (BodyType)_BinaryFormatter.Deserialize(_NetworkStream);
            _EngineVolumeMinFilter  = (float)_BinaryFormatter.Deserialize(_NetworkStream);
            _EngineVolumeMaxFilter  = (float)_BinaryFormatter.Deserialize(_NetworkStream);
            _EngineTypeFilter       = (EngineType)_BinaryFormatter.Deserialize(_NetworkStream);
            _TransmissionTypeFilter = (TransmissionType)_BinaryFormatter.Deserialize(_NetworkStream);
            _WheelDriveTypeFilter   = (WheelDriveType)_BinaryFormatter.Deserialize(_NetworkStream);
            _MileageMinFilter       = (decimal)_BinaryFormatter.Deserialize(_NetworkStream);
            _MileageMaxFilter       = (decimal)_BinaryFormatter.Deserialize(_NetworkStream);
            _BodyColorFilter        = (BodyColor)_BinaryFormatter.Deserialize(_NetworkStream);
            _InteriorMaterialFilter = (InteriorMaterial)_BinaryFormatter.Deserialize(_NetworkStream);
            _InteriorColorFilter    = (InteriorColor)_BinaryFormatter.Deserialize(_NetworkStream);
            _PriceMinFilter         = (decimal)_BinaryFormatter.Deserialize(_NetworkStream);
            _PriceMaxFilter         = (decimal)_BinaryFormatter.Deserialize(_NetworkStream);

            if (Session.UserController.IsAuthorized)
            {
                _BinaryFormatter.Serialize(_NetworkStream, MessageType.Success);
                IsFilteringEnabled = true;
            }
            else
            {
                Session.SendErrorMessage("Для этого действия требуется авторизация!");
            }

            RefreshContext();
        }
Example #5
0
                protected override void Layout()
                {
                    if (MyAPIGateway.Gui.IsCursorVisible)
                    {
                        CloseMenu();
                    }

                    base.Layout();

                    // Update sizing
                    if (SelectedPage != null)
                    {
                        var pageElement = SelectedPage.AssocMember as HudElementBase;
                        pageElement.Width = Width - Padding.X - modList.Width - bodyChain.Spacing;
                    }

                    bodyChain.Height = Height - header.Height - topDivider.Height - Padding.Y - bottomDivider.Height;
                    modList.Width    = 270f;

                    // Bound window offset to keep it from being moved off screen
                    Vector2 min = new Vector2(HudMain.ScreenWidth, HudMain.ScreenHeight) / (HudMain.ResScale * -2f), max = -min;

                    Offset = Vector2.Clamp(Offset, min, max);

                    // Update color opacity
                    BodyColor    = BodyColor.SetAlphaPct(HudMain.UiBkOpacity);
                    header.Color = BodyColor;
                }
Example #6
0
 public new void Setup()
 {
     base.Setup();
     defaultFont = CreateFont(DefaultFontStr, DefaultFontSize);
     areaBrush   = AreaColor.GetSolidBrush(this);
     textBrush   = TextColor.GetSolidBrush(this);
     blueBrush   = CreateSolidBrush(Color.Blue);
     redBrush    = CreateSolidBrush(Color.Red);
     headBrush   = HeadColor.GetSolidBrush(this);
     bodyBrush   = BodyColor.GetSolidBrush(this);
 }
 private ColorOption GetColorOptionFor(BodyColor bodyColor)
 {
     if (colonistGroup.groupColor?.bodyColors != null)
     {
         if (colonistGroup.groupColor.bodyColors.TryGetValue(bodyColor, out var color))
         {
             return(color);
         }
     }
     return(null);
 }
        new public void  Setup()
        {
            base.Setup();

            DefaultFont = CreateFont(DefaultFontstr, DefaultFontSize);
            acb         = AreaColor.getSolidBrush(this);
            tfb         = TextColor.getSolidBrush(this);
            csb         = CreateSolidBrush(Color.Blue);
            csfmb       = CreateSolidBrush(Color.Red);
            hcb         = HeadColor.getSolidBrush(this);
            bcb         = BodyColor.getSolidBrush(this);
        }
Example #9
0
        public async Task <int> SaveBodyColor(BodyColor bodyColor)
        {
            if (bodyColor.Id != 0)
            {
                _context.BodyColors.Update(bodyColor);

                await _context.SaveChangesAsync();

                return(1);
            }
            else
            {
                await _context.BodyColors.AddAsync(bodyColor);

                await _context.SaveChangesAsync();

                return(1);
            }
        }
Example #10
0
 public ColorModel(BodyColor color)
 {
     this.BodyColorSelection = color;
 }
        public override void DoWindowContents(Rect inRect)
        {
            base.DoWindowContents(inRect);

            foreach (var data in colorRects)
            {
                var colorOption = GetColorOptionFor(data.Key);
                if (colorOption != null)
                {
                    if (colorOption.pawnFavoriteOnly)
                    {
                        GUI.DrawTexture(data.Value, Textures.PawnFavoriteIcon);
                    }
                    else
                    {
                        Widgets.DrawBoxSolidWithOutline(data.Value, colorOption.color, Color.white);
                    }
                }
                else
                {
                    Widgets.DrawBoxSolidWithOutline(data.Value, Color.clear, Color.white);
                }

                if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && Event.current.clickCount == 1 && Mouse.IsOver(data.Value))
                {
                    activeMode = data.Key;
                }
                else if (Event.current.type == EventType.MouseDown && Event.current.button == 1 && Event.current.clickCount == 1 && Mouse.IsOver(data.Value))
                {
                    RemoveColor();
                }
            }
            if (colorRects.ContainsKey(activeMode))
            {
                GUI.DrawTexture(colorRects[activeMode], Textures.GreenSelectionBox);
            }

            foreach (var data in stringRects)
            {
                Widgets.Label(data.Value, data.Key);
            }

            var colorSelectorRect = new Rect(37, 142, 570, 195);
            var oldColor          = curColor;

            Widgets.ColorSelector(colorSelectorRect, ref curColor, ColorUtils.AllColors);
            if (oldColor != curColor)
            {
                SetColor();
            }
            var setIdeoColorRect = new Rect(40, inRect.yMax - 58, 174, 24f);

            if (Widgets.ButtonText(setIdeoColorRect, Strings.SetIdeologyColor))
            {
                curColor = Faction.OfPlayer.ideos.PrimaryIdeo.ApparelColor;
                SetColor();
            }

            var setPawnFavoritesColor = new Rect(setIdeoColorRect.xMax + 15, setIdeoColorRect.y, setIdeoColorRect.width, 24f);

            if (Widgets.ButtonText(setPawnFavoritesColor, Strings.SetPawnFavoritesColor))
            {
                if (this.colonistGroup.groupColor is null)
                {
                    this.colonistGroup.groupColor = new GroupColor();
                }
                if (this.colonistGroup.groupColor.bodyColors is null)
                {
                    this.colonistGroup.groupColor.bodyColors = new Dictionary <BodyColor, ColorOption>();
                }
                this.colonistGroup.groupColor.bodyColors[activeMode] = new ColorOption(true);
                curColor = Color.clear;
            }

            var clearGroupColor = new Rect(setPawnFavoritesColor.xMax + 15, setIdeoColorRect.y, setIdeoColorRect.width, 24f);

            if (Widgets.ButtonText(clearGroupColor, Strings.ClearGroupColor))
            {
                RemoveColor();
            }
        }