static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths) { foreach (string asset in importedAssets) { if (!filePath.Equals(asset)) { continue; } ComputerLevel data = (ComputerLevel)AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(ComputerLevel)); if (data == null) { data = ScriptableObject.CreateInstance <ComputerLevel> (); data.SheetName = filePath; data.WorksheetName = sheetName; AssetDatabase.CreateAsset((ScriptableObject)data, assetFilePath); //data.hideFlags = HideFlags.NotEditable; } //data.dataArray = new ExcelQuery(filePath, sheetName).Deserialize<ComputerLevelData>().ToArray(); //ScriptableObject obj = AssetDatabase.LoadAssetAtPath (assetFilePath, typeof(ScriptableObject)) as ScriptableObject; //EditorUtility.SetDirty (obj); ExcelQuery query = new ExcelQuery(filePath, sheetName); if (query != null && query.IsValid()) { data.dataArray = query.Deserialize <ComputerLevelData>().ToArray(); ScriptableObject obj = AssetDatabase.LoadAssetAtPath(assetFilePath, typeof(ScriptableObject)) as ScriptableObject; EditorUtility.SetDirty(obj); } } }
public CreatePlayerDto( PlayerType type, string name, bool playVsComputer = false, ComputerLevel computerLevel = ComputerLevel.None) { Type = type; Name = name; PlayVsComputer = playVsComputer; ComputerLevel = computerLevel; }
public void IsMatch_GivenComputerLevel_MatchesGivenExpected(ComputerLevel computerLevel, bool expected) { // Arrange var mockLogger = new Mock <ILogger <ComputerMoveHard> >(); IComputerMove classUnderTest = new ComputerMoveHard(mockLogger.Object); // Act var actual = classUnderTest.IsMatch(computerLevel); // Assert Assert.AreEqual(expected, actual); }
public async Task <Player> CreatePlayer( string name, PlayerType type, string connectionId, bool playVsComputer, ComputerLevel computerLevel) { if (_connectionManager.Count > 1) { throw new SetupException("Maximum number of players already in the game!"); } var player = new Player(name, type); _connectionManager.Add(player.Id, connectionId); _playerManager.AddPlayerToGame(player); switch (playVsComputer, _connectionManager.Count) {
public bool IsMatch(ComputerLevel computerLevel) { return(computerLevel == ComputerLevel.Hard); }
public void PlayVsComputer(ComputerLevel computerLevel) { AddPlayerToGame(new Player("Computer", PlayerType.Computer)); IsPlayingVsComputer = true; ComputerLevel = computerLevel; }
public async Task CreatePlayerAsync(string name, PlayerType type, bool playVsComputer, ComputerLevel computerLevel = ComputerLevel.None) { try { var player = await PostRequest <Player, CreatePlayerDto>( $"setup/createplayer/{_messageService.HubConnectionId}", new CreatePlayerDto(type, name, playVsComputer, computerLevel)); PlayerId = player.Id; _eventExecutor.PlayerCreated(player); } catch (Exception exception) { Console.WriteLine("Failed to create player: " + exception.Message); } }
public bool IsMatch(ComputerLevel computerLevel) { return(computerLevel == ComputerLevel.Medium); }