public void SetLayoutPreferences(WindowLayout.ScaleMode scaleMode, Vector2 fixedScaleResolution, WindowLayoutPreferences layoutPreferences)
        {
            var matchWidthOrHeight = 0f;

            if (scaleMode == ScaleMode.Preferences)
            {
                var fixedScale = layoutPreferences.fixedScale;
                if (fixedScale == true)
                {
                    scaleMode = ScaleMode.Fixed;
                }
                else
                {
                    scaleMode = ScaleMode.Normal;
                }

                fixedScaleResolution = layoutPreferences.fixedScaleResolution;
                matchWidthOrHeight   = layoutPreferences.matchWidthOrHeight;
            }

            this.SetScale(scaleMode, fixedScaleResolution, matchWidthOrHeight);
        }
Exemplo n.º 2
0
        public void Init(float depth, int raycastPriority, int orderInLayer, WindowLayout.ScaleMode scaleMode, Vector2 fixedScaleResolution, WindowLayoutPreferences layoutPreferences)
        {
            if (this.initialized == false)
            {
                Debug.LogError("Can't initialize window instance because of some components was not installed properly.");
                return;
            }

            this.transform.localScale = Vector3.zero;

            this.canvas.sortingOrder  = orderInLayer;
            this.canvas.planeDistance = 10f;            // * orderInLayer;
            this.canvas.worldCamera   = this.GetWindow().workCamera;

            CanvasUpdater.ForceUpdate(this.canvas, this.canvasScaler);

            var matchWidthOrHeight = 0f;

            if (scaleMode == ScaleMode.Preferences)
            {
                var fixedScale = layoutPreferences.fixedScale;
                if (fixedScale == true)
                {
                    scaleMode = ScaleMode.Fixed;
                }
                else
                {
                    scaleMode = ScaleMode.Normal;
                }

                fixedScaleResolution = layoutPreferences.fixedScaleResolution;
                matchWidthOrHeight   = layoutPreferences.matchWidthOrHeight;
            }

            this.SetScale(scaleMode, fixedScaleResolution, matchWidthOrHeight);

            for (int i = 0; i < this.elements.Count; ++i)
            {
                this.elements[i].Setup(this.GetWindow());
                this.elements[i].SetComponentState(WindowObjectState.NotInitialized, dontInactivate: true);
            }

            this.root.Setup(this.GetWindow());
        }
Exemplo n.º 3
0
		public void Init(float depth, int raycastPriority, int orderInLayer, WindowLayout.ScaleMode scaleMode, Vector2 fixedScaleResolution, WindowLayoutPreferences layoutPreferences) {
			
			if (this.initialized == false) {
				
				Debug.LogError("Can't initialize window instance because of some components was not installed properly.");
				return;
				
			}
			
			this.transform.localScale = Vector3.zero;

			this.canvas.sortingOrder = orderInLayer;
			this.canvas.planeDistance = 10f;// * orderInLayer;
			this.canvas.worldCamera = this.GetWindow().workCamera;
			
			CanvasUpdater.ForceUpdate(this.canvas, this.canvasScaler);

			var matchWidthOrHeight = 0f;

			if (scaleMode == ScaleMode.Preferences) {

				var fixedScale = layoutPreferences.fixedScale;
				if (fixedScale == true) {

					scaleMode = ScaleMode.Fixed;

				} else {

					scaleMode = ScaleMode.Normal;

				}

				fixedScaleResolution = layoutPreferences.fixedScaleResolution;
				matchWidthOrHeight = layoutPreferences.matchWidthOrHeight;

			}

			this.SetScale(scaleMode, fixedScaleResolution, matchWidthOrHeight);

			for (int i = 0; i < this.elements.Count; ++i) {

				this.elements[i].Setup(this.GetWindow());
				this.elements[i].SetComponentState(WindowObjectState.NotInitialized, dontInactivate: true);

			}

			this.root.Setup(this.GetWindow());

		}