private IEnumerator FadeAll(NewImageEffect effect, Action callback, bool includeBack, bool includeDiabox) { Dictionary <int, float> originAlpha = new Dictionary <int, float>(); foreach (int i in GetDepthNum()) { UI2DSprite ui = GetSpriteByDepth(i); originAlpha[i] = ui.alpha; } if (includeBack) { originAlpha[-1] = bgSprite.alpha; } if (includeDiabox) { duiManager.Close(effect.time, () => { }); //originAlpha[-2] = duiManager.mainContainer.GetComponent<UIWidget>().alpha; //duiManager.clickContainer.SetActive(false); } float t = 0; float final = effect.state.spriteAlpha; while (t < 1) { t = Mathf.MoveTowards(t, 1, 1 / effect.time * Time.deltaTime); if (includeDiabox) { //float origin = originAlpha[-2]; //float alpha = origin + t * (final - origin); //duiManager.mainContainer.GetComponent<UIWidget>().alpha = alpha; } foreach (int i in GetDepthNum()) { UI2DSprite ui = GetSpriteByDepth(i); float origin = originAlpha[i]; float alpha = origin + t * (final - origin); ui.GetComponent <UIRect>().alpha = alpha; } if (includeBack) { float origin = originAlpha[-1]; float alpha = origin + t * (final - origin); bgSprite.GetComponent <UIRect>().alpha = alpha; } yield return(null); } //删除 foreach (int i in GetDepthNum()) { RemoveSpriteByDepth(i); } if (includeBack) { bgSprite.sprite2D = null; } //if (includeDiabox)duiManager.mainContainer.SetActive(false); callback(); }
public void ExecAuto(Action callback) { DialogBoxUIManager uiManger = diabox.GetComponent <DialogBoxUIManager>(); if (isopen) { uiManger.Open(time, callback); } else { uiManger.Close(time, callback); } }
public override void Exec() { DialogBoxUIManager uiManger = diabox.GetComponent <DialogBoxUIManager>(); if (isopen) { uiManger.Open(time, new Action(() => { })); } else { uiManger.Close(time, new Action(() => { })); } }