示例#1
0
 public IObservable <BoolResponse> SetProgress(int level, LevelProgressRequest contract)
 {
     // tmp fake data
     return(Observable
            .Return(new BoolResponse
     {
         Result = true
     }).Single());
 }
示例#2
0
        public override void Execute()
        {
            Retain();

            var levelProgress = new LevelProgressDto
            {
                Level            = gameModel.Level,
                Stars            = gameModel.Stars.Value,
                ObjectsCollected = gameModel.ObjectsCollected.Value,
                Seconds          = gameModel.Seconds.Value
            };


            var current = progress.Get(gameModel.Level);

            if (current != null)
            {
                if (current.Stars < levelProgress.Stars)
                {
                    current.Stars            = levelProgress.Stars;
                    current.Seconds          = levelProgress.Seconds;
                    current.ObjectsCollected = levelProgress.ObjectsCollected;
                }
            }
            else
            {
                Retain();

                progress.Progress.Add(levelProgress);

                var contract = new LevelProgressRequest
                {
                    LevelProgress = levelProgress
                };

                connection.SetProgress(gameModel.Level, contract).Subscribe(OnSuccess, OnError);
            }
        }