public void SetScale(WindowLayout.ScaleMode scaleMode, Vector2 fixedResolution, float matchWidthOrHeight) { this.ValidateCanvasScaler(); if (scaleMode == ScaleMode.Normal) { this.SetNoScale(); } else { this.canvasScaler.enabled = true; if (scaleMode == ScaleMode.Fixed) { this.canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; this.canvasScaler.screenMatchMode = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight; this.canvasScaler.matchWidthOrHeight = matchWidthOrHeight; this.canvasScaler.referenceResolution = new Vector2(fixedResolution.x, fixedResolution.y); } else if (scaleMode == ScaleMode.Custom) { // We should not do anything in canvasScaler } } }
public void SetScale(WindowLayout.ScaleMode scaleMode) { this.ValidateCanvasScaler(); if (scaleMode == ScaleMode.Normal) { this.SetNoScale(); } else { this.canvasScaler.enabled = true; if (scaleMode == ScaleMode.Fixed) { this.canvasScaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize; this.canvasScaler.screenMatchMode = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight; this.canvasScaler.matchWidthOrHeight = 0f; this.canvasScaler.referenceResolution = new Vector2(1024f, 768f); // TODO: Add to flow data settings } else if (scaleMode == ScaleMode.Custom) { // We should not do anything in canvasScaler } } }
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()); }
public void Init(float depth, int raycastPriority, int orderInLayer, WindowLayout.ScaleMode scaleMode) { if (this.initialized == false) { Debug.LogError("Can't initialize window instance because of some components was not installed properly."); return; } this.canvas.sortingOrder = orderInLayer; this.canvas.planeDistance = 10f; // * orderInLayer; this.canvas.worldCamera = this.GetWindow().workCamera; this.SetScale(scaleMode); for (int i = 0; i < this.elements.Count; ++i) { this.elements[i].Setup(this.GetWindow()); } }
public void SetLayoutPreferences(WindowLayout.ScaleMode scaleMode, Vector2 fixedScaleResolution, WindowLayoutPreferences layoutPreferences) { var matchWidthOrHeight = 0f; if (scaleMode == ScaleMode.Preferences) { var fixedScale = layoutPreferences.IsFixedScale(); if (fixedScale == true) { scaleMode = ScaleMode.Fixed; } else { scaleMode = ScaleMode.Normal; } fixedScaleResolution = layoutPreferences.GetFixedScaleResolution(); matchWidthOrHeight = layoutPreferences.GetMatchWidthOrHeight(); } this.SetScale(scaleMode, fixedScaleResolution, matchWidthOrHeight); }
public void Init(float depth, int raycastPriority, int orderInLayer, WindowLayout.ScaleMode scaleMode, Vector2 fixedScaleResolution) { 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); this.SetScale(scaleMode, fixedScaleResolution); for (int i = 0; i < this.elements.Count; ++i) { this.elements[i].Setup(this.GetWindow()); } this.root.Setup(this.GetWindow()); }