Exemplo n.º 1
0
        // CreateWindow is the manual way of creating a window.
        public static GameObject CreateWindow(int sizeX, int sizeY, BerryWindow windowType, bool spearateInstace = true, bool disableExitBg = false, bool skipInstanceRef = false)
        {
            // Disable scrolling. ( UiManager destroy all focus and BerryWindow will take care of re-enabling scrolling )
            if (ScenePrimer.curPrimerComponent.curZoomComp != null)
            {
                ScenePrimer.curPrimerComponent.curZoomComp.zoomingEnabled = false;
                ScenePrimer.curPrimerComponent.curZoomComp.mouseScroll    = 0;
            }

            ScenePrimer.curPrimerComponent.disableInput = true;

            // Create the window object and set it's parrent to be the target focus object.
            GameObject newWindow = new GameObject(windowType.windowTitleName);

            uiFocusInstance = UiManager.CreateUiFocusObj(spearateInstace, disableExitBg, true, windowType, false, skipInstanceRef);
            newWindow.transform.SetParent(uiFocusInstance.transform);
            windowType.isSepareateFocus = spearateInstace;


            // Create the actual window Object
            windowType.WindowCreate(sizeX, sizeY, newWindow);

            return(newWindow);
        }
Exemplo n.º 2
0
 public static GameObject CreateUiFocusObj(bool createSeparateFocusInstance = false, bool disabelBackBackground = false, bool fadeInAnimation = false, BerryWindow targetWindow = null, bool killInput = false, bool skipSystemRefrencerce = false)
 {
     if (createSeparateFocusInstance)
     {
         GameObject separateFocus = CreateCanvas("separateFocusCanvas", null, false, true, 10000, true, false);
         if (!disabelBackBackground)
         {
             /*
              *                  ScenePrimer.curPrimerComponent.disableInput = true;
              *                  GlobalToolManager.globalToolManager.disableInput = true;
              */
             GlobalToolManager.DisabelTools();
             UiInteractiveBackgroundObject focusBG = new UiInteractiveBackgroundObject();
             focusBG.uiSize       = new Vector2(0, 0);
             focusBG.normalColor  = new Color(0, 0, 0, 0.35f);
             focusBG.hoverColor   = new Color(0, 0, 0, 0.35f);
             focusBG.pressedColor = new Color(0, 0, 0, 0.35f);
             UiButtonObject focusBackgroundButton = new UiButtonObject();
             focusBackgroundButton.uiSize = new Vector2(0, 0);
             focusBackgroundButton.uiButtonBackgroundObject           = focusBG;
             focusBackgroundButton.uiButtonBackgroundObject.uiRayCast = true;
             focusBackgroundButton.uiButtonBackgroundObject.uiColor   = new Color(0, 0, 0, 0);
             focusBackgroundButton.uiButtonIcon = null;
             focusBackgroundButton.uiButtonBackgroundObject.uiAnchorMode = UiAnchorsMode.FillStretch;
             focusBackgroundButton.uiAnchorMode = UiAnchorsMode.FillStretch;
             GameObject defocusBg = CreateButton(separateFocus, focusBackgroundButton).gameObject;
             defocusBg.AddComponent <DefocusBtn>().focusInstanceObjRef = focusInstanceObj;
             defocusBg.GetComponent <DefocusBtn>().windowReference     = targetWindow;
             defocusBg.GetComponent <DefocusBtn>().killInput           = killInput;
         }
         if (!skipSystemRefrencerce)
         {
             addFocusSeparate(separateFocus);
         }
         return(separateFocus);
     }
     else
     {
         if (curFocusObj != null)
         {
             /*
              *                  if(fadeInAnimation)
              *                  {
              *                          curFocusObj.transform.parent.gameObject.AddComponent<QuickUiAnimator>().PlayFadeAnim(0, 1, false, true, 0.01f);
              *                  }else{
              *                          curFocusObj.SetActive(true);
              *                  }
              */
         }
         else
         {
             GameObject curFocus = CreateCanvas("FocusCanvas", null, false, true, 10000, true, false);
             focusInstanceObj = curFocus;
             if (!disabelBackBackground)
             {
                 /*
                  *                      ScenePrimer.curPrimerComponent.disableInput = true;
                  *                      GlobalToolManager.globalToolManager.disableInput = true;
                  */
                 GlobalToolManager.DisabelTools();
                 UiInteractiveBackgroundObject focusBG = new UiInteractiveBackgroundObject();
                 focusBG.uiSize       = new Vector2(0, 0);
                 focusBG.normalColor  = new Color(0, 0, 0, 0.35f);
                 focusBG.hoverColor   = new Color(0, 0, 0, 0.35f);
                 focusBG.pressedColor = new Color(0, 0, 0, 0.35f);
                 UiButtonObject focusBackgroundButton = new UiButtonObject();
                 focusBackgroundButton.uiSize = new Vector2(0, 0);
                 focusBackgroundButton.uiButtonBackgroundObject           = focusBG;
                 focusBackgroundButton.uiButtonBackgroundObject.uiColor   = new Color(0, 0, 0, 0);
                 focusBackgroundButton.uiButtonBackgroundObject.uiRayCast = true;
                 focusBackgroundButton.uiButtonIcon = null;
                 focusBackgroundButton.uiButtonBackgroundObject.uiAnchorMode = UiAnchorsMode.FillStretch;
                 focusBackgroundButton.uiAnchorMode = UiAnchorsMode.FillStretch;
                 GameObject defocusBg = CreateButton(curFocus, focusBackgroundButton).gameObject;
                 defocusBg.AddComponent <DefocusBtn>().focusInstanceObjRef = focusInstanceObj;
                 defocusBg.GetComponent <DefocusBtn>().windowReference     = targetWindow;
                 defocusBg.GetComponent <DefocusBtn>().killInput           = killInput;
             }
             curFocusObj = curFocus;
             if (fadeInAnimation)
             {
             }
             else
             {
                 curFocusObj.SetActive(true);
             }
             return(curFocus);
         }
         return(focusInstanceObj);
     }
 }