Exemplo n.º 1
0
        /*//OLD METHOD
         * public DTO.MonopolyEngine.GameState Brent(DTO.Player me)
         * {
         *  DTO.MonopolyEngine.GameState tmp = NewGame.publicState;
         *
         *  DTO.MonopolyEngine.StateToClient state = new DTO.MonopolyEngine.StateToClient();
         *  return null;//NewGame.publicState;
         * }*/

        //NEW METHOD TOMPEETERS 10/12/2013
        DTO.MonopolyEngine.StateToClient IService1.GetState(DTO.Player me)
        {
            DTO.MonopolyEngine.GameState tmp = NewGame.publicState;

            DTO.MonopolyEngine.StateToClient state = new DTO.MonopolyEngine.StateToClient();

            // state.ActivePlayer = tmp.ActivePlayer;
            state.ActiveTileName         = tmp.ActiveTileName;
            state.CurrentPhase           = tmp.CurrentPhase;
            state.DieCast                = tmp.DieCast;
            state.EnableBuy              = tmp.EnableBuy;
            state.lastDieRoll            = tmp.lastDieRoll;
            state.PlayerTradeRequested   = tmp.PlayerTradeRequested;
            state.PropertyTradeDirection = tmp.PropertyTradeDirection;
            state.PropertyTradeRequested = tmp.PropertyTradeRequested;
            state.TurnNumber             = tmp.TurnNumber;
            state.Log       = tmp.Notificationlog;
            state.Ownership = tmp.Ownership;
            state.IsBought  = tmp.IsBought;
            //state.PlayerList = tmp.PlayerList;

            state.ActivePlayer = new DTO.MonopolyEngine.GamePlayerToClient();


            foreach (var p in tmp.PlayerList)
            {
                if (p.MyPlayer.PlayerId == me.PlayerId)
                {
                    state.ActivePlayer.MyName            = p.MyPlayer.PlayerName;
                    state.ActivePlayer.Cash              = p.Cash;
                    state.ActivePlayer.HasEscapePrisonCh = p.HasEscapePrisonCh;
                    state.ActivePlayer.HasEscapePrisonCo = p.HasEscapePrisonCo;
                    state.ActivePlayer.IsActive          = p.IsActive;
                    state.ActivePlayer.IsPlaying         = p.IsPlaying;
                    state.ActivePlayer.IsPrison          = p.IsPrison;
                    state.ActivePlayer.Location          = p.Location;
                    state.ActivePlayer.PrisonTime        = p.PrisonTime;
                    state.OwnedProps = new List <DTO.MonopolyEngine.PropertyToClient>();
                    foreach (var item in p.PlayerProperty)
                    {
                        state.OwnedProps.Add(new DTO.MonopolyEngine.PropertyToClient()
                        {
                            HouseLevel = item.HouseLevel, ID = item.ID, Morguage = item.Morguage, SetLevel = item.SetLevel
                        });
                    }
                }
            }

            return(state);//NewGame.publicState;
        }
        /*//OLD METHOD
         * public DTO.MonopolyEngine.GameState Brent(DTO.Player me)
         * {
         *  DTO.MonopolyEngine.GameState tmp = NewGame.publicState;
         *
         *  DTO.MonopolyEngine.StateToClient state = new DTO.MonopolyEngine.StateToClient();
         *  return null;//NewGame.publicState;
         * }*/

        //NEW METHOD TOMPEETERS 10/12/2013
        DTO.MonopolyEngine.StateToClient IService1.GetState(DTO.Player me)
        {
            DTO.MonopolyEngine.GameState tmp = NewGame.publicState;

            DTO.MonopolyEngine.StateToClient state = new DTO.MonopolyEngine.StateToClient();

            // state.ActivePlayer = tmp.ActivePlayer;
            state.ActiveTileName         = tmp.ActiveTileName;
            state.CurrentPhase           = tmp.CurrentPhase;
            state.DieCast                = tmp.DieCast;
            state.EnableBuy              = tmp.EnableBuy;
            state.lastDieRoll            = tmp.lastDieRoll;
            state.PlayerTradeRequested   = tmp.PlayerTradeRequested;
            state.PropertyTradeDirection = tmp.PropertyTradeDirection;
            state.PropertyTradeRequested = tmp.PropertyTradeRequested;
            state.TurnNumber             = tmp.TurnNumber;
            state.Log = tmp.Notificationlog;