// Update is called once per frame void Update() { if (MainMenuGlobal.getCurrentState() != MainMenuState.MS_SHORTCUT && MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_UNPIN_RED) { return; } if (PopupObject.IsPopup) { return; } if (PinCollider == null) { return; } bool touchedDown = TouchInterface.GetTouchDown(); bool touchedUp = TouchInterface.GetTouchUp(); Vector2 touchPos = TouchInterface.GetTouchPosition(); if (touchedDown) { if (PinCollider.OverlapPoint(touchPos)) { if (MainMenuGlobal.getCurrentState() == MainMenuState.MS_TUTORIAL_UNPIN_RED) { MainMenuGlobal.Tutorial.NextTutorial(); } //UnPinned item UnPinn(); } } }
public void NextTutorial() { Debug.Log(MainMenuGlobal.getCurrentState()); if (currentIndex < pageList.Length) { pageList[currentIndex].UnHightlightObject(); pageList[currentIndex].gameObject.SetActive(false); currentIndex++; } if (currentIndex >= pageList.Length) { MainMenuGlobal.SetState(MainMenuState.MS_NORMAL); skipObject.SetActive(false); UserCommonData.IsTutorial = false; UserCommonData.pGlobal.Save(); //out to menu state } else { MainMenuGlobal.SetState(pageList[currentIndex].state); pageList[currentIndex].gameObject.SetActive(true); pageList[currentIndex].HighlightObject(); } }
// Update is called once per frame protected override void Update() { if (MainMenuGlobal.getCurrentState() != WorkingState) { return; } base.Update(); }
// Use this for initialization void Start() { for (int i = 0; i < NormalList.Count; i++) { NormalList[i].SetIndex(i); } if (MainMenuGlobal.getCurrentState() == MainMenuState.MS_SHORTCUT) { TriggerShortcut(); } LoadShortcut(); }
// Update is called once per frame void Update() { bool touchedDown = TouchInterface.GetTouchDown(); bool touchedUp = TouchInterface.GetTouchUp(); Vector2 touchPos = TouchInterface.GetTouchPosition(); if (touchedDown && MainMenuState.MS_SETTING == MainMenuGlobal.getCurrentState()) { if (BTSound.OverlapPoint(touchPos)) { //Debug.Log("Sound"); BTON = 1; IsTouch = true; lastTouch = touchPos; } else if (BTTel.OverlapPoint(touchPos)) { //Debug.Log("Tel"); BTON = 2; IsTouch = true; lastTouch = touchPos; } else if (BTLat.OverlapPoint(touchPos)) { //Debug.Log("Lat Lon"); BTON = 3; IsTouch = true; lastTouch = touchPos; } // else if(newsCollider.OverlapPoint(touchPos)){ // //Debug.Log("Lat Lon"); // BTON=4; // IsTouch = true; // lastTouch = touchPos; // } } if (touchedUp && MainMenuState.MS_SETTING == MainMenuGlobal.getCurrentState()) { if (IsTouch) { IsTouch = false; // if(newsCollider.OverlapPoint(touchPos)){ // // } // else{ BTON = 0; // } } } setUpdateSlide(); }
public void TriggerShortcut() { IsOpen = !IsOpen; if (MainMenuGlobal.getCurrentState() == MainMenuState.MS_TUTORIAL_SHORTCUT) { MainMenuGlobal.Tutorial.NextTutorial(); } else if (IsOpen) { MainMenuGlobal.SetState(MainMenuState.MS_SHORTCUT); } StartCoroutine("RunTrigger"); }
// Update is called once per frame void Update() { if ((MainMenuGlobal.getCurrentState() != MainMenuState.MS_NORMAL) && (MainMenuGlobal.getCurrentState() != MainMenuState.MS_DRAG) && (MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_DRAG) && (MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_SHORTCUT) ) { IsDrag = false; IsMouseDown = false; return; } updateTouch(); updateRotate(); }
public void UnPinn() { PinnHeader.ShiftUp(this); UnPinnObj.PushBackItem(); if (MainMenuGlobal.getCurrentState() == MainMenuState.MS_SHORTCUT) { UserCommonData.RemoveBookmark(UnPinnObj.index); } if (EventCollider != null) { EventCollider.enabled = false; } StopCoroutine("PlayUnPin"); StopCoroutine("PlayPin"); StopCoroutine("PlayShiftUp"); StartCoroutine("PlayUnPin"); }
public void Pinn(int idx) { index = idx; transform.localPosition = new Vector3(-8, index * -0.6f, 0); if (MainMenuGlobal.getCurrentState() == MainMenuState.MS_SHORTCUT) { UserCommonData.AddBookmark(UnPinnObj.index); } if (EventCollider != null) { EventCollider.enabled = false; } //run Shift in StopCoroutine("PlayUnPin"); StopCoroutine("PlayPin"); StopCoroutine("PlayShiftUp"); StartCoroutine("PlayPin"); }
IEnumerator RunTrigger() { Vector3 swapPts = (IsOpen)?SwapInPts.transform.position:SwapOutPts.transform.position; IsRunning = true; while (Vector3.Distance(transform.position, swapPts) > 0.05f) { Vector3 newPosition = Vector3.Lerp(transform.position, swapPts, Time.deltaTime * 10); transform.position = newPosition; yield return(null); } transform.position = swapPts; IsRunning = false; if (MainMenuGlobal.getCurrentState() == MainMenuState.MS_TUTORIAL_CLOSE_SHORTCUT) { MainMenuGlobal.Tutorial.NextTutorial(); } else if (!IsOpen) { MainMenuGlobal.SetState(MainMenuState.MS_NORMAL); } }
public void skipTutorial() { Debug.Log("Skip Tutorial"); pageList[currentIndex].UnHightlightObject(); currentIndex = pageList.Length; skipObject.SetActive(false); Awake(); switch (MainMenuGlobal.getCurrentState()) { case MainMenuState.MS_TUTORIAL_DRAG: { } break; case MainMenuState.MS_TUTORIAL_SHORTCUT: { } break; case MainMenuState.MS_TUTORIAL_PIN_RED: { ShortCutMain.pGlobal.TriggerShortcut(); } break; case MainMenuState.MS_TUTORIAL_UNPIN_RED: { ShortCutMain.pGlobal.TriggerShortcut(); } break; case MainMenuState.MS_TUTORIAL_PIN_GREEN: { ShortCutMain.pGlobal.TriggerShortcut(); } break; case MainMenuState.MS_TUTORIAL_UNPIN_GREEN: { ShortCutMain.pGlobal.TriggerShortcut(); } break; case MainMenuState.MS_TUTORIAL_CLOSE_SHORTCUT: { ShortCutMain.pGlobal.TriggerShortcut(); } break; case MainMenuState.MS_TUTORIAL_SETTING: { } break; } NextTutorial(); }
private void updateRotate() { if (onRotate == 1 || onRotate == 2) { if (onRotate == 1) { rotateDiff = (-0.734f) * DragSensitive; } else if (onRotate == 2) { rotateDiff = (0.736f) * DragSensitive; } if (onRotate == 1 || onRotate == 2) { if ((MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_DRAG) && (MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_SHORTCUT)) { MainMenuGlobal.SetState(MainMenuState.MS_DRAG); } IsDragArrow = true; } if (IsDragArrow) { moveVal += rotateDiff * 8; foreach (GameObject gobj in pageLayers) { PageLayer obj = gobj.GetComponent <PageLayer> (); obj.ResetBubble(); } roadLayer.SlideRoad(rotateDiff); //move layer here foreach (GameObject gobj in pageLayers) { PageLayer obj = gobj.GetComponent <PageLayer> (); obj.RotatePageDiff(rotateDiff); } //get current Layer you're in //check current RotateVal length } if (countCor >= 6) { foreach (GameObject gobj in pageLayers) { PageLayer obj = gobj.GetComponent <PageLayer> (); obj.PopBubble(); obj.PopObject(); } setCurrentLayerNo(); // rotateMorphVal.morphEasein (0, -moveVal, 10); IsDragArrow = false; onRotate = 0; moveVal = 0f; foreach (GameObject gobj in pageLayers) { PageLayer obj = gobj.GetComponent <PageLayer> (); obj.RotatePageDiff(rotateMorphVal.dVal); } roadLayer.SlideRoad(rotateMorphVal.dVal); rotateMorphVal.Update(); if (rotateMorphVal.IsFinish()) { if ((MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_DRAG) && (MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_SHORTCUT)) { MainMenuGlobal.SetState(MainMenuState.MS_NORMAL); } } } countCor++; } }
// Update is called once per frame void Update() { if (PopupObject.IsPopup) { return; } if (MainMenuGlobal.getCurrentState() != MainMenuState.MS_NORMAL && MainMenuGlobal.getCurrentState() != MainMenuState.MS_SHORTCUT && MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_SHORTCUT && MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_CLOSE_SHORTCUT) { return; } if (ShortCutCollider == null) { return; } if (IsRunning) { return; } bool touchedDown = TouchInterface.GetTouchDown(); bool touchedUp = TouchInterface.GetTouchUp(); Vector2 touchPos = TouchInterface.GetTouchPosition(); if (touchedDown) { if (ShortCutCollider.OverlapPoint(touchPos)) { //Trigger Shortcut mSound.playSound("click"); TriggerShortcut(); } else if ((MainMenuGlobal.getCurrentState() == MainMenuState.MS_SHORTCUT) && TouchArea.OverlapPoint(touchPos)) { //mSound.playSound("click"); lastTouchPos = touchPos; ShortCutCurrentPos = DummyPosition.transform.localPosition; IsDrag = true; } } if (touchedUp) { IsDrag = false; } if (IsDrag) { float tempPosx = ShortCutCurrentPos.x; //calculate CurrentMapPos Vector3 movedPosition = ShortCutCurrentPos + new Vector3(0, touchPos.y - lastTouchPos.y, 0); ShortCutCurrentPos = new Vector3(tempPosx, ShortCutCurrentPos.y, 0); DummyPosition.GetComponent <Rigidbody2D>().velocity = (movedPosition - ShortCutCurrentPos) * 60; lastTouchPos = touchPos; } else { DummyPosition.GetComponent <Rigidbody2D>().AddForce(-DummyPosition.GetComponent <Rigidbody2D>().velocity *5); } ShortCutDetail.transform.localPosition = DummyPosition.GetComponent <Rigidbody2D>().transform.localPosition; }
// Update is called once per frame void Update() { bool touchedDown = TouchInterface.GetTouchDown(); bool touchedUp = TouchInterface.GetTouchUp(); Vector2 touchPos = TouchInterface.GetTouchPosition(); if (touchedDown) { if (boxSkip.OverlapPoint(touchPos)) { IsTouch = true; lastTouchPos = touchPos; } } if (touchedUp) { if (boxSkip.OverlapPoint(touchPos)) { if (IsTouch && (Vector2.Distance(touchPos, lastTouchPos) < 0.5f)) { skipTutorial(); } } } switch (MainMenuGlobal.getCurrentState()) { case MainMenuState.MS_TUTORIAL_DRAG: { if (touchedDown) { pageList[currentIndex].gameObject.SetActive(false); } else if (touchedUp) { pageList[currentIndex].gameObject.SetActive(true); } } break; case MainMenuState.MS_TUTORIAL_SHORTCUT: { } break; case MainMenuState.MS_TUTORIAL_PIN_RED: { } break; case MainMenuState.MS_TUTORIAL_UNPIN_RED: { } break; case MainMenuState.MS_TUTORIAL_PIN_GREEN: { } break; case MainMenuState.MS_TUTORIAL_UNPIN_GREEN: { } break; case MainMenuState.MS_TUTORIAL_CLOSE_SHORTCUT: { } break; case MainMenuState.MS_TUTORIAL_SETTING: { if (touchedUp) { NextTutorial(); } } break; } }
private void updateTouch() { float diff = 0; if (TouchInterface.GetTouchDown()) { if (rotateMorphVal.IsFinish()) { IsMouseDown = true; Vector2 mousePos = TouchInterface.GetTouchPosition(); lastTouchPos = mousePos; } } if (TouchInterface.GetTouchUp()) { if (IsMouseDown) { mSound.playSound("fw"); if (IsDrag) { foreach (GameObject gobj in pageLayers) { PageLayer obj = gobj.GetComponent <PageLayer> (); obj.PopBubble(); obj.PopObject(); } if (MainMenuGlobal.getCurrentState() == MainMenuState.MS_TUTORIAL_DRAG) { MainMenuGlobal.Tutorial.NextTutorial(); } } setCurrentLayerNo(); rotateMorphVal.morphEasein(0, -moveVal, 10); IsDrag = false; IsMouseDown = false; } } if (IsMouseDown) { Vector2 mousePos = TouchInterface.GetTouchPosition(); diff = (lastTouchPos.x - mousePos.x) * DragSensitive; if (Mathf.Abs(diff) > DragTreshold) { if ((MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_DRAG) && (MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_SHORTCUT)) { MainMenuGlobal.SetState(MainMenuState.MS_DRAG); } IsDrag = true; } if (IsDrag) { lastTouchPos = mousePos; moveVal += diff; Debug.Log("IsDrag Cal Page No = " + currentLayerNo + " " + moveVal); foreach (GameObject gobj in pageLayers) { PageLayer obj = gobj.GetComponent <PageLayer> (); obj.ResetBubble(); } roadLayer.SlideRoad(diff); //move layer here foreach (GameObject gobj in pageLayers) { PageLayer obj = gobj.GetComponent <PageLayer> (); obj.RotatePageDiff(diff); } //get current Layer you're in //check current RotateVal length } } else { moveVal = 0; { //keep snap layer //snap layer by using rotateVal //get delta angle here foreach (GameObject gobj in pageLayers) { PageLayer obj = gobj.GetComponent <PageLayer> (); obj.RotatePageDiff(rotateMorphVal.dVal); } roadLayer.SlideRoad(rotateMorphVal.dVal); rotateMorphVal.Update(); if (rotateMorphVal.IsFinish()) { if ((MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_DRAG) && (MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_SHORTCUT)) { MainMenuGlobal.SetState(MainMenuState.MS_NORMAL); } } } } }
// Update is called once per frame void Update() { bool touchedDown = TouchInterface.GetTouchDown(); bool touchedUp = TouchInterface.GetTouchUp(); Vector2 touchPos = TouchInterface.GetTouchPosition(); if (touchedDown && MainMenuState.MS_HELP == MainMenuGlobal.getCurrentState()) { if (BTMenu1.OverlapPoint(touchPos)) { PrevMenuPage = MenuPage; MenuPage = 1; SubMenuPage = 0; ChangeMenu(); } else if (BTMenu2.OverlapPoint(touchPos)) { PrevMenuPage = MenuPage; MenuPage = 2; SubMenuPage = 0; ChangeMenu(); } else if (BTMenu3.OverlapPoint(touchPos)) { PrevMenuPage = MenuPage; MenuPage = 3; SubMenuPage = 0; ChangeMenu(); } else if (BTMenu4.OverlapPoint(touchPos)) { PrevMenuPage = MenuPage; MenuPage = 4; SubMenuPage = 0; ChangeMenu(); } else if (BTMenu5.OverlapPoint(touchPos)) { PrevMenuPage = MenuPage; MenuPage = 5; SubMenuPage = 0; ChangeMenu(); } else if (BTRootMenu.OverlapPoint(touchPos)) { PrevMenuPage = MenuPage; MenuPage = 0; SubMenuPage = 0; BTOBjRootMenu.SetActive(false); ChangeMenu(); } else if (BTFW.OverlapPoint(touchPos)) { SubMenuPage++; ChangeSubMenu(true); } else if (BTBACK.OverlapPoint(touchPos)) { if (SubMenuPage > 0) { SubMenuPage--; ChangeSubMenu(false); } else { changeToRoot(); } } } }
// Update is called once per frame void Update() { if (MainMenuGlobal.getCurrentState() != MainMenuState.MS_SHORTCUT && MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_PIN_GREEN && MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_UNPIN_GREEN) { return; } if (SubList.Length > 0) { bool NoSubPinn = true; for (int i = 0; i < SubList.Length; i++) { if (!SubList[i].IsPinn) { NoSubPinn = false; break; } } if (NoSubPinn) { IsPinn = true; PinSR.sprite = Pin_Green; } else { IsPinn = false; PinSR.sprite = UnPin_Green; } } if (PinCollider == null) { return; } if (IsRunning) { return; } bool touchedDown = TouchInterface.GetTouchDown(); bool touchedUp = TouchInterface.GetTouchUp(); Vector2 touchPos = TouchInterface.GetTouchPosition(); if (touchedDown) { if (PinCollider.OverlapPoint(touchPos)) { //pinned all sub item or pin itself if (!IsPinn) { if (MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_UNPIN_GREEN) { PinnItem(); } if (MainMenuGlobal.getCurrentState() == MainMenuState.MS_TUTORIAL_PIN_GREEN) { MainMenuGlobal.Tutorial.NextTutorial(); } } else if (IsPinn) { if (MainMenuGlobal.getCurrentState() != MainMenuState.MS_TUTORIAL_PIN_GREEN) { UnPinnItem(); } if (MainMenuGlobal.getCurrentState() == MainMenuState.MS_TUTORIAL_UNPIN_GREEN) { MainMenuGlobal.Tutorial.NextTutorial(); } } } } }