Skip to content

Commit

Permalink
#292 Added UI Performence Improvements 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sn1p3rr3c0n committed Jan 23, 2021
1 parent 91164a0 commit deba200
Showing 1 changed file with 23 additions and 27 deletions.
50 changes: 23 additions & 27 deletions Source/ProjectRimFactory/SAL3/Things/ITab_RecipeHolder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,37 +51,32 @@ enum enum_RecipeStatus



private Dictionary<RecipeDef, enum_RecipeStatus> Recipes {

get
private void RefreshRecipeList()
{
Recipes = new Dictionary<RecipeDef, enum_RecipeStatus>();
foreach (RecipeDef r in parrentDB.Learnable_Recipes)
{

Dictionary<RecipeDef, enum_RecipeStatus> lRecipes = new Dictionary<RecipeDef, enum_RecipeStatus>();
foreach (RecipeDef r in parrentDB.Learnable_Recipes)
if (parrentDB.Quered_Recipes.Contains(r))
{
if (parrentDB.Quered_Recipes.Contains(r))
{
lRecipes[r] = enum_RecipeStatus.Quered;
}else if (parrentDB.Recipe_Learning == r)
{
lRecipes[r] = enum_RecipeStatus.InPorogress;
}
else
{
lRecipes[r] = enum_RecipeStatus.Learnable;
}
Recipes[r] = enum_RecipeStatus.Quered;
}
foreach (RecipeDef r in parrentDB.Saved_Recipes)
else if (parrentDB.Recipe_Learning == r)
{
lRecipes[r] = enum_RecipeStatus.Saved;
Recipes[r] = enum_RecipeStatus.InPorogress;
}
else
{
Recipes[r] = enum_RecipeStatus.Learnable;
}

return lRecipes;
}


foreach (RecipeDef r in parrentDB.Saved_Recipes)
{
Recipes[r] = enum_RecipeStatus.Saved;
}
}

private Dictionary<RecipeDef, enum_RecipeStatus> Recipes;




Expand All @@ -100,7 +95,9 @@ public ITab_RecipeHolder()

private bool ShouldDrawRow(RecipeDef recipe, ref float curY, float ViewRecthight, float scrollY)
{

if (!showLearnable && Recipes[recipe] == enum_RecipeStatus.Learnable) return false;
if (!showQuered && Recipes[recipe] == enum_RecipeStatus.Quered) return false;
if (!showSaved && Recipes[recipe] == enum_RecipeStatus.Saved) return false;

//The item is above the view (including a safty margin of one item)
if ((curY + ROW_HIGHT - scrollY) < 0)
Expand All @@ -113,9 +110,7 @@ private bool ShouldDrawRow(RecipeDef recipe, ref float curY, float ViewRecthight
if ((curY - ROW_HIGHT - scrollY - ViewRecthight) < 0)
{

if (!showLearnable && Recipes[recipe] == enum_RecipeStatus.Learnable) return false;
if (!showQuered && Recipes[recipe] == enum_RecipeStatus.Quered) return false;
if (!showSaved && Recipes[recipe] == enum_RecipeStatus.Saved) return false;


return true;
}
Expand All @@ -131,6 +126,7 @@ private bool ShouldDrawRow(RecipeDef recipe, ref float curY, float ViewRecthight

protected override void FillTab()
{
RefreshRecipeList();

Listing_Standard list = new Listing_Standard();
Rect inRect = new Rect(0f, 0f, WinSize.x, WinSize.y).ContractedBy(10f);
Expand Down

0 comments on commit deba200

Please sign in to comment.