public void Start() { addColorLabel.gameObject.SetActive(true); selectColorButton.SetActive(false); highlight.gameObject.SetActive(false); colorWidget = null; }
public void specify_a_constructor_dependency_by_type() { var widget = new ColorWidget("Red"); build <ClassWithWidget>(i => i.Ctor <IWidget>().IsSpecial(x => x.Object(widget))).Widget.ShouldBeTheSameAs( widget); }
private void SetColorForButton(int index, Color color, string colorName) { if (string.IsNullOrEmpty(colorName) == false) { colorButtons[index].addColorLabel.gameObject.SetActive(false); colorButtons[index].selectColorButton.gameObject.SetActive(true); ColorWidget newColorWidget = Instantiate(colorWidgetPrefab).GetComponent <ColorWidget>(); newColorWidget.color = color; newColorWidget.colorName = colorName; colorButtons[index].SetColorWidget(newColorWidget); // Pass the color to the shader DecoratorPanel.Instance.photoRenderer.material.SetColor("_Color" + (index + 1).ToString(), newColorWidget.color); } else { colorButtons[index].addColorLabel.gameObject.SetActive(true); colorButtons[index].selectColorButton.gameObject.SetActive(false); colorButtons[index].SetColorWidget(null); // Pass the color to the shader DecoratorPanel.Instance.photoRenderer.material.SetColor("_Color" + (index + 1).ToString(), Color.black); } }
public void specify_a_constructor_dependency() { var widget = new ColorWidget("Red"); build <ClassWithWidget>(instance => instance.CtorDependency <IWidget>("widget").Is(x => x.Object(widget))). Widget. ShouldBeTheSameAs(widget); }
public void specify_a_non_simple_property_with_equal_to() { var widget = new ColorWidget("Red"); var container = new Container(x => x.For <ClassWithWidgetProperty>() .Use <ClassWithWidgetProperty>() .Setter(o => o.Widget).Is(widget)); widget.ShouldBeTheSameAs(container.GetInstance <ClassWithWidgetProperty>().Widget); }
public void specify_ctorarg_with_non_simple_argument() { var widget = new ColorWidget("Red"); var container = new Container(x => x.For <ClassWithWidget>() .Use <ClassWithWidget>() .Ctor <IWidget>().Is(widget)); widget.ShouldBeTheSameAs(container.GetInstance <ClassWithWidget>().Widget); }
public void specify_a_non_simple_property_with_equal_to() { var widget = new ColorWidget("Red"); var container = new Container(x => x.ForRequestedType <ClassWithWidgetProperty>() .Use <ClassWithWidgetProperty>() .WithProperty(o => o.Widget).EqualTo(widget)); Assert.AreSame(widget, container.GetInstance <ClassWithWidgetProperty>().Widget); }
public void specify_ctorarg_with_non_simple_argument() { var widget = new ColorWidget("Red"); var container = new Container(x => x.ForRequestedType <ClassWithWidget>() .Use <ClassWithWidget>() .WithCtorArg("widget").EqualTo(widget)); Assert.AreSame(widget, container.GetInstance <ClassWithWidget>().Widget); }
public PropertyWheelMenuBody(PropertyWheelMenu parent) : base(parent) { this.propertyWheelMenu = parent; background = new TexturedBox(this) { Material = Material.CircleMat, Color = headerColor, Size = Vector2.Zero, }; summaryLabel = new Label(this) { AutoResize = false, BuilderMode = TextBuilderModes.Wrapped, Width = 200f, }; notificationText = new Label(this) { AutoResize = true, ParentAlignment = ParentAlignments.Bottom | ParentAlignments.Inner, BuilderMode = TextBuilderModes.Wrapped, Width = 150f, Offset = new Vector2(0f, 30f), }; colorWidget = new ColorWidget(this) { Visible = false }; colorWidgetHSV = new ColorWidgetHSV(this) { Visible = false }; comboWidget = new ComboWidget(this) { Visible = false }; floatWidget = new FloatWidget(this) { Visible = false }; textWidget = new TextWidget(this) { Visible = false }; summaryBuilder = new RichText(); CloseWidgetCallback = CloseWidget; textBuf = new StringBuilder(); notificationTimer = new Stopwatch(); Padding = new Vector2(wheelBodyPeekPadding); Size = new Vector2(maxPeekWrapWidth); }
/// <summary> /// Gets the colorwidgets attached to the UI color buttons /// </summary> /// <returns></returns> public ColorWidget[] GetButtonColorWidgets() { ColorWidget[] ret = new ColorWidget[3]; for (int i = 0; i < 3; i++) { ret[i] = colorButtons[i].GetColorWidget(); } return(ret); }
public void specify_a_property_dependency() { var widget = new ColorWidget("Red"); build <ClassWithWidgetProperty>(i => i.Setter(x => x.Widget).IsSpecial(x => x.Object(widget))).Widget. ShouldBeTheSameAs(widget); var container = new Container(x => { x.ForConcreteType <ClassWithWidgetProperty>().Configure .Setter(o => o.Widget).IsSpecial(o => o.Object(new ColorWidget("Red"))); }); }
public void inject_into_the_child_does_not_affect_the_parent_container() { var parent = new Container(x => x.For <IWidget>().Use <AWidget>()); var child = parent.GetNestedContainer(); var childWidget = new ColorWidget("blue"); child.Inject <IWidget>(childWidget); // do the check repeatedly child.GetInstance <IWidget>().ShouldBeTheSameAs(childWidget); child.GetInstance <IWidget>().ShouldBeTheSameAs(childWidget); child.GetInstance <IWidget>().ShouldBeTheSameAs(childWidget); // now, compare to the parent parent.GetInstance <IWidget>().ShouldNotBeTheSameAs(childWidget); }
public void SetColorWidget(ColorWidget colorWidget) { // Remove old color widget if (this.colorWidget != null) { DestroyImmediate(this.colorWidget.gameObject); } this.colorWidget = colorWidget; // Add new color if (this.colorWidget != null) { this.colorWidget.transform.SetParent(transform, false); this.colorWidget.transform.localPosition = Vector3.zero; this.colorWidget.transform.localScale = Vector3.one; this.colorWidget.GetComponent <Graphic>().raycastTarget = false; this.colorWidget.transform.SetAsFirstSibling(); } }
public void PickCombination(GameObject combinationWidget) { gameObject.SetActive(false); colorButtons[currentColor].addColorLabel.gameObject.SetActive(false); colorButtons[currentColor].selectColorButton.gameObject.SetActive(true); int prevCurrentColor = currentColor; for (currentColor = 0; currentColor < colorButtons.Count; currentColor++) { ColorWidget newColorWidget = Instantiate(colorWidgetPrefab).GetComponent <ColorWidget>(); newColorWidget.colorName = combinationWidget.GetComponent <CombinationWidget>().colorNames[currentColor]; newColorWidget.GetComponent <Graphic>().color = combinationWidget.GetComponent <CombinationWidget>().graphics[currentColor].color; PickColorForCurrentColorButton(newColorWidget.gameObject); Destroy(newColorWidget.gameObject); } currentColor = prevCurrentColor; }
public void PickColorForCurrentColorButton(GameObject colorWidget) { gameObject.SetActive(false); colorButtons[currentColor].addColorLabel.gameObject.SetActive(false); colorButtons[currentColor].selectColorButton.gameObject.SetActive(true); ColorWidget newColorWidget = Instantiate(colorWidget.gameObject).GetComponent <ColorWidget>(); colorButtons[currentColor].SetColorWidget(newColorWidget); // Pass color information to shader switch (currentColor) { case 0: DecoratorPanel.Instance.photoRenderer.material.SetColor("_Color1", newColorWidget.GetComponent <Graphic>().color); break; case 1: DecoratorPanel.Instance.photoRenderer.material.SetColor("_Color2", newColorWidget.GetComponent <Graphic>().color); break; case 2: DecoratorPanel.Instance.photoRenderer.material.SetColor("_Color3", newColorWidget.GetComponent <Graphic>().color); break; } }
public void can_serialize() { var widget = new ColorWidget("blue"); var instance = new ObjectInstance(widget); cache.Set(typeof(Rule), instance, widget); var formatter = new BinaryFormatter(); var stream = new MemoryStream(); formatter.Serialize(stream, cache); stream.Position = 0; var deserializedCache = (MainObjectCache)formatter.Deserialize(stream); Assert.AreNotSame(cache, deserializedCache); var cachedWidget = deserializedCache.Get(typeof(Rule), instance) as ColorWidget; cachedWidget.ShouldNotBeNull(); cachedWidget.Color.ShouldEqual("blue"); }