public virtual void EnsureConstraints() { if ((mLoadedConstraints == true)) { return; } mLoadedConstraints = true; mTask_loyalty_counter = new Articy.Unity.Constraints.NumberConstraint(-100D, 100D, 0, 0, 0, null); mTask_death_target_first = new Articy.Unity.Constraints.ReferenceSlotConstraint("Entity;", "", "None;", ""); mTask_death_target_second = new Articy.Unity.Constraints.ReferenceSlotConstraint("Entity;", "", "None;", ""); mTask_spare_target_first = new Articy.Unity.Constraints.ReferenceSlotConstraint("Entity;", "", "None;", ""); mTask_spare_occupation_selector = new Articy.Unity.Constraints.EnumConstraint(false, "BySortIndex"); mTask_daily_profiles = new Articy.Unity.Constraints.ReferenceStripConstraint(10000, "Entity;", "", "None;", "template_profile;template_random_profile;"); mTask_death_occupation_selector = new Articy.Unity.Constraints.EnumConstraint(false, "BySortIndex"); mTask_profile_count = new Articy.Unity.Constraints.ScriptConstraint("Outcome", ""); mTask_description_top = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, true); mTask_death_threshold_younger = new Articy.Unity.Constraints.NumberConstraint(18D, 2000D, 0, 0, 0, "years "); mTask_death_threshold_older = new Articy.Unity.Constraints.NumberConstraint(18D, 2000D, 0, 0, 0, "years"); mTask_spare_threshold_younger = new Articy.Unity.Constraints.NumberConstraint(18D, 2000D, 0, 0, 0, "years"); mTask_spare_threshold_older = new Articy.Unity.Constraints.NumberConstraint(18D, 2000D, 0, 0, 0, "years"); mTask_description_bottom = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, true); mTask_death_occupation_amount = new Articy.Unity.Constraints.NumberConstraint(-3.40282346638529E+38D, 3.40282346638529E+38D, 0, 0, 0, null); mTask_death_threshold_younger_amount = new Articy.Unity.Constraints.NumberConstraint(-3.40282346638529E+38D, 3.40282346638529E+38D, 0, 0, 0, null); mTask_death_threshold_older_amount = new Articy.Unity.Constraints.NumberConstraint(-3.40282346638529E+38D, 3.40282346638529E+38D, 0, 0, 0, null); mTask_spare_occupation_amount = new Articy.Unity.Constraints.NumberConstraint(-3.40282346638529E+38D, 3.40282346638529E+38D, 0, 0, 0, null); mTask_spare_threshold_younger_amount = new Articy.Unity.Constraints.NumberConstraint(-3.40282346638529E+38D, 3.40282346638529E+38D, 0, 0, 0, null); mTask_spare_threshold_older_amount = new Articy.Unity.Constraints.NumberConstraint(-3.40282346638529E+38D, 3.40282346638529E+38D, 0, 0, 0, null); mTask_death_count = new Articy.Unity.Constraints.NumberConstraint(-3.40282346638529E+38D, 3.40282346638529E+38D, 0, 0, 0, null); mTask_profile_shuffler = new Articy.Unity.Constraints.BooleanConstraint(false); }
/// <summary> /// Default constructor /// </summary> /// <param name="constraintWidth">width constraint</param> /// <param name="constraintHeight">height constraint</param> /// <param name="width">width value</param> /// <param name="height">height value</param> public AdjustementSize(EnumConstraint constraintWidth, EnumConstraint constraintHeight, uint width, uint height) { this.constraintWidth = constraintWidth; this.constraintHeight = constraintHeight; this.width = width; this.height = height; }
public void Should_match_when_parameter_is_optional() { var constraint = new EnumConstraint<ResponseFormat>(true); var matched = constraint.Match(new Mock<HttpContextBase>().Object, new Route("{controller}/{action}", new Mock<IRouteHandler>().Object), "format", new RouteValueDictionary(), RouteDirection.IncomingRequest); Assert.True(matched); }
public void Should_not_match_when_value_does_not_match_with_enum_name() { var constraint = new EnumConstraint<ResponseFormat>(); var matched = constraint.Match(new Mock<HttpContextBase>().Object, new Route("{controller}/{action}", new Mock<IRouteHandler>().Object), "format", new RouteValueDictionary { { "format", "bson" } }, RouteDirection.IncomingRequest); Assert.False(matched); }
public void Should_match_when_parameter_is_optional() { var constraint = new EnumConstraint <ResponseFormat>(true); var matched = constraint.Match(new Mock <HttpContextBase>().Object, new Route("{controller}/{action}", new Mock <IRouteHandler>().Object), "format", new RouteValueDictionary(), RouteDirection.IncomingRequest); Assert.True(matched); }
public void Should_not_match_for_enum_value() { var constraint = new EnumConstraint <ResponseFormat>(); var matched = constraint.Match(new Mock <HttpContextBase>().Object, new Route("{controller}/{action}", new Mock <IRouteHandler>().Object), "format", new RouteValueDictionary { { "format", 4 } }, RouteDirection.IncomingRequest); Assert.False(matched); }
public virtual void EnsureConstraints() { if ((mLoadedConstraints == true)) { return; } mLoadedConstraints = true; mItem_accessory_type = new Articy.Unity.Constraints.EnumConstraint(false, "BySortIndex"); mItem_variation_name = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mItem_parent_reference = new Articy.Unity.Constraints.ReferenceSlotConstraint("Entity;", "", "None;", "template_item;"); }
/// <summary> /// Options to change (graphics attributes) /// </summary> /// <param name="d">disposition</param> /// <param name="w">constraint on width</param> /// <param name="h">constraint on height</param> /// <param name="b">background color</param> /// <param name="a">border color</param> /// <param name="f">font color</param> /// <param name="bs">border size</param> /// <param name="ps">padding size</param> /// <param name="obj">ux object</param> public void Options(Disposition d, EnumConstraint w, EnumConstraint h, CSSColor b, CSSColor a, CSSColor f, int bs, int ps, IUXObject obj) { this.disposition = d; this.constraintWidth = w; this.constraintHeight = h; this.backgroundColor = (CSSColor)b.Clone(); this.borderColor = (CSSColor)a.Clone(); this.textColor = (CSSColor)f.Clone(); this.borderSize = bs; this.paddingSize = ps; this.content = obj; }
/// <summary> /// Constructor from a previous parent constraint /// </summary> /// <param name="objectName">object name</param> /// <param name="parent">parent constraint</param> public ParentConstraint(string objectName, ParentConstraint parent) { this.precedingWidth = parent.precedingWidth; this.precedingHeight = parent.precedingHeight; this.constraintWidth = parent.constraintWidth; this.constraintHeight = parent.constraintHeight; this.maximumWidth = parent.maximumWidth; this.maximumHeight = parent.maximumHeight; this.disposition = parent.disposition; this.border = parent.border; this.objectName = objectName; }
private void SetupEnum(EnumConstraint constraint) { AllowsCustomFields = false; IsCastable = false; IsIndexable = false; Fields = new List <IAutocompleteItem>(); Types = null; foreach (var name in constraint.EnumType.GetEnumNames()) { Fields.Add(new LeafAutocompleteItem(name)); } }
/// <summary> /// Default constructor /// </summary> /// <param name="objectName">object name</param> /// <param name="precedingWidth">previous width</param> /// <param name="precedingHeight">previous height</param> /// <param name="constraintWidth">width constraint</param> /// <param name="constraintHeight">height constraint</param> /// <param name="maximumWidth">maximum width</param> /// <param name="maximumHeight">maximum height</param> /// <param name="disposition">disposition</param> /// <param name="border">border size and constraint</param> public ParentConstraint(string objectName, uint precedingWidth, uint precedingHeight, EnumConstraint constraintWidth, EnumConstraint constraintHeight, uint maximumWidth, uint maximumHeight, Disposition disposition, BorderConstraint border) { this.precedingWidth = precedingWidth; this.precedingHeight = precedingHeight; this.constraintWidth = constraintWidth; this.constraintHeight = constraintHeight; this.maximumWidth = maximumWidth; this.maximumHeight = maximumHeight; this.disposition = disposition; this.border = border; this.objectName = objectName; }
public virtual void EnsureConstraints() { if ((mLoadedConstraints == true)) { return; } mLoadedConstraints = true; mAge = new Articy.Unity.Constraints.NumberConstraint(-3.40282346638529E+38, 3.40282346638529E+38, 0, 0, 0, null); mSpecies = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mBornIn = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mSex = new Articy.Unity.Constraints.EnumConstraint(true, "BySortIndex"); mOccupation = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mAccent = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mPersonality = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, true); mAppearance = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, true); }
public virtual void EnsureConstraints() { if ((mLoadedConstraints == true)) { return; } mLoadedConstraints = true; mProfile_name = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mProfile_age_value = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mProfile_job = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mProfile_bio = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, true); mProfile_is_enabled = new Articy.Unity.Constraints.BooleanConstraint(true); mProfile_marked_for_death = new Articy.Unity.Constraints.BooleanConstraint(false); mProfile_occupation_selector = new Articy.Unity.Constraints.EnumConstraint(false, "BySortIndex"); mProfile_appearance_news_first = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mProfile_appearance_news_second = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); }
/// <summary> /// Computes the adjustement size for a master page /// </summary> /// <param name="p">given a project</param> /// <param name="mp">given a master page</param> /// <returns>an adjustement size</returns> public static AdjustementSize ComputeMasterPage(Project p, MasterPage mp) { uint maxWidth = 0; uint height = 0; EnumConstraint cWidth = EnumConstraint.FIXED, cHeight = EnumConstraint.FIXED; foreach (HorizontalZone hz in mp.HorizontalZones) { AdjustementSize ads = SizeCompute.ComputeHorizontalZones(p, hz, mp.Objects); if (ads.ConstraintWidth == EnumConstraint.FIXED) { if (maxWidth < ads.Width) { maxWidth = ads.Width; } } else { cWidth = EnumConstraint.AUTO; } if (ads.ConstraintHeight == EnumConstraint.FIXED) { height += ads.Height; } else { cHeight = EnumConstraint.AUTO; } } // set information AdjustementSize container = new AdjustementSize(mp.ConstraintWidth, mp.ConstraintHeight, mp.Width, mp.Height); AdjustementSize content = new AdjustementSize(cWidth, cHeight, maxWidth, height); // compute SizeCompute.CheckConstraints(container, content); // update information mp.ConstraintWidth = container.ConstraintWidth; mp.ConstraintHeight = container.ConstraintHeight; mp.Width = container.Width; mp.Height = container.Height; return(new AdjustementSize(mp.ConstraintWidth, mp.ConstraintHeight, mp.Width, mp.Height)); }
public void ShouldMatch_IfParameterValue_InTheEnumMembers([Values("foo", "notfoo")] string input) { var constraint = new EnumConstraint("Climax.Web.Http.Tests.TestEnum, Climax.Web.Http.Tests"); var result = constraint.Match(new HttpRequestMessage(), new Mock<IHttpRoute>().Object, "test", new HttpRouteValueDictionary { {"test", input} }, HttpRouteDirection.UriResolution); if (input == "foo") { result.ShouldBeTrue(); } else { result.ShouldBeFalse(); } }
public virtual void EnsureConstraints() { if ((mLoadedConstraints == true)) { return; } mLoadedConstraints = true; mIfConditionTrue = new Articy.Unity.Constraints.ReferenceSlotConstraint("Dialogue;Location;DialogueFragment;Entity;", "", "None;", "Item;"); mIfConditionFalse = new Articy.Unity.Constraints.ReferenceSlotConstraint("Dialogue;Location;DialogueFragment;Entity;", "", "None;", "Item;"); mCursorIfConditionTrue = new Articy.Unity.Constraints.EnumConstraint(false, "BySortIndex"); mCursorIfConditionFalse = new Articy.Unity.Constraints.EnumConstraint(false, "BySortIndex"); mItemToInteractWith = new Articy.Unity.Constraints.ReferenceSlotConstraint("Entity;", "", "None;", "Item;"); mLinkIfItemValid = new Articy.Unity.Constraints.ReferenceSlotConstraint("DialogueFragment;Dialogue;Location;Condition;Instruction;", "", "None;", ""); mLinkIfItemInvalid = new Articy.Unity.Constraints.ReferenceSlotConstraint("DialogueFragment;Dialogue;Location;Condition;Instruction;", "", "None;", ""); mClickCondition = new Articy.Unity.Constraints.ScriptConstraint("Condition", ""); mOnClickInstruction = new Articy.Unity.Constraints.ScriptConstraint("Outcome", ""); mInteractionCondition = new Articy.Unity.Constraints.ScriptConstraint("Condition", ""); mInstructionIfItemValid = new Articy.Unity.Constraints.ScriptConstraint("Outcome", ""); }
public virtual void EnsureConstraints() { if ((mLoadedConstraints == true)) { return; } mLoadedConstraints = true; mItem_name = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mItem_description = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, true); mItem_price_value = new Articy.Unity.Constraints.NumberConstraint(-3.40282346638529E+38D, 3.40282346638529E+38D, 0, 0, 0, "darksouls"); mItem_type_category = new Articy.Unity.Constraints.EnumConstraint(false, "BySortIndex"); mItem_flavour_text_first = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mItem_instruction_onbuy = new Articy.Unity.Constraints.ScriptConstraint("Outcome", ""); mItem_flavour_text_second = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mItem_icon = new Articy.Unity.Constraints.ReferenceSlotConstraint("LocationImage;Asset;Entity;", "", "None;Image;Video;Audio;Document;Misc;All;", ""); mItem_flavour_text_third = new Articy.Unity.Constraints.TextConstraint(2048, "", null, true, false); mItem_dialogue = new Articy.Unity.Constraints.ReferenceSlotConstraint("Dialogue;", "", "None;", "template_conscience;"); mItem_variations = new Articy.Unity.Constraints.ReferenceStripConstraint(10000, "Entity;", "", "None;", "template_item_variation;"); mItem_slot_number = new Articy.Unity.Constraints.NumberConstraint(-1D, 2D, 0, 0, 0, null); mItem_variable = new Articy.Unity.Constraints.ScriptConstraint("Condition", ""); }
public virtual void EnsureConstraints() { if ((mLoadedConstraints == true)) { return; } mLoadedConstraints = true; mProfile_generate_occupation = new Articy.Unity.Constraints.EnumConstraint(false, "BySortIndex"); mProfile_generate_older_than = new Articy.Unity.Constraints.NumberConstraint(18D, 2000D, 0, 0, 0, "years"); mProfile_generate_younger_than = new Articy.Unity.Constraints.NumberConstraint(18D, 2000D, 0, 0, 0, "years"); mProfile_generate_ecology_value_min = new Articy.Unity.Constraints.NumberConstraint(-100D, 100D, 0, 0, 0, null); mProfile_generate_peace_value_min = new Articy.Unity.Constraints.NumberConstraint(-100D, 100D, 0, 0, 0, null); mProfile_generate_healthcare_value_min = new Articy.Unity.Constraints.NumberConstraint(-100D, 100D, 0, 0, 0, null); mProfile_generate_prosperity_value_min = new Articy.Unity.Constraints.NumberConstraint(-100D, 100D, 0, 0, 0, null); mProfile_generate_any_random = new Articy.Unity.Constraints.BooleanConstraint(false); mProfile_generate_ecology_value_max = new Articy.Unity.Constraints.NumberConstraint(-100D, 100D, 0, 0, 0, null); mProfile_generate_peace_value_max = new Articy.Unity.Constraints.NumberConstraint(-100D, 100D, 0, 0, 0, null); mProfile_generate_healthcare_value_max = new Articy.Unity.Constraints.NumberConstraint(-100D, 100D, 0, 0, 0, null); mProfile_generate_prosperity_value_max = new Articy.Unity.Constraints.NumberConstraint(-100D, 100D, 0, 0, 0, null); mProfile_generate_spare_death_both = new Articy.Unity.Constraints.EnumConstraint(false, "BySortIndex"); }
/// <summary> /// Construct all zones and compute total size /// </summary> /// <param name="c">column count</param> /// <param name="l">list count</param> /// <param name="list">list of rectangle the user supplied</param> /// <param name="hList">horizontal zones list</param> /// <param name="width">width</param> /// <param name="height">height</param> /// <param name="constraintWidth">constraint width</param> /// <param name="constraintHeight">constraint height</param> public static void MakeZones(uint c, uint l, List <AreaSizedRectangle> list, List <HorizontalZone> hList, uint width, uint height, EnumConstraint constraintWidth, EnumConstraint constraintHeight) { AreaSizedRectangle[,] indexes = new AreaSizedRectangle[c, l]; for (int index = 0; index < list.Count; ++index) { AreaSizedRectangle current = list[index]; indexes[current.StartWidth, current.StartHeight] = current; } double deltaWidth = width / (double)c; double deltaHeight = height / (double)l; // ranger les données dans la master page for (int pos_ligne = 0; pos_ligne < l; ++pos_ligne) { HorizontalZone hz; hz = new HorizontalZone(); hz.ConstraintWidth = constraintWidth; hz.ConstraintHeight = EnumConstraint.AUTO; hz.Width = width; int maxCountLines; uint maxHeight; maxHeight = 0; maxCountLines = 0; for (int pos_colonne = 0; pos_colonne < c; ++pos_colonne) { AreaSizedRectangle current = indexes[pos_colonne, pos_ligne]; if (current != null) { VerticalZone vz = new VerticalZone(); vz.CountLines = current.CountHeight; vz.CountColumns = current.CountWidth; vz.Width = Convert.ToUInt32(deltaWidth * current.CountWidth); vz.Height = Convert.ToUInt32(deltaHeight * current.CountHeight); vz.ConstraintWidth = constraintWidth; vz.ConstraintHeight = constraintHeight; hz.VerticalZones.Add(vz); if (maxCountLines < vz.CountLines) { maxCountLines = vz.CountLines; } if (maxHeight < vz.Height) { maxHeight = vz.Height; } } } hz.CountLines = maxCountLines; hz.Height = maxHeight; hList.Add(hz); } }
//public static TestClass ToTestClass(this string _this) //{ // // #generates compile error (so no missuse) // return EnumConstraint.TryParse<TestClass>(_this); //} //public static TestStruct ToTestStruct(this string _this) //{ // // #generates compile error (so no missuse) // return EnumConstraint.TryParse<TestStruct>(_this); //} public static TestEnum ToTestEnum(this string _this) { // #enum type works just fine (coding constraint to Enum type) return(EnumConstraint.TryParse <TestEnum>(_this)); }
/// <summary> /// Default constructor /// </summary> /// <param name="constraintWidth">constraint width enumeration</param> /// <param name="width">width size</param> /// <param name="preceding_width">width size outbox</param> /// <param name="constraintHeight">constraint height enumeration</param> /// <param name="height">height size</param> /// <param name="preceding_height">height size outbox</param> public ConstraintSize(EnumConstraint constraintWidth, uint width, uint preceding_width, EnumConstraint constraintHeight, uint height, uint preceding_height) { this.constraintWidth = constraintWidth; this.constraintHeight = constraintHeight; this.width = this.height = 0; this.widthString = this.heightString = String.Empty; this.attributeHeight = this.attributeWidth = String.Empty; this.forcedWidth = preceding_width; this.forcedHeight = preceding_height; // calcul la taille en fonction du type de contrainte switch (this.constraintWidth) { case EnumConstraint.AUTO: this.width = width; break; case EnumConstraint.FIXED: this.width = width; this.forcedWidth = this.width; this.widthString = this.width.ToString() + "px"; this.attributeWidth = "width='" + this.widthString + "'"; break; case EnumConstraint.RELATIVE: this.width = width; this.widthString = this.width.ToString() + "%"; this.attributeWidth = "width='" + this.widthString + "'"; break; case EnumConstraint.FORCED: if (preceding_width != 0) { this.width = preceding_width; this.forcedWidth = this.width; this.widthString = this.width.ToString() + "px"; this.attributeWidth = "width='" + this.widthString + "'"; } break; } switch (this.constraintHeight) { case EnumConstraint.AUTO: this.height = height; break; case EnumConstraint.FIXED: this.height = height; this.forcedHeight = this.height; this.heightString = this.height.ToString() + "px"; this.attributeHeight = "height='" + this.heightString + "'"; break; case EnumConstraint.RELATIVE: this.height = height; this.heightString = this.height.ToString() + "%"; this.attributeHeight = "height='" + this.heightString + "'"; break; case EnumConstraint.FORCED: if (preceding_height != 0) { this.height = preceding_height; this.forcedHeight = this.height; this.heightString = this.height.ToString() + "px"; this.attributeHeight = "height='" + this.heightString + "'"; } break; } }