void Shoot() { gunShot.Play(); RaycastHit hit; if (Physics.Raycast(fps.transform.position, fps.transform.forward, out hit)) { Debug.Log(hit.transform.name); if (hit.transform.name.Equals("Pigman") == false) { ricochet.Play(); } Target target = hit.transform.GetComponent <Target>(); Target2 target2 = hit.transform.GetComponent <Target2>(); if (target != null) { target.TakeDamage(damage); } if (target2 != null) { target2.TakeDamage(damage); } } }
/// <inheritdoc /> /// <summary> /// 重置目标、默认网关设置并清空数据包缓冲区,不会对正在进行的毒化工作的设置造成影响。 /// </summary> public override void Reset() { Target1.Clear(); Target2.Clear(); Gateway = null; ClearCaptures(); }
public override void OnEnter() { base.OnEnter(); Color = CCColor3B.Blue; Opacity = 255; // Make sure we set the Opacity to cascade or fadein action will not work correctly. Target1.IsOpacityCascaded = true; Target2.IsOpacityCascaded = true; // Define actions var moveUp = new CCMoveBy(1.0f, new CCPoint(0.0f, 50.0f)); var moveDown = moveUp.Reverse(); // A CCSequence action runs the list of actions in ... sequence! var moveSeq = new CCSequence(new CCEaseBackInOut(moveUp), new CCEaseBackInOut(moveDown)); var repeatedAction = new CCRepeatForever(moveSeq); // A CCSpawn action runs the list of actions concurrently var dreamAction = new CCSpawn(new CCFadeIn(5.0f), new CCWaves(5.0f, new CCGridSize(10, 20), 5, 20, true, false)); Target1.RunActions(dreamAction, repeatedAction); Target2.RunActions(dreamAction, new CCDelayTime(0.5f), repeatedAction); // moving background. Testing issue #244 var move = new CCMoveBy(3, new CCPoint(200, 0)); bgNode.RepeatForever(move, move.Reverse()); }
public void Map_WithType_Back_Success() { TinyMapper.Bind <Target1, Source1>(); TinyMapper.Bind <Target2, Source1>(); Target1 target1 = CreateTarget1(); var actual = TinyMapper.Map <Source1>(target1); Assert.Equal(actual.DateTime, target1.DateTime); Assert.Equal(actual.FirstName, target1.FirstName); Assert.Equal(actual.LegacyString, target1.LatestString); Assert.Equal(actual.LegacyTarget1String, target1.SourceString); Assert.Null(actual.LegacyTarget2String); Assert.Equal(actual.SealedString, target1.ProtectedString); Assert.Equal(actual.SealedTarget1String, target1.TargetString); Assert.Null(actual.SealedTarget2String); Target2 target2 = CreateTarget2(); actual = TinyMapper.Map <Source1>(target2); Assert.Equal(actual.DateTime, target2.DateTime); Assert.Equal(actual.FirstName, target2.FirstName); Assert.Equal(actual.LegacyString, target2.LatestString); Assert.Null(actual.LegacyTarget1String); Assert.Equal(actual.LegacyTarget2String, target2.SourceString); Assert.Equal(actual.SealedString, target2.ProtectedString); Assert.Null(actual.SealedTarget1String); Assert.Equal(actual.SealedTarget2String, target2.TargetString); }
//Continues the game (new set) and destroys the point markers public void ToContinue() { GameObject[] gos; gos = GameObject.FindGameObjectsWithTag("point"); foreach (GameObject go in gos) { Destroy(go); } continued = true; Target.SetActive(true); TR.cycle = 0; //TR.replace(); if (WeighingSlider.value == 2) { Target2.SetActive(true); TR2.cycle = 0; //TR2.replace(); } // Align cycles for new set if (GameControl.instance.completedSets > 1) { TR.cycle = TR2.cycle = 1; } }
public void ContinueWorkout() { if (WeighingSlider.value == 1) { TR.cycle = 5; } else { TR.cycle = 0; } TR.replace(); Target.SetActive(true); if (WeighingSlider.value == 2) // both arms at same time selected { TR2.cycle = 0; TR2.replace(); Target2.SetActive(true); } StopLoggingRestTime(); StartLoggingWorkoutTime(); GameControl.instance.completedSets++; ToContinue(); /* * if (continued == false) * { * ToContinue(); * } */ }
public void Serialize2() { var target = new Target2(); string data = JsonSerializer.ToJsonString(target, m_resolver); Assert.AreEqual(m_target2Serialized, data); }
public void MsgDispatcherLogical_LogicalEndpointSetID() { Target2 target = new Target2(); MsgDispatcher dispatcher = new MsgDispatcher(); Guid orgID; orgID = dispatcher.LogicalEndpointSetID; dispatcher.AddTarget(target); Assert.AreNotEqual(orgID, dispatcher.LogicalEndpointSetID); }
public void CanMethodWithPath() { var newTarget = new Target2 { Target = target.Object }; Elt.DataContext = newTarget; FireMethod("Target." + nameof(ITarget.NoParamsNoReturn)); target.Verify(i => i.NoParamsNoReturn(), Times.Once); }
//private LeapServiceProvider provider; void Start() { collisionEvents = new List <ParticleCollisionEvent> (); BCI2000.receiveThread = new Thread(() => BCI2000.receiveData(BCI2000.receivePort)); BCI2000.receiveThread.IsBackground = true; BCI2000.receiveThread.Start(); Target1.SetActive(false); Target2.SetActive(false); Target = new GameObject[3]; Target [1] = Target1; Target [2] = Target2; }
public void MsgDispatcherPhysical_ValidHandlers() { Target2 target = new Target2(); MsgDispatcher dispatcher = new MsgDispatcher(); dispatcher.AddTarget(target); dispatcher.Dispatch(new _DispatchMsg1()); dispatcher.Dispatch(new _DispatchMsg2()); dispatcher.Dispatch(new _DispatchMsg3()); Thread.Sleep(DispatchWait); Assert.IsTrue(target.dispatch1); Assert.IsTrue(target.dispatch2); Assert.IsTrue(target.dispatch3); }
public override void OnEnter() { base.OnEnter(); var waves = new CCWaves(5, new CCGridSize(15, 10), 5, 20, true, false); var shaky = new CCShaky3D(5, new CCGridSize(15, 10), 4, false); Target1.RepeatForever(waves); Target2.RepeatForever(shaky); // moving background. Testing issue #244 var move = new CCMoveBy(3, new CCPoint(200, 0)); bgNode.RepeatForever(move, move.Reverse()); }
public static BigInteger Fib(BigInteger i, BigInteger acc) { Target2 <BigInteger> target = (recurse, i1, acc1) => { if (i1 == 0) { return(acc1); } if (i1 % 100000 == 0) { Console.WriteLine($"i:{i1},acc:{acc1}"); } return(recurse(i1 - 1, acc1 + i)); }; return(target.Call(i, acc)); }
// Use this for initialization void Awake() { ThisCamera = Camera.main.transform; ThisCamera.GetComponent <Camera>().fieldOfView = MaxFOV; TargetFOV = MaxFOV; MousePosLast = Input.mousePosition; Target1 = GameObject.CreatePrimitive(PrimitiveType.Cube).transform; Target2 = GameObject.CreatePrimitive(PrimitiveType.Cube).transform; //鍒涘缓鍙傝冪墿浣搝z Target1.position = Vector3.zero; Target2.position = Vector3.zero; Target1.GetComponent <Renderer>().enabled = false; Target2.GetComponent <Renderer>().enabled = false; Target1.GetComponent <Collider>().enabled = false; Target2.GetComponent <Collider>().enabled = false; Target2.parent = Target1; Target1.localEulerAngles = new Vector3(0, BaseLookAt, 0); Target2.localEulerAngles = new Vector3(BaseAngles, 0, 0); //鍒涘缓鎽勫奖鏈鸿繍鍔ㄧ粨鏋剒z Parent1 = GameObject.CreatePrimitive(PrimitiveType.Cube).transform; Parent2 = GameObject.CreatePrimitive(PrimitiveType.Cube).transform; Parent1.position = Vector3.zero; Parent2.position = Vector3.zero; Parent1.GetComponent <Renderer>().enabled = false; Parent2.GetComponent <Renderer>().enabled = false; Parent1.GetComponent <Collider>().enabled = false; Parent2.GetComponent <Collider>().enabled = false; Parent2.parent = Parent1; ThisCamera.parent = Parent2; //Parent1.localEulerAngles=new Vector3(0,BaseLookAt,0); Parent2.localEulerAngles = new Vector3(BaseAngles, 0, 0); ThisCamera.localPosition = new Vector3(0, 0, 0); ThisCamera.localEulerAngles = Vector3.zero; // Target1.position = BasePositton.position; Parent1.position = BasePositton.position; LastPosition = Vector3.zero; }
internal BulkTarget(TIdentifier identifier, TLocation location, TAge age, TGender gender, TDayTime dayTime, TDeviceOs deviceOs, TNegativeLocation negativeLocation, TRadius radius) : this(location, age, gender, dayTime, deviceOs, negativeLocation, radius) { Target = new Target2(); Target.Id = identifier.TargetId; EntityId = identifier.EntityId; EntityName = identifier.EntityName; ParentEntityName = identifier.ParentEntityName; if (identifier.IsDeleteRow) { _deleteAllRows.Add(identifier); } }
public void Serialize() { var resolver = new Utf8JsonFormatterResolver(); resolver.AddResolver(TestTypedFormatterResolver.Instance); var target1 = new Target1(); var target2 = new Target2(); var target3 = new Target3(); string data1 = JsonSerializer.ToJsonString <ITarget>(target1, resolver); string data2 = JsonSerializer.ToJsonString <ITarget>(target2, resolver); string data3 = JsonSerializer.ToJsonString <ITarget>(target3, resolver); Assert.AreEqual(m_target1Data, data1); Assert.AreEqual(m_target2Data, data2); Assert.AreEqual(m_target3Data, data3); Assert.Pass($"{data1}\n{data2}\n{data3}"); }
public static void Main(string[] args) { var adaptee = new Adaptee { Name = "FirstObject" }; var target1 = new Target1 { Name = "SecondObject" }; var target2 = new Target2 { Name = "ThirdObject" }; var adapter1 = new Adapter(adaptee); var adapter2 = new Adapter(target1); var adapter3 = new Adapter(target2); Console.WriteLine(adapter1.Request("Adapter 1")); Console.WriteLine(adapter2.Request("Adapter 2")); Console.WriteLine(adapter3.Request("Adapter 3")); }
void Shoot() { muzzleFlash.Play(); RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); Target target = hit.transform.GetComponent <Target>(); if (target != null) { target.TakeDamage(damage); } Target2 target2 = hit.transform.GetComponent <Target2>(); if (target2 != null) { target2.TakeDamage(damage); } } }
void Shoot() { GunAudio.Play(); RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { Debug.Log(hit.transform.name); Target target = hit.transform.GetComponent <Target>(); Target2 target2 = hit.transform.GetComponent <Target2>(); TargetSA target3 = hit.transform.GetComponent <TargetSA>(); if (target != null) { target.TakeDamage(damage); score += 1f; } if (target2 != null) { target2.TakeDamage(damage); score -= 2f; } if (target3 != null) { target3.TakeDamage(damage); score += 10f; } if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * impactForce); } GameObject impactGO = Instantiate(impactEffect, hit.point, Quaternion.LookRotation(hit.normal)); Destroy(impactGO, 2f); } }
public void Shoot() { currentAmmo -= 1; RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, currentGun.range)) { Target2 target2 = hit.transform.GetComponent <Target2>(); if (target2 != null) { target2.TakeDamage(currentGun.damage); Debug.Log("Hit " + hit.transform.gameObject.tag); } if (hit.rigidbody != null) { hit.rigidbody.AddForce(-hit.normal * currentGun.impactForce); } } }
void Shoot() { lightningBoltScript.Trigger(); AudioSource.PlayClipAtPoint(Electricity, transform.position); RaycastHit hit; if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range)) { //Debug.Log(hit.transform.name); Target target = hit.transform.GetComponent <Target>(); Target2 target2 = hit.transform.GetComponent <Target2>(); Target3 target3 = hit.transform.GetComponent <Target3>(); Target4 target4 = hit.transform.GetComponent <Target4>(); if (target != null) { target.TakeDamage(damage); GetComponent <AudioSource>().Play(); } if (target2 != null) { target2.TakeDamage(damage); GetComponent <AudioSource>().Play(); } if (target3 != null) { target3.TakeDamage(damage); GetComponent <AudioSource>().Play(); } if (target4 != null) { target4.TakeDamage(damage); GetComponent <AudioSource>().Play(); } } }
public Adapter(Target2 target2) { this.Request = delegate(string key) { return(String.Concat("Request: ", target2.Target2Method(key), Splitter, target2.Name)); }; }
public static T Call <T>(this Target2 <T> target, T arg1, T arg2) => target.ToTailCall()(arg1, arg2);
public int Foo(string a, object b, int c) { return((int)Target2.MethodCalled("Foo", new object[] { a, b, StaticField, StaticProp })); }
// Update is called once per frame void Update() { // Sound SoundManager.instance.ToggleSoundOnorOff(); ScoreValue.text = "Score: " + scoreAmount.ToString(); ROMLAmount.text = (ROMLSlider.value * 5.0f).ToString() + "°"; ROMRAmount.text = (ROMRSlider.value * 5.0f).ToString() + "°"; //RepsAmount.text = (int)(RepsSlider.value / 3) + " full reps + " + (RepsSlider.value % 3); RepsAmount.text = (int)(RepsSlider.value / 1) + " puck saves (i.e. reps)"; SetsAmount.text = SetsSlider.value.ToString(); RecoveryTimeAmount.text = RecoveryTimeSlider.value.ToString() + " seconds"; WeighingAmount.text = WeighingSlider.value.ToString(); // Save Slider values PlayerPrefs.SetFloat("ROMLSlider", ROMLSlider.value); PlayerPrefs.SetFloat("ROMRSlider", ROMRSlider.value); PlayerPrefs.SetFloat("RepsSlider", RepsSlider.value); PlayerPrefs.SetFloat("SetsSlider", SetsSlider.value); PlayerPrefs.SetFloat("RecoveryTimeSlider", RecoveryTimeSlider.value); PlayerPrefs.SetFloat("WeighingSlider", WeighingSlider.value); PlayerPrefs.SetFloat("MaxTimeToTargetSlider", MaxTimeToTargetSlider.value); if (SoundToggle.isOn == true) { PlayerPrefs.SetInt("SoundToggleValue", 1); } else { PlayerPrefs.SetInt("SoundToggleValue", 0); } if (MapToFullROM.isOn == true) { PlayerPrefs.SetInt("MapToFullROM", 1); } else { PlayerPrefs.SetInt("MapToFullROM", 0); } if (MaxTimeToTargetSlider.value < 20.0f) { MaxTimeToTargetAmount.fontSize = 16; MaxTimeToTargetAmount.text = MaxTimeToTargetSlider.value.ToString(); } else { MaxTimeToTargetAmount.fontSize = 24; MaxTimeToTargetAmount.text = "∞"; } // End panel appears if ((scoreAmount) >= RepsSlider.value && setAmount == (SetsSlider.value - 1)) { StopLoggingWorkoutTime(); SoundManager.instance.PlaySingle(GameControl.instance.buzzerAudio, 0.8f); EndPanel.SetActive(true); EndPanelText.text = "Congratulations!\nMatch practice ís complete for today!"; // Update statistics totalSaves = totalSaves + scoreAmount; goalsSavedEndText.text = totalSaves.ToString(); shotsOnGoalEndText.text = shotsOnGoal.ToString(); savePercentage = 100.0f * (float)totalSaves / (float)shotsOnGoal; savePercentageEndText.text = savePercentage.ToString("F0") + " %"; Target.SetActive(false); if (WeighingSlider.value == 2) { Target2.SetActive(false); } /* * if (PlayerPrefs.GetInt("2PuckShooter") == 1) * Target2.SetActive(false); */ scoreAmount = 0; setAmount = 0; } // Break panel appears if reps are max and it wasn't the last set if ((scoreAmount) >= RepsSlider.value && setAmount != SetsSlider.value) { StopLoggingWorkoutTime(); StartLoggingRestTime(); SoundManager.instance.PlaySingle(GameControl.instance.buzzerAudio, 0.8f); breakTimeAmount = RecoveryTimeSlider.value; setAmount++; BreakPanel.SetActive(true); Target.SetActive(false); if (WeighingSlider.value == 2) { Target2.SetActive(false); } /* * if (PlayerPrefs.GetInt("2PuckShooter") == 1) * Target2.SetActive(false); */ continued = false; StartCoroutine(BreakTimer()); scoreAmount = 0; } if (WeighingSlider.value == -1) { WeighingAmount.text = "Left arm ONLY"; } if (WeighingSlider.value == 1) { WeighingAmount.text = "Right arm ONLY"; } if (WeighingSlider.value == 0) { WeighingAmount.text = "Both arms (1 arm at a time)"; } if (WeighingSlider.value == 2) { WeighingAmount.text = "Both arms (at same time)"; /* * ROMRSlider.interactable = false; * ROMRAmount.text = ""; * * Color titlecolor = ROMRTitle.color; * titlecolor.a = 0.20f; * ROMRTitle.color = titlecolor; */ } //GameControl.instance.completedRepsLeft = scoreRight; // Note: Arms are mirrored //GameControl.instance.completedRepsRight = scoreLeft; }
public static Func <T, T, T> ToTailCall <T>( this Target2 <T> target) => ToTailCall <T, T, T>((recurse, arg1, arg2) => target((_arg1, _arg2) => recurse(_arg1, _arg2), arg1, arg2));
// Prints the specified Target2 object. private void PrintTarget2(Target2 target) { if (target == null) { return; } OutputStatusMessage(String.Format("Target2 Id: {0}", target.Id)); OutputStatusMessage(String.Format("Target2 Name: {0}\n", target.Name)); if (target.Age != null) { OutputStatusMessage("AgeTarget:"); foreach (var bid in target.Age.Bids) { OutputStatusMessage(String.Format("\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\tAge: {0}\n", bid.Age)); } } if (target.DayTime != null) { OutputStatusMessage("DayTimeTarget:"); foreach (var bid in target.DayTime.Bids) { OutputStatusMessage(String.Format("\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\tDay: {0}", bid.Day)); OutputStatusMessage(String.Format("\tFromHour: {0}", bid.FromHour)); OutputStatusMessage(String.Format("\tToHour: {0}", bid.ToHour)); OutputStatusMessage(String.Format("\tFromMinute: {0}", bid.FromMinute)); OutputStatusMessage(String.Format("\tToMinute: {0}\n", bid.ToMinute)); } } if (target.DeviceOS != null) { OutputStatusMessage("DeviceOSTarget:"); foreach (var bid in target.DeviceOS.Bids) { OutputStatusMessage(String.Format("\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\tDeviceName: {0}", bid.DeviceName)); } } if (target.Gender != null) { OutputStatusMessage("GenderTarget:"); foreach (var bid in target.Gender.Bids) { OutputStatusMessage(String.Format("\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\tGender: {0}\n", bid.Gender)); } } if (target.Location != null) { OutputStatusMessage("LocationTarget2:"); OutputStatusMessage(String.Format("\tIntentOption: {0}\n", target.Location.IntentOption)); if (target.Location.CityTarget != null) { OutputStatusMessage("\tCityTarget:"); foreach (var bid in target.Location.CityTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tCity: {0}\n", bid.City)); } } if (target.Location.CountryTarget != null) { OutputStatusMessage("\tCountryTarget:"); foreach (var bid in target.Location.CountryTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tCountryAndRegion: {0}", bid.CountryAndRegion)); OutputStatusMessage(String.Format("\t\tIsExcluded: {0}\n", bid.IsExcluded)); } } if (target.Location.MetroAreaTarget != null) { OutputStatusMessage("\tMetroAreaTarget:"); foreach (var bid in target.Location.MetroAreaTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tMetroArea: {0}", bid.MetroArea)); OutputStatusMessage(String.Format("\t\tIsExcluded: {0}\n", bid.IsExcluded)); } } if (target.Location.PostalCodeTarget != null) { OutputStatusMessage("\tPostalCodeTarget:"); foreach (var bid in target.Location.PostalCodeTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tPostalCode: {0}", bid.PostalCode)); OutputStatusMessage(String.Format("\t\tIsExcluded: {0}\n", bid.IsExcluded)); } } if (target.Location.RadiusTarget != null) { OutputStatusMessage("\tRadiusTarget2:"); foreach (var bid in target.Location.RadiusTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tLatitudeDegrees: {0}", bid.LatitudeDegrees)); OutputStatusMessage(String.Format("\t\tLongitudeDegrees: {0}", bid.LongitudeDegrees)); OutputStatusMessage(String.Format("\t\tRadius: {0} {1}\n", bid.Radius, bid.RadiusUnit)); } } if (target.Location.StateTarget != null) { OutputStatusMessage("\tStateTarget:"); foreach (var bid in target.Location.StateTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tState: {0}", bid.State)); OutputStatusMessage(String.Format("\t\tIsExcluded: {0}\n", bid.IsExcluded)); } } } }
public async override Task RunAsync(AuthorizationData authorizationData) { try { Service = new ServiceClient<ICampaignManagementService>(authorizationData); // Specify a campaign. var campaign = new Campaign { Name = "Women's Shoes" + DateTime.UtcNow, Description = "Red shoes line.", BudgetType = BudgetLimitType.MonthlyBudgetSpendUntilDepleted, MonthlyBudget = 1000.00, TimeZone = "PacificTimeUSCanadaTijuana", DaylightSaving = true }; // Specify an ad group. var adGroup = new AdGroup { Name = "Women's Red Shoe Sale", AdDistribution = AdDistribution.Search, BiddingModel = BiddingModel.Keyword, PricingModel = PricingModel.Cpc, StartDate = null, EndDate = new Date { Month = 12, Day = 31, Year = 2015 }, ExactMatchBid = new Bid { Amount = 0.09 }, PhraseMatchBid = new Bid { Amount = 0.07 }, Language = "English" }; // Add the campaign and ad group var campaignIds = (long[])await AddCampaignsAsync(authorizationData.AccountId, new[] { campaign }); var adGroupIds = (long[])await AddAdGroupsAsync(campaignIds[0], new[] { adGroup }); // Print the new assigned campaign and ad group identifiers PrintCampaignIdentifiers(campaignIds); PrintAdGroupIdentifiers(adGroupIds); // Bing Ads API Version 9 supports both Target and Target2 objects. You should use Target2. // This example compares Target and Target2, and demonstrates the impact of updating the // DayTimeTarget, IntentOption, and RadiusTarget2 nested in a Target2 object. var campaignTarget = new Target { Name = "My Campaign Target", DeviceOS = new DeviceOSTarget { Bids = new[] { new DeviceOSTargetBid { BidAdjustment = 10, DeviceName = "Smartphones", }, }, }, Day = new DayTarget { Bids = new[] { new DayTargetBid { BidAdjustment = 10, Day = Day.Friday } } }, Hour = new HourTarget { Bids = new[] { new HourTargetBid { BidAdjustment = 10, Hour = HourRange.ElevenAMToTwoPM } } }, Location = new LocationTarget { HasPhysicalIntent = true, MetroAreaTarget = new MetroAreaTarget { Bids = new List<MetroAreaTargetBid> { new MetroAreaTargetBid { BidAdjustment = 15, MetroArea = "Seattle-Tacoma, WA, WA US", IsExcluded = false } } }, RadiusTarget = new RadiusTarget { Bids = new[] { new RadiusTargetBid { BidAdjustment = 50, LatitudeDegrees = 47.755367, LongitudeDegrees = -122.091827, Radius = 5 } } } } }; var adGroupTarget = new Target { Name = "My Ad Group Target", Hour = new HourTarget { Bids = new[] { new HourTargetBid { BidAdjustment = 10, Hour = HourRange.SixPMToElevenPM } } } }; // Each customer has a target library that can be used to set up targeting for any campaign // or ad group within the specified customer. // Add a target to the library and associate it with the campaign. var campaignTargetId = (await AddTargetsToLibraryAsync(new[] { campaignTarget }))[0]; OutputStatusMessage(String.Format("Added Target Id: {0}\n", campaignTargetId)); SetTargetToCampaignAsync(campaignIds[0], campaignTargetId); OutputStatusMessage(String.Format("Associated CampaignId {0} with TargetId {1}.\n", campaignIds[0], campaignTargetId)); // Get and print the Target with the legacy GetTargetsByIds operation OutputStatusMessage("Get Campaign Target: \n"); var targets = await GetTargetsByIdsAsync(new[] { campaignTargetId }); PrintTarget(targets[0]); // Get and print the Target2 with the new GetTargetsByIds2 operation OutputStatusMessage("Get Campaign Target2: \n"); var targets2 = await GetTargetsByIds2Async(new[] { campaignTargetId }); PrintTarget2(targets2[0]); // Add a target to the library and associate it with the ad group. var adGroupTargetId = (await AddTargetsToLibraryAsync(new[] { adGroupTarget }))[0]; OutputStatusMessage(String.Format("Added Target Id: {0}\n", adGroupTargetId)); SetTargetToAdGroupAsync(adGroupIds[0], adGroupTargetId); OutputStatusMessage(String.Format("Associated AdGroupId {0} with TargetId {1}.\n", adGroupIds[0], adGroupTargetId)); // Get and print the Target with the legacy GetTargetsByIds operation OutputStatusMessage("Get AdGroup Target: \n"); targets = await GetTargetsByIdsAsync(new[] { adGroupTargetId }); PrintTarget(targets[0]); // Get and print the Target2 with the new GetTargetsByIds2 operation OutputStatusMessage("Get AdGroup Target2: \n"); targets2 = await GetTargetsByIds2Async(new[] { adGroupTargetId }); PrintTarget2(targets2[0]); // Update the ad group's target as a Target2 object with additional target types. // Existing target types such as DayTime, Location, and Radius must be specified // or they will not be included in the updated target. var target2 = new Target2 { Id = adGroupTargetId, Name = "My Target2", Age = new AgeTarget { Bids = new[] { new AgeTargetBid { BidAdjustment = 10, Age = AgeRange.EighteenToTwentyFive } } }, DayTime = new DayTimeTarget { Bids = new[] { new DayTimeTargetBid { BidAdjustment = 10, Day = Day.Friday, FromHour = 1, ToHour = 12, FromMinute = Minute.Zero, ToMinute = Minute.FortyFive } } }, DeviceOS = new DeviceOSTarget { Bids = new[] { new DeviceOSTargetBid { BidAdjustment = 20, DeviceName = "Tablets", }, }, }, Gender = new GenderTarget { Bids = new[] { new GenderTargetBid { BidAdjustment = 10, Gender = GenderType.Female } } }, Location = new LocationTarget2 { IntentOption = IntentOption.PeopleSearchingForOrViewingPages, CountryTarget = new CountryTarget { Bids = new[] { new CountryTargetBid { BidAdjustment = 10, CountryAndRegion = "US", IsExcluded = false } } }, MetroAreaTarget = new MetroAreaTarget { Bids = new List<MetroAreaTargetBid> { new MetroAreaTargetBid { BidAdjustment = 15, MetroArea = "Seattle-Tacoma, WA, WA US", IsExcluded = false } } }, PostalCodeTarget = new PostalCodeTarget { Bids = new[] { new PostalCodeTargetBid { // Bid adjustments are not allowed for location exclusions. // If IsExcluded is true, this element will be ignored. BidAdjustment = 10, PostalCode = "98052, WA US", IsExcluded = true } } }, RadiusTarget = new RadiusTarget2 { Bids = new[] { new RadiusTargetBid2 { BidAdjustment = 51, LatitudeDegrees = 47.755367, LongitudeDegrees = -122.091827, Radius = 11, //RadiusUnit = DistanceUnit.Kilometers } } } } }; // Update the same identified target as a Target2 object. // Going forward when getting the specified target Id, the Day and Hour elements of the legacy // Target object will be nil, since the target is being updated with a DayTime target. UpdateTargetsInLibrary2Async(new[] { target2 }); OutputStatusMessage("Updated the ad group level target as a Target2 object.\n"); // Get and print the Target with the legacy GetTargetsByIds operation OutputStatusMessage("Get Campaign Target: \n"); targets = await GetTargetsByIdsAsync(new[] { campaignTargetId }); PrintTarget(targets[0]); // Get and print the Target2 with the new GetTargetsByIds2 operation OutputStatusMessage("Get Campaign Target2: \n"); targets2 = await GetTargetsByIds2Async(new[] { campaignTargetId }); PrintTarget2(targets2[0]); // Get and print the Target with the legacy GetTargetsByIds operation OutputStatusMessage("Get AdGroup Target: \n"); targets = await GetTargetsByIdsAsync(new[] { adGroupTargetId }); PrintTarget(targets[0]); // Get and print the Target2 with the new GetTargetsByIds2 operation OutputStatusMessage("Get AdGroup Target2: \n"); targets2 = await GetTargetsByIds2Async(new[] { adGroupTargetId }); PrintTarget2(targets2[0]); // Get all new and existing targets in the customer library, whether or not they are // associated with campaigns or ad groups. var allTargetsInfo = await GetTargetsInfoFromLibraryAsync(); OutputStatusMessage("All target identifiers and names from the customer library: \n"); PrintTargetsInfo(allTargetsInfo); // Delete the campaign, ad group, and targets that were previously added. // DeleteCampaigns would remove the campaign and ad group, as well as the association // between ad groups and campaigns. To explicitly delete the association between an entity // and the target, use DeleteTargetFromCampaign and DeleteTargetFromAdGroup respectively. DeleteTargetFromCampaignAsync(campaignIds[0]); DeleteTargetFromAdGroupAsync(adGroupIds[0]); DeleteCampaignsAsync(authorizationData.AccountId, new[] { campaignIds[0] }); OutputStatusMessage(String.Format("Deleted CampaignId {0}\n", campaignIds[0])); // DeleteCampaigns deletes the association between the campaign and target, but does not // delete the target from the customer library. // Call the DeleteTargetsFromLibrary operation for each target that you want to delete. // You must specify an array with exactly one item. DeleteTargetsFromLibraryAsync(new[] { campaignTargetId }); OutputStatusMessage(String.Format("Deleted TargetId {0}\n", campaignTargetId)); DeleteTargetsFromLibraryAsync(new[] { adGroupTargetId }); OutputStatusMessage(String.Format("Deleted TargetId {0}\n", adGroupTargetId)); } // Catch authentication exceptions catch (OAuthTokenRequestException ex) { OutputStatusMessage(string.Format("Couldn't get OAuth tokens. Error: {0}. Description: {1}", ex.Details.Error, ex.Details.Description)); } // Catch Campaign Management service exceptions catch (FaultException<Microsoft.BingAds.CampaignManagement.AdApiFaultDetail> ex) { OutputStatusMessage(string.Join("; ", ex.Detail.Errors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); } catch (FaultException<Microsoft.BingAds.CampaignManagement.ApiFaultDetail> ex) { OutputStatusMessage(string.Join("; ", ex.Detail.OperationErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); OutputStatusMessage(string.Join("; ", ex.Detail.BatchErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); } catch (FaultException<Microsoft.BingAds.CampaignManagement.EditorialApiFaultDetail> ex) { OutputStatusMessage(string.Join("; ", ex.Detail.OperationErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); OutputStatusMessage(string.Join("; ", ex.Detail.BatchErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); } catch (Exception ex) { OutputStatusMessage(ex.Message); } }
/// <summary> /// Outputs the Target2. /// </summary> protected void OutputTarget2(Target2 target) { if (target != null) { OutputStatusMessage(string.Format("Target.Id: {0}", target.Id)); if (target.Age != null) { foreach (var bid in target.Age.Bids) { OutputAgeTargetBid(bid); } } if (target.DayTime != null) { foreach (var bid in target.DayTime.Bids) { OutputDayTimeTargetBid(bid); } } if (target.DeviceOS != null) { foreach (var bid in target.DeviceOS.Bids) { OutputDeviceOSTargetBid(bid); } } if (target.DeviceOS != null) { foreach (var bid in target.Gender.Bids) { OutputGenderTargetBid(bid); } } OutputStatusMessage("ForwardCompatibilityMap: "); if (target.ForwardCompatibilityMap != null) { foreach (var pair in target.ForwardCompatibilityMap) { OutputStatusMessage(string.Format("Key: {0}", pair.Key)); OutputStatusMessage(string.Format("Value: {0}", pair.Value)); } } OutputLocationTarget2(target.Location); } }
public async override Task RunAsync(AuthorizationData authorizationData) { try { Service = new ServiceClient <ICampaignManagementService>(authorizationData); // Specify a campaign. var campaign = new Campaign { Name = "Women's Shoes" + DateTime.UtcNow, Description = "Red shoes line.", BudgetType = BudgetLimitType.MonthlyBudgetSpendUntilDepleted, MonthlyBudget = 1000.00, TimeZone = "PacificTimeUSCanadaTijuana", DaylightSaving = true }; // Specify an ad group. var adGroup = new AdGroup { Name = "Women's Red Shoe Sale", AdDistribution = AdDistribution.Search, BiddingModel = BiddingModel.Keyword, PricingModel = PricingModel.Cpc, StartDate = null, EndDate = new Date { Month = 12, Day = 31, Year = 2015 }, ExactMatchBid = new Bid { Amount = 0.09 }, PhraseMatchBid = new Bid { Amount = 0.07 }, Language = "English" }; // Add the campaign and ad group var campaignIds = (long[]) await AddCampaignsAsync(authorizationData.AccountId, new[] { campaign }); var adGroupIds = (long[]) await AddAdGroupsAsync(campaignIds[0], new[] { adGroup }); // Print the new assigned campaign and ad group identifiers PrintCampaignIdentifiers(campaignIds); PrintAdGroupIdentifiers(adGroupIds); // Bing Ads API Version 9 supports both Target and Target2 objects. You should use Target2. // This example compares Target and Target2, and demonstrates the impact of updating the // DayTimeTarget, IntentOption, and RadiusTarget2 nested in a Target2 object. var campaignTarget = new Target { Name = "My Campaign Target", Day = new DayTarget { Bids = new[] { new DayTargetBid { BidAdjustment = 10, Day = Day.Friday } } }, Hour = new HourTarget { Bids = new[] { new HourTargetBid { BidAdjustment = 10, Hour = HourRange.ElevenAMToTwoPM } } }, Location = new LocationTarget { HasPhysicalIntent = true, MetroAreaTarget = new MetroAreaTarget { Bids = new List <MetroAreaTargetBid> { new MetroAreaTargetBid { BidAdjustment = 15, MetroArea = "Seattle-Tacoma, WA, WA US", IsExcluded = false } } }, RadiusTarget = new RadiusTarget { Bids = new[] { new RadiusTargetBid { BidAdjustment = 50, LatitudeDegrees = 47.755367, LongitudeDegrees = -122.091827, Radius = 5 } } } } }; var adGroupTarget = new Target { Name = "My Ad Group Target", Hour = new HourTarget { Bids = new[] { new HourTargetBid { BidAdjustment = 10, Hour = HourRange.SixPMToElevenPM } } } }; // Each customer has a target library that can be used to set up targeting for any campaign // or ad group within the specified customer. // Add a target to the library and associate it with the campaign. var campaignTargetId = (await AddTargetsToLibraryAsync(new[] { campaignTarget }))[0]; OutputStatusMessage(String.Format("Added Target Id: {0}\n", campaignTargetId)); SetTargetToCampaignAsync(campaignIds[0], campaignTargetId); OutputStatusMessage(String.Format("Associated CampaignId {0} with TargetId {1}.\n", campaignIds[0], campaignTargetId)); // Get and print the Target with the legacy GetTargetsByIds operation OutputStatusMessage("Get Campaign Target: \n"); var targets = await GetTargetsByIdsAsync(new[] { campaignTargetId }); PrintTarget(targets[0]); // Get and print the Target2 with the new GetTargetsByIds2 operation OutputStatusMessage("Get Campaign Target2: \n"); var targets2 = await GetTargetsByIds2Async(new[] { campaignTargetId }); PrintTarget2(targets2[0]); // Add a target to the library and associate it with the ad group. var adGroupTargetId = (await AddTargetsToLibraryAsync(new[] { adGroupTarget }))[0]; OutputStatusMessage(String.Format("Added Target Id: {0}\n", adGroupTargetId)); SetTargetToAdGroupAsync(adGroupIds[0], adGroupTargetId); OutputStatusMessage(String.Format("Associated AdGroupId {0} with TargetId {1}.\n", adGroupIds[0], adGroupTargetId)); // Get and print the Target with the legacy GetTargetsByIds operation OutputStatusMessage("Get AdGroup Target: \n"); targets = await GetTargetsByIdsAsync(new[] { adGroupTargetId }); PrintTarget(targets[0]); // Get and print the Target2 with the new GetTargetsByIds2 operation OutputStatusMessage("Get AdGroup Target2: \n"); targets2 = await GetTargetsByIds2Async(new[] { adGroupTargetId }); PrintTarget2(targets2[0]); // Update the ad group's target as a Target2 object with additional target types. // Existing target types such as DayTime, Location, and Radius must be specified // or they will not be included in the updated target. var target2 = new Target2 { Id = adGroupTargetId, Name = "My Target2", Age = new AgeTarget { Bids = new[] { new AgeTargetBid { BidAdjustment = 10, Age = AgeRange.EighteenToTwentyFive } } }, DayTime = new DayTimeTarget { Bids = new[] { new DayTimeTargetBid { BidAdjustment = 10, Day = Day.Friday, FromHour = 1, ToHour = 12, FromMinute = Minute.Zero, ToMinute = Minute.FortyFive } } }, DeviceOS = new DeviceOSTarget { Bids = new[] { new DeviceOSTargetBid { BidAdjustment = 20, DeviceName = "Tablets", } }, }, Gender = new GenderTarget { Bids = new[] { new GenderTargetBid { BidAdjustment = 10, Gender = GenderType.Female } } }, Location = new LocationTarget2 { IntentOption = IntentOption.PeopleSearchingForOrViewingPages, CountryTarget = new CountryTarget { Bids = new[] { new CountryTargetBid { BidAdjustment = 10, CountryAndRegion = "US", IsExcluded = false } } }, MetroAreaTarget = new MetroAreaTarget { Bids = new List <MetroAreaTargetBid> { new MetroAreaTargetBid { BidAdjustment = 15, MetroArea = "Seattle-Tacoma, WA, WA US", IsExcluded = false } } }, PostalCodeTarget = new PostalCodeTarget { Bids = new[] { new PostalCodeTargetBid { // Bid adjustments are not allowed for location exclusions. // If IsExcluded is true, this element will be ignored. BidAdjustment = 10, PostalCode = "98052, WA US", IsExcluded = true } } }, RadiusTarget = new RadiusTarget2 { Bids = new[] { new RadiusTargetBid2 { BidAdjustment = 50, LatitudeDegrees = 47.755367, LongitudeDegrees = -122.091827, Radius = 11, RadiusUnit = DistanceUnit.Kilometers } } } } }; // Update the same identified target as a Target2 object. // Going forward when getting the specified target Id, the Day and Hour elements of the legacy // Target object will be nil, since the target is being updated with a DayTime target. UpdateTargetsInLibrary2Async(new[] { target2 }); OutputStatusMessage("Updated the ad group level target as a Target2 object.\n"); // Get and print the Target with the legacy GetTargetsByIds operation OutputStatusMessage("Get Campaign Target: \n"); targets = await GetTargetsByIdsAsync(new[] { campaignTargetId }); PrintTarget(targets[0]); // Get and print the Target2 with the new GetTargetsByIds2 operation OutputStatusMessage("Get Campaign Target2: \n"); targets2 = await GetTargetsByIds2Async(new[] { campaignTargetId }); PrintTarget2(targets2[0]); // Get and print the Target with the legacy GetTargetsByIds operation OutputStatusMessage("Get AdGroup Target: \n"); targets = await GetTargetsByIdsAsync(new[] { adGroupTargetId }); PrintTarget(targets[0]); // Get and print the Target2 with the new GetTargetsByIds2 operation OutputStatusMessage("Get AdGroup Target2: \n"); targets2 = await GetTargetsByIds2Async(new[] { adGroupTargetId }); PrintTarget2(targets2[0]); // Get all new and existing targets in the customer library, whether or not they are // associated with campaigns or ad groups. var allTargetsInfo = await GetTargetsInfoFromLibraryAsync(); OutputStatusMessage("All target identifiers and names from the customer library: \n"); PrintTargetsInfo(allTargetsInfo); // Delete the campaign, ad group, and targets that were previously added. // DeleteCampaigns would remove the campaign and ad group, as well as the association // between ad groups and campaigns. To explicitly delete the association between an entity // and the target, use DeleteTargetFromCampaign and DeleteTargetFromAdGroup respectively. DeleteTargetFromCampaignAsync(campaignIds[0]); DeleteTargetFromAdGroupAsync(adGroupIds[0]); DeleteCampaignsAsync(authorizationData.AccountId, new[] { campaignIds[0] }); OutputStatusMessage(String.Format("Deleted CampaignId {0}\n", campaignIds[0])); // DeleteCampaigns deletes the association between the campaign and target, but does not // delete the target from the customer library. // Call the DeleteTargetsFromLibrary operation for each target that you want to delete. // You must specify an array with exactly one item. DeleteTargetsFromLibraryAsync(new[] { campaignTargetId }); OutputStatusMessage(String.Format("Deleted TargetId {0}\n", campaignTargetId)); DeleteTargetsFromLibraryAsync(new[] { adGroupTargetId }); OutputStatusMessage(String.Format("Deleted TargetId {0}\n", adGroupTargetId)); } // Catch authentication exceptions catch (OAuthTokenRequestException ex) { OutputStatusMessage(string.Format("Couldn't get OAuth tokens. Error: {0}. Description: {1}", ex.Details.Error, ex.Details.Description)); } // Catch Campaign Management service exceptions catch (FaultException <Microsoft.BingAds.CampaignManagement.AdApiFaultDetail> ex) { OutputStatusMessage(string.Join("; ", ex.Detail.Errors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); } catch (FaultException <Microsoft.BingAds.CampaignManagement.ApiFaultDetail> ex) { OutputStatusMessage(string.Join("; ", ex.Detail.OperationErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); OutputStatusMessage(string.Join("; ", ex.Detail.BatchErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); } catch (FaultException <Microsoft.BingAds.CampaignManagement.EditorialApiFaultDetail> ex) { OutputStatusMessage(string.Join("; ", ex.Detail.OperationErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); OutputStatusMessage(string.Join("; ", ex.Detail.BatchErrors.Select(error => string.Format("{0}: {1}", error.Code, error.Message)))); } catch (Exception ex) { OutputStatusMessage(ex.Message); } }
// Prints the specified Target2 object. private void PrintTarget2(Target2 target) { if (target == null) { return; } OutputStatusMessage(String.Format("Target2 Id: {0}", target.Id)); OutputStatusMessage(String.Format("Target2 Name: {0}\n", target.Name)); if (target.Age != null) { OutputStatusMessage("AgeTarget:"); foreach (var bid in target.Age.Bids) { OutputStatusMessage(String.Format("\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\tAge: {0}\n", bid.Age)); } } if (target.DayTime != null) { OutputStatusMessage("DayTimeTarget:"); foreach (var bid in target.DayTime.Bids) { OutputStatusMessage(String.Format("\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\tDay: {0}", bid.Day)); OutputStatusMessage(String.Format("\tFromHour: {0}", bid.FromHour)); OutputStatusMessage(String.Format("\tToHour: {0}", bid.ToHour)); OutputStatusMessage(String.Format("\tFromMinute: {0}", bid.FromMinute)); OutputStatusMessage(String.Format("\tToMinute: {0}\n", bid.ToMinute)); } } if (target.DeviceOS != null) { OutputStatusMessage("DeviceOSTarget:"); foreach (var bid in target.DeviceOS.Bids) { OutputStatusMessage(String.Format("\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\tDeviceName: {0}", bid.DeviceName)); } } if (target.Gender != null) { OutputStatusMessage("GenderTarget:"); foreach (var bid in target.Gender.Bids) { OutputStatusMessage(String.Format("\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\tGender: {0}\n", bid.Gender)); } } if (target.Location != null) { OutputStatusMessage("LocationTarget2:"); OutputStatusMessage(String.Format("\tIntentOption: {0}\n", target.Location.IntentOption)); if (target.Location.CityTarget != null) { OutputStatusMessage("\tCityTarget:"); foreach (var bid in target.Location.CityTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tCity: {0}\n", bid.City)); } } if (target.Location.CountryTarget != null) { OutputStatusMessage("\tCountryTarget:"); foreach (var bid in target.Location.CountryTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tCountryAndRegion: {0}", bid.CountryAndRegion)); OutputStatusMessage(String.Format("\t\tIsExcluded: {0}\n", bid.IsExcluded)); } } if (target.Location.MetroAreaTarget != null) { OutputStatusMessage("\tMetroAreaTarget:"); foreach (var bid in target.Location.MetroAreaTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tMetroArea: {0}", bid.MetroArea)); OutputStatusMessage(String.Format("\t\tIsExcluded: {0}\n", bid.IsExcluded)); } } if (target.Location.PostalCodeTarget != null) { OutputStatusMessage("\tPostalCodeTarget:"); foreach (var bid in target.Location.PostalCodeTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tPostalCode: {0}", bid.PostalCode)); OutputStatusMessage(String.Format("\t\tIsExcluded: {0}\n", bid.IsExcluded)); } } if (target.Location.RadiusTarget != null) { OutputStatusMessage("\tRadiusTarget2:"); foreach (var bid in target.Location.RadiusTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tLatitudeDegrees: {0}", bid.LatitudeDegrees)); OutputStatusMessage(String.Format("\t\tLongitudeDegrees: {0}", bid.LongitudeDegrees)); OutputStatusMessage(String.Format("\t\tRadius: {0} {1}\n", bid.Radius, bid.RadiusUnit)); } } if (target.Location.StateTarget != null) { OutputStatusMessage("\tStateTarget:"); foreach (var bid in target.Location.StateTarget.Bids) { OutputStatusMessage(String.Format("\t\tBidAdjustment: {0}", bid.BidAdjustment)); OutputStatusMessage(String.Format("\t\tState: {0}", bid.State)); OutputStatusMessage(String.Format("\t\tIsExcluded: {0}\n", bid.IsExcluded)); } } } }
public void Test() { Target2.Verify(t => t.Run(Client.Object), Times.Once()); }
public override void ReadDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; if (ele.TryPathTo("EditorID", false, out subEle)) { if (EditorID == null) { EditorID = new SimpleSubrecord <String>(); } EditorID.ReadXML(subEle, master); } if (ele.TryPathTo("Data", false, out subEle)) { if (Data == null) { Data = new PackageData(); } Data.ReadXML(subEle, master); } if (ele.TryPathTo("Location1", false, out subEle)) { if (Location1 == null) { Location1 = new PackageLocation(); } Location1.ReadXML(subEle, master); } if (ele.TryPathTo("Location2", false, out subEle)) { if (Location2 == null) { Location2 = new PackageLocation(); } Location2.ReadXML(subEle, master); } if (ele.TryPathTo("Schedule", false, out subEle)) { if (Schedule == null) { Schedule = new PackageScheduleData(); } Schedule.ReadXML(subEle, master); } if (ele.TryPathTo("Target1", false, out subEle)) { if (Target1 == null) { Target1 = new PackageTarget(); } Target1.ReadXML(subEle, master); } if (ele.TryPathTo("Conditions", false, out subEle)) { if (Conditions == null) { Conditions = new List <Condition>(); } foreach (XElement e in subEle.Elements()) { Condition tempCTDA = new Condition(); tempCTDA.ReadXML(e, master); Conditions.Add(tempCTDA); } } if (ele.TryPathTo("Idle/Flags", false, out subEle)) { if (IdleFlags == null) { IdleFlags = new SimpleSubrecord <PackageIdleFlags>(); } IdleFlags.ReadXML(subEle, master); } if (ele.TryPathTo("Idle/Count", false, out subEle)) { if (IdleCount == null) { IdleCount = new SimpleSubrecord <Byte>(); } IdleCount.ReadXML(subEle, master); } if (ele.TryPathTo("Idle/TimerSetting", false, out subEle)) { if (IdleTimerSetting == null) { IdleTimerSetting = new SimpleSubrecord <Single>(); } IdleTimerSetting.ReadXML(subEle, master); } if (ele.TryPathTo("Idle/Animations", false, out subEle)) { if (IdleAnimations == null) { IdleAnimations = new FormArray(); } IdleAnimations.ReadXML(subEle, master); } if (ele.TryPathTo("Unused", false, out subEle)) { if (Unused == null) { Unused = new SimpleSubrecord <Byte[]>(); } Unused.ReadXML(subEle, master); } if (ele.TryPathTo("CombatStyle", false, out subEle)) { if (CombatStyle == null) { CombatStyle = new RecordReference(); } CombatStyle.ReadXML(subEle, master); } if (ele.TryPathTo("EatMarker", false, out subEle)) { if (EatMarker == null) { EatMarker = new SubMarker(); } EatMarker.ReadXML(subEle, master); } if (ele.TryPathTo("EscortDistance", false, out subEle)) { if (EscortDistance == null) { EscortDistance = new SimpleSubrecord <UInt32>(); } EscortDistance.ReadXML(subEle, master); } if (ele.TryPathTo("FollowDistance_StartLocation_TriggerRadius", false, out subEle)) { if (FollowDistance_StartLocation_TriggerRadius == null) { FollowDistance_StartLocation_TriggerRadius = new SimpleSubrecord <UInt32>(); } FollowDistance_StartLocation_TriggerRadius.ReadXML(subEle, master); } if (ele.TryPathTo("PatrolIsRepeatable", false, out subEle)) { if (PatrolIsRepeatable == null) { PatrolIsRepeatable = new SimpleSubrecord <NoYesByte>(); } PatrolIsRepeatable.ReadXML(subEle, master); } if (ele.TryPathTo("UseWeaponData", false, out subEle)) { if (UseWeaponData == null) { UseWeaponData = new PackageUseWeaponData(); } UseWeaponData.ReadXML(subEle, master); } if (ele.TryPathTo("Target2", false, out subEle)) { if (Target2 == null) { Target2 = new PackageTarget(); } Target2.ReadXML(subEle, master); } if (ele.TryPathTo("UseItemMarker", false, out subEle)) { if (UseItemMarker == null) { UseItemMarker = new SubMarker(); } UseItemMarker.ReadXML(subEle, master); } if (ele.TryPathTo("AmbushMarker", false, out subEle)) { if (AmbushMarker == null) { AmbushMarker = new SubMarker(); } AmbushMarker.ReadXML(subEle, master); } if (ele.TryPathTo("DialogData", false, out subEle)) { if (DialogData == null) { DialogData = new PackageDialogData(); } DialogData.ReadXML(subEle, master); } if (ele.TryPathTo("DummyIgnore", false, out subEle)) { if (DummyIgnore == null) { DummyIgnore = new PackageLocation(); } DummyIgnore.ReadXML(subEle, master); } if (ele.TryPathTo("OnBegin", false, out subEle)) { if (OnBegin == null) { OnBegin = new PackageEvent(); } OnBegin.ReadXML(subEle, master); } if (ele.TryPathTo("OnEnd", false, out subEle)) { if (OnEnd == null) { OnEnd = new PackageEvent(); } OnEnd.ReadXML(subEle, master); } if (ele.TryPathTo("OnChange", false, out subEle)) { if (OnChange == null) { OnChange = new PackageEvent(); } OnChange.ReadXML(subEle, master); } }