private void InitDefaultContainer(Guid containerId, ColumnSchemaType schema, IEnumerable <Widget> widgets) { if (DefaultContainers.ContainsKey(containerId)) { return; } lock (DefaultContainers) { if (DefaultContainers.ContainsKey(containerId)) { return; } var widgetContainer = new WidgetContainer(Guid.Empty, containerId) { ColumnSchemaType = columnSchemaType, }; foreach (var widget in widgets) { var state = new WidgetState(widget.WidgetID, widgetContainer.ID) { X = widget.Position.X, Y = widget.Position.Y }; widgetContainer.States.Add(state); } DefaultContainers[containerId] = widgetContainer; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); WidgetState.SetWidgetNameOnTarget(this.TargetControl as IAttributeAccessor); WidgetState.AddPagePreRenderCompleteHandler(); }
internal void InitWidgetState(WidgetState widgetState, string jsObjName) { WidgetState = widgetState; Position = new Point(widgetState.X, widgetState.Y); _jsObjName = jsObjName; ID = widgetState.ContainerID + "_" + WidgetID; }
public static NodeState TryGetState(Node node, Animation animation) { var node3D = node as Node3D; if (node3D != null) { return(Node3DState.TryGetState(node3D, animation)); } var widget = node as Widget; if (widget != null) { return(WidgetState.TryGetState(widget, animation)); } var point = node as DistortionMeshPoint; if (point != null) { return(DistortionMeshPointState.TryGetState(point, animation)); } var bone = node as Bone; if (bone != null) { return(BoneState.TryGetState(bone, animation)); } return(null); }
private Color MenuItemBackgroundColor(WidgetState state) { if (state == WidgetState.Selected) { return(Color.White); } return(Color.Transparent); }
public void OnParentSetState(WidgetState parentState) { if (mParentState != parentState) { mParentState = parentState; UpdateStateInHierarchy(); } }
protected override void OnStateInHierarchyChanged(WidgetState previousState, WidgetState newState) { base.OnStateInHierarchyChanged(previousState, newState); if (pIsPageFlipEnabled) { mPageFlip.OnMenuStateChanged(newState); } }
void IPostBackEventHandler.RaisePostBackEvent(string eventArgument) { if (AutoPostBack && !Page.IsPostBackEventControlRegistered) { Page.AutoPostBackControl = this; } WidgetState.RaisePostBackEvent(eventArgument); }
/// <summary> /// Sets the current state of the widget based on a string value /// </summary> /// <param name="widgetState"></param> public void SetWidgetState(string widgetState) { WidgetState?parsedState = WidgetManager.ParseWidgetState(widgetState); if (parsedState.HasValue) { state = parsedState.Value; } }
protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); if (this.TargetControl.Visible) { Page.RegisterRequiresPostBack(this); WidgetState.ParseEverything(this.TargetControl); WidgetState.RenderCss(); } }
protected virtual void SetParamsFromPublicVariables() { if (_State != pState) { pState = _State; } if (_Visible != pVisible) { pVisible = _Visible; } }
protected override void OnStateInHierarchyChanged(WidgetState previousStateInHierarchy, WidgetState newStateInHierarchy) { UpdateUnityComponents(); if ((previousStateInHierarchy == WidgetState.DISABLED && mStateInHierarchy != WidgetState.DISABLED) || (previousStateInHierarchy != WidgetState.DISABLED && mStateInHierarchy == WidgetState.DISABLED)) { // We're either changing from being DISABLED to somethig else, or becoming DISABLED. An effect change must be triggered SelectEffect(); } }
public void OnMenuStateChanged(WidgetState newState) { if (_Next != null) { _Next.OnParentSetState(newState); } if (_Previous != null) { _Previous.OnParentSetState(newState); } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (value is WidgetState) { WidgetState ws = (WidgetState)value; if (ws == WidgetState.NoConnection) { return(Visibility.Collapsed); } } return(Visibility.Visible); }
/// <summary> /// This method will be called whenever the widget is being re-parented under a different widget or a UI. /// If you are overriding this, add checks to ensure that operations/methods that must not be performed multiple times /// are only executed once /// </summary> public virtual void Initialize(UI parentUI, UIWidget parentWidget) { if (!mInitialized) { mInitialized = true; pRectTransform = transform as RectTransform; if (_ProxyTransform == null) { _ProxyTransform = pRectTransform; } mSelectable = GetComponent <Selectable>(); // Clearing these lists since Initialize() could by called multiple times in the editor by FillEffectReferences() mChildWidgets.Clear(); mGraphicsStates.Clear(); CacheWidgets(transform); mGraphicsStatesCached = true; } pParentUI = parentUI; pParentWidget = parentWidget; // We can't call SetParamsFromPublicVariables() here since that would trigger // a series of recursive calls mState = _State; mVisible = _Visible; if (parentWidget != null) { mParentState = parentWidget.pStateInHierarchy; mParentVisible = parentWidget.pVisibleInHierarchy; } else if (parentUI != null) { mParentState = parentUI.pStateInHierarchy; mParentVisible = parentUI.pVisibleInHierarchy; } WidgetState previousStateInHierarchy = mStateInHierarchy; //bool previousVisibleInHierarchy = mVisibleInHierarchy; mStateInHierarchy = (mState < mParentState) ? mState : mParentState; mVisibleInHierarchy = mParentVisible ? mVisible : mParentVisible; OnStateInHierarchyChanged(previousStateInHierarchy, mStateInHierarchy); OnVisibleInHierarchyChanged(mVisibleInHierarchy); foreach (UIWidget childWidget in mChildWidgets) { childWidget.pEventTarget = pEventTarget; childWidget.Initialize(pParentUI, this); } }
private Color ComboBoxItemBackgroundColor(WidgetState state) { if (state == WidgetState.Selected) { return(Color.White); } if (state == WidgetState.Hovered) { return(Color.Black.Mix(Color.White, 0.15f)); } return(Color.Transparent); }
private static Color WidgetBackgroundColor(WidgetState state) { if (state == WidgetState.None || state == WidgetState.Hovered) { return Color.Transparent; } else if (state == WidgetState.Selected) { return Color.Black; } else { return Color.CornflowerBlue; } }
protected sealed override void UpdateStateInHierarchy() { WidgetState previousStateInHierarchy = mStateInHierarchy; base.UpdateStateInHierarchy(); if (previousStateInHierarchy != mStateInHierarchy) { foreach (UI childUI in mChildUIs) { childUI.OnParentSetState(mStateInHierarchy); } } }
/// <summary> /// Sets mStateInHierarchy and propagates it to children. /// Calls the OnStateInHierarchyChanged() event /// </summary> protected virtual void UpdateStateInHierarchy() { WidgetState previousStateInHierarchy = mStateInHierarchy; mStateInHierarchy = (mState < mParentState) ? mState : mParentState; if (previousStateInHierarchy != mStateInHierarchy) { foreach (UIWidget childWidget in mChildWidgets) { childWidget.OnParentSetState(mStateInHierarchy); } OnStateInHierarchyChanged(previousStateInHierarchy, mStateInHierarchy); } }
private static Color WidgetBackgroundColor(WidgetState state) { if (state == WidgetState.None || state == WidgetState.Hovered) { return(Color.Transparent); } else if (state == WidgetState.Selected) { return(Color.Black); } else { return(Color.CornflowerBlue); } }
private Color ComboBoxItemForegroundColor(WidgetState state) { if (state == WidgetState.Hovered) { return(Color.White); } else if (state == WidgetState.Selected) { return(Color.Black); } else { return(Color.White * 0.7f); } }
private static Color WidgetForegroundColor(WidgetState state) { if (state == WidgetState.Hovered) { return(Color.White); } else if (state == WidgetState.None) { return(Color.White * 0.7f); } else if (state == WidgetState.Selected) { return(Color.White); } else { return(Color.CornflowerBlue); } }
public static NodeState TryGetState(Node node, Animation animation) { if (node is Node3D node3D) { return(Node3DState.TryGetState(node3D, animation)); } if (node is Widget widget) { return(WidgetState.TryGetState(widget, animation)); } if (node is DistortionMeshPoint point) { return(DistortionMeshPointState.TryGetState(point, animation)); } if (node is Bone bone) { return(BoneState.TryGetState(bone, animation)); } return(null); }
private Color MenuItemForegroundColor(WidgetState state) { if (state == WidgetState.Hovered) { return Color.White; } else if (state == WidgetState.Selected) { return Color.Black; } else { return Color.White * 0.7f; } }
protected virtual void SetDefaultOptions() { WidgetState.SetDefaultOptions(); }
private Color ComboBoxItemBackgroundColor(WidgetState state) { if (state == WidgetState.Selected) { return Color.White; } if (state == WidgetState.Hovered) { return Color.Black.Mix (Color.White, 0.15f); } return Color.Transparent; }
private Color MenuItemBackgroundColor(WidgetState state) { if (state == WidgetState.Selected) { return Color.White; } return Color.Transparent; }
public Widget(float fontFactor = 1.0f) { State = WidgetState.Initialising; Type = GetType(); FontFactor = fontFactor; }
public static void SetState(DependencyObject obj, WidgetState value) { obj.SetValue(StateProperty, value); }
protected virtual void OnStateInHierarchyChanged(WidgetState previousStateInHierarchy, WidgetState newStateInHierarchy) { }
private Color ComboBoxItemBackgroundColor(WidgetState state) { if (state == WidgetState.Selected) { return Color.DarkGreen; } if (state == WidgetState.Hovered) { return Color.White.Mix (Color.DarkGreen, 0.25f); } return Color.Transparent; }
protected override void OnStateInHierarchyChanged(WidgetState previousStateInHierarchy, WidgetState newStateInHierarchy) { UpdateUnityComponents(); }
/// <summary> /// Performs initial setup. Should be called only once per UI. /// Game code must not override this method. Use OnInitialize() instead /// </summary> protected virtual void Initialize(UI parentUI) { if (!mInitialized) { mInitialized = true; pRectTransform = transform as RectTransform; if (_ProxyTransform == null) { _ProxyTransform = pRectTransform; } pCanvas = GetComponent <Canvas>(); pCanvasScaler = GetComponent <CanvasScaler>(); mUIManager = UIManager.pInstance; if (mUIManager == null) { Debug.LogError("No UIManager in the scene"); } pEventReceiver = new UIEvents(); pEventReceiver.OnAnimEnd += OnAnimEnd; pEventReceiver.OnDrag += OnDrag; pEventReceiver.OnDrop += OnDrop; pEventReceiver.OnBeginDrag += OnBeginDrag; pEventReceiver.OnEndDrag += OnEndDrag; pEventReceiver.OnClick += OnClick; pEventReceiver.OnPress += OnPress; pEventReceiver.OnPressRepeated += OnPressRepeated; pEventReceiver.OnHover += OnHover; pEventReceiver.OnEndEdit += OnEndEdit; pEventReceiver.OnValueChanged += OnValueChanged; pEventReceiver.OnCheckedChanged += OnCheckedChanged; pEventReceiver.OnSelected += OnSelected; CacheWidgets(_ProxyTransform); mGraphicsStatesCached = true; } pParentUI = parentUI; // We can't call SetParamsFromPublicVariables() here since that would trigger // a series of recursive calls mState = _State; mVisible = _Visible; if (parentUI != null) { mParentState = parentUI.pStateInHierarchy; mParentVisible = parentUI.pVisibleInHierarchy; } WidgetState previousStateInHierarchy = mStateInHierarchy; //bool previousVisibleInHierarchy = mVisibleInHierarchy; mStateInHierarchy = (mState < mParentState) ? mState : mParentState; mVisibleInHierarchy = mParentVisible ? mVisible : mParentVisible; OnStateInHierarchyChanged(previousStateInHierarchy, mStateInHierarchy); OnVisibleInHierarchyChanged(mVisibleInHierarchy); foreach (UIWidget childWidget in mChildWidgets) { childWidget.pEventTarget = pEventReceiver; childWidget.Initialize(this, null); } foreach (UI childUI in mChildUIs) { childUI.pEventTarget = pEventReceiver; childUI.Initialize(this); } }
private Color MenuItemForegroundColor(WidgetState state) { if (state == WidgetState.Hovered) { return Color.DarkGreen.Mix (Color.Black, 0.50f); } else if (state == WidgetState.Selected) { return Color.White; } else { return Color.Black; } }
private static Color WidgetForegroundColor(WidgetState state) { if (state == WidgetState.Hovered) { return Color.DarkGreen.Mix (Color.Black, 0.50f); } else if (state == WidgetState.None) { return Color.Black; } else if (state == WidgetState.Selected) { return Color.Black; } else { return Color.CornflowerBlue; } }
private static Color WidgetForegroundColor(WidgetState state) { if (state == WidgetState.Hovered) { return Color.White; } else if (state == WidgetState.None) { return Color.White * 0.7f; } else if (state == WidgetState.Selected) { return Color.White; } else { return Color.CornflowerBlue; } }
public void PaintGlassy(Control control, Graphics graphics, Rectangle rectangle, Theme theme, WidgetState state, int Angle) { glassy.DrawBackground(control, graphics, rectangle, false, Color.Blue, Color.Red, Color.Yellow, Color.Gray, 90); }
/// <summary> /// Updates the state of the user widget, i.e., collapsed, open, etc... /// </summary> /// <param name="widgetName"></param> /// <param name="widgetState"></param> private void UpdateUserWidgetPreference(string widgetName, WidgetState widgetState) { string stateName = widgetName + " State"; uc.UpdateUserAttribute(stateName, widgetState.ToString(), "Widget Preference"); }
protected virtual void OnStateChanged(WidgetState previousState, WidgetState newState) { }