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> ExpandCollapseFirstPanel(bool shouldExpandPanel, TransactionSummaryFirstSubData selectedTransSubData, string parentKey, Dictionary <string, TransactionSummaryGameObjectList> transactionGameObjectDict) { if (!shouldExpandPanel) { transactionGameObjectDict.Remove(parentKey + "_" + selectedTransSubData.GetPrimaryKey()); } else { GameObject parentGameObject = transactionGameObjectDict[parentKey].GetParentGameObject(); transactionGameObjectDict.Remove(parentKey + "_" + selectedTransSubData.GetPrimaryKey()); GameObject selectedSubPanel = parentGameObject.transform.Find("FirstSubPanel_" + parentKey + "_" + selectedTransSubData.GetPrimaryKey()).gameObject; TransactionSummaryGameObjectList transactionGameObjects = new TransactionSummaryGameObjectList(parentKey + "_" + selectedTransSubData.GetPrimaryKey(), selectedSubPanel); transactionGameObjects.SetExpandedFlag(true); transactionGameObjectDict.Add(parentKey + "_" + selectedTransSubData.GetPrimaryKey(), transactionGameObjects); foreach (TransactionSummarySecondSubData tsSecondSubData in selectedTransSubData.GetTransactionSummarySecondSubDataList()) { GameObject tempSecondSubPanel = (GameObject)Instantiate(secondSubPanel, transform.position, transform.rotation); Transform[] ts = tempSecondSubPanel.transform.GetComponentsInChildren <Transform>(); tempSecondSubPanel.name = "SecondSubPanel_" + parentKey + "_" + selectedTransSubData.GetPrimaryKey() + "_" + tsSecondSubData.GetPrimaryKey(); foreach (Transform t in ts) { switch (t.gameObject.name) { case "SecondSubPanelMainText": t.gameObject.GetComponent <Text>().text = tsSecondSubData.GetPrimaryKey(); break; case "SecondSubPanelSubText": t.gameObject.GetComponent <Text>().text = ""; break; case "SecondSubPanelPrice": t.gameObject.GetComponent <Text>().text = "$" + tsSecondSubData.GetTotalPrice(); break; } } tempSecondSubPanel.SetActive(true); tempSecondSubPanel.transform.SetParent(selectedSubPanel.transform, false); transactionGameObjects.AddTransactionSummaryGameObject(tempSecondSubPanel); } } return(transactionGameObjectDict); }