using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; public class InGameTouchInfo : MonoBehaviourSingletonTemplate { private void Start() { //var uiel = UIEventListener.Get(transform.GetChild(0).gameObject); //uiel.onClick += OnClick; //uiel.onDrag += OnDrag; //uiel.onPress += OnPress; } private void OnPress(GameObject go, bool state) { //// 마우스 위치를 화면 좌표에서 월드 좌표로 변환 //Vector3 worldPos = UICamera.mainCamera.ScreenToWorldPoint(Input.mousePosition); //// 월드 좌표를 NGUI 좌표로 변환 //Vector3 localPos = tf_joystick.parent.InverseTransformPoint(worldPos); //// 변환된 좌표를 조이스틱 위치로 설정 //tf_joystick.localPosition = localPos; } //public void OnClick(GameObject _go) private void Update() { //if (InGameInfo.Ins.IsGameMode(eGameMode.Lobby)) return; if (Input.GetMouseButtonDown(0)) { //bool noAction = true; Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); var hits = Physics.RaycastAll(ray); for (int i = 0; i < hits.Length; i++) { switch (hits[i].collider.tag) { // 이동이 생겨서 터치로 아이템 먹는 거 제거 (대신 가까이 가면 먹음) //case "DropItem": // noAction = false; // hits[i].collider.GetComponent().ItemTouch(); // break; case "Mob": //noAction = false; MonsterSimpleInfo.Ins.Set(hits[i].collider.GetComponent()); //MyValue.MyPC.Change_Target(true, hits[i].collider.GetComponent()); break; case "ChapterClear": if (hits[i].collider.GetComponent().IsChapterClearCondition()) InGameInfo.Ins.Clear_Chapter(); break; case "Grave": if (ServerInfo.Ins.m_ServerData.Get_Common(eCommon.DungeonOpen1) < 1 && Vector3.Distance(MyValue.MyPC.Get_position(), hits[i].transform.position) < 5f) { ServerInfo.Ins.m_ServerData.Add_Common(eCommon.DungeonOpen1); //ToastUI.Ins.Set("기억의 던전에서 갈 수 없던 곳이 오픈되었다."); } break; case "Mine": if (ServerInfo.Ins.m_ServerData.Get_Common(eCommon.DungeonOpen2) < 1 && Vector3.Distance(MyValue.MyPC.Get_position(), hits[i].transform.position) < 5f) { ServerInfo.Ins.m_ServerData.Add_Common(eCommon.DungeonOpen2); //ToastUI.Ins.Set("기억의 던전에서 갈 수 없던 곳이 오픈되었다."); } break; case "FireOff": if (Vector3.Distance(MyValue.MyPC.Get_position(), hits[i].transform.position) < 5f) { hits[i].transform.gameObject.SetActive(false); GameUI.Ins.IngameUI.m_ChapterQuest.Add_PurposeCount(new ChapterQuestAddData { purpose = ePurpose.GetItem, objtype = ChapterQuestObjType.FireOff }); } break; case "Flag": if (Vector3.Distance(MyValue.MyPC.Get_position(), hits[i].transform.position) < 5f) { hits[i].transform.gameObject.SetActive(false); GameUI.Ins.IngameUI.m_ChapterQuest.Add_PurposeCount(new ChapterQuestAddData { purpose = ePurpose.GetItem, objtype = ChapterQuestObjType.Flag }); } break; case "Stone": if (hits[i].collider.GetComponent() != null) MyValue.MyPC.Change_Target(true, hits[i].collider.GetComponent()); break; default: if (hits[i].collider.GetComponent() != null) MyValue.MyPC.Change_Target(true, hits[i].collider.GetComponent()); break; } } //if (noAction) //{ // if (Physics.Raycast(ray, out RaycastHit hit)) // { // if (MyValue.MyPC.Check_Path(hit.point)) // { // if (MyValue.MyPC.Run_Destination(hit.point, go_Mark)) // { // go_Mark.transform.position = hit.point; // go_Mark.SetActive(true); // } // } // } //} } } public void OnDrag(GameObject go, Vector2 delta) { //var x = Math.Abs(delta.x); //if (x > 4f) m_RealCamera.Set_Axis(true, delta.x * 0.03f); //var y = Math.Abs(delta.y); //if (y > 4f) m_RealCamera.Set_Axis(false, delta.y * 0.01f); } }