public void CheckWidgetDepth(Transform tm) { this._gameObjectList.Clear(); GameObject gameObject = tm.gameObject; while (!gameObject.activeInHierarchy) { if (!gameObject.activeSelf) { this._gameObjectList.Add(gameObject); } gameObject.SetActive(true); gameObject = gameObject.transform.parent.gameObject; } UIWidget component = tm.GetComponent <UIWidget>(); if (component != null) { if (!tm.GetComponent <DepthControllerHash>()) { DepthControllerHash depthControllerHash = tm.gameObject.AddComponent <DepthControllerHash>(); depthControllerHash.originDepth = component.depth; if (!this._childWidget.ContainsKey(depthControllerHash.originDepth)) { this._childWidget.Add(depthControllerHash.originDepth, new List <UIWidget>()); } this._childWidget[depthControllerHash.originDepth].Add(component); } this._minValue = Mathf.Min(this._minValue, component.depth); this._maxValue = Mathf.Max(this._maxValue, component.depth); } foreach (GameObject gameObject2 in this._gameObjectList) { gameObject2.SetActive(false); } IEnumerator enumerator2 = tm.GetEnumerator(); try { while (enumerator2.MoveNext()) { object obj = enumerator2.Current; Transform tm2 = (Transform)obj; this.CheckWidgetDepth(tm2); } } finally { IDisposable disposable; if ((disposable = (enumerator2 as IDisposable)) != null) { disposable.Dispose(); } } }
public void SetWidgetManualDepth(Transform tm, int depth) { this.InitWidgetDepth(tm); List <int> list = new List <int>(this._childWidget.Keys); for (int i = 0; i < list.Count; i++) { int key = list[i]; for (int j = 0; j < this._childWidget[key].Count; j++) { int num = this._maxValue - this._minValue; DepthControllerHash component = this._childWidget[key][j].GetComponent <DepthControllerHash>(); this._childWidget[key][j].manualDepth = num * depth + component.originDepth; this._childWidget[key][j].SetDepthFromManualDepth(); } } }
public void ApplySkin() { switch (this._uiSkinnerPartsType) { case UISkinnerPartsType.NGUISpriteColor: if (this._uiBasicSprite != null) { this._uiBasicSprite.color = this._uiBasicSpriteColor; this.EditorApply(this._uiBasicSprite); } break; case UISkinnerPartsType.NGUIWidgetAlpha: if (this._uiWidget != null) { this._uiWidget.alpha = this._alpha; this.EditorApply(this._uiWidget); } break; case UISkinnerPartsType.NGUIAnimatedAlpha: if (this._animatedAlpha != null) { this._animatedAlpha.alpha = this._alpha; this.EditorApply(this._animatedAlpha); } break; case UISkinnerPartsType.SpriteSkinner: if (this._spriteSkinner != null) { this._spriteSkinner.value = this._skinnerIndex; this.EditorApply(this._spriteSkinner); } break; case UISkinnerPartsType.UISkinnerToggle: if (this._skinnerToggle != null) { this._skinnerToggle.value = this._setActive; } break; case UISkinnerPartsType.NGUILabelStyle: if (this._uiLabel != null) { this._uiLabel.fontSize = this._uiLabelFontSize; this._uiLabel.fontStyle = this._uiLabelFontStyle; this.EditorApply(this._uiLabel); } break; case UISkinnerPartsType.NGUILabelText: if (this._uiLabel != null) { this._uiLabel.text = this._uiLabelText; this.EditorApply(this._uiLabel); } break; case UISkinnerPartsType.NGUILabelColor: if (this._uiLabel != null) { this._uiLabel.color = this._uiLabelColor; this._uiLabel.applyGradient = this._uiLabelUseGradient; this._uiLabel.gradientTop = this._uiLabelGradientTopColor; this._uiLabel.gradientBottom = this._uiLabelGradientBottomColor; this.EditorApply(this._uiLabel); } break; case UISkinnerPartsType.NGUILabelEffect: if (this._uiLabel != null) { this._uiLabel.effectStyle = this._uiLabelEffectStyle; this._uiLabel.effectColor = this._uiLabelEffectColor; this._uiLabel.effectDistance = this._uiLabelEffectDistance; this.EditorApply(this._uiLabel); } break; case UISkinnerPartsType.ScreenPosition: if (this._uiScreenPosition != null) { this._uiScreenPosition.SetScreenPosition(this._uiScreenPositionIndex); } break; case UISkinnerPartsType.NGUILabelFont: if (this._uiLabel != null) { if (!this._useUnityFont && this._uiLabelNguiFont != null) { this._uiLabel.bitmapFont = this._uiLabelNguiFont; } if (this._useUnityFont && this._uiLabelUnityFont != null) { this._uiLabel.trueTypeFont = this._uiLabelUnityFont; } this.EditorApply(this._uiLabel); } break; case UISkinnerPartsType.TextReplacer: if (this._uiTextReplacer != null) { this._uiTextReplacer.value = this._replacerIndex; this._uiTextReplacer.Apply(); } break; case UISkinnerPartsType.ObjectsSetActive: if (this._gameObjects != null) { foreach (GameObject gameObject in this._gameObjects) { if (gameObject != null) { NGUITools.SetActiveSelf(gameObject, this._setActive); } } } break; case UISkinnerPartsType.WidgetDepth: if (this._uiWidget != null) { if (this.parentUIWidget == null) { this.parentUIWidget = this._uiWidget.transform.parent.GetComponent <UIWidget>(); } this._uiWidget.depth = this.parentUIWidget.depth + this._depth; DepthControllerHash component = this._uiWidget.GetComponent <DepthControllerHash>(); component.originDepth = this._depth; this._uiWidget.Update(); this.EditorApply(this._uiWidget); } break; case UISkinnerPartsType.MaterialSwicher: if (this._materialSwicher != null) { this._materialSwicher.value = this._materialSwicherIndex; this._materialSwicher.Apply(); } break; case UISkinnerPartsType.MaterialSwichers: if (this._materialSwicher != null) { foreach (UIMaterialSwitcherBase uimaterialSwitcherBase in this._materialSwithcers) { uimaterialSwitcherBase.value = this._materialSwicherIndex; uimaterialSwitcherBase.Apply(); } } break; default: if (this._gameObject != null) { NGUITools.SetActiveSelf(this._gameObject, this._setActive); this.EditorApply(this._gameObject); } break; } }