Пример #1
0
        public void ShowWnd(UIType t, object[] param = null)
        {
            UIWindowInfo info = null;

            if (mWindowInstanceList.ContainsKey(t))
            {
                UICache cache = mWindowInstanceList[t];
                mStackInstance.Push(cache.mInstance, cache.mInfo);
            }
            else
            {
                if (UIWindowConfig.WindowConfig.TryGetValue(t, out info))
                {
                    ResourcesManager.Instance.Load(t.ToString(), "UI", () =>
                    {
                        GameObject instan = ResourcesManager.Instance.GetResources <GameObject>(t.ToString());
                        instan            = NGUITools.AddChild(WindowRoot, instan);
                        mStackInstance.Push(instan, info);
                        UIBase owner = (UIBase)Activator.CreateInstance(info.Owner);
                        mWindowInstanceList.Add(t, new UICache(t, instan, info, owner));

                        owner.OnInit();
                        owner.OnParam(param);
                        owner.OnEnter();
                    });
                    //GameObject instan = UITools.LoadWnd( "Windows/" + info.GetResourcePath(), WindowRoot);//GameObject.Instantiate<GameObject>(Resources.Load<GameObject>(info.GetResourcePath()));
                }
                else
                {
                    Debug.Log(string.Format("WindowConfig Can't find type [{0}]", t.ToString()));
                }
            }
        }
Пример #2
0
        public void Push(GameObject obj, UIWindowInfo info)
        {
            StackData data = FindByType(info.Key);

            if (data == null)
            {
                data         = new StackData();
                data.mObject = obj;
                data.mInfo   = info;
                data.mOrder  = mListWindow.Count;
                mListWindow.Add(data);
            }

            StackChunk chunk;

            if (mChunkWindow.TryGetValue(info.WinType, out chunk))
            {
                OnPushTrigger(ref data);
                chunk.Push(data);
            }
            else
            {
                mListWindow.Remove(data);
                Debug.LogError(string.Format("Can't find chunk [{0}], Key [{1}]", info.WinType.ToString(), info.Key.ToString()));
            }
        }
Пример #3
0
 public UICache(UIType t, GameObject obj, UIWindowInfo info, UIBase owner)
 {
     mType     = t;
     mInfo     = info;
     mOwner    = owner;
     mInstance = obj;
 }
Пример #4
0
        public void Push( GameObject obj, UIWindowInfo info)
        {
            StackData data = FindByType(info.Key);
            if (data == null)
            {
                data = new StackData();
                data.mObject = obj;
                data.mInfo = info;
                data.mOrder = mListWindow.Count;
                mListWindow.Add(data);
            }

            StackChunk chunk;
            if ( mChunkWindow.TryGetValue( info.WinType, out chunk))
            {
                OnPushTrigger(ref data);
                chunk.Push(data);
            }
            else
            {
                mListWindow.Remove(data);
                Debug.LogError(string.Format("Can't find chunk [{0}], Key [{1}]", info.WinType.ToString(), info.Key.ToString()));
            }
           
        }