Ejemplo n.º 1
0
        public ZsFishStage(Guid account_id, FishFarmData fish_farm_data, FormulaPlayerRecord formula_player_record, IFormulaPlayerRecorder formula_player_recorder, IFormulaFarmRecorder formula_stage_data_recorder)
        {
            _AccountId = account_id;
            _FishFarmData = fish_farm_data;

            _FormulaFarmRecorder = formula_stage_data_recorder;
            _FormulaPlayerRecorder = formula_player_recorder;

            _FormulaPlayerRecord = formula_player_record;
        }
Ejemplo n.º 2
0
        public ZsHitChecker(FishFarmData fish_farm_data, FormulaPlayerRecord formula_player_record)
        {
            var record = formula_player_record.FindFarmRecord(fish_farm_data.FarmId);

            if(record == null)
            {
                var tmp = formula_player_record.FarmRecords.ToList();
                tmp.Add(new FarmRecord(fish_farm_data.FarmId));
                formula_player_record.FarmRecords = tmp.ToArray();
            }

            _DataVisitor = new DataVisitor(fish_farm_data, formula_player_record);
        }
Ejemplo n.º 3
0
        public DataVisitor(FishFarmData fish_farm, FormulaPlayerRecord formula_player_record)
        {
            Farm = fish_farm;
            PlayerRecord = formula_player_record;

            _Treasures = new List<TreasureKind>
            {
                new TreasureKind
                {
                    Kind = TreasureKind.KIND.RANDOM,
                    Treasures = new List<WEAPON_TYPE>()
                },
                new TreasureKind
                {
                    Kind = TreasureKind.KIND.CERTAIN,
                    Treasures = new List<WEAPON_TYPE>()
                }
            };
        }
Ejemplo n.º 4
0
 Value<bool> IFormulaPlayerRecorder.Save(FormulaPlayerRecord record)
 {
     return true;
 }
Ejemplo n.º 5
0
 Value<bool> IFormulaPlayerRecorder.Save(FormulaPlayerRecord record)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 6
0
 private FormulaPlayerRecord _LoadFormulaPlayerRecord(FormulaPlayerRecord record)
 {
     var data = _Database.Find(record, x => x.Id);
     return data;
 }
Ejemplo n.º 7
0
        Value<bool> IFormulaPlayerRecorder.Save(FormulaPlayerRecord record)
        {
            Server._Logger.Info().Message("Save Player Run Start.").Property("PlayerId", record.Guid).Write();
            var val = new Value<bool>();
            var recordData = _LoadFormulaPlayerRecord(record);

            if(recordData == null)
            {
                val.SetValue(false);
                Server._Logger.Fatal().Message("Save player data fail.").Write();
            }
            else
            {
                val.SetValue(true);
                _Database.Update(record, a => a.Id);

                Server._Logger.Info().Message("Save Player Run Finish.").Property("PlayerId", record.Guid).Write();
            }

            return val;
        }
Ejemplo n.º 8
0
        Value<FormulaPlayerRecord> IFormulaPlayerRecorder.Query(Guid account_id)
        {
            Server._Logger.Info().Message("Player Query Run Start.").Property("PlayerId", account_id).Write();

            var val = new Value<FormulaPlayerRecord>();
            var data = _LoadFormulaPlayerRecord(account_id);

            if(data == null)
            {
                var record = new FormulaPlayerRecord
                {
                    Guid = Guid.NewGuid(),
                    Owner = account_id
                };

                _Database.Add(record, obj => obj.Id);
                val.SetValue(record);

                Server._Logger.Info().Message("Create New Player Run.").Property("PlayerId", account_id).Write();
            }
            else
            {
                val.SetValue(data);
            }

            Server._Logger.Info().Message("Player Query Run Finish.").Property("PlayerId", account_id).Write();

            return val;
        }