Inheritance: UnityEngine.MonoBehaviour
Example #1
0
        /// <summary>
        ///
        /// </summary>
        public Stage()
            : base()
        {
            _inst       = this;
            soundVolume = 1;

            _updateContext     = new UpdateContext();
            stageWidth         = Screen.width;
            stageHeight        = Screen.height;
            _frameGotHitTarget = -1;

            _touches = new TouchInfo[5];
            for (int i = 0; i < _touches.Length; i++)
            {
                _touches[i] = new TouchInfo();
            }

            if (Application.platform == RuntimePlatform.WindowsPlayer ||
                Application.platform == RuntimePlatform.WindowsEditor ||
                Application.platform == RuntimePlatform.OSXPlayer ||
                Application.platform == RuntimePlatform.OSXEditor)
            {
                touchScreen = false;
            }
            else
            {
                touchScreen = Input.touchSupported && SystemInfo.deviceType != DeviceType.Desktop;
            }

            _rollOutChain  = new List <DisplayObject>();
            _rollOverChain = new List <DisplayObject>();

            onStageResized = new EventListener(this, "onStageResized");
            onTouchMove    = new EventListener(this, "onTouchMove");

            StageEngine engine = GameObject.FindObjectOfType <StageEngine>();

            if (engine != null)
            {
                Object.Destroy(engine.gameObject);
            }

            this.gameObject.name  = "Stage";
            this.gameObject.layer = LayerMask.NameToLayer(StageCamera.LayerName);
            this.gameObject.AddComponent <StageEngine>();
            this.gameObject.AddComponent <UIContentScaler>();
            this.gameObject.SetActive(true);
            Object.DontDestroyOnLoad(this.gameObject);

            this.cachedTransform.localScale = new Vector3(StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel);

            EnableSound();

            Timers.inst.Add(5, 0, RunTextureCollector);

#if UNITY_5_4_OR_NEWER
            SceneManager.sceneLoaded += SceneManager_sceneLoaded;
#endif
            _focusRemovedDelegate = OnFocusRemoved;
        }
Example #2
0
        public Stage()
            : base()
        {
            _inst       = this;
            soundVolume = 1;

            _updateContext     = new UpdateContext();
            stageWidth         = Screen.width;
            stageHeight        = Screen.height;
            _frameGotHitTarget = -1;

            touchScreen = Input.touchSupported;

            _touches = new TouchInfo[5];
            for (int i = 0; i < _touches.Length; i++)
            {
                _touches[i] = new TouchInfo();
            }

            if (!touchScreen)
            {
                _touches[0].touchId = 0;
            }

            _rollOutChain  = new List <DisplayObject>();
            _rollOverChain = new List <DisplayObject>();

            onStageResized = new EventListener(this, "onStageResized");
            onTouchMove    = new EventListener(this, "onTouchMove");

            StageEngine engine = GameObject.FindObjectOfType <StageEngine>();

            if (engine != null)
            {
                this.gameObject = engine.gameObject;
            }
            else
            {
                int layer = LayerMask.NameToLayer(StageCamera.LayerName);

                this.gameObject           = new GameObject("Stage");
                this.gameObject.hideFlags = HideFlags.None;
                this.gameObject.layer     = layer;
                this.gameObject.AddComponent <StageEngine>();
                this.gameObject.AddComponent <UIContentScaler>();
            }
            this.cachedTransform            = gameObject.transform;
            this.cachedTransform.localScale = new Vector3(StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel);
            this.gameObject.SetActive(true);
            UnityEngine.Object.DontDestroyOnLoad(this.gameObject);

            EnableSound();

            inputCaret  = new InputCaret();
            highlighter = new Highlighter();
        }
