void Awake() { Instance = this; scene = SceneManager.GetSceneByName("BattlePreparation"); GameObject[] objs = scene.GetRootGameObjects(); //캔버스 찾기 for (int i = 0; i < objs.Length; i++) { canvas = objs[i].GetComponent <Canvas>(); if (canvas) { canvas.worldCamera = Camera.main; break; } } UIHeroSelectSlot[] slots = canvas.GetComponentsInChildren <UIHeroSelectSlot>(); if (slots != null) { heroSelectSlotList = new List <UIHeroSelectSlot>(slots); //Debug.Log(heroSelectSlotList.Count); } }
public void OnClick() { if (heroData.heroType != HeroData.HeroType.Battle) { return; } string battleGroupID = heroData.battleGroupID; if (!string.IsNullOrEmpty(battleGroupID)) { //새로운 전투 그룹 만들 때에는 다른 전투 그룹에 있는 애들 출전 제외 불가 if (UIBattlePreparation.battleGroupID != Battle.currentBattleGroup.battleType.ToString()) { return; } //기존 전투 그룹 편집 중에는 기존 전투 그룹에 있는 애들 이외에는 출전 제외 불가 if (Battle.currentBattleGroup && battleGroupID != Battle.currentBattleGroup.battleType.ToString()) { return; } } if (!heroSlotContainer.isSelectedToBattle) { UIBattlePreparation.AddHero(heroData); } else { UIBattlePreparation.RemoveHero(heroData); } }
public void OnClickHeroSlotButton() { if (string.IsNullOrEmpty(id)) { return; } HeroData data = HeroManager.heroDataDic[id]; if (data == null) { return; } UIBattlePreparation.RemoveHero(data); }
IEnumerator ShowBattlePreparationA(string battleGroupID, List <BattleHero> heroList = null) { string sceneName = "BattlePreparation"; Scene scene = SceneManager.GetSceneByName(sceneName); if (!scene.isLoaded) { while (!AssetLoader.Instance) { yield return(null); } yield return(StartCoroutine(AssetLoader.Instance.LoadLevelAsync("scene/battlepreparation", sceneName, true))); } UIBattlePreparation.Show(battleGroupID, heroList); coroutineShowBattlePreparation = null; }
void OnDestroy() { Instance = null; }