//최초 생성될것들
    void MaterialDungeonInit()
    {
        //이펙트
        UIHelper.CreateEffectInGame(SkillLvGroup.transform.FindChild("BtnNormal/label"), "Fx_UI_Dungeon_Easy_01");
        UIHelper.CreateEffectInGame(SkillLvGroup.transform.FindChild("BtnHard/label"), "Fx_UI_Dungeon_Normal_01");
        UIHelper.CreateEffectInGame(SkillLvGroup.transform.FindChild("BtnVeryHard/label"), "Fx_UI_Dungeon_Hard_01");
        UIHelper.CreateEffectInGame(SkillLvGroup.transform.FindChild("BtnHell/label"), "Fx_UI_Dungeon_VeryHard_01");

        UIHelper.CreateEffectInGame(EquipLvGroup.transform.FindChild("BtnNormal/label"), "Fx_UI_Dungeon_Easy_01");
        UIHelper.CreateEffectInGame(EquipLvGroup.transform.FindChild("BtnHard/label"), "Fx_UI_Dungeon_Normal_01");
        UIHelper.CreateEffectInGame(EquipLvGroup.transform.FindChild("BtnHell/label"), "Fx_UI_Dungeon_VeryHard_01");

        ViewObjs[2].transform.FindChild("Character/Txt_charname/label").GetComponent <UILabel>().text = string.Format("{0} {1:#,#}", _LowDataMgr.instance.GetStringCommon(47), CharInven._TotalAttack);


        //던전 난이도
        DungeonTable.SkillInfo skillDungeonInfo = null;
        for (int i = 0; i < SkillLvGroup.transform.childCount; i++)
        {
            UILabel    lv      = SkillLvGroup.transform.GetChild(i).transform.FindChild("Txt").GetComponent <UILabel>();
            GameObject lockImg = SkillLvGroup.transform.GetChild(i).transform.FindChild("Lvguide").gameObject;
            skillDungeonInfo = _LowDataMgr.instance.GetLowDataSkillBattle((byte)(i + 1));
            if (skillDungeonInfo != null)
            {
                lv.text  = string.Format(_LowDataMgr.instance.GetStringCommon(1271), skillDungeonInfo.MinenterLv.ToString());
                lv.color = skillDungeonInfo.MinenterLv > CharInven._Level ? Color.red : Color.white;
                lockImg.SetActive(skillDungeonInfo.MinenterLv > CharInven._Level);
            }
        }

        DungeonTable.EquipInfo equipDungeonInfo = null;
        for (int i = 0; i < EquipLvGroup.transform.childCount; i++)
        {
            UILabel    lv      = EquipLvGroup.transform.GetChild(i).transform.FindChild("Txt").GetComponent <UILabel>();
            GameObject lockImg = EquipLvGroup.transform.GetChild(i).transform.FindChild("Lvguide").gameObject;
            equipDungeonInfo = _LowDataMgr.instance.GetLowDataEquipBattle((byte)(i + 1));
            if (equipDungeonInfo != null)
            {
                lv.text  = string.Format(_LowDataMgr.instance.GetStringCommon(1271), equipDungeonInfo.MinenterLv.ToString());
                lv.color = equipDungeonInfo.MinenterLv > CharInven._Level ? Color.red : Color.white;
                lockImg.SetActive(equipDungeonInfo.MinenterLv > CharInven._Level);
            }
        }
    }
    public override void OnEnter(System.Action callback)
    {
        base.OnEnter(callback);

        lastSelectStageId = 1;
        if (0 < lastSelectStageId)
        {
            if (IsGoldStage)
            {
                DungeonTable.EquipInfo lowData = _LowDataMgr.instance.GetLowDataEquipBattle((byte)lastSelectStageId);
                StageName = lowData.StageName;
            }
            else
            {
                DungeonTable.SkillInfo lowData = _LowDataMgr.instance.GetLowDataSkillBattle((byte)lastSelectStageId);
                StageName = lowData.StageName;
            }
        }
        else
        {
            if (IsGoldStage)
            {
                StageName = "Gold_Dungeon_001";
            }
            else
            {
                StageName = "Exp_Dungeon_001";
            }
        }

        LoadLevelAsync(StageName);

        GameReadyState.NextAction = _ACTION.SPECIAL_STAGE;

        // xray 일단 주석처리
        //  CameraManager.instance.XRayComponent.DefualtCameraMode();
    }
    /// <summary>
    /// 장비강화재료 / 스킬강화재료 던전
    /// </summary>
    void OnClickEquipAndSkillDungeon(bool isEquip)
    {
        _LowDataMgr lowMgr = _LowDataMgr.instance;

        ViewObjs[0].SetActive(false);
        ViewObjs[1].SetActive(false);
        ViewObjs[2].SetActive(true);

        EquipLvGroup.transform.gameObject.SetActive(isEquip);
        SkillLvGroup.transform.gameObject.SetActive(!isEquip);

        byte          useEnergy = 0;
        List <string> itemList  = null;

        if (isEquip)
        {
            //장비강화
            DungeonTable.EquipInfo equipDungeonInfo = lowMgr.GetLowDataEquipBattle((byte)MaterialDungeonLevelDifficulty);
            if (equipDungeonInfo != null)
            {
                itemList  = equipDungeonInfo.RewardItemId.list;
                useEnergy = equipDungeonInfo.UseEnergy;
            }
        }
        else
        {
            //스킬강화
            DungeonTable.SkillInfo skillDungeonInfo = lowMgr.GetLowDataSkillBattle((byte)MaterialDungeonLevelDifficulty);
            if (skillDungeonInfo != null)
            {
                itemList  = skillDungeonInfo.RewardItemId.list;
                useEnergy = skillDungeonInfo.UseEnergy;
            }
        }

        bool canGo = NetData.instance.GetAsset(AssetType.Energy) >= useEnergy;

        MaterialDungeonStartBtn.transform.FindChild("Txt_num").GetComponent <UILabel>().text = useEnergy.ToString();
        MaterialDungeonStartBtn.transform.FindChild("Btn_on").gameObject.SetActive(canGo);
        MaterialDungeonStartBtn.transform.FindChild("Btn_off").gameObject.SetActive(!canGo);

        //드랍아이템
        int dropIconCount = MaterialDungetnDropItem.Length;

        for (int i = 0; i < dropIconCount; i++)
        {
            if (itemList.Count <= i)
            {
                MaterialDungetnDropItem[i].gameObject.SetActive(false);
                continue;
            }

            uint itemId = uint.Parse(itemList[i]);
            MaterialDungetnDropItem[i].gameObject.SetActive(true);
            InvenItemSlotObject slot = MaterialDungetnDropItem[i].GetChild(0).GetComponent <InvenItemSlotObject>();
            slot.SetLowDataItemSlot(itemId, 0, delegate(ulong key)
            {
                UIMgr.OpenDetailPopup(this, itemId);
            });
        }

        MaterialDungetnDropItem[0].parent.GetComponent <UIGrid>().Reposition();
        UIScrollView scroll = MaterialDungetnDropItem[0].parent.parent.GetComponent <UIScrollView>();

        if (scroll != null)
        {
            scroll.ResetPosition();
            scroll.enabled = itemList.Count <= 5 ? false : true;
        }

        EventDelegate.Set(MaterialDungeonStartBtn.onClick, delegate()
        {
            if (!canGo)
            {
                SceneManager.instance.SetNoticePanel(NoticeType.Message, 390);  //체력부족?
                return;
            }

            //여기서 시작해줌
            if (CurGameMode == GAME_MODE.SPECIAL_GOLD)
            {
                //uint level = NetData.instance.UserLevel;
                //byte dungeonId = 1;
                //while (true)
                //{
                //    DungeonTable.EquipInfo materialData = _LowDataMgr.instance.GetLowDataEquipBattle(dungeonId);
                //    if (materialData != null)
                //    {
                //        if (materialData.MinenterLv < level)
                //            break;
                //    }

                //    ++dungeonId;
                //}

                byte dungeonId = 1;
                DungeonTable.EquipInfo materialData = lowMgr.GetLowDataEquipBattle((byte)MaterialDungeonLevelDifficulty);

                if (materialData != null)
                {
                    dungeonId = materialData.Index;
                }

                if (dungeonId == 0)//혹시 모를 경우를 대비해 이렇게 막아놓는다.
                {
                    DungeonTable.EquipInfo mData = lowMgr.GetLowDataEquipBattle(1);

                    string msg = _LowDataMgr.instance.GetStringCommon(699);
                    msg        = string.Format(msg, mData.MinenterLv);
                    SceneManager.instance.SetNoticePanel(NoticeType.Message, 0, msg);
                    return;
                }

                OnGoldGameStart(dungeonId);
                //NetworkClient.instance.SendPMsgCoinBattleStartC(dungeonId);
            }

            else if (CurGameMode == GAME_MODE.SPECIAL_EXP)//경험치 스테이지로 들어감
            {
                //uint level = NetData.instance.UserLevel;
                //byte dungeonId = 1;
                //while (true)
                //{
                //    DungeonTable.SkillInfo skillData = _LowDataMgr.instance.GetLowDataSkillBattle(dungeonId);
                //    if (skillData != null)
                //    {
                //        if (skillData.MinenterLv <= level)
                //            break;
                //    }


                //    ++dungeonId;
                //}

                byte dungeonId = 1;
                DungeonTable.SkillInfo materialData = lowMgr.GetLowDataSkillBattle((byte)MaterialDungeonLevelDifficulty);

                if (materialData != null)
                {
                    dungeonId = materialData.Index;
                }

                if (dungeonId == 0)//혹시 모를 경우를 대비해 이렇게 막아놓는다.
                {
                    DungeonTable.SkillInfo skillData = lowMgr.GetLowDataSkillBattle(1);

                    string msg = _LowDataMgr.instance.GetStringCommon(699);
                    msg        = string.Format(msg, skillData.MinenterLv);
                    SceneManager.instance.SetNoticePanel(NoticeType.Message, 0, msg);
                    return;
                }

                OnExpGameStart(dungeonId);
                //NetworkClient.instance.SendPMsgExpBattleStartC(dungeonId);
            }
        });
    }
    protected override IEnumerator GameStartReady()
    {
        SoundManager.instance.PlayBgmSoundClip(null);

        while (true)
        {
            if (SpecialGameState.IsMapLoad)
            {
                break;
            }

            yield return(null);
        }

        if (HudPanel == null)
        {
            while (HudPanel == null)
            {
                yield return(null);
            }
        }

        SceneManager.instance.ShowLoadingTipPanel(false);
        yield return(new WaitForSeconds(1f));

        if (GameMode == GAME_MODE.SPECIAL_EXP)
        {
            SoundManager.instance.PlaySfxSound(eUISfx.UI_count_exp_dungeon, true);
        }
        else
        {
            SoundManager.instance.PlaySfxSound(eUISfx.UI_count_gold_dungeon, true);
        }

        HudPanel.StartEffCountDown();
        int count = 3;

        while (0 < count)
        {
            --count;
            yield return(new WaitForSeconds(1f));
        }

        //플레이 시간 저장.
        if (SpecialGameState.IsGoldStage)
        {
            DungeonTable.EquipInfo goldLowData = _LowDataMgr.instance.GetLowDataEquipBattle((byte)StageId);
            TimeLimit = 9999;// goldLowData.LimitTime;
        }
        else
        {
            DungeonTable.SkillInfo expLowData = _LowDataMgr.instance.GetLowDataSkillBattle((byte)StageId);
            TimeLimit = expLowData.LimitTime;
        }

        int loopCount = SpawnUnitList.Count;

        for (int i = 0; i < loopCount; i++)
        {
            SpawnUnitList[i].gameObject.SetActive(true);
            SpawnUnitList[i].SetObstacleAvoidance(false);
            SpawnUnitList[i].StaticState(false);

            if (SpawnUnitList[i] is Npc)
            {
                string     path  = "Effect/_UI/_INGAME/Fx_IN_enter_01";
                GameObject effGo = GameObject.Instantiate(Resources.Load(path)) as GameObject;
                effGo.transform.parent        = SpawnUnitList[i].transform;
                effGo.transform.localScale    = SpawnUnitList[i].transform.localScale;
                effGo.transform.localPosition = Vector3.zero;
            }
        }

        GameStart();

        yield return(new WaitForSeconds(0.1f));

        SceneManager.instance.CurrentStateBase().PlayMapBGM(Application.loadedLevelName);
    }
    void InitSpawnCtlr()
    {
        if (SpecialGameState.IsGoldStage)//리젠 영역잡기
        {
            DungeonTable.EquipInfo mLowData = _LowDataMgr.instance.GetLowDataEquipBattle((byte)StageId);
            if (mLowData != null)
            {
                //regenCount = goldLowData.regenCount;
                List <string> charPos = mLowData.RegenCharacter.list;
                CLeft   = short.Parse(charPos[0]);
                CTop    = short.Parse(charPos[1]);
                CRight  = short.Parse(charPos[2]);
                CBottom = short.Parse(charPos[3]);

                List <string> mobPos = mLowData.RegenMob.list;
                MLeft   = short.Parse(mobPos[0]);
                MTop    = short.Parse(mobPos[1]);
                MRight  = short.Parse(mobPos[2]);
                MBottom = short.Parse(mobPos[3]);

                for (int i = 0; i < mLowData.DummyMonster.Count; i++)//몬스터
                {
                    MonsterData data = new MonsterData(uint.Parse(mLowData.DummyMonster[i]), float.Parse(mLowData.DummyMonsterTime[i]), int.Parse(mLowData.DropGold[i]), 0, false);
                    MonDataList.Add(data);
                }

                for (int i = 0; i < mLowData.RegenMobCount.Count; i++) //프랍 생성
                {
                    int count = int.Parse(mLowData.RegenMobCount[i]);  //해당 개수만큼 해당 번쨰 프랍 생성.
                    for (int j = 0; j < count; j++)
                    {
                        MonsterData data = new MonsterData(uint.Parse(mLowData.MonsterIndex[i]), float.Parse(mLowData.RegenMobTime[i]), 0, int.Parse(mLowData.GetMobPoint[i]), true);
                        MonDataList.Add(data);
                    }
                }
            }
        }
        else
        {
            DungeonTable.SkillInfo skillLowData = _LowDataMgr.instance.GetLowDataSkillBattle((byte)StageId);
            if (skillLowData != null)
            {
                List <string> charPos = skillLowData.RegenCharacter.list;
                CLeft   = short.Parse(charPos[0]);
                CTop    = short.Parse(charPos[1]);
                CRight  = short.Parse(charPos[2]);
                CBottom = short.Parse(charPos[3]);

                List <string> mobPos = skillLowData.RegenMob.list;
                MLeft   = short.Parse(mobPos[0]);
                MTop    = short.Parse(mobPos[1]);
                MRight  = short.Parse(mobPos[2]);
                MBottom = short.Parse(mobPos[3]);

                for (int i = 0; i < skillLowData.regenCount.Count; i++) //프랍 생성
                {
                    int count = int.Parse(skillLowData.regenCount[i]);  //해당 개수만큼 해당 번쨰 프랍 생성.
                    for (int j = 0; j < count; j++)
                    {
                        MonsterData data = new MonsterData(uint.Parse(skillLowData.MonsterIndex[i]), float.Parse(skillLowData.MonsterTime[i]), int.Parse(skillLowData.DropGold[i]), int.Parse(skillLowData.DropPoint[i]), false);
                        MonDataList.Add(data);
                    }
                }
            }
        }

        SpawnDisturbMob(true);

        //MaxBoxCount = SpawnPropList.Count;
        Debug.Log("SpacialDungeon Reward TotalValue= " + MaxValue);
    }