protected override void afterLoadBody(string name, Body body, CustomProperties customProperties, XElement bodyData) { bool activatesObstacle = false; bool fallOnActivate = false; bool ignoreCeilingCollision = false; bool isDestructibleObstacle = false; int entityId = EntityFactory.afterLoadBody(name, body, customProperties, bodyData); customProperties.tryGetBool("activatesObstacle", out activatesObstacle); customProperties.tryGetBool("fallOnActivate", out fallOnActivate); customProperties.tryGetBool("ignoreCeilingCollision", out ignoreCeilingCollision); customProperties.tryGetBool("isDestructibleObstacle", out isDestructibleObstacle); // ActivatesObstacle components if (activatesObstacle) { _bodyThatSendsActivateObstacle = body; } // Fall on activate if (fallOnActivate) { _bodiesThatReceiveActivateObstacleFall.Add(body); } // Ignore ceiling collision if (ignoreCeilingCollision) { // TODO -- Do something tons of fun. } base.afterLoadBody(name, body, customProperties, bodyData); }
public void GetValue_can_get_string_value() { var propertyElement = XElement.Parse("<MyProperty>Lorem ipsum</MyProperty>"); var xmlEdit = new CustomProperties(_logger, TestServices.MockDataTypeService(), null, null, propertyElement); var propertyType = TestModels.CreatePropertyType("propertyAlias"); var value = xmlEdit.GetValue(propertyElement, propertyType); Assert.AreEqual(typeof(string), value.GetType()); Assert.AreEqual("Lorem ipsum", value.ToString()); }
public void GetValue_can_handle_invalid_integer_value() { var dataTypeInteger = TestModels.MockDataTypeDefinition(DataTypeDatabaseType.Integer); var propertyElement = XElement.Parse("<MyProperty>Try passing text</MyProperty>"); var xmlEdit = new CustomProperties(_logger, TestServices.MockDataTypeService(dataTypeInteger), null, null, propertyElement); var propertyType = TestModels.CreatePropertyType("propertyAlias", dataTypeInteger); var value = xmlEdit.GetValue(propertyElement, propertyType); Assert.IsNull(value); }
public void GetValue_can_get_integer_value() { var dataTypeInteger = TestModels.MockDataTypeDefinition(DataTypeDatabaseType.Integer); var propertyElement = XElement.Parse("<MyProperty>123</MyProperty>"); var xmlEdit = new CustomProperties(_logger, TestServices.MockDataTypeService(dataTypeInteger), null, null, propertyElement); var propertyType = TestModels.CreatePropertyType("propertyAlias", dataTypeInteger); var result = xmlEdit.GetValue(propertyElement, propertyType); Assert.AreEqual(typeof(int), result.GetType()); Assert.AreEqual(123, (int)result); }
private static bool IsExistsCustomProperty(CustomProperties properties, string customPropertyName) { bool flag = false; foreach (CustomProperty cp in properties) { if (cp.Name == customPropertyName) { return(true); } } return(flag); }
/// <summary> /// /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <param name="addToApsDict">If <b>true</b>, property will be added to the <i>aps</i> dictionary, otherwise to the root dictionary. Default: <b>false</b>.</param> /// <returns></returns> public ApplePush AddCustomProperty(string key, object value, bool addToApsDict = false) { if (addToApsDict) { CustomApsProperties ??= new Dictionary <string, object>(); CustomApsProperties.Add(key, value); } else { CustomProperties ??= new Dictionary <string, object>(); CustomProperties.Add(key, value); } return(this); }
/// <summary> /// Sets the value of the component to a different value. /// </summary> /// <param name="component">The component with the property value that is to be set.</param> /// <param name="value">The new value.</param> public override void SetValue(object component, object value) { // Validate new value ValidateValue(this._name, value); // Get new value as string string stringValue = GetStringFromValue(value); // "UserDefined" property expose comma separated user defined properties CustomProperties customAttr = component as CustomProperties; if (this._name == "UserDefined") { customAttr.SetUserDefinedAttributes(stringValue); } else { // Check if the new value is the same as DefaultValue bool setAttributeValue = true; if (IsDefaultValue(stringValue)) { // Remove custom properties with default values from data point // only when series do not have this attribute set. if (!(customAttr.DataPointCustomProperties is DataPoint) || !((DataPoint)customAttr.DataPointCustomProperties).series.IsCustomPropertySet(this._name)) { // Delete attribute if (customAttr.DataPointCustomProperties.IsCustomPropertySet(this._name)) { customAttr.DataPointCustomProperties.DeleteCustomProperty(this._name); setAttributeValue = false; } } } // Set custom attribute value if (setAttributeValue) { customAttr.DataPointCustomProperties[this._name] = stringValue; } } customAttr.DataPointCustomProperties.CustomProperties = customAttr.DataPointCustomProperties.CustomProperties; IChangeTracking changeTracking = component as IChangeTracking; if (changeTracking != null) { changeTracking.AcceptChanges(); } }
private void RunTest(FileStream file) { /* Read a Test document <em>doc</em> into a POI filesystem. */ POIFSFileSystem poifs = new POIFSFileSystem(file); DirectoryEntry dir = poifs.Root; DocumentEntry dsiEntry = null; try { dsiEntry = (DocumentEntry)dir.GetEntry(DocumentSummaryInformation.DEFAULT_STREAM_NAME); } catch (FileNotFoundException) { /* * A missing document summary information stream is not an error * and therefore silently ignored here. */ } /* * If there is a document summry information stream, Read it from * the POI filesystem, else Create a new one. */ DocumentSummaryInformation dsi; if (dsiEntry != null) { DocumentInputStream dis = new DocumentInputStream(dsiEntry); PropertySet ps = new PropertySet(dis); dsi = new DocumentSummaryInformation(ps); } else { dsi = PropertySetFactory.CreateDocumentSummaryInformation(); } CustomProperties cps = dsi.CustomProperties; if (cps == null) { /* The document does not have custom properties. */ return; } foreach (var de in cps) { CustomProperty cp = (CustomProperty)de.Value; Assert.IsNotNull(cp.Name); Assert.IsNotNull(cp.Value); } }
public void TestSetDate() { var key = "test"; CustomProperties properties = new CustomProperties(); Assert.AreEqual(0, properties.Properties.Count); /* Normal value. */ var normalValue = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc); properties.Set(key, normalValue); Assert.AreEqual(1, properties.Properties.Count); Assert.AreEqual(normalValue, properties.Properties[key]); }
public void TestSetBool() { var key = "test"; CustomProperties properties = new CustomProperties(); Assert.AreEqual(0, properties.Properties.Count); /* Normal value. */ var normalValue = false; properties.Set(key, normalValue); Assert.AreEqual(1, properties.Properties.Count); Assert.AreEqual(normalValue, properties.Properties[key]); }
public static async Task Start(string appSecret) { MobileCenter.Start(appSecret, typeof(Analytics), typeof(Crashes), typeof(Distribute), typeof(Push)); #if DEBUG await Distribute.SetEnabledAsync(false); #else await Distribute.SetEnabledAsync(true); #endif await Analytics.SetEnabledAsync(true); var customprops = new CustomProperties(); customprops.Set("username", "mahdi"); MobileCenter.SetCustomProperties(customprops); }
private bool UpdatePropertiesFromHashTable(CustomProperties customProperties, System.Collections.Hashtable customHashTable) { object hashKeyValue; bool entityChanged = false; foreach (string customItemKey in customHashTable.Keys) { hashKeyValue = customHashTable[customItemKey]; if (UpdateCustomProperty(customProperties, hashKeyValue, customItemKey)) { entityChanged = true; } } return(entityChanged); }
public CommonProject() : base(typeof(DearTarget)) { RootPath = ProjectRootPath; CustomProperties.Add("VcpkgEnabled", "false"); AddTargets(new DearTarget(Platform.win64, TargetAPI.D3D12 | TargetAPI.D3D11 | TargetAPI.Vulkan | TargetAPI.OpenGL3 | TargetAPI.WGPU, Optimization.Debug | Optimization.Release, BuildType.APIOnly | BuildType.DemoOnly | BuildType.Full)); }
protected void SetProperty(string key, string value) { var prop = new CustomProperties(); if (string.IsNullOrEmpty(value)) { prop.Clear(key); } else { prop.Set(key, value); } MobileCenter.SetCustomProperties(prop); }
private static dynamic GetWorksheetCusotmProperty(Worksheet ws, string name) { CustomProperties cps = ws.CustomProperties; dynamic result = null; foreach (dynamic item in cps) { if (string.Compare(item.Name, name, true) == 0) { result = item; break; } } return(result); }
internal static void SetWorksheetProperty(Worksheet ws, string propertyName, string propertyValue) { ExcelUIThreadProtecter.CheckIsExcelUIMainThread(); dynamic cp = GetWorksheetCusotmProperty(ws, propertyName); if (cp == null) { CustomProperties cps = ws.CustomProperties; cps.Add(propertyName, propertyValue); } else { cp.Value = propertyValue; } }
//********************************************************************** // Retrieves the value of a custom property //********************************************************************** public static string GetCustomProperty(CustomProperties properties, String name) { try { // Try to retrieve the Property object oName = (object)name; return properties.get_Item(ref oName).Value; } catch { // An exception is thrown if the Property is not found return null; } }
protected override void AddCustomPropertiesToInfoWindow() { CustomProperties.Add(new ShowableProperty { Name = "Vergiftungszeit", PropertyName = "poisontime", Hint = "Diese Zeit bleibt der Gegner vergiftet" }); CustomProperties.Add(new ShowableProperty { Name = "Giftschaden", PropertyName = "poisonamount", Hint = "Dieser Wert ist der Angriffswert des Giftes" }); CustomProperties.Add(new ShowableProperty { Name = "Gift-Intervall", PropertyName = "poisoncountertime", Hint = "Nach dieser Zeit (in Millisekunden)\ngreift das Gift den Gegner an" }); CustomProperties.Add(new ShowableProperty { Name = "Gesamtschaden", PropertyName = "damageoverall", Hint = "Das ist der Schaden, der dem\nGegner insgesamt zugeführt wird." }); }
protected SampleProject() : base(excludeSharpmakeFiles: false, generateXmlDoc: false) { // samples are special, all the classes are here instead of in the subfolders SourceRootPath = @"[project.SharpmakeCsPath]\[project.Name]"; SourceFilesExcludeRegex.Add( @"\\codebase\\", @"\\projects\\", @"\\reference\\" ); DependenciesCopyLocal = DependenciesCopyLocalTypes.None; CustomProperties.Add("CopyLocalLockFileAssemblies", "false"); }
public override string ToString() { StringBuilder __sb = new StringBuilder("THAnalyticsEvent("); bool __first = true; if (SuperProperties != null && __isset.superProperties) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("SuperProperties: "); __sb.Append(SuperProperties == null ? "<null>" : SuperProperties.ToString()); } if (CustomProperties != null && __isset.customProperties) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("CustomProperties: "); __sb.Append(CustomProperties.ToDebugString()); } if (__isset.deviceTime) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("DeviceTime: "); __sb.Append(DeviceTime); } if (Name != null && __isset.name) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Name: "); __sb.Append(Name); } __sb.Append(")"); return(__sb.ToString()); }
public void TestPropertiesCountValidate() { const int MaxPropertiesCount = 60; CustomProperties properties = new CustomProperties(); Assert.AreEqual(0, properties.Properties.Count); for (int i = 0; i < MaxPropertiesCount; i++) { properties.Set("t" + i, "test"); Assert.AreEqual(i + 1, properties.Properties.Count); } properties.Set("over1", "test"); Assert.AreEqual(MaxPropertiesCount, properties.Properties.Count); properties.Set("over2", "test"); Assert.AreEqual(MaxPropertiesCount, properties.Properties.Count); }
public IfCaseModel(IdeCollection <IdeBaseItem> source) : base(source) //new { _case = new CaseDefinition() { value = "" }; Property = (PropertyItemModel)CustomProperties.First(); BlockContainer = new BlockContainer(); BlockContainer.OnContainerChanged += (a, b) => { _case.linkList = BlockContainer.BuildTemplateBlockDef(b); }; Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); CanDragDrop = false; CanRemove = false; }
/// <summary> /// Updates and synchronizes this Room's Custom Properties. Optionally, expectedProperties can be provided as condition. /// </summary> /// <remarks> /// Custom Properties are a set of string keys and arbitrary values which is synchronized /// for the players in a Room. They are available when the client enters the room, as /// they are in the response of OpJoin and OpCreate. /// /// Custom Properties either relate to the (current) Room or a Player (in that Room). /// /// Both classes locally cache the current key/values and make them available as /// property: CustomProperties. This is provided only to read them. /// You must use the method SetCustomProperties to set/modify them. /// /// Any client can set any Custom Properties anytime. It's up to the game logic to organize /// how they are best used. /// /// You should call SetCustomProperties only with key/values that are new or changed. This reduces /// traffic and performance. /// /// Unless you define some expectedProperties, setting key/values is always permitted. /// In this case, the property-setting client will not receive the new values from the server but /// instead update its local cache in SetCustomProperties. /// /// If you define expectedProperties, the server will skip updates if the server property-cache /// does not contain all expectedProperties with the same values. /// In this case, the property-setting client will get an update from the server and update it's /// cached key/values at about the same time as everyone else. /// /// The benefit of using expectedProperties can be only one client successfully sets a key from /// one known value to another. /// As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally. /// When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their /// actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to /// take the item will have it (and the others fail to set the ownership). /// /// Properties get saved with the game state for Turnbased games (which use IsPersistent = true). /// </remarks> /// <param name="propertiesToSet">Hashtable of Custom Properties that changes.</param> /// <param name="expectedProperties">Provide some keys/values to use as condition for setting the new values.</param> public virtual void SetCustomProperties(Hashtable propertiesToSet, Hashtable expectedProperties = null) { var customProps = propertiesToSet.StripToStringKeys(); // merge (and delete null-values), unless we use CAS (expected props) if (expectedProperties == null || expectedProperties.Count == 0) { CustomProperties.Merge(customProps); CustomProperties.StripKeysWithNullValues(); } // send (sync) these new values if in room if (IsLocalClientInside) { LoadBalancingClient.peer.OpSetPropertiesOfRoom(customProps, false, expectedProperties); } }
public CustomProperty CreateCustomProperty() { if (base.CriGenerationPhase != CriGenerationPhases.Definition) { throw new RenderingObjectModelException(ProcessingErrorCode.rsInvalidOperation); } PrepareCustomProperties(); Microsoft.ReportingServices.ReportIntermediateFormat.DataValue dataValue = new Microsoft.ReportingServices.ReportIntermediateFormat.DataValue(); dataValue.Name = Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo.CreateEmptyExpression(); dataValue.Value = Microsoft.ReportingServices.ReportIntermediateFormat.ExpressionInfo.CreateEmptyExpression(); if (m_reportItemDef.CustomProperties == null) { m_reportItemDef.CustomProperties = new Microsoft.ReportingServices.ReportIntermediateFormat.DataValueList(); } m_reportItemDef.CustomProperties.Add(dataValue); return(CustomProperties.Add(base.RenderingContext, dataValue.Name, dataValue.Value)); }
public FunctionalTestProject() : base(excludeSharpmakeFiles: false, generateXmlDoc: false) { // same a samples, tests are special, the class is here instead of in the subfolder SourceRootPath = @"[project.SharpmakeCsPath]\[project.Name]"; SourceFilesExcludeRegex.Add( @"\\codebase\\", @"\\projects\\", @"\\reference\\" ); DependenciesCopyLocal = DependenciesCopyLocalTypes.None; CustomProperties.Add("CopyLocalLockFileAssemblies", "false"); AddTargets(Common.GetDefaultTargets()); }
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { string stringValue = value as string; if (stringValue != null && context != null && context.Instance != null) { // Create new custom attribute class with a reference to the DataPointCustomProperties if (context.Instance is DataPointCustomProperties) { ((DataPointCustomProperties)context.Instance).CustomProperties = stringValue; CustomProperties newAttributes = new CustomProperties(((DataPointCustomProperties)context.Instance)); return(newAttributes); } else if (context.Instance is CustomProperties) { CustomProperties newAttributes = new CustomProperties(((CustomProperties)context.Instance).DataPointCustomProperties); return(newAttributes); } else if (context.Instance is IDataPointCustomPropertiesProvider) { CustomProperties newAttributes = new CustomProperties(((IDataPointCustomPropertiesProvider)context.Instance).DataPointCustomProperties); return(newAttributes); } else if (context.Instance is Array) { DataPointCustomProperties attributes = null; foreach (object obj in ((Array)context.Instance)) { if (obj is DataPointCustomProperties) { attributes = (DataPointCustomProperties)obj; attributes.CustomProperties = stringValue; } } if (attributes != null) { CustomProperties newAttributes = new CustomProperties(attributes); return(newAttributes); } } } return(base.ConvertFrom(context, culture, value)); }
/// <summary> /// Updates and synchronizes this Player's Custom Properties. Optionally, expectedProperties can be provided as condition. /// </summary> /// <remarks> /// Custom Properties are a set of string keys and arbitrary values which is synchronized /// for the players in a Room. They are available when the client enters the room, as /// they are in the response of OpJoin and OpCreate. /// /// Custom Properties either relate to the (current) Room or a Player (in that Room). /// /// Both classes locally cache the current key/values and make them available as /// property: CustomProperties. This is provided only to read them. /// You must use the method SetCustomProperties to set/modify them. /// /// Any client can set any Custom Properties anytime. It's up to the game logic to organize /// how they are best used. /// /// You should call SetCustomProperties only with key/values that are new or changed. This reduces /// traffic and performance. /// /// Unless you define some expectedProperties, setting key/values is always permitted. /// In this case, the property-setting client will not receive the new values from the server but /// instead update its local cache in SetCustomProperties. /// /// If you define expectedProperties, the server will skip updates if the server property-cache /// does not contain all expectedProperties with the same values. /// In this case, the property-setting client will get an update from the server and update it's /// cached key/values at about the same time as everyone else. /// /// The benefit of using expectedProperties can be only one client successfully sets a key from /// one known value to another. /// As example: Store who owns an item in a Custom Property "ownedBy". It's 0 initally. /// When multiple players reach the item, they all attempt to change "ownedBy" from 0 to their /// actorNumber. If you use expectedProperties {"ownedBy", 0} as condition, the first player to /// take the item will have it (and the others fail to set the ownership). /// /// Properties get saved with the game state for Turnbased games (which use IsPersistent = true). /// </remarks> /// <param name="propertiesToSet">Hashtable of Custom Properties that changes.</param> /// <param name="expectedProperties">Provide some keys/values to use as condition for setting the new values.</param> public void SetCustomProperties(Hashtable propertiesToSet, Hashtable expectedProperties = null) { var customProps = propertiesToSet.StripToStringKeys(); // merge (and delete null-values), unless we use CAS (expected props) if (expectedProperties == null) { CustomProperties.Merge(customProps); CustomProperties.StripKeysWithNullValues(); } // send (sync) these new values if in room if (RoomReference != null && RoomReference.IsLocalClientInside) { LoadBalancingClient.peer.OpSetPropertiesOfActor(actorID, customProps, expectedProperties); } }
/// <summary> /// Initializes a new instance of the <see cref="DismPackageInfo"/> class. /// </summary> /// <param name="packageInfo">A <see cref="DismApi.DismPackageInfo_"/> struct containing data for this object.</param> internal DismPackageInfo(DismApi.DismPackageInfo_ packageInfo) { _packageInfo = packageInfo; // See if there are any custom properties if (_packageInfo.CustomPropertyCount > 0 && _packageInfo.CustomProperty != IntPtr.Zero) { // Add the items CustomProperties.AddRange <DismApi.DismCustomProperty_>(_packageInfo.CustomProperty, (int)_packageInfo.CustomPropertyCount, i => new DismCustomProperty(i)); } // See if there are any features associated with the package if (_packageInfo.FeatureCount > 0 && _packageInfo.Feature != IntPtr.Zero) { // Add the items Features.AddRange <DismApi.DismFeature_>(_packageInfo.Feature, (int)_packageInfo.FeatureCount, i => new DismFeature(i)); } }
/// <summary> /// Gets a custom property value either from the thread local or the static storage (in this particular order) /// </summary> /// <typeparam name="TProperty">Type of property</typeparam> /// <param name="key">Custom property key</param> /// <returns>The property value or null</returns> public TProperty Get <TProperty>(string key) { Guard.NotEmpty(key, nameof(key)); IDictionary <string, object> dict; if (TryGetCustomThreadProperties(false, out dict) && dict.TryGetValue(key, out var value)) { return((TProperty)value); } if (CustomProperties.TryGetValue(key, out value)) { return((TProperty)value); } return(default(TProperty)); }
public bool CustomPropertyRemove(string devId, string key) { bool result = false; for (int i = 0; i <= CustomProperties.Count - 1; i++) { if (CustomProperties[i].DeveloperId.Trim().ToLower() == devId.Trim().ToLower()) { if (CustomProperties[i].Key.Trim().ToLower() == key.Trim().ToLower()) { CustomProperties.Remove(CustomProperties[i]); result = true; break; } } } return(result); }
internal void CopyToItem(Item item) { item.autoReuse = AutoReuse.Value; item.consumable = Consumable.Value; item.potion = Potion.Value; item.shoot = Shoot.Value; item.createTile = Tile.Value; item.tileBoost = TileBoost.Value; item.buffType = BuffTypes[0].Value; item.buffTime = BuffTimes[0].Value; item.damage = Damage.Value; item.crit = Critical.Value; item.healLife = HealHP.Value; item.healMana = HealMP.Value; item.axe = AxePower.Value; item.pick = PickaxePower.Value; item.hammer = HammerPower.Value; item.stack = Stack.Value; item.maxStack = MaxStack.Value; item.useAnimation = UseAnimation.Value; item.useTime = UseTime.Value; item.shootSpeed = ShootSpeed.Value; item.knockBack = KnockBack.Value; item.accessory = Accessory.Value; item.defense = Defense.Value; item.melee = RMelee.Selected; item.magic = RMagic.Selected; item.ranged = RRanged.Selected; item.summon = RSummon.Selected; item.thrown = RThrown.Selected; item.fishingPole = FishingPower.Value; item.scale = Scale.Value; item.useStyle = UseStyle.Value; item.mana = CostMP.Value; CustomProperties cItem = item.GetGlobalItem <CustomProperties>(); for (int i = 1; i < BuffTypes.Length; i++) { int id = i - 1; cItem.BuffTypes[id] = BuffTypes[i].Value; cItem.BuffTimes[id] = BuffTimes[i].Value; } }
public SwitchBlockModel(IdeCollection <IdeBaseItem> source) : base(source) //new { var _conditonalDefinition = new ConditionalDefinition(); _wrapper = new LinkDefinition.LinkWrapper() { Conditional = _conditonalDefinition }; Items = new IdeCollection <IdeBaseItem>(this); Items.CollectionChanged += (a, b) => { BuildSwitchDefinitions(b); }; Property = (PropertyItemModel)CustomProperties.First(); Messenger.Default.Register <CustomPropertyChangedMessage>(this, action => CustomPropertyChanged(action)); AddCaseCommand = new RelayCommand(AddCase); AddDefaultCommand = new RelayCommand(AddDefault); }
public string CustomPropertiesToXml() { string result = string.Empty; try { StringWriter sw = new StringWriter(); XmlSerializer xs = new XmlSerializer(CustomProperties.GetType()); xs.Serialize(sw, CustomProperties); result = sw.ToString(); } catch (Exception ex) { EventLog.LogEvent(ex); result = string.Empty; } return(result); }
public async Task <bool> Login() { bool result = false; try { await BlobCache.Secure.Vacuum(); if (!string.IsNullOrEmpty(AuthenticationToken)) { var loginInfo = await BlobCache.Secure.GetLoginAsync(); var account = new Account { Username = loginInfo.UserName, Password = loginInfo.Password }; await Insert(account, true); Account = await GetCurrentAccount(account); User = await GetCurrentUser(); EventAggregator.GetEvent <UserAuthenticatedEvent>().Publish(); var moreInformation = new CustomProperties(); moreInformation.Set("Name", User.Name); moreInformation.Set("Email", Account.Email); AppCenter.SetUserId(Account.Username); AppCenter.SetCustomProperties(moreInformation); result = true; } } catch { result = false; } return(result); }
protected override void beforeLoadBodies(World world, CustomProperties customWorldProperties) { _offset = _level.moduleEndPointsCount == 0 ? _level.initialPosition : _level.getLastModuleEndPoint(); foreach (XElement bodyData in _worldData.Elements("body")) { string name = bodyData.Element("name").Value; if (name == "moduleAnchorA") { // Do nothing with this for now } else if (name == "moduleAnchorB") { _anchorBuffer = loadVector2(bodyData.Element("position")); } } base.beforeLoadBodies(world, customWorldProperties); }
public async Task RemoveRootProperty_CallsInterop(string name, string value) { // Arrange var jsInterop = new MockJSRuntime(); var jsResultValueTask = new ValueTask <string>(value); jsInterop.NextInvocationResult = jsResultValueTask; var sut = new CustomProperties(jsInterop); // Act var result = await sut.RemoveRootPropertyAsync(name); // Assert var(Identifier, Args) = jsInterop.Invocations.Single(); Assert.Equal($"{apiPrefix}.removeRootProperty", Identifier); Assert.Collection( Args, arg => Assert.Equal(name, arg)); Assert.Equal(result, value); }
public ItemProperties() { CustomProperties = new CustomProperties(); }
void convertCustomProperties( SerializableDictionary old, CustomProperties @new ) { old.ForEach( pair => @new.Add( pair.Key, new CustomProperty( pair.Value.name, pair.Value.value, pair.Value.type, pair.Value.description ) ) ) ; }
// afterLoadBody -- Called from terrain module loader public static int afterLoadBody(string name, Body body, CustomProperties customProperties, XElement bodyData) { bool activatesObstacle = false; bool ignoresRopeRaycast = false; bool ignoresBridgeRaycast = false; bool isDestructibleObstacle = false; bool isGround = false; bool isCeiling = false; bool isLevelEnd = false; int entityId = EntityManager.createEntity(); body.UserData = entityId; customProperties.tryGetBool("isGround", out isGround); customProperties.tryGetBool("isDestructibleObstacle", out isDestructibleObstacle); customProperties.tryGetBool("activatesObstacle", out activatesObstacle); customProperties.tryGetBool("ignoresRopeRaycast", out ignoresRopeRaycast); customProperties.tryGetBool("ignoresBridgeRaycast", out ignoresBridgeRaycast); customProperties.tryGetBool("isCeiling", out isCeiling); customProperties.tryGetBool("isLevelEnd", out isLevelEnd); EntityManager.addComponent(entityId, new PositionComponent(entityId, body)); // GroundBody component if (isGround) { body.CollisionCategories = (ushort)CollisionCategory.Terrain; EntityManager.addComponent(entityId, new GroundBodyComponent(entityId, body)); EntityManager.addComponent(entityId, createColorPrimitiveRenderComponent(entityId, body, new Color(130, 130, 130, 255))); } // Ceiling component if (isCeiling) { body.CollisionCategories = (ushort)CollisionCategory.Terrain; EntityManager.addComponent(entityId, new CeilingComponent(entityId, body)); EntityManager.addComponent(entityId, createColorPrimitiveRenderComponent(entityId, body, new Color(130, 130, 130, 255))); } // DestructibleObstacle (with Vitals) components if (isDestructibleObstacle) { EntityManager.addComponent(entityId, new DestructibleObstacleComponent(entityId, body, new List<Faction>(new [] { Faction.Enemy, Faction.Player }))); EntityManager.addComponent(entityId, new StatsComponent(entityId, 10, 10, 0, 0, 0, 100)); EntityManager.addComponent(entityId, new FactionComponent(entityId, Faction.Neutral, Faction.None)); EntityManager.addComponent(entityId, new AffectedBySpellEntitiesComponent(entityId)); EntityManager.addComponent(entityId, createColorPrimitiveRenderComponent(entityId, body, Color.Red)); } // IgnoresRopeRaycast and IgnoresBridgeRaycast components if (ignoresRopeRaycast) { EntityManager.addComponent(entityId, new IgnoreRopeRaycastComponent(entityId)); } if (ignoresBridgeRaycast) { EntityManager.addComponent(entityId, new IgnoreBridgeRaycastComponent(entityId)); } // Level end if (isLevelEnd) { body.CollidesWith = (ushort)CollisionCategory.Characters; body.OnCollision += new OnCollisionEventHandler(levelEndOnCollision); body.OnSeparation += new OnSeparationEventHandler(levelEndOnSeparation); } return entityId; }
public DictionaryPropertyDescriptor(CustomProperties customProperties, string key, Attribute[] attrs) : base(key, attrs) { _key = key; _customProperties = customProperties; }
protected override void afterLoadBody(string name, Body body, CustomProperties customProperties, XElement bodyData) { EntityFactory.afterLoadBody(name, body, customProperties, bodyData); base.afterLoadBody(name, body, customProperties, bodyData); }
//********************************************************************** // Sets the value of a custom property //********************************************************************** public static void SetCustomProperty(CustomProperties properties, String name, String value) { object oName = (object)name; try { // Try to retrieve and set the Property properties.get_Item(ref oName).Value = value; } catch { // An exception is found if the Property is not found properties.Add(name, value); } }
protected override void beforeLoadBodies(World world, CustomProperties customWorldProperties) { int moduleEndPointsCount = _map.moduleEndPointsCount; Vector2 size = _map.moduleEndPoints[moduleEndPointsCount - 1] - _map.moduleEndPoints[moduleEndPointsCount - 2]; Vector2 randomFactor = new Vector2(Helpers.randomBetween(_rng, 0f, 1f), Helpers.randomBetween(_rng, 0f, 1f)); bool attachToCeiling = false; _offset = _map.moduleEndPoints[_map.moduleEndPoints.Count - 2] + size * randomFactor; if (customWorldProperties.tryGetBool("attachToCeiling", out attachToCeiling) && attachToCeiling) { Vector2 point = Vector2.Zero; // Raycast for a ceiling using the random position world.RayCast( (f, p, n, fr) => { if (f.Body.UserData == null) { return -1; } if (EntityManager.getCeilingComponent((int)f.Body.UserData) != null) { _offset = p; return fr; } else { return -1; } }, _offset + new Vector2(0f, 1000f), _offset + new Vector2(0f, -1000f)); } base.beforeLoadBodies(world, customWorldProperties); }