Example #3
0
 static public int get_ObjectTotal(IntPtr l)
 {
     try {
         FairyGUI.StageEngine self = (FairyGUI.StageEngine)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.ObjectTotal);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #4
0
 static public int set_ObjectOnStage(IntPtr l)
 {
     try {
         FairyGUI.StageEngine self = (FairyGUI.StageEngine)checkSelf(l);
         System.Int32         v;
         checkType(l, 2, out v);
         self.ObjectOnStage = v;
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #5
0
        /// <summary>
        ///
        /// </summary>
        public Stage()
            : base()
        {
            _inst       = this;
            soundVolume = 1;

            _updateContext     = new UpdateContext();
            stageWidth         = Screen.width;
            stageHeight        = Screen.height;
            _frameGotHitTarget = -1;

            if (Application.platform == RuntimePlatform.WindowsPlayer ||
                Application.platform == RuntimePlatform.WindowsPlayer ||
                Application.platform == RuntimePlatform.OSXPlayer ||
                Application.platform == RuntimePlatform.OSXEditor)
            {
                touchScreen = false;
            }
            else
            {
                touchScreen = Input.touchSupported;
            }

            _touches = new TouchInfo[5];
            for (int i = 0; i < _touches.Length; i++)
            {
                _touches[i] = new TouchInfo();
            }

            if (!touchScreen)
            {
                _touches[0].touchId = 0;
            }

            _rollOutChain  = new List <DisplayObject>();
            _rollOverChain = new List <DisplayObject>();

            onStageResized = new EventListener(this, "onStageResized");
            onTouchMove    = new EventListener(this, "onTouchMove");

            StageEngine engine = GameObject.FindObjectOfType <StageEngine>();

            if (engine != null)
            {
                this.gameObject = engine.gameObject;
            }
            else
            {
                int layer = LayerMask.NameToLayer(StageCamera.LayerName);

                this.gameObject           = new GameObject("Stage");
                this.gameObject.hideFlags = HideFlags.None;
                this.gameObject.layer     = layer;
                this.gameObject.AddComponent <StageEngine>();
                this.gameObject.AddComponent <UIContentScaler>();
            }
            this.cachedTransform            = gameObject.transform;
            this.cachedTransform.localScale = new Vector3(StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel);
            this.gameObject.SetActive(true);
            UnityEngine.Object.DontDestroyOnLoad(this.gameObject);

            EnableSound();

            if (touchScreen)
            {
#if !(UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR)
                _keyboard     = new FairyGUI.TouchScreenKeyboard();
                keyboardInput = true;
#endif
            }

            Timers.inst.Add(5, 0, RunTextureCollector);

#if UNITY_5_4_OR_NEWER
            SceneManager.sceneLoaded += SceneManager_sceneLoaded;
#endif
            _focusRemovedDelegate = OnFocusRemoved;
        }
Example #6
0
        public Stage(int layer, int cameraDepth)
            : base()
        {
            inst = this;
            defaultLayer = layer;
            soundVolume = 1;

            _updateContext = new UpdateContext();
            stageWidth = Screen.width;
            stageHeight = Screen.height;

            gameObject.name = "Stage";
            gameObject.hideFlags = HideFlags.None;
            gameObject.SetActive(true);
            _engine = gameObject.AddComponent<StageEngine>();
            Object.DontDestroyOnLoad(gameObject);

            _cameraObject = new GameObject("Camera");
            _cameraObject.hideFlags = HideFlags.None;
            _cameraObject.layer = defaultLayer;
            Object.DontDestroyOnLoad(_cameraObject);

            camera = _cameraObject.AddComponent<Camera>();
            camera.nearClipPlane = -8;
            camera.farClipPlane = 1;
            camera.depth = cameraDepth;
            camera.cullingMask = 1 << defaultLayer;
            camera.clearFlags = CameraClearFlags.Depth;
            camera.orthographic = true;
            camera.orthographicSize = 1;
            camera.transform.parent = cachedTransform;

            _halfPixelOffset = (Application.platform == RuntimePlatform.WindowsPlayer ||
                Application.platform == RuntimePlatform.XBOX360 ||
                Application.platform == RuntimePlatform.WindowsWebPlayer ||
                Application.platform == RuntimePlatform.WindowsEditor);

            // Only DirectX 9 needs the half-pixel offset
            if (_halfPixelOffset)
                _halfPixelOffset = (SystemInfo.graphicsShaderLevel < 40);

            if (Application.platform == RuntimePlatform.IPhonePlayer
                || Application.platform == RuntimePlatform.Android
                || Application.platform == RuntimePlatform.WP8Player)
                touchScreen = true;

            AdjustCamera();
            EnableSound();

            inputCaret = new InputCaret();
            highlighter = new Highlighter();

            _touches = new TouchInfo[5];
            for (int i = 0; i < _touches.Length; i++)
                _touches[i] = new TouchInfo();

            if (!touchScreen)
                _touches[0].touchId = 0;

            _rollOutChain = new List<DisplayObject>();
            _rollOverChain = new List<DisplayObject>();

            onStageResized = new EventListener(this, "onStageResized");
            onMouseMove = new EventListener(this, "onMouseMove");
            onPostUpdate = new EventListener(this, "onPostUpdate");
        }
Example #7
0
        public Stage()
            : base()
        {
            _inst       = this;
            soundVolume = 1;

            _updateContext     = new UpdateContext();
            stageWidth         = Screen.width;
            stageHeight        = Screen.height;
            _frameGotHitTarget = -1;

            touchScreen = Input.touchSupported;

            _touches = new TouchInfo[5];
            for (int i = 0; i < _touches.Length; i++)
            {
                _touches[i] = new TouchInfo();
            }

            if (!touchScreen)
            {
                _touches[0].touchId = 0;
            }

            _rollOutChain  = new List <DisplayObject>();
            _rollOverChain = new List <DisplayObject>();

            onStageResized = new EventListener(this, "onStageResized");
            onTouchMove    = new EventListener(this, "onTouchMove");
            onCopy         = new EventListener(this, "onCopy");
            onPaste        = new EventListener(this, "onPaste");

            StageEngine engine = GameObject.FindObjectOfType <StageEngine>();

            if (engine != null)
            {
                this.gameObject = engine.gameObject;
            }
            else
            {
                int layer = LayerMask.NameToLayer(StageCamera.LayerName);

                this.gameObject           = new GameObject("Stage");
                this.gameObject.hideFlags = HideFlags.None;
                this.gameObject.layer     = layer;
                this.gameObject.AddComponent <StageEngine>();
                this.gameObject.AddComponent <UIContentScaler>();
            }
            this.cachedTransform            = gameObject.transform;
            this.cachedTransform.localScale = new Vector3(StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel, StageCamera.UnitsPerPixel);
            this.gameObject.SetActive(true);
            UnityEngine.Object.DontDestroyOnLoad(this.gameObject);

            EnableSound();

            inputCaret  = new InputCaret();
            highlighter = new Highlighter();

            Timers.inst.Add(5, 0, RunTextureCollector);

#if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR
            CopyPastePatch.Apply();
#endif

#if UNITY_5_4_OR_NEWER
            SceneManager.sceneLoaded += SceneManager_sceneLoaded;
#endif
        }
Example #8
0
        public Stage(int layer, int cameraDepth)
            : base()
        {
            inst         = this;
            defaultLayer = layer;
            soundVolume  = 1;

            _updateContext = new UpdateContext();
            stageWidth     = Screen.width;
            stageHeight    = Screen.height;

            gameObject.name      = "Stage";
            gameObject.hideFlags = HideFlags.None;
            gameObject.SetActive(true);
            _engine = gameObject.AddComponent <StageEngine>();
            Object.DontDestroyOnLoad(gameObject);

            _cameraObject           = new GameObject("Camera");
            _cameraObject.hideFlags = HideFlags.None;
            _cameraObject.layer     = defaultLayer;
            Object.DontDestroyOnLoad(_cameraObject);

            camera = _cameraObject.AddComponent <Camera>();
            camera.nearClipPlane    = -8;
            camera.farClipPlane     = 1;
            camera.depth            = cameraDepth;
            camera.cullingMask      = 1 << defaultLayer;
            camera.clearFlags       = CameraClearFlags.Depth;
            camera.orthographic     = true;
            camera.orthographicSize = 1;
            camera.transform.parent = cachedTransform;

            _halfPixelOffset = (Application.platform == RuntimePlatform.WindowsPlayer ||
                                Application.platform == RuntimePlatform.XBOX360 ||
                                Application.platform == RuntimePlatform.WindowsWebPlayer ||
                                Application.platform == RuntimePlatform.WindowsEditor);

            // Only DirectX 9 needs the half-pixel offset
            if (_halfPixelOffset)
            {
                _halfPixelOffset = (SystemInfo.graphicsShaderLevel < 40);
            }

            if (Application.platform == RuntimePlatform.IPhonePlayer ||
                Application.platform == RuntimePlatform.Android ||
                Application.platform == RuntimePlatform.WP8Player)
            {
                touchScreen = true;
            }

            AdjustCamera();
            EnableSound();

            inputCaret  = new InputCaret();
            highlighter = new Highlighter();

            _touches = new TouchInfo[5];
            for (int i = 0; i < _touches.Length; i++)
            {
                _touches[i] = new TouchInfo();
            }

            if (!touchScreen)
            {
                _touches[0].touchId = 0;
            }

            _rollOutChain  = new List <DisplayObject>();
            _rollOverChain = new List <DisplayObject>();

            onStageResized = new EventListener(this, "onStageResized");
            onMouseMove    = new EventListener(this, "onMouseMove");
            onPostUpdate   = new EventListener(this, "onPostUpdate");
        }