Пример #1
0
        public void TestValidRecord()
        {
            var record = new GamePlayerRecord();

            Assert.AreNotEqual(null, record.Id);
            Assert.AreEqual(0, record.Money);
            Assert.AreEqual(Guid.Empty, record.Owner);
        }
Пример #2
0
 public PlayStage(ISoulBinder binder, IFishStage fish_stage, GamePlayerRecord money)
 {
     _Fishs = new List<Fish>();
     _Bullets = new List<Bullet>();
     _Requests = new Dictionary<int, HitRequest>();
     _Binder = binder;
     _FishStage = fish_stage;
     _DeadFishCount = 0;
     _Money = money;
     _WeaponType = WEAPON_TYPE.NORMAL;
     _WeaponBet = 10;
 }
Пример #3
0
 void IGameRecorder.Save(GamePlayerRecord game_player_record)
 {
     var account = _Accounts.Find(a => a.Guid == game_player_record.Owner);
     if(account.IsPlayer())
     {
         var old = _Records.Find(r => r.Owner == account.Guid);
         _Records.Remove(old);
         _Records.Add(game_player_record);
     }
 }
Пример #4
0
        Value<GamePlayerRecord> IGameRecorder.Load(Guid account_id)
        {
            var account = _Accounts.Find(a => a.Guid == account_id);
            if(account.IsPlayer())
            {
                var record = _Records.Find(r => r.Owner == account.Guid);
                if(record == null)
                {
                    record = new GamePlayerRecord
                    {
                        Id = Guid.NewGuid(),
                        Money = 1000,
                        Owner = account_id
                    };
                }

                return record;
            }

            return null;
        }
Пример #5
0
        void IGameRecorder.Save(GamePlayerRecord record)
        {
            var data = _Database.FindAll<GamePlayerRecord>().SingleOrDefault(r => r.Id == record.Id);

            _Database.Update(data, r => r.Id == record.Id);
        }
Пример #6
0
        Value<GamePlayerRecord> IGameRecorder.Load(Guid account_id)
        {
            var val = new Value<GamePlayerRecord>();
            var account = _Find(account_id);
            if(account.IsPlayer())
            {
                var record = _Database.FindAll<GamePlayerRecord>().SingleOrDefault(r => r.Owner == account_id);

                if(record != null)
                {
                    val.SetValue(record);
                }
                else
                {
                    var newRecord = new GamePlayerRecord
                    {
                        Id = Guid.NewGuid(),
                        Owner = account_id,
                        Money = 100
                    };
                    _Database.Add(newRecord, obj => obj.Id);
                    val.SetValue(newRecord);
                }
            }
            else
            {
                val.SetValue(null);
            }

            return val;
        }
Пример #7
0
        private void _ToQueryRecord()
        {
            _GameRecorder.Load(_Account.Guid)
                        .OnValue += obj =>
                        {
                            _GamePlayerRecord = obj;
                            _StageTicketInspector.Initial(new[]
                            {
                                new Common.Data.Stage
                                {
                                    Id = 1,
                                    Pass = true
                                },
                                new Common.Data.Stage
                                {
                                    Id = 2,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 4,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 5,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 6,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 7,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 8,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 9,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 10,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 11,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 12,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 13,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 14,
                                    Pass = false
                                },
                                new Common.Data.Stage
                                {
                                    Id = 111,
                                    Pass = true
                                }
                            });

                            _ToLoadTradeNotes();
                        };
        }