Exemplo n.º 1
0
    void Lobby_OnFailedToConnect(LobbyConnectionError error)
    {
        MessageBox_N.CancelMask(MsgInfoType.LobbyLoginMask);

        switch (error)
        {
        case LobbyConnectionError.RSAPublicKeyMismatch:
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000034));
            break;

        //lz-2016.10.31 ·­ÒëÁ¬½Ó´íÎóÂë
        case LobbyConnectionError.CreateSocketOrThreadFailure:
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000860));
            break;

        case LobbyConnectionError.ConnectionTimeout:
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000861));
            break;

        case LobbyConnectionError.ConnectionFailed:
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000862));
            break;

        default:
            MessageBox_N.ShowOkBox(error.ToString());
            break;
        }

        //LoginGui_N.Instance.HideMask();
        LogManager.Error("Failed to connect lobby server:", error);
    }
Exemplo n.º 2
0
    void uLink_OnDisconnectedFromServer(uLink.NetworkDisconnection mode)
    {
        MessageBox_N.CancelMask(MsgInfoType.ServerLoginMask);

        if (mode == uLink.NetworkDisconnection.LostConnection)
        {
            if (LogFilter.logDebug)
            {
                Debug.Log("Lost connection");
            }
            else
            if (LogFilter.logDebug)
            {
                Debug.Log("Disconnected. Mode:" + mode);
            }
        }

        RolesInGame.Clear();

        if (null != OnDisconnectEvent)
        {
            OnDisconnectEvent();
        }

        Cursor.lockState = Screen.fullScreen? CursorLockMode.Confined: CursorLockMode.None;
        Cursor.visible   = true;
        PeCamera.SetVar("ForceShowCursor", true);
    }
Exemplo n.º 3
0
    void RPC_L2C_CloseServer(uLink.BitStream stream, LobbyMessageInfo info)
    {
        string msg = stream.Read <string>();

        MessageBox_N.CancelMask(MsgInfoType.ServerDeleteMask);
        MessageBox_N.ShowOkBox(msg);
    }
Exemplo n.º 4
0
    void RPC_S2C_EnterDungeon(uLink.BitStream stream, uLink.NetworkMessageInfo info)
    {
        bool success = stream.Read <bool>();

        if (!success)
        {
            MessageBox_N.CancelMask(MsgInfoType.DungeonGeneratingMask);
            return;
        }
        Vector3 genPlayerPos  = stream.Read <Vector3>();
        int     seed          = stream.Read <int>();
        int     dungeonId     = stream.Read <int>();
        int     dungeonDataId = stream.Read <int>();

        RandomDungenMgr.Instance.LoadDataFromId(dungeonDataId);
        //UILoadScenceEffect.Instance.EnableProgress(true);
        RandomDungenMgrData.DungeonId = dungeonId;
        RandomDungenMgrData.SetPosByGenPlayerPos(genPlayerPos);
        int failCount = 0;

        while (!RandomDungenMgr.Instance.GenDungeon(seed))
        {
            failCount++;
            Debug.Log("generation failed: " + failCount);
        }

        RandomDungenMgr.Instance.LoadPathFinding();
        RequestFastTravel(0, RandomDungenMgrData.revivePos, 0);
//		FastTravel.TravelTo(RandomDungenMgrData.revivePos);
    }
Exemplo n.º 5
0
    //	void uLink_OnMasterServerEvent(uLink.MasterServerEvent e)
    //	{
    //		switch (e)
    //		{
    //			case uLink.MasterServerEvent.HostListReceived:
    //				if (null != HostListReceivedEvent)
    //					HostListReceivedEvent(this, EventArgs.Empty);
    //				break;
    //
    //			default:
    //				break;
    //		}
    //	}

    //void uLink_OnPreBufferedRPCs(uLink.NetworkBufferedRPC[] bufferedArray)
    //{
    //	foreach (uLink.NetworkBufferedRPC rpc in bufferedArray)
    //	{
    //		if (rpc.isInstantiate)
    //			rpc.DontExecuteOnConnected();
    //	}
    //}

    void uLink_OnConnectedToServer()
    {
        if (LogFilter.logDebug)
        {
            Debug.Log("Server connected");
        }
        MessageBox_N.CancelMask(MsgInfoType.ServerLoginMask);
    }
Exemplo n.º 6
0
 void OnServerRegistered(string srvName, int srvMode, int srvPort)
 {
     if (Equals(MyServerManager.LocalName, srvName))
     {
         MessageBox_N.CancelMask(MsgInfoType.NoticeOnly);
         MyServerManager.LocalPort = srvPort;
         Connect();
         P2PManager.OnServerRegisteredEvent -= OnServerRegistered;
     }
 }
