using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; using UnityEngine.UI; using UnityEngineInternal; using UnityEditor; using ARLocation; using System; public class UITest : MonoBehaviour { public GameObject op; public LocationPath locationPath; List tracingMarkers = new List(); public GameObject compass; public GameObject compass_1; private GameObject instantiatedOBJ; private float time = 1f; public GameObject lastPosition; public GameObject lastPosition_Mom; public GameObject[] obj_Choice; public GameObject spawnPosition; public Sprite[] icons; public GameObject arSe; public Camera arCamera; public GameObject[] navis; public GameObject arrowON; public GameObject start_Panel; public GameObject select_Panel; public Button[] main_buttons; public GameObject naviSub_Panel; public Text[] text; public GameObject[] buildings; public GameObject[] buttons; public Button select_Button; public Sprite[] select_Image; public Button naviStart_Button; public Button[] start_Point; public GameObject obj_ChoicePanel; private int building_count1 = 0; private int building_count2 = 0; private int select_count = 0; private int functions = 0; private int ID; private int delay_Time = 0; private int x,y; public void ClickMap_Button() { Tweener startTweenr = start_Panel.transform.DOMoveY(300, 1f); startTweenr.OnComplete(() => OnCompleteText()); buttons[0].SetActive(true); arSe.GetComponent().enabled = false; main_buttons[0].GetComponent().transform.DOMoveY(-226, 0.5f); main_buttons[1].GetComponent().transform.DOMoveY(-226, 0.5f); main_buttons[2].GetComponent().transform.DOMoveY(-226, 0.5f); main_buttons[3].GetComponent().transform.DOMoveY(-226, 0.5f); } public void OnCompleteText() { text[0].DOText("확인하실 건물을 선택하십시오!", 1f); text[1].DOText("프라임관", 1f); select_Panel.SetActive(true); } public void Notyet_Button() { Tweener objT = text[2].DOText("곧 구현될 기능입니다.", 1f); objT.OnComplete(() => NotYet()); } public void NotYet() { text[2].text = ""; } public void Click_FirstB(string tag) { GameObject[] gameObjects = GameObject.FindGameObjectsWithTag(tag); foreach (GameObject target in gameObjects) { GameObject.Destroy(target); compass_1.SetActive(false); } Invoke("Late1", 0.1f); if (select_count == 0) { building_count1 += 1; //count 1 buildings[0].SetActive(true); arSe.GetComponent().enabled = true; //instantiatedOBJ = (GameObject)Instantiate(buildings[0], spawnPosition.transform.position, spawnPosition.transform.rotation); buildings[0].GetComponent().icon = icons[4]; lastPosition.GetComponent().icon = icons[5]; start_Panel.transform.DOMoveY(-340, 1f); buttons[0].SetActive(true); //Exit 버튼 buttons[1].SetActive(true); //UP Down 버튼 compass.SetActive(true); } else if (select_count == 1) { building_count2 += 1; buildings[2].SetActive(true); buildings[2].GetComponent().icon = icons[4]; buildings[0].GetComponent().icon = icons[5]; buildings[1].GetComponent().icon = icons[5]; buttons[0].SetActive(true); buttons[1].SetActive(true); compass.SetActive(true); start_Panel.transform.DOMoveY(-340, 1f); } else//count가 0 이 아닐때 즉 아래층을 눌렀을때. { Tweener objT = text[2].DOText("도면이 구현되지 않았습니다.", 1f); objT.OnComplete(() => NotYet()); } } // 오브젝트 컨트롤 부분 public void Obj_Button() { obj_ChoicePanel.transform.DOMoveX(0, 0.5f); arSe.GetComponent().enabled = true; buttons[0].SetActive(true); main_buttons[0].GetComponent().transform.DOMoveY(-226, 0.5f); main_buttons[1].GetComponent().transform.DOMoveY(-226, 0.5f); main_buttons[2].GetComponent().transform.DOMoveY(-226, 0.5f); main_buttons[3].GetComponent().transform.DOMoveY(-226, 0.5f); } public void Obj_ChoiceButton() { arSe.GetComponent().placePrefab = obj_Choice[0]; } public void Obj_ChoiceButton1() { arSe.GetComponent().placePrefab = obj_Choice[1]; } public void Obj_ChoiceButton2() { arSe.GetComponent().placePrefab = obj_Choice[2]; } public void Obj_ChoiceButton3() { arSe.GetComponent().placePrefab = obj_Choice[3]; } // 모든거 다 Exit 할때 public void Click_Exit() { compass_1.SetActive(false); start_Panel.transform.DOMoveY(-340, 1f); buildings[0].SetActive(false); buildings[1].SetActive(false); buildings[2].SetActive(false); //Destroy(GameObject.Find("GameObject (1)(Clone)")); buildings[1].SetActive(false); buttons[1].SetActive(false); building_count1 = 0; building_count2 = 0; arSe.GetComponent().enabled = false; naviSub_Panel.transform.DOLocalMoveY(-2600, 1f); compass.SetActive(false); buttons[0].SetActive(false); arSe.GetComponent().enabled = false; obj_ChoicePanel.transform.DOMoveX(-205, 0.5f); main_buttons[0].GetComponent().transform.DOMoveY(160, 0.5f); main_buttons[1].GetComponent().transform.DOMoveY(160, 0.5f); main_buttons[2].GetComponent().transform.DOMoveY(160, 0.5f); main_buttons[3].GetComponent().transform.DOMoveY(160, 0.5f); } public void Click_UpButton(string tag) { if (building_count1 == 1) { GameObject[] gameObjects = GameObject.FindGameObjectsWithTag(tag); foreach(GameObject target in gameObjects) { GameObject.Destroy(target); compass_1.SetActive(false); } Invoke("Late1", 0.1f); buildings[0].SetActive(false); buildings[1].SetActive(true); buildings[0].GetComponent().icon = icons[5]; buildings[1].GetComponent().icon = icons[4]; lastPosition.GetComponent().icon = icons[5]; building_count1 += 1; } else if(building_count1 > 1){ Tweener objT = text[2].DOText("아직 2층밖에 없습니다.", 1f); objT.OnComplete(() => NotYet()); } if (building_count2 == 1) { Tweener objT = text[2].DOText("2층은 아직 없습니다.", 1f); objT.OnComplete(() => NotYet()); /*GameObject[] gameObjects = GameObject.FindGameObjectsWithTag(tag); foreach (GameObject tartget in gameObjects) { GameObject.Destroy(tartget); compass_1.SetActive(false); }*/ } } void Late1() { compass_1.SetActive(true); } public void Click_DownButton(string tag) { if (building_count1 == 1) { Tweener objT = text[2].DOText("내려갈 층이 없습니다.", 1f); objT.OnComplete(() => NotYet()); } else if (building_count1 == 2) { GameObject[] gameObjects = GameObject.FindGameObjectsWithTag(tag); foreach (GameObject target in gameObjects) { GameObject.Destroy(target); compass_1.SetActive(false); } Invoke("Late1", 0.1f); buildings[0].SetActive(true); buildings[1].SetActive(false); buildings[0].GetComponent().icon = icons[4]; buildings[1].GetComponent().icon = icons[5]; lastPosition.GetComponent().icon = icons[5]; building_count1 -= 1; } } public void Click_Right() //장소 선택에서 오른쪽 버튼 눌렀을때. { switch (select_count) { case 0: select_Button.GetComponent