Exemplo n.º 1
0
    /// <summary>
    /// 判断是否在AI场景中
    /// </summary>
    private bool IsInAIArea()
    {
        uint mapID  = m_CfgEternityProxy.GetCurrentMapId();
        uint areaID = (uint)MapManager.GetInstance().GetCurrentAreaUid();

        if (areaID == AI_AREA_ID)
        {
            return(true);
        }
        return(false);
    }
Exemplo n.º 2
0
    /// <summary>
    /// 切换地图
    /// </summary>
    /// <param name="buf">协议内容</param>
    private void OnSwitchMap(KProtoBuf buf)
    {
        S2C_SWITCH_MAP respond = buf as S2C_SWITCH_MAP;

        CfgEternityProxy cfgEternityProxy = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;

        if (cfgEternityProxy.GetCurrentMapData().ByteBuffer == null || cfgEternityProxy.GetCurrentMapId() != respond.mapID)
        {
            uint gamingMapId = respond.mapID;
            GameFacade.Instance.SendNotification(NotificationName.MSG_SWITCH_SCENE_START);

            cfgEternityProxy.SetCurrentMapData(gamingMapId);

            Vector3          worldPos         = new Vector3(respond.posX, respond.posY, respond.posZ);
            ulong            areaId           = respond.area_id;
            GameMainMediator gameMainMediator = GameFacade.Instance.RetrieveMediator(UIPanel.GameMainMediator) as GameMainMediator;
            if (gameMainMediator == null)
            {
                gameMainMediator = new GameMainMediator();
                GameFacade.Instance.RegisterMediator(gameMainMediator);
                gameMainMediator.SwtichMap(areaId, worldPos);
            }
            else
            {
                gameMainMediator.SwtichMap(areaId, worldPos);
            }

            // TODO.
            //切图直接清缓存
            MSAIBossProxy aiproxy = GameFacade.Instance.RetrieveProxy(ProxyName.MSAIBossProxy) as MSAIBossProxy;
            aiproxy.CleanAllMonster();

            MineDropItemManager.Instance.ClearAllInfo();
            DropItemManager.Instance.ClearInfo();
        }
    }