Exemplo n.º 7
0
    void Lobby_OnDisconnected()
    {
        MessageBox_N.CancelMask(MsgInfoType.LobbyLoginMask);

        if (LogFilter.logDebug)
        {
            Debug.Log("Disconnected from lobby server");
        }

        if (null != OnLobbyDisconnectedEvent)
        {
            OnLobbyDisconnectedEvent();
        }

        Cursor.lockState = Screen.fullScreen? CursorLockMode.Confined: CursorLockMode.None;
        Cursor.visible   = true;
        PeCamera.SetVar("ForceShowCursor", true);

        NetworkInterface.Disconnect();
        if (Pathea.PeFlowMgr.Instance != null && Pathea.PeFlowMgr.Instance.curScene != Pathea.PeFlowMgr.EPeScene.MainMenuScene)
        {
            Pathea.PeFlowMgr.Instance.LoadScene(Pathea.PeFlowMgr.EPeScene.MainMenuScene, false);
        }
    }
Exemplo n.º 8
0
 void RPC_L2C_SteamLogin(uLink.BitStream stream, LobbyMessageInfo info)
 {
     MessageBox_N.CancelMask(MsgInfoType.LobbyLoginMask);
     Debug.Log("Steam validate ticket.");
 }
Exemplo n.º 9
0
    bool CloseFrontWnd()
    {
        if (UIStateMgr.Instance == null)
        {
            return(false);
        }

        if (GameUI.Instance == null)
        {
            return(false);
        }

        if (GameUI.Instance.mUIWorldMap.isShow)
        {
            GameUI.Instance.mUIWorldMap.Hide();
            return(true);
        }
        else if (GameUI.Instance.mOption.isShow)
        {
            GameUI.Instance.mOption.Hide();
            return(true);
        }
        else if (GameUI.Instance.mSaveLoad.isShow)
        {
            GameUI.Instance.mSaveLoad.Hide();
            return(true);
        }
        else if (MessageBox_N.IsShowing)
        {
            if (MessageBox_N.Instance)
            {
                MsgInfoType _inftype = MessageBox_N.Instance.GetCurrentInfoTypeP();
                if (!(_inftype == MsgInfoType.LobbyLoginMask || _inftype == MsgInfoType.ServerDeleteMask || _inftype == MsgInfoType.ServerLoginMask))
                {
                    MessageBox_N.CancelMask(_inftype);
                }
                return(true);
            }
        }


        List <UIBaseWnd> wnds = UIStateMgr.Instance.mBaseWndList;

        UIBaseWnd frontmost = null;

        foreach (UIBaseWnd wnd in wnds)
        {
            if (wnd == GameUI.Instance.mMissionTrackWnd ||
                wnd == GameUI.Instance.mItemsTrackWnd ||
                wnd == GameUI.Instance.mCustomMissionTrack.missionInterpreter.missionTrackWnd ||
                wnd == GameUI.Instance.mRevive)    //lz-2017.01.04 按esc退出的时候复活界面不关闭错误 #7975
            {
                continue;
            }
            if (wnd.isShow && wnd.Active)
            {
                frontmost = wnd;
                frontmost.Hide();
                return(true);
            }
        }

        //		if (GameUIMode.Instance.curUIMode == GameUIMode.UIMode.um_building)
        //		{
        //			GameUI.Instance.mBuildBlock.QuitBuildMode();
        //			return true;
        //		}

        return(false);
    }
Exemplo n.º 10
0
 void Start()
 {
     MessageBox_N.CancelMask(MsgInfoType.DungeonGeneratingMask);
     UILoadScenceEffect.Instance.EndScence(SetToTravelPos);
 }
Exemplo n.º 11
0
    void uLink_OnFailedToConnect(uLink.NetworkConnectionError error)
    {
        MessageBox_N.CancelMask(MsgInfoType.ServerLoginMask);

        if (LogFilter.logDebug)
        {
            Debug.LogErrorFormat("Failed to connect:{0}", error);
        }

        if (null != OnFailedConnectEvent)
        {
            OnFailedConnectEvent();
        }

        switch (error)
        {
        case uLink.NetworkConnectionError.InvalidPassword:
        {
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000037));
        }
        break;

        case uLink.NetworkConnectionError.RSAPublicKeyMismatch:
        {
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000045));
        }
        break;

        case uLink.NetworkConnectionError.ConnectionBanned:
        {
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000046));
        }
        break;

        case uLink.NetworkConnectionError.LimitedPlayers:
        {
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000826));
        }
        break;

        case (uLink.NetworkConnectionError) 200:
        {
            // Incompatible record version
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000754));
        }
        break;

        case (uLink.NetworkConnectionError) 201:
        {
            // Server had a fatal error
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000755));
        }
        break;

        case (uLink.NetworkConnectionError) 202:
        {
            // full custom player in custom mode
            MessageBox_N.ShowOkBox(PELocalization.GetString(8000827));
        }
        break;

        default:
        {
            MessageBox_N.ShowYNBox(PELocalization.GetString(8000502), Connect);
        }
        break;
        }
    }