public void BuildRoadSegment_OnExistingRoadSegment_MeaningfulErrorIsReceived()
        {
            // Arrange
            MockDice           mockDice = null;
            MockPlayer         player;
            MockComputerPlayer firstOpponent, secondOpponent, thirdOpponent;
            var localGameController = this.CreateLocalGameControllerAndCompleteGameSetup(out mockDice, out player, out firstOpponent, out secondOpponent, out thirdOpponent);

            mockDice.AddSequence(new[] { 8u });
            player.AddResources(new ResourceClutch(1, 0, 1, 0, 0));

            localGameController.LongestRoadBuiltEvent = (Guid pid, Guid nid) => { throw new NotImplementedException(); };
            ErrorDetails errorDetails = null;

            localGameController.ErrorRaisedEvent = (ErrorDetails e) => { errorDetails = e; };

            GameToken turnToken = null;

            localGameController.StartPlayerTurnEvent = (GameToken t) => { turnToken = t; };
            PlayerDataBase playerData = null;

            //localGameController.RoadSegmentBuiltEvent = (PlayerDataBase p) => { playerData = p; };
            localGameController.StartGamePlay();

            // Act
            localGameController.BuildRoadSegment(turnToken, MainRoadOneEnd, MainSettlementOneLocation);

            // Assert
            Assert.Fail("Fail");
            playerData.ShouldBeNull();
            errorDetails.ShouldNotBeNull();
            errorDetails.Message.ShouldBe("Cannot build road segment. Road segment between " + MainRoadOneEnd + " and " + MainSettlementOneLocation + " already exists.");
        }
Esempio n. 2
0
 public GameStateController(PlayerBase _player, PlayerDataBase _playerData, PlatformControllerBase _platformController, MonoBehaviour _mono)
 {
     player             = _player;
     mono               = _mono;
     playerData         = _playerData;
     platformController = _platformController;
 }
        public void BuildRoadSegment_ValidScenario_RoadSegmentBuiltEventRaised()
        {
            // Arrange
            MockDice           mockDice = null;
            MockPlayer         player;
            MockComputerPlayer firstOpponent, secondOpponent, thirdOpponent;
            var localGameController = this.CreateLocalGameControllerAndCompleteGameSetup(out mockDice, out player, out firstOpponent, out secondOpponent, out thirdOpponent);

            mockDice.AddSequence(new[] { 8u });
            player.AddResources(new ResourceClutch(1, 0, 1, 0, 0));

            PlayerDataBase playerDataBase = null;
            //localGameController.RoadSegmentBuiltEvent = (PlayerDataBase p) => { playerDataBase = p; };
            GameToken turnToken = null;

            localGameController.StartPlayerTurnEvent = (GameToken t) => { turnToken = t; };
            localGameController.StartGamePlay();

            // Act
            localGameController.BuildRoadSegment(turnToken, 4u, 3u);

            // Assert
            //playerDataBase.ShouldNotBeNull();
            Assert.Fail("Fail");
        }
Esempio n. 4
0
    public void Load(string id)
    {
        var save = saves.Find(s => s.ID == int.Parse(id));

        characterDB = save.characterDB;
        playerDB    = save.playerDB;
        BattleIndex = save.battleIndex;
        GalIndex    = save.galIndex;
        NextScene(save.sceneName);
    }
Esempio n. 5
0
    public void LoadPlayerData()
    {
        XmlSerializer serializer = new XmlSerializer(typeof(PlayerDataBase));
        string        path       = Application.streamingAssetsPath + "/XML/playerData.xml";

        StreamReader stream = new StreamReader(path);

        playerDB = serializer.Deserialize(stream) as PlayerDataBase;
        stream.Close();
    }
Esempio n. 6
0
 public PlatformController(PlatformDataBase _platformData, PlayerDataBase _playerData, LaneDataBase _laneData, ObstaclesDataBase
                           _obstaclesData, CollectablesDataBase _collectablesData, CollectablesControllerBase _collectablesController)
 {
     playerData             = _playerData;
     platformData           = _platformData;
     laneData               = _laneData;
     obstaclesData          = _obstaclesData;
     collectablesData       = _collectablesData;
     collectablesController = _collectablesController;
 }
Esempio n. 7
0
 // Use this for initialization
 void Start()
 {
     loadingScreen.Instance.Disapear();
     aud = GetComponent <AudioSource>();
     playSound("Chaching");
     Instance = this;
     DB       = GameManager.Instance.PlayerDataBase;
     BTNCreator();
     XPSlider.maxValue = GameManager.Instance.expNeed();
 }
