public bool ApplyEffect(Skill effect) { DroneSkill skill = effect as DroneSkill; if (skill == null) { return(false); } switch (skill.applyTo) { case DroneSkill.ApplyTo.InteractSpeed: InteractSpeed += skill.value; return(true); case DroneSkill.ApplyTo.MovementSpeed: agent.speed += skill.value.Result(); return(true); case DroneSkill.ApplyTo.HarvestAmountBoost: return(true); default: break; } return(false); }
public ClickIos(Click click) { this.customValue = click.getCustomValue(); this.productIos = new ProductIos(click.getProduct()); this.clickType = click.getClickType(); this.clickData = click.getClickData(); }
public void SaveCustomFieldText(int refID, int fieldID, string value) { CustomValue customValue = CustomValues.GetValue(UserSession.LoginUser, fieldID, refID); customValue.Value = value; customValue.Collection.Save(); }
private void RecoverTicketCustomValues(int orgID, int badTicketID, int goodTicketID) { CustomValues badCustomValues = new CustomValues(GetCorrupteLoginUser()); badCustomValues.LoadByReferenceTypeModifiedAfterRecovery(orgID, ReferenceType.Tickets, badTicketID); foreach (CustomValue badCustomValue in badCustomValues) { try { if (badCustomValue == null) { continue; } CustomValue goodCustomValue = CustomValues.GetValue(GetReviewLoginUser(), goodTicketID, badCustomValue.ApiFieldName); if (goodCustomValue != null) { goodCustomValue.Value = badCustomValue.Value; goodCustomValue.Collection.Save(); } } catch (Exception ex) { _exceptionOcurred = true; ExceptionLogs.LogException(GetCorrupteLoginUser(), ex, "recover"); } } }
private void EnumerableTest() { ValueList <CustomValue> a = new ValueList <CustomValue>(); a.Add(new CustomValue() { B = true, F = 2.1f, I = 3 }); a.Add(new CustomValue() { B = false, F = 2.2f, I = 2 }); a.Add(new CustomValue() { B = true, F = 2.3f, I = 1 }); IRefEnumerator <CustomValue> e = a.GetEnumerator(); CustomValue v = default(CustomValue); e.Reset(); while (e.MoveNext(ref v)) { Debug.Log(v.ToString()); } e.Dispose(); e = null; }
/// <summary> /// Applies Effect on that is not accounted for /// </summary> /// <returns> If it suceeded </returns> public override bool ApplyEffects(Skill effect) { if (base.ApplyEffects(effect)) { return(true); } WeaponSkill skill = effect as WeaponSkill; if (skill == null) { return(false); } switch (skill.applyTo) { case WeaponSkill.ApplyTo.BulletSpeed: bulletSpeed += effect.Effect(); return(true); default: break; } return(false); }
public virtual bool ApplyEffects(Skill effect) { AttackSkill skill = effect as AttackSkill; if (skill == null) { return(false); } switch (skill.applyTo) { case AttackSkill.ApplyTo.Attack: attackDamage += effect.Effect(); return(true); case AttackSkill.ApplyTo.Speed: attackSpeed *= effect.Effect(); if (attackSpeed.Multiplier < 0.5f) { attackSpeed.Multiplier = 0.5f; } return(true); default: break; } return(false); }
public void SaveCustomFieldDate(int refID, int fieldID, DateTime?value) { DateTime?date; try { if (value == null) { date = null; } else { date = Convert.ToDateTime(value); } } catch (Exception) { date = null; } CustomValue customValue = CustomValues.GetValue(UserSession.LoginUser, fieldID, refID); if (date != null) { customValue.Value = DataUtils.DateToUtc(UserSession.LoginUser, date).ToString(); } else { customValue.Value = ""; } customValue.Collection.Save(); }
public CustomValueProxy SaveCustomValue(int customFieldID, int refID, object value) { CustomValue customValue = CustomValues.GetValue(TSAuthentication.GetLoginUser(), customFieldID, refID); if (value == null) { customValue.Value = ""; customValue.Collection.Save(); return(null); } switch (customValue.FieldType) { case CustomFieldType.DateTime: customValue.Value = ((DateTime)value).ToString(); break; case CustomFieldType.Date: customValue.Value = ((DateTime)value).ToShortDateString(); break; default: customValue.Value = DataUtils.CleanValueScript(value.ToString()); break; } customValue.Collection.Save(); return(customValue.GetProxy()); }
public void SaveCustomFieldBool(int refID, int fieldID, bool value) { CustomValue customValue = CustomValues.GetValue(UserSession.LoginUser, fieldID, refID); customValue.Value = value.ToString(); customValue.Collection.Save(); }
public string CreatePickListControl(CustomField field, bool isEditable = false, int organizationID = -1) { StringBuilder html = new StringBuilder(); string[] items = field.ListValues.Split('|'); if (isEditable) { CustomValue value = CustomValues.GetValue(TSAuthentication.GetLoginUser(), field.CustomFieldID, organizationID); html.AppendFormat(@"<div class='form-group'> <label for='{0}' class='col-xs-4 control-label'>{1}</label> <div class='col-xs-8'> <p class='form-control-static'><a class='editable' id='{0}' data-type='select'>{2}</a></p> </div> </div>", field.CustomFieldID, field.Name, value.Value); } else { html.AppendFormat("<div class='col-xs-8'><select class='form-control customField' id='{0}' name='{0}' type='picklist'>", field.CustomFieldID); foreach (string item in items) { html.AppendFormat("<option value='{0}'>{1}</option>", item, item); } html.Append("</select></div>"); } return(html.ToString()); }
public When_created_based_on_custom_value_type() { source = new CustomValue { Id = 123 }; dynamicObject = new DynamicObject(source); }
public CustomField CreateElement(ElementModel model) { List <CustomValue> options = new List <CustomValue>(); foreach (var picklist in model.PickListValues) { CustomValue option = new CustomValue(); option.label = picklist.Text; option.fullName = picklist.Value; option.@default = picklist.IsDefault; options.Add(option); } ValueSet value = new ValueSet(); value.valueSetDefinition = new ValueSetValuesDefinition() { sorted = true, value = options.ToArray() }; CustomField field = new CustomField(); field.fullName = model.FullName; field.label = model.Label; field.type = FieldType.Picklist; field.valueSet = value; field.typeSpecified = true; field.securityClassification = SecurityClassification.DataIntendedToBePublic; field.securityClassificationSpecified = true; return(field); }
public string CreateTextControl(CustomField field, bool isEditable = false, int organizationID = -1) { StringBuilder html = new StringBuilder(); if (isEditable) { CustomValue value = CustomValues.GetValue(TSAuthentication.GetLoginUser(), field.CustomFieldID, organizationID); html.AppendFormat(@"<div class='form-group'> <label for='{0}' class='col-xs-4 control-label'>{1}</label> <div class='col-xs-8'> <p class='form-control-static'><a class='editable' id='{0}' data-type='text'>{2}</a></p> </div> </div>", field.CustomFieldID, field.Name, value.Value); } else { StringBuilder mask = new StringBuilder(); if (!String.IsNullOrEmpty(field.Mask)) { mask.Append("placeholder='" + field.Mask + "'"); } html.AppendFormat("<div class='col-xs-8'><input class='form-control col-xs-10 customField {1}' id='{0}' name='{0}' {2}></div>", field.CustomFieldID, field.IsRequired ? "required" : "", mask.ToString()); } return(html.ToString()); }
public T GetCustomValue <T>(string name) { if (CustomValue.ContainsKey(name)) { return((T)CustomValue[name]); } return(default(T)); }
public void MinusOperator() { testValue -= testEffectValue; Assert.AreEqual(BASE, testValue.Base); Assert.AreEqual(-MODIFIER, testValue.Modifier); Assert.AreEqual(0.5, testValue.Multiplier); }
public void PlusOperator() { testValue += testEffectValue; Assert.AreEqual(BASE, testValue.Base); Assert.AreEqual(MODIFIER, testValue.Modifier); Assert.AreEqual(MULTIPLIER, testValue.Multiplier); }
public static string GetCustomValue(RestCommand command, int customValueID) { CustomValue customValue = CustomValues.GetCustomValue(command.LoginUser, customValueID); if (customValue.OrganizationID != command.Organization.OrganizationID) { throw new RestException(HttpStatusCode.Unauthorized); } return(customValue.GetXml("CustomValue", true)); }
public void Result() { float expectedValue = (BASE + MODIFIER) * MULTIPLIER; testValue += testEffectValue; float result = testValue.Result(); Assert.AreEqual(expectedValue, result); }
public PageIos(Page page) { this.customValue = page.getCustomValue(); this.productIos = new ProductIos(page.getProduct()); this.identity = page.getIdentity(); this.contentPath = page.getContentPath(); this.keywordCategory = page.getKeywordCategory(); this.keyword = page.getKeyword(); this.searchResultCount = page.getSearchResultCount(); }
private string GetUserSlackID(int userID) { CustomValue customValue = CustomValues.GetValue(LoginUser, userID, "slackname"); if (customValue != null && !string.IsNullOrWhiteSpace(customValue.Value)) { return(customValue.Value); } return(null); }
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) { if (value is string) { CustomValue customValue; if (CustomValue.TryParse((string)value, out customValue)) { return(customValue); } } return(base.ConvertFrom(context, culture, value)); }
void DropdownClickHandler(object userData) { CustomValue data = (CustomValue)userData; int index = list.serializedProperty.arraySize; list.serializedProperty.arraySize++; list.index = index; var element = list.serializedProperty.GetArrayElementAtIndex(index); element.FindPropertyRelative("valueType").enumValueIndex = (int)data.valueType; element.FindPropertyRelative("valueString").stringValue = ""; serializedObject.ApplyModifiedProperties(); }
public void SaveCustomFields() { CustomFields fields = new CustomFields(UserSession.LoginUser); fields.LoadByReferenceType(UserSession.LoginUser.OrganizationID, _refType, _auxID); foreach (CustomField field in fields) { Control control = GetCustomControl(_table, FieldIDToControlID(field.CustomFieldID)); if (control != null) { CustomValue value = CustomValues.GetValue(UserSession.LoginUser, field.CustomFieldID, _refID); if (control is RadInputControl) { value.Value = (control as RadInputControl).Text; } else if (control is CheckBox) { value.Value = (control as CheckBox).Checked.ToString(); } else if (control is RadComboBox) { value.Value = (control as RadComboBox).SelectedValue; } else if (control is RadDatePicker) { if (control is RadTimePicker) { DateTime?selectedNullableDateTime = (control as RadTimePicker).SelectedDate; if (selectedNullableDateTime != null) { DateTime selectedDateTime = (DateTime)selectedNullableDateTime; DateTime timeOnly = new DateTime(1970, 1, 1, selectedDateTime.Hour, selectedDateTime.Minute, 0, 0, UserSession.LoginUser.CultureInfo.Calendar); value.Value = DataUtils.DateToUtc(UserSession.LoginUser, timeOnly).ToString(); } } else { value.Value = DataUtils.DateToUtc(UserSession.LoginUser, (control as RadDatePicker).SelectedDate).ToString(); } } else if (control is RadDateTimePicker) { value.Value = DataUtils.DateToUtc(UserSession.LoginUser, (control as RadDateTimePicker).SelectedDate).ToString(); } value.Collection.Save(); } } }
public void SetCustomValue(string name, object value) { if (name == "Token") { } if (CustomValue.ContainsKey(name)) { CustomValue[name] = value; } else { CustomValue.Add(name, value); } }
public string CheckRequiredCustomFields() { CustomFields fields = new CustomFields(UserSession.LoginUser); fields.LoadByReferenceType(UserSession.LoginUser.OrganizationID, _refType, _auxID); foreach (CustomField field in fields) { Control control = GetCustomControl(_table, FieldIDToControlID(field.CustomFieldID)); if (control != null) { CustomValue value = CustomValues.GetValue(UserSession.LoginUser, field.CustomFieldID, _refID); if (value.IsRequired) { if (control is RadInputControl) { value.Value = (control as RadInputControl).Text; } else if (control is CheckBox) { value.Value = (control as CheckBox).Checked.ToString(); } else if (control is RadComboBox) { if (field.IsFirstIndexSelect && (control as RadComboBox).SelectedIndex == 0) { value.Value = ""; } else { value.Value = (control as RadComboBox).SelectedValue; } } else if (control is RadDateTimePicker) { value.Value = DataUtils.DateToUtc(UserSession.LoginUser, (control as RadDateTimePicker).SelectedDate).ToString(); } if (value.Value == "" || value.Value == null) { return(value.Name + " is a required value, please enter a value before saving"); } } } } return(""); }
/// <summary> /// Applies Effect on that is not accounted for /// </summary> /// <returns> If it suceeded </returns> public bool ApplyEffects(Skill effect) { switch (effect.Name) { case "Damage": damage += effect.Effect <CustomValue>(); return(true); case "Speed": speed += effect.Effect <CustomValue>(); return(true); default: break; } return(false); }
public override int GetHashCode() { int hash = 1; if (EventId != 0UL) { hash ^= EventId.GetHashCode(); } if (EventType != 0) { hash ^= EventType.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.LongValue) { hash ^= LongValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.DoubleValue) { hash ^= DoubleValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.SkeletonValue) { hash ^= SkeletonValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.ObjectValue) { hash ^= ObjectValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.StringValue) { hash ^= StringValue.GetHashCode(); } if (valueTypeCase_ == ValueTypeOneofCase.CustomValue) { hash ^= CustomValue.GetHashCode(); } if (appTypeCase_ == AppTypeOneofCase.AppId) { hash ^= AppId.GetHashCode(); } hash ^= (int)valueTypeCase_; hash ^= (int)appTypeCase_; return(hash); }
public string CreateBooleanControl(CustomField field, bool isEditable = false, int organizationID = -1) { StringBuilder html = new StringBuilder(); if (isEditable) { CustomValue value = CustomValues.GetValue(TSAuthentication.GetLoginUser(), field.CustomFieldID, organizationID); html.AppendFormat(@"<div class='form-group'> <label for='{0}' class='col-xs-4 control-label'>{1}</label> <div class='col-xs-8'> <p class='form-control-static'><a class='editable' id='{0}' data-type='text'>{2}</a></p> </div> </div>", field.CustomFieldID, field.Name, value.Value); } else { html.AppendFormat("<div class='col-xs-1'><label><input class='customField' id='{0}' type='checkbox'></label></div>", field.CustomFieldID); } return(html.ToString()); }
public PurchaseIos(Purchase purchase) { this.customValue = purchase.getCustomValue(); this.productIos = new ProductIos(purchase.getProduct()); this.orderNo = purchase.getOrderNo(); this.currency = purchase.getCurrency(); this.keywordCategory = purchase.getKeywordCategory(); this.keyword = purchase.getKeyword(); this.useLatestSearchKeyword = purchase.getUseLatestSearchKeyword(); this.useLatestCustomValue1 = purchase.getUseLatestCustomValue1(); this.useLatestCustomValue2 = purchase.getUseLatestCustomValue2(); this.useLatestCustomValue3 = purchase.getUseLatestCustomValue3(); this.useLatestCustomValue4 = purchase.getUseLatestCustomValue4(); this.useLatestCustomValue5 = purchase.getUseLatestCustomValue5(); this.useLatestCustomValue6 = purchase.getUseLatestCustomValue6(); this.useLatestCustomValue7 = purchase.getUseLatestCustomValue7(); this.useLatestCustomValue8 = purchase.getUseLatestCustomValue8(); this.useLatestCustomValue9 = purchase.getUseLatestCustomValue9(); this.useLatestCustomValue10 = purchase.getUseLatestCustomValue10(); }