コード例 #1
0
        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);
        }
コード例 #2
0
ファイル: UIManager.cs プロジェクト: concretemixer/MiniGolf
 public void Hide(UIMap.Id _viewId)
 {
     if (uiElements.ContainsKey(_viewId))
     {
         GameObject.Destroy(uiElements[_viewId]);
         uiElements.Remove(_viewId);
     }
 }
コード例 #3
0
ファイル: UIManager.cs プロジェクト: concretemixer/MiniGolf
 public TViewClass Get <TViewClass>(UIMap.Id _viewId)
 {
     if (uiElements.ContainsKey(_viewId))
     {
         return(uiElements[_viewId].GetComponent <TViewClass>());
     }
     return(default(TViewClass));
 }
コード例 #4
0
ファイル: UIMap.cs プロジェクト: concretemixer/Traffic
        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]);
        }
コード例 #5
0
ファイル: UIManager.cs プロジェクト: concretemixer/MiniGolf
        public TViewClass Show <TViewClass>(UIMap.Id _viewId)
        {
            var instance = Show(_viewId);

            return(instance.GetComponent <TViewClass>());
        }