void Awake() { if (ButtonColors == null) { ButtonColors = new UiInteractiveBackgroundObject(); } speed = ButtonColors.speed; targetColor = new Color(); switchColor(100, ButtonColors.normalColor); }
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); } }