You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
402 lines
14 KiB
402 lines
14 KiB
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<TracingMarker> tracingMarkers = new List<TracingMarker>();
|
|
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<Selection__1>().enabled = false;
|
|
main_buttons[0].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
main_buttons[1].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
main_buttons[2].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
main_buttons[3].GetComponent<RectTransform>().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<Object_Control>().enabled = true;
|
|
//instantiatedOBJ = (GameObject)Instantiate(buildings[0], spawnPosition.transform.position, spawnPosition.transform.rotation);
|
|
buildings[0].GetComponent<TracingMarker>().icon = icons[4];
|
|
lastPosition.GetComponent<TracingMarker>().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<TracingMarker>().icon = icons[4];
|
|
buildings[0].GetComponent<TracingMarker>().icon = icons[5];
|
|
buildings[1].GetComponent<TracingMarker>().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<Selection__1>().enabled = true;
|
|
buttons[0].SetActive(true);
|
|
main_buttons[0].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
main_buttons[1].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
main_buttons[2].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
main_buttons[3].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
}
|
|
public void Obj_ChoiceButton()
|
|
{
|
|
arSe.GetComponent<Selection__1>().placePrefab = obj_Choice[0];
|
|
}
|
|
public void Obj_ChoiceButton1()
|
|
{
|
|
arSe.GetComponent<Selection__1>().placePrefab = obj_Choice[1];
|
|
}
|
|
public void Obj_ChoiceButton2()
|
|
{
|
|
arSe.GetComponent<Selection__1>().placePrefab = obj_Choice[2];
|
|
}
|
|
public void Obj_ChoiceButton3()
|
|
{
|
|
arSe.GetComponent<Selection__1>().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<Selection__1>().enabled = false;
|
|
naviSub_Panel.transform.DOLocalMoveY(-2600, 1f);
|
|
compass.SetActive(false);
|
|
buttons[0].SetActive(false);
|
|
arSe.GetComponent<Selection__1>().enabled = false;
|
|
obj_ChoicePanel.transform.DOMoveX(-205, 0.5f);
|
|
main_buttons[0].GetComponent<RectTransform>().transform.DOMoveY(160, 0.5f);
|
|
main_buttons[1].GetComponent<RectTransform>().transform.DOMoveY(160, 0.5f);
|
|
main_buttons[2].GetComponent<RectTransform>().transform.DOMoveY(160, 0.5f);
|
|
main_buttons[3].GetComponent<RectTransform>().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<TracingMarker>().icon = icons[5];
|
|
buildings[1].GetComponent<TracingMarker>().icon = icons[4];
|
|
lastPosition.GetComponent<TracingMarker>().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<TracingMarker>().icon = icons[4];
|
|
buildings[1].GetComponent<TracingMarker>().icon = icons[5];
|
|
lastPosition.GetComponent<TracingMarker>().icon = icons[5];
|
|
building_count1 -= 1;
|
|
}
|
|
}
|
|
public void Click_Right() //장소 선택에서 오른쪽 버튼 눌렀을때.
|
|
{
|
|
switch (select_count)
|
|
{
|
|
case 0:
|
|
select_Button.GetComponent<Button>().image.sprite = select_Image[1];
|
|
select_count += 1;
|
|
text[1].DOText("공대", 1.5f);
|
|
break;
|
|
default:
|
|
Tweener objT = text[2].DOText("다음 장소가 존재 하지 않습니다.", 1f);
|
|
objT.OnComplete(() => NotYet());
|
|
break;
|
|
}
|
|
}
|
|
public void Click_Left() // 장소 선택 에서 왼쪽 버튼 눌렀을때.
|
|
{
|
|
switch (select_count)
|
|
{
|
|
case 1:
|
|
select_Button.GetComponent<Button>().image.sprite = select_Image[0];
|
|
select_count -= 1;
|
|
text[1].DOText("프라임관", 1.5f);
|
|
break;
|
|
default:
|
|
Tweener objT = text[2].DOText("이전 장소가 존재 하지 않습니다.", 1f);
|
|
objT.OnComplete(() => NotYet());
|
|
break;
|
|
}
|
|
}
|
|
public void Navi_Button()
|
|
{
|
|
Tweener navi = naviSub_Panel.transform.DOLocalMoveY(-640, 1f);
|
|
navi.OnComplete(() => naviOn());
|
|
buildings[0].GetComponent<TracingMarker>().icon = icons[5];
|
|
buildings[1].GetComponent<TracingMarker>().icon = icons[5];
|
|
lastPosition.GetComponent<TracingMarker>().icon = icons[6];
|
|
buttons[0].SetActive(true);
|
|
compass_1.SetActive(false);
|
|
arSe.GetComponent<Selection__1>().enabled = false;
|
|
main_buttons[0].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
main_buttons[1].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
main_buttons[2].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
main_buttons[3].GetComponent<RectTransform>().transform.DOMoveY(-226, 0.5f);
|
|
}
|
|
public void naviOn()
|
|
{
|
|
text[3].DOText("시작위치를 골라주세요.", 1f);
|
|
}
|
|
|
|
public void click_0Button()
|
|
{
|
|
ID = 0;
|
|
FirstStart_Point();
|
|
start_Point[1].GetComponent<Button>().image.DOColor(Color.red, 1f);
|
|
|
|
}
|
|
public void click_40Button()
|
|
{
|
|
ID = 40;
|
|
FirstStart_Point();
|
|
start_Point[3].GetComponent<Button>().image.DOColor(Color.red, 1f);
|
|
}
|
|
public void click_13Button()
|
|
{
|
|
ID = 13;
|
|
FirstStart_Point();
|
|
start_Point[2].GetComponent<Button>().image.DOColor(Color.red, 1f);
|
|
}
|
|
public void click_7Button()
|
|
{
|
|
ID = 7;
|
|
FirstStart_Point();
|
|
start_Point[0].GetComponent<Button>().image.DOColor(Color.red, 1f);
|
|
}
|
|
public void click_19Button()
|
|
{
|
|
ID = 19;
|
|
FirstStart_Point();
|
|
start_Point[4].GetComponent<Button>().image.DOColor(Color.red, 1f);
|
|
}
|
|
public void click_25Button()
|
|
{
|
|
ID = 25;
|
|
FirstStart_Point();
|
|
start_Point[6].GetComponent<Button>().image.DOColor(Color.red, 1f);
|
|
}
|
|
public void click_29Button()
|
|
{
|
|
ID = 29;
|
|
FirstStart_Point();
|
|
start_Point[5].GetComponent<Button>().image.DOColor(Color.red, 1f);
|
|
}
|
|
public void FirstStart_Point()
|
|
{
|
|
Invoke("Delays", 0.5f);
|
|
}
|
|
//테스트는 0 -> 7 0 -> 13 으로 하기.
|
|
void Delays()
|
|
{
|
|
if (delay_Time == 0)
|
|
{
|
|
x = ID;
|
|
delay_Time++;
|
|
text[3].DOText("첫번째 경로가 선택 되었습니다.", 0.5f);
|
|
}
|
|
else if (delay_Time == 1)
|
|
{
|
|
y = ID;
|
|
if(x == 0 && y== 7) {
|
|
|
|
Tweener textTw = text[3].DOText(start_Point[4].name+"를 골랐습니다.", 1f);
|
|
textTw.OnComplete(() => Finish());
|
|
NaviStart();
|
|
}
|
|
else if (x == 0 && y == 13) {
|
|
Tweener textTw = text[3].DOText(start_Point[2].name + "를 골랐습니다.", 1f);
|
|
textTw.OnComplete(() => Finish());
|
|
NaviStart();
|
|
}
|
|
}
|
|
}
|
|
public void First_to_End1()
|
|
{
|
|
Tweener textTw =text[3].DOText("End1 를 골랐습니다.", 1f);
|
|
textTw.OnComplete(() => Finish());
|
|
naviStart_Button.gameObject.SetActive(true);
|
|
}
|
|
public void Finish()
|
|
{
|
|
text[3].DOText("경로가 생성되었습니다.", 1f);
|
|
}
|
|
public void NaviStart()
|
|
{
|
|
op.SetActive(true);
|
|
arrowON.SetActive(true);
|
|
navis[0].GetComponent<MoveAlongPath>().PlaybackSettings.Speed = 2f;
|
|
text[3].text = "";
|
|
compass.SetActive(true);
|
|
compass_1.SetActive(true);
|
|
Invoke("Late1", 0.1f);
|
|
for (int i = 0; i < 7; i++)
|
|
{
|
|
start_Point[i].GetComponent<Button>().image.DOColor(Color.black, 1f);
|
|
|
|
start_Point[i].gameObject.SetActive(true);
|
|
}
|
|
Tweener navi = naviSub_Panel.transform.DOLocalMoveY(-2470, 0.5f);
|
|
|
|
naviStart_Button.gameObject.SetActive(false);
|
|
naviSub_Panel.transform.DOLocalMoveY(-2600, 1f);
|
|
buttons[0].SetActive(false);
|
|
}
|
|
public void NotYet_Point()
|
|
{
|
|
Tweener wrongPath = text[3].DOText("아직 경로가 없습니다.", 1f);
|
|
wrongPath.OnComplete(() => RewriteWord());
|
|
}
|
|
public void RewriteWord()
|
|
{
|
|
text[3].DOText("출발 위치를 골라주세요.",1f);
|
|
}
|
|
}
|