void Awake() { mapDisplay = GameObject.Find("MapDisplay").gameObject; gameAreaPanel = transform.Find("GameAreaPanel").gameObject; bottomBarPanel = transform.Find("BottomBarPanel").gameObject; gamePausedPanel = transform.Find("GamePausedPanel").gameObject; noInformationPanel = bottomBarPanel.transform.Find("SecondPhasePanel/NoInformationPanel").gameObject; colonyInformationPanel = bottomBarPanel.transform.Find("SecondPhasePanel/ColonyInformationPanel").gameObject; objectInformationPanel = bottomBarPanel.transform.Find("SecondPhasePanel/ObjectInformationPanel").gameObject; availableBoostersPanel = bottomBarPanel.transform.Find("SecondPhasePanel/AvailableBoostersPanel").gameObject; colonyActiveBoostersIcons = new GameObject[3]; colonyActiveBoostersIcons[0] = colonyInformationPanel.transform.Find("ActiveBoostersBackground/IronImg").gameObject; colonyActiveBoostersIcons[1] = colonyInformationPanel.transform.Find("ActiveBoostersBackground/MaskImg").gameObject; colonyActiveBoostersIcons[2] = colonyInformationPanel.transform.Find("ActiveBoostersBackground/ShieldImg").gameObject; availableBoostersIcons = new Text[4]; availableBoostersIcons[0] = availableBoostersPanel.transform.Find("IronImg/IronText").gameObject.GetComponent <Text>(); availableBoostersIcons[1] = availableBoostersPanel.transform.Find("MaskImg/MaskText").gameObject.GetComponent <Text>(); availableBoostersIcons[2] = availableBoostersPanel.transform.Find("ShieldImg/ShieldText").gameObject.GetComponent <Text>(); availableBoostersIcons[3] = availableBoostersPanel.transform.Find("QueenImg/QueenText").gameObject.GetComponent <Text>(); noInformationPanel.SetActive(true); colonyInformationPanel.SetActive(false); objectInformationPanel.SetActive(false); gamePausedPanel.SetActive(false); gameAreaPanel.SetActive(true); bottomBarPanel.SetActive(true); #if UNITY_IPHONE || UNITY_ANDROID bottomBarPanel.transform.Find("AvailableTermitesPanelMobile").gameObject.SetActive(true); bottomBarPanel.transform.Find("AvailableTermitesPanelDesktop").gameObject.SetActive(false); availableTermitesPanel = bottomBarPanel.transform.Find("AvailableTermitesPanelMobile").gameObject; termitesCounter = bottomBarPanel.transform.Find("AvailableTermitesPanelMobile/Number").GetComponent <Text>(); #else bottomBarPanel.transform.Find("AvailableTermitesPanelDesktop").gameObject.SetActive(true); bottomBarPanel.transform.Find("AvailableTermitesPanelMobile").gameObject.SetActive(false); availableTermitesPanel = bottomBarPanel.transform.Find("AvailableTermitesPanelDesktop").gameObject; termitesCounter = bottomBarPanel.transform.Find("AvailableTermitesPanelDesktop/Number").GetComponent <Text>(); #endif activeChallengeDisplay = bottomBarPanel.transform.Find("SecondPhasePanel/CurrentChallengePanel").gameObject.GetComponent <ChallengeDisplay>(); initChallengesList(); }
void displayChallenges(string jsondata) { var node = JSON.Parse(jsondata); int numChallenges = node[0].AsInt; int myID = PlayerPrefs.GetInt("playerid"); for (int i = 1; i <= numChallenges; i++) { if (node[i]["id"].AsInt != myID) //don't show the player's own challenge { GameObject newDisplay = Instantiate <GameObject>(displayPrefab); ChallengeDisplay display = newDisplay.GetComponent <ChallengeDisplay>(); display.SetDisplay(node[i]["name"], node[i]["wins"].AsInt, node[i]["losses"].AsInt, node[i]["draws"].AsInt); display.playerid = node[i]["id"].AsInt; newDisplay.transform.SetParent(contentPanel.transform); newDisplay.transform.localScale = new Vector3(1, 1, 1); //was getting set to 2.5 for some reason. no idea why... } } }
void Awake() { mapDisplay = GameObject.Find("MapDisplay").gameObject; gameAreaPanel = transform.Find("GameAreaPanel").gameObject; bottomBarPanel = transform.Find("BottomBarPanel").gameObject; gamePausedPanel = transform.Find("GamePausedPanel").gameObject; noInformationPanel = bottomBarPanel.transform.Find("SecondPhasePanel/NoInformationPanel").gameObject; colonyInformationPanel = bottomBarPanel.transform.Find("SecondPhasePanel/ColonyInformationPanel").gameObject; objectInformationPanel = bottomBarPanel.transform.Find("SecondPhasePanel/ObjectInformationPanel").gameObject; availableBoostersPanel = bottomBarPanel.transform.Find("SecondPhasePanel/AvailableBoostersPanel").gameObject; colonyActiveBoostersIcons = new GameObject[3]; colonyActiveBoostersIcons[0] = colonyInformationPanel.transform.Find("ActiveBoostersBackground/IronImg").gameObject; colonyActiveBoostersIcons[1] = colonyInformationPanel.transform.Find("ActiveBoostersBackground/MaskImg").gameObject; colonyActiveBoostersIcons[2] = colonyInformationPanel.transform.Find("ActiveBoostersBackground/ShieldImg").gameObject; availableBoostersIcons = new Text[4]; availableBoostersIcons[0] = availableBoostersPanel.transform.Find("IronImg/IronText").gameObject.GetComponent<Text>(); availableBoostersIcons[1] = availableBoostersPanel.transform.Find("MaskImg/MaskText").gameObject.GetComponent<Text>(); availableBoostersIcons[2] = availableBoostersPanel.transform.Find("ShieldImg/ShieldText").gameObject.GetComponent<Text>(); availableBoostersIcons[3] = availableBoostersPanel.transform.Find("QueenImg/QueenText").gameObject.GetComponent<Text>(); noInformationPanel.SetActive(true); colonyInformationPanel.SetActive(false); objectInformationPanel.SetActive(false); gamePausedPanel.SetActive(false); gameAreaPanel.SetActive(true); bottomBarPanel.SetActive(true); #if UNITY_IPHONE || UNITY_ANDROID bottomBarPanel.transform.Find("AvailableTermitesPanelMobile").gameObject.SetActive(true); bottomBarPanel.transform.Find("AvailableTermitesPanelDesktop").gameObject.SetActive(false); availableTermitesPanel = bottomBarPanel.transform.Find("AvailableTermitesPanelMobile").gameObject; termitesCounter = bottomBarPanel.transform.Find("AvailableTermitesPanelMobile/Number").GetComponent<Text>(); #else bottomBarPanel.transform.Find("AvailableTermitesPanelDesktop").gameObject.SetActive(true); bottomBarPanel.transform.Find("AvailableTermitesPanelMobile").gameObject.SetActive(false); availableTermitesPanel = bottomBarPanel.transform.Find("AvailableTermitesPanelDesktop").gameObject; termitesCounter = bottomBarPanel.transform.Find("AvailableTermitesPanelDesktop/Number").GetComponent<Text>(); #endif activeChallengeDisplay = bottomBarPanel.transform.Find("SecondPhasePanel/CurrentChallengePanel").gameObject.GetComponent<ChallengeDisplay>(); initChallengesList(); }