public Dictionary <string, TransactionSummaryGameObjectList> ExpandCollapseSecondPanel(bool shouldExpandPanel, TransactionSummarySecondSubData selectedTransSubData, string parentKey, Dictionary <string, TransactionSummaryGameObjectList> transactionGameObjectDict) { if (!shouldExpandPanel) { transactionGameObjectDict.Remove(parentKey + "_" + selectedTransSubData.GetPrimaryKey()); } else { transactionGameObjectDict.Remove(parentKey + "_" + selectedTransSubData.GetPrimaryKey()); GameObject parentGameObject = transactionGameObjectDict[parentKey].GetParentGameObject(); GameObject selectedSubPanel = parentGameObject.transform.Find("SecondSubPanel_" + parentKey + "_" + selectedTransSubData.GetPrimaryKey()).gameObject; TransactionSummaryGameObjectList transactionGameObjects = new TransactionSummaryGameObjectList(parentKey + "_" + selectedTransSubData.GetPrimaryKey(), selectedSubPanel); transactionGameObjects.SetExpandedFlag(true); transactionGameObjectDict.Add(parentKey + "_" + selectedTransSubData.GetPrimaryKey(), transactionGameObjects); foreach (TransactionSummarySubDetailsData tsSubDetailsData in selectedTransSubData.GetTransactionSummarySubDetailsData()) { GameObject tempThirdSubPanel = (GameObject)Instantiate(thirdSubPanel, transform.position, transform.rotation); Transform[] ts = tempThirdSubPanel.transform.GetComponentsInChildren <Transform>(); tempThirdSubPanel.name = "ThirdSubPanel_" + parentKey + "_" + selectedTransSubData.GetPrimaryKey() + "_" + tsSubDetailsData.GetPrimaryKey(); string firstSubPanelSubText = ""; bool shouldSubTextBeVisible = false; if (isOrderByDate) { firstSubPanelSubText = tsSubDetailsData.GetPrimaryKey().Substring(0, 1); shouldSubTextBeVisible = true; } foreach (Transform t in ts) { switch (t.gameObject.name) { case "ThirdSubPanelMainText": t.gameObject.GetComponent <Text>().text = tsSubDetailsData.GetPrimaryKey(); break; case "ThirdSubPanelSubTextImage": t.gameObject.GetComponent <Button>().GetComponentInChildren <Text>().text = firstSubPanelSubText; t.gameObject.GetComponent <Button>().gameObject.SetActive(shouldSubTextBeVisible); break; case "ThirdSubPanelPrice": t.gameObject.GetComponent <Text>().text = "$" + tsSubDetailsData.GetTotalPrice(); break; } } tempThirdSubPanel.SetActive(true); tempThirdSubPanel.transform.SetParent(selectedSubPanel.transform, false); transactionGameObjects.GetTransactionSummaryGameObjects().Add(tempThirdSubPanel); } } return(transactionGameObjectDict); }
public Dictionary <string, TransactionSummaryGameObjectList> ExpandCollapseBasePanel(bool shouldExpandPanel, TransactionSummaryData tsData, Dictionary <string, TransactionSummaryGameObjectList> transactionGameObjectDict) { TransactionSummaryGameObjectList transactionGameObjects = transactionGameObjectDict[tsData.GetPrimaryKey()]; transactionGameObjects.GetTransactionSummaryGameObjects().Clear(); GameObject parentGameObject = transactionGameObjects.GetParentGameObject(); GameObject expandCollapseButtonObject = parentGameObject.transform.GetComponentsInChildren <Button>()[1].gameObject; if (!shouldExpandPanel) { expandCollapseButtonObject.GetComponentInChildren <Text>().text = ">"; transactionGameObjects.SetExpandedFlag(false); } else { expandCollapseButtonObject.GetComponentInChildren <Text>().text = "v"; transactionGameObjects.SetExpandedFlag(true); foreach (TransactionSummaryFirstSubData tsFirstSubData in tsData.GetTransactionSummaryFirstSubDataList()) { GameObject tempFirstSubPanel = (GameObject)Instantiate(firstSubPanel, transform.position, transform.rotation); Transform[] ts = tempFirstSubPanel.transform.GetComponentsInChildren <Transform>(); tempFirstSubPanel.name = "FirstSubPanel_" + tsData.GetPrimaryKey() + "_" + tsFirstSubData.GetPrimaryKey(); foreach (Transform t in ts) { switch (t.gameObject.name) { case "FirstSubPanelMainText": t.gameObject.GetComponent <Text>().text = tsFirstSubData.GetPrimaryKey(); break; case "FirstSubPanelSubText": t.gameObject.GetComponent <Text>().text = ""; break; case "FirstSubPanelPrice": t.gameObject.GetComponent <Text>().text = "$" + tsFirstSubData.GetTotalPrice(); break; } } tempFirstSubPanel.SetActive(true); tempFirstSubPanel.transform.SetParent(parentGameObject.transform, false); transactionGameObjects.AddTransactionSummaryGameObject(tempFirstSubPanel); } } return(transactionGameObjectDict); }
public Dictionary <string, TransactionSummaryGameObjectList> ExpandCollapseThirdPanel( bool shouldExpandPanel, TransactionSummarySubDetailsData selectedTransSubData, string parentKey, Dictionary <string, TransactionSummaryGameObjectList> transactionGameObjectDict) { if (!shouldExpandPanel) { transactionGameObjectDict.Remove(parentKey + "_" + selectedTransSubData.GetPrimaryKey()); } else { transactionGameObjectDict.Remove(parentKey + "_" + selectedTransSubData.GetPrimaryKey()); GameObject parentGameObject = transactionGameObjectDict[parentKey].GetParentGameObject(); GameObject selectedSubPanel = parentGameObject.transform.Find("ThirdSubPanel_" + parentKey + "_" + selectedTransSubData.GetPrimaryKey()).gameObject; TransactionSummaryGameObjectList transactionGameObjects = new TransactionSummaryGameObjectList(parentKey + "_" + selectedTransSubData.GetPrimaryKey(), selectedSubPanel); transactionGameObjects.SetExpandedFlag(true); transactionGameObjectDict.Add(parentKey + "_" + selectedTransSubData.GetPrimaryKey(), transactionGameObjects); foreach (TransactionSummaryDetailsData tsDetailsData in selectedTransSubData.getTransactionSummaryDetailsData()) { GameObject tempTransactionsPanel = (GameObject)Instantiate(transactionsPanel, transform.position, transform.rotation); Transform[] ts = tempTransactionsPanel.transform.GetComponentsInChildren <Transform>(); tempTransactionsPanel.name = "TransactionsPanel_" + parentKey + "_" + selectedTransSubData.GetPrimaryKey() + "_" + tsDetailsData.GetPrimaryKey(); foreach (Transform t in ts) { switch (t.gameObject.name) { case "TransactionPanelMainText": t.gameObject.GetComponent <Text>().text = "Transaction #" + tsDetailsData.GetPrimaryKey() + ", " + tsDetailsData.GetTransactionTime() + " - $" + tsDetailsData.GetTotalPrice(); break; case "TransactionPanelSubText": t.gameObject.GetComponent <Text>().text = ""; break; } } tempTransactionsPanel.SetActive(true); tempTransactionsPanel.transform.SetParent(selectedSubPanel.transform, false); transactionGameObjects.GetTransactionSummaryGameObjects().Add(tempTransactionsPanel); } } return(transactionGameObjectDict); }