public void Updata() { KeyCode nEscapeKeyCode = FuntionShortCutCtrl.GetInstance().GetKeyCodeByIndex(FuntionShortCutSlotIndex.SystemPannel); //不要ESC界面的时候这里也记得关掉 if ((!BindKeyCodeForMovieTable.ContainsKey(nEscapeKeyCode)) && PopupMovieStack.Count > 0) { PopMovie(); } foreach (DictionaryEntry keypair in BindKeyCodeForMovieTable) { KeyCode key = (KeyCode)keypair.Key; SFMovieEx movie = (SFMovieEx)keypair.Value; if (InputManager.GetKeyUp(key)) { if (key == nEscapeKeyCode && PopupMovieStack.Count > 0) { PopMovie(); continue; } if (!IsMovieAllowed(movie)) { PushMovie(movie); } else { PopMovie(movie); } } } }
private void CheckUIKeyMessage() { if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.Exit) && StageManager.Instance.getCurrentState() != Stage_ManagerDef.EStage_State.ESS_LOADSCENE) { OnKeyMessage(FuntionShortCutSlotIndex.Exit, KeyStatus.Down); } for (int i = 1; i < (int)KeyStatus.Max; i++) { foreach (FuntionShortCutSlotIndex index in m_keyMessageList[i].Keys) { if (i == (int)KeyStatus.Down) { if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(index)) { OnKeyMessage(index, KeyStatus.Down); } } else if (i == (int)KeyStatus.Up) { if (FuntionShortCutCtrl.CheckFunctionShortcutKeyUp(index)) { OnKeyMessage(index, KeyStatus.Up); } } else if (i == (int)KeyStatus.Pressing) { if (FuntionShortCutCtrl.CheckFunctionShortcutKeyPressing(index)) { OnKeyMessage(index, KeyStatus.Pressing); } } } } }
/// <summary> /// 检测功能按键是否有按下 /// </summary> /// <param name="keyCtrlIndex">功能按键槽位序号</param> /// <returns></returns> public static bool CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex keyCtrlIndex) { if (!FuntionShortCutCtrl.GetInstance().dicCombinationShortcutKey.ContainsKey((int)keyCtrlIndex)) { return(false); } //获取此槽位权限Flag, 如果为0代表全局开启,不限制 //不为0则与场景保姆中的快捷键方案标识做&运算,判断当前是否有权限使用该槽位 //如果无权限使用,则直接return掉 int flag = SlotKeyCodeConfig.Instance.GetSlotFlag((int)SlotType.Function, (int)keyCtrlIndex); if (flag != 0 && (flag & GameLogicAPI.getHotkeyIndex()) == 0) { return(false); } if (FuntionShortCutCtrl.GetInstance().dicCombinationShortcutKey[(int)keyCtrlIndex].ModifierKeyCodeList.Count <= 0)//((int)keyCtrlIndex < (int)FuntionShortCutSlotIndex.Com_UpgradeSpellSlot0) { return(FuntionShortCutCtrl.GetInstance().CheckKeyCodeKeyStatus(keyCtrlIndex, KeyStatus.Down)); } else { return(FuntionShortCutCtrl.GetInstance().CheckCombinationKeyStatus(keyCtrlIndex, KeyStatus.Down)); } }
public void Update() { if (InputManager.Raw_GetKeyDown(FuntionShortCutCtrl.GetInstance().GetKeyCodeByIndex(FuntionShortCutSlotIndex.Exit))) { UISystem.Instance.ShowWnd(WndID.WND_ID_GAME_PROMOTION, false); } }
public bool skillautoForward = false; //技能导致的自动前进 void GetUserInputs() { inputDir = new Vector3(InputManager.GetAxis(InputAxisSet.Axis_Horizontal), 0, InputManager.GetAxis(InputAxisSet.Axis_Vertical)); inputDir.Normalize(); if (m_resetAxis) { moveDir = Vector3.zero; isMoving = false; return; } if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.AutoForward)) { if (autoForward) { autoForward = false; } else if (inputDir.sqrMagnitude < 0.0001f) { autoForward = true; } } if (inputDir.sqrMagnitude > 0.0001f) { if (autoForward) { autoForward = false; } } if (autoForward || skillautoForward) { moveDir = Vector3.forward; } else { moveDir = inputDir; } //Check if the user wants the soldier to walk isMoving = moveDir.sqrMagnitude > 0; /*这里导致移动按鼠标攻击时角色不能转动,取消的话,按鼠标左键光标不会隐藏 * //按鼠标左键,相机绕角色旋转 * if (InputManager.InputManager_GetMouseButton(0) && !dead ) * { * fire = true; * //移动时间没按左键则,取消fire状态 * if (!IsInvoking("ClearFireStateTimer")) * Invoke("ClearFireStateTimer", ClearFireStateTime); * else * { * CancelInvoke("ClearFireStateTimer"); * Invoke("ClearFireStateTimer", ClearFireStateTime); * } * } */ }
protected override bool CustomPrecondition(TBTWorkingData wData) { bool result = false; if (m_eShortCutIndex == FuntionShortCutSlotIndex.None) { for (int i = 0; i < m_eCheckKeyCode.Length; ++i) { if (m_bInputMgrEnableAffected) { result = InputManager.GetKeyDown(m_eCheckKeyCode[i]); } else { result = InputManager.Raw_GetKeyDown(m_eCheckKeyCode[i]); } if (result) { break; } } } else { result = FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(m_eShortCutIndex); } return(result); }
override public void Update() { if (InputManager.GetKey(FuntionShortCutCtrl.GetInstance().GetKeyCodeByIndex(FuntionShortCutSlotIndex.SystemPannel))) { SetState(ESummonerState.ESS_None); } }
public void Update() { //F11,打开调试信息 if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.EntityViewDebugOpen)) { bOpenDebugInfo = !bOpenDebugInfo; } }
//进入登录状态的操作 private void onEnterLoginState() { FuntionShortCutCtrl.GetInstance().ClearAndRest(); LogicDataCenter.onEnterLoginState(); CurStageSubState = EStage_SubState.ESSS_NONE; UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_COMMON_LOGINSTATE_ENTER, null); }
public override void OnRegisterDocument(Value _root) { base.OnRegisterDocument(_root); GetMemberWithCheck(MyRoot, "MainChatTable", out _vMainChatTable); PopupMovieManager.Instance.BindKeyCodeForMovie(FuntionShortCutCtrl.GetInstance().GetKeyCodeByIndex(FuntionShortCutSlotIndex.EnterLeft), this); PopupMovieManager.Instance.BindKeyCodeForMovie(FuntionShortCutCtrl.GetInstance().GetKeyCodeByIndex(FuntionShortCutSlotIndex.EnterRight), this); SetMovieVisibleOnCreate(); this.SetMovieVisible(true); }
override public void Update() { onTick(); if (InputManager.GetKey(FuntionShortCutCtrl.GetInstance().GetKeyCodeByIndex(FuntionShortCutSlotIndex.SystemPannel))) { SetState(EHallWinState.EHWS_None); } }
// 获得单实例 public static FuntionShortCutCtrl GetInstance() { if (instance == null) { instance = new FuntionShortCutCtrl(); instance.InitModifiersCodeMap(); } return(instance); }
// 检查学习天赋快捷键是否按下 private void CheckFastLearnShortcut() { for (int slotID = 0; slotID < 6; slotID++) { if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.Ctrl_1 + slotID)) { int nIndex = slotID; OnHeroTalentItemClick(nIndex, null); } } }
/// <summary> /// 还原默认槽位配置 /// </summary> public void RestSlotData() { CurrentSlotMap.Clear(); CurrentSpellMode = defaultSpellMode; foreach (KeyValuePair <int, SlotKeyCodeData> kv in defaultSlotMap) { SlotKeyCodeData data = new SlotKeyCodeData(kv.Value.nSlotIndex, kv.Value.nSlotType, kv.Value.nReleaseCondition, kv.Value.nAutoCasting, kv.Value.nFlag, kv.Value.szKeySequence, kv.Value.szSlotFunction); CurrentSlotMap.Add(kv.Key, data); } FuntionShortCutCtrl.GetInstance().ClearAndRest(); SetSlotData(true); }
/// <summary> /// 修改槽位方法 /// </summary> /// <param name="nIndex">槽位索引 槽位类型(slotType) * 每类槽位最大数量(1000)+当前槽位索引(slotIndex)</param> /// <param name="nAuto">智能施法状态(0:默认;1:快捷 ;2:常规;3:推荐)</param> /// <param name="szKeyCode">槽位键值</param> public void ChangeSlotData(int nIndex, int nAuto, string szKeyCode) { if (CurrentSlotMap.ContainsKey(nIndex)) { int index = CurrentSlotMap[nIndex].nSlotIndex; int type = CurrentSlotMap[nIndex].nSlotType; if (szKeyCode != CurrentSlotMap[nIndex].szKeySequence) { CurrentSlotMap[nIndex].szKeySequence = szKeyCode; if (type == (int)SlotType.Function) { FuntionShortCutCtrl.GetInstance().ChangeKeyCodeToDic(index, szKeyCode, 0); } else { if (!EntityFactory.MainHero) { return; } SkillCtrl sc = EntityFactory.MainHero.GetComponent <SkillCtrl>(); if (sc != null) { sc.SetSlotKeyCode(type, index, CurrentSlotMap[nIndex].nReleaseCondition, szKeyCode); UIMsgCmdData uiPlayerProgress = new UIMsgCmdData((int)WndMsgID.WND_MSG_WARBUTTOMCENTER_SETSHORTCUT, type, szKeyCode.ToUpper(), IntPtr.Zero, index); UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_WARBUTTOMCENTER_SETSHORTCUT, uiPlayerProgress); } } } if (nAuto != CurrentSlotMap[nIndex].nAutoCasting) { if (type == (int)SlotType.Function) { return; } CurrentSlotMap[nIndex].nAutoCasting = nAuto; cmd_entity_set_smart_cast data = new cmd_entity_set_smart_cast(); data.nSlotIndex = index; data.nSlotType = type; data.nSmartCast = nAuto; slotSmartDatas[0] = data; SendSmartDataToLogic(); slotSmartDatas.Clear(); } } }
/// <summary> /// 检测是否有通过快捷键升级技能 /// </summary> private void CheckSpellUpdateByShortcut() { //没技能点就不检测 if (currentSpellUpgradePoint <= 0) { return; } for (int slotID = 0; slotID < 3; slotID++) { if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.Com_UpgradeSpellSlot0 + slotID)) { onSkillUpgradeButtonClick(slotID); } } }
public override void OnRegisterDocument(Value _root) { base.OnRegisterDocument(_root); GetMemberWithCheck(MyRoot, "SettingWindow", out vSettingWindow); //this.SetDepth((int)SFGFxMovieManager.EGFxMovieLayer.EGFxLayer_PopupLayer); m_ValueMap.Add("HeroKeyCode1", null); m_ValueMap.Add("HeroKeyCode2", null); m_ValueMap.Add("HeroKeyCode3", null); m_ValueMap.Add("SkillKeyCode1", null); m_ValueMap.Add("PropKeyCode1", null); m_ValueMap.Add("PropKeyCode2", null); m_ValueMap.Add("PropKeyCode3", null); m_ValueMap.Add("PropKeyCode4", null); m_ValueMap.Add("PropKeyCode5", null); m_ValueMap.Add("PropKeyCode6", null); m_ValueMap.Add("OrnamentKeyCode", null); m_HotKeyAttrStringMap.Add("HeroKeyCode1", GameSettingsXmlModel.heroKeyCode1); m_HotKeyAttrStringMap.Add("HeroKeyCode2", GameSettingsXmlModel.heroKeyCode2); m_HotKeyAttrStringMap.Add("HeroKeyCode3", GameSettingsXmlModel.heroKeyCode3); m_HotKeyAttrStringMap.Add("SkillKeyCode1", GameSettingsXmlModel.skillKeyCode1); m_HotKeyAttrStringMap.Add("PropKeyCode1", GameSettingsXmlModel.propKeyCode1); m_HotKeyAttrStringMap.Add("PropKeyCode2", GameSettingsXmlModel.propKeyCode2); m_HotKeyAttrStringMap.Add("PropKeyCode3", GameSettingsXmlModel.propKeyCode3); m_HotKeyAttrStringMap.Add("PropKeyCode4", GameSettingsXmlModel.propKeyCode4); m_HotKeyAttrStringMap.Add("PropKeyCode5", GameSettingsXmlModel.propKeyCode5); m_HotKeyAttrStringMap.Add("PropKeyCode6", GameSettingsXmlModel.propKeyCode6); m_HotKeyAttrStringMap.Add("OrnamentKeyCode", GameSettingsXmlModel.ornamentKeyCode); m_HotKeyAttrIntMap.Add("HeroKeyState1", GameSettingsXmlModel.heroKeyState1); m_HotKeyAttrIntMap.Add("HeroKeyState2", GameSettingsXmlModel.heroKeyState2); m_HotKeyAttrIntMap.Add("HeroKeyState3", GameSettingsXmlModel.heroKeyState3); m_HotKeyAttrIntMap.Add("SkillKeyState1", GameSettingsXmlModel.skillKeyState1); m_HotKeyAttrIntMap.Add("PropKeyState1", GameSettingsXmlModel.propKeyState1); m_HotKeyAttrIntMap.Add("PropKeyState2", GameSettingsXmlModel.propKeyState2); m_HotKeyAttrIntMap.Add("PropKeyState3", GameSettingsXmlModel.propKeyState3); m_HotKeyAttrIntMap.Add("PropKeyState4", GameSettingsXmlModel.propKeyState4); m_HotKeyAttrIntMap.Add("PropKeyState5", GameSettingsXmlModel.propKeyState5); m_HotKeyAttrIntMap.Add("PropKeyState6", GameSettingsXmlModel.propKeyState6); m_HotKeyAttrIntMap.Add("OrnamentKeyState", GameSettingsXmlModel.ornamentKeyState); m_AttrBoolMap.Add("ShowPlayerBlood", GameSettingsXmlModel.showPlayerBlood); m_AttrBoolMap.Add("ShowBloodInfo", GameSettingsXmlModel.showBloodInfo); m_AttrIntMap.Add("MusicVolume", GameSettingsXmlModel.currentBGMValue); PopupMovieManager.Instance.BindKeyCodeForMovie(FuntionShortCutCtrl.GetInstance().GetKeyCodeByIndex(FuntionShortCutSlotIndex.SystemPannel), this); SetMovieVisibleOnCreate(); }
public void OnDestroy() { isOnGameRuning = false; OnDeviceStateChage -= OnDeviceStateChange; OnDeviceStateChage = null; mainCam = null; Effect.EffectNode.ClearTargetCache(); ViewConfigManager.Destroy(); RenderViewAPI.Stop(); GameLogicAPI.Stop(); SceneManager.UnRegisterSceneLoadFinishEvent(SceneLoadFinish); MouseCursorManager.Instance.DestroyMouseCursroManager(); FuntionShortCutCtrl.Destroy(); GUIDE.GuideManager.Destroy(); SceneEffectManager.Destroy(); }
public override void OnRegisterDocument(Value _root) { base.OnRegisterDocument(_root); GetMemberWithCheck(MyRoot, "StoreWindow", out vStoreWindow); GetMemberWithCheck(vStoreWindow, "MoneyTF", out vMoneyTF); GetMemberWithCheck(vStoreWindow, "AllGoodsPage", out vAllGoodsPage); GetMemberWithCheck(vAllGoodsPage, "AllGoodsTypeFrame", out vAllGoodsTypeFrame); GetMemberWithCheck(vStoreWindow, "RecommendedGoodsPage", out vRecommendedGoodsPage); GetMemberWithCheck(vStoreWindow, "CanComposeFrame", out vCanComposeFrame); GetMemberWithCheck(vStoreWindow, "GoodsComposeTreeMgr", out vGoodsComposeTreeMgr); GetMemberWithCheck(vStoreWindow, "GoodsDetalInfo", out vGoodsDetalInfo); PopupMovieManager.Instance.BindKeyCodeForMovie(FuntionShortCutCtrl.GetInstance().GetKeyCodeByIndex(FuntionShortCutSlotIndex.OpenGoodStore), this); GameMobaSchemesManager.MobaGoodsSchemesInitEndEvent += GetMobaGoodsFromSchemes; SetMovieVisibleOnCreate(); }
/// <summary> /// 检测功能按键是否按住 /// </summary> /// <param name="keyCtrlIndex">功能按键槽位序号</param> /// <returns></returns> public static bool CheckFunctionShortcutKeyPressing(FuntionShortCutSlotIndex keyCtrlIndex) { if (!FuntionShortCutCtrl.GetInstance().dicCombinationShortcutKey.ContainsKey((int)keyCtrlIndex)) { return(false); } int flag = SlotKeyCodeConfig.Instance.GetSlotFlag((int)SlotType.Function, (int)keyCtrlIndex); if (flag != 0 && (flag & GameLogicAPI.getHotkeyIndex()) == 0) { return(false); } if (FuntionShortCutCtrl.GetInstance().dicCombinationShortcutKey[(int)keyCtrlIndex].ModifierKeyCodeList.Count <= 0)//((int)keyCtrlIndex < (int)FuntionShortCutSlotIndex.Com_UpgradeSpellSlot0) { return(FuntionShortCutCtrl.GetInstance().CheckKeyCodeKeyStatus(keyCtrlIndex, KeyStatus.Pressing)); } else { return(FuntionShortCutCtrl.GetInstance().CheckCombinationKeyStatus(keyCtrlIndex, KeyStatus.Pressing)); } }
void CheckAttachFunc() { if (m_multiAttachFunc) { if ((isAttackSign(m_currentAttachType) && FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.AttackSign)) || (m_currentAttachType == MouseAttachFuncType.RetreatSign && (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.DangerSign)))) { SetAttachType(MouseAttachFuncType.None); } } if (InputManager.GetKeyUp(KeyCode.LeftAlt) || InputManager.GetKeyUp(KeyCode.LeftControl)) { SetAttachType(MouseAttachFuncType.None); } if (InputManager.GetMouseButtonDown(1)) //右键取消 { SetAttachType(MouseAttachFuncType.None); } if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.AttackSign) || InputManager.GetKeyDown(KeyCode.LeftControl)) { SetAttachType(MouseAttachFuncType.CtrlAttackSign); } if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.AttackSign) || InputManager.GetKeyDown(KeyCode.LeftAlt)) { SetAttachType(MouseAttachFuncType.AltAttackSign); } if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.DangerSign)) { SetAttachType(MouseAttachFuncType.DangerSign); } }
//处理用户输入 protected void GetInputNormally(Vector2 angleClamp) { if (mouseCtrl == null) { return; } float fMouseScrollValue = 0.0f; if (InputManager.IsMouseInScreen()) { fMouseScrollValue = InputManager.GetAxis(InputAxisSet.Axis_MouseScrollWheel); } if (Mathf.Abs(fMouseScrollValue) > 0.01f) { if ((Application.isEditor) && (InputManager.GetKey(KeyCode.LeftControl) || InputManager.GetKey(KeyCode.RightControl))) { //m_userDesireFov = CurCameraProperty.NormalFOV; m_userDesireFov = m_userDesireFov - fMouseScrollValue * CurCameraProperty.ScrollSpeed; m_userDesireFov = Mathf.Clamp(m_userDesireFov, 10.0f, 120.0f); } else if (canUserControlCamera()) { // normalDistance -= InputManager.GetAxis("Mouse ScrollWheel") * Time.deltaTime * CurCameraProperty.ScrollSpeed;//normalDistance -= InputManager.GetAxis("Mouse ScrollWheel") * Time.deltaTime * scrollSpeed; m_userDesireDistance = Mathf.Lerp(m_userDesireDistance, m_userDesireDistance - fMouseScrollValue * CurCameraProperty.ScrollSpeed, Time.deltaTime); m_userDesireDistance = Mathf.Clamp(m_userDesireDistance, curCameraModeParam.distanceRange.x, curCameraModeParam.distanceRange.y);//normalDistance = Mathf.Clamp(normalDistance, minDistance, maxDistance); } soldierCam.NavPauseTime = Time.time;//如果用户操作了暂停自动导航一会 } //m_userDesireDir = new Vector3(CurCameraProperty.NormalDirection.z, CurCameraProperty.NormalDirection.y, CurCameraProperty.NormalDirection.x); //m_userDesireTran = new Vector3(0, CurCameraProperty.NormalHeight, 0); if (!soldier.gameObject) { Trace.Warning("SoliderCamera.soldier.gameObject is null!"); return; } float dis = (m_userDesirePos - soldier.gameObject.transform.position).magnitude; if (dis > 10.0f || curCameraMode == CameraMode.FPSMode) { m_userDesirePos = soldier.gameObject.transform.position; } else { //帧率波动距离时,摄像机会抖动,特别是左右移动时此现象明显 //这里对摄像机位移利用逼近方案平滑,解决抖动 //位移逼近方案 Vector3 apprMoveX = CameraUtil.approximateVec(m_userDesirePos, soldier.gameObject.transform.position, soldierCam.smoothFactor.x) - m_userDesirePos; Vector3 apprMoveY = CameraUtil.approximateVec(m_userDesirePos, soldier.gameObject.transform.position, soldierCam.smoothFactor.y) - m_userDesirePos; Vector3 apprMoveZ = CameraUtil.approximateVec(m_userDesirePos, soldier.gameObject.transform.position, soldierCam.smoothFactor.z) - m_userDesirePos; float moveRight = Vector3.Dot(apprMoveX, camTransform.right); float moveForward = Vector3.Dot(apprMoveZ, camTransform.forward); float moveUp = Vector3.Dot(apprMoveY, camTransform.up); //以下代码帧率突变进行统计,为平滑参数提供参考 if (adaptSmooth) { //用标准差的方式算帧率突变的程度 //每m_deviationN帧算一组,该组的平均值作为下一组的平均值使用 //累计m_deviationN后平滑因子按(0.75f - Mathf.Sqrt(deviation)*2.0f)计算,并且和上一个平滑因子37开叠加,避免平滑因子突变 float deltaTime = Time.deltaTime; if (m_avgDetaTime < 0.01f) { m_avgDetaTime = deltaTime; } m_accDetaTime += deltaTime; float k = deltaTime - m_avgDetaTime; k = k * k; m_accDeviation += k; m_deviationCount++; if (m_deviationCount >= m_deviationN) { m_avgDetaTime = m_accDetaTime / m_deviationN; float deviation = Mathf.Sqrt(m_accDeviation / m_deviationN); soldierCam.smoothFactor.x = soldierCam.smoothFactor.x * 0.3f + (0.75f - Mathf.Sqrt(deviation) * 2.0f) * 0.7f; if (soldierCam.smoothFactor.x < 0.2f) { soldierCam.smoothFactor.x = 0.2f; } m_accDetaTime = 0.0f; m_accDeviation = 0.0f; m_deviationCount = 0; } } /* * //速度逼近方案 * Vector3 moveVec = soldier.position - m_userDesirePos; * float moveRight = Vector3.Dot(moveVec, camTransform.right); * float moveForward = Vector3.Dot(moveVec, camTransform.forward); * float moveUp = Vector3.Dot(moveVec, camTransform.up); * float speedRight = moveRight - m_lastMoveRight; * float apprSpeedRight = approximateFloat(m_lastSpeedRight, speedRight, smoothFactor.x); * if (Mathf.Abs(speedRight) > Mathf.Abs(apprSpeedRight)) * { * speedRight = apprSpeedRight; * } * if (Mathf.Abs(moveRight) > Mathf.Abs(m_lastMoveRight + speedRight)) * { * moveRight = m_lastMoveRight + speedRight; * } * m_lastMoveRight = moveRight; * m_lastSpeedRight = speedRight; */ Vector3 offset = moveForward * camTransform.forward + moveUp * camTransform.up + moveRight * camTransform.right; m_userDesirePos += offset; } //m_userDesirePos = soldier.position; if ((mouseCtrl.cameraRotateButton || canMouseRotateCamera()) && canCameraRotate() && !UISystem.Instance.IsMouseOverUI()) { float _x = mouseCtrl.fMouseAxisX; float _y = mouseCtrl.fMouseAxisY; if (k1 < 1.0f) { k1 = 1.0f; } //Vector2 a = soldierController.aim ? aimSpeed : speed; Vector2 a = CurCameraProperty.Speed * CurCameraProperty.SpeedScale; //speed; dx = Mathf.Clamp(_x * a.x, -999999999.0f, 99999999.0f); dy = Mathf.Clamp(_y * a.y, -999999999.0f, 99999999.0f); n = k1 * Mathf.Pow(Mathf.Sqrt(_x * _x + _y * _y) / (k3 * deltaTime), k2); n = Mathf.Clamp(n, minn, maxn); rx = dx * n; ry = dy * n; if (Mathf.Abs(rx) > 0.1f || Mathf.Abs(ry) > 0.1f) { soldierCam.exitNavMode(CameraNavMode.Target); //其他操作中断镜头追踪攻击对象 soldierCam.exitNavMode(CameraNavMode.FloatingAngle); //其他操作中断自动转镜头 } soldierCam.SetUserDesireAngleY(m_userDesireAngle.y + rx); //x += Mathf.Clamp(_x * a.x, -maxSpeed.x, maxSpeed.x) * deltaTime; soldierCam.SetUserDesireAngleX(m_userDesireAngle.x - ry); //y -= Mathf.Clamp(_y * a.y, -maxSpeed.y, maxSpeed.y) * deltaTime; //这里限制仰俯角,不能去掉 soldierCam.SetUserDesireAngleX(Mathf.Clamp(m_userDesireAngle.x, angleClamp.x, angleClamp.y)); //y = ClampAngle(y, yMinLimit, yMaxLimit); soldierCam.SetUserDesireAngleY(m_userDesireAngle.y - Mathf.Floor(m_userDesireAngle.y / 360.0f) * 360.0f); } if (FuntionShortCutCtrl.CheckFunctionShortcutKeyDown(FuntionShortCutSlotIndex.MoveCameraPositionToFront)) { if (soldier != null) { if (soldier.gameObject) { bool reached = false; soldierCam.SetUserDesireAngleY(CameraUtil.approximateAngleFloat(soldierCam, m_userDesireAngle.y, soldier.gameObject.transform.eulerAngles.y, 0.5f, ref reached)); } } soldierCam.exitNavMode(CameraNavMode.Target); //其他操作中断自动旋转 soldierCam.exitNavMode(CameraNavMode.FloatingAngle); //其他操作中断自动旋转 } }
public static void Destroy() { FuntionShortCutCtrl.GetInstance().destroy(); }
// Update is called once per frame public void Update() { UpdateDeviceLost(); if (!mainCam) { mainCam = Camera.main; } // 帧 GameFrameManager.OnUpdate(); // 定时器 TimerManager.OnUpdate(); DoTask(); // 当前正在载入地图,不要处理消息 if (loading != null) { if (!loading.isDone) { ViewEventHelper.Instance.SendCommand(GameLogicDef.GVIEWCMD_PROGRESSING, (int)(loading.progress * 100)); return; } else { loading = null; ViewEventHelper.Instance.SendCommand(GameLogicDef.GVIEWCMD_PROGRESSING, 100); Trace.Log("load level asyn ok!"); } } if (bCreated) { GameLogicAPI.onFrameUpdate(); } FuntionShortCutCtrl nFunctionCtr = FuntionShortCutCtrl.GetInstance(); if (InputManager.Raw_GetKeyUp(nFunctionCtr.GetKeyCodeByIndex(FuntionShortCutSlotIndex.ControlTraceOpen))) { if (!string.IsNullOrEmpty(LogFileName)) { Process.Start(LogFileName); } } SkinManager.OnUpdate(); SafeZone.Update(); SafeZoneEffectManager.Update(); if (isNeedToQuit) { bForbidQuit = false; Application.Quit(); } if (NeedToReStart) { enabled = false; NeedToReStart = false; ReStartApplication(); return; } GUIDE.GuideManager.Update(); // 通知逻辑层处理消息 //ViewEventHelper.Instance.SendCommand(GameLogicDef.GVIEWCMD_FRAME_UPDATE); }
/// <summary> /// 设置槽位信息 /// </summary> public void SetSlotData(bool isForceDefault = false) { if (!EntityFactory.MainHero) { return; } SkillCtrl sc = EntityFactory.MainHero.GetComponent <SkillCtrl>(); if (!sc) { return; } int vocationID = EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION); foreach (KeyValuePair <int, SlotKeyCodeData> kv in CurrentSlotMap) { switch (kv.Value.nSlotType) { case (int)SlotType.Equip: case (int)SlotType.Skill: { sc.SetSlotKeyCode(kv.Value.nSlotType, kv.Value.nSlotIndex, kv.Value.nReleaseCondition, kv.Value.szKeySequence); UIMsgCmdData uiPlayerProgress = new UIMsgCmdData((int)WndMsgID.WND_MSG_WARBUTTOMCENTER_SETSHORTCUT, kv.Value.nSlotType, kv.Value.szKeySequence.ToUpper(), IntPtr.Zero, kv.Value.nSlotIndex); UISystem.Instance.SendWndMessage(WndMsgID.WND_MSG_WARBUTTOMCENTER_SETSHORTCUT, uiPlayerProgress); cmd_entity_set_smart_cast data = new cmd_entity_set_smart_cast(); List <PlayerSlotItem> slotList = null; int maxSlotIndexForEachType = 1000; //一类slot最多有多少个index,用于将index和type合并编码 int nSlotID = kv.Value.nSlotType * maxSlotIndexForEachType + kv.Value.nSlotIndex; SpellMode useType = SpellMode.ST_Normal; bool hasUserConfig = PlayerSlotSettingConfig.Instance.GetLocalData(EntityFactory.MainHeroView.Property.GetNumProp(ENTITY_PROPERTY.PROPERTY_VOCATION), out slotList); if (hasUserConfig && !isForceDefault) //如果用户配置了就使用用户的配置 { for (int i = 0; i < slotList.Count; i++) { if (nSlotID == slotList[i].slotID) { useType = (SpellMode)Enum.Parse(typeof(SpellMode), slotList[i].useType.ToString()); } } } else //默认施法:使用策划在技能编辑器的配置 { if (sc != null) { OrderData odata = sc.GetCurOrderData(nSlotID); if (odata == null) { useType = SpellMode.ST_Normal; } else { useType = (SpellMode)Enum.Parse(typeof(SpellMode), (odata.nAdvanceUseType).ToString()); } } } kv.Value.nAutoCasting = (int)useType; data.nSlotIndex = kv.Value.nSlotIndex; data.nSlotType = kv.Value.nSlotType; data.nSmartCast = kv.Value.nAutoCasting; slotSmartDatas[0] = data; SendSmartDataToLogic(); slotSmartDatas.Clear(); } break; case (int)SlotType.Function: FuntionShortCutCtrl.GetInstance().SaveKeyCodeToDic(kv.Value.nSlotIndex, kv.Value.szKeySequence); break; default: break; } } }
//插旗 public void DoMouseAttachFunc(float xPos, float yPos, float zPos) { int targetID = 0; if (isAttackSign(m_currentAttachType) || m_currentAttachType == MouseAttachFuncType.RetreatSign) { if (raycast.targetID > 0) { EntityView evTarget = EntityFactory.getEntityViewByID(raycast.targetID); if (evTarget != null && IsValidMapSignalTarget(evTarget)) { targetID = raycast.targetID; } } if (targetID == 0) { Vector3 hitPoint = new Vector3(xPos, yPos, zPos); IList <EntityView> list = MapFinderManager.Nearest(hitPoint, 24, SPELL.CampFlag.CampFlag_Unknow); if (list != null) { float curDistance = float.MaxValue; EntityView curObj = null; foreach (EntityView view in list) { if (IsValidMapSignalTarget(view)) { float mag = (view.gameObject.transform.position - hitPoint).sqrMagnitude; if (curDistance > mag) { curDistance = mag; curObj = view; } } } if (curDistance < 16f) { targetID = curObj.ID; } } } } cmd_war_mini_map_info data = new cmd_war_mini_map_info(); switch (m_currentAttachType) { case MouseAttachFuncType.CtrlAttackSign: data.nType = (int)EMinimapClickType.EMCT_AttackSignal; break; case MouseAttachFuncType.AltAttackSign: data.nType = (int)EMinimapClickType.EMCT_AttackSignal; break; case MouseAttachFuncType.RetreatSign: data.nType = (int)EMinimapClickType.EMCT_RetreatSignal; break; case MouseAttachFuncType.DangerSign: data.nType = (int)EMinimapClickType.EMCT_DangerSignal; break; case MouseAttachFuncType.OnWaySign: data.nType = (int)EMinimapClickType.EMCT_OnWaySignal; break; case MouseAttachFuncType.HelpMeSign: data.nType = (int)EMinimapClickType.EMCT_HelpMeSignal; break; case MouseAttachFuncType.LostEyeSign: data.nType = (int)EMinimapClickType.EMCT_LostEyeSignal; break; default: return; } // 给逻辑层发命令 主角ID 目标位置 信号类型 data.x = xPos; data.y = yPos; data.z = zPos; data.nEntityID = targetID; EntityEventHelper.Instance.SendCommand <cmd_war_mini_map_info>(EntityFactory.MainHeroID, EntityLogicDef.ENTITY_CMD_MINIMAP_INFO, ref data); if (isAttackSign(m_currentAttachType) && (FuntionShortCutCtrl.CheckFunctionShortcutKeyPressing(FuntionShortCutSlotIndex.AttackSign) || InputManager.GetKey(KeyCode.LeftAlt) || InputManager.GetKey(KeyCode.LeftControl)) || m_currentAttachType == MouseAttachFuncType.RetreatSign && (FuntionShortCutCtrl.CheckFunctionShortcutKeyPressing(FuntionShortCutSlotIndex.DangerSign))) { // 功能继续 m_multiAttachFunc = true; } else if ((InputManager.GetKey(KeyCode.LeftAlt)) && (m_currentAttachType == MouseAttachFuncType.OnWaySign || m_currentAttachType == MouseAttachFuncType.DangerSign || m_currentAttachType == MouseAttachFuncType.HelpMeSign || m_currentAttachType == MouseAttachFuncType.LostEyeSign)) { // 战术标记发完后还按着alt的话保持附个空标记占位,以免出普攻 SetAttachType(MouseAttachFuncType.EmptySign); } else { SetAttachType(MouseAttachFuncType.None); } }