public void Hide(float time = 0, System.Action whenComplete = null) { this.tweener.Play(this.owner, time, true, delegate(float percentage){ if (this.widgets != null) { Util4NGUI.SetOpacity(this.widgets, 1 - percentage); } else if (this.button != null) { Util4NGUI.SetOpacity(this.button, 1 - percentage); } }, delegate(bool complete){ if (whenComplete != null) { whenComplete(); } }); }
public void FadeOut(float time = 0, System.Action whenComplete = null) { Color[] orgColors = null; if (this.widgets != null) { orgColors = new Color[this.widgets.Length]; for (var i = 0; i < orgColors.Length; ++i) { orgColors[i] = this.widgets[i].color; } } else if (this.button != null) { orgColors = new Color[1] { button.defaultColor }; } this.tweener.Play(this.owner, time, true, delegate(float percentage){ if (this.widgets != null) { for (var i = 0; i < orgColors.Length; ++i) { var w = this.widgets[i]; var c = orgColors[i]; c.a = (1f - percentage); Util4NGUI.SetColor(w, c); } } else if (this.button != null) { var c = orgColors[0]; c.a = (1f - percentage); Util4NGUI.SetColor(this.button, c); } }, delegate(bool complete){ if (whenComplete != null) { whenComplete(); } }); }