예제 #1
0
    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);
    }
예제 #2
0
    public void onProgress(EventBase evt)
    {
        LoadingEvent levt = evt as LoadingEvent;

        SetProgress(levt.progress);

        mLoadingContent.text = levt.showname;
    }
예제 #3
0
    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);
    }
예제 #4
0
        private void ProgressHandler(Event e)
        {
            LoadingEvent le = (LoadingEvent)e;

            if (null != _maskGraphics)
            {
                _maskGraphics.Message = le.Message;
            }
        }
예제 #5
0
 private void HandleLoadingListEvent(object sender, LoadingEvent e)
 {
     if (e.State == LoadingEvent.LoadingState.Started)
     {
         LoadingList = true;
     }
     else if (e.State == LoadingEvent.LoadingState.Done)
     {
         LoadingList = false;
     }
 }
예제 #6
0
    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;
    }
예제 #7
0
        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();
        }