Beispiel #1
0
        public void ImmediateWindow(int ID, Rect rect, WindowLayer layer, Action doWindowFunc, bool doBackground = true, bool absorbInputAroundWindow = false, float shadowAlpha = 1f)
        {
            if (Event.current.type != EventType.Repaint)
            {
                return;
            }
            if (ID == 0)
            {
                Log.Warning("Used 0 as immediate window ID.");
                return;
            }
            ID = -Math.Abs(ID);
            bool flag = false;

            for (int i = 0; i < windows.Count; i++)
            {
                if (windows[i].ID == ID)
                {
                    ImmediateWindow obj = (ImmediateWindow)windows[i];
                    obj.windowRect              = rect;
                    obj.doWindowFunc            = doWindowFunc;
                    obj.layer                   = layer;
                    obj.doWindowBackground      = doBackground;
                    obj.absorbInputAroundWindow = absorbInputAroundWindow;
                    obj.shadowAlpha             = shadowAlpha;
                    flag = true;
                    break;
                }
            }
            if (!flag)
            {
                AddNewImmediateWindow(ID, rect, layer, doWindowFunc, doBackground, absorbInputAroundWindow, shadowAlpha);
            }
            immediateWindowsRequests.Add(ID);
        }
 public void ImmediateWindow(int ID, Rect rect, WindowLayer layer, Action doWindowFunc, bool doBackground = true, bool absorbInputAroundWindow = false, float shadowAlpha = 1f)
 {
     if (Event.current.type == EventType.Repaint)
     {
         if (ID == 0)
         {
             Log.Warning("Used 0 as immediate window ID.", false);
         }
         else
         {
             ID = -Math.Abs(ID);
             bool flag = false;
             for (int i = 0; i < this.windows.Count; i++)
             {
                 if (this.windows[i].ID == ID)
                 {
                     ImmediateWindow immediateWindow = (ImmediateWindow)this.windows[i];
                     immediateWindow.windowRect              = rect;
                     immediateWindow.doWindowFunc            = doWindowFunc;
                     immediateWindow.layer                   = layer;
                     immediateWindow.doWindowBackground      = doBackground;
                     immediateWindow.absorbInputAroundWindow = absorbInputAroundWindow;
                     immediateWindow.shadowAlpha             = shadowAlpha;
                     flag = true;
                     break;
                 }
             }
             if (!flag)
             {
                 this.AddNewImmediateWindow(ID, rect, layer, doWindowFunc, doBackground, absorbInputAroundWindow, shadowAlpha);
             }
             this.immediateWindowsRequests.Add(ID);
         }
     }
 }
Beispiel #3
0
        private void AddNewImmediateWindow(int ID, Rect rect, WindowLayer layer, Action doWindowFunc, bool doBackground, bool absorbInputAroundWindow, float shadowAlpha)
        {
            if (ID >= 0)
            {
                Log.Error("Invalid immediate window ID.");
                return;
            }
            ImmediateWindow immediateWindow = new ImmediateWindow();

            immediateWindow.ID                      = ID;
            immediateWindow.layer                   = layer;
            immediateWindow.doWindowFunc            = doWindowFunc;
            immediateWindow.doWindowBackground      = doBackground;
            immediateWindow.absorbInputAroundWindow = absorbInputAroundWindow;
            immediateWindow.shadowAlpha             = shadowAlpha;
            immediateWindow.PreOpen();
            immediateWindow.windowRect = rect;
            InsertAtCorrectPositionInList(immediateWindow);
            FocusAfterInsertIfShould(immediateWindow);
            updateInternalWindowsOrderLater = true;
            immediateWindow.PostOpen();
        }