public void SetCurrentNavType(NavType nav_type) { CurrentNavType = nav_type; AnchorCell = NavTypeHelper.GetAnchorCell(nav_type, Grid.PosToCell(this)); NavGrid.NavTypeData navTypeData = NavGrid.GetNavTypeData(CurrentNavType); KBatchedAnimController component = GetComponent <KBatchedAnimController>(); Vector2 one = Vector2.one; if (navTypeData.flipX) { one.x = -1f; } if (navTypeData.flipY) { one.y = -1f; } component.navMatrix = Matrix2x3.Translate(navTypeData.animControllerOffset * 200f) * Matrix2x3.Rotate(navTypeData.rotation) * Matrix2x3.Scale(one); }
public override Matrix2x3 GetTransformMatrix() { Vector3 v = base.PositionIncludingOffset; v.z = 0f; Vector2 scale = new Vector2(animScale * animWidth, (0f - animScale) * animHeight); if (materialType == KAnimBatchGroup.MaterialType.UI) { rt = GetComponent <RectTransform>(); if ((UnityEngine.Object)rootCanvas == (UnityEngine.Object)null) { rootCanvas = GetRootCanvas(); } if ((UnityEngine.Object)scaler == (UnityEngine.Object)null && (UnityEngine.Object)rootCanvas != (UnityEngine.Object)null) { scaler = rootCanvas.GetComponent <CanvasScaler>(); } if ((UnityEngine.Object)rootCanvas == (UnityEngine.Object)null) { screenOffset.x = (float)(Screen.width / 2); screenOffset.y = (float)(Screen.height / 2); } else { screenOffset.x = rootCanvas.rectTransform().rect.width / 2f; screenOffset.y = rootCanvas.rectTransform().rect.height / 2f; } float d = 1f; if ((UnityEngine.Object)scaler != (UnityEngine.Object)null) { d = 1f / scaler.scaleFactor; } v = (rt.localToWorldMatrix.MultiplyPoint(rt.pivot) + offset) * d - screenOffset; float num = animWidth * animScale; float num2 = animHeight * animScale; if (setScaleFromAnim && curAnim != null) { float num3 = num; Vector2 size = rt.rect.size; num = num3 * (size.x / curAnim.unScaledSize.x); float num4 = num2; Vector2 size2 = rt.rect.size; num2 = num4 * (size2.y / curAnim.unScaledSize.y); } else { float num5 = num; Vector2 size3 = rt.rect.size; num = num5 * (size3.x / animOverrideSize.x); float num6 = num2; Vector2 size4 = rt.rect.size; num2 = num6 * (size4.y / animOverrideSize.y); } Vector3 lossyScale = rt.lossyScale; float x = lossyScale.x * num; Vector3 lossyScale2 = rt.lossyScale; float y = (0f - lossyScale2.y) * num2; Vector3 lossyScale3 = rt.lossyScale; scale = new Vector3(x, y, lossyScale3.z); pivot = rt.pivot; } Matrix2x3 n = Matrix2x3.Scale(scale); Matrix2x3 n2 = Matrix2x3.Scale(new Vector2((!flipX) ? 1f : (-1f), (!flipY) ? 1f : (-1f))); if (rotation == 0f) { Matrix2x3 m = Matrix2x3.TRS(v, base.transform.rotation, base.transform.localScale); return(m * n * navMatrix * n2); } Matrix2x3 n3 = Matrix2x3.Translate(-pivot); Matrix2x3 n4 = Matrix2x3.Rotate(rotation * 0.0174532924f); Matrix2x3 m2 = Matrix2x3.Translate(pivot); Matrix2x3 n5 = m2 * n4 * n3; Matrix2x3 m3 = Matrix2x3.TRS(v, base.transform.rotation, base.transform.localScale); return(m3 * n5 * n * navMatrix * n2); }