private void Update() { if (target != null) { PlayerProperty component = target.GetComponent <PlayerProperty>(); if (custom_inputs.Instance.GetButtonDown("K_JUMP") || null == component || component.Desc.IsHidePlayer) { target = BrickManManager.Instance.GetNextPlayer(target, excludingMe: false, LookFriendlyOnly()); if (null == target) { base.transform.parent = null; } else { base.transform.parent = target.transform; } } } if (!MyInfoManager.Instance.IsGM || !Screen.lockCursor || Input.GetKeyDown(KeyCode.F4)) { } VerifyLocalController(); VerifySpectatorController(); if (curMode != MyInfoManager.Instance.ControlMode) { curMode = MyInfoManager.Instance.ControlMode; ModeChange(); } VerifyTarget(); deltaTime += Time.deltaTime; if (deltaTime > 0.2f) { deltaTime = 0f; P2PManager.Instance.SendPEER_SPECTATOR(); if (MyInfoManager.Instance.ControlMode == MyInfoManager.CONTROL_MODE.SPECTATOR_MODE) { GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.CAMERA_SPECTATOR_USE); } } }
private bool Execute(BfCommand cmd) { GameObject gameObject = GameObject.Find("Main"); if (cmd != null) { switch (cmd.Cmd) { case BfCommand.BF_COMMAND.WHISPER_CMD: CSNetManager.Instance.Sock.SendCS_WHISPER_REQ(cmd.Arg1, cmd.Arg2); return(true); case BfCommand.BF_COMMAND.CAMERA_CMD: switch (cmd.Arg1) { case "fly": MyInfoManager.Instance.ControlMode = MyInfoManager.CONTROL_MODE.FLY_MODE; GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.CAMERA_FLY_ON); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("FLY_MODE"))); } break; case "spectator": MyInfoManager.Instance.ControlMode = MyInfoManager.CONTROL_MODE.SPECTATOR_MODE; GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.CAMERA_SPECTATOR_ON); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("SPECTATOR_MODE"))); } break; case "play": MyInfoManager.Instance.ControlMode = MyInfoManager.CONTROL_MODE.PLAY_MODE; GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.CAMERA_OFF); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("PLAY_MODE"))); } break; } return(true); case BfCommand.BF_COMMAND.GOD_CMD: switch (cmd.Arg1) { case "on": case "true": MyInfoManager.Instance.GodMode = true; NoCheat.Instance.Sync(NoCheat.WATCH_DOG.GODMODE, MyInfoManager.Instance.GodMode ? 1 : 0); GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.GOD_ON); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("GOD_MODE_ON"))); } break; case "off": case "false": MyInfoManager.Instance.GodMode = false; NoCheat.Instance.Sync(NoCheat.WATCH_DOG.GODMODE, MyInfoManager.Instance.GodMode ? 1 : 0); GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.GOD_OFF); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("GOD_MODE_OFF"))); } break; } return(true); case BfCommand.BF_COMMAND.GHOST_CMD: switch (cmd.Arg1) { case "on": case "true": MyInfoManager.Instance.isGhostOn = true; NoCheat.Instance.Sync(NoCheat.WATCH_DOG.GHOSTMODE, MyInfoManager.Instance.isGhostOn ? 1 : 0); GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.GHOST_ON); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("GHOST_MODE_ON"))); } MyInfoManager.Instance.ControlMode = MyInfoManager.CONTROL_MODE.FLY_MODE; break; case "off": case "false": MyInfoManager.Instance.isGhostOn = false; NoCheat.Instance.Sync(NoCheat.WATCH_DOG.GHOSTMODE, MyInfoManager.Instance.isGhostOn ? 1 : 0); GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.GHOST_OFF); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("GHOST_MODE_OFF"))); } MyInfoManager.Instance.ControlMode = MyInfoManager.CONTROL_MODE.PLAY_MODE; break; } return(true); case BfCommand.BF_COMMAND.GUI_CMD: switch (cmd.Arg1) { case "on": { MyInfoManager.Instance.isGuiOn = true; GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.GUI_ON); GameObject gameObject3 = GameObject.Find("Main Camera"); if (null == gameObject3) { Debug.LogError("Fail to find mainCamera for radar"); } else { CameraController component2 = gameObject3.GetComponent <CameraController>(); if (null == component2) { Debug.LogError("Fail to get CameraController for radar"); } component2.EnableFpCam(enable: true); } break; } case "off": { MyInfoManager.Instance.isGuiOn = false; GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.GUI_OFF); GameObject gameObject2 = GameObject.Find("Main Camera"); if (null == gameObject2) { Debug.LogError("Fail to find mainCamera for radar"); } else { CameraController component = gameObject2.GetComponent <CameraController>(); if (null == component) { Debug.LogError("Fail to get CameraController for radar"); } component.EnableFpCam(enable: false); } break; } } return(true); case BfCommand.BF_COMMAND.STRAIGHT_MOVEMENT_CMD: switch (cmd.Arg1) { case "on": case "true": MyInfoManager.Instance.isStraightMovement = true; GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.STRAIGHT_MOVEMENT_ON); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("STRAIGHT_MOVEMENT_MODE_ON"))); } break; case "off": case "false": MyInfoManager.Instance.isStraightMovement = false; GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.STRAIGHT_MOVEMENT_OFF); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("STRAIGHT_MOVEMENT_OFF"))); } break; } return(true); case BfCommand.BF_COMMAND.INVISIBLE_CMD: switch (cmd.Arg1) { case "on": case "true": MyInfoManager.Instance.isInvisibilityOn = true; GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.INVISIBLE_ON); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("INVISIBLE_MODE_ON"))); } break; case "off": case "false": MyInfoManager.Instance.isInvisibilityOn = false; GM_COMMAND_LOGER.SendLog(GM_COMMAND_LOGER.GM_COMMAND_LOG.INVISIBLE_OFF); if (null != gameObject) { gameObject.BroadcastMessage("OnChat", new ChatText(ChatText.CHAT_TYPE.SYSTEM, -1, StringMgr.Instance.Get("MODE_CHANGE"), StringMgr.Instance.Get("INVISIBLE_MODE_OFF"))); } break; } return(true); case BfCommand.BF_COMMAND.MUTE_CMD: CSNetManager.Instance.Sock.SendCS_MUTE_REQ(cmd.Arg1, Convert.ToInt32(cmd.Arg2)); return(true); case BfCommand.BF_COMMAND.BAN_CMD: CSNetManager.Instance.Sock.SendCS_ADD_BAN_BY_NICKNAME_REQ(cmd.Arg1); return(true); } } return(false); }