@@ -51,7 +51,7 @@ void Start()
5151 itemManager = GameObject . Find ( "Item Manager" ) . GetComponent < ItemManager > ( ) ;
5252
5353 loadedItems = itemManager . GetItemList ( ) ;
54- GenerateLists ( ) ;
54+ GenerateAllListingFromItemManager ( ) ;
5555 int listingNo = 0 ;
5656 foreach ( Item itemInList in loadedItems )
5757 {
@@ -81,9 +81,6 @@ void Start()
8181 listingNo ++ ;
8282 }
8383
84- Debug . Log ( $ "List<T>: { itemListings . Count } ") ;
85-
86-
8784 listingNo = 0 ;
8885 foreach ( string category in foundCategories )
8986 {
@@ -207,8 +204,6 @@ public void SearchCatalog()
207204 return ;
208205 }
209206
210- Debug . Log ( "Searching for: " + search ) ;
211-
212207 List < Item > searchResults = new List < Item > ( ) ;
213208
214209 foreach ( Item foundItem in loadedItems )
@@ -254,7 +249,7 @@ public void SearchCatalog()
254249
255250 }
256251
257- hideListings ( ) ;
252+ HideListings ( ) ;
258253
259254 foreach ( Item toShow in searchResults )
260255 {
@@ -263,7 +258,7 @@ public void SearchCatalog()
263258 }
264259
265260 //Hides all listings currently visible
266- private void hideListings ( )
261+ private void HideListings ( )
267262 {
268263 List < GameObject > listingsToHide = new List < GameObject > ( ) ;
269264
@@ -287,38 +282,30 @@ private void hideListings()
287282 //Shows listing that is passed in and updates visible/disabled lists
288283 private void showListing ( Item listing )
289284 {
290- Debug . Log ( $ "Looking for: Listing: { listing . GetItemID ( ) } { listing . GetName ( ) } ") ;
291-
292285 GameObject content = GameObject . Find ( "Content" ) ;
293- GameObject toShow = content . transform . Find ( $ "Listing: { listing . GetItemID ( ) } { listing . GetName ( ) } ") . gameObject ;
286+ GameObject itemFound = content . transform . Find ( $ "Listing: { listing . GetItemID ( ) } { listing . GetName ( ) } ") . gameObject ;
294287
295- toShow . SetActive ( true ) ;
288+ itemFound . SetActive ( true ) ;
296289
297- visibleListings . Add ( toShow ) ;
298- disabledListings . Remove ( toShow ) ;
290+ visibleListings . Add ( itemFound ) ;
291+ disabledListings . Remove ( itemFound ) ;
299292 UpdateItemManagerModels ( ) ;
300293 }
301294
302295 private void NavigateToInfoScene ( Item itemToShow )
303296 {
304- Debug . Log ( "Navigate to infoscene" ) ;
305297 itemSceneController . GetComponent < ItemDisplayPanelBehaviour > ( ) . SetCurrentItem ( itemToShow ) ;
306298 }
307299
308- private void GenerateLists ( )
300+ private void GenerateAllListingFromItemManager ( )
309301 {
310302 foreach ( Item item in loadedItems )
311303 {
312-
313304 List < string > itemCategories = item . GetCategories ( ) ;
314305
315306 foreach ( string category in itemCategories )
316307 {
317- if ( foundCategories . Contains ( category ) )
318- {
319- Debug . Log ( $ "Category { category } is already in foundCategories.") ;
320- }
321- else
308+ if ( ! foundCategories . Contains ( category ) )
322309 {
323310 foundCategories . Add ( category ) ;
324311 }
@@ -339,16 +326,13 @@ private void GenerateLists()
339326 foundCategories . Sort ( ) ;
340327 foundBrands . Sort ( ) ;
341328 foundDesigners . Sort ( ) ;
342-
343- var result = string . Join ( ", " , foundCategories . ToArray ( ) ) ;
344- Debug . Log ( $ "Categories loaded: { result } ") ;
345329 }
346330
347331 public void ChangeContentToCategory ( string category )
348332 {
349333 GameObject content = GameObject . Find ( "Content" ) ;
350334
351- hideListings ( ) ;
335+ HideListings ( ) ;
352336
353337 foreach ( Item itemInList in loadedItems )
354338 {
@@ -361,9 +345,4 @@ public void ChangeContentToCategory(string category)
361345 showingItems = true ;
362346 }
363347
364- // Update is called once per frame
365- void Update ( )
366- {
367-
368- }
369348}
0 commit comments