public GameObject Show(UIMap.Id _viewId) { Loggr.Log("attempt to instantiate: " + _viewId.ToString()); if (resourceManager == null) { Debug.Log("NULLLLL"); } if (uiElements.ContainsKey(_viewId)) { Loggr.Log("already exist: " + _viewId.ToString()); return(uiElements[_viewId]); } var resourcePath = UIMap.GetPath(_viewId); var view = resourceManager.GetResource <GameObject>(resourcePath); var instance = GameObject.Instantiate(view as GameObject) as GameObject; instance.transform.SetParent(container.transform); instance.transform.localPosition = Vector3.zero; localeService.SetAllTexts(instance.gameObject); uiElements[_viewId] = instance; return(instance); }
public void Hide(UIMap.Id _viewId) { if (uiElements.ContainsKey(_viewId)) { GameObject.Destroy(uiElements[_viewId]); uiElements.Remove(_viewId); } }
public TViewClass Get <TViewClass>(UIMap.Id _viewId) { if (uiElements.ContainsKey(_viewId)) { return(uiElements[_viewId].GetComponent <TViewClass>()); } return(default(TViewClass)); }
public static string GetPath(UIMap.Id _id) { string path; if (!map.TryGetValue(_id, out path)) { throw new ArgumentException(string.Format("Undefined resource for UI id: {0}", _id.ToString())); } return(map[_id]); }
public TViewClass Show <TViewClass>(UIMap.Id _viewId) { var instance = Show(_viewId); return(instance.GetComponent <TViewClass>()); }