public void DispatchOnSingleRodPanelClick(SingleRodPanel rodPanel) { if (OnSingleRodPanelClick != null) { OnSingleRodPanelClick.Invoke(rodPanel); } }
private void InitRods() { if (rodTypesToInitialize != null && rodTypesToInitialize.Length > 0 && rodTypesToInitialize.Length.Equals(rodCategories.Length)) { for (int i = 0; i < rodTypesToInitialize.Length; i++) { GameObject textLabel = DisplayUtils.AddContentToParentObject(titleLabelRodPrefab, rodsToSelectTransform); textLabel.GetComponent <TextMeshProUGUI>().text = rodCategories[i]; GameObject gridPanel = DisplayUtils.AddContentToParentObject(rodGridPrefab, rodsToSelectTransform); for (int j = 0; j < rodTypesToInitialize[i]; j++) { GameObject singleRodObject = DisplayUtils.AddContentToParentObject(singleRodPrefab, gridPanel.transform); SingleRodPanel singleRodPanel = singleRodObject.GetComponent <SingleRodPanel>(); // always select first rod if (j == 0) { singleRodPanel.IsRodSelected = true; singleRodPanel.SelectedPanel.gameObject.SetActive(true); spawnedObject = ObjectPooler.Instance.SpawnFromPool(singleRodPanel.SelectedRodModel); } int randomIcon = Random.Range(0, rodIcons.Length); int randomFrame = Random.Range(0, rodFrames.Length); int randomName = Random.Range(0, rodNames.Length); int randomModel = Random.Range(0, rodModelsCount); int randomSliderValue = j == 0 ? 100 : Random.Range(0, 100); singleRodPanel.Create(rodIcons[randomIcon], rodFrames[randomFrame], rodNames[randomName], randomModel, randomSliderValue); createdRods.Add(singleRodPanel); } } } }
private void OnSingleRodPanelResponse(SingleRodPanel rod) { DeselectAllRods(); rod.IsRodSelected = true; rod.SelectedPanel.gameObject.SetActive(true); if (spawnedObject != null) { ObjectPooler.Instance.Despawn(spawnedObject); } spawnedObject = ObjectPooler.Instance.SpawnFromPool(rod.SelectedRodModel); }