/// 显示进度条(循环进度) /// </summary> /// <param name="info">进度信息</param> /// <param name="onclose">点击关闭事件</param> /// <param name="ower">进度条宿主</param> public static void Show(string info, onClose onclose = null, Form ower = null) { inCycle = false; if (pThread != null) { pThread = null; } pThread = new Thread(() => { pBarUtil().ShowSysTitle = true; pBarUtil().picWait.Visible = false; pBarUtil().lblInfo.Location = new Point(50, 27); pBarUtil().pb.Location = new Point(46, 54); pBarUtil().pb.Value = 0; pBarUtil().pb.Step = 8; pBarUtil().pb.Visible = true; pBarUtil().lblProgress.Visible = false; pBarUtil().closeEvent = onclose; // pBar.fmOwer = ower; pBarUtil().Show(); SetInfo(info); inCycle = true; while (true) { if (!inCycle) { return; } if (pBarUtil().IsHandleCreated) { pBarUtil()?.Invoke(new Action(() => { if (pBarUtil().pb.Value >= pBarUtil().pb.Maximum) { if (timerWait == null) { timerWait = new System.Timers.Timer(); timerWait.Interval = 600; timerWait.Elapsed += timerWait_Elapsed; } timerWait.Start(); } else { pBarUtil().pb.Value++; } pBarUtil().BringToFront(); pBarUtil().pb.Refresh(); })); } Thread.Sleep(100); Application.DoEvents(); } }); pThread.Start(); }
public void Open(Color mColor, UnityAction <Color> callback, onClose closeCallback) { onValueChanged.AddListener(callback); CloseCallback += closeCallback; CurrentColor = mColor; gameObject.SetActive(true); SendChangedEvent(); }
/// <summary> /// 显示进度条(指定进度) /// </summary> /// <param name="info">进度信息</param> /// <param name="complete">已完成进度</param> /// <param name="maxValue">最大进度</param> /// <param name="onclose">点击关闭事件</param> /// <param name="ower">进度条宿主</param> public static void Show(string info, int complete, int maxValue, onClose onclose = null, Form ower = null) { inCycle = false; if (pThread != null) { pThread = null; } pThread = new Thread(() => { pBarUtil().ShowSysTitle = true; pBarUtil().picWait.Visible = false; pBarUtil().lblInfo.Location = new Point(50, 27); pBarUtil().pb.Location = new Point(46, 54); pBarUtil().pb.Value = 0; pBarUtil().pb.Step = 8; pBarUtil().pb.Visible = true; pBarUtil().pb.Value = 0; pBarUtil().pb.Step = 1; pBarUtil().lblProgress.Visible = true; pBarUtil().closeEvent = onclose; // pBarUtil().fmOwer = ower; pBarUtil().Show(); SetProgress(info, complete, maxValue); inCycle = true; while (true) { if (!inCycle) { return; } if (_pBar == null) { return; } Application.DoEvents(); } }); pThread.Start(); }
void ShowGift() { temperRewardList = UILevelRewardController.Instance.temperRewardList; if (temperRewardList.Count > 0) { ItemOfReward tIOR = temperRewardList [giftIndex - 1]; if (tIOR != null) { // int giftID = temperRewardList [giftIndex - 1].pid; this.ShiftNameAndIcon(giftIcon, starsPic, _name, tIOR.pid); // this.ShiftNameAndIcon (temperRewardList [giftIndex-1].pid); this.ShowAtt(temperRewardList [giftIndex - 1].at); this.ShowNum(numObj, giftNum, tIOR.num); } OnClose += ShowGift; UILevelRewardController.Instance.temperRewardList.Remove(tIOR); } else { OnClose = null; } }
/// 等待显示(无进度条) /// </summary> /// <param name="info">进度信息</param> /// <param name="onclose">点击关闭事件</param> /// <param name="ower">进度条宿主</param> public static void Wait(string info, onClose onclose = null, Form ower = null) { inCycle = false; if (pThread != null) { try { pThread.Abort(); } catch { } } pThread = null; pThread = new Thread(() => { pBarUtil().ShowSysTitle = true; pBarUtil().picWait.Location = new Point(50, 32); pBarUtil().picWait.Visible = true; pBarUtil().lblInfo.Location = new Point(100, 40); pBarUtil().pb.Visible = false; pBarUtil().lblProgress.Visible = false; pBarUtil().closeEvent = onclose; // pBarUtil().fmOwer = ower; pBarUtil().Show(); SetInfo(info); inCycle = true; while (true) { if (!inCycle) { return; } Thread.Sleep(100); Application.DoEvents(); } }); pThread.Start(); }