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)
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();
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;
}