@@ -51,7 +51,9 @@ void Start()
5151 itemManager = GameObject . Find ( "Item Manager" ) . GetComponent < ItemManager > ( ) ;
5252
5353 loadedItems = itemManager . GetItemList ( ) ;
54- GenerateLists ( ) ;
54+
55+ GenerateAllListingFromItemManager ( ) ;
56+
5557 int listingNo = 0 ;
5658 foreach ( Item itemInList in loadedItems )
5759 {
@@ -81,9 +83,6 @@ void Start()
8183 listingNo ++ ;
8284 }
8385
84- Debug . Log ( $ "List<T>: { itemListings . Count } ") ;
85-
86-
8786 listingNo = 0 ;
8887 foreach ( string category in foundCategories )
8988 {
@@ -207,8 +206,6 @@ public void SearchCatalog()
207206 return ;
208207 }
209208
210- Debug . Log ( "Searching for: " + search ) ;
211-
212209 List < Item > searchResults = new List < Item > ( ) ;
213210
214211 foreach ( Item foundItem in loadedItems )
@@ -254,7 +251,7 @@ public void SearchCatalog()
254251
255252 }
256253
257- hideListings ( ) ;
254+ HideListings ( ) ;
258255
259256 foreach ( Item toShow in searchResults )
260257 {
@@ -263,7 +260,7 @@ public void SearchCatalog()
263260 }
264261
265262 //Hides all listings currently visible
266- private void hideListings ( )
263+ private void HideListings ( )
267264 {
268265 List < GameObject > listingsToHide = new List < GameObject > ( ) ;
269266
@@ -287,25 +284,22 @@ private void hideListings()
287284 //Shows listing that is passed in and updates visible/disabled lists
288285 private void showListing ( Item listing )
289286 {
290- Debug . Log ( $ "Looking for: Listing: { listing . GetItemID ( ) } { listing . GetName ( ) } ") ;
291-
292287 GameObject content = GameObject . Find ( "Content" ) ;
293- GameObject toShow = content . transform . Find ( $ "Listing: { listing . GetItemID ( ) } { listing . GetName ( ) } ") . gameObject ;
288+ GameObject itemFound = content . transform . Find ( $ "Listing: { listing . GetItemID ( ) } { listing . GetName ( ) } ") . gameObject ;
294289
295- toShow . SetActive ( true ) ;
290+ itemFound . SetActive ( true ) ;
296291
297- visibleListings . Add ( toShow ) ;
298- disabledListings . Remove ( toShow ) ;
292+ visibleListings . Add ( itemFound ) ;
293+ disabledListings . Remove ( itemFound ) ;
299294 UpdateItemManagerModels ( ) ;
300295 }
301296
302297 private void NavigateToInfoScene ( Item itemToShow )
303298 {
304- Debug . Log ( "Navigate to infoscene" ) ;
305299 itemSceneController . GetComponent < ItemDisplayPanelBehaviour > ( ) . SetCurrentItem ( itemToShow ) ;
306300 }
307301
308- private void GenerateLists ( )
302+ private void GenerateAllListingFromItemManager ( )
309303 {
310304 foreach ( Item item in loadedItems )
311305 {
@@ -314,11 +308,7 @@ private void GenerateLists()
314308
315309 foreach ( string category in itemCategories )
316310 {
317- if ( foundCategories . Contains ( category ) )
318- {
319- Debug . Log ( $ "Category { category } is already in foundCategories.") ;
320- }
321- else
311+ if ( ! foundCategories . Contains ( category ) )
322312 {
323313 foundCategories . Add ( category ) ;
324314 }
@@ -339,16 +329,13 @@ private void GenerateLists()
339329 foundCategories . Sort ( ) ;
340330 foundBrands . Sort ( ) ;
341331 foundDesigners . Sort ( ) ;
342-
343- var result = string . Join ( ", " , foundCategories . ToArray ( ) ) ;
344- Debug . Log ( $ "Categories loaded: { result } ") ;
345332 }
346333
347334 public void ChangeContentToCategory ( string category )
348335 {
349336 GameObject content = GameObject . Find ( "Content" ) ;
350337
351- hideListings ( ) ;
338+ HideListings ( ) ;
352339
353340 foreach ( Item itemInList in loadedItems )
354341 {
@@ -360,10 +347,4 @@ public void ChangeContentToCategory(string category)
360347 }
361348 showingItems = true ;
362349 }
363-
364- // Update is called once per frame
365- void Update ( )
366- {
367-
368- }
369350}
0 commit comments