public MPOverlayMenu(CharacterEditorMenu root) { Root = root; headerTitle = "Overlays"; statusTitle = ""; numVisibleItems = 7; overlays.ForEach(o => { menuItems.Add(new MenuItemHorNamedSelector { Title = o.Name, state = o.OptionValues.IndexOf(Function.Call <int>(Hash._GET_PED_HEAD_OVERLAY_VALUE, Game.PlayerPed.Handle, o.ID)), Type = MenuItemHorizontalSelectorType.NumberAndBar, wrapAround = true, optionList = o.OptionNames, OnChange = new Action <int, string, MenuItemHorNamedSelector>((selectedAlternative, selName, menuItem) => { Function.Call(Hash.SET_PED_HEAD_OVERLAY, Game.PlayerPed.Handle, o.ID, o.OptionValues[selectedAlternative], 1f); if (!Root.AdditionalSaveData.HeadOverlays.ContainsKey((byte)o.ID)) { Root.AdditionalSaveData.HeadOverlays[(byte)o.ID] = new PedData.HeadOverlay(); } Root.AdditionalSaveData.HeadOverlays[(byte)o.ID].Variant = (byte)o.OptionValues[selectedAlternative]; Root.AdditionalSaveData.HeadOverlays[(byte)o.ID].Opacity = 1.0f; // Setting default opacity of 1f }) }); if (o.colorType != 0) { if (!overlayColors.ContainsKey(o.ID)) { overlayColors[o.ID] = 0; } menuItems.Add(new MenuItemHorSelector <int> { Title = $"{o.Name}: Color", state = overlayColors[o.ID], Type = MenuItemHorizontalSelectorType.NumberAndBar, wrapAround = true, minState = 0, maxState = 63, OnChange = new Action <int, MenuItemHorSelector <int> >((selectedAlternative, menuItem) => { overlayColors[o.ID] = selectedAlternative; Function.Call(Hash._SET_PED_HEAD_OVERLAY_COLOR, Game.PlayerPed.Handle, o.ID, o.colorType, selectedAlternative, selectedAlternative); if (!Root.AdditionalSaveData.HeadOverlays.ContainsKey((byte)o.ID)) { Root.AdditionalSaveData.HeadOverlays[(byte)o.ID] = new PedData.HeadOverlay(); } Root.AdditionalSaveData.HeadOverlays[(byte)o.ID].PrimaryColor = (byte)selectedAlternative; Root.AdditionalSaveData.HeadOverlays[(byte)o.ID].SecondaryColor = (byte)selectedAlternative; }) }); } }); menuItems.Add(new MenuItemStandard { Title = "Back", OnActivate = CloseMenu }); }
public MPBodyMenu(CharacterEditorMenu root) { Root = root; headerTitle = "Body"; statusTitle = ""; FatherHead = new ItemSelector(this, "Father's face", 45); MotherHead = new ItemSelector(this, "Mother's face", 45); HeadWeight = new ItemSlider(this, "Father/Mother face blend"); FacialFeatures = new ItemSelector(this, "Facial features", 20); FacialMorphStrength = new ItemSlider(this, "Facial features blend", -2.0f, 2.0f, 0.0f, 0.5f); FatherSkin = new ItemSelector(this, "Father's skin color", 45); MotherSkin = new ItemSelector(this, "Mother's skin color", 45); SkinWeight = new ItemSlider(this, "Father/Mother skin blend"); menuItems.Add(FatherHead); menuItems.Add(MotherHead); menuItems.Add(HeadWeight); menuItems.Add(FacialFeatures); menuItems.Add(FacialMorphStrength); menuItems.Add(FatherSkin); menuItems.Add(MotherSkin); menuItems.Add(SkinWeight); menuItems.Add(new MenuItemStandard { Title = "Back", OnActivate = CloseMenu }); }
private void ExitWithoutSaving(MenuItemStandard m) { //Log.ToChat( "CharacterEditorMenu ExitWithoutSaving" ); Root.cleanCloseMenu(); var pedData = JsonConvert.DeserializeObject <PedData>(Client.Instance.Instances.Session.GetPlayer(Game.Player).GetGlobalData("Character.SkinData", "")); CharacterEditorMenu.handleSkinCreate(pedData); }
public CustomizeMenu(CharacterEditorMenu root) { Root = root; headerTitle = "Customizable"; statusTitle = "Customizable your model"; PopulateMenu(); }
public CustomizeMenu(CharacterEditorMenu root, bool isClothingStore) { Root = root; this.isClothingStore = isClothingStore; headerTitle = "Customizable"; statusTitle = "Customizable your model"; PopulateMenu(); }
public ModelSelector(CharacterEditorMenu root) { Root = root; Title = "Model"; Type = MenuItemHorizontalSelectorType.Number; state = 0; optionList = Options; wrapAround = true; OnChange = SetNewModel; }
public SkinHandler(Client client) : base(client) { client.RegisterEventHandler("Skin.LoadPlayerSkin", new Action <dynamic>(data => { CharacterEditorMenu.handleSkinCreate(data == null ? CharacterEditorMenu.skinData : data); })); client.RegisterEventHandler("Skin.StartCharacterCreation", new Action <int>(async playerHome => { CharacterEditorMenu charMenu = new CharacterEditorMenu(); while (charMenu.Observer.CurrentMenu != null) { Client.Get <Arrest>().DisableActions(); Game.PlayerPed.Task.ClearAll(); await BaseScript.Delay(0); } //if (playerHome != 0) TriggerEvent("spawnPlayerHome", playerHome); })); client.RegisterEventHandler("Skin.UpdatePlayerSkinData", new Action <dynamic>(skinData => CharacterEditorMenu.skinData = skinData)); client.RegisterEventHandler("Skin.SaveCurrentOutfit", new Action <string>(handleOutfitCreate)); client.Get <InteractionUI>().RegisterInteractionMenuItem(new MenuFramework.MenuItemStandard { Title = "Clothing Store", OnActivate = state => { new CharacterEditorMenu(true); InteractionUI.Observer.CloseMenu(true); } }, () => clothingStoreLocaitons.Any(o => o.DistanceToSquared(Game.PlayerPed.Position) < 5.0f), 500); BlipHandler.AddBlip("Clothing store", clothingStoreLocaitons, new BlipOptions { Sprite = BlipSprite.Clothes }); MarkerHandler.AddMarker(clothingStoreLocaitons); client.RegisterEventHandler("Skin.RefreshSkin", new Action(RefreshPlayerSkin)); client.RegisterEventHandler("Player.OnLoginComplete", new Action(RefreshPlayerSkin)); client.RegisterEventHandler("Player.CheckForInteraction", new Action(() => { if (clothingStoreLocaitons.Any(o => o.DistanceToSquared(Game.PlayerPed.Position) < 5.0f)) { new CharacterEditorMenu(true); } })); client.RegisterEventHandler("Player.OnSkinLoaded", new Action(() => canRefreshSkin = false)); CommandRegister.RegisterCommand("refreshskin", async cmd => { if (!canRefreshSkin) { return; } await cmd.Session.UpdateData("Character.SkinData"); RefreshPlayerSkin(); }); }
public MPEyeSelector(CharacterEditorMenu root) { Root = root; Title = "Eye color"; Type = MenuItemHorizontalSelectorType.Number; wrapAround = true; minState = 0; maxState = 63; state = 0; OnChange = SetNewAppearance; OnSelect = new Action <MenuItem>((menuItem) => { Roleplay.Client.CharacterEditor.LookAtFace(); }); }
public ExitButton(CharacterEditorMenu root) { Root = root; Title = "Return to character select"; OnActivate = OpenExitPrompt; Prompt = new MenuModel { headerTitle = "Return to character select?", statusTitle = "All changes will be lost." }; Prompt.menuItems.Add(new MenuItemStandard { Title = "Yes", OnActivate = ExitWithoutSaving }); Prompt.menuItems.Add(new MenuItemStandard { Title = "No", OnActivate = AbortExit }); }
public async void RefreshPlayerSkin() { while (LocalSession == null) { await BaseScript.Delay(0); } if (!string.IsNullOrEmpty(LocalSession.GetGlobalData("Character.SkinData", ""))) { var pedData = JsonConvert.DeserializeObject <PedData>(LocalSession.GetGlobalData("Character.SkinData", "")); CharacterEditorMenu.handleSkinCreate(pedData); } else { //BaseScript.TriggerEvent("Skin.StartCharacterCreation"); } }
public MPHairMenu(CharacterEditorMenu root) { Root = root; headerTitle = "Hair"; statusTitle = ""; HairModel = new ItemSelector(this, "Hair model", GameData.MPHairModelList.GetLength(0)); PrimaryHairColor = new ItemSelector(this, "Primary hair color", 63); SecondaryHaircolor = new ItemSelector(this, "Secondary hair color", 63); menuItems.Add(HairModel); menuItems.Add(PrimaryHairColor); menuItems.Add(SecondaryHaircolor); menuItems.Add(new MenuItemStandard { Title = "Back", OnActivate = CloseMenu }); }
public MPHairMenu(CharacterEditorMenu root) { Root = root; headerTitle = "Hair"; statusTitle = ""; for (int i = 0; i < Game.PlayerPed.Style[PedComponents.Hair].Count; i++) { hairCount.Add(i); } HairModel = new ItemSelector(this, "Hair", /*GameData.MPHairModelList.GetLength( 0 )*/ Game.PlayerPed.Style[PedComponents.Hair].Count - 1); PrimaryHairColor = new ItemSelector(this, "Primary hair color", 63); SecondaryHaircolor = new ItemSelector(this, "Secondary hair color", 63); menuItems.Add(HairModel); menuItems.Add(PrimaryHairColor); menuItems.Add(SecondaryHaircolor); menuItems.Add(new MenuItemStandard { Title = "Back", OnActivate = CloseMenu }); }
public MPHairButton(CharacterEditorMenu root) { Title = "Hair"; SubMenu = new MPHairMenu(root); OnSelect = new Action <MenuItem>((menuItem) => { Roleplay.Client.CharacterEditor.LookAtFace(); }); }
public MPBodyButton(CharacterEditorMenu root) { Title = "Body"; SubMenu = new MPBodyMenu(root); OnSelect = new Action <MenuItem>((menuItem) => { root.Editor.lookAtBody(); }); }
public CustomizeButton(CharacterEditorMenu root, bool isClothingStore) { Title = "Customize"; SubMenu = new CustomizeMenu(root, isClothingStore); }
public CustomizeButton(CharacterEditorMenu root) { Title = "Customize"; SubMenu = new CustomizeMenu(root); }
public MPBodyButton(CharacterEditorMenu root) { Title = "Body"; SubMenu = new MPBodyMenu(root); OnSelect = new Action <MenuItem>((menuItem) => { Roleplay.Client.CharacterEditor.LookAtBody(); }); }
public MPHairButton(CharacterEditorMenu root) { Title = "Hair"; SubMenu = new MPHairMenu(root); OnSelect = new Action <MenuItem>((menuItem) => { root.Editor.lookAtHead(); }); }
public ModelTextureSelector(CharacterEditorMenu root, IPedVariation component) { Root = root; Component = component; Title = ComponentNames.ContainsKey(component.ToString()) ? ComponentNames[component.ToString()] : component.ToString(); OnActivate = OpenComponentMenu; OnSelect = new Action <MenuItem>((menuItem) => { if (component.ToString() == "Legs" || component.ToString() == "Shoes") { root.Editor.lookAtLegs(); } else if (component.ToString() == "Hats") { root.Editor.lookAtHead(); } else { root.Editor.lookAtBody(); } }); // Is this variation a prop or component? PedProps propID; PedComponents compID; if (Enum.TryParse(Component.ToString(), out propID)) { ComponentID = (int)propID; IsProp = true; AppliedModel = -1; } else if (Enum.TryParse(Component.ToString(), out compID)) { ComponentID = (int)compID; } Menu = new MenuModel { headerTitle = ComponentNames.ContainsKey(component.ToString()) ? ComponentNames[component.ToString()] : component.ToString(), statusTitle = ComponentNames.ContainsKey(component.ToString()) ? ComponentNames[component.ToString()] : component.ToString() }; // Only add the Change Model button if there is more than one model if (component.HasVariations) { ModelSelector = new MenuItemHorSelector <int> { Title = "Model", Type = MenuItemHorizontalSelectorType.Number, state = 0, minState = 0, maxState = component.Count - 1, wrapAround = true, overrideDetailWith = $"{component.Index + 1}/{component.Count}", OnChange = SetNewModel }; Menu.menuItems.Add(ModelSelector); } // Only add the Change Texture button if there is more than one texture for this model //if( component.HasTextureVariations ) { TextureSelector = new MenuItemHorSelector <int> { Title = "Texture", Type = MenuItemHorizontalSelectorType.Number, state = 0, minState = 0, maxState = component.TextureCount - 1, wrapAround = true, overrideDetailWith = $"{component.TextureIndex + 1}/{(component.TextureCount == 0 ? "1" : component.TextureCount.ToString())}", OnChange = SetNewTexture }; Menu.menuItems.Add(TextureSelector); //} Menu.menuItems.Add(new MenuItemStandard { Title = "Back", OnActivate = CloseComponentMenu }); }
public SaveButton(CharacterEditorMenu root) { Root = root; Title = "Save character & Play!"; OnActivate = SaveAndExit; }