예제 #1
0
        private void _ToGame(GamePlayerRecord record, Realm.Map map)
        {
            var player = EntityProvider.Create(record.Entity);

            var itemProvider = new ItemProvider();
            var itemAxe      = itemProvider.MakeItem("Axe1", 0.5f);
            var itemSword1   = itemProvider.MakeItem("Sword1", 0.5f);
            var itemSword2   = itemProvider.MakeItem("Sword2", 0.5f);
            var itemShield1  = itemProvider.MakeItem("Shield1", 0.5f);

            player.Bag.Add(itemAxe);
            player.Bag.Add(itemSword1);
            player.Bag.Add(itemSword2);
            player.Bag.Add(itemShield1);

            foreach (var item in record.Items)
            {
                player.Bag.Add(item);
            }

            var stage = new GameStage(this._Binder, map.Finder, map.Gate, player);

            stage.ExitEvent     += () => { };
            stage.TransmitEvent += _ToRealm;
            _Machine.Push(stage);
        }
예제 #2
0
        Value <GamePlayerRecord> IGameRecorder.Load(Guid account_id)
        {
            var account = this._Accounts.Find(a => a.Id == account_id);

            if (account.IsPlayer())
            {
                var record = this._Records.Find(r => r.Owner == account.Id);
                if (record == null)
                {
                    record = new GamePlayerRecord
                    {
                        Id = Guid.NewGuid(),

                        Owner = account_id,
                        Items = new Item[]
                        {
                        }
                    };
                }

                return(record);
            }

            return(null);
        }
예제 #3
0
        void IGameRecorder.Save(GamePlayerRecord game_player_record)
        {
            var account = _Accounts.Find(a => a.Id == game_player_record.Owner);

            if (account.IsPlayer())
            {
                var old = _Records.Find(r => r.Owner == account.Id);
                _Records.Remove(old);
                _Records.Add(game_player_record);
            }
        }
예제 #4
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;
 }
예제 #5
0
        // Sends the details for the game and all players to the database
        private IEnumerator RecordGameHistory(int blueScore, int redScore)
        {
            string winner = "Draw";

            if (blueScore > redScore)
            {
                winner = "Blue";
            }
            else if (redScore > blueScore)
            {
                winner = "Red";
            }

            // create player array
            GamePlayerRecord[] playerRecords = new GamePlayerRecord[serverManager.ClientCount];
            int i = 0;

            foreach (ClientDataOnServer client in serverManager.RegisteredClients)
            {
                string           clientTeam = client.ClientTeam == IAIBase.ETeam.TEAM_RED ? "Red" : "Blue";
                GamePlayerRecord record     = new GamePlayerRecord()
                {
                    UserID = client.User.UserID, Team = clientTeam, EXP = client.EXP
                };
                playerRecords[i] = record;
                ++i;
            }

            WWWForm gameForm = new WWWForm();

            gameForm.AddField("Winner", winner);
            gameForm.AddField("Players", JsonUtility.SerializeToJson <GamePlayerRecord[]>(playerRecords));
            gameForm.AddField("Hash", HashUtility.GetMD5Hash(winner + AppKey.appKey));

            WWW response = new WWW(WWWFormUtility.recordGameScoresURL, gameForm);

            yield return(response);

            if (response.error == null)
            {
                Debug.Log(response.text);
            }
            else
            {
                Debug.Log(response.error);
            }
        }
예제 #6
0
        Value <GamePlayerRecord> IGameRecorder.Load(Guid account_id)
        {
            var account = _Accounts.Find(a => a.Id == account_id);

            if (account.IsPlayer())
            {
                var record = _Records.Find(r => r.Owner == account.Id);
                if (record == null)
                {
                    record = new GamePlayerRecord
                    {
                        Id    = Guid.NewGuid(),
                        Money = 1000,
                        Owner = account_id
                    };
                }

                return(record);
            }

            return(null);
        }
 private void _LoadResult(GamePlayerRecord obj)
 {
     this.DoneEvent(obj);
 }
예제 #8
0
 private void _ToRequestMap(GamePlayerRecord record)
 {
     this._GamePlayerRecord = record;
     _ToRealm("town1");
 }
예제 #9
0
        private void _ToQueryRecord()
        {
            _GameRecorder.Load(_Account.Id).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();
            };
        }