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
}