Example #1
0
 public void ShowWindow <T>(string packageName, string componentName) where T : WindowsBasePanel
 {
     if (_curWindow != null)
     {
         UIPanel panel = _curWindow.gameObject.GetComponent <UIPanel>();
         if (panel == null)
         {
             Debug.LogError("Error!!!");
         }
         else
         {
             string curPackageName   = panel.packageName;
             string curComponentName = panel.componentName;
             if (packageName == curPackageName)
             {
                 if (componentName == curComponentName)
                 {
                     Debug.LogError("窗口已经打开");
                     return;
                 }
                 else
                 {
                     panel.componentName = componentName;
                     panel.CreateUI();
                     DestroyImmediate(_curWindow);
                     _curWindow = panel.gameObject.AddComponent <T>();
                 }
             }
             else
             {
                 UIPackage.AddPackage("UI/" + packageName);
                 _curWindow.gameObject.SetActive(false);
                 _beforeWindow.Add(_curWindow);
                 _curWindow = AddUIPanel(packageName, componentName).AddComponent <T>();
             }
         }
     }
     else
     {
         _curWindow = AddUIPanel(packageName, componentName).AddComponent <T>();
     }
 }
Example #2
0
 private void ShowMainWindow <T>(eWindowsID windowId) where T : WindowsBasePanel
 {
     this.IsShowingWindow_ = true;
     if (this.CurShowingWindow_ != null)
     {
         if (this.CurShowingWindow_.WindowData_._id == (int)windowId)
         {
             this.IsShowingWindow_ = false;
             return;
         }
         else
         {
             CloseMainWindow((eWindowsID)this.CurShowingWindow_.WindowData_._id);
         }
     }
     if (this.DeletingWindowsDict_.ContainsKey(windowId))
     {
         this.CurShowingWindow_ = this.DeletingWindowsDict_[windowId];
         this.CurShowingWindow_.gameObject.SetActive(true);
         this.DeletingWindowsDict_.Remove(windowId);
     }
     else
     {
         UIWindowsData windowData   = ConfigData.Instance.UIWindowsDataDict_[(int)windowId];
         T             windowScript = AddChild <T>(this.gameObject);
         if (windowScript != null)
         {
             windowScript.gameObject.SetActive(true);
             windowScript.WindowData_ = windowData;
             this.CurShowingWindow_   = windowScript;
         }
         else
         {
             Debug.LogError("窗口[" + windowData._name + "] 创建失败,请检查预制路径或实例化是否成功。");
         }
     }
     this.IsShowingWindow_ = false;
 }
Example #3
0
 public void ShowMainWindow <T>(eWindowsID windowId) where T : WindowsBasePanel
 {
     this.IsShowingWindow_ = true;
     if (this.CurShowingWindow_ != null)
     {
         if (this.CurShowingWindow_.WindowID == windowId)
         {
             this.IsShowingWindow_ = false;
             return;
         }
         else
         {
             CloseMainWindow(this.CurShowingWindow_.WindowID);
         }
     }
     if (this.DeletingWindowsDict_.ContainsKey(windowId))
     {
         this.CurShowingWindow_ = this.DeletingWindowsDict_[windowId];
         this.CurShowingWindow_.gameObject.SetActive(true);
         this.DeletingWindowsDict_.Remove(windowId);
     }
     else
     {
         T windowScript = AddChild <T>(_centerRoot);
         if (windowScript != null)
         {
             windowScript.gameObject.SetActive(true);
             windowScript.WindowID  = windowId;
             this.CurShowingWindow_ = windowScript;
         }
         else
         {
             Debug.LogError("窗口[" + windowId.ToString() + "] 创建失败,请检查预制路径或实例化是否成功。");
         }
     }
     this.IsShowingWindow_ = false;
 }