public void SetCurrentFrameData(ref BackgroundData currentFrameData) { lock (m_lockObj) { var temp = currentFrameData; currentFrameData = m_frameBackgroundData; m_frameBackgroundData = temp; m_latest = true; } }
public BackgroundData GetBackgroundData() { BackgroundData background = null; if (sceneData != null && !string.IsNullOrEmpty(sceneData.backgroundName)) { background = sceneTable.GetBackground(sceneData.backgroundName); } return(background); }
public void updateTracker(BackgroundData trackerFrameData) { //this is an array in case you want to get the n closest bodies int closestBody = findClosestTrackedBody(trackerFrameData); // render the closest body Body skeleton = trackerFrameData.Bodies[closestBody]; renderSkeleton(skeleton, 0); }
public void GivenNoMapDataSet_WhenSelectingMapDataFromContextMenuCancelled_ThenNoObserversNotified() { // Given var mockRepository = new MockRepository(); var assessmentSectionObserver = mockRepository.StrictMock <IObserver>(); var backgroundDataObserver = mockRepository.StrictMock <IObserver>(); BackgroundData backgroundData = BackgroundDataConverter.ConvertTo(new WellKnownTileSourceMapData(WellKnownTileSource.BingHybrid)); using (new UseCustomSettingsHelper(new TestSettingsHelper { ApplicationLocalUserSettingsDirectory = TestHelper.GetTestDataPath(TestDataPath.Riskeer.Integration.Forms, "EmptyWmtsConnectionInfo") })) using (var treeViewControl = new TreeViewControl()) using (var plugin = new RiskeerPlugin()) { var viewCommands = mockRepository.Stub <IViewCommands>(); var mainWindow = mockRepository.Stub <IMainWindow>(); IGui gui = StubFactory.CreateGuiStub(mockRepository); gui.Stub(g => g.MainWindow).Return(mainWindow); gui.Stub(g => g.ViewCommands).Return(viewCommands); gui.Stub(cmp => cmp.Get(backgroundData, treeViewControl)).Return(new CustomItemsOnlyContextMenuBuilder()); mockRepository.ReplayAll(); var assessmentSection = new AssessmentSection(AssessmentSectionComposition.Dike); var assessmentSectionStateRootContext = new AssessmentSectionStateRootContext(assessmentSection); assessmentSection.Attach(assessmentSectionObserver); assessmentSection.BackgroundData.Attach(backgroundDataObserver); BackgroundData oldBackgroundData = assessmentSection.BackgroundData; DialogBoxHandler = (name, wnd) => { var tester = (BackgroundMapDataSelectionDialog) new FormTester(name).TheObject; tester.DialogResult = DialogResult.Cancel; tester.Close(); }; TreeNodeInfo info = GetInfo(plugin); plugin.Gui = gui; using (ContextMenuStrip contextMenuStrip = info.ContextMenuStrip(backgroundData, assessmentSectionStateRootContext, treeViewControl)) { // When contextMenuStrip.Items[selectContextMenuIndex].PerformClick(); // Then BackgroundDataTestHelper.AssertBackgroundData(oldBackgroundData, assessmentSection.BackgroundData); } } mockRepository.VerifyAll(); }
private static void ReadBackgroundData(this AssessmentSectionEntity entity, IAssessmentSection assessmentSection) { BackgroundData readBackgroundData = entity.BackgroundDataEntities.Single().Read(); BackgroundData backgroundData = assessmentSection.BackgroundData; backgroundData.IsVisible = readBackgroundData.IsVisible; backgroundData.Transparency = readBackgroundData.Transparency; backgroundData.Name = readBackgroundData.Name; backgroundData.Configuration = readBackgroundData.Configuration; }
public void ConvertFrom_BackgroundData_ReturnWmtsMapData(WmtsMapData mapData) { // Setup BackgroundData backgroundData = BackgroundDataConverter.ConvertTo(mapData); // Call ImageBasedMapData convertedMapData = BackgroundDataConverter.ConvertFrom(backgroundData); // Assert MapDataTestHelper.AssertImageBasedMapData(backgroundData, convertedMapData); }
private static void AssertBackgroundData(WellKnownTileSourceMapData mapData, BackgroundData backgroundData) { Assert.AreEqual(mapData.Name, backgroundData.Name); Assert.IsTrue(backgroundData.IsVisible); Assert.AreEqual(mapData.Transparency, backgroundData.Transparency); var configuration = (WellKnownBackgroundDataConfiguration)backgroundData.Configuration; var wellKnownTileSource = (RiskeerWellKnownTileSource)mapData.TileSource; Assert.AreEqual(wellKnownTileSource, configuration.WellKnownTileSource); }
public void ConvertFrom_BackgroundDataWithInvalidWellKnownTileSourceValue_ThrowsInvalidEnumArgumentException() { // Setup var backgroundData = new BackgroundData(new WellKnownBackgroundDataConfiguration((RiskeerWellKnownTileSource)999)); // Call TestDelegate call = () => BackgroundDataConverter.ConvertFrom(backgroundData); // Assert Assert.Throws <InvalidEnumArgumentException>(call); }
private static bool Add(BackgroundData data) { for (int i = 0; i < BackgroundMask.depthPositions.Count; i++) { if (BackgroundMask.depthPositions.list[i].owner == data.owner) { return(false); } } BackgroundMask.depthPositions.Push(data); return(true); }
public void Constructor_ValidBackgroundData_ExpectedValues() { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); // Call var properties = new BackgroundDataProperties(backgroundData); // Assert Assert.IsInstanceOf <ObjectProperties <BackgroundData> >(properties); Assert.AreSame(backgroundData, properties.Data); }
public bool GetCurrentFrameData(ref BackgroundData dataBuffer) { lock (m_lockObj) { var temp = dataBuffer; dataBuffer = m_frameBackgroundData; m_frameBackgroundData = temp; bool result = m_latest; m_latest = false; return(result); } }
private void LoadBackgroundData(SkinDatas skinData, BackgroundDataSpec spec) { if (spec == null) { return; } if (spec.name == null) { Debug.LogWarning($"BackgroundDataSpec without a name will be ignored. spec:\n{JsonConvert.SerializeObject(spec)}"); return; } if (skinData.BackgroundDatas.ContainsKey(spec.name)) { Debug.LogWarning($"BackgroundDataSpec with a duplicated name will be ignored. spec:\n{JsonConvert.SerializeObject(spec)}"); return; } string file = spec.file ?? spec.name; string path = Path.Combine(SkinFolderPath, "Playfield", "Background", file + ".jpg"); Sprite background = LoadNormalSprite(path, externalSkinDataObjects); if (background == null) { Debug.LogWarning($"Background not found, ignored the BackgroundDataSpec. spec:\n{JsonConvert.SerializeObject(spec)}"); return; } BackgroundData data = new BackgroundData(); data.background = new Labelled <Sprite> { value = background, label = path }; data.side = null; if (spec.side == "light") { data.side = Side.Light; } else if (spec.side == "conflict") { data.side = Side.Conflict; } data.theme = null; if (spec.theme != null) { if (skinData.ThemeDatas.ContainsKey(spec.theme)) { data.theme = spec.theme; } } skinData.BackgroundDatas.Add(spec.name, data); if (skinData.DefaultBackground == null) { skinData.DefaultBackground = spec.name; } }
private static void DoublecastWQ(Obj_AI_Base target) { if (MenuConfig.Doublecast && Spells.Q.IsReady() && Qstack != 2) { BackgroundData.CastW(target); BackgroundData.DoubleCastQ(target); } else { BackgroundData.CastW(target); } }
public void Create_BackgroundDataContainsConfiguredWMTSConfiguration_ReturnsBackgroundDataEntity() { // Setup const string name = "background"; const string sourceCapabilitiesUrl = "//url"; const string selectedCapabilityName = "selectedName"; const string preferredFormat = "image/png"; const bool isVisible = true; const bool isConfigured = true; var transparancy = (RoundedDouble)0.3; var configuration = new WmtsBackgroundDataConfiguration(isConfigured, sourceCapabilitiesUrl, selectedCapabilityName, preferredFormat); var backgroundData = new BackgroundData(configuration) { IsVisible = isVisible, Transparency = transparancy, Name = name }; // Call BackgroundDataEntity entity = backgroundData.Create(); // Assert Assert.AreEqual(name, entity.Name); Assert.AreEqual(Convert.ToByte(isVisible), entity.IsVisible); Assert.AreEqual(transparancy, entity.Transparency); var expectedKeyValuePairs = new Dictionary <string, string> { { BackgroundDataIdentifiers.IsConfigured, Convert.ToByte(isConfigured).ToString() }, { BackgroundDataIdentifiers.SourceCapabilitiesUrl, sourceCapabilitiesUrl }, { BackgroundDataIdentifiers.SelectedCapabilityIdentifier, selectedCapabilityName }, { BackgroundDataIdentifiers.PreferredFormat, preferredFormat } }; IEnumerable <KeyValuePair <string, string> > actualKeyValuePairs = entity.BackgroundDataMetaEntities.Select( metaEntity => new KeyValuePair <string, string>(metaEntity.Key, metaEntity.Value)); CollectionAssert.AreEquivalent(expectedKeyValuePairs, actualKeyValuePairs); }
public void Transparency_ValidValues_ReturnNewlySetValue(double newValue) { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); int originalNumberOfDecimals = backgroundData.Transparency.NumberOfDecimalPlaces; // Call backgroundData.Transparency = (RoundedDouble)newValue; // Assert Assert.AreEqual(newValue, backgroundData.Transparency.Value); Assert.AreEqual(originalNumberOfDecimals, backgroundData.Transparency.NumberOfDecimalPlaces); }
public static bool isDetectWall;//initial from sdk private void Start() { background = new BackgroundData(this.gameObject); Initialposition = Wall_Ratio.GetRatio.position; InitialSize = Wall_Ratio.Size; isDetectWall = false; isValidArea = false; #if UNITY_EDITOR Wall_Ratio.GetRatio.position = Vector3.forward * 3; isDetectWall = true; #endif }
public void ConvertFrom_BackgroundData_ReturnWellKnownMapData() { // Setup var random = new Random(21); var wellKnownTileSource = random.NextEnumValue <WellKnownTileSource>(); BackgroundData backgroundData = BackgroundDataConverter.ConvertTo(new WellKnownTileSourceMapData(wellKnownTileSource)); // Call ImageBasedMapData convertedMapData = BackgroundDataConverter.ConvertFrom(backgroundData); // Assert MapDataTestHelper.AssertImageBasedMapData(backgroundData, convertedMapData); }
private static void AssertBackgroundData(WmtsMapData mapData, BackgroundData backgroundData) { Assert.AreEqual(mapData.Name, backgroundData.Name); Assert.IsTrue(backgroundData.IsVisible); Assert.AreEqual(mapData.Transparency, backgroundData.Transparency); var configuration = (WmtsBackgroundDataConfiguration)backgroundData.Configuration; Assert.AreEqual(mapData.IsConfigured, configuration.IsConfigured); Assert.AreEqual(mapData.SourceCapabilitiesUrl, configuration.SourceCapabilitiesUrl); Assert.AreEqual(mapData.SelectedCapabilityIdentifier, configuration.SelectedCapabilityIdentifier); Assert.AreEqual(mapData.PreferredFormat, configuration.PreferredFormat); }
//backup data for undo // Use this for initialization void Start() { gamelength = 50; turn = 0; //initializing default game variable values data = new BackgroundData(10000, Random.Range(60, 80), 10000, 3); AverageTemperature = data.Temperature; //lake data.WaterSources[0] = new WaterSource("Lake", 100000, 5000, 1, 1); //aquifer data.WaterSources[1] = new WaterSource("Aquifer", 100000, 5000, 1, 1); //shipments data.WaterSources[2] = new WaterSource("Shipment", 0, 0, 1, 10); //set initial water towers data.CalculateWaterDistributionRate(); //Set Initial Rain Interval and TurnCount RainTurnCount = Random.Range(2, 4); RainInterval = Random.Range(3, 5); AverageRainInterval = RainInterval; //reseting event icons/text WinText.SetActive(false); // Rain.enabled = false; Drought.SetActive(false); Monsoon.SetActive(false); MigrationIn.SetActive(false); MigrationOut.SetActive(false); WarmFront.SetActive(false); ColdFront.SetActive(false); LoseText.SetActive(false); LoseCounterText.text = "Lives: 10"; //buttons Endturn.onClick.AddListener(EndturnListener); LakeReserve.maxValue = data.WaterSources[0].GetReserve(); AquiferReserve.maxValue = data.WaterSources[1].GetReserve(); ShipmentReserve.maxValue = 50000; City.SetLakeMax(100000); City.SetLakeCurrent(LakeReserve.maxValue); WTInvestment.onClick.AddListener(delegate { SetCurrentInvestment(0); }); LKInvestment.onClick.AddListener(delegate { SetCurrentInvestment(1); }); AQInvestment.onClick.AddListener(delegate { SetCurrentInvestment(2); }); Invest1000.onClick.AddListener(delegate { InvestInCurrent(1000); }); Invest2000.onClick.AddListener(delegate { InvestInCurrent(2000); }); Invest5000.onClick.AddListener(delegate { InvestInCurrent(5000); }); WaterShipment.onClick.AddListener(delegate { SetCurrentInvestment(3); }); }
/// <summary> /// Converts <see cref="BackgroundData"/> to <see cref="ImageBasedMapData"/>. /// </summary> /// <param name="backgroundData">The <see cref="BackgroundData"/> to convert.</param> /// <returns>The converted <see cref="ImageBasedMapData"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="backgroundData"/> /// is <c>null</c>.</exception> /// <exception cref="InvalidEnumArgumentException">Thrown when /// <see cref="WellKnownBackgroundDataConfiguration.WellKnownTileSource"/> contains an /// invalid value for <see cref="WellKnownTileSource"/>.</exception> /// <exception cref="NotSupportedException">Thrown when <see cref="BackgroundData.Configuration"/> /// doesn't is of a type that can be converted.</exception> public static ImageBasedMapData ConvertFrom(BackgroundData backgroundData) { if (backgroundData == null) { throw new ArgumentNullException(nameof(backgroundData)); } ImageBasedMapData mapData = CreateMapData(backgroundData); mapData.IsVisible = backgroundData.IsVisible; mapData.Transparency = backgroundData.Transparency; return(mapData); }
public void SetAllData_MapDataCollectionNull_ThrowsArgumentNullException() { // Setup var riskeerMapControl = new RiskeerMapControl(); var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); // Call TestDelegate test = () => riskeerMapControl.SetAllData(null, backgroundData); // Assert string paramName = Assert.Throws <ArgumentNullException>(test).ParamName; Assert.AreEqual("data", paramName); }
int findIndexFromId(BackgroundData frameData, int id) { int retIndex = -1; for (int i = 0; i < (int)frameData.NumOfBodies; i++) { if ((int)frameData.Bodies[i].Id == id) { retIndex = i; break; } } return(retIndex); }
public void ConvertFrom_ConfigurationTypeNotSupportedForConversion_ThrowNotSupportedException() { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); // Call TestDelegate test = () => BackgroundDataConverter.ConvertFrom(backgroundData); // Assert var exception = Assert.Throws <NotSupportedException>(test); string expectedMessage = $"Can't create a image based map data for {typeof(TestBackgroundDataConfiguration)}."; Assert.AreEqual(expectedMessage, exception.Message); }
public void Transparency_SetInvalidValue_ThrowArgumentOutOfRangeException(double invalidTransparency) { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); // Call TestDelegate call = () => backgroundData.Transparency = (RoundedDouble)invalidTransparency; // Assert const string message = "De transparantie moet in het bereik [0,00, 1,00] liggen."; string paramName = TestHelper.AssertThrowsArgumentExceptionAndTestMessage <ArgumentOutOfRangeException>(call, message).ParamName; Assert.AreEqual("value", paramName); }
private string randomReward(out int val) { // Roll chance for type of reward first float[] reward_type = { coin_chance, ball_skin_chance, ball_trail_chance }; int reward_output = chanceRoll(reward_type); if (reward_output == 0) { // Coin Reward int coin_reward = chanceRoll(coin_reward_chance); val = coin_reward_values[coin_reward]; return("coin"); } else { BackgroundData bg_data = GameObject.Find("BackgroundDataCenter").GetComponent <BackgroundData>(); if (reward_output == 1) { // Ball Skin Reward float[] skin_chance = { common_chance, rare_chance, epic_chance, legendary_chance }; int skin_reward = chanceRoll(skin_chance); string[] skin_type = { "common", "rare", "epic", "legendary" }; Dictionary <string, ArrayList> ball_categories = bg_data.getCollectables()["ball_skins"]; val = (int)Random.Range(0, (ball_categories[skin_type[skin_reward]].Count - 0.01f)); return("ball_skin"); } /* * else if (reward_output == 2) * { * // Ball Trail Reward * Debug.Log("TODO: Ball Trail"); * } */ else { Debug.Log("Reward Output out of range of index"); } } // TODO - remove val = -1; return("null"); }
public void Constructor_ExpectedValues() { // Setup var configuration = new TestBackgroundDataConfiguration(); // Call var backgroundData = new BackgroundData(configuration); // Assert Assert.IsNull(backgroundData.Name); Assert.IsTrue(backgroundData.IsVisible); Assert.AreEqual(2, backgroundData.Transparency.NumberOfDecimalPlaces); Assert.AreEqual(0.60, backgroundData.Transparency.Value); Assert.AreSame(configuration, backgroundData.Configuration); }
public static void Update(EventArgs args) { if (Player.IsDead) { return; } if (Utils.GameTimeTickCount - LastQ >= 3650 - Game.Ping && MenuConfig.KeepQ && !Player.InFountain() && !Player.HasBuff("Recall") && Player.HasBuff("RivenTriCleave")) { Spells.Q.Cast(Game.CursorPos); } QMove(); BackgroundData.ForceSkill(); switch (Orbwalker.ActiveMode) { case Orbwalking.OrbwalkingMode.Combo: Combos.Combo(); break; case Orbwalking.OrbwalkingMode.Burst: Combos.Burst(); break; case Orbwalking.OrbwalkingMode.Flee: FleeMode.Flee(); break; case Orbwalking.OrbwalkingMode.QuickHarass: FastHarassMode.FastHarass(); break; case Orbwalking.OrbwalkingMode.Mixed: Mixed.Harass(); break; case Orbwalking.OrbwalkingMode.LaneClear: JungleClearMode.Jungleclear(); LaneclearMode.Laneclear(); break; } }
public void ForeColor_ArbitraryBackgroundDataConfiguration_ReturnControlText() { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call Color image = info.ForeColor(backgroundData); // Assert Assert.AreEqual(Color.FromKnownColor(KnownColor.ControlText), image); } }
private static void AddEntitiesForBackgroundDataMeta(BackgroundData backgroundData, BackgroundDataEntity entity) { var wmtsBackgroundDataConfiguration = backgroundData.Configuration as WmtsBackgroundDataConfiguration; var wellKnownBackgroundDataConfiguration = backgroundData.Configuration as WellKnownBackgroundDataConfiguration; if (wmtsBackgroundDataConfiguration != null) { entity.BackgroundDataType = Convert.ToByte(BackgroundDataType.Wmts); AddWmtsMetaEntities(wmtsBackgroundDataConfiguration, entity); } else if (wellKnownBackgroundDataConfiguration != null) { entity.BackgroundDataType = Convert.ToByte(BackgroundDataType.WellKnown); AddWellKnownTileSourceMetaEntities(wellKnownBackgroundDataConfiguration, entity); } }
public void Text_Always_ReturnsName() { // Setup var backgroundData = new BackgroundData(new TestBackgroundDataConfiguration()); using (var plugin = new RiskeerPlugin()) { TreeNodeInfo info = GetInfo(plugin); // Call string text = info.Text(backgroundData); // Assert Assert.AreEqual("Achtergrondkaart", text); } }
public void addToQueue(BackgroundData bgData) { queueList.Add(bgData); }