Пример #1
0
        public async Task <GameSystemInfo> GetSystemInfo(int id)
        {
            var system = await _unitOfWork.GamingSystemRepository.GetByIDAsync(id);

            if (system == null)
            {
                return(null);
            }

            var systemGames = _unitOfWork.GamesRepository.GetQuery(x => x.SystemId == id);
            var sysInfo     = new GameSystemInfo(system);
            var timePlayed  = systemGames.Where(x => x.TimePlayed.HasValue).Sum(x => x.TimePlayed.Value.TotalSeconds);

            //Counts and time
            sysInfo.FavoriteCount = systemGames.Where(x => x.Favourite).Count();
            sysInfo.Timeplayed    = (int)timePlayed;
            sysInfo.GameCount     = systemGames.Count();

            //Add last played games list
            sysInfo.LastPlayedGames = systemGames.Where(x => x.LastPlayed.HasValue)?
                                      .Select(x => new Game()
            {
                Id               = x.Id,
                FileName         = x.FileName,
                ShortDescription = x.ShortDescription,
                LastPlayed       = x.LastPlayed,
                TimePlayed       = x.TimePlayed,
                System           = system
            }).OrderByDescending(x => x.LastPlayed).Take(5).ToList();

            return(sysInfo);
        }
Пример #2
0
    // Use this for initialization
    protected void Awake()
    {
        publisher.NotifyMonoAwake();
        // Don't destroy this script when loading.
        DontDestroyOnLoad(this.gameObject);

        GameObject tStaticRes = GameObject.Find("StaticRes");

        if (tStaticRes != null)
        {
            DontDestroyOnLoad(tStaticRes);
        }

        // Start time
        mDataTime      = new System.DateTime();
        mDataTime      = System.DateTime.Now;
        mLastFrameTime = mDataTime;

        Input.imeCompositionMode = IMECompositionMode.On;
        //-------------------
        // Set random seed.
        UnityEngine.Random.seed = (int)System.DateTime.Now.Ticks;
        phoneImei = SystemInfo.deviceUniqueIdentifier;
        //-------------


        Debug.Log("Application.persistentDataPath : " + Application.persistentDataPath);

        // 2012.05.22 LiHaojie Adjust the targetFrameRate is 35 fps
        Application.targetFrameRate = 35;
        Application.runInBackground = true;

        Globals.Instance.Awake();

        GameSystemInfo.CollectSystemInfo();
        //TalkingDataGA.SessionStarted("01BD57E566CD46FF3889ED4A4D547BD4", "gfan");

        if (!GameDefines.ToastEnabled)
        {
            HelpUtil.DestroyObject(textShow.gameObject);
            textShow = null;
        }


//		AdaptiveUI ();
    }
Пример #3
0
        protected override async Task ExecuteCoreAsync(RemoteDataSourceInfo parameter)
        {
            var index = await RemoteDataService.DownloadIndexAsync(parameter);

            var i = 0;

            foreach (var remoteDataInfo in index.RemoteDataInfos)
            {
                OperationTitle = $"Downloading {remoteDataInfo.Name}";
                var uri = new Uri(index.IndexUri, remoteDataInfo.IndexPathSuffix);
                using (var client = new HttpClient())
                    using (var stream = await client.GetStreamAsync(uri))
                        using (var memoryStream = new MemoryStream())
                        {
                            await stream.CopyToAsync(memoryStream);

                            memoryStream.Seek(0, SeekOrigin.Begin);
                            switch (remoteDataInfo.DataType)
                            {
                            case RemoteDataType.Catalogue:
                                var catInfo = CatalogueInfo.CreateFromStream(memoryStream);
                                memoryStream.Seek(0, SeekOrigin.Begin);
                                using (var outStream = await RepoStorageService.GetCatalogueOutputStreamAsync(catInfo))
                                {
                                    await memoryStream.CopyToAsync(outStream);
                                }
                                break;

                            case RemoteDataType.GameSystem:
                                var gstInfo = GameSystemInfo.CreateFromStream(memoryStream);
                                memoryStream.Seek(0, SeekOrigin.Begin);
                                using (var outStream = await RepoStorageService.GetGameSystemOutputStreamAsync(gstInfo))
                                {
                                    await memoryStream.CopyToAsync(outStream);
                                }
                                break;

                            default:
                                throw new ArgumentOutOfRangeException();
                            }
                        }
                ProgressPercent = (++i / index.RemoteDataInfos.Count) * 100;
            }
        }
Пример #4
0
 void Awake()
 {
     Instance = this;
 }