private void InitRoot() { UIDisplayMode = AppConst.UIDisplayMode; GameObject go = new GameObject("Event System"); go.AddComponent <EventSystem>(); go.AddComponent <StandaloneInputModule>(); FixedWindowRoot = CreateGameObject(UIWindowRoot, UILayerConst.FixedRoot).transform; NormalWindowRoot = CreateUGUIRoot(UIWindowRoot, UILayerConst.NormalRoot).transform; PopupWindowRoot = CreateGameObject(UIWindowRoot, UILayerConst.PopupRoot).transform; GameUIRoot = CreateGameObject(UIWindowRoot, UILayerConst.GameUIRoot).transform; }
private void InitRoot() { UIDisplayMode = AppConst.UIDisplayMode; this.mGo = this.gameObject; this.mGo.name = UILayerConst.UIRoot; this.mGo.layer = LayerMask.NameToLayer(UILayerConst.ShowUILayer); this.UIWindowRoot = this.transform; UIRoot mRoot = this.mGo.AddComponent <UIRoot>(); mRoot.scalingStyle = UIRoot.Scaling.ConstrainedOnMobiles; mRoot.manualWidth = AppConst.AppContentWidth; mRoot.manualHeight = AppConst.AppContentHeight; mRoot.fitHeight = true; mRoot.fitWidth = false; GameObject camGo = CreateGameObject(UIWindowRoot, UILayerConst.Camera); this.UICamera = camGo.AddComponent <Camera>(); UICamera.clearFlags = CameraClearFlags.Depth; UICamera.depth = 2; UICamera.cullingMask = 5 << 5; UICamera.orthographic = true; UICamera.orthographicSize = 1; UICamera.farClipPlane = 200f; UICamera.nearClipPlane = -10f; UICamera.farClipPlane = 10f; camGo.AddComponent <UICamera>(); FixedWindowRoot = CreateGameObject(UIWindowRoot, UILayerConst.FixedRoot).transform; NormalWindowRoot = CreateGameObject(UIWindowRoot, UILayerConst.NormalRoot).transform; PopupWindowRoot = CreateGameObject(UIWindowRoot, UILayerConst.PopupRoot).transform; GameUIRoot = CreateGameObject(UIWindowRoot, UILayerConst.GameUIRoot).transform; }