public IEnumerator WHEN_FillAllGameDataFunctionCalled_THEN_GameDataIsFilled() { // Make all games labelled as played Globals.isBalloonsButtonOn = false; Globals.isCTFButtonOn = false; Globals.isImageHitButtonOn = false; Globals.isSquaresButtonOn = false; Globals.isCatchTheBallButtonOn = false; Globals.isJudgeTheBallButtonOn = false; Globals.isSaveOneBallButtonOn = false; BatterySessionManagement batterySessionManagement = new BatterySessionManagement(); batterySessionManagement.FillAllGameData(); yield return(null); // Game data should be filled with actual gameplay data from each game Assert.AreEqual(Balloons.GetGameplayData(), batterySessionManagement.balloonsData); Assert.AreEqual(CatchTheThief.GetGameplayData(), batterySessionManagement.ctfData); Assert.AreEqual(Squares.GetGameplayData(), batterySessionManagement.squaresData); Assert.AreEqual(ImageHit.GetGameplayData(), batterySessionManagement.imageHitData); Assert.AreEqual(CatchTheBall.GetGameplayData(), batterySessionManagement.catchTheBallData); Assert.AreEqual(JudgeTheBall.GetGameplayData(), batterySessionManagement.judgeTheBallData); Assert.AreEqual(SaveOneBall.GetGameplayData(), batterySessionManagement.saveOneBallData); }
public IEnumerator WHEN_GetGameplayDataFunctionCalled_THEN_GamePlayDataRetured() { BalloonsStorage balloonsData1 = Balloons.GetGameplayData(); List <BalloonsRound> expectedRoundsData1 = new List <BalloonsRound>(); Assert.AreEqual(expectedRoundsData1, balloonsData1.Rounds); balloonScript.ClickOnBalloon(); yield return(new WaitForSeconds(0.01f)); // After the click on balloon that is located on center point: BalloonsStorage balloonsData2 = Balloons.GetGameplayData(); List <BalloonsRound> expectedRoundsData2 = new List <BalloonsRound>(); Assert.AreEqual(expectedRoundsData2, balloonsData2.Rounds); // Take 0.01s to click on the balloon that is in random position balloonScript.ClickOnBalloon(); yield return(new WaitForSeconds(0.01f)); // After the click on balloon that is located on random position: BalloonsStorage balloonsData3 = Balloons.GetGameplayData(); double expectedBalloonSize = 200; List <TimeAndPosition> expectedClicks = new List <TimeAndPosition>(); Assert.AreEqual(1, balloonsData3.Rounds.Count); Assert.IsTrue(Math.Abs(expectedBalloonSize - balloonsData3.Rounds[0].BalloonSize) <= tolerance); Assert.AreEqual(expectedClicks, balloonsData3.Rounds[0].Clicks); }
/// <summary> /// FillAllGameData is to update game data objects with corresponding raw gameplay data. /// It will only get gameplay data for the games that have been played. /// </summary> public void FillAllGameData() { // Get gameplay data for Balloons // If the game has been played, get the gameplay data; else, skip this game if (!notYetPlayBalloons) { balloonsData = Balloons.GetGameplayData(); } // Get gameplay data for Squares // If the game has been played, get the gameplay data; else, skip this game if (!notYetPlaySquares) { squaresData = Squares.GetGameplayData(); } // Get gameplay data for Catch The Thief // If the game has been played, get the gameplay data; else, skip this game if (!notYetPlayCTF) { ctfData = CatchTheThief.GetGameplayData(); } // Get gameplay data for ImageHit // If the game has been played, get the gameplay data; else, skip this game if (!notYetPlayImageHit) { imageHitData = ImageHit.GetGameplayData(); } // Get gameplay data for Catch The Ball // If the game has been played, get the gameplay data; else, skip this game if (!notYetCatchTheBall) { catchTheBallData = CatchTheBall.GetGameplayData(); } // Get gameplay data for Save One Ball // If the game has been played, get the gameplay data; else, skip this game if (!notYetSaveOneBall) { saveOneBallData = SaveOneBall.GetGameplayData(); } // Get gameplay data for Judge The Ball // If the game has been played, get the gameplay data; else, skip this game if (!notYetJudgeTheBall) { judgeTheBallData = JudgeTheBall.GetGameplayData(); } }
// Once scene loaded, store important game objects for the tests // into instance variables. void SetGameObjects(Scene scene, LoadSceneMode mode) { // Link game object to local variable; throw out exception if there is no such game object balloon = GameObject.Find("Balloon"); Assert.IsNotNull(balloon, "Missing gameobject: " + "balloon"); timer = GameObject.Find("TimerValue").GetComponent <Text>(); Assert.IsNotNull(timer, "Missing gameobject: " + "timer"); testButton = GameObject.Find("TransparentTestButton"); Assert.IsNotNull(testButton, "Missing gameobject: " + "transparent test button"); balloonScript = GameObject.Find("Canvas").GetComponent <Balloons>(); Assert.IsNotNull(balloonScript, "Balloon.cs script is not attached to canvas"); // Remove event so this method is not re-evaluated // if a non-BalloonsInstruction scene is loaded SceneManager.sceneLoaded -= SetGameObjects; }
public ClientPlane(Balloons.Messaging.Model.Plane parent) : base(parent) { }
private static void GetDrawingDimension() { try { inventorApp = (Inventor.Application)Marshal.GetActiveObject("Inventor.Application"); Console.WriteLine("查找到可用的实例"); } catch { Console.WriteLine("未打开Inventor"); return; } DrawingDocument drawingDocument = (DrawingDocument)inventorApp.ActiveDocument; //在Inventor当前正在显示的工程图不一样的时候,ActiveSheet也会发生变化 Console.WriteLine("打开的图纸:" + drawingDocument.ActiveSheet.Name + " " + drawingDocument.FullFileName); DrawingView drawingView = drawingDocument.ActiveSheet.DrawingViews[1]; //特别注明:该类及其方法仅针对模型和草图文件 GeneralDimensionsEnumerator generalDimensionsEnumerator = drawingDocument.ActiveSheet.DrawingDimensions.GeneralDimensions.Retrieve(drawingView); Console.WriteLine("generalDimensionsEnumerator.Count = " + generalDimensionsEnumerator.Count); if (generalDimensionsEnumerator.Count != 0) { for (int i = 1; i <= generalDimensionsEnumerator.Count; i++) { Console.WriteLine(generalDimensionsEnumerator[i].Text); } } //////////////////////////////////////////////////////////////////////////////////////////////////////// BaselineDimensionSets baselineDimensionSets = drawingDocument.ActiveSheet.DrawingDimensions.BaselineDimensionSets; Console.WriteLine("baselineDimensionSets.Count = " + baselineDimensionSets.Count); if (baselineDimensionSets.Count != 0) { for (int i = 1; i <= baselineDimensionSets.Count; i++) { BaselineDimensionSet baselineDimensionSet = baselineDimensionSets[i]; Console.WriteLine("baselineDimensionSet.Members = " + baselineDimensionSet.Members); Console.WriteLine("baselineDimensionSet.DimensionType" + baselineDimensionSet.DimensionType); } } //////////////////////////////////////////////////////////////////////////////////////////////////////// Balloons ballons = drawingDocument.ActiveSheet.Balloons; Console.WriteLine("ballons.Count = " + ballons.Count); Balloon balloon = null; if (ballons.Count != 0) { for (int i = 1; i <= ballons.Count; i++) { Console.WriteLine("\n------------------------ballons[" + i + "]------------------------"); balloon = ballons[i]; //Console.WriteLine("balloon.Leader.RootNode = " + balloon.Leader.RootNode); //打印出 System.__ComObject //Console.WriteLine("balloon.Position = " + balloon.Position); //打印出 System.__ComObject AttributeSets attributeSets = balloon.AttributeSets; Console.WriteLine("attributeSets.Count = " + attributeSets.Count); for (int j = 1; j <= attributeSets.Count; j++) { AttributeSet attributeSet = attributeSets[j]; Console.WriteLine("attributeSet.Name = " + attributeSet.Name); } BalloonValueSets balloonValueSets = balloon.BalloonValueSets; for (int j = 1; j <= balloonValueSets.Count; j++) { BalloonValueSet balloonValueSet = balloonValueSets[j]; Console.WriteLine("balloonValueSet.ItemNumber = " + balloonValueSet.ItemNumber); Console.WriteLine("balloonValueSet.Value = " + balloonValueSet.Value); Console.WriteLine("balloonValueSet.OverrideValue = " + balloonValueSet.OverrideValue); //Console.WriteLine("balloonValueSet.ReferencedFiles = " + balloonValueSet.ReferencedFiles); Console.WriteLine("balloonValueSet.Type = " + balloonValueSet.Type); } Leader leader = balloon.Leader; Console.WriteLine("leader.ArrowheadType = " + leader.ArrowheadType); Console.WriteLine("leader.Type = " + leader.Type); AttributeSets attributeSets_leader = leader.AttributeSets; Console.WriteLine("attributeSets_leader.Count = " + attributeSets_leader.Count); for (int j = 0; j < attributeSets_leader.Count; j++) { AttributeSet attributeSet = attributeSets[j]; Console.WriteLine("attributeSet_leader.Name = " + attributeSet.Name); } Console.WriteLine("END------------------------ballons[" + i + "]------------------------\n"); } } //////////////////////////////////////////////////////////////////////////////////////////////////////// //DrawingViews views = drawingDocument.ActiveSheet.DrawingViews; //Console.WriteLine("views.count = " + views.Count); Console.WriteLine("drawingDocument.SelectSet.Count = " + drawingDocument.SelectSet.Count); SelectSet selectSet = null; DrawingCurveSegment drawingCurveSegment = null; if (drawingDocument.SelectSet.Count == 0) { Console.WriteLine("Select a drawing view"); DrawingView view = inventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view"); //selectSet = inventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingSheetFilter, "Select drawing sheet!"); drawingCurveSegment = inventorApp.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select drawing segment filter"); } else { selectSet = drawingDocument.SelectSet; } //DrawingCurveSegment drawingCurveSegment = selectSet[1];//drawingDocument.SelectSet[1]; DrawingCurve drawingCurve = drawingCurveSegment.Parent; //Get the mid point of the selected curve assuming that the selection curve is linear Point2d MidPoint = drawingCurve.MidPoint; //Set a reference to the TransientGeometry object. TransientGeometry TG = inventorApp.TransientGeometry; Console.WriteLine("TG : " + (TG == null)); ObjectCollection LeaderPoints = inventorApp.TransientObjects.CreateObjectCollection(); Console.WriteLine("LeaderPoints : " + (LeaderPoints == null)); LeaderPoints.Add(TG.CreatePoint2d(MidPoint.X + 10, MidPoint.Y + 10)); LeaderPoints.Add(TG.CreatePoint2d(MidPoint.X + 10, MidPoint.Y + 5)); //Add the GeometryIntent to the leader points collection. //This is the geometry that the balloon will attach to. GeometryIntent geometryIntent = drawingDocument.ActiveSheet.CreateGeometryIntent(drawingCurve); LeaderPoints.Add(geometryIntent); //Set a reference to the parent drawing view of the selected curve //DrawingView drawingView = drawingCurve.Parent; //Set a reference to the referenced model document Document ModelDoc = drawingView.ReferencedDocumentDescriptor.ReferencedDocument; Console.WriteLine(ModelDoc.Type); //PartDocument ModelDoc = drawingView.ReferencedDocumentDescriptor.ReferencedDocument; //AssemblyDocument ModelDoc = drawingView.ReferencedDocumentDescriptor.ReferencedDocument; //Check if a partslist or a balloon has already been created for thie model Boolean IsDrawingBOMDefined = drawingDocument.DrawingBOMs.IsDrawingBOMDefined(ModelDoc.FullFileName); // Balloon balloon; if (IsDrawingBOMDefined) { //当DrawingBOM已经被定义了 //Just create the balloon with the leader points. All other arguments can be ignored Console.WriteLine("当DrawingBOM已经被定义了\n创建气泡标注"); balloon = drawingDocument.ActiveSheet.Balloons.Add(LeaderPoints); } else { //当DrawingBOM没有被定义 AssemblyDocument assemblyDocument = (AssemblyDocument)ModelDoc; AssemblyComponentDefinition assemblyComponentDefinition = assemblyDocument.ComponentDefinition; ///* //First check if the 'structured' BOM view has been enabled in the model //Set a reference to the model's BOM object //BOM bom = ModelDoc.ComponentDefinition.BOM; BOM bom = assemblyComponentDefinition.BOM; if (bom.StructuredViewEnabled) { //Level needs to be specifieed. Numbering options jave already been defined. //Get the Level('All levels' of 'First level only') from the model BOM view - must use the same here PartsListLevelEnum Level; if (bom.StructuredViewFirstLevelOnly) { Level = PartsListLevelEnum.kStructured; } else { Level = PartsListLevelEnum.kStructuredAllLevels; } } else { //Level and numbering options must be specifieed. //The corresponding model BOM view will automatically be enabled NameValueMap NumberingScheme = inventorApp.TransientObjects.CreateNameValueMap(); //Add the option for a comma delimiter NumberingScheme.Add("Delimeter", ","); //Create the balloon by specifying the level and numbering scheme balloon = drawingDocument.ActiveSheet.Balloons.Add(LeaderPoints, PartsListLevelEnum.kStructuredAllLevels, NumberingScheme); } //*/ } }