2024-12-15 01:39:39 +00:00
using CodeStage.AntiCheat.Detectors ;
using CodeStage.AntiCheat.Storage ;
using System ;
using System.Collections ;
using System.Collections.Generic ;
using UnityEngine ;
using UnityEngine.ResourceManagement.AsyncOperations ;
public partial class InGameInfo : MyCoroutine
{
public static InGameInfo Ins ;
public SceneInfo m_SceneInfo ;
public Transform tf_Effects , tf_Objs ;
2025-05-21 23:13:07 +00:00
public Material mat_Dissolve ;
2024-12-15 01:39:39 +00:00
List < HUDDMGUI > list_HUDDMGUI = new List < HUDDMGUI > ( ) ;
2025-01-23 22:16:18 +00:00
List < HUDUI > list_HUDUI = new List < HUDUI > ( ) ;
2024-12-15 01:39:39 +00:00
HUDLvUp m_HUDLvUp ;
Dictionary < string , List < GameObject > > dic_str_Effect = new Dictionary < string , List < GameObject > > ( ) ;
Dictionary < eEffect , List < GameObject > > dic_Skill = new Dictionary < eEffect , List < GameObject > > ( ) ;
2025-03-03 02:19:33 +00:00
Dictionary < eObj , GameObject > dic_Obj = new Dictionary < eObj , GameObject > ( ) ;
2024-12-15 01:39:39 +00:00
eGameMode m_GameMode ;
List < GameObject > list_dropitems = new List < GameObject > ( ) ;
List < ProjectileData > list_projectileData = new List < ProjectileData > ( ) ;
2026-09-06 23:24:25 +00:00
private void Awake ( )
{
Ins = this ;
// PD #747 — 무기 궤적 트레일이 검끝 버스트를 스폰할 때 쓰는 경로(크레센트 억제용 콜백 포함).
WL . Combat . WeaponTrailDriver . ExternalSpawner = Show_EffectEx ;
}
2024-12-15 01:39:39 +00:00
void Set_Init ( )
{
for ( eEffect i = 0 ; i < eEffect . Max ; i + + )
dic_Skill . Add ( i , new List < GameObject > ( ) ) ;
for ( int i = 0 ; i < 14 ; i + + )
list_quickamount . Add ( 0 ) ;
for ( eObj i = 0 ; i < eObj . Max ; i + + )
2025-03-03 02:19:33 +00:00
dic_Obj . Add ( i , null ) ;
2024-12-15 01:39:39 +00:00
AddrResourceMgr . Ins . LoadObject < GameObject > ( "Assets/Res_Addr/Obj/MobMark.prefab" , handle = >
{
if ( handle . IsDone & & handle . Status = = AsyncOperationStatus . Succeeded )
{
2025-03-03 02:19:33 +00:00
var mm = DSUtil . Get_Clone ( handle . Result , tf_Objs ) ;
AddrResourceMgr . Ins . Set_AddressableReleaseSelf ( mm ) ;
dic_Obj [ eObj . MobMark ] = mm ;
mm . SetActive ( false ) ;
2024-12-15 01:39:39 +00:00
}
} ) ;
for ( int i = 0 ; i < 200 ; i + + ) // 너무 많나?
list_projectileData . Add ( new ProjectileData ( ) ) ;
#if UNITY_EDITOR
2026-10-19 16:48:59 +00:00
if ( WL . SkillTest . WLTestScene . Active )
2024-12-15 01:39:39 +00:00
return ;
#endif
AddrResourceMgr . Ins . LoadObject < GameObject > ( "Assets/Res_Addr/MainUI/NewGameUI.prefab" , handle = >
{
if ( handle . IsDone & & handle . Status = = AsyncOperationStatus . Succeeded )
{
DSUtil . Get_Clone ( handle . Result ) ;
InappInfo . Ins . Check_Retrieved ( ) ;
}
} ) ;
}
IEnumerator Start ( )
{
2026-10-19 17:57:59 +00:00
#if UNITY_EDITOR
if ( ! WL . SkillTest . WLTestScene . Active ) // WL #947 훅 — 로그인 없는 테스트 씬은 서버 주기 점검(뉴스 · 일일 초기화 · PlayFab 호출)을 돌리지 않는다
#endif
2025-07-24 06:28:09 +00:00
DataCheckMgr . Ins . Set ( ) ;
2024-12-15 01:39:39 +00:00
Set_Init ( ) ;
2024-12-27 23:19:08 +00:00
while ( ! TableChecker . Ins . CheckAllLoad ( ) ) yield return new WaitForSeconds ( 0.1f ) ;
2026-10-20 01:24:45 +00:00
#if UNITY_EDITOR
if ( WL . SkillTest . WLTestScene . Active & & ! WL . SkillTest . WLTestScene . PreloadEffects ) yield break ; // WL #947 훅 — 테스트 씬은 예열(인스턴스 514 · 한 프레임 약 18 s)을 생략하고 첫 사용 때 로드한다(JSON preloadEffects 1 이면 원본대로)
#endif
2024-12-27 23:19:08 +00:00
var lst = table_effectlist . Ins . Get_DataList ( 1 ) ;
for ( int i = 0 ; i < lst . Count ; i + + )
{
2026-10-19 17:57:59 +00:00
if ( ! dic_str_Effect . ContainsKey ( lst [ i ] . s_EffectPrefab ) ) dic_str_Effect . Add ( lst [ i ] . s_EffectPrefab , new List < GameObject > ( ) ) ; // WL #947 훅 — 테이블을 씬 안에서 로드하는 테스트 씬은 이 루프 전에 예열 투사체 수명 종료(Show_HitEffect → Get_Effect)가 키를 먼저 넣어 Add 가 ArgumentException 으로 끊겼다
2024-12-27 23:19:08 +00:00
for ( int j = 0 ; j < lst [ i ] . n_PreLoadCount ; j + + )
Load_Effect ( lst [ i ] . s_EffectPrefab , effect = > { effect . transform . position = Vector3 . one * 100000f ; } ) ;
}
var skilllst = table_skilllist . Ins . Get_DataList ( ) ;
for ( int i = 0 ; i < skilllst . Count ; i + + )
{
if ( skilllst [ i ] . e_SkillType = = eSkillType . Active & & skilllst [ i ] . e_Skill ! = eEffect . None )
{
for ( int j = 0 ; j < 2 ; j + + )
Load_Skill ( skilllst [ i ] . e_Skill , list_projectileData [ 0 ] , true ) ;
}
}
2024-12-15 01:39:39 +00:00
#if UNITY_EDITOR
2026-10-19 16:48:59 +00:00
if ( WL . SkillTest . WLTestScene . Active ) yield break ;
2024-12-15 01:39:39 +00:00
#endif
ObscuredCheatingDetector . StartDetection ( OnCheaterDetected ) ;
ObscuredPrefs . OnAlterationDetected + = OnCheaterDetected ;
SpeedHackDetector . StartDetection ( OnCheaterDetected ) ;
while ( DSUtil . CheckNull ( NewGameUI . Ins ) ) yield return null ;
AddrResourceMgr . Ins . LoadObject < GameObject > ( "Assets/Res_Addr/Ingame/HUDDMGUI.prefab" , handle = >
{
if ( handle . IsDone & & handle . Status = = AsyncOperationStatus . Succeeded )
{
for ( int i = 0 ; i < 150 ; i + + )
list_HUDDMGUI . Add ( DSUtil . Get_Clone < HUDDMGUI > ( handle . Result , NewGameUI . Ins . tf_HUD ) ) ;
2025-03-05 03:47:01 +00:00
list_HUDDMGUI . ForEach ( f = > f . Off ( true ) ) ;
2024-12-15 01:39:39 +00:00
}
} ) ;
2025-01-23 22:16:18 +00:00
AddrResourceMgr . Ins . LoadObject < GameObject > ( "Assets/Res_Addr/Ingame/HUDUI.prefab" , handle = >
{
for ( int i = 0 ; i < 100 ; i + + )
list_HUDUI . Add ( DSUtil . Get_Clone < HUDUI > ( handle . Result , NewGameUI . Ins . tf_HUD ) ) ;
2025-03-05 03:47:01 +00:00
list_HUDUI . ForEach ( f = > f . Off ( true ) ) ;
2025-01-23 22:16:18 +00:00
} ) ;
2024-12-15 01:39:39 +00:00
//var sinfo = ServerInfo.Ins;
//Init_StageInfo(eGameMode.Stage, sinfo.m_ServerData.Get_Common(eCommon.TotalStage));
//Set_Coroutine(() =>
//{
// if (sinfo.IsNewUser())
// {
// var pc = MyValue.MyPC;
// pc.Stop_PC();
// StoryUI.Ins.Set(() => { pc.FindNextTarget(); DataCheckMgr.Ins.Set(); });
// }
// else
// {
// sinfo.Check_OfflineReward();
// DataCheckMgr.Ins.Set();
// }
//}, Time.deltaTime);
//BossGemCoolTime = sinfo.m_ServerData.Get_Common(eCommon.BossGemCoolTime);
//DropEventCoolTime = 60f;
}
2025-03-01 03:41:56 +00:00
public void AllEffectOff ( )
{
foreach ( var item in dic_str_Effect )
for ( int i = 0 ; i < item . Value . Count ; i + + )
item . Value [ i ] . SetActive ( false ) ;
2025-03-05 03:47:01 +00:00
foreach ( var item in dic_Obj )
2025-08-19 03:02:15 +00:00
{
if ( ! DSUtil . CheckNull ( item . Value ) )
item . Value . SetActive ( false ) ;
}
2025-03-05 03:47:01 +00:00
list_HUDDMGUI . ForEach ( f = > f . Off ( true ) ) ;
list_HUDUI . ForEach ( f = > f . Off ( true ) ) ;
2025-03-01 03:41:56 +00:00
}
2024-12-15 01:39:39 +00:00
void OnCheaterDetected ( )
{
Time . timeScale = 0f ;
Popup . Ins . Set ( ePopupType . One , - 99 , DSUtil . Quit , DSUtil . Quit ) ;
}
public eGameMode Get_GameMode ( ) { return m_GameMode ; }
public bool IsGameMode ( eGameMode _mode ) { return m_GameMode = = _mode ; }
/// <summary>
2025-01-23 00:57:39 +00:00
/// -1 로비, 0 농장, 1 스테이지, 2 던전
2024-12-15 01:39:39 +00:00
/// </summary>
/// <param name="id"></param>
public void Load_Map ( int id )
{
2025-03-11 23:47:21 +00:00
LoadingUI . Ins . Start_Loading ( ) ;
2025-03-01 03:41:56 +00:00
AllEffectOff ( ) ;
2025-03-04 23:42:24 +00:00
if ( ProjectileInfo . isIns ) ProjectileInfo . Ins . AllOff ( ) ;
2025-03-12 05:18:01 +00:00
if ( DropItemInfo . isIns ) DropItemInfo . Ins . AllOff ( ) ;
2024-12-15 01:39:39 +00:00
MyValue . MyChoiceMapData . n_MapID = id ;
var Tdata = table_battlemapconfig . Ins . Get_Data ( MyValue . MyChoiceMapData . n_MapID ) ;
m_GameMode = Tdata . e_MapType ;
2025-03-19 01:39:10 +00:00
ServerInfo . Ins . m_ServerData . Add_MissionCount ( ePurpose . ARRIVAL_MAP_LIMIT , id ) ;
2025-01-23 00:57:39 +00:00
m_SceneInfo . Load_AddScene ( Tdata , ( ) = >
2024-12-15 01:39:39 +00:00
{
StartCam ( ) ;
NewGameUI . Ins . SetUI_byGameMode ( m_GameMode ) ;
} ) ;
}
public void StartCam ( ) { StartCoroutine ( Co_StartCam ( ) ) ; }
IEnumerator Co_StartCam ( )
{
2025-02-11 00:15:02 +00:00
while ( ! MyValue . bMyPC ) yield return null ;
2025-03-07 06:50:46 +00:00
MyValue . MyPC . StartCam ( null ) ;
2024-12-15 01:39:39 +00:00
}
#region HUD
2025-01-23 22:16:18 +00:00
public HUDUI Get_HUDUI ( )
2024-12-15 01:39:39 +00:00
{
2025-01-23 22:16:18 +00:00
HUDUI temp = null ;
for ( int i = 0 ; i < list_HUDUI . Count ; i + + )
2024-12-15 01:39:39 +00:00
{
2025-01-27 04:37:33 +00:00
if ( list_HUDUI [ i ] . Get_Check ( ) )
2025-01-23 22:16:18 +00:00
{
temp = list_HUDUI [ i ] ;
break ;
}
}
if ( DSUtil . CheckNull ( temp ) & & list_HUDUI . Count > 0 )
{
temp = DSUtil . Get_Clone < HUDUI > ( list_HUDUI [ 0 ] . gameObject , NewGameUI . Ins . tf_HUD ) ;
list_HUDUI . Add ( temp ) ;
}
return temp ;
2024-12-15 01:39:39 +00:00
}
public HUDDMGUI Get_HUDDMGUI ( )
{
HUDDMGUI temp = null ;
for ( int i = 0 ; i < list_HUDDMGUI . Count ; i + + )
{
if ( ! list_HUDDMGUI [ i ] . gameObject . activeInHierarchy )
{
temp = list_HUDDMGUI [ i ] ;
break ;
}
}
2025-01-23 22:16:18 +00:00
if ( DSUtil . CheckNull ( temp ) & & list_HUDDMGUI . Count > 0 )
2024-12-15 01:39:39 +00:00
{
2025-01-23 22:16:18 +00:00
temp = DSUtil . Get_Clone < HUDDMGUI > ( list_HUDDMGUI [ 0 ] . gameObject , NewGameUI . Ins . tf_HUD ) ;
2024-12-15 01:39:39 +00:00
list_HUDDMGUI . Add ( temp ) ;
}
return temp ;
}
public HUDLvUp Get_HUDLvUp ( )
{
if ( m_HUDLvUp = = null ) m_HUDLvUp = DSUtil . Get_Clone < HUDLvUp > ( "InGame/HUDLvUp" , NewGameUI . Ins . tf_HUD ) ;
return m_HUDLvUp ;
}
#endregion
public void AllEffect_Off ( )
{
foreach ( var item in dic_Skill )
{
for ( int i = 0 ; i < item . Value . Count ; i + + )
item . Value [ i ] . gameObject . SetActive ( false ) ;
}
}
2025-02-12 04:39:37 +00:00
public void Show_SkillTypeEffect ( ProjectileData pd , Actor target , float lifeTime , Action < TurnOff_GO > cceffect = null )
2024-12-15 01:39:39 +00:00
{
var stcData = pd . m_skillTypeConfigTable ;
if ( ! DSUtil . CheckNull ( stcData ) & & ! stcData . e_SkillEffect . Equals ( "None" ) )
{
if ( ! DSUtil . CheckNull ( target ) )
{
Get_Effect ( stcData . e_SkillEffect , temp = >
{
2025-02-12 04:39:37 +00:00
var effect = temp . GetComponent < TurnOff_GO > ( ) ;
effect . Set ( target , pd , lifeTime ) ;
2025-04-07 23:18:30 +00:00
effect . Set_EffectwhenOff ( stcData . s_SkillEffectWhenOff ) ;
2025-05-13 23:11:24 +00:00
temp . transform . localScale = stcData . v3_Scale ;
2024-12-15 01:39:39 +00:00
var chekers = temp . GetComponentsInChildren < ProjectileHitChecker > ( true ) ;
for ( int i = 0 ; i < chekers . Length ; i + + )
chekers [ i ] . Set ( pd . m_ProjectileBase ) ;
2025-02-12 04:39:37 +00:00
cceffect ? . Invoke ( effect ) ;
2024-12-15 01:39:39 +00:00
} ) ;
}
}
}
public void Shoot_Effect ( ProjectileData _ptd )
{
var isskill = _ptd . IsSkill ( ) ;
eEffect effect ;
if ( isskill )
{
effect = _ptd . m_SkillListTableData . e_Skill ;
switch ( _ptd . m_SkillListTableData . e_SkillTarget )
{
case eSkillTarget . Self :
2025-02-05 00:47:02 +00:00
case eSkillTarget . SelfEnemy :
2024-12-15 01:39:39 +00:00
_ptd . target = _ptd . shooter ;
break ;
case eSkillTarget . Team :
_ptd . target = _ptd . shooter ;
var myteam = ActorInfo . Ins . Get_AlliesActors ( _ptd . shooter . IsEnemy ( ) , _ptd . shooter . Get_position ( ) ,
table_GlobalValue . Ins . Get_Float ( "f_SkillTeamRange" ) ) ;
for ( int i = 0 ; i < myteam . Count ; i + + )
{
_ptd . Copy ( list_projectileData [ i ] ) ;
list_projectileData [ i ] . target = myteam [ i ] ;
Shoot_Skill ( effect , list_projectileData [ i ] ) ;
}
return ;
case eSkillTarget . Pet :
2025-05-15 07:33:01 +00:00
if ( _ptd . shooter . IsRole ( eRole . Pet ) )
_ptd . target = _ptd . shooter . Get_Owner ( ) ;
else
_ptd . target = _ptd . shooter . Get_MyPet ( ) ;
2024-12-15 01:39:39 +00:00
break ;
}
}
else
effect = _ptd . m_Skill ;
Shoot_Skill ( effect , _ptd ) ;
}
2024-12-26 03:49:13 +00:00
void Shoot_Skill ( eEffect effect , ProjectileData _ptd , bool firstload = false )
2024-12-15 01:39:39 +00:00
{
for ( int i = 0 ; i < dic_Skill [ effect ] . Count ; i + + )
{
if ( ! dic_Skill [ effect ] [ i ] . activeInHierarchy )
{
dic_Skill [ effect ] [ i ] . GetComponent < ProjectileBase > ( ) . Set ( _ptd ) ;
return ;
}
}
2024-12-26 03:49:13 +00:00
Load_Skill ( effect , _ptd , firstload ) ;
}
void Load_Skill ( eEffect effect , ProjectileData _ptd , bool firstload = false )
{
2024-12-15 01:39:39 +00:00
AddrResourceMgr . Ins . LoadObject < GameObject > ( Get_SkillPrefabPath ( effect ) , handle = >
{
var temp = DSUtil . Get_Clone ( handle . Result , tf_Effects ) ;
dic_Skill [ effect ] . Add ( temp ) ;
2024-12-26 03:49:13 +00:00
if ( ! firstload ) temp . GetComponent < ProjectileBase > ( ) . Set ( _ptd ) ;
2024-12-15 01:39:39 +00:00
} ) ;
}
void Load_Effect ( string prefab , Action < GameObject > act )
{
AddrResourceMgr . Ins . LoadObject < GameObject > ( DSUtil . Format ( "Assets/Res_Addr/Effect/{0}.prefab" , prefab ) , handle = >
{
if ( handle . IsDone & & handle . Status = = AsyncOperationStatus . Succeeded )
{
var temp = DSUtil . Get_Clone ( handle . Result , tf_Effects ) ;
dic_str_Effect [ prefab ] . Add ( temp ) ;
act ? . Invoke ( temp ) ;
}
} ) ;
}
void Get_Effect ( string prefab , Action < GameObject > act )
{
if ( dic_str_Effect . ContainsKey ( prefab ) )
{
for ( int i = 0 ; i < dic_str_Effect [ prefab ] . Count ; i + + )
if ( ! dic_str_Effect [ prefab ] [ i ] . activeInHierarchy )
{
act ( dic_str_Effect [ prefab ] [ i ] ) ;
return ;
}
}
else
dic_str_Effect . Add ( prefab , new List < GameObject > ( ) ) ;
Load_Effect ( prefab , act ) ;
}
public void Show_Effect ( string prefab , Actor target )
{
Get_Effect ( prefab , temp = >
{
var turnoff = temp . GetComponent < TurnOff_GO > ( ) ;
turnoff . Set_PrefabInfo ( target ) ;
} ) ;
}
2025-04-07 23:18:30 +00:00
public void Show_Effect ( string prefab , Vector3 pos , Vector3 ? _eulerAngles = null , string showEffectwhenOff = "" )
2024-12-15 01:39:39 +00:00
{
Get_Effect ( prefab , temp = >
{
temp . transform . position = pos ;
2025-04-07 23:18:30 +00:00
if ( _eulerAngles . HasValue )
2024-12-15 01:39:39 +00:00
temp . transform . eulerAngles = _eulerAngles . Value ;
temp . SetActive ( true ) ;
2025-04-07 23:18:30 +00:00
temp . GetComponent < TurnOff_GO > ( ) . Set_EffectwhenOff ( showEffectwhenOff ) ;
2024-12-15 01:39:39 +00:00
} ) ;
}
2026-09-06 23:24:25 +00:00
/// <summary>
/// PD #747 — 스폰된 인스턴스를 콜백으로 넘겨 주는 오버로드.
/// 위 Show_Effect 와 동작은 같고, 호출부가 활성화 <b>직전에</b> 인스턴스를 후처리할 수 있다.
/// (무기 궤적 트레일이 원본 크레센트 이미터를 끄는 데 쓴다)
/// </summary>
public void Show_EffectEx ( string prefab , Vector3 pos , Vector3 eulerAngles , Action < GameObject > actSpawned )
{
Get_Effect ( prefab , temp = >
{
temp . transform . position = pos ;
temp . transform . eulerAngles = eulerAngles ;
actSpawned ? . Invoke ( temp ) ; // 반드시 SetActive 전에 — 파티클이 재생되기 전에 걸러야 한다
temp . SetActive ( true ) ;
var off = temp . GetComponent < TurnOff_GO > ( ) ;
if ( off ! = null ) off . Set_EffectwhenOff ( "" ) ;
} ) ;
}
2025-02-13 01:13:22 +00:00
public void Show_Effect ( string prefab , Actor actor , eEffectLocation loca , float lifetime , Action < TurnOff_GO > actEffect = null )
2024-12-15 01:39:39 +00:00
{
Get_Effect ( prefab , temp = >
{
var turnoff = temp . GetComponent < TurnOff_GO > ( ) ;
2025-02-13 01:13:22 +00:00
turnoff . Set ( actor , loca , lifetime ) ;
actEffect ? . Invoke ( turnoff ) ;
2024-12-15 01:39:39 +00:00
} ) ;
}
2025-03-03 02:19:33 +00:00
public GameObject Get_Obj ( eObj obj ) { return dic_Obj [ obj ] ; }
2024-12-15 01:39:39 +00:00
string Get_SkillPrefabPath ( eEffect effect )
{
if ( effect . ToString ( ) . Contains ( "Select" ) )
return DSUtil . Format ( "Assets/Res_Addr/SelectSkill/{0}.prefab" , effect ) ;
else if ( effect . ToString ( ) . Contains ( "Skill" ) )
return DSUtil . Format ( "Assets/Res_Addr/Skill/{0}.prefab" , effect ) ;
else
return DSUtil . Format ( "Assets/Res_Addr/Effect/{0}.prefab" , effect ) ;
}
public void Set_TimeScale ( float _scale , float _delay ) { Set_Coroutine ( ( ) = > { Time . timeScale = _scale ; } , _delay ) ; }
#region 인 게 임 제 어 ( 게 임 시 작 , 게 임 재 시 작 , 보 스 만 남 , 보 스 킬 , 보 스 에 게 짐 , 컨 텐 츠 종 료 조 건 )
public void Clear_Chapter ( )
{
GameUI . Ins . IngameUI . m_StageResult . Set ( true , false , Return_To_Lobby ) ;
}
public void Boss_Meet ( )
{
}
public void Kill_Boss ( )
{
}
public void Defeat_byMonster ( )
{
// 죽으면 부활의 성소로 가므로 필요없음
//if (m_CurStageData.Chapter == 104)
// GameUI.Ins.IngameUI.m_MemoryWitchResult.Set();
//else
// GameUI.Ins.IngameUI.m_StageResult.Set(false, false, Return_To_Lobby);
}
public void PetBattleResult ( bool _win )
{
Time . timeScale = 0.3f ;
Set_Coroutine ( ( ) = >
{
Time . timeScale = 1f ;
} , 0.5f ) ;
}
public void Return_To_Lobby ( )
{
Time . timeScale = 1f ; // 일시정지에서 돌아오면 0임
m_GameMode = eGameMode . Lobby ;
Init_IngameData ( ) ;
NewGameUI . Ins . SetUI_byGameMode ( m_GameMode ) ;
2025-01-27 04:24:29 +00:00
MyValue . MyChoiceMapData . n_PortalIndex = 0 ;
2025-01-22 23:03:43 +00:00
Load_Map ( - 1 ) ;
2024-12-15 01:39:39 +00:00
}
public void Return_To_ChapterLobby ( )
{
Return_To_Lobby ( ) ;
}
#endregion
}