Наследование: UnityEngine.EventSystems.BaseRaycaster
Пример #1
0
 static public int set_blockingObjects(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         UnityEngine.UI.GraphicRaycaster.BlockingObjects v;
         v = (UnityEngine.UI.GraphicRaycaster.BlockingObjects)LuaDLL.luaL_checkinteger(l, 2);
         self.blockingObjects = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Пример #2
0
    protected static void CorrectFullScreenRendering(bool p_isTransition)
    {
        FocusContainer v_firstFullScreenRenderingContainer  = null;
        FocusContainer v_secondFullScreenRenderingContainer = null;

        foreach (FocusContainer v_container in FocusOrder)
        {
            if (v_container != null && v_container.FullScreenRendering)
            {
                v_container.CheckCanvasAndGraphicsRaycaster();
                Canvas v_canvas = v_container.GetComponent <Canvas>();
                UnityEngine.UI.GraphicRaycaster v_graphicsRayCaster = v_container.GetComponent <UnityEngine.UI.GraphicRaycaster>();
                if (v_firstFullScreenRenderingContainer == null)
                {
                    v_firstFullScreenRenderingContainer = v_container;
                }
                else if (p_isTransition && v_firstFullScreenRenderingContainer != null && v_secondFullScreenRenderingContainer == null)
                {
                    v_secondFullScreenRenderingContainer = v_container;
                }
                if (v_graphicsRayCaster != null)
                {
                    v_graphicsRayCaster.enabled = v_firstFullScreenRenderingContainer == v_container || v_secondFullScreenRenderingContainer == v_container;
                }
                if (v_canvas != null)
                {
                    v_canvas.enabled = v_firstFullScreenRenderingContainer == v_container || v_secondFullScreenRenderingContainer == v_container;
                }
            }
        }
    }
Пример #3
0
 static public int get_renderOrderPriority(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.renderOrderPriority);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Пример #4
0
 static public int Raycast(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.UI.GraphicRaycaster           self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> a2;
         checkType(l, 3, out a2);
         self.Raycast(a1, a2);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Пример #5
0
 protected virtual void CheckFocus(PanelStateEnum p_panelState)
 {
     if (p_panelState == PanelStateEnum.Opening || p_panelState == PanelStateEnum.Opened)
     {
         FocusContainer.SetFocus(this);
         FocusContainer.CorrectFullScreenRendering(p_panelState == PanelStateEnum.Opening);
     }
     else if (p_panelState == PanelStateEnum.Closing || p_panelState == PanelStateEnum.Closed)
     {
         FocusContainer.CorrectFullScreenRendering(p_panelState == PanelStateEnum.Closing);
         FocusContainer.RemoveFocus(this);
         if (p_panelState == PanelStateEnum.Closed)
         {
             //set Renderer To False Before Remove
             Canvas v_canvas = GetComponent <Canvas>();
             UnityEngine.UI.GraphicRaycaster v_graphicsRayCaster = GetComponent <UnityEngine.UI.GraphicRaycaster>();
             if (v_graphicsRayCaster != null)
             {
                 v_graphicsRayCaster.enabled = false;
             }
             if (v_canvas != null)
             {
                 v_canvas.enabled = false;
             }
         }
     }
 }
Пример #6
0
    public virtual void Show()
    {
        if (isShown)
        {
            return;
        }

        if (mCfg.type == 2)
        {
            //CoreEntry.gAudioMgr.PlayUISound(900001);
        }
        if (mCfg != null && mCfg.AnimationType == 2)
        {
            Transform ToggleGroup = this.transform.DeepFindChild("ToggleGroup");
            if (ToggleGroup != null)
            {
                if (GroupPos.x == -10000)
                {
                    RectTransform rectTrs = ToggleGroup.GetComponent <RectTransform>();
                    if (rectTrs != null)
                    {
                        GroupPos = rectTrs.anchoredPosition;
                    }
                }
                if (GroupPos.x != -10000)
                {
                    UIAnimationMgr.Instance.PlayAni(ToggleGroup.gameObject, null, 20, GroupPos.x, GroupPos.y);
                }
            }
        }


        LastShowTime = Time.time;
        isShown      = true;
        int        tmpLayer = LayerMask.NameToLayer("UI");
        GameObject obj      = this.gameObject;

        CommonTools.SetLayer(obj, tmpLayer);
        if (!obj.activeSelf)
        {
            obj.SetActive(true);
        }
        //gameObject.gameObject.SetActive(true);//.transform.SetRenderActive(true);
        UnityEngine.UI.GraphicRaycaster gray = this.GetComponent <UnityEngine.UI.GraphicRaycaster>();
        if (gray != null)
        {
            gray.enabled = true;
        }
        if (luaOnShow != null)
        {
            luaOnShow();
        }
        OnShow();

        if (!mCfg.ignoreguide)
        {
            EventParameter ep = EventParameter.Get(mPanelName);
            CoreEntry.gEventMgr.TriggerEvent(GameEvent.GE_UI_OPEN, ep);
        }
    }
Пример #7
0
    protected virtual void CheckCanvasAndGraphicsRaycaster()
    {
        Canvas v_canvas = GetComponent <Canvas>();

        UnityEngine.UI.GraphicRaycaster v_graphicsRayCaster = GetComponent <UnityEngine.UI.GraphicRaycaster>();
        if (!FullScreenRendering)
        {
            if (v_graphicsRayCaster != null)
            {
                KiltUtils.DestroyImmediate(v_graphicsRayCaster);
            }
            if (v_canvas != null)
            {
                KiltUtils.Destroy(v_canvas);
            }
        }
        else
        {
            if (v_canvas == null)
            {
                v_canvas = gameObject.AddComponent <Canvas>();
            }
            if (v_graphicsRayCaster == null)
            {
                v_graphicsRayCaster = gameObject.AddComponent <UnityEngine.UI.GraphicRaycaster>();
            }
        }
    }
Пример #8
0
 static public int set_ignoreReversedGraphics(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.ignoreReversedGraphics = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
 static public int set_ignoreReversedGraphics(IntPtr l)
 {
     UnityEngine.UI.GraphicRaycaster o = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
     System.Boolean v;
     checkType(l, 2, out v);
     o.ignoreReversedGraphics = v;
     return(0);
 }
Пример #10
0
 private void Awake()
 {
     masker.gameObject.SetActive(true);
     graphicRaycaster = GetComponentInChildren<GraphicRaycaster>();
     masker.enabled = true;
     masker.color = new Color(0,0,0,0);
     graphicRaycaster.enabled = false;
 }
 static public int set_blockingObjects(IntPtr l)
 {
     UnityEngine.UI.GraphicRaycaster o = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
     UnityEngine.UI.GraphicRaycaster.BlockingObjects v;
     checkEnum(l, 2, out v);
     o.blockingObjects = v;
     return(0);
 }
Пример #12
0
        void Awake()
        {
            m_Canvas = GetComponent<Canvas>();
            if (m_Canvas.worldCamera == null || m_Canvas.renderMode == RenderMode.ScreenSpaceOverlay) return;

            m_Raycaster = GetComponent<GraphicRaycaster>();
            SetCameraRaycaster();
        }
Пример #13
0
 private void Awake()
 {
     graphicRaycaster = GetComponentInChildren<GraphicRaycaster>();
     DontDestroyOnLoad(this);
     masker = GetComponentInChildren<Image>();
     masker.enabled = true;
     masker.color = new Color(0,0,0,0);
     graphicRaycaster.enabled = false;
 }
Пример #14
0
    void OnLoginAdvisor()
    {
        graphicRaycaster = GetComponentInChildren<GraphicRaycaster>();
        graphicRaycaster.enabled = true;

        panel.SetActive(true);
        panel.GetComponent<Animator>().updateMode = AnimatorUpdateMode.UnscaledTime;
        panel.GetComponent<Animator>().Play("PopupOn");
    }
Пример #15
0
        /// <summary>
        /// Gets the instances / pipeline connections needed for the concrete implementation
        /// </summary>
        protected override void Start()
        {
            Canvas = transform.GetOrAddComponent<Canvas>();
            Canvas.overrideSorting = true;
            GraphicRaycaster = transform.GetOrAddComponent<GraphicRaycaster>();
            CanvasGroup = transform.GetOrAddComponent<CanvasGroup>();

            base.Start();
        }
 static public int get_ignoreReversedGraphics(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         pushValue(l, self.ignoreReversedGraphics);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int get_eventCamera(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         pushValue(l, self.eventCamera);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #18
0
    /// <summary>
    /// Cast a ray to test if screenPosition is over any UI object in canvas. This is a replacement
    /// for IsPointerOverGameObject() which does not work on Android in 4.6.0f3
    /// </summary>
    public static bool IsPointerOverUIObject(Canvas canvas, Vector2 screenPosition)
    {
        UnityEngine.EventSystems.PointerEventData eventDataCurrentPosition = new UnityEngine.EventSystems.PointerEventData(UnityEngine.EventSystems.EventSystem.current);
        eventDataCurrentPosition.position = screenPosition;

        UnityEngine.UI.GraphicRaycaster uiRaycaster           = canvas.gameObject.GetComponent <UnityEngine.UI.GraphicRaycaster>();
        List <UnityEngine.EventSystems.RaycastResult> results = new List <UnityEngine.EventSystems.RaycastResult>();

        uiRaycaster.Raycast(eventDataCurrentPosition, results);
        return(results.Count > 0);
    }
 static public int get_renderOrderPriority(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         pushValue(l, self.renderOrderPriority);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #20
0
 // Use this for initialization
 void Awake()
 {
     gr = GameObject.Find("GUICanvas").GetComponent<GraphicRaycaster>();
     JustTapped = false;
     TapPos = Vector2.zero;
     NormalizedTapPos = Vector2.zero;
     TapLength = 0f;
     tapStart = Vector2.zero;
     tapStartTime = Time.time;
     pressing = false;
 }
 static public int get_blockingObjects(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         pushEnum(l, (int)self.blockingObjects);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #22
0
 static public int get_sortOrderPriority(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         pushValue(l, self.sortOrderPriority);
         return(1);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #23
0
 static public int get_defaultPriority(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.defaultPriority);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_blockingObjects(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         UnityEngine.UI.GraphicRaycaster.BlockingObjects v;
         checkEnum(l, 2, out v);
         self.blockingObjects = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int set_ignoreReversedGraphics(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         bool v;
         checkType(l, 2, out v);
         self.ignoreReversedGraphics = v;
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #26
0
    /// <summary>
    /// Cast a ray to test if screenPosition is over any UI object in canvas. This is a replacement
    /// for IsPointerOverGameObject() which does not work on Android in 4.6.0f3
    /// </summary>
    public static bool IsPointerOverUIObject(Canvas canvas, Vector2 screenPosition)
    {
        // Referencing this code for GraphicRaycaster https://gist.github.com/stramit/ead7ca1f432f3c0f181f
        // the ray cast appears to require only eventData.position.
        UnityEngine.EventSystems.PointerEventData eventDataCurrentPosition = new UnityEngine.EventSystems.PointerEventData(UnityEngine.EventSystems.EventSystem.current);
        eventDataCurrentPosition.position = screenPosition;

        UnityEngine.UI.GraphicRaycaster uiRaycaster           = canvas.gameObject.GetComponent <UnityEngine.UI.GraphicRaycaster>();
        List <UnityEngine.EventSystems.RaycastResult> results = new List <UnityEngine.EventSystems.RaycastResult>();

        uiRaycaster.Raycast(eventDataCurrentPosition, results);
        return(results.Count > 0);
    }
Пример #27
0
 static public int set_ignoreReversedGraphics(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         System.Boolean v;
         checkType(l, 2, out v);
         self.ignoreReversedGraphics = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Пример #28
0
    protected void Awake()
    {
        dictator       = FindObjectOfType <Wolf>();
        player         = FindObjectOfType <Llama>();
        fox            = FindObjectOfType <Fox>();
        playerControls = FindObjectOfType <UIPlayerControls>();
        playerControls.CardSelectedEvent += OnCardSelected;
        //newsHeadline = FindObjectOfType<UINewsHeadline>();
        newsHeadline.HeadlineResolvedEvent += OnHeadlineResolved;
        newsHeadline.gameObject.SetActive(false);
        graphicRaycaster = GetComponentInChildren <UnityEngine.UI.GraphicRaycaster>(true);

        sheepFlockTransform = GameObject.Find("SheepFlock").transform;
    }
 static public int Raycast(IntPtr l)
 {
     try {
         UnityEngine.UI.GraphicRaycaster           self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData a1;
         checkType(l, 2, out a1);
         System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> a2;
         checkType(l, 3, out a2);
         self.Raycast(a1, a2);
         return(0);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int Raycast(IntPtr l)
 {
     try{
         UnityEngine.UI.GraphicRaycaster           self = (UnityEngine.UI.GraphicRaycaster)checkSelf(l);
         UnityEngine.EventSystems.PointerEventData a1;
         checkType(l, 2, out a1);
         List <UnityEngine.EventSystems.RaycastResult> a2;
         checkType(l, 3, out a2);
         self.Raycast(a1, a2);
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
Пример #31
0
    private void CreateRootCanvas()
    {
        m_objRootCanvas = new GameObject();
        m_objRootCanvas.name = "RootCanvas";
        m_objRootCanvas.layer = GameLayer.UI;
        m_transRootCanvas = m_objRootCanvas.AddComponent<RectTransform>();
        m_compRootCanvas = m_objRootCanvas.AddComponent<Canvas>();
        m_compRootCanvasScaler = m_objRootCanvas.AddComponent<CanvasScaler>();
        m_compRootGraphicRaycaster = m_objRootCanvas.AddComponent<GraphicRaycaster>();
        m_compTicker = m_objRootCanvas.AddComponent<Ticker>();
        m_compTicker.onUpdate += OnTryOpenBufferedWindow;
        GameObject.DontDestroyOnLoad(m_objRootCanvas);

        m_compRootCanvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
        m_compRootCanvasScaler.referenceResolution = new Vector2(1920, 1080);
    }
 static int Raycast(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         UnityEngine.UI.GraphicRaycaster           obj  = (UnityEngine.UI.GraphicRaycaster)ToLua.CheckObject <UnityEngine.UI.GraphicRaycaster>(L, 1);
         UnityEngine.EventSystems.PointerEventData arg0 = (UnityEngine.EventSystems.PointerEventData)ToLua.CheckObject <UnityEngine.EventSystems.PointerEventData>(L, 2);
         System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult> arg1 = (System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>)ToLua.CheckObject(L, 3, typeof(System.Collections.Generic.List <UnityEngine.EventSystems.RaycastResult>));
         obj.Raycast(arg0, arg1);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
    static int get_ignoreReversedGraphics(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.GraphicRaycaster obj = (UnityEngine.UI.GraphicRaycaster)o;
            bool ret = obj.ignoreReversedGraphics;
            LuaDLL.lua_pushboolean(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index ignoreReversedGraphics on a nil value"));
        }
    }
    static int set_ignoreReversedGraphics(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.GraphicRaycaster obj = (UnityEngine.UI.GraphicRaycaster)o;
            bool arg0 = LuaDLL.luaL_checkboolean(L, 2);
            obj.ignoreReversedGraphics = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index ignoreReversedGraphics on a nil value"));
        }
    }
    static int get_renderOrderPriority(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.GraphicRaycaster obj = (UnityEngine.UI.GraphicRaycaster)o;
            int ret = obj.renderOrderPriority;
            LuaDLL.lua_pushinteger(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index renderOrderPriority on a nil value"));
        }
    }
    static int set_blockingObjects(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.GraphicRaycaster obj = (UnityEngine.UI.GraphicRaycaster)o;
            UnityEngine.UI.GraphicRaycaster.BlockingObjects arg0 = (UnityEngine.UI.GraphicRaycaster.BlockingObjects)ToLua.CheckObject(L, 2, typeof(UnityEngine.UI.GraphicRaycaster.BlockingObjects));
            obj.blockingObjects = arg0;
            return(0);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index blockingObjects on a nil value"));
        }
    }
    static int get_eventCamera(IntPtr L)
    {
        object o = null;

        try
        {
            o = ToLua.ToObject(L, 1);
            UnityEngine.UI.GraphicRaycaster obj = (UnityEngine.UI.GraphicRaycaster)o;
            UnityEngine.Camera ret = obj.eventCamera;
            ToLua.PushSealed(L, ret);
            return(1);
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e, o, "attempt to index eventCamera on a nil value"));
        }
    }
Пример #38
0
    public override void gaxb_init()
    {
        gameObject = new GameObject("<Canvas/>", typeof(RectTransform));

        canvas = gameObject.AddComponent<Canvas>();
        graphicRaycaster = gameObject.AddComponent<GraphicRaycaster>();

        if (renderMode == PlanetUnity2.CanvasRenderMode.ScreenSpaceOverlay)
            canvas.renderMode = RenderMode.ScreenSpaceOverlay;
        if (renderMode == PlanetUnity2.CanvasRenderMode.ScreenSpaceCamera) {
            canvas.renderMode = RenderMode.ScreenSpaceCamera;
            canvas.worldCamera = Camera.main;
        }
        if (renderMode == PlanetUnity2.CanvasRenderMode.WorldSpace)
            canvas.renderMode = RenderMode.WorldSpace;

        canvas.pixelPerfect = pixelPerfect;

        rectTransform = gameObject.transform as RectTransform;

        SetFrame (0, 0, 0, 0, 0, 0, "stretch,stretch");
    }
Пример #39
0
	// Methods
	//

	// Use this for initialization
	public virtual void Awake () {
		
		// Init the GraphicRaycaster
		if (this.GetComponent<GraphicRaycaster> () != null) {
			this.raycaster = this.GetComponent<GraphicRaycaster> ();
		} else {	
			this.raycaster = this.gameObject.AddComponent<GraphicRaycaster>();
		}
		
		// If this popup don't have a name ID, set it by it's game object name
		if (this.DialogID == "") {
			
			// Case this is an instantiated prefab, we don't want the (Clone) part of the title
			if(this.name.EndsWith("(Clone)")){
				this.DialogID = this.name.Substring(0, this.name.LastIndexOf("(Clone)"));
			}
			else{
				this.DialogID = this.name;
			}			
		}
		
	}
Пример #40
0
	// Methods
	//


	// Use this for initialization
	public virtual void Awake () {


		if (this.GetComponent<Canvas> () != null) {

			this.canvas = this.GetComponent<Canvas> ();
			
		} else
		// Auto init a canvas
		{

			this.canvas = this.gameObject.AddComponent<Canvas>();
			this.canvas.renderMode = RenderMode.ScreenSpaceOverlay;
		}

		// Init the GraphicRaycaster
		if (this.GetComponent<GraphicRaycaster> () != null) {
			this.raycaster = this.GetComponent<GraphicRaycaster> ();
		} else {	
			this.raycaster = this.gameObject.AddComponent<GraphicRaycaster>();
		}

		// If this screen don't have a name ID, set it by it's game object name
		if (this.ScreenID == "") {

			// Case this is an instantiated prefab, we don't want the (Clone) part of the title
			if(this.name.EndsWith("(Clone)")){
				this.ScreenID = this.name.Substring(0, this.name.LastIndexOf("(Clone)"));
			}
			else{
				this.ScreenID = this.name;
			}

		}

	}
Пример #41
0
    // Use this for initialization
    void Start()
    {
        _scroll_rect = gameObject.GetComponent<ScrollRect>();
        _raycaster = gameObject.GetComponent<GraphicRaycaster> ();
        _button = gameObject.GetComponent<Button> ();
        _scroll_rect.inertia = false;
        _lerp = false;

        _positions = new List<Vector3>();

        //		Debug.Log (Scrolled);

        if (Screens > 0) {
            for (int i = 0; i < Screens; ++i) {
                _scroll_rect.horizontalNormalizedPosition = (float)i / (float)(Screens - 1);
                _positions.Add (ScreensContainer.localPosition);
            }

            string CurrentLevelName = "";

            CurrentLevelName = Application.loadedLevelName;
        //		Debug.Log (CurrentLevelName);

            if (Line01 == true && CurrentLevelName == "Baseline_Scene_01") {
                DisableScrollbar ();
            }
            if (Line02 == true && CurrentLevelName == "Trion_Scene_01") {
                DisableScrollbar ();
            }
            if (Line03 == true && CurrentLevelName == "Flexline_Scene_01") {
                DisableScrollbar ();
            }
            if (Line04 == true && CurrentLevelName == "Simply_Scene_01") {
                DisableScrollbar ();
            }
            if (Line05 == true && CurrentLevelName == "Flipon_Scene_01") {
                DisableScrollbar ();
            }
            if (Line06 == true && CurrentLevelName == "Puron_Scene_01") {
                DisableScrollbar ();
            }
            if (Line07 == true && CurrentLevelName == "Firstline_Scene_01NEW") {
                DisableScrollbar ();
            }
            if (Line08 == true && CurrentLevelName == "Jump_Scene_01") {
                DisableScrollbar ();
            }
            if (Line09 == true && CurrentLevelName == "moduline_scene_01") {
                DisableScrollbar ();
            }
            if (Line10 == true && CurrentLevelName == "Europa_Scene_01") {
                DisableScrollbar ();
            }
        }

        _scroll_rect.horizontalNormalizedPosition = (float)(StartingScreen - 1) / (float)(Screens - 1);
    }
Пример #42
0
    // Use this for initialization
    void Start()
    {
        // Set the screen size
        GetComponent<CanvasScaler>().referenceResolution = ScreenData.GetScreenSize();

        // Initialize Components
        graphicRaycaster = GetComponent<GraphicRaycaster>();

        int creation = SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Level_Editor_Creation);
        if (creation == 1)
        {
            RefTileMap.CreateNew(SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Level_Editor_Row), SaveClass.GetPlayerPrefInt(SaveClass.Save_Keys.Key_Level_Editor_Col));
        }
        else if (creation == 0)
        {
            RefTileMap.Load(SaveClass.GetPlayerPrefString(SaveClass.Save_Keys.Key_Level));

            // Assign current values to editor UI
            MapName.text = RefTileMap.Name;
            var parameters = RefTileMap.ObjectiveParams.Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries);
            RefObjectiveParam.text = parameters[0];
        }
        else
        {
            Application.LoadLevel("MainMenuScene");
        }
    }
Пример #43
0
 // Use this for initialization
 private void Start()
 {
     DontDestroyOnLoad (gameObject);
     graphicRaycaster = gameObject.AddComponent<GraphicRaycaster>();
 }
Пример #44
0
	// Use this for initialization
	void Start () {
		//transform.position = FindObjectOfType<Camera>().ScreenToWorldPoint(new Vector3(Screen.width/5, Screen.height*4/5, 700));
		RC = GetComponent<UnityEngine.UI.GraphicRaycaster>();
	}
Пример #45
0
 void CloseOff()
 {
     graphicRaycaster = GetComponentInChildren<GraphicRaycaster>();
     panel.SetActive(false);
 }
Пример #46
0
    void OnSettings()
    {
        // SetLoginField(FB.IsLoggedIn);
        if(!Data.Instance.musicManager.disabled)
          Events.OnMusicVolumeChanged(0.2f);

        graphicRaycaster = GetComponentInChildren<GraphicRaycaster>();
        graphicRaycaster.enabled = true;

        panel.SetActive(true);
        panel.GetComponent<Animator>().updateMode = AnimatorUpdateMode.UnscaledTime;
        panel.GetComponent<Animator>().Play("PopupOn",0,0);
        timescale = Time.timeScale;
        Time.timeScale = 0;
    }
    // Use this for initialization
    void Start()
    {
        timer = 5;
        graphicRaycaster = GameObject.Find("Canvas").GetComponent<GraphicRaycaster>();
        //InterstitialRect = new Rect((Screen.width - InterstitialPortraitSize.x) / 2, (Screen.height - InterstitialPortraitSize.y) / 2, InterstitialPortraitSize.x, InterstitialPortraitSize.y);
        InterstitialRect = new Rect(0, 0, Screen.width, Screen.height);
        float CloseButtonWidth = Screen.width * 0.1f;
        AdCloseButtonRect = new Rect(Screen.width - CloseButtonWidth, 0, CloseButtonWidth, CloseButtonWidth);
        BackgroundTintRect = new Rect(-2, -2, Screen.width + 4, Screen.height + 4);
        m_PageNo = 1;
        BestScoreText.text = NotAvailable;
        RankText.text = NotAvailable;

        m_Online = !GotErrorDuringScoreUpdate;
        StartCoroutine(
            UIStateManager.GameAPI.GetPlayerRankDetail(
               UIStateManager.Manager.PlayerId,
               LeaderboardDetail.Id,
               OnGetRankDetails));

        if (GotErrorDuringScoreUpdate)
        {
            DoLeaderBoardToggle(false);
            LeaderboardToggle.interactable = false;
        }
        else
        {
            Refresh(true);
        }

        if (!LeaderboardDetail.Active)
        {
            PlayButton.interactable = false;
        }

        CurrentScoreObject.SetActive(true);
        WinningPlayersObject.SetActive(true);
        TournamentText.text = LeaderboardListScript.LeaderboardDetail.Name;
        TournamentValidity.text = UIStateManager.Manager.GetLeaderboardValidity(LeaderboardDetail, LeaderboardDetail.LifeTime / 60).ToString() +
            (LeaderboardDetail.Active ? "" : " Expired");

        UIStateManager.Manager.OnConnectionChange += Manager_OnConnectionChange;

        if (UIStateManager.Manager.ShowScore)
        {
            CurrentScoreObject.SetActive(true);
        }
        else
        {
            CurrentScoreObject.SetActive(false);
        }

        if (LeaderboardDetail.IsSponsored)
        {
            LoadInterstitial();
            drawAd = true;
        }

        #if UNITY_ANDROID || UNITY_IPHONE
        ShareButtonIcon.sprite = ShareIcon;
        #else
        ShareButtonIcon.sprite = MailIcon;
        #endif
    }