Beispiel #1
0
        protected override void OnKeyPressInternal(IPointer cursor, KeyCodes code,
                                                   KeyboardModifiers modifiers, InputEventModifier eventModifiers)
        {
            base.OnKeyPressInternal(cursor, code, modifiers, eventModifiers);

            // We are focused.
            animationState.TransistTo(CommonStyleStates.Focused);

            if (code == KeyCodes.C && (modifiers & KeyboardModifiers.LCtrl) != 0)
            {
                if (selectedRange.Y < selectedRange.X)
                {
                    return;
                }

                // We have a copy event.
                Action3 <Label, Vector2i, StringBuilder> t = onTextCopy;
                StringBuilder b = new StringBuilder(SelectedText);

                // Events may alter copy or react on it.
                if (t != null)
                {
                    t(this, selectedRange, b);
                }

                // We add copy to cursor.
                AttachedData attachedData = new AttachedData();
                attachedData.ApplicationID  = Guid.Empty; //< FIXME
                attachedData.Data           = b.ToString();
                attachedData.Representation = null;

                // We attach data.
                cursor.AttachData(attachedData);
            }
        }
Beispiel #2
0
        internal void AddAction_3(double id, string content)
        {
            Action3 action3 = new Action3();

            action3.ID      = id;
            action3.Content = content;
            _actions_3.Add(action3);
        }
Beispiel #3
0
            public ConsoleMethod_Action3(Action3 method, MethodDescription description) : base(description)
            {
                if (method == null)
                {
                    throw new ArgumentNullException(nameof(method));
                }

                this.method = method;
            }
Beispiel #4
0
        void IUserInteractive.OnWheel(IPointer cursor, float deltaWheel)
        {
            OnWheelInternal(cursor, deltaWheel);

            Action3 <Area, IPointer, float> t = onWheel;

            if (t != null)
            {
                t(this, cursor, deltaWheel);
            }
        }
Beispiel #5
0
        void IUserInteractive.OnPointerRelease(IPointer cursor, uint button)
        {
            OnPointerReleaseInternal(cursor, button);

            Action3 <Area, IPointer, uint> t = onMouseReleased;

            if (t != null)
            {
                t(this, cursor, button);
            }
        }
Beispiel #6
0
        void IUserInteractive.OnPointerMove(IPointer cursor, Vector2f deltaMove)
        {
            OnPointerMoveInternal(cursor, deltaMove);

            // We fire event.
            Action3 <Area, IPointer, Vector2f> t = onMouseMove;

            if (t != null)
            {
                t(this, cursor, deltaMove);
            }
        }
Beispiel #7
0
    public IAction CreateAction(ACTION_ID id)
    {
        IAction Action = null;

        switch (id)
        {
        case ACTION_ID.ACTION_1: Action = new Action1(); break;

        case ACTION_ID.ACTION_2: Action = new Action2(); break;

        case ACTION_ID.ACTION_3: Action = new Action3(); break;

        case ACTION_ID.ACTION_4: Action = new Action4(); break;

        case ACTION_ID.ACTION_5: Action = new Action5(); break;

        case ACTION_ID.ACTION_6: Action = new Action6(); break;

        case ACTION_ID.ACTION_DasheBackward: Action = new ActionDashBackward(); break;

        case ACTION_ID.ACTION_DasheForward: Action = new ActionDashForward(); break;

        case ACTION_ID.ACTION_Jab: Action = new ActionJab(); break;

        case ACTION_ID.ACTION_Kick: Action = new ActionKick(); break;

        case ACTION_ID.ACTION_MoveAttack1: Action = new ActionMoveAttack1(); break;

        case ACTION_ID.ACTION_MoveAttack2: Action = new ActionMoveAttack2(); break;

        case ACTION_ID.ACTION_Punch: Action = new ActionPunch(); break;

        case ACTION_ID.ACTION_RangeAttack1: Action = new ActionRangeAttack1(); break;

        case ACTION_ID.ACTION_RangeAttack2: Action = new ActionRangeAttack2(); break;

        case ACTION_ID.ACTION_SpecialAttack1: Action = new ActionSpecialAttack1(); break;

        case ACTION_ID.ACTION_SpecialAttack2: Action = new ActionSpecialAttack2(); break;

        case ACTION_ID.ACTION_Uppercut: Action = new ActionUppercut(); break;

        default: Action = new NullAction(); break;
        }
        ControllerCenter.Instance.ActionSystem.Add((uint)(Time.realtimeSinceStartup) * 100, Action);
        return(Action);
    }
        static void Main(string[] args)
        {
            Action3 line3 = new Action3();

            line3.DoAction("");
            Console.Read();
            //VolatileTest volatileTest = new VolatileTest();
            //for (int i = 0; i < 1000; i++)
            //{
            //    Thread t = new Thread(new ThreadStart(() => { volatileTest.count = i; }));
            //    t.Start();
            //}

            //Thread.Sleep(5000);
            //Console.WriteLine(volatileTest.count);
            //Console.Read();
        }
