Beispiel #1
0
    //private void RequestRecentMatches()
    //{

    //}

    /*public void SendRequestFullGame(MatchSignature matchSignature)
     * {
     *  //var matchSig = MatchInfo.DecodeShareCode("CSGO-WMw4F-5EYMy-7Hk79-JhRrm-tNTWJ");
     *  //RequestFullGameInfo(matchSig.matchId, matchSig.outcomeId, matchSig.token);
     *  if (SteamController.steamInScene != null && SteamController.steamInScene.IsLoggedIn && !SteamController.steamInScene.steam3.isAnon)
     *  {
     *      SteamController.LogToConsole("\nRequesting full game info");
     *      //blockRefresh = true;
     *
     *      var account = SteamController.steamInScene.GetFriendWithAccountId(SteamController.steamInScene.userAccountId);
     *      userLastState = account != null ? account.GetState() : (SteamKit2.EPersonaState)SettingsController.personaState;
     *
     *      SteamController.steamInScene.SetPersonaState(SteamKit2.EPersonaState.Invisible);
     *      SteamController.steamInScene.PlayCStrike();
     *      StartCoroutine(CommonRoutines.WaitToDoAction(() =>
     *      {
     *          SteamController.steamInScene.RequestFullGameInfo(matchSignature.matchId, matchSignature.outcomeId, matchSignature.token);
     *          //lastRecentMatchesRequest = Time.time;
     *          //blockRefresh = false;
     *      }, 30, () => SteamController.steamInScene.playingApp == 730));
     *  }
     * }
     * public void RequestRecentMatches()
     * {
     *  if (SteamController.steamInScene != null && SteamController.steamInScene.IsLoggedIn && !SteamController.steamInScene.steam3.isAnon && !blockRefresh && Time.time - lastRecentMatchesRequest > recentMatchesRequestCooldown)
     *  {
     *      SteamController.LogToConsole("\nRequesting recent matches");
     *      blockRefresh = true;
     *
     *      var account = SteamController.steamInScene.GetFriendWithAccountId(SteamController.steamInScene.userAccountId);
     *      userLastState = account != null ? account.GetState() : (SteamKit2.EPersonaState)SettingsController.personaState;
     *
     *      SteamController.steamInScene.SetPersonaState(SteamKit2.EPersonaState.Invisible);
     *      SteamController.steamInScene.PlayCStrike();
     *      StartCoroutine(CommonRoutines.WaitToDoAction(() =>
     *      {
     *          SteamController.steamInScene.RequestRecentGamesPlayed(SteamController.steamInScene.userAccountId);
     *          lastRecentMatchesRequest = Time.time;
     *          blockRefresh = false;
     *      }, 30, () => { return SteamController.steamInScene.playingApp == 730; }, () => { lastRecentMatchesRequest = Time.time; blockRefresh = false; }));
     *  }
     * }*/
    private void GetOfflineDemos()
    {
        SteamController.LogToConsole("\nFinding matches on device");
        IEnumerable <string> demoFiles = null;

        if (Directory.Exists(SettingsController.matchesLocation))
        {
            demoFiles = Directory.EnumerateFiles(SettingsController.matchesLocation, "*.dem");
        }
        else
        {
            SteamController.LogToConsole("Matches directory does not exist");
        }

        if (demoFiles != null)
        {
            SteamController.LogToConsole("Found " + demoFiles.Count() + " match(es) on device");
            foreach (string file in demoFiles)
            {
                TaskManagerController.RunAction(() =>
                {
                    MatchInfo.FindOrCreateMatch(Path.GetFileNameWithoutExtension(file));
                    //AddAvailableMatch(match);
                });
            }
            RefreshList();
        }
        else
        {
            SteamController.LogToConsole("Did not find any match(es) on device");
        }
    }
Beispiel #2
0
 //public void CheckForNewMatches()
 //{
 //    GetOfflineDemos();
 //    RequestRecentMatches();
 //}
 private void SteamInScene_onRecentGamesReceived(SteamKit2.GC.CSGO.Internal.CMsgGCCStrike15_v2_MatchList matchList)
 {
     SteamController.LogToConsole("\nReceived " + matchList.matches.Count() + " match(es)");
     TaskManagerController.RunAction(() =>
     {
         foreach (var match in matchList.matches)
         {
             MatchInfo.FindOrCreateMatch(match);
         }
         RefreshList();
     });
 }