Skip to content

Commit 3d12824

Browse files
Merge branch 'master' of https://github.com/MinhPhu0304/iDesign into bugfix-filters
2 parents f6eb037 + 4786ee8 commit 3d12824

File tree

3 files changed

+15
-44
lines changed

3 files changed

+15
-44
lines changed

Assets/scripts/FilterTypeBehaviour.cs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ private void GenerateButtons(List<string> foundStrings)
3838
{
3939
foreach (string FoundCategory in foundStrings)
4040
{
41-
Debug.Log("Found "+FoundCategory);
42-
4341
GameObject FilterButton = Instantiate(TypePrefab);
4442

4543
FilterButton.GetComponentInChildren<Text>().text = FoundCategory;
@@ -51,9 +49,9 @@ private void GenerateButtons(List<string> foundStrings)
5149
if (ContentForScroll != null)
5250
{
5351
FilterButton.transform.SetParent(ContentForScroll.transform, false);
54-
Debug.Log("IF ACCESSED");
5552
}
56-
else {
53+
else
54+
{
5755
FilterButton.transform.SetParent(ParentPanel.transform, false);
5856
}
5957

@@ -66,8 +64,6 @@ private void ActivateFilter(GameObject ButtonPressed)
6664
string ButtonText = ButtonPressed.GetComponentInChildren<Text>().text;
6765

6866
GameObject SearchBox = GameObject.Find("InputField");
69-
Debug.Log(SearchBox);
70-
Debug.Log(ButtonText);
7167

7268
SearchBox.GetComponent<InputField>().text = ButtonText;
7369
CatalogueScript.showingItems = true;
@@ -83,10 +79,4 @@ private void SetButtonSize(GameObject Button)
8379
RectTransform rt = Button.GetComponent<RectTransform>();
8480
rt.sizeDelta = new Vector2(ParentPanel.GetComponent<RectTransform>().rect.width - SIDEGAP, HEIGHT);
8581
}
86-
87-
// Update is called once per frame
88-
void Update()
89-
{
90-
91-
}
9282
}

Assets/scripts/LoadCatalog.cs

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

Assets/scripts/SwitchToCameraScene.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ void Update()
1919

2020
public void SwitchToCamera()
2121
{
22-
SceneManager.LoadScene("ARScene");
22+
SceneManager.LoadScene("ARManipulation");
2323
}
2424
}

0 commit comments

Comments
 (0)