using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using omFrame;
using omFrame.Static;
using omFrame.Table;
using Autohand;
using FTS;
using FTS.Device;
using FTS.Component;
using omFrame.Utility;
using UnityEngine.Events;
#region 텍스트 스크립트 enum 값
public enum TextScript
{
TextWaiting = 0,
Text1 = 1,
Text2 = 2,
Text3 = 3,
Text4 = 4,
Text5 = 5,
Text6 = 6,
Text7 = 7,
Text8 = 8,
Text9 = 9,
Text10 = 10,
Text11 = 11,
Text12 = 12,
Text13 = 13,
Text14 = 14,
Text15 = 15,
Text16 = 16,
Text17 = 17,
Text18 = 18,
Text19 = 19,
Text20 = 20,
Text21 = 21,
Text22 = 22,
Text23 = 23,
Text24 = 24,
Text25 = 25,
Text26 = 26,
Text27 = 27,
Text28 = 28,
Text29 = 29,
Text30 = 30,
Text31 = 31,
Text32 = 32,
Text33 = 33,
Text34 = 34,
Text35 = 35,
Text36 = 36,
Text37 = 37,
Text38 = 38,
Text39 = 39,
Text40 = 40,
Text41 = 41,
Text42 = 42,
Text43 = 43,
Text44 = 44,
TextNone =45,
TextSub0 = 46,
TextSub1 = 47,
TextSub2 = 48,
TextSub3 = 49,
TextSub4 = 50,
TextSub5 = 51,
}
#endregion
public class TailHookQuest : MonoBehaviour
{
protected Action m_callBack;
public omIInteraction m_omIInteraction; // 드론 인터렉션
public TailHookQuest m_curQuest = null; // 현재 퀘스트
public List<TailHookQuest> m_questList; // 퀘스트 리스트
public TextScript m_TextScript;
protected TailHook m_tailHook;
protected TailHookQuest m_tailHookQuest;
public bool m_end = false;
[Header("Quest Common (공통 퀘스트)")]
public bool m_common = false;
[TextArea(5, 5)]
public string m_description;
private static TailHookQuest inst = null;
protected TailHook_NetQuest netQuest;
[Header("For Camera")]
public Camera F16_HookCam;
public Camera T50_HookCam;
public Camera ValvCam;
public bool F16_HookCamBool = false;
public bool T50_HookCamBool = false;
public bool ValvCamBool = false;
omPlayerOwner m_omPlayerOwner;
private void Awake()
{
netQuest = GetComponent<TailHook_NetQuest>();
}
public virtual void OpenQuest()
{
GotoNextQuest();
}
public virtual void OpenNextQuest()
{
NextQuest();
}
public virtual void NextQuest()
{
if (m_questList.Count > 0)
{
if (m_curQuest == null)
{
m_curQuest = m_questList[0];
m_curQuest.OnQuestEnter();
}
else
{
m_curQuest.OnQuestExit();
if (m_questList.Count >= 2)
{
//다음 시나리오 퀘스트 받아오기
m_curQuest = m_questList[1];
m_curQuest.OnQuestEnter();
//현재 시나리오 퀘스트 지우기
m_questList.RemoveAt(0);
}
else
{
m_curQuest.OnQuestExit();
m_callBack();
}
}
}
else
{
m_curQuest = null;
m_end = true; // 퀘스트의 끝을 알리는 bool값
}
}
public virtual void GotoNextQuest()
{
if (m_questList.Count > 0)
{
if (m_curQuest == null)
{
m_curQuest = m_questList[0];
m_curQuest.OnQuestEnter();
}
else
{
m_curQuest.OnQuestExit();
if (m_questList.Count >= 2)
{
//다음 시나리오 퀘스트 받아오기
m_curQuest = m_questList[1];
m_curQuest.OnQuestEnter();
//현재 시나리오 퀘스트 지우기
m_questList.RemoveAt(0);
}
else
{
m_curQuest.OnQuestExit();
m_callBack();
}
}
}
else
{
m_curQuest = null;
m_end = true; // 퀘스트의 끝을 알리는 bool값
m_callBack();
}
}
// 부모 받음
public void SetTailHookQuest(TailHook hook)
{
m_tailHook = hook;
}
virtual public void Init()
{
EnableGameObjectArr(false);
}
public void AddListener(Action callBack)
{
m_callBack = callBack;
}
// 퀘스트 시작
virtual public void OnQuestEnter()
{
CallTextScript();
EnableGameObjectArr(true);
FindCam();
}
// 다음 퀘스트로 넘김
virtual public void OnQuestExit()
{
if (netQuest != null)
{
netQuest.SendQuest();
}
EnableGameObjectArr(false);
}
private void EnableGameObjectArr(bool flag)
{
//for (int i = user0; i < m_activeGameObjectArr.Length; ++i)
//{
// m_activeGameObjectArr[i].SetActive(flag);
//}
}
void FindCam()
{
if (F16_HookCamBool == true)
omFrameWork.Inst.Dialog.GetWSHud.OpenLeftEventView(F16_HookCam);
if (T50_HookCamBool == true)
omFrameWork.Inst.Dialog.GetWSHud.OpenLeftEventView(T50_HookCam);
if (ValvCamBool == true)
omFrameWork.Inst.Dialog.GetWSHud.OpenLeftEventView(ValvCam);
}
#region Text Script (텍스트 스크립트)
void CallTextScript()
{
switch (m_TextScript)
{
#region 공통 텍스트 (Common Text)
case TextScript.TextWaiting:
// 대기중 Text
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15025, true);
break;
case TextScript.TextNone:
// 텍스트 없을 때
break;
case TextScript.TextSub0:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15073, true);
break;
case TextScript.TextSub1:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15074, true);
break;
case TextScript.TextSub2:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15075, true);
break;
case TextScript.TextSub3:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15076, true);
break;
case TextScript.TextSub4:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15077, true);
break;
case TextScript.TextSub5:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15078, true);
break;
case TextScript.Text8:
omFrameWork.Inst.Dialog.GetWSHud.CloseInfoText();
omFrameWork.Inst.Dialog.GetWSHud.SetTitleText(1001, true);
break;
case TextScript.Text9:
omFrameWork.Inst.Dialog.GetWSHud.CloseTitleText();
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15030, true);
break;
#endregion
#region 텍스트 스크립트 (Text Script)
case TextScript.Text10:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15032, true);
break;
case TextScript.Text11:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15033, true);
break;
case TextScript.Text12:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15034, true);
break;
case TextScript.Text13:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15035, true);
break;
case TextScript.Text14:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15039, true);
break;
case TextScript.Text15:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15043, true);
break;
case TextScript.Text16:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15040, true);
break;
case TextScript.Text17:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15041, true);
break;
case TextScript.Text18:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15042, true);
break;
case TextScript.Text19:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15050, true);
break;
case TextScript.Text20:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15051, true);
break;
case TextScript.Text21:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15052, true);
break;
case TextScript.Text22:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15047, true);
break;
case TextScript.Text23:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15053, true);
break;
case TextScript.Text24:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15048, true);
break;
case TextScript.Text25:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15049, true);
break;
case TextScript.Text26:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15053, true);
break;
case TextScript.Text27:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15054, true);
break;
case TextScript.Text28:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15067, true);
break;
case TextScript.Text29:
break;
case TextScript.Text30:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15069, true);
break;
case TextScript.Text31:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15060, true);
break;
case TextScript.Text32:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15055, true);
break;
case TextScript.Text33:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15070, true);
break;
case TextScript.Text34:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15061, true);
break;
case TextScript.Text35:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15057, true);
break;
case TextScript.Text36:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15061, true);
break;
case TextScript.Text37:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15062, true);
break;
case TextScript.Text38:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15059, true);
break;
case TextScript.Text39:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15060, true);
break;
case TextScript.Text40:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15064, true);
break;
case TextScript.Text41:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15063, true);
break;
case TextScript.Text42:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15065, true);
break;
case TextScript.Text43:
omFrameWork.Inst.Dialog.GetWSHud.SetInfoText(15066, true);
break;
case TextScript.Text44:
omFrameWork.Inst.Dialog.GetWSHud.CloseInfoAni();
omFrameWork.Inst.Dialog.GetWSHud.CloseInfoText();
omFrameWork.Inst.Dialog.GetWSHud.CloseLeftEventView();
omFrameWork.Inst.Dialog.GetWSHud.SetTitleText(1010, true);
break;
#endregion
}
}
// 텔레포트 장치 착용
void equipTeleport()
{
// GameObject.FindObjectOfType<omPlayerOwner>().m_CurrentPawn.TeleportEquipment(eEquipType.ET_RightHand, 1113, true);
m_omPlayerOwner = GameObject.FindObjectOfType<omPlayerOwner>();
m_omPlayerOwner.AddNetTeleportTraker();
// 텔레포트 장치가 돌아가는 값 보정
GameObject teleport = GameObject.Find("TeleportDevice_Hand(Clone)");
if (teleport != null)
{
teleport.transform.localPosition = new Vector3(0.011f, -0.028f, 0.004f);
teleport.transform.localRotation = Quaternion.Euler(0.044f, 108.69f, -9.446f);
}
}
#endregion
}