private void OnEnable() { int[] iarr = GameManager.instance.ReturnPlayerList(); for (int i = 0; i < 3; i++) { if (iarr[i] >= 0) { string strName = UserInfo.instance.GetCharData(CHAR_DATA.CHAR_NAME, iarr[i]) as string; m_selectCharBT[i].GetComponentInChildren <UILabel>().text = strName; strName += m_strSprite; m_selectCharBT[i].GetComponentInChildren <UISprite>().spriteName = strName; m_selectCharBT[i].normalSprite = strName; } else { m_selectCharBT[i].GetComponentInChildren <UILabel>().text = "Name"; m_selectCharBT[i].GetComponentInChildren <UISprite>().spriteName = "EmptySelect"; m_selectCharBT[i].normalSprite = "EmptySelect"; } } //클리어 골드 int MapIndex = GameManager.instance.ReturnStage(); if (m_Grid.transform.childCount > 0) { while (m_Grid.transform.childCount != 0) { GameObject game = m_Grid.transform.GetChild(0).gameObject; game.transform.SetParent(null); NGUITools.Destroy(game); } m_Grid.transform.DetachChildren(); } if (MapIndex >= 0) { m_SelectStageIndex.text = Util.ConvertToString(MapIndex + 1) + "Stage"; //현재 선택한 맵 인덱스 var MapTable = EXCEL.ExcelLoad.Read("Excel/Table/Stage_Table"); //맵 테이블을 불러오고 m_ClearEXP.text = "+" + Util.ConvertToString(MapTable[MapIndex][MAP_DATA.MAP_CLEAR_EXP.ToString()]); m_ClearGold.text = "+" + Util.ConvertToString(MapTable[MapIndex][MAP_DATA.MAP_CLEAR_GOLD.ToString()]); m_ClearEnergy.text = "-" + Util.ConvertToString(MapTable[MapIndex][MAP_DATA.MAP_ENERGY.ToString()]); string [] ClearItem = Util.ConvertToString(MapTable[MapIndex][MAP_DATA.MAP_CLEAR_ITEM.ToString()]).Split('/');; for (int i = 0; i < ClearItem.Length; i++) { //첫 번째는 아이템 타입, 인벤토리 타입(웨폰, 스티그마), 아이템 인덱스 string[] item = ClearItem[i].Split(';'); GameObject Item = ResourceLoader.CreatePrefab("Prefabs/ItemSprite"); Item.transform.SetParent(m_Grid.transform, false); Item.GetComponent <ItemSprite>().Setting(Util.ConvertToInt(item[2]), -1, (ITEM_TYPE)Util.ConvertToInt(item[0]), (INVENTORY_TYPE)Util.ConvertToInt(item[1])); } m_Grid.GetComponent <UIGrid>().Reposition(); //리 포지셔닝으로 그리드 재정렬 m_Scroll.GetComponent <UIScrollView>().ResetPosition(); } m_UIPanel.Refresh(); }
public void WeaponChange(int iIndex) { GameObject Weapon; if (m_iWeaponIndex != iIndex && iIndex >= 0) //현재 장비랑 중복 장착이 아니다. { for (int i = 0; i < m_WeaponPoint.Count; i++) { Weapon = m_WeaponPoint[i].transform.GetChild(0).gameObject ?? null; if (Weapon != null) { Weapon.transform.SetParent(null); Destroy(Weapon); } string strRoute = string.Empty; string WeaponIndex = Util.ConvertToString(UserInfo.instance.GetItemForList(iIndex, INVENTORY_TYPE.INVENTORY_WEAPON, ITEM_DATA.ITEM_INDEX)); if (i == 0) { strRoute = "Equipment/" + m_eType.ToString() + "/" + WeaponIndex + "/R"; } else if (i == 1) { strRoute = "Equipment/" + m_eType.ToString() + "/" + WeaponIndex + "/L"; } Weapon = ResourceLoader.CreatePrefab(strRoute); Weapon.transform.SetParent(m_WeaponPoint[i].transform, false); Weapon.SetActive(false); Weapon.transform.Find("Effect").gameObject.SetActive(false); } //현재 장착 중인 장비를 부순다. m_iWeaponIndex = iIndex; } //웨폰 인덱스는 무조건 인벤토리 리스트 순서 이므로 크게 상관 하지 말것 }
//스크롤 뷰에 셋팅 private void OnEnable() { //on off 될 때 셋팅 int iMax = UserInfo.instance.CompanionList.Count; if (m_Grid.transform.childCount > 0) //그리드 초기화 { while (m_Grid.transform.childCount != 0) { GameObject game = m_Grid.transform.GetChild(0).gameObject; game.transform.SetParent(null); NGUITools.Destroy(game); } m_Grid.transform.DetachChildren(); } for (int i = 0; i < iMax; i++) { GameObject CharInfo = ResourceLoader.CreatePrefab("Prefabs/UI/CharInfomation"); CharInfo.transform.SetParent(m_Grid.transform, false); CharInfo.GetComponent <CharInfomation>().Setting(i); //컴패니언 리스트 기준의 인덱스 } m_Grid.GetComponent <UIGrid>().Reposition(); //리 포지셔닝으로 그리드 재정렬 m_ScrollView.ResetPosition(); m_Panel.Refresh(); }
private void OnEnable() { m_CurItemName.text = ""; m_CurItemLevel.text = "Lv."; m_iCurSelectChar = GameManager.instance.ReturnCurSelectChar(); //바꾸려고 하는 캐릭터 m_eSelectType = GameManager.instance.ReturnSelectType(); //바꾸고자 하는 것 m_ChangeItem.text = Util.ConvertToString(m_eSelectType); //현재 바꾸려는 것 INVENTORY_TYPE eInven = GameManager.instance.ReturnInvenType(); List <ItemData> Data = UserInfo.instance.GetInventoryList(eInven); for (int i = 0; i < Data.Count; i++) { ITEM_TYPE eType = (ITEM_TYPE)Data[i].GetItemData(ITEM_DATA.ITEM_TYPE); if (eType == m_eSelectType) { //장비 장착은 현재 아이템 인벤토리에 획득 순서를 기반으로 한다. //스프라이트의 선택은 레이캐스트와 콜백을 사용한다 //콜백으로 현재 선택한 아이템의 리스트 인덱스를 저장한 뒤 선택 버튼을 누르면 갱신된다. GameObject Item = ResourceLoader.CreatePrefab("Prefabs/ItemSprite"); Item.transform.SetParent(m_GridChar.transform, false); int iIndex = Util.ConvertToInt(UserInfo.instance.GetItemForList(i, eInven, ITEM_DATA.ITEM_INDEX)); Item.GetComponent <ItemSprite>().Setting(iIndex, i, (ITEM_TYPE)Data[i].GetItemData(ITEM_DATA.ITEM_TYPE), eInven); Item.GetComponent <ItemSprite>().SetCallBack(ItemSelect); } } m_GridChar.GetComponent <UIGrid>().Reposition(); //리 포지셔닝으로 그리드 재정렬 m_ItemView.GetComponent <UIScrollView>().ResetPosition(); m_ItemView.GetComponent <UIPanel>().Refresh(); }
private int m_iWeaponIndex = -1; //캐릭터가 차고 있는 무기의 리스트 인덱스 // Start is called before the first frame update //다시 한 번 봐야하는 부분 private void OnEnable() { //처음 시작할 때 셋팅 m_iWeaponIndex = Util.ConvertToInt(UserInfo.instance.GetCharData(CHAR_DATA.CHAR_WEAPON_INDEX, m_iCharIndex)); //캐릭터의 웨폰 인덱스(리스트 순서) m_eType = (ITEM_TYPE)UserInfo.instance.GetCharData(CHAR_DATA.CHAR_WEAPON_TYPE, m_iCharIndex); //캐릭터 웨폰 타입 int iIndex = Util.ConvertToInt(UserInfo.instance.GetItemForList(m_iWeaponIndex, INVENTORY_TYPE.INVENTORY_WEAPON, ITEM_DATA.ITEM_INDEX)); //웨폰의 실제 인덱스 GameObject Weapon; for (int i = 0; i < m_WeaponPoint.Count; i++) { string strRoute = string.Empty; string WeaponIndex = Util.ConvertToString(iIndex); if (i == 0) { strRoute = "Equipment/" + m_eType.ToString() + "/" + WeaponIndex + "/R"; //0번쨰는 R } else if (i == 1) { strRoute = "Equipment/" + m_eType.ToString() + "/" + WeaponIndex + "/L"; //1번째는 L } Weapon = ResourceLoader.CreatePrefab(strRoute); Weapon.transform.SetParent(m_WeaponPoint[i].transform, false); Weapon.SetActive(true); Weapon.transform.Find("Effect").gameObject.SetActive(false); // } }
private void Awake() { m_CharSprite = transform.GetChild(0).GetComponent <UISprite>(); m_CharName = transform.GetChild(1).GetComponent <UILabel>(); m_CharStatus = transform.GetChild(2).GetComponent <UILabel>(); m_PartySprite = ResourceLoader.CreatePrefab("Prefabs/UI/PartySprite"); }
private GameObject CreateItem(Transform parent) { //크리에이트 GameObject Item = ResourceLoader.CreatePrefab(m_strName, parent); Item.SetActive(false); return(Item); }
private CharObject CreateItem(Transform parent) { //크리에이트 CharObject Item = new CharObject(); Item.st_Object = ResourceLoader.CreatePrefab(m_strName); Item.st_Object.transform.SetParent(parent, false); //무기관련 정보가 있다면 셋팅 Item.st_Object.SetActive(false); Item.st_Index = m_iCurIndex; return(Item); }
public PlayerManager(Transform Parent, Transform Particle) { int[] iarr = GameManager.instance.ReturnPlayerList(); GameObject GameUI = GameObject.Find("PlayerKey"); //초기 셋팅만해놓는다. for (int i = 0; i < 3; i++) { if (iarr[i] != -1) { try { string route = UserInfo.instance.GetCharData(CHAR_DATA.CHAR_INDEX, iarr[i]).ToString(); string name = UserInfo.instance.GetCharData(CHAR_DATA.CHAR_NAME, iarr[i]).ToString(); string CharRoute = "Player/" + route + "/Prefabs/" + name; GameObject PlayerChar = ResourceLoader.CreatePrefab(CharRoute); PlayerChar.transform.SetParent(Parent); PlayerChar.GetComponent <Animator>().runtimeAnimatorController = UserInfo.instance.GetCharAnimator(iarr[i], CHAR_ANIMATOR.CHAR_BATTLE_ANIMATOR) as RuntimeAnimatorController; //해당 캐릭터의 배틀 애니메이터 셋팅 int iIndex = Util.ConvertToInt(UserInfo.instance.GetCharData(CHAR_DATA.CHAR_WEAPON_INDEX, iarr[i])); ITEM_TYPE eType = (ITEM_TYPE)Util.ConvertToInt(UserInfo.instance.GetCharData(CHAR_DATA.CHAR_WEAPON_TYPE, iarr[i])); CharRoute = "Player/" + route + "/Particle/UltimateSkill"; GameObject Ultimate = ResourceLoader.CreatePrefab(CharRoute); Ultimate.transform.SetParent(Particle, false); Ultimate.SetActive(false); PlayerChar.GetComponent <WeaponPoint>().enabled = true; PlayerChar.GetComponent <WeaponPoint>().ViewEffect(true); PlayerScript script = PlayerChar.GetComponent <PlayerScript>(); script.enabled = true; script.PlayerInit(Ultimate); //해당 캐릭터의 플레이어 스크립트 설정 //플레이어 동작 스크립트 PlayerChar.SetActive(false); m_ListChar.Add(PlayerChar); m_ScriptList.Add(script); //플레이어 캐릭터 셋팅 //해당 캐릭터의 파티클 임팩트 } catch (System.NullReferenceException ex) { Debug.Log(ex); } } } }
//생성 시 부모는 해당 오브젝트 풀로 지정하고 설정한다. public void Set(string strPoolName, string strPrefabs, int iObjectCount) { try { GameObject ObjectPool = ResourceLoader.CreatePrefab("Prefabs/ObejctPool"); //오브젝트 풀링 ObjectPool.name = strPoolName; ObjectPool Pool = ObjectPool.GetComponent <ObjectPool>(); Pool.Init(strPrefabs, iObjectCount, Pool.transform); m_PoolManger.Add(Pool); //게임 오브젝트로 생성한 뒤 } catch (NullReferenceException ex) { Debug.Log(ex); } }
public void Set(string strPoolName, string [] strPrefabs, int [] iarr, int iObjectCount) { //서로 다른 오브젝트를 풀링으로 관리 try { GameObject ObjectPool = ResourceLoader.CreatePrefab("Prefabs/CharObjectPool"); //오브젝트 풀링 ObjectPool.name = strPoolName; CharObjectPool Pool = ObjectPool.GetComponent <CharObjectPool>(); Pool.Init(strPrefabs, iarr, iObjectCount, Pool.transform); m_PoolManger.Add(Pool); //게임 오브젝트로 생성한 뒤 하위 컴포넌트로 셋팅 } catch (NullReferenceException ex) { Debug.Log(ex); } }
public MapManager(Transform Parent, List <Dictionary <string, object> > MapFile, List <Dictionary <string, object> > MapTable, List <Dictionary <string, object> > MapPos) { //리스트로 저장 하고 해당 리스트에 맞춰서 맵 배치 Vector3 vecPos = new Vector3(); Quaternion QueRot = new Quaternion(); Vector3 vecSca = new Vector3(); for (var i = 0; i < MapFile.Count; i++) { string strText = "Prefabs/BackGround/" + MapFile[i]["Prefab"].ToString(); //경로 vecPos.Set(float.Parse(MapFile[i]["LocX"].ToString()), float.Parse(MapFile[i]["LocY"].ToString()), float.Parse(MapFile[i]["LocZ"].ToString())); //좌표 QueRot.Set(float.Parse(MapFile[i]["QuaX"].ToString()), float.Parse(MapFile[i]["QuaY"].ToString()), float.Parse(MapFile[i]["QuaZ"].ToString()), float.Parse(MapFile[i]["QuaW"].ToString())); //회전 vecSca.Set(float.Parse(MapFile[i]["ScaleX"].ToString()), float.Parse(MapFile[i]["ScaleY"].ToString()), float.Parse(MapFile[i]["ScaleZ"].ToString())); //스케일 GameObject MapObject = ResourceLoader.CreatePrefab(strText, Parent); MapObject.transform.SetPositionAndRotation(vecPos, QueRot); //맵의 오브젝트 MapObject.transform.localScale = vecSca; } //맵 셋팅 //맵 타입 설정 int iStage = GameManager.instance.ReturnStage(); //맵의 타입, 시간 foreach (MAP_DATA E in System.Enum.GetValues(typeof(MAP_DATA))) { Dictionary <MAP_DATA, object> Node = new Dictionary <MAP_DATA, object>(); Node.Add(E, MapTable[iStage][E.ToString()]); m_ListObjectType.Add(Node); } //맵의 특정 이벤트 지점을 저장한 백터 // Index LocX LocY LocZ foreach (var POS in MapPos) { Vector3 Node = new Vector3(float.Parse(POS["LocX"].ToString()), float.Parse(POS["LocY"].ToString()), float.Parse(POS["LocZ"].ToString())); m_ListEventPos.Add(Node); } //출발 지점등 GameManager.instance.StageSelect(m_ListObjectType); //게임 매니저에 스테이지 관련 타입들을 저장한다. }
public EnemyManager(Transform Parent, List <Dictionary <string, object> > Pos, List <Dictionary <string, object> > Info) { //엑셀을 읽어와서 //MaxWave, CurWave, Prefab LocX LocY LocZ QuaW QuaX QuaY QuaZ ScaleX ScaleY ScaleZ m_iMaxWave = int.Parse(Pos[0]["MaxWave"].ToString()); //전체 웨이브 숫자 m_iCurWave = 0; //현재 웨이브 숫자 Vector3 vecPos = new Vector3(); Quaternion QueRot = new Quaternion(); Vector3 vecSca = new Vector3(); for (int i = 0; i < m_iMaxWave; i++) { List <GameObject> Node = new List <GameObject>(); GameObject WaveObject = ResourceLoader.CreatePrefab("Prefabs/Wave", Parent); WaveObject.name = i.ToString() + "Wave"; for (int j = 0; j < Pos.Count; j++) { if (i == int.Parse(Pos[j]["CurWave"].ToString())) { int Index = int.Parse(Pos[j]["Index"].ToString()); //에너미 인덱스 string Rote = "Enemy/" + Index.ToString() + "/Prefabs/" + Index.ToString(); GameObject Enemy = ResourceLoader.CreatePrefab(Rote, WaveObject.transform); //Wave 하위로 셋팅 vecPos.Set(float.Parse(Pos[j]["LocX"].ToString()), float.Parse(Pos[j]["LocY"].ToString()), float.Parse(Pos[j]["LocZ"].ToString())); //좌표 QueRot.Set(float.Parse(Pos[j]["QuaX"].ToString()), float.Parse(Pos[j]["QuaY"].ToString()), float.Parse(Pos[j]["QuaZ"].ToString()), float.Parse(Pos[j]["QuaW"].ToString())); //회전 vecSca.Set(float.Parse(Pos[j]["ScaleX"].ToString()), float.Parse(Pos[j]["ScaleY"].ToString()), float.Parse(Pos[j]["ScaleZ"].ToString())); //스케일 Enemy.transform.SetPositionAndRotation(vecPos, QueRot); //맵의 오브젝트 Enemy.transform.localScale = vecSca; EnemyScript script = Enemy.GetComponent <EnemyScript>(); script.enabled = true; script.Setting(Index, Info); //내부에 캐릭터 데이터 셋팅 Node.Add(Enemy); } } WaveObject.gameObject.SetActive(false); //웨이브 오브젝트를 꺼주고 순서에 맞게 다시 켜준다. m_WaveObject.Add(WaveObject); m_ListEnemyObject.Add(Node); } }
private void Awake() { GameObject UI = GameObject.Find("UI Root"); for (int i = (int)UI_PANEL.PANEL_START; i < (int)UI_PANEL.PANEL_END; i++) { int iIndex = i + 1; m_arrUIPanel[i] = UI.transform.GetChild(iIndex).gameObject; } //UI Panel; m_ScrollPanel = UI.transform.GetChild(4).gameObject; m_HomeButton = UI.transform.Find("Home").gameObject; CurPanel = UI_PANEL.PANEL_END; GameObject Exit = ResourceLoader.CreatePrefab("Prefabs/QuitUI"); Exit.transform.SetParent(UI.transform, false); m_UserName.text = UserInfo.instance.UserName; }
private void OnEnable() { var CharList = UserInfo.instance.GetMyCharList(); int iCount = CharList.Count; for (int i = 0; i < iCount; i++) { GameObject CharInfo = ResourceLoader.CreatePrefab("Prefabs/CharInfoButton"); //만들어 놓은 오브젝트를 다시 가져와서 쓴다. CharInfo.transform.SetParent(m_GridChar.transform, false); //부모 트랜스폼 새로 설정 int iData = Util.ConvertToInt(CharList[i].GetCharData(CHAR_DATA.CHAR_INDEX)); CharInfo.GetComponent <CharInfoButton>().Setting(iData); CharInfo.GetComponent <CharInfoButton>().SetCallBack(CharInfoSelect);//캐릭터의 고유 인덱스 기반 } m_GridChar.GetComponent <UIGrid>().Reposition(); //리 포지셔닝으로 그리드 재정렬 m_GridPanel.GetComponent <UIScrollView>().ResetPosition(); m_GridPanel.GetComponent <UIPanel>().Refresh(); CharInfoSelect(Util.ConvertToInt(CharList[0].GetCharData(CHAR_DATA.CHAR_INDEX))); //첫번째로 셋팅 }
//미니 맵도 여기서 관리 private void Start() { //유저 맵 데이터 기반으로 맵 불러오기 m_BlockNode = ResourceLoader.CreatePrefab("Prefabs/Map/Block"); m_BlockNode.transform.SetParent(transform, false); m_PlayerObject = GameObject.Find("GameObject").transform.GetChild(1).transform.GetChild(0).gameObject; //유저가 현재 선택한 맵 데이터 기반 int iStageIndex = GameManager.instance.StageIndex; MapSaveData Node = JSON.JsonUtil.LoadJson <MapSaveData>("UserMapData"); string Route = "Prefabs/Map/" + iStageIndex + "_StageMiniMap"; m_MiniMap = ResourceLoader.CreatePrefab(Route); m_MiniMap.transform.SetParent(m_MiniMapUI.transform, false); //미니맵 셋팅 MapSetting(iStageIndex); //맵 데이터 셋팅 MapClassSetting(GameManager.instance.BlockIndex); //각각의 맵의 블럭 클래스를 각각 설정 EndPoint(false); }
void ViewInventory(INVENTORY_TYPE eType) { if (m_iCurPannel != (int)eType) //버튼 중복 클릭을 방지 { InventoryReset(); //무슨 인벤토리를 보여줄 것인가. List <ItemData> Data = UserInfo.instance.GetInventoryList(eType); for (int i = 0; i < Data.Count; i++) { GameObject Item = ResourceLoader.CreatePrefab("Prefabs/ItemSprite"); Item.transform.SetParent(m_GridChar.transform, false); int iIndex = Util.ConvertToInt(UserInfo.instance.GetItemForList(i, eType, ITEM_DATA.ITEM_INDEX)); Item.GetComponent <ItemSprite>().Setting(iIndex, i, (ITEM_TYPE)Data[i].GetItemData(ITEM_DATA.ITEM_TYPE), eType); } m_GridChar.GetComponent <UIGrid>().Reposition(); //리 포지셔닝으로 그리드 재정렬 m_ItemView.GetComponent <UIScrollView>().ResetPosition(); m_ItemView.GetComponent <UIPanel>().Refresh(); m_iCurPannel = (int)eType; } }
// Start is called before the first frame update void Start() { List <CharPartyData> PartyList = null; if (m_PointName == "PlayerPoint") //v플레이어 포인트 { PartyList = GameManager.instance.PlayerParty; } else if (m_PointName == "EnemyPoint") //에너미 포인트 { PartyList = GameManager.instance.EnemyParty; } foreach (CharPartyData Member in PartyList) { string Name = Util.ConvertToString(Member.CharData.ReturnData(CHARACTER_DATA.CHAR_NAME)); string Route = m_strRoute + Name; GameObject Spine = ResourceLoader.CreatePrefab(Route); Spine.transform.SetParent(transform, false); } PositionSetting(); }
public void OnClick() { if (GameManager.instance.MissionStatus == MISSION_STATUS.MISSION_COMPLETE) { if (m_eMission == MAP_MISSION.RESCUE_MISSION) { //구출 미션 시에는 버튼을 누르고 난 뒤에 새로운 동료창을 업데이트 if (!m_bCompanion) { //현재 if (m_Grid.transform.childCount > 0) //그리드 초기화 { while (m_Grid.transform.childCount != 0) { GameObject game = m_Grid.transform.GetChild(0).gameObject; game.transform.SetParent(null); NGUITools.Destroy(game); } m_Grid.transform.DetachChildren(); } GameObject Resque = ResourceLoader.CreatePrefab("Prefabs/UI/ResquePlayerCard"); Resque.transform.SetParent(m_Grid.transform, false); Resque.GetComponent <PlayerResqueCard>().Setting(GameManager.instance.WhoRescueName, GameManager.instance.WhoRescueClass); //컴패니언 정보 세이브 CharData Node = new CharData(); Node.m_CurEXP = 0; Node.m_eClass = GameManager.instance.WhoRescueClass; Node.m_iIndex = GameManager.instance.WhoRescueIndex; Node.m_Level = 1; UserInfo.instance.CompanionSetting(Node); //동료 셋팅 m_bCompanion = true; } else { //동료 패널 나오고 제 클릭시 //로비신으로\ UserInfo.instance.UserCompanionSave(); UserInfo.instance.UserPartySave(); //세이브 후 로비신으로 Time.timeScale = 1.0f; LoadScene.SceneLoad("LobbyScene"); } } else { //로비신으로\ UserInfo.instance.UserCompanionSave(); UserInfo.instance.UserPartySave(); //세이브 후 로비신으로 Time.timeScale = 1.0f; LoadScene.SceneLoad("LobbyScene"); } } else { int iStage = GameManager.instance.StageIndex; } }
private void OnEnable() { //그리드 생성 if (m_Grid.transform.childCount > 0) //그리드 초기화 { while (m_Grid.transform.childCount != 0) { GameObject game = m_Grid.transform.GetChild(0).gameObject; game.transform.SetParent(null); NGUITools.Destroy(game); } m_Grid.transform.DetachChildren(); } if (GameManager.instance.WhatPhase == GAME_PHASE.PHASE_RESULT_LOSE) { m_ResultSprite.spriteName = MISSION_STATUS.MISSION_BATTLE_LOSE.ToString(); } else if (GameManager.instance.WhatPhase == GAME_PHASE.PHASE_RESULT_WIN) { m_ResultSprite.spriteName = MISSION_STATUS.MISSION_COMPLETE.ToString(); int iMaxEXP = GameManager.instance.EnemyEXP; var PlayerParty = GameManager.instance.PlayerParty; var UserParty = UserInfo.instance.PartyList; int iCount = PlayerParty.Count; float fCurEXP = Mathf.Round((float)(iMaxEXP / iCount)); //파티 숫자대로 엔빵 var ExcelEXP = EXCEL.ExcelLoad.Read("Excel/Class/CLASS_EXP"); //경험치 테이블(공용) string ExcelRoute = string.Empty; for (int i = 0; i < iCount; i++) { //게임 매니저의 캐릭터 데이터를 업데이트 하고, //유저의 데이터도 업데이트 한다. int iCurEXP = Util.ConvertToInt(UserParty[i].CharData.ReturnData(CHARACTER_DATA.CHAR_CUR_EXP)); iCurEXP += Util.ConvertToInt(fCurEXP); UserParty[i].CharData.Update(CHARACTER_DATA.CHAR_CUR_EXP, fCurEXP); //참조 복사이므로 한쪽만 해주자 //각각 레벨업의 체크 해준다. ExcelRoute = "Excel/Class/" + UserParty[i].CharData.ReturnData(CHARACTER_DATA.CHAR_CLASS_TYPE).ToString(); var ExcelClass = EXCEL.ExcelLoad.Read(ExcelRoute); //클래스 EXCEL ExcelRoute = "Excel/Character/" + UserParty[i].CharData.ReturnData(CHARACTER_DATA.CHAR_CLASS_TYPE).ToString() + Util.ConvertToString(UserParty[i].CharData.ReturnData(CHARACTER_DATA.CHAR_INDEX)); var ExcelChar = EXCEL.ExcelLoad.Read(ExcelRoute); //캐릭터 EXCEL if (UserParty[i].CharData.ifLevelUp(ExcelClass, ExcelEXP, ExcelChar)) { //레벨업 하였는가 그렇다면 HP를 맥스로 채워줘라, 각각의 데이터를 리셋팅 UserParty[i].MaxHP = float.Parse(Util.ConvertToString(UserParty[i].CharData.ReturnData(CHARACTER_DATA.CHAR_MAX_HP))); UserParty[i].CurHP = float.Parse(Util.ConvertToString(UserParty[i].CharData.ReturnData(CHARACTER_DATA.CHAR_MAX_HP))); PlayerParty[i].MaxHP = float.Parse(Util.ConvertToString(PlayerParty[i].CharData.ReturnData(CHARACTER_DATA.CHAR_MAX_HP))); PlayerParty[i].CurHP = float.Parse(Util.ConvertToString(PlayerParty[i].CharData.ReturnData(CHARACTER_DATA.CHAR_MAX_HP))); Debug.Log("LevelUP"); } GameObject CharInfo = ResourceLoader.CreatePrefab("Prefabs/UI/PlayerCard"); CharInfo.transform.SetParent(m_Grid.transform, false); CharInfo.GetComponent <PlayerCard>().Setting(i); } GameManager.instance.EnemyEXP = 0; m_Grid.GetComponent <UIGrid>().Reposition(); //리 포지셔닝으로 그리드 재정렬 m_ScrollView.ResetPosition(); m_Panel.Refresh(); } }
public void Mission(MISSION_STATUS eStatus, MAP_MISSION eMission) { m_ScrollObject.SetActive(true); if (m_Grid.transform.childCount > 0) //그리드 초기화 { while (m_Grid.transform.childCount != 0) { GameObject game = m_Grid.transform.GetChild(0).gameObject; game.transform.SetParent(null); NGUITools.Destroy(game); } m_Grid.transform.DetachChildren(); } if (eStatus == MISSION_STATUS.MISSION_COMPLETE) { //미션 성공 m_ImageButton.gameObject.SetActive(true); int iCOunt = GameManager.instance.PlayerParty.Count; m_eMission = eMission; m_bCompanion = false; for (int i = 0; i < iCOunt; i++) { GameObject CharInfo = ResourceLoader.CreatePrefab("Prefabs/UI/PlayerCard"); CharInfo.transform.SetParent(m_Grid.transform, false); CharInfo.GetComponent <PlayerCard>().Setting(i); } //결과창 캐릭터 그리드 셋팅 m_Grid.GetComponent <UIGrid>().Reposition(); //리 포지셔닝으로 그리드 재정렬 m_ScrollView.ResetPosition(); m_Panel.Refresh(); float fTime = GameManager.instance.MaxTime; string strMax = Util.TimeCheck(fTime); fTime = GameManager.instance.CurTime; string strCur = Util.TimeCheck(fTime); m_TimeLabel.text = strCur + "/" + strMax; } else if (eStatus == MISSION_STATUS.MISSION_TIME_OUT) { m_ScrollObject.SetActive(false); m_TimeLabel.gameObject.SetActive(false); //타임 아웃 } else if (eStatus == MISSION_STATUS.MISSION_FAILED) { m_ScrollObject.SetActive(false); float fTime = GameManager.instance.MaxTime; string strMax = Util.TimeCheck(fTime); fTime = GameManager.instance.CurTime; string strCur = Util.TimeCheck(fTime); m_TimeLabel.text = strCur + "/" + strMax; } m_ResultSprite.spriteName = eStatus.ToString(); m_ImageButton.gameObject.SetActive(true); Time.timeScale = 0.0f; }
void Start() { //해당 패널이 액티브 되면 활성화 int [] ListChar = GameManager.instance.ReturnPlayerList(); int ClearExp = Util.ConvertToInt(GameManager.instance.ReturnStageData(MAP_DATA.MAP_CLEAR_EXP)); int ClearGold = Util.ConvertToInt(GameManager.instance.ReturnStageData(MAP_DATA.MAP_CLEAR_GOLD)); int ClearEnergy = Util.ConvertToInt(GameManager.instance.ReturnStageData(MAP_DATA.MAP_ENERGY)); string [] ClearItem = Util.ConvertToString(GameManager.instance.ReturnStageData(MAP_DATA.MAP_CLEAR_ITEM)).Split('/'); //클리어 아이템들은 ;과 ,으로 구분 되어 있으니 잘 쪼개어 사용 m_StageLabel.text = Util.ConvertToString(GameManager.instance.ReturnStage() + 1) + "Stage Clear"; //스테이지 //플레이어 리소스 관련 m_PlayerResource.transform.GetChild(0).GetComponent <UILabel>().text = "+" + ClearExp.ToString(); UserInfo.instance.UserUpdate(USER_INFO.USER_INFO_CUR_EXP, Util.SumData(UserInfo.instance.GetUserData(USER_INFO.USER_INFO_CUR_EXP), ClearExp, true)); //클리어 데이터 업데이트 m_PlayerResource.transform.GetChild(1).GetComponent <UILabel>().text = "+" + ClearGold.ToString(); UserInfo.instance.UserUpdate(USER_INFO.USER_INFO_GOLD, Util.SumData(UserInfo.instance.GetUserData(USER_INFO.USER_INFO_GOLD), ClearGold, true)); //클리어 데이터 업데이트 UserInfo.instance.UserUpdate(USER_INFO.USER_INFO_CUR_ENERGY, Util.SumData(UserInfo.instance.GetUserData(USER_INFO.USER_INFO_CUR_ENERGY), ClearEnergy, false)); //클리어 데이터 업데이트 if (UserInfo.instance.ifUserLevelUP()) //캐릭터 레벨업을 하였는가? 처리 { m_PlayerResource.transform.GetChild(3).gameObject.SetActive(true); //레벨 업 라벨를 띄워줌 } GameObject Slider = m_PlayerResource.transform.GetChild(2).gameObject; //경험치 바 업데이트 int iCur = Util.ConvertToInt(UserInfo.instance.GetUserData(USER_INFO.USER_INFO_CUR_EXP)); int iMax = Util.ConvertToInt(UserInfo.instance.GetUserData(USER_INFO.USER_INFO_MAX_ENERGY)); float fValue = (float)iCur / (float)iMax; string strEXP = iCur.ToString() + "/" + iMax.ToString(); Slider.GetComponentInChildren <UILabel>().text = strEXP; //현재 경험치 / 맥스 경험 Slider.GetComponent <UISlider>().value = fValue; //경험치 바 value //플레이어 캐릭터 관련 업데이트, 리스트 인덱스 기반 for (int i = 0; i < 3; i++) { if (ListChar[i] != -1) { m_ListChar[i].gameObject.SetActive(true); //결과창 캐릭터 패널 액티브 string strName = UserInfo.instance.GetCharData(CHAR_DATA.CHAR_NAME, ListChar[i]) as string; m_ListChar[i].transform.GetChild(0).GetComponent <UISprite>().spriteName = strName + "Select"; //스프라이트를 해당 캐릭터로 변경 //경험치 만큼 업데이트를 하고 Slider = m_ListChar[i].transform.GetChild(1).gameObject; UserInfo.instance.CharUpdate(CHAR_DATA.CHAR_CUR_EXP, Util.SumData(UserInfo.instance.GetCharData(CHAR_DATA.CHAR_CUR_EXP, ListChar[i]), ClearExp, true), ListChar[i]); //EXP 업데이트 if (UserInfo.instance.ifCharLevelUp(ListChar[i])) { //해당 캐릭터가 레벨업을 하였는가? m_ListChar[i].transform.GetChild(3).gameObject.SetActive(true); } iCur = Util.ConvertToInt(UserInfo.instance.GetCharData(CHAR_DATA.CHAR_CUR_EXP, ListChar[i])); //업데이트 이후 CurEXp iMax = Util.ConvertToInt(UserInfo.instance.GetCharData(CHAR_DATA.CHAR_MAX_EXP, ListChar[i])); fValue = (float)iCur / (float)iMax; Slider.GetComponent <UISlider>().value = fValue; //경험치 value Slider.GetComponentInChildren <UILabel>().text = "+" + ClearExp.ToString(); //경험치 획득 m_ListChar[i].transform.GetChild(2).GetComponent <UILabel>().text = "Lv." + UserInfo.instance.GetCharData(CHAR_DATA.CHAR_LEVEL, ListChar[i]).ToString(); //캐릭터 레벨 } else { m_ListChar[i].gameObject.SetActive(false); } } //캐릭터 업데이트 //맵 아이템 기준으로 GameObject Grid = m_ItemRoot.transform.GetChild(0).gameObject; for (int i = 0; i < ClearItem.Length; i++) { //첫 번째는 아이템 타입, 인벤토리 타입(웨폰, 스티그마), 아이템 인덱스 string[] item = ClearItem[i].Split(';'); GameObject Item = ResourceLoader.CreatePrefab("Prefabs/ItemSprite"); Item.transform.SetParent(Grid.transform, false); Item.GetComponent <ItemSprite>().Setting(Util.ConvertToInt(item[2]), -1, (ITEM_TYPE)Util.ConvertToInt(item[0]), (INVENTORY_TYPE)Util.ConvertToInt(item[1])); UserInfo.instance.InventoryUpdate((ITEM_TYPE)Util.ConvertToInt(item[0]), (INVENTORY_TYPE)Util.ConvertToInt(item[1]), Util.ConvertToInt(item[2])); //업데이트 } Grid.GetComponent <UIGrid>().Reposition(); //리 포지셔닝으로 그리드 재정렬 m_ItemRoot.GetComponent <UIScrollView>().ResetPosition(); m_ResultPanel.Refresh(); //인벤토리 업데이트 }