public ResourceBubbleUI GetBubbleUI(ResourceManager.RESOURCES type) { foreach (GameObject resourceUI in m_ResourceUIList) { if (resourceUI.activeSelf) { continue; } ResourceBubbleUI resourceBubbleUI = resourceUI.GetComponent <ResourceBubbleUI>(); if (resourceBubbleUI == null) { continue; } return(resourceBubbleUI); } if (m_ResourceBubblePrefab == null) { return(null); } for (int i = 0; i < 5; ++i) { GameObject newResourceBubbleObj = Instantiate(m_ResourceBubblePrefab); newResourceBubbleObj.SetActive(false); m_ResourceUIList.Add(newResourceBubbleObj); } return(GetBubbleUI(type)); }
public void InitResourceBubbleUI(ResourceManager.RESOURCES type, int amt, Vector2 pos, ResourceBuildings resourceBuildingObj) { ResourceBubbleUI resourceBubble = GetBubbleUI(type); if (resourceBubble == null) { return; } if (m_ResourceSpriteStorage.ContainsKey(type)) { resourceBubble.Init(type, amt, pos, m_ResourceSpriteStorage[type], resourceBuildingObj); } }