Beispiel #1
0
    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);
        }
    }
Beispiel #2
0
    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);
        }
    }
Beispiel #3
0
    public void OnClickHeroSlotButton()
    {
        if (string.IsNullOrEmpty(id))
        {
            return;
        }

        HeroData data = HeroManager.heroDataDic[id];

        if (data == null)
        {
            return;
        }

        UIBattlePreparation.RemoveHero(data);
    }
Beispiel #4
0
    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;
    }
Beispiel #5
0
 void OnDestroy()
 {
     Instance = null;
 }