/// <summary> /// Set the label's pivot to the left. /// </summary> protected void SetPivotToLeft() { Vector2 po = NGUIMath.GetPivotOffset(mPivot); po.x = 0f; label.pivot = NGUIMath.GetPivot(po); }
protected void SetPivotToRight() { Vector2 pivotOffset = NGUIMath.GetPivotOffset(mPivot); pivotOffset.x = 1f; label.pivot = NGUIMath.GetPivot(pivotOffset); }
protected void SetPivotToLeft() { Vector2 pivotOffset = NGUIMath.GetPivotOffset(this.mPivot); pivotOffset.x = 0.0f; this.label.pivot = NGUIMath.GetPivot(pivotOffset); }
protected void SetPivotToRight() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) Vector2 pivotOffset = NGUIMath.GetPivotOffset(mPivot); pivotOffset.x = 1f; label.pivot = NGUIMath.GetPivot(pivotOffset); }
/// <summary> /// Cache the transform and the panel. /// </summary> void Awake() { mTrans = transform; mPanel = GetComponent <UIPanel>(); if (mPanel.clipping == UIDrawCall.Clipping.None) { mPanel.clipping = UIDrawCall.Clipping.ConstrainButDontClip; } // Auto-upgrade if (movement != Movement.Custom && scale.sqrMagnitude > 0.001f) { if (scale.x == 1f && scale.y == 0f) { movement = Movement.Horizontal; } else if (scale.x == 0f && scale.y == 1f) { movement = Movement.Vertical; } else if (scale.x == 1f && scale.y == 1f) { movement = Movement.Unrestricted; } else { movement = Movement.Custom; customMovement.x = scale.x; customMovement.y = scale.y; } scale = Vector3.zero; #if UNITY_EDITOR NGUITools.SetDirty(this); #endif } // Auto-upgrade if (contentPivot == UIWidget.Pivot.TopLeft && relativePositionOnReset != Vector2.zero) { Vector2 vTemp = Vector2.zero; vTemp.x = relativePositionOnReset.x; vTemp.y = 1f - relativePositionOnReset.y; contentPivot = NGUIMath.GetPivot(vTemp); relativePositionOnReset = Vector2.zero; #if UNITY_EDITOR NGUITools.SetDirty(this); #endif } }
static public int GetPivot_s(IntPtr l) { try { UnityEngine.Vector2 a1; checkType(l, 1, out a1); var ret = NGUIMath.GetPivot(a1); pushValue(l, true); pushEnum(l, (int)ret); return(2); } catch (Exception e) { return(error(l, e)); } }
/// <summary> /// Cache the transform and the panel. /// </summary> void Awake() { mTrans = transform; originalLocalPosition = mTrans.localPosition; mPanel = GetComponent <UIPanel>(); maxMomentumAmount = new Vector3(0.01f * momentumAmount, 0.01f * momentumAmount, 0.01f * momentumAmount); if (mPanel.clipping == UIDrawCall.Clipping.None) { mPanel.clipping = UIDrawCall.Clipping.ConstrainButDontClip; } // Auto-upgrade if (movement != Movement.Custom && scale.sqrMagnitude > 0.001f) { // if (scale.x == 1f && scale.y == 0f) // { // movement = Movement.Horizontal; // } // else if (scale.x == 0f && scale.y == 1f) // { // movement = Movement.Vertical; // } // else if (scale.x == 1f && scale.y == 1f) // { // movement = Movement.Unrestricted; // } // else // { // movement = Movement.Custom; // customMovement.x = scale.x; // customMovement.y = scale.y; // } scale = Vector3.zero; #if UNITY_EDITOR NGUITools.SetDirty(this); #endif } // Auto-upgrade if (contentPivot == UIWidget.Pivot.TopLeft && relativePositionOnReset != Vector2.zero) { contentPivot = NGUIMath.GetPivot(new Vector2(relativePositionOnReset.x, 1f - relativePositionOnReset.y)); relativePositionOnReset = Vector2.zero; #if UNITY_EDITOR NGUITools.SetDirty(this); #endif } }
private void Awake() { this.mTrans = base.transform; this.mPanel = base.GetComponent <UIPanel>(); if (this.mPanel.clipping == UIDrawCall.Clipping.None) { this.mPanel.clipping = UIDrawCall.Clipping.ConstrainButDontClip; } if (this.movement != UIScrollView.Movement.Custom && this.scale.sqrMagnitude > 0.001f) { if (this.scale.x == 1f && this.scale.y == 0f) { this.movement = UIScrollView.Movement.Horizontal; } else { if (this.scale.x == 0f && this.scale.y == 1f) { this.movement = UIScrollView.Movement.Vertical; } else { if (this.scale.x == 1f && this.scale.y == 1f) { this.movement = UIScrollView.Movement.Unrestricted; } else { this.movement = UIScrollView.Movement.Custom; this.customMovement.x = this.scale.x; this.customMovement.y = this.scale.y; } } } this.scale = Vector3.zero; } if (this.contentPivot == UIWidget.Pivot.TopLeft && this.relativePositionOnReset != Vector2.zero) { this.contentPivot = NGUIMath.GetPivot(new Vector2(this.relativePositionOnReset.x, 1f - this.relativePositionOnReset.y)); this.relativePositionOnReset = Vector2.zero; } }
private void Awake() { mTrans = base.transform; mPanel = GetComponent <UIPanel>(); if (mPanel.clipping == UIDrawCall.Clipping.None) { mPanel.clipping = UIDrawCall.Clipping.ConstrainButDontClip; } if (movement != Movement.Custom && scale.sqrMagnitude > 0.001f) { if (scale.x == 1f && scale.y == 0f) { movement = Movement.Horizontal; } else if (scale.x == 0f && scale.y == 1f) { movement = Movement.Vertical; } else if (scale.x == 1f && scale.y == 1f) { movement = Movement.Unrestricted; } else { movement = Movement.Custom; customMovement.x = scale.x; customMovement.y = scale.y; } scale = Vector3.zero; } if (contentPivot == UIWidget.Pivot.TopLeft && relativePositionOnReset != Vector2.zero) { contentPivot = NGUIMath.GetPivot(new Vector2(relativePositionOnReset.x, 1f - relativePositionOnReset.y)); relativePositionOnReset = Vector2.zero; } }
public unsafe static long $Invoke20(long instance, long *args) { return(GCHandledObjects.ObjectToGCHandle(NGUIMath.GetPivot(*(*(IntPtr *)args)))); }
public virtual void Awake() { if (CoverFlow) { if (_CoverFlowCount != 0) { CoverFlowCount = _CoverFlowCount; } if (transform.childCount < CoverFlowCount + 1 || Alwaysreset) { int count = transform.childCount; for (int i = 0; i < count; i++) { DestroyImmediate(transform.GetChild(0).gameObject); } if (transform.parent.FindChild("Benchmark") == null) { GameObject Benchmark = Instantiate <GameObject>(Resources.Load("Benchmark") as GameObject); Benchmark.transform.name = "Benchmark"; Benchmark.transform.parent = transform.parent; Benchmark.transform.localScale = new Vector3(1, 1, 1); Benchmark.transform.localPosition = transform.localPosition; } if (transform.FindChild("BG") == null) { GameObject Front = Instantiate <GameObject>(Resources.Load("BG") as GameObject); Front.transform.name = "BG"; Front.transform.parent = transform; Front.transform.localScale = new Vector3(1, 1, 1); } BenchmarkSize = 720f; if (CoverFlowCount > 4) { if (CoverFlowCount == 5) { BenchmarkSize = 800f; } else { BenchmarkSize = 800f + (((float)CoverFlowCount - 5f) * 220f); } } transform.FindChild("BG").localPosition = new Vector3((Size.x * (CoverFlowCount - 1)) * 0.5f, ((MaxSize.y - 200) * 0.5f) + 20f); transform.FindChild("BG").GetComponent <BoxCollider2D>().size = new Vector2((Size.x * CoverFlowCount) + ((360 - (Size.x * 0.5f)) * 2f), MaxSize.y); transform.FindChild("BG").GetComponent <BoxCollider2D>().offset = new Vector2(0, 0); transform.FindChild("BG").GetComponent <UITexture>().SetRect((Size.x * CoverFlowCount) + ((360 - (Size.x * 0.5f)) * 2f), MaxSize.y); transform.parent.FindChild("Benchmark").GetComponent <BoxCollider2D>().size = new Vector2(BenchmarkSize, Size.y); transform.parent.FindChild("Benchmark").GetComponent <CoverFlowOndrag>().BenchmarkSize = BenchmarkSize; transform.parent.FindChild("Benchmark").GetComponent <CoverFlowOndrag>().DefaultSize = DefaultSize; transform.parent.FindChild("Benchmark").GetComponent <CoverFlowOndrag>().MaxSize = MaxSize; transform.parent.FindChild("Benchmark").GetComponent <CoverFlowOndrag>().Size = Size; transform.parent.FindChild("Benchmark").GetComponent <CoverFlowOndrag>().Gap = Gap; for (int i = 0; i < CoverFlowCount; i++) { //Debug.Log(CoverFlowCount); GameObject Temp = (GameObject)Instantiate(CoverFlowItem); Temp.transform.FindChild("CoverFlowItem").tag = "item"; Temp.transform.name = "Item " + i.ToString(); Temp.transform.parent = transform; Temp.transform.localScale = new Vector3(1, 1, 1); Temp.transform.localPosition = new Vector3(Size.x * i, ((MaxSize.y - 200) * 0.5f) + 20f); Temp.transform.FindChild("CoverFlowItem").GetComponent <UITexture>().SetRect(DefaultSize.x, DefaultSize.y); if (Temp.transform.FindChild("CoverFlowItem").GetComponent <UIDragScrollView>() == null) { Temp.transform.FindChild("CoverFlowItem").gameObject.AddComponent <UIDragScrollView>(); } if (Temp.transform.FindChild("CoverFlowItem").GetComponent <BoxCollider2D>() == null) { Temp.transform.FindChild("CoverFlowItem").gameObject.AddComponent <BoxCollider2D>(); } Temp.transform.FindChild("CoverFlowItem").GetComponent <BoxCollider2D>().size = DefaultSize; Temp.transform.FindChild("CoverFlowItem").GetComponent <UITexture>().SetRect(DefaultSize.x, DefaultSize.y); Temp.transform.GetComponent <UIPanel>().SetRect(DefaultSize.x, DefaultSize.y); Temp.transform.FindChild("CoverFlowItem").FindChild("BG").GetComponent <UISprite>().SetRect(DefaultSize.x, DefaultSize.y); if (i >= CoverFlowCount - (int)Mathf.Round((float)(CoverFlowCount - 3) * 0.5f)) { int num = CoverFlowCount - (int)Mathf.Round((float)(CoverFlowCount - 3) * 0.5f); Temp.transform.name = "Item " + (num - (i + 1)).ToString(); Temp.transform.localPosition = new Vector3(Size.x * (num - (i + 1)), ((MaxSize.y - 200) * 0.5f) + 20f); } } } } mTrans = transform; mPanel = GetComponent <UIPanel>(); if (mPanel.clipping == UIDrawCall.Clipping.None) { mPanel.clipping = UIDrawCall.Clipping.ConstrainButDontClip; } // Auto-upgrade if (movement != Movement.Custom && scale.sqrMagnitude > 0.001f) { if (scale.x == 1f && scale.y == 0f) { movement = Movement.Horizontal; } else if (scale.x == 0f && scale.y == 1f) { movement = Movement.Vertical; } else if (scale.x == 1f && scale.y == 1f) { movement = Movement.Unrestricted; } else { movement = Movement.Custom; customMovement.x = scale.x; customMovement.y = scale.y; } scale = Vector3.zero; #if UNITY_EDITOR NGUITools.SetDirty(this); #endif } // Auto-upgrade if (contentPivot == UIWidget.Pivot.TopLeft && relativePositionOnReset != Vector2.zero) { contentPivot = NGUIMath.GetPivot(new Vector2(relativePositionOnReset.x, 1f - relativePositionOnReset.y)); relativePositionOnReset = Vector2.zero; #if UNITY_EDITOR NGUITools.SetDirty(this); #endif } }