void IDropHandler.OnDrop(PointerEventData eventData) { if (IsLocked) { return; } DraggableItemUI droppedItem = eventData.pointerDrag.gameObject.GetComponent <DraggableItemUI>(); if (droppedItem == null) { return; } DroppableSlotUI fromSlot = droppedItem.GetComponentInParent <DroppableSlotUI>(); if (fromSlot == null || fromSlot == this) { return; } if (inventoryUI == null) { Debug.LogError("Inventory Does Not Exists!!!\nAdd Inventory Component."); return; } // Check IsLocked if (inventoryUI.itemUIs[Index]?.Item.LockItemSlot ?? false || droppedItem.Item.LockItemSlot) { return; } // Trigger Action UI_Screen screen = null; if (fromSlot.onMoveItem(fromSlot.Index, inventoryUI.inventory, Index)) { // Drop Success OnDropSuccess(); // Get This Screen screen = GetComponentInParent <UI_Screen>(); } else { // Drop Fail OnDropFail(); // Get Item Screen screen = droppedItem.GetComponent <UI_Screen>(); } // Send Screen to Top if (screen != null) { CloseableScreenManager.Inst.SendScreenToTop(screen); } }
public void SendScreenToTop(UI_Screen screen) { screen.transform.SetAsFirstSibling(); for (int i = 0; i < transform.childCount; i++) { if (transform.GetChild(i).gameObject.activeSelf) { transform.GetChild(i).GetComponent <UI_Screen>().thisCanvas.sortingOrder = -i; } } }
protected void AnimateScreen(UI_Screen previousScreen, UI_Screen currentScreen) { //previousScreen.gameObject.transform.localPosition = new Vector3(1080, 0, 0); currentScreen.gameObject.transform.localPosition = new Vector3(xPos, 0, 0); LeanTween.moveLocalX(currentScreen.gameObject, 0f, 1f).setEase(LeanTweenType.easeInOutQuad) .setOnStart(() => { eventSystem.enabled = false; currentScreen.GetComponentInParent <UI_System>().StartScreen(currentScreen); }) .setOnComplete(() => { previousScreen.GetComponentInParent <UI_System>().CloseScreen(previousScreen); eventSystem.enabled = true; currentScreen.SetSelectable(); }); LeanTween.moveLocalX(previousScreen.gameObject, -xPos, 1f).setEase(LeanTweenType.easeInOutQuad); }
public void SwitchScreens(UI_Screen uiScreen) { if (uiScreen) { if (currentScreen) { currentScreen.CloseScreen(); previousScreen = currentScreen; } currentScreen = uiScreen; currentScreen.StartScreen(); if (onSwitchScreen != null) { onSwitchScreen.Invoke(); } } }
public void ChangeScreen(UI_Screen nextScreen) { if ((nextScreen == Screen21) && (Gas || Rock)) { if (Gas) { ScreenSys.SwitchScreens(aScreen: Screen21); } else if (Rock) { ScreenSys.SwitchScreens(aScreen: Screen22); } } else if ((Gas || Rock)) { ScreenSys.SwitchScreens(nextScreen); } }
//show or hide touch screen controls void SetTouchScreenControls(UI_Screen UI) { if (UI.UI_Name == "TouchScreenControls") { return; } InputManager inputManager = GameObject.FindObjectOfType <InputManager>(); if (inputManager != null && inputManager.inputType == INPUTTYPE.TOUCHSCREEN) { if (UI.showTouchControls) { ShowMenu("TouchScreenControls", false); } else { CloseMenu("TouchScreenControls"); } } }
public void SetUIReferences(UI_System.UI_System uiSys, UI_Screen uiScr) { SetUISystem(uiSys); SetUIScreen(uiScr); }
public void SetUIScreen(UI_Screen uiScr) { _uiScreen = uiScr; }
IEnumerator Die(float waitTime) { if (!_Check) { _Check = true; _anim.SetBool("Die", true); GameObject.Find("BossSounds").transform.GetChild(0).GetComponent <AudioSource>().Play(); dataQuest _data = GameObject.Find("QuestManager").GetComponent <dataQuest>(); _data._Stage = BossStage.ToString(); yield return(new WaitForSeconds(waitTime)); A_screen.Hide_AllScreen(); A_screen.EndStage.SetActive(true); A_screen.EndButtom.SetActive(true); EndStage _end = GameObject.Find("EndStage Panel").GetComponent <EndStage>(); UI_Screen data = GameObject.Find("Canvas").GetComponent <UI_Screen>(); if (levelStage == "S") { _end.itemAmount = 4; sumExp += ((bossExp * 2) + (bossExp / 2)); } else if (levelStage == "A") { _end.itemAmount = 3; sumExp += (bossExp * 2); } else if (levelStage == "B") { _end.itemAmount = 2; sumExp += ((bossExp * 2) - (bossExp / 2)); } else if (levelStage == "C") { _end.itemAmount = 1; sumExp += bossExp; } P_Sta.Exp += Convert.ToInt32(sumExp); data.data.text += "\n ท่านได้รับค่าประสบการณ์ " + sumExp + " หน่วย"; if (BossStage.ToString() == "Stage_1") { _end.addItemEnd(_end.itemAmount, itemAd, 3); } else if (BossStage.ToString() == "Stage_2") { _end.addItemEnd(_end.itemAmount, itemAd2, 6); } else if (BossStage.ToString() == "Stage_3") { _end.addItemEnd(_end.itemAmount, itemAd3, 3); } GameObject.Find("InventoryManager").GetComponent <Inventory>().ScrollDown(); _end.LavelStage = levelStage; _end.TimeStage = timeStage; _data._Degree = _end.LavelStage; _data.QuestEnd(); Destroy(gameObject, 1.4f); } }