Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
veger committed Feb 27, 2024
1 parent 0f1a501 commit 083cb4e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions YAFC/Widgets/ImmediateWidgets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public static bool BuildInlineObjectList<T>(this ImGui gui, IEnumerable<T> list,
return selected != null;
}

public static void BuildInlineObejctListAndButton<T>(this ImGui gui, ICollection<T> list, IComparer<T> ordering, Action<T> select, string header, int count = 6, bool multiple = false, Predicate<T> checkmark = null, bool allowNone = false, Func<T, string> extra = null) where T : FactorioObject {
public static void BuildInlineObjectListAndButton<T>(this ImGui gui, ICollection<T> list, IComparer<T> ordering, Action<T> select, string header, int count = 6, bool multiple = false, Predicate<T> checkmark = null, bool allowNone = false, Func<T, string> extra = null) where T : FactorioObject {
using (gui.EnterGroup(default, RectAllocator.Stretch)) {
if (gui.BuildInlineObjectList(list, ordering, header, out var selected, count, checkmark, extra)) {
select(selected);
Expand All @@ -144,13 +144,13 @@ public static bool BuildFactorioObjectWithAmount(this ImGui gui, FactorioObject
if (goods != null) {
gui.BuildText(DataUtils.FormatAmount(amount, unit), Font.text, false, RectAlignment.Middle);
if (InputSystem.Instance.control && gui.BuildButton(gui.lastRect, SchemeColor.None, SchemeColor.Grey) == ButtonEvent.MouseOver)
ShowPrecisionValueTootlip(gui, amount, unit, goods);
ShowPrecisionValueTooltip(gui, amount, unit, goods);
}
return clicked;
}
}

public static void ShowPrecisionValueTootlip(ImGui gui, float amount, UnitOfMeasure unit, FactorioObject goods) {
public static void ShowPrecisionValueTooltip(ImGui gui, float amount, UnitOfMeasure unit, FactorioObject goods) {
string text;
switch (unit) {
case UnitOfMeasure.PerSecond:
Expand All @@ -174,7 +174,7 @@ public static void ShowPrecisionValueTootlip(ImGui gui, float amount, UnitOfMeas
}

public static void BuildObjectSelectDropDown<T>(this ImGui gui, ICollection<T> list, IComparer<T> ordering, Action<T> select, string header, int count = 6, bool multiple = false, Predicate<T> checkmark = null, bool allowNone = false, Func<T, string> extra = null) where T : FactorioObject {
gui.ShowDropDown(imGui => imGui.BuildInlineObejctListAndButton(list, ordering, select, header, count, multiple, checkmark, allowNone, extra));
gui.ShowDropDown(imGui => imGui.BuildInlineObjectListAndButton(list, ordering, select, header, count, multiple, checkmark, allowNone, extra));
}

public static GoodsWithAmountEvent BuildFactorioObjectWithEditableAmount(this ImGui gui, FactorioObject obj, float amount, UnitOfMeasure unit, out float newAmount, SchemeColor color = SchemeColor.None) {
Expand Down
2 changes: 1 addition & 1 deletion YAFC/Windows/NeverEnoughItemsPanel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ private void DrawIngredients(ImGui gui, Recipe recipe) {
foreach (var ingredient in recipe.ingredients)
if (gui.BuildFactorioObjectWithAmount(ingredient.goods, ingredient.amount, UnitOfMeasure.None)) {
if (ingredient.variants != null)
gui.ShowDropDown(imGui => imGui.BuildInlineObejctListAndButton<Goods>(ingredient.variants, DataUtils.DefaultOrdering, SetItem, "Accepted fluid variants"));
gui.ShowDropDown(imGui => imGui.BuildInlineObjectListAndButton<Goods>(ingredient.variants, DataUtils.DefaultOrdering, SetItem, "Accepted fluid variants"));
else
changing = ingredient.goods;
}
Expand Down
2 changes: 1 addition & 1 deletion YAFC/Workspace/ProductionSummary/ProductionSummaryView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public override void BuildElement(ImGui gui, ProductionSummaryEntry data) {
if (evt == ButtonEvent.Click)
view.AddOrRemoveColumn(goods);
else if (evt == ButtonEvent.MouseOver)
ImmediateWidgets.ShowPrecisionValueTootlip(gui, amount, goods.flowUnitOfMeasure, goods);
ImmediateWidgets.ShowPrecisionValueTooltip(gui, amount, goods.flowUnitOfMeasure, goods);
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions YAFC/Workspace/ProductionTable/ProductionTableView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@ private void BuildSolarPanelAccumulatorView(ImGui gui, RecipeRow recipe) {

private void ShowAccumulatorDropdown(ImGui gui, RecipeRow recipe, Entity accumulator) {
gui.ShowDropDown(imGui => {
imGui.BuildInlineObejctListAndButton<EntityAccumulator>(Database.allAccumulators, DataUtils.DefaultOrdering,
imGui.BuildInlineObjectListAndButton<EntityAccumulator>(Database.allAccumulators, DataUtils.DefaultOrdering,
accum => recipe.RecordUndo().ChangeVariant(accumulator, accum), "Select accumulator",
extra: x => DataUtils.FormatAmount(x.accumulatorCapacity, UnitOfMeasure.Megajoule));
});
}

private void ShowEntityDropPown(ImGui imgui, RecipeRow recipe) {
imgui.ShowDropDown(gui => {
gui.BuildInlineObejctListAndButton(recipe.recipe.crafters, DataUtils.FavouriteCrafter, sel => {
gui.BuildInlineObjectListAndButton(recipe.recipe.crafters, DataUtils.FavouriteCrafter, sel => {
if (recipe.entity == sel)
return;
recipe.RecordUndo().entity = sel;
Expand Down Expand Up @@ -464,7 +464,7 @@ private void ShowModuleDropDown(ImGui gui, RecipeRow recipe) {
}

if (recipe.entity?.moduleSlots > 0)
dropGui.BuildInlineObejctListAndButton(modules, DataUtils.FavouriteModule, recipe.SetFixedModule, "Select fixed module");
dropGui.BuildInlineObjectListAndButton(modules, DataUtils.FavouriteModule, recipe.SetFixedModule, "Select fixed module");

if (moduleTemplateList.data.Count > 0) {
dropGui.BuildText("Use module template:", wrap: true, font: Font.subheader);
Expand Down Expand Up @@ -606,7 +606,7 @@ void DropDownContent(ImGui gui) {
gui.BuildText("This entity has no known fuels");
else if (recipe.entity.energy.fuels.Length > 1 || recipe.entity.energy.fuels[0] != recipe.fuel) {
BuildFavourites(gui, recipe.fuel, "Add fuel to favourites");
gui.BuildInlineObejctListAndButton(recipe.entity.energy.fuels, DataUtils.FavouriteFuel, selectFuel, "Select fuel", extra: fuelDisplayFunc);
gui.BuildInlineObjectListAndButton(recipe.entity.energy.fuels, DataUtils.FavouriteFuel, selectFuel, "Select fuel", extra: fuelDisplayFunc);
}
}

Expand Down Expand Up @@ -644,7 +644,7 @@ void DropDownContent(ImGui gui) {
}

if (type != ProductDropdownType.Product && goods != null && allProduction.Length > 0) {
gui.BuildInlineObejctListAndButton(allProduction, comparer, addRecipe, "Add production recipe", 6, true, recipeExists);
gui.BuildInlineObjectListAndButton(allProduction, comparer, addRecipe, "Add production recipe", 6, true, recipeExists);
if (link == null) {
var iconRect = new Rect(gui.lastRect.Right - 2f, gui.lastRect.Top, 2f, 2f);
gui.DrawIcon(iconRect.Expand(-0.2f), Icon.OpenNew, gui.textColor);
Expand All @@ -657,10 +657,10 @@ void DropDownContent(ImGui gui) {
}

if (type != ProductDropdownType.Fuel && goods != null && type != ProductDropdownType.Ingredient && goods.usages.Length > 0)
gui.BuildInlineObejctListAndButton(goods.usages, DataUtils.DefaultRecipeOrdering, addRecipe, "Add consumption recipe", type == ProductDropdownType.Product ? 6 : 3, true, recipeExists);
gui.BuildInlineObjectListAndButton(goods.usages, DataUtils.DefaultRecipeOrdering, addRecipe, "Add consumption recipe", type == ProductDropdownType.Product ? 6 : 3, true, recipeExists);

if (type == ProductDropdownType.Product && goods != null && allProduction.Length > 0)
gui.BuildInlineObejctListAndButton(allProduction, comparer, addRecipe, "Add production recipe", 1, true, recipeExists);
gui.BuildInlineObjectListAndButton(allProduction, comparer, addRecipe, "Add production recipe", 1, true, recipeExists);

if (link != null && gui.BuildCheckBox("Allow overproduction", link.algorithm == LinkAlgorithm.AllowOverProduction, out var newValue))
link.RecordUndo().algorithm = newValue ? LinkAlgorithm.AllowOverProduction : LinkAlgorithm.Match;
Expand Down

0 comments on commit 083cb4e

Please sign in to comment.