public virtual void OpenWindow(UGUIWindowInfo windowInfo)
 {
     this.windowInfo        = windowInfo;
     this.windowInfo.window = this;
     windowState            = UGUIWindowStates.Open;
     windowTransform        = GetComponent <RectTransform>();
 }
Example #2
0
        /// <summary>
        /// 将窗口设置为焦点窗口(同级别下最靠前的窗口)
        /// </summary>
        /// <param name="windowName"></param>
        public void SetWindowAsFocusWindow(string windowName)
        {
            UGUIWindowInfo windowInfo = GetUGUIWindowInfoByName(windowName);

            if (windowInfo != null && windowInfo.window != null)
            {
                SetWindowAsLastWindow(windowInfo.window);
            }
        }
Example #3
0
        //系统调用方法
        public UGUIWindowBase CreateWindow(Type windowType)
        {
            UGUIWindowInfo windowInfo = GetUGUIWindowInfoByName(windowType.Name);

            if (windowInfo != null)
            {
                if (!windowInfo.UseAssetBundle)
                {
                    string     path          = windowInfo.PrefabsPath.ResourcesPath() + "/" + windowInfo.GameObjectName;
                    GameObject windowPrefabs = Resources.Load <GameObject>(path);
                    GameObject window        = null;
                    if (windowPrefabs != null)
                    {
                        switch (windowInfo.WindowType)
                        {
                        case UGUIWindowTypes.BottomStaticWindow:
                            window = Instantiate(windowPrefabs, UGUICanvas.GetChild(0));
                            break;

                        case UGUIWindowTypes.PopupWindow:
                            window = Instantiate(windowPrefabs, UGUICanvas.GetChild(1));
                            break;

                        case UGUIWindowTypes.TopStaticWindow:
                            window = Instantiate(windowPrefabs, UGUICanvas.GetChild(2));
                            break;
                        }

                        window.name = windowInfo.GameObjectName;
                        UGUIWindowBase prefabsWindowBase = window.GetComponent <UGUIWindowBase>();
                        prefabsWindowBase.OpenWindow(windowInfo);
                        return(prefabsWindowBase);
                    }
                    else
                    {
                        Debug.LogError("UGUIFrameworkCreateWindowError: 路径" + windowInfo.PrefabsPath + "下不存在窗体预制体" + windowInfo.GameObjectName);
                    }
                }
                else
                {
                    Debug.LogError("UGUIFrameworkCreateWindowError: 路径" + windowInfo.PrefabsPath + "下不存在窗体预制体" + windowInfo.GameObjectName);
                }
            }
            else
            {
                Debug.LogError("UGUIFrameworkCreateWindowError: 未找到名称为:" + windowType.Name + "的窗体信息!");
            }

            return(null);
        }
 public override void OpenWindow(UGUIWindowInfo windowInfo)
 {
     base.OpenWindow(windowInfo);
     windowTransform = GetComponent <RectTransform>();
     //在此处添加初始化窗口代码
 }