Пример #1
0
 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;
     }
 }
Пример #2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            WidgetState.SetWidgetNameOnTarget(this.TargetControl as IAttributeAccessor);
            WidgetState.AddPagePreRenderCompleteHandler();
        }
Пример #3
0
 internal void InitWidgetState(WidgetState widgetState, string jsObjName)
 {
     WidgetState = widgetState;
     Position    = new Point(widgetState.X, widgetState.Y);
     _jsObjName  = jsObjName;
     ID          = widgetState.ContainerID + "_" + WidgetID;
 }
Пример #4
0
            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);
            }
Пример #5
0
 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);
     }
 }
Пример #8
0
        void IPostBackEventHandler.RaisePostBackEvent(string eventArgument)
        {
            if (AutoPostBack && !Page.IsPostBackEventControlRegistered)
            {
                Page.AutoPostBackControl = this;
            }

            WidgetState.RaisePostBackEvent(eventArgument);
        }
Пример #9
0
        /// <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;
            }
        }
Пример #10
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            if (this.TargetControl.Visible)
            {
                Page.RegisterRequiresPostBack(this);
                WidgetState.ParseEverything(this.TargetControl);
                WidgetState.RenderCss();
            }
        }
Пример #11
0
 protected virtual void SetParamsFromPublicVariables()
 {
     if (_State != pState)
     {
         pState = _State;
     }
     if (_Visible != pVisible)
     {
         pVisible = _Visible;
     }
 }
Пример #12
0
        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);
            }
        }
Пример #14
0
 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);
 }
Пример #15
0
        /// <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);
            }
        }
Пример #16
0
 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);
 }
Пример #17
0
 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;
     }
 }
Пример #18
0
        protected sealed override void UpdateStateInHierarchy()
        {
            WidgetState previousStateInHierarchy = mStateInHierarchy;

            base.UpdateStateInHierarchy();

            if (previousStateInHierarchy != mStateInHierarchy)
            {
                foreach (UI childUI in mChildUIs)
                {
                    childUI.OnParentSetState(mStateInHierarchy);
                }
            }
        }
Пример #19
0
        /// <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);
            }
        }
Пример #20
0
 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);
     }
 }
Пример #21
0
 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);
     }
 }
Пример #22
0
 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);
     }
 }
Пример #23
0
 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);
 }
Пример #24
0
 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;
     }
 }
Пример #25
0
 protected virtual void SetDefaultOptions()
 {
     WidgetState.SetDefaultOptions();
 }
Пример #26
0
 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;
 }
Пример #27
0
 private Color MenuItemBackgroundColor(WidgetState state)
 {
     if (state == WidgetState.Selected) {
         return Color.White;
     }
     return Color.Transparent;
 }
Пример #28
0
 public Widget(float fontFactor = 1.0f) 
 {
     State = WidgetState.Initialising;
     Type = GetType();
     FontFactor = fontFactor;
 }
Пример #29
0
 internal void InitWidgetState(WidgetState widgetState, string jsObjName)
 {
     WidgetState = widgetState;
     Position = new Point(widgetState.X, widgetState.Y);
     _jsObjName = jsObjName;
     ID = widgetState.ContainerID + "_" + WidgetID;
 }
Пример #30
0
 public static void SetState(DependencyObject obj, WidgetState value)
 {
     obj.SetValue(StateProperty, value);
 }
Пример #31
0
 protected virtual void OnStateInHierarchyChanged(WidgetState previousStateInHierarchy, WidgetState newStateInHierarchy)
 {
 }
Пример #32
0
 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;
 }
Пример #33
0
 protected override void OnStateInHierarchyChanged(WidgetState previousStateInHierarchy, WidgetState newStateInHierarchy)
 {
     UpdateUnityComponents();
 }
Пример #34
0
        /// <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);
            }
        }
Пример #35
0
 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;
     }
 }
Пример #36
0
 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;
     }
 }
Пример #37
0
 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;
     }
 }
Пример #38
0
 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);
 }
Пример #39
0
        /// <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");
        }
Пример #40
0
 protected virtual void OnStateChanged(WidgetState previousState, WidgetState newState)
 {
 }