Beispiel #1
0
    public override void OnRefresh(object msg)
    {
        InputManager.Instance.UIInputMap = HotKeyMapID.None;

        m_LoadingPanelParamere = (LoadingPanelParamere)msg;
        if (m_Index >= IMAGE_INDEX_MIN)
        {
            m_Bg.sprite = m_LoadList[m_Index];
        }
    }
Beispiel #2
0
    public override void OnHide(object msg)
    {
        base.OnHide(msg);
        m_AnimatorController.OnAnimationEvent -= OnAnimationEvent;
        ServerTimeUtil.Instance.OnTick        -= OnUpdate;
        m_OpenEnd              = false;
        m_SwitchMapEnd         = false;
        m_LoadingPanelParamere = null;
        WwiseUtil.PlaySound((int)SoundID.LoadEnd, false, null);
        //如果全加载过了
        //随机选一个 并且return
        if (m_AllImageLoaded)
        {
            m_Index = Random.Range(IMAGE_INDEX_MIN, IMAGE_INDEX_MAX);
            return;
        }
        //选一个没加载过的
        int index;

        while (true)
        {
            index = Random.Range(IMAGE_INDEX_MIN, IMAGE_INDEX_MAX);
            Sprite sprite;
            if (!m_LoadList.TryGetValue(index, out sprite))
            {
                m_Index = index;
                break;
            }
        }
        //加载并且存一个id
        //如果数量都加载了 就标记m_AllImageLoaded 为true
        string m_BgAddress = string.Format(LOADING_ADDRESS, m_Index);

        AssetUtil.LoadAssetAsync(m_BgAddress,
                                 (pathOrAddress, returnObject, userData) =>
        {
            if (returnObject != null)
            {
                Texture2D texture = (Texture2D)returnObject;
                m_LoadList.Add(m_Index, Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), Vector2.zero));
                m_AllImageLoaded = m_LoadList.Values.Count == IMAGE_INDEX_MAX - IMAGE_INDEX_MIN;
            }
            else
            {
                Debug.LogError(string.Format("资源加载成功,但返回null,  pathOrAddress = {0}", pathOrAddress));
            }
        });
    }
    public void SwtichMap(ulong areaId, Vector3 worldPos)
    {
        StateChangeHandler.HandleChangeState();
        DropHandler.HandleSyncDrop();
        SkillBroadCastRPCNet.Handle();

        LoadingPanelParamere loadingPanelParamere = MessageSingleton.Get <LoadingPanelParamere>();

        loadingPanelParamere.OnShown = () =>
        {
            GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy;
            if (gameplayProxy != null)
            {
                GameplayManager.Instance.Clear();
                gameplayProxy.SetCurrentAreaUid(areaId);
                Vector3 gameWorldPos = gameplayProxy.WorldPositionToServerAreaOffsetPosition(worldPos);
                Map.MapManager.GetInstance().SetPlayerPosition(worldPos, gameWorldPos);
            }
            OnSwitchMapLoadingPanelShown();
        };
        UIManager.Instance.OpenPanel(UIPanel.LoadingSecondPanel, loadingPanelParamere);

        CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        uint             lastGamingMapId  = cfgEternityProxy.GetLastGamingMapId();
        uint             gamingMapId      = cfgEternityProxy.GetCurrentGamingMapId();

        if (lastGamingMapId != Map.Constants.NOTSET_MAP_UID)
        {
            int lastMapType = cfgEternityProxy.GetMapByKey(lastGamingMapId).Value.GamingType;
            int mapType     = cfgEternityProxy.GetMapByKey(gamingMapId).Value.GamingType;
            if (lastMapType == 4 && mapType == 4)
            {
                WwiseUtil.PlaySound(WwiseManager.voiceComboID, WwiseMusicSpecialType.SpecialType_Voice_StartCrossingTheGate, WwiseMusicPalce.Palce_1st, false, null);
            }
        }
    }