private void OnPinch(PinchGesture gesture) { if (JoyStickLogic.Instance() != null && JoyStickLogic.Instance().FingerID != -1) { return; } if (gesture.Phase == ContinuousGesturePhase.Started) { Obj_MainPlayer mainPlayer = Singleton <ObjManager> .Instance.MainPlayer; if (null != mainPlayer) { if (Singleton <ObjManager> .GetInstance().MainPlayer.IsCanOperate_Move()) { Singleton <ObjManager> .GetInstance().MainPlayer.StopMove(); } } m_bPinching = true; } else if (gesture.Phase == ContinuousGesturePhase.Updated) { if (Cutscene.CutsceneManager.Instance.IsPlayingCutscene == false) { CameraManager.Instance.UpdateDistance(gesture.Delta); } } else { m_bPinching = false; } }
/// <summary> /// 用这个Factory创建一个Cutscene /// </summary> /// <returns>The cutscene.</returns> public override Cutscene CreatCutscene() { BeginBuild(); /////////////////////////////////////////////////////////////////// /// 定义阶段 /////////////////////////////////////////////////////////////////// // 电影黑边界面控制 DefineAction("MovieUI", new CutsceneActionMovieUIControl()); // 开始过场动画 DefineAction("Dialog", new CutsceneActionStoryDialog(285), true); // 移动新手引导 DefineAction("NewUserGuide1", new CutsceneActionClientFuncCall(() => { JoyStickLogic.Instance().NewPlayerGuide(1); }), true); /////////////////////////////////////////////////////////////////// /// 连接阶段 /////////////////////////////////////////////////////////////////// StartBWhenAStart("Begin", "Dialog"); StartBWhenAStart("Dialog", "MovieUI"); FinishBWhenAFinish("Dialog", "MovieUI"); StartBWhenAFinish("Dialog", "NewUserGuide1"); EndBuild(); return(base.CreatCutscene()); }
static void JoyStickUI(int nIndex) { if (JoyStickLogic.Instance()) { JoyStickLogic.Instance().NewPlayerGuide(nIndex); } }
public static JoyStickLogic Instance() { if (_instance == null) { _instance = new JoyStickLogic(); } return(_instance); }
public void SwitchAllWhenPopUIShow(bool isShow) { if (MissionDialogAndLeftTabsLogic.Instance()) { MissionDialogAndLeftTabsLogic.Instance().PlayTween(!isShow); } if (TargetFrameLogic.Instance()) { TargetFrameLogic.Instance().PlayTween(!isShow); } if (FunctionButtonLogic.Instance()) { FunctionButtonLogic.Instance().PlayTween(!isShow); } if (ExpLogic.Instance()) { ExpLogic.Instance().PlayTween(!isShow); } if (ChatFrameLogic.Instance()) { ChatFrameLogic.Instance().PlayTween(!isShow); } if (SkillBarLogic.Instance()) { SkillBarLogic.Instance().PlayTween(!isShow); } if (PlayerHitsLogic.Instance()) { PlayerHitsLogic.Instance().PlayTween(!isShow); } if (RechargeBarLogic.Instance()) { RechargeBarLogic.Instance().PlayTween(!isShow); } if (!isShow) { if (JoyStickLogic.Instance()) { JoyStickLogic.Instance().CloseWindow(); } } else { if (JoyStickLogic.Instance()) { JoyStickLogic.Instance().OpenWindow(); } } }
private void OnDestroy() { #if !UNITY_EDITOR try { #endif _instance = null; #if !UNITY_EDITOR } catch (Exception ex) { Logger.Error(ex.ToString()); } #endif }
private void Awake() { #if !UNITY_EDITOR try { #endif mTransform = gameObject.transform; _instance = this; #if !UNITY_EDITOR } catch (Exception ex) { Logger.Error(ex.ToString()); } #endif }
public override void Start() { base.Start(); ProcessInput.IsProcessInput = false; //UIManager.HideAllUIExceptStory(); //UIManager.ShowUI(UIInfo.StoryDialogRoot, OnUIOpen, null); // // 判断是否进入ModelStory模式 // Singleton<ObjManager>.Instance.MainPlayer.IsInModelStory = IsNeedSilentMode(m_nStoryID); // 如果正在键盘输入 隐藏键盘 if (ChatInfoLogic.Instance() != null) { ChatInfoLogic.Instance().HideKeyboard(); } if (ProcessInput.Instance() != null) { ProcessInput.Instance().ReleaseTouch(); ProcessInput.Instance().ResetStickState(); } if (JoyStickLogic.Instance() != null) { JoyStickLogic.Instance().ReleaseJoyStick(); } if (Singleton <ObjManager> .GetInstance().MainPlayer != null) { // 这儿进行一些特殊的处理,可能Cabal里用不到 Singleton <ObjManager> .Instance.MainPlayer.StopMove(); Singleton <ObjManager> .Instance.MainPlayer.IsNoMove = true; } UIManager.HideAllUIExceptStory(); // UIManager.ShowUI(UIInfo.StoryDialogRoot, OnUIOpen, null); UIManager.ShowUI(UIInfo.MovieUI, OnUIOpen, null); Messenger.Broadcast(MessengerConst.OnCutsceneMovieBegin); }
// 展示UI,根据类型不同,触发不同行为 public static bool ShowUI(UIPathData pathData, OnOpenUIDelegate delOpenUI = null, object param = null) { if (null == m_instance) { LogModule.ErrorLog("game manager is not init"); return(false); } m_instance.AddLoadDicRefCount(pathData.name); #if !UNITY_EDITOR && !UNITY_STANDALONE_WIN if (pathData.uiType == UIPathData.UIType.TYPE_POP || // pathData.uiType == UIPathData.UIType.TYPE_STORY || // 现在对话界面有可能是小对话不需要释放摇杆了,把释放摇杆的操作放到具体逻辑中去 pathData.uiType == UIPathData.UIType.TYPE_TIP || pathData.uiType == UIPathData.UIType.TYPE_MENUPOP) { if (JoyStickLogic.Instance() != null) { ProcessInput.Instance().ReleaseTouch(); JoyStickLogic.Instance().ReleaseJoyStick(); } } #endif Dictionary <string, GameObject> curDic = null; switch (pathData.uiType) { case UIPathData.UIType.TYPE_BASE: curDic = m_instance.m_dicBaseUI; break; case UIPathData.UIType.TYPE_POP: curDic = m_instance.m_dicPopUI; break; case UIPathData.UIType.TYPE_STORY: curDic = m_instance.m_dicStoryUI; break; case UIPathData.UIType.TYPE_TIP: curDic = m_instance.m_dicTipUI; break; case UIPathData.UIType.TYPE_MENUPOP: curDic = m_instance.m_dicMenuPopUI; break; case UIPathData.UIType.TYPE_MESSAGE: curDic = m_instance.m_dicMessageUI; break; case UIPathData.UIType.TYPE_DEATH: curDic = m_instance.m_dicDeathUI; break; default: return(false); } if (null == curDic) { return(false); } if (m_instance.m_dicCacheUI.ContainsKey(pathData.name)) { if (!curDic.ContainsKey(pathData.name)) { curDic.Add(pathData.name, m_instance.m_dicCacheUI[pathData.name]); } m_instance.m_dicCacheUI.Remove(pathData.name); } if (curDic.ContainsKey(pathData.name)) { // 如果缓存区有,那么直接显示 curDic[pathData.name].SetActive(true); m_instance.DoAddUI(pathData, curDic[pathData.name], delOpenUI, param); return(true); } m_instance.LoadUI(pathData, delOpenUI, param); return(true); }
static void OnLoadItemGetRoot(bool bSuccess, object param) { // 异常 如果资源加载失败 if (bSuccess == false) { InitDataInfo curInfo = param as InitDataInfo; if (curInfo == null) { return; } if (curInfo._type == NEWITEMTYPE.TYPE_SKILL) { if (SkillBarLogic.Instance() != null) { SkillBarLogic.Instance().UpdateSkillBarInfo(); if (GameManager.gameManager.PlayerDataPool.ForthSkillFlag == true) { if (SkillBarLogic.Instance()) { SkillBarLogic.Instance().NewPlayerGuide(4); } } } } else { if (curInfo._type == NEWITEMTYPE.TYPE_MENUBAR || curInfo._type == NEWITEMTYPE.TYPE_FELLOW3DSHOW) { if (MenuBarLogic.Instance() != null) { MenuBarLogic.Instance().InitButtonActive(); } if (PlayerFrameLogic.Instance() != null) { PlayerFrameLogic.Instance().AddRemindNum(); } } else if (curInfo._type == NEWITEMTYPE.TYPE_FUNCTION) { if (FunctionButtonLogic.Instance() != null) { FunctionButtonLogic.Instance().InitButtonActive(); FunctionButtonLogic.Instance().PlayNewButtonEffect(); } } } return; } if (NewItemGetLogic.Instance() != null) { InitDataInfo curInfo = param as InitDataInfo; NewItemGetLogic.Instance().Init(curInfo._spriteName, curInfo._destGameObject, curInfo._type, curInfo._nNewSkillID, curInfo._attachGameObject, curInfo._ItemName, curInfo._strFuncName, curInfo._strDec); if (JoyStickLogic.Instance() != null) { ProcessInput.Instance().ReleaseTouch(); JoyStickLogic.Instance().ReleaseJoyStick(); } } }
// Update is called once per frame private void Update() { #if !UNITY_EDITOR try { #endif if (mSkipTime > 0) { mSkipTime -= Time.deltaTime; return; } GameLogic.Instance.MultiTouch--; //鼠标按键更新 //首先处理鼠标按下 //当鼠标按下未处理的话,才去处理鼠标点击 if (Input.touchCount <= 0) { if (null != GameControl.Instance && !GameControl.Instance.JoyStickPressed) { if (false == UpdateButtonStay(false)) { UpdateButton(false); } } //更新鼠标双击状态 UpdateMouseDBClick(); } else if (Input.touchCount == 1) { var InputtouchCount0 = Input.touchCount; for (var i = 0; i < InputtouchCount0; i++) { // 如果是摇杆的fingerID 即按住摇杆划出了摇杆范围 直接continue if (JoyStickLogic.Instance() != null) { if (Input.GetTouch(i).fingerId == JoyStickLogic.Instance().FingerId) { continue; } } if (false == UpdateButtonStay(true, i)) { UpdateButton(true, i); } } } else if (Input.touchCount == 2) { var zoom = true; var InputtouchCount1 = Input.touchCount; for (var i = 0; i < InputtouchCount1; i++) { // 如果是摇杆的fingerID 即按住摇杆划出了摇杆范围 直接continue if (JoyStickLogic.Instance() != null) { if (Input.GetTouch(i).fingerId == JoyStickLogic.Instance().FingerId) { zoom = false; GameLogic.Instance.MultiTouch = 0; break; } } // 如果手指碰到UI,也不能缩放 if (null != UICamera.mainCamera) { var nUiRay = UICamera.mainCamera.ScreenPointToRay(Input.GetTouch(i).position); RaycastHit nHit; if (Physics.Raycast(nUiRay, out nHit, LayerMask.GetMask("UI"))) { zoom = false; GameLogic.Instance.MultiTouch = 0; break; } } } if (zoom) { if (GameLogic.Instance.MultiTouch >= 0) { // if (GameLogic.Instance.MultiPos[0] > Input.touches[0].position.y && // GameLogic.Instance.MultiPos[1] > Input.touches[1].position.y) // { // var cam = GameLogic.Instance.MainCamera.GetComponent<CameraController>(); // cam.FAngle += 3; // if (cam.FAngle > 60) // { // cam.FAngle = 60; // } // cam.Dirty = true; // // GameLogic.Instance.MultiPos[0] = Input.touches[0].position.y; // GameLogic.Instance.MultiPos[1] = Input.touches[1].position.y; // } // else if (GameLogic.Instance.MultiPos[0] < Input.touches[0].position.y && // GameLogic.Instance.MultiPos[1] < Input.touches[1].position.y) // { // var cam = GameLogic.Instance.MainCamera.GetComponent<CameraController>(); // cam.FAngle -= 3; // if (cam.FAngle < 35) // { // cam.FAngle = 35; // } // cam.Dirty = true; // // GameLogic.Instance.MultiPos[0] = Input.touches[0].position.y; // GameLogic.Instance.MultiPos[1] = Input.touches[1].position.y; // } // else { var l = (Input.touches[0].position - Input.touches[1].position).magnitude; var cam = GameLogic.Instance.MainCamera.GetComponent <CameraController>(); cam.Length += (l - GameLogic.Instance.MultiDistance) * cam.ZoomSpeed; cam.Length = Mathf.Clamp(cam.Length, cam.MinLength, cam.MaxLength); cam.FAngle = Mathf.Lerp(35, 25, (cam.MaxLength - cam.Length) / (cam.MaxLength - cam.MinLength)); cam.Dirty = true; GameLogic.Instance.MultiDistance = l; ObjManager.Instance.MyPlayer.RefreshnameBarod(); } GameLogic.Instance.MultiTouch++; } else { GameLogic.Instance.MultiDistance = (Input.touches[0].position - Input.touches[1].position).magnitude; GameLogic.Instance.MultiPos[0] = Input.touches[0].position.y; GameLogic.Instance.MultiPos[1] = Input.touches[1].position.y; GameLogic.Instance.MultiTouch = 1; } } } #if !UNITY_EDITOR } catch (Exception ex) { Logger.Error(ex.ToString()); } #endif }
// Use this for initialization //void Start() //{ //} // Update is called once per frame void Update() { #if UNITY_EDITOR if (!IsProcessInput && (Input.GetMouseButton((int)MOUSE_BUTTON.MOUSE_BUTTON_LEFT))) { if (JtddAnimationManager.Instance != null) { if (JtddAnimationManager.Instance.IsAnimation) { ProcessInput.IsProcessInput = false; JtddAnimationManager.Instance.OverAnimation(); m_CurOverAnimation = Time.time; return; } } } #else if (!IsProcessInput) { if (Input.touchCount > 0) { if (JtddAnimationManager.Instance != null) { if (JtddAnimationManager.Instance.IsAnimation) { ProcessInput.IsProcessInput = false; JtddAnimationManager.Instance.OverAnimation(); m_CurOverAnimation = Time.time; } } } return; } #endif //监控动画完成后 N秒内部接受按键信息 if (m_CurOverAnimation > 0) { if (Time.time - m_CurOverAnimation <= m_IntervalTime) { return; } m_CurOverAnimation = 0.0f; } if (Singleton <ObjManager> .Instance.MainPlayer && !Singleton <ObjManager> .Instance.MainPlayer.IsInModelStory && !Singleton <ObjManager> .Instance.MainPlayer.QingGongState && !Singleton <ObjManager> .Instance.MainPlayer.IsFirstUseCrash) { //鼠标按键更新 //首先处理鼠标按下 //当鼠标按下未处理的话,才去处理鼠标点击 if (Input.touchCount <= 0) { if (false == UpdateButtonStay(false)) { UpdateButton(false); } //更新鼠标双击状态 UpdateMouseDBClick(); } else { for (int i = 0; i < Input.touchCount; i++) { // 如果是摇杆的fingerID 即按住摇杆划出了摇杆范围 直接continue if (JoyStickLogic.Instance() != null) { if (Input.GetTouch(i).fingerId == JoyStickLogic.Instance().FingerID) { continue; } } if (false == UpdateButtonStay(true, i)) { UpdateButton(true, i); } } } } }
/// <summary> /// Update touch-based events. /// </summary> public void ProcessTouches() { for (int i = 0; i < Input.touchCount; ++i) { Touch input = Input.GetTouch(i); currentTouchID = allowMultiTouch ? input.fingerId : 1; if (allowMultiTouch) { currentTouchID = input.fingerId; } else { if (JoyStickLogic.Instance() != null) { currentTouchID = input.fingerId; // Debug.Log("===========currentTouchID: " + currentTouchID + "==============="); // Debug.Log("===========JoyStickLogicID: " + JoyStickLogic.Instance().FingerID + "==============="); // Debug.Log("===========ProcessInputID: " + ProcessInput.Instance().SceneTouchFingerID + "==============="); if (currentTouchID == JoyStickLogic.Instance().FingerID || currentTouchID == ProcessInput.Instance().SceneTouchFingerID) { continue; } } else { currentTouchID = 1; } } currentTouch = GetTouch(currentTouchID); bool pressed = (input.phase == TouchPhase.Began) || currentTouch.touchBegan; bool unpressed = (input.phase == TouchPhase.Canceled) || (input.phase == TouchPhase.Ended); currentTouch.touchBegan = false; if (pressed) { currentTouch.delta = Vector2.zero; } else { // Although input.deltaPosition can be used, calculating it manually is safer (just in case) currentTouch.delta = input.position - currentTouch.pos; } currentTouch.pos = input.position; if (!Raycast(currentTouch.pos, out lastHit)) { hoveredObject = fallThrough; } if (hoveredObject == null) { hoveredObject = genericEventHandler; } currentTouch.current = hoveredObject; lastTouchPosition = currentTouch.pos; // We don't want to update the last camera while there is a touch happening if (pressed) { currentTouch.pressedCam = currentCamera; } else if (currentTouch.pressed != null) { currentCamera = currentTouch.pressedCam; } // Double-tap support if (input.tapCount > 1) { currentTouch.clickTime = Time.realtimeSinceStartup; } // Process the events from this touch ProcessTouch(pressed, unpressed); // If the touch has ended, remove it from the list if (unpressed) { RemoveTouch(currentTouchID); } currentTouch = null; // Don't consider other touches if (!allowMultiTouch) { break; } } }
void Awake() { m_Instance = this; }
void OnDestroy() { m_Instance = null; }