コード例 #1
0
    private void Start()
    {
        IEnumerator <GameObject> BotPreviewsEnum = BotPreviews.GetEnumerator();

        BotPreviewsEnum.MoveNext();

        foreach (var botInfo in BattleController.opponentTeam.Bots)
        {
            BotPreviewGenerator.CreateBotImage(botInfo, BotPreviewsEnum.Current);
            BotPreviewsEnum.MoveNext();
        }

        BotPreviewsEnum.Dispose();
    }
コード例 #2
0
    private void RefreshTeamBotPreviews()
    {
        var teamBots = team1.Concat(team2).Concat(team3).ToList();

        foreach (var teamBot in teamBots)
        {
            if (teamBot.BotInfo != null)
            {
                BotPreviewGenerator.CreateBotImage(teamBot.BotInfo, teamBot.gameObject);
            }

            else
            {
                BotPreviewGenerator.CreateBotImage(defaultBotInfo, teamBot.gameObject);
            }
        }
    }
コード例 #3
0
    private void UpdateTeamsAndPreviews()
    {
        DataManager.Instance.Latch(this);
        StartCoroutine(DataManager.Instance.FetchInitialData(success =>
        {
            if (!success)
            {
                return;
            }
            userTeams = DataManager.Instance.UserTeams;

            IEnumerator <GameObject> BotPreviewEnum = BotPreviews.GetEnumerator();
            BotPreviewEnum.MoveNext();
            foreach (var team in userTeams)
            {
                foreach (var bot in team.Bots)
                {
                    BotPreviewGenerator.CreateBotImage(bot, BotPreviewEnum.Current);
                    BotPreviewEnum.MoveNext();
                }
            }
            BotPreviewEnum.Dispose();
        }));
    }
コード例 #4
0
 //Generates an image for the bot via the BotPreviewGenerator using the given bot info and the object
 //the Image is to be generated onto
 void CreateBotImage(BotInfo botInfo, GameObject botGenerator)
 {
     BotPreviewGenerator.CreateBotImage(botInfo, botGenerator);
 }
コード例 #5
0
    void Start()
    {
        DataManager.Instance.Latch(this);

        if (enemy == null)
        {
            StartCoroutine(DataManager.Instance.SearchUser("trainingUser1", (userExists, userInfo) =>
            {
                if (!userExists)
                {
                    Debug.Log("No Find Trainer");
                }
                else
                {
                    enemy = userInfo;
                    Debug.Log(userInfo.Email);
                }

                StartCoroutine(DataManager.Instance.GetOtherUserTeams(enemy.ID, (success, opponentTeams) =>
                {
                    if (!success)
                    {
                        return;
                    }

                    enemyTeams = opponentTeams;

                    IEnumerator <GameObject> preview = BotPreviews.GetEnumerator();
                    preview.MoveNext();
                    foreach (var team in enemyTeams)
                    {
                        foreach (var bot in team.Bots)
                        {
                            BotPreviewGenerator.CreateBotImage(bot, preview.Current);
                            preview.MoveNext();
                        }
                    }

                    preview.Dispose();
                }));
            }));
            return;
        }
        else
        {
            StartCoroutine(DataManager.Instance.GetOtherUserTeams(enemy.ID, (success, opponentTeams) =>
            {
                if (!success)
                {
                    return;
                }

                enemyTeams = opponentTeams;

                IEnumerator <GameObject> preview = BotPreviews.GetEnumerator();
                preview.MoveNext();
                foreach (var team in enemyTeams)
                {
                    foreach (var bot in team.Bots)
                    {
                        BotPreviewGenerator.CreateBotImage(bot, preview.Current);
                        preview.MoveNext();
                    }
                }

                preview.Dispose();
            }));
        }
    }
コード例 #6
0
 public static void UpdateCurrentPreview(BotInfo botInfo)
 {
     BotPreviewGenerator.CreateBotImage(botInfo, Instance.currentBotPreview);
     Instance.currentBotName.text = botInfo.Name;
 }