private void OnLoadingProgress(BaseEvent evt) { LoadingEvent e = evt as LoadingEvent; progress = e.progress; switch (e.name) { case "UpdateAssets": loadingTips.text = "正在加载本地资源,不会消耗流量"; progress = progress * 0.8f; break; case "Preloader": loadingTips.text = "正在预加载资源"; progress = 0.8f + progress * 0.2f; break; case "Login": loadingTips.text = "正在登录服务器"; progress = progress * 0.5f; break; case "LoadScene": loadingTips.text = "正在切换场景"; progress = 0.5f + progress * 0.5f; break; default: break; } slider.gameObject.SetActive(true); }
public void onProgress(EventBase evt) { LoadingEvent levt = evt as LoadingEvent; SetProgress(levt.progress); mLoadingContent.text = levt.showname; }
public void NotifyProcess(float value, string showname) { LoadingEvent evt = new LoadingEvent(LoadingEvent.LOADING_PROGRESS); evt.progress = (int)(value * 100); evt.showname = showname; EventSystem.Instance.PushEvent(evt); }
private void ProgressHandler(Event e) { LoadingEvent le = (LoadingEvent)e; if (null != _maskGraphics) { _maskGraphics.Message = le.Message; } }
private void HandleLoadingListEvent(object sender, LoadingEvent e) { if (e.State == LoadingEvent.LoadingState.Started) { LoadingList = true; } else if (e.State == LoadingEvent.LoadingState.Done) { LoadingList = false; } }
private void onProgress(EventBase evt) { if (!slider.gameObject.activeSelf) { return; } LoadingEvent ev = (LoadingEvent)evt; float val = 0.01f * ev.progress; slider.value = val; slider2.value = val; }
private void StartHandler(Event e) { #if DEBUG if (DebugMode) { Debug.Log("StartHandler " + _component.Width + ", " + _component.Height); } #endif if (null != _maskGraphics) { return; // already masking this component } _parent = _component.Parent ?? (_component is Stage ? _component : null); if (null == _parent) { return; // we are not on the display list, so we have nothing to mask indeed } _maskGraphics = new LoadingMaskAnimator { IncludeInLayout = false, X = _component.X, Y = _component.Y, Width = _component.Width, Height = _component.Height, //Bounds = (Rectangle) _component.Bounds.Clone() // BEWARE! This was the reference bug (without Clone())!!!!!!!!! }; _parent.AddChild(_maskGraphics); LoadingEvent le = e as LoadingEvent; if (null != le) { _maskGraphics.Message = le.Message; } // critical! //_maskGraphics.Transform.Apply(); _maskGraphics.InvalidateTransform(); // subscribe to MOVE and RESIZE events of the component // we shall be levitating just over the component _component.AddEventListener(MoveEvent.MOVE, MoveHandler, EventPhase.Target); _component.AddEventListener(ResizeEvent.RESIZE, ResizeHandler, EventPhase.Target); _maskGraphics.Play(); }