Esempio n. 8
0
 public LevelController(LevelViewBase _levelView, LevelHolderBase _levelHolder, MonoBehaviour _mono,
                        PlayerControllerBase _playerController, PlayerDataBase _PlayerData, AsteroidsFactoryBase _asteroidsFactory, MapControllerBase _mapController)
 {
     levelView        = _levelView;
     playerController = _playerController;
     PlayerData       = _PlayerData;
     levelHolder      = _levelHolder;
     mono             = _mono;
     asteroidsFactory = _asteroidsFactory;
     mapController    = _mapController;
 }
Esempio n. 9
0
 public PlatformSpawner(PlatformDataBase _platformData, PlayerDataBase _playerData, GenericPool <PlatformBase>
                        _platformPool, LaneDataBase _laneData, ObstaclesDataBase _obstaclesData, CollectablesDataBase _collectablesData,
                        CollectablesControllerBase _collectablesController)
 {
     platformData           = _platformData;
     playerData             = _playerData;
     platformPool           = _platformPool;
     laneData               = _laneData;
     obstaclesData          = _obstaclesData;
     collectablesData       = _collectablesData;
     collectablesController = _collectablesController;
 }
Esempio n. 10
0
    public void ChangeMyData(GameManager.meIs _name, PlayerDataBase _data)
    {
        switch (_name)
        {
        case (GameManager.meIs.Allen):
            Allen = _data;
            break;

        case (GameManager.meIs.Queen):
            Queen = _data;
            break;
        }
    }
Esempio n. 11
0
        public PlayerDataBase GetDataModel(bool provideFullPlayerData)
        {
            PlayerDataBase result = null;

            if (provideFullPlayerData)
            {
                result = new PlayerFullDataModel(this);
            }
            else
            {
                result = new PlayerDataModel(this);
            }

            return(result);
        }
Esempio n. 12
0
    public IEnumerator LoadPlayerData(string path)
    {
        WWW www = new WWW(path);

        yield return(www);

        XmlSerializer serializer = new XmlSerializer(typeof(PlayerDataBase));

        StringReader sr = new StringReader(www.text);

        sr.Read();      //跳过BOM头
        playerDB = serializer.Deserialize(sr) as PlayerDataBase;
        sr.Close();

        Global.GetInstance().OnLoadPlayerDataComplete();
    }
Esempio n. 13
0
        static void Main(string[] args)
        {
            PlayerDataBase playerDataBase = new PlayerDataBase();

            playerDataBase.AddNewPlayer(new Player("青羊小霸王"));
            playerDataBase.AddNewPlayer(new Player("武侯一霸"));

            AbstractPlayer player = playerDataBase.GetPlayer("青羊小霸王");

            player.Show();


            player = playerDataBase.GetPlayer("武侯一霸");
            player.Show();

            player = playerDataBase.GetPlayer("高新区方少");
            player.Show();
        }
Esempio n. 14
0
    /// <summary>
    /// Writes all PlayerData(s) to a JSON.
    /// </summary>
    static public void WriteDataBase()
    {
        PlayerDataBase Database = new PlayerDataBase
        {
            PlayerData = PlayerData.GetDatabase()
        };

        //cache
        //string Ref = PlayerData.Database[0].Reference;

        /*for (int i = 0; i < PlayerData.Count; i++)
         * {
         *  if (Database.PlayerData[i].ID == -1)
         *      Database.PlayerData[i].ID = i;
         * }*/

        DataManagment.WriteToJSON(Database, "PokemonData/Data");
    }
        public static bool SetCorruptionEnabled(PlayerDataBase playerData, bool corruptionEnabled, ref WingCorruptionZone __instance)
        {
            if (Cheats.CheatHandler.Instance.Cheats.AlwaysEnableWings && corruptionEnabled)
            {
                Util.Logger.Instance.Log("[WingCorruptionZonePatch-SetCorruptionEnabled] Stopped a Wing Corruption Zone from disabling flight");
                return(false);
            }

            CarLogic    carLogic = playerData.CarLogic_;
            WingsGadget wings    = carLogic.Wings_;

            if (wings != null)
            {
                wings.SetAbilityEnabled(!corruptionEnabled, __instance.showAbilityAlert);
            }
            carLogic.GetComponent <CutPlaneShaderController>().CorruptionEffectActive_ = corruptionEnabled;

            return(false);
        }
Esempio n. 16
0
 public CameraController(CameraDataBase _cameraData, PlayerDataBase _playerData)
 {
     cameraData = _cameraData;
     playerData = _playerData;
 }
