public void CopyFromChrAsm(NewChrAsm chrAsm) { GameType = GameDataManager.GameType; HeadID = chrAsm.HeadID; BodyID = chrAsm.BodyID; ArmsID = chrAsm.ArmsID; LegsID = chrAsm.LegsID; RightWeaponID = chrAsm.RightWeaponID; //RightWeaponModelIndex = chrAsm.RightWeaponModelIndex; LeftWeaponID = chrAsm.LeftWeaponID; //LeftWeaponModelIndex = chrAsm.LeftWeaponModelIndex; LeftWeaponFlipBackwards = chrAsm.LeftWeaponFlipBackwards; LeftWeaponFlipSideways = chrAsm.LeftWeaponFlipSideways; RightWeaponFlipBackwards = chrAsm.RightWeaponFlipBackwards; RightWeaponFlipSideways = chrAsm.RightWeaponFlipSideways; WeaponStyle = chrAsm.StartWeaponStyle; }
protected override void BuildContents() { if (asm == null) { ImGui.Text("No player currently loaded."); equipSearchStates.Clear(); return; } bool isChanged = false; int EquipListIndexSelect(string disp, int currentSelectedID, string[] sourceNames, int[] sourceIDs) { //ImGui.PushID($"EditPlayerEquip_Dropdown_{disp}"); if (!equipSearchStates.ContainsKey(disp) || equipSearchStates[disp].GameItsFor != GameDataManager.GameType) { equipSearchStates[disp] = new EquipSearchState(sourceNames, sourceIDs); } var state = equipSearchStates[disp]; int idx = state.SearchResultsIDs.ToList().IndexOf(currentSelectedID); ImGui.SetNextItemOpen(state.IsDropdownOpen); var tree = ImGui.TreeNode($"{disp}: {(idx >= 0 && idx < state.SearchResultsIDs.Length ? state.SearchResultsNames[idx] : "None")}##EditPlayerEquip_Dropdown_{disp}_Tree"); if (tree) { state.IsDropdownOpen = true; ImGui.InputText($"##EditPlayerEquip_Dropdown_{disp}_SearchField", ref state.SearchTerm, 256); equipSearchStates[disp].CheckSearchTermUpdated(currentSelectedID); idx = state.SearchResultsIDs.ToList().IndexOf(currentSelectedID); int oldIdx = idx; ImGui.ListBox($"##EditPlayerEquip_Dropdown_{disp}_Dropdown", ref idx, state.SearchResultsNames, state.SearchResultsNames.Length); if (idx != oldIdx) { var newSelectedId = idx >= 0 && idx < state.SearchResultsIDs.Length ? state.SearchResultsIDs[idx] : -1; if (newSelectedId != currentSelectedID) { currentSelectedID = newSelectedId; isChanged = true; } } ImGui.TreePop(); } else { state.IsDropdownOpen = false; } //ImGui.PopID(); return(currentSelectedID); } asm.HeadID = EquipListIndexSelect("Head", asm.HeadID, FmgManager.EquipmentNamesHD, FmgManager.EquipmentIDsHD); asm.BodyID = EquipListIndexSelect("Body", asm.BodyID, FmgManager.EquipmentNamesBD, FmgManager.EquipmentIDsBD); asm.ArmsID = EquipListIndexSelect("Arms", asm.ArmsID, FmgManager.EquipmentNamesAM, FmgManager.EquipmentIDsAM); asm.LegsID = EquipListIndexSelect("Legs", asm.LegsID, FmgManager.EquipmentNamesLG, FmgManager.EquipmentIDsLG); ImGui.Separator(); bool isFemale = asm.IsFemale; ImGui.Checkbox("Is Female", ref isFemale); if (isFemale != asm.IsFemale) { asm.IsFemale = isFemale; asm.UpdateModels(isAsync: true, onCompleteAction: null, updateFaceAndBody: true, forceReloadArmor: true); } ImGui.Separator(); asm.RightWeaponID = EquipListIndexSelect("Right Weapon", asm.RightWeaponID, FmgManager.EquipmentNamesWP, FmgManager.EquipmentIDsWP); asm.LeftWeaponID = EquipListIndexSelect("Left Weapon", asm.LeftWeaponID, FmgManager.EquipmentNamesWP, FmgManager.EquipmentIDsWP); if (isChanged) { asm.UpdateModels(isAsync: true, onCompleteAction: null, updateFaceAndBody: true, forceReloadArmor: true); } ImGui.Separator(); Tools.FancyComboBox("Weapon Style", ref EquipStyleIndex, EquipStylesNamesList); NewChrAsm.WeaponStyleType oldStartWeaponStyle = asm.StartWeaponStyle; asm.StartWeaponStyle = (EquipStyleIndex >= 0 && EquipStyleIndex < EquipStylesList.Length) ? EquipStylesList[EquipStyleIndex] : NewChrAsm.WeaponStyleType.None; if (asm.StartWeaponStyle != oldStartWeaponStyle) { asm.WeaponStyle = asm.StartWeaponStyle; } ImGui.Separator(); //bool applyEnabled = !LoadingTaskMan.AnyTasksRunning(); //if (!applyEnabled) // Tools.PushGrayedOut(); //ImGui.Button("Apply Equipment to Character"); //if (ImGui.IsItemClicked() && applyEnabled) // asm.UpdateModels(isAsync: true, onCompleteAction: null, updateFaceAndBody: false); //if (!applyEnabled) // Tools.PopGrayedOut(); //ImGui.Separator(); ImGui.Checkbox("Right Weapon Model Debug Lineup", ref asm.DebugRightWeaponModelPositions); ImGui.Checkbox("Left Weapon Model Debug Lineup", ref asm.DebugLeftWeaponModelPositions); }