private void Awake() { // 자식들에게 번호를 먹여줌 for (int i = 0; i < BlueTeamInfo.Length; i++) { BlueTeamInfo[i].transform.SetSiblingIndex(i); } for (int i = 0; i < RedTeamInfo.Length; i++) { RedTeamInfo[i].transform.SetSiblingIndex(i); } // 방 인원수에 맞게끔만 뜨게하고 나머지는 꺼버림 float f = (float)PhotonNetwork.room.PlayerCount / 2f; // 0.5를 반올림했는데 0이나와서 0.01을 더해줌(이해불가) int n = Mathf.RoundToInt(f + 0.01f); for (int i = n; i < 5; i++) { BlueTeamInfo[i].SetActive(false); RedTeamInfo[i].SetActive(false); } // ResultData를 초기화 for (int i = 0; i < 5; i++) { blueTeamRD[i] = new ResultManager.ResultData(); redTeamRD[i] = new ResultManager.ResultData(); } inGameManager = GameObject.FindGameObjectWithTag("InGameManager").GetComponent <InGameManager>(); }
private void Awake() { Screen.SetResolution(1280, 720, false); Cursor.lockState = CursorLockMode.None; TabCharacterInfo characterInfo = null; ResultManager.ResultData resultData = null; gameResultText.text = ResultManager.Instance.result; for (int i = 0; i < 5; i++) { // 데이터가 저장되있지않으면 해당 줄의 액티브 꺼버림 if (string.IsNullOrEmpty(ResultManager.Instance.blueTeamResults[i].championName)) { blueTeamResultInfo[i].SetActive(false); } // 저장되있으면 저장데이터 불러와서 보여줌 else { characterInfo = blueTeamResultInfo[i].GetComponent <TabCharacterInfo>(); resultData = ResultManager.Instance.blueTeamResults[i]; DataApply(characterInfo, resultData); if (resultData.isMine) { myChampionImage.sprite = Resources.Load <Sprite>("Champion/ChampionIcon/" + resultData.championName + "_Big"); myGradeText.text = GradeCalculate(resultData.kill, resultData.death, resultData.assist); } } if (string.IsNullOrEmpty(ResultManager.Instance.redTeamResults[i].championName)) { redTeamResultInfo[i].SetActive(false); } else { characterInfo = redTeamResultInfo[i].GetComponent <TabCharacterInfo>(); resultData = ResultManager.Instance.redTeamResults[i]; DataApply(characterInfo, resultData); if (resultData.isMine) { myChampionImage.sprite = Resources.Load <Sprite>("Champion/ChampionIcon/" + resultData.championName + "_Big"); myGradeText.text = GradeCalculate(resultData.kill, resultData.death, resultData.assist); } } } }
private void Awake() { TabCharacterInfo characterInfo = null; ResultManager.ResultData rd = null; winloseText.text = ResultManager.Instance.result; // 데이터가 저장되있지않으면 해당줄 액티브 꺼버림 // 저장되있으면 저장데이터 불러와서 보여줌 for (int i = 0; i < 5; i++) { if (string.IsNullOrEmpty(ResultManager.Instance.blueTeamResults[i].championName)) { BlueTeamResultInfo[i].SetActive(false); } else { characterInfo = BlueTeamResultInfo[i].GetComponent <TabCharacterInfo>(); rd = ResultManager.Instance.blueTeamResults[i]; DataApply(characterInfo, rd); if (rd.me) { myChampionImage.sprite = Resources.Load <Sprite>("Champion/ChampionIcon/" + rd.championName + "_Big"); myGradeText.text = GradeCalculate(rd.kill, rd.death, rd.assist); } } if (string.IsNullOrEmpty(ResultManager.Instance.redTeamResults[i].championName)) { RedTeamResultInfo[i].SetActive(false); } else { characterInfo = RedTeamResultInfo[i].GetComponent <TabCharacterInfo>(); rd = ResultManager.Instance.redTeamResults[i]; DataApply(characterInfo, rd); if (rd.me) { myChampionImage.sprite = Resources.Load <Sprite>("Champion/ChampionIcon/" + rd.championName + "_Big"); myGradeText.text = GradeCalculate(rd.kill, rd.death, rd.assist); } } } //PhotonNetwork.LeaveRoom(); }
public void DataApply(TabCharacterInfo characterInfo, ResultManager.ResultData resultData) { characterInfo.level_Text.text = resultData.level.ToString(); characterInfo.championIcon_Image.sprite = Resources.Load <Sprite>("Champion/ChampionIcon/" + resultData.championName + "_Big"); characterInfo.nickname_Text.text = resultData.nickName; characterInfo.kda_Text.text = resultData.kill.ToString() + "/" + resultData.death.ToString() + "/" + resultData.assist.ToString(); characterInfo.cs_Text.text = resultData.cs.ToString(); for (int i = 0; i < 6; i++) { if (resultData.items[i] != 0) { ShopItem.Item it = ShopItem.Instance.itemlist[resultData.items[i]]; // myItem은 복사본이 아니므로 변경해서는 안됨 characterInfo.items[i].gameObject.GetComponent <ItemInfo>().myItem = it; characterInfo.items[i].sprite = Resources.Load <Sprite>("Item_Image/" + it.iconName); characterInfo.items[i].color = Color.white; } else { characterInfo.items[i].gameObject.GetComponent <ItemInfo>().myItem = null; characterInfo.items[i].sprite = null; characterInfo.items[i].color = new Color(1, 1, 1, 0); } } if (resultData.accessoryItem != 0) { ShopItem.Item it = ShopItem.Instance.itemlist[resultData.accessoryItem]; characterInfo.accessoryItem.gameObject.GetComponent <ItemInfo>().myItem = it; characterInfo.accessoryItem.sprite = Resources.Load <Sprite>("Item_Image/" + it.iconName); characterInfo.accessoryItem.color = Color.white; } else { characterInfo.accessoryItem.gameObject.GetComponent <ItemInfo>().myItem = null; characterInfo.accessoryItem.sprite = null; characterInfo.accessoryItem.color = new Color(1, 1, 1, 0); } }