public HeadOverlayUI(UIMenu menu, string title, int prop, HeadOverlayTypes type) { Menu = InteractionMenu.Instance._interactionMenuPool.AddSubMenuOffset(menu, title, new PointF(5, Screen.Height / 2)); Menu.OnMenuClose += sender => { ClothesManager.Instance.SaveHeadOverlays(); }; var drawables = new List <dynamic>(); for (int i = 0; i < 11; i++) { drawables.Add(""); } Drawables = new UIMenuSliderItem("Drawables", drawables, 0); Menu.AddItem(Drawables); Drawables.OnSliderChanged += (sender, index) => { var color1 = new List <dynamic>(); var color2 = new List <dynamic>(); if (color2 != null) { Menu.RemoveItemAt(2); } if (Colors1 != null) { Menu.RemoveItemAt(1); } color1.Clear(); color2.Clear(); for (int i = 0; i < 63; i++) { color1.Add(""); } for (int i = 0; i < 63; i++) { color2.Add(""); } Colors1 = new UIMenuSliderItem("Primary Color", color1, 0); Menu.AddItem(Colors1); Colors2 = new UIMenuSliderItem("Secondary Color", color2, 0); Menu.AddItem(Colors2); ClothesManager.Instance.SetHeadOverlays(type, index, 0, 0); Colors1.OnSliderChanged += (textsender, textindex) => { ClothesManager.Instance.SetHeadOverlays(type, index, Colors1.Index, Colors2.Index); }; Colors2.OnSliderChanged += (textsender, textindex) => { ClothesManager.Instance.SetHeadOverlays(type, index, Colors1.Index, Colors2.Index); }; InteractionMenu.Instance._interactionMenuPool.RefreshIndex(); }; }
public void SetHeadOverlays(HeadOverlayTypes type, int index, int primarycolor, int secondarycolor) { switch (type) { case HeadOverlayTypes.Blemishes: _blemishes[1] = index; _blemishes[2] = primarycolor; _blemishes[3] = secondarycolor; _blemishes[4] = 0; _blemishes[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _blemishes[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _blemishes[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Beards: _beards[1] = index; _beards[2] = primarycolor; _beards[3] = secondarycolor; _beards[4] = 1; _beards[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _beards[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _beards[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Eyebrows: _eyebrows[1] = index; _eyebrows[2] = primarycolor; _eyebrows[3] = secondarycolor; _eyebrows[4] = 1; _eyebrows[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _eyebrows[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _eyebrows[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Aging: _aging[1] = index; _aging[2] = primarycolor; _aging[3] = secondarycolor; _aging[4] = 0; _aging[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _aging[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _aging[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Makeup: _makeup[1] = index; _makeup[2] = primarycolor; _makeup[3] = secondarycolor; _makeup[4] = 0; _makeup[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _makeup[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _makeup[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Blush: _blush[1] = index; _blush[2] = primarycolor; _blush[3] = secondarycolor; _blush[4] = 2; _blush[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _blush[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _blush[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Complexion: _complexion[1] = index; _complexion[2] = primarycolor; _complexion[3] = secondarycolor; _complexion[4] = 0; _complexion[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _complexion[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _complexion[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Sundamage: _sundamage[1] = index; _sundamage[2] = primarycolor; _sundamage[3] = secondarycolor; _sundamage[4] = 0; _sundamage[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _sundamage[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _sundamage[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Lipstick: _lipstick[1] = index; _lipstick[2] = primarycolor; _lipstick[3] = secondarycolor; _lipstick[4] = 2; _lipstick[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _lipstick[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _lipstick[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Moles: _moles[1] = index; _moles[2] = primarycolor; _moles[3] = secondarycolor; _moles[4] = 0; _moles[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _moles[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _moles[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.Chesthair: _chesthair[1] = index; _chesthair[2] = primarycolor; _chesthair[3] = secondarycolor; _chesthair[4] = 1; _chesthair[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _chesthair[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _chesthair[4], primarycolor, secondarycolor); break; case HeadOverlayTypes.BodyBlemishes: _bodyblemishes[1] = index; _bodyblemishes[2] = primarycolor; _bodyblemishes[3] = secondarycolor; _bodyblemishes[4] = 0; _bodyblemishes[5] = 255; API.SetPedHeadOverlay(Game.PlayerPed.Handle, _bodyblemishes[0], index, 255); API.SetPedHeadOverlayColor(Game.PlayerPed.Handle, index, _bodyblemishes[4], primarycolor, secondarycolor); break; } }