Esempio n. 17
0
    private void Start()
    {
        StartCoroutine(XMLManager.LoadSync <GameDataBase>(Application.streamingAssetsPath + "/XML/Core/gameData.xml", result => gameDB = result));
        StartCoroutine(XMLManager.LoadSync <CharacterDataBase>(Application.streamingAssetsPath + "/XML/Preset/characterData.xml", result => characterDB = result));
        StartCoroutine(XMLManager.LoadSync <PlayerDataBase>(Application.streamingAssetsPath + "/XML/Preset/playerData.xml", result => playerDB          = result));

        nameDic.Add("Naruto", "旋涡 鸣人");
        nameDic.Add("Sasuke", "宇智波 佐助");
        nameDic.Add("Shikamaru", "奈良 鹿丸");
        nameDic.Add("Choji", "秋道 丁次");
        nameDic.Add("Neji", "日向 宁次");
        nameDic.Add("Lee", "洛克 李");
        nameDic.Add("Kiba", "犬冢 牙");
        nameDic.Add("Akamaru", "赤丸");
        nameDic.Add("Gaara", "我爱罗");
        nameDic.Add("Kankuro", "勘九郎");
        nameDic.Add("Temari", "手鞠");
        nameDic.Add("Kimimaro", "君麻吕");
        nameDic.Add("Kidoumaru", "鬼童丸");
        nameDic.Add("Tayuya", "多由也");
        nameDic.Add("Sakon", "左近");
        nameDic.Add("Ukon", "右近");
        nameDic.Add("Jiroubou", "次郎坊");
    }
Esempio n. 18
0
 public Observer(PlayerDataBase playerInfo)
 {
     this.m_PlayerInfo = playerInfo;
 }
Esempio n. 19
0
    private void configurateMatch()
    {
        m_ball  = (GameObject.Instantiate(m_ballPrefab) as GameObject).GetComponent <Ball>();
        m_board = GameObject.FindGameObjectWithTag("Board").GetComponent <Board>();

        m_board.init(m_ball);
        m_ball.init(m_board);

        m_arrow = (GameObject.Instantiate(m_arrowPrefab) as GameObject).GetComponent <Arrow>();
        m_arrow.gameObject.SetActiveRecursively(false);

        m_camera = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <GameCamera>();

        //Instantiate teams
        m_team1 = new Team(this, m_camera, m_board);
        m_team2 = new Team(this, m_camera, m_board);

        m_team1.m_opponentTeam = m_team2;
        m_team2.m_opponentTeam = m_team1;
        m_team1.m_user         = User.P1;
        m_team2.m_user         = User.P2;
        m_team1.ID             = "01";
        m_team2.ID             = "02";

        //P1 Team
        TeamData team1Data = TeamDataBase.getTeamData("Nankatsu");

        foreach (PlayerTeamData player in team1Data.m_playerList)
        {
            //Get the player data
            PlayerData playerData = PlayerDataBase.getPlayerData(player.m_name);

            Player p = (GameObject.Instantiate(m_playerPrefab) as GameObject).GetComponent <Player>();
            p.init(m_board, m_team1, playerData.m_position == PlayerPosition.GK);

            m_board.addPlayer(p, new Vector2(player.m_tileX, player.m_tileY));

            if (player.m_tileX == 8 && player.m_tileY == 7)
            {
                p.setBall(m_ball);
            }

            //Add player to the team
            m_team1.addPlayer(p);
        }

        //P2 Team
        TeamData team2Data = TeamDataBase.getTeamData("Nankatsu");

        foreach (PlayerTeamData player in team2Data.m_playerList)
        {
            //Get the player data
            PlayerData playerData = PlayerDataBase.getPlayerData(player.m_name);

            Player p = (GameObject.Instantiate(m_playerPrefab) as GameObject).GetComponent <Player>();
            p.init(m_board, m_team2, playerData.m_position == PlayerPosition.GK);
            p.isFliped = true;

            m_board.addPlayer(p, new Vector2((Board.SIZEX - 1) - player.m_tileX, (Board.SIZEY - 1) - player.m_tileY));

            //Add player to the team
            m_team2.addPlayer(p);
        }

        //P1 starts
        m_currentTeam  = m_team1;
        m_currentPhase = User.P1;
        m_turnIndex    = c_numberOfTurnsInAPhase;
        if (e_startPhase != null)
        {
            e_startPhase(m_currentPhase);
        }

        //Set game mode
        m_gameMode = GameModes.P1VsP2;

        startUserPhase();

        //Add listeners
        ApplicationFactory.instance.m_messageBus.PlayerMovedToTile += currentPlayerMovedToTile;
        ApplicationFactory.instance.m_messageBus.BallMovedToTile   += ballMovedToTile;
        ApplicationFactory.instance.m_messageBus.BallPassEnded     += ballPassEnded;

        ApplicationFactory.instance.m_messageBus.PlayerTurnEnded += playerTurnEnd;
        ApplicationFactory.instance.m_messageBus.UserPhaseEnded  += userPhaseEnd;
    }
Esempio n. 20
0
 public CameraMovement(CameraDataBase _cameraData, PlayerDataBase _playerData)
 {
     cameraData = _cameraData;
     playerData = _playerData;
 }
Esempio n. 21
0
 public PlayerInfo(PlayerDataBase playerData)
 {
     this.playerData = playerData;
     lastMove        = (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
 }