Beispiel #9
0
        protected Area(SerializationInfo info, StreamingContext context)
        {
            serializationOptions = (WidgetSerialization)info.GetValue("SerializeOptions", typeof(WidgetSerialization));
            zOrder      = info.GetUInt32("ZOrder");
            parent      = (IWidget)info.GetValue("Parent", typeof(IWidget));
            description = info.GetString("Description");
            containedDescriptionShowUpTime  = info.GetSingle("ContainedDescriptionShowUpTime");
            containedDescriptionPositioning = (LayoutAnchor)info.GetValue("ContainedDescriptionPositioning", typeof(LayoutAnchor));
            containedDescriptionObject      = (IDisplayObject)info.GetValue("ContainedDescriptionObject", typeof(IDisplayObject));
            anchor        = (LayoutAnchor)info.GetValue("Anchor", typeof(LayoutAnchor));
            minSize       = (GuiVector2)info.GetValue("MinSize", typeof(GuiVector2));
            maxSize       = (GuiVector2)info.GetValue("MaxSize", typeof(GuiVector2));
            preferredSize = (GuiVector2)info.GetValue("PreferredSize", typeof(GuiVector2));
            preserveRatio = info.GetBoolean("PreserveRatio");
            preferredRect = (GuiRect)info.GetValue("PreferredRect", typeof(GuiRect));
            marginLeft    = (GuiScalar)info.GetValue("MarginLeft", typeof(GuiScalar));
            marginRight   = (GuiScalar)info.GetValue("MarginRight", typeof(GuiScalar));
            marginTop     = (GuiScalar)info.GetValue("MarginTop", typeof(GuiScalar));
            marginBottom  = (GuiScalar)info.GetValue("MarginBottom", typeof(GuiScalar));

            if ((serializationOptions & WidgetSerialization.PersistAllStyles) > 0)
            {
                style = (Style)info.GetValue("Style", typeof(Style));
            }
            else if ((serializationOptions & WidgetSerialization.PersistNonThemeStyles) > 0)
            {
                style = (Style)info.GetValue("Style", typeof(Style));
            }

            if ((serializationOptions & WidgetSerialization.PersistRenderer) > 0)
            {
                renderer = (Themes.IGuiRenderer)info.GetValue("Renderer", typeof(Themes.IGuiRenderer));
            }

            if ((serializationOptions & WidgetSerialization.PersistState) > 0)
            {
                isVisible = info.GetBoolean("IsVisible");
            }

            if ((serializationOptions & WidgetSerialization.PersistAnimations) > 0)
            {
                animationState   = (StyleAnimationController)info.GetValue("StyleAnimationController", typeof(StyleAnimationController));
                activeAnimations = (List <AnimationProcess>)info.GetValue("ActiveAnimations", typeof(List <AnimationProcess>));
            }

            if ((serializationOptions & WidgetSerialization.PersistEventBindings) > 0)
            {
                onChange       = (Action <IPreChangeNotifier>)info.GetValue("OnChange", typeof(Action <IPreChangeNotifier>));
                onMouseOver    = (Action2 <Area, IPointer>)info.GetValue("OnMouseOver", typeof(Action2 <Area, IPointer>));
                onMouseLeave   = (Action2 <Area, IPointer>)info.GetValue("OnMouseLeave", typeof(Action2 <Area, IPointer>));
                onMousePressed = (Action4 <Area, IPointer, uint, InputEventModifier>)info.GetValue("OnMousePressed",
                                                                                                   typeof(Action4 <Area, IPointer, uint, InputEventModifier>));
                onMouseReleased = (Action3 <Area, IPointer, uint>)info.GetValue("OnMouseReleased", typeof(Action3 <Area, IPointer, uint>));
                onWheel         = (Action3 <Area, IPointer, float>)info.GetValue("OnWheel", typeof(Action3 <Area, IPointer, float>));
                onMouseMove     = (Action3 <Area, IPointer, Vector2f>)info.GetValue("OnMouseMove", typeof(Action3 <Area, IPointer, Vector2f>));
                onFocusGain     = (Action <Area>)info.GetValue("OnFocusGain", typeof(Action <Area>));
                onFocusLost     = (Action <Area>)info.GetValue("OnFocusLost", typeof(Action <Area>));
                onKeyPressed    = (Action5 <Area, IPointer, KeyCodes, KeyboardModifiers, InputEventModifier>)info.GetValue(
                    "OnKeyPressed", typeof(Action5 <Area, IPointer, KeyCodes, KeyboardModifiers, InputEventModifier>));
                onKeyReleased      = (Action4 <Area, IPointer, KeyCodes, KeyboardModifiers>)info.GetValue("OnKeyReleased", typeof(Action4 <Area, IPointer, KeyCodes, KeyboardModifiers>));
                onDescriptionShow  = (Action2 <Area, IWidget>)info.GetValue("OnDescriptionShow", typeof(Action2 <Area, IWidget>));
                onDescriptionHide  = (Action2 <Area, IWidget>)info.GetValue("OnDescriptionHide", typeof(Action2 <Area, IWidget>));
                onStyleStateChange = (Action3 <Area, StyleState, StyleState>)info.GetValue("OnStyleStateChange", typeof(Action3 <Area, StyleState, StyleState>));
            }
        }
Beispiel #10
0
 /// <summary>
 /// 创建一个新的控制台方法;
 /// </summary>
 public static Method Create(Action3 method, MethodDescription description)
 {
     return(new ConsoleMethod_Action3(method, description));
 }