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);
    }
Beispiel #2
0
//	public static void CamFOV(float v)
//    {
////        if (null == m_Controller || null == m_Controller.m_TargetCam)
////        {
////            return;
////        }
//
//        m_Controller.m_TargetCam.fieldOfView = v;
//        m_Controller.SaveParams();
//    }

    public static void ApplySysSetting()
    {
        if (Camera.main == null)
        {
            return;
        }

        AAEnable(SystemSettingData.Instance.mAntiAliasing > 0);
        DepthScEnable(SystemSettingData.Instance.mDepthBlur);
        SSAOEnable(SystemSettingData.Instance.mSSAO);
        Camera.main.hdr = SystemSettingData.Instance.HDREffect;
        PeCamera.SetVar("Camera Inertia", SystemSettingData.Instance.CamInertia);
        PeCamera.SetVar("Drive Camera Inertia", SystemSettingData.Instance.DriveCamInertia);  //log: lz-2016.05.18 功能 #1924在Options内增加载具的摄像机跟随灵敏度调整功能
//        CamFOV(SystemSettingData.Instance.CameraFov);
    }
    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);
        }
    }
Beispiel #4
0
    void HandleLog(string logString, string stackTrace, LogType type)
    {
#if SAVE_GAME_LOG
        if (Logs == null)
        {
            Logs = new List <GameLogNode> ();
        }
        bool found = false;
        for (int i = 0; i < Logs.Count; i++)
        {
            if (Logs[i].Type == type && Logs[i].LogString == logString && Logs[i].StackTrace == stackTrace)
            {
                Logs[i].Count = Logs[i].Count + 1;
                found         = true;
                break;
            }
        }
        if (!found)
        {
            GameLogNode log = new GameLogNode();
            log.LogTime    = DateTime.Now;
            log.LogString  = logString;
            log.StackTrace = stackTrace;
            log.Type       = type;
            log.Count      = 1;
            Logs.Add(log);

            // If there are many logs, delete old and useless log.
            if (Logs.Count > 512)
            {
                for (int i = 0; i < Logs.Count; i++)
                {
                    if (Logs[i].Type == LogType.Log)
                    {
                        Logs.RemoveAt(i);
                        break;
                    }
                }
            }
        }
#endif

        //
        // Catch Null pointer error.
        //
        // !!!!! DO NOT Delete !!!!!
        //
        if (type == LogType.Assert || type == LogType.Error || type == LogType.Exception)
        {
            if (string.IsNullOrEmpty(_strRuntimeError))
            {
                int ex_pos   = logString.IndexOf("Exception");
                int line_end = logString.IndexOf("\n");
                if (line_end < 0)
                {
                    line_end = logString.Length;
                }

                if (ex_pos >= 0 && ex_pos < line_end)
                {
                    _strListInUse = SystemSettingData.Instance.IsChinese ? c_strListCn : c_strListEn;
                    if (logString.Contains("OclKernelError"))
                    {
                        _strRuntimeError = _strListInUse[(int)EStr.OclError];
                    }
                    else if (logString.Contains("IOException: Win32 IO returned 112.") || logString.Contains("IOException: Disk full."))
                    {
                        _strRuntimeError = _strListInUse[(int)EStr.NotEnoughSpace] + "\r\n\r\n" + logString + "\r\n" + stackTrace;
                    }
                    else if (logString.Contains("SaveDataCorrupt"))
                    {
                        _strRuntimeError = _strListInUse[(int)EStr.CorruptSave] + "\r\n\r\n" + logString + "\r\n" + stackTrace;
                    }
                    else if (logString.Contains("FilesCorrupt") || logString.Contains("IO.EndOfStreamException"))
                    {
                        _strRuntimeError = _strListInUse[(int)EStr.CorruptFile] + "\r\n\r\n" + logString + "\r\n" + stackTrace;
                    }
                    else if (logString.Contains("IO.FileNotFoundException"))
                    {
                        _strRuntimeError = _strListInUse[(int)EStr.FileNotFound] + "\r\n\r\n" + logString + "\r\n" + stackTrace;
                    }
                    else if (logString.Contains("UnauthorizedAccessException"))
                    {
                        _strRuntimeError = _strListInUse[(int)EStr.NoAuthority] + "\r\n\r\n" + logString + "\r\n" + stackTrace;
                    }
                    else if (logString.Contains("DllNotFoundException"))
                    {
                        _strRuntimeError = _strListInUse[(int)EStr.MissingNetFramework];
                    }
                    else
                    {
                        _strRuntimeError = logString + "\r\n\r\n" + stackTrace;
                    }
                    _lastLogTime = DateTime.Now;
                    // Force disp cursor
                    try{
                        Cursor.lockState = Screen.fullScreen? CursorLockMode.Confined: CursorLockMode.None;
                        Cursor.visible   = true;
                        PeCamera.SetVar("ForceShowCursor", true);
                    }catch {}
                }
            }
        }
    }
Beispiel #5
0
        public void OnMsg(EMsg msg, params object[] args)
        {
            switch (msg)
            {
            case EMsg.View_Prefab_Build:
                BiologyViewCmpt obj = args [0] as BiologyViewCmpt;
//				TestHitBack hitBack = obj.GetComponentInChildren<TestHitBack> ();
//				if (null != hitBack) {
//					hitBack.cam = Camera.main;
//					obj.transform.position += 1.3f * Vector3.up;
//				}
                m_PhyCtrl = obj.monoPhyCtrl;

                if (obj.monoModelCtrlr != null)
                {
                    _camTarget = obj.monoModelCtrlr.transform.Find("CamTarget");
                }
                if (obj.monoModelCtrlr != null)
                {
                    _bneckModel = obj.monoModelCtrlr.transform.Find("Bip01/Bip01 Pelvis/Bip01 Spine1/Bip01 Spine2/Bip01 Spine3/Bip01 Neck");
                }
                if (obj.monoRagdollCtrlr != null)
                {
                    _bneckRagdoll = obj.monoRagdollCtrlr.transform.Find("Bip01/Bip01 Pelvis/Bip01 Spine1/Bip01 Spine2/Bip01 Spine3/Bip01 Neck");
                }


                if (null != UILoadScenceEffect.Instance && UILoadScenceEffect.Instance.isInProgress)
                {
                    StartInvincible();
                }

                InitReputationSystem();
                Invoke("ResetFirstCtrl", 1f);
                break;

            //case EMsg.View_Model_Build:

            //    break;

            case EMsg.Camera_ChangeMode:
                PeCamera.cameraModeData = args [0] as CameraModeData;
                break;

            case EMsg.Battle_EnterShootMode:
                m_InShootMode = true;
                if (null != TestPEEntityCamCtrl.Instance && null != mView.modelTrans)
                {
                    TestPEEntityCamCtrl.Instance.SetCamMode(PETools.PEUtil.GetChild(mView.modelTrans, "CamTarget"),
                                                            PETools.PEUtil.GetChild(mView.modelTrans, "Bip01 Neck"), "3rd Person Shoot");
                }

                if (null != UISightingTelescope.Instance)
                {
                    UISightingTelescope.Instance.Show((UISightingTelescope.SightingType)args [0]);
                }
                //lz-2018.01.18 改变持枪状态,改变相机灵敏度的返回值
                SystemSettingData.Instance.holdGun = true;

                break;

            case EMsg.Battle_ExitShootMode:
                m_InShootMode = false;
                if (null != TestPEEntityCamCtrl.Instance)
                {
                    TestPEEntityCamCtrl.Instance.SetCamMode(PETools.PEUtil.GetChild(mView.modelTrans, "CamTarget"),
                                                            PETools.PEUtil.GetChild(mView.modelTrans, "Bip01 Neck"), "Normal Mode F1");
                }
                if (null != UISightingTelescope.Instance)
                {
                    UISightingTelescope.Instance.ExitShootMode();
                }
                SystemSettingData.Instance.holdGun = false;
                break;

            case EMsg.Battle_OnShoot:
                if (null != UISightingTelescope.Instance)
                {
                    UISightingTelescope.Instance.OnShoot();
                }
                break;

            case EMsg.UI_ShowChange:
                m_DisableActionByUI = (bool)args [0];
                if (m_DisableActionByUI && mEquip.ISAimWeapon)
                {
                    mEquip.ActiveWeapon(false);
//					for(PEActionType type = PEActionType.Move; type <= PEActionType.Stuned; type++)
//						mMotionMgr.EndImmediately(type);
                }
                break;

            case EMsg.Build_BuildMode:
                bool enterBuildMode = (bool)args [0];
                if (enterBuildMode)
                {
                    GameUIMode.Instance.GotoBuildMode();
                }
                else
                {
                    GameUIMode.Instance.GotoBaseMode();
                }

                PeCamera.SetVar("Build Mode", enterBuildMode);

                if (null != onBuildMode)
                {
                    onBuildMode(enterBuildMode);
                }

                break;

            case EMsg.Battle_OnAttack:
                if (null != onEquipmentAttack)
                {
                    onEquipmentAttack((int)args [2]);
                }
                PeEventGlobal.Instance.MainPlayerAttack.Invoke(Entity, (AttackMode)args [0]);
                break;

            //case EMsg.Battle_HPChange:
            //	SkEntity skEntity = (SkEntity)args[0];
            //	float damage = (float)args[1];
            //	if (skEntity != null && damage < PETools.PEMath.Epsilon)
            //	{
            //		OnDamage(skEntity, Mathf.Abs(damage));
            //	}
            //	break;

            case EMsg.Action_DurabilityDeficiency:
                if (null != onDurabilityDeficiency)
                {
                    onDurabilityDeficiency();
                }
                break;
            }
        }