public IndexerDeclaration(TypeReference typeReference, ArrayList parameters, Modifier modifier, ArrayList attributes)
 {
     this.type = typeReference;
     this.modifier = modifier;
     this.parameters = parameters;
     this.attributes = attributes;
 }
示例#2
0
        public virtual void Initialize(Modifier modifier, Engine game)
        {
            Game = game;
            Modifier = modifier;

            Initialize();
        }
 public PropertyDeclaration(string name, TypeReference typeReference, Modifier modifier, ArrayList attributes)
 {
     this.name = name;
     this.typeReference = typeReference;
     this.modifier = modifier;
     this.attributes = attributes;
 }
        ArrayList parameters = new ArrayList(); // [ParameterDeclarationExpression]

        #endregion Fields

        #region Constructors

        public ConstructorDeclaration(string name, Modifier modifier, ArrayList parameters, ArrayList attributes)
        {
            this.name     = name;
            this.modifier = modifier;
            this.parameters = parameters;
            this.attributes = attributes;
        }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Column"/> class.
 /// </summary>
 /// <param name="table">The parent table.</param>
 /// <param name="name">The column's name.</param>
 /// <param name="modifier">The modifier.</param>
 internal Column(Table table, string name, Modifier modifier)
 {
     Table = table;
     IsNullable = true;
     Name = name;
     Modifier = modifier;
 }
示例#6
0
 public Field(ReturnType type, string fullyQualifiedName, Modifier m, IRegion region)
 {
     this.returnType = type;
     this.FullyQualifiedName = fullyQualifiedName;
     this.region = region;
     modifiers = (ModifierEnum)m;
 }
示例#7
0
文件: PlotDrag.cs 项目: parnham/NPlot
 /// <summary>
 /// MouseDown method for PlotDrag interaction
 /// </summary>
 /// <param name="X">mouse X position</param>
 /// <param name="Y"> mouse Y position</param>
 /// <param name="keys"> mouse and keyboard modifiers</param>
 /// <param name="ps">the InteractivePlotSurface2D</param>
 public override bool DoMouseDown(int X, int Y, Modifier keys, InteractivePlotSurface2D ps)
 {
     // Only start drag if mouse is inside plot area (excluding axes)
     Rectangle area = ps.PlotAreaBoundingBoxCache;
     if (area.Contains(X,Y)) {
         dragInitiated_ = true;
         lastPoint_ = new Point(X,Y);
         if (((keys & Modifier.Button1) != 0)) {		   // Drag
             if (horizontal_ || vertical_) {
                 ps.plotCursor = CursorType.Hand;
             }
             if (((keys & Modifier.Control) != 0)) {	   // Zoom
                 if (horizontal_)
                     ps.plotCursor = CursorType.LeftRight;
                 if (vertical_)
                     ps.plotCursor = CursorType.UpDown;
                 if (horizontal_ && vertical_)
                     ps.plotCursor = CursorType.Zoom;
             }
         }
         // evaluate focusPoint about which axis is expanded
         focusX = (double)(X - area.Left)/(double)area.Width;
         focusY = (double)(area.Bottom - Y)/(double)area.Height;
     }
     return false;
 }
示例#8
0
        /// <summary>
        /// MouseMove method for Guideline
        /// </summary>
        /// <param name="X">mouse X position</param>
        /// <param name="Y"> mouse Y position</param>
        /// <param name="keys"> mouse and keyboard modifiers</param>
        /// <param name="ps">the InteractivePlotSurface2D</param>
        public override bool DoMouseMove(int X, int Y, Modifier keys, InteractivePlotSurface2D ps)
        {
            Rectangle plotArea = ps.PlotAreaBoundingBoxCache;

            if (drawPending) {
                overRuns += 1;
                return false;
            }

            // note previous guideline ready to erase it
            Rectangle prevExtent = lineExtent;

            // Only display guideline when mouse is within the plotArea
            if (plotArea.Contains(X,Y)) {
                int h = 1;
                int w = plotArea.Right - plotArea.Left + 1;
                lineExtent = new Rectangle (plotArea.X, Y, w, h);
                drawPending = true;
            }
            else {
                lineExtent = Rectangle.Empty;
            }
            ps.QueueDraw (prevExtent);
            ps.QueueDraw (lineExtent);
            return false;
        }
示例#9
0
 public Class(CompilationUnit cu, ClassType t, Modifier m, IRegion region)
 {
     this.cu = cu;
     classType = t;
     this.region = region;
     modifiers = (ModifierEnum)m;
 }
示例#10
0
		public Constructor(Modifier m, IRegion region, IRegion bodyRegion)
		{
			FullyQualifiedName = "ctor";
			this.region     = region;
			this.bodyRegion = bodyRegion;
			modifiers = (ModifierEnum)m;
		}
示例#11
0
文件: Chakram.cs 项目: IdcNoob/Ensage
 public void AddModifierObstacle(Modifier modifier, Unit unit)
 {
     if (Obstacle != null)
     {
         End();
     }
 }
示例#12
0
文件: PlotZoom.cs 项目: parnham/NPlot
        /// <summary>
        /// Mouse Scroll (wheel) method for AxisZoom interaction
        /// </summary>
        public override bool DoMouseScroll(int X, int Y, int direction, Modifier keys, InteractivePlotSurface2D ps)
        {
            double proportion = 0.1*sensitivity_;	// use initial zoom of 10%
            double focusX = 0.5, focusY = 0.5;		// default focus point

            // Zoom direction is +1 for Up/ZoomIn, or -1 for Down/ZoomOut
            proportion *= -direction;

            // delete previous focusPoint drawing - this is all a bit 'tentative'
            ps.QueueDraw (focusRect);

            Rectangle area = ps.PlotAreaBoundingBoxCache;
            if (area.Contains(X,Y)) {
                pF.X = X;
                pF.Y = Y;
                focusX = (double)(X - area.Left)/(double)area.Width;
                focusY = (double)(area.Bottom - Y)/(double)area.Height;
            }

            // Zoom in/out for all defined axes
            ps.CacheAxes();
            ps.ZoomXAxes (proportion,focusX);
            ps.ZoomYAxes (proportion,focusY);

            int x = pF.X-10;
            int y = pF.Y-10;

            focusRect = new Rectangle (x, y, 21, 21);
            // draw new focusRect
            ps.QueueDraw (focusRect);

            return (true);
        }
 public Destructor(string className, Modifier m, IRegion region, IRegion bodyRegion)
 {
     FullyQualifiedName = "~" + className;
     this.region     = region;
     this.bodyRegion = bodyRegion;
     modifiers = (ModifierEnum)m;
 }
示例#14
0
 public bool ApplyModifiers(Stack stack, Modifier mod)
 {
     //This is used to perform the mathematical modifiers.
     int firstValue = stack.Pop();
     Program.form.listBox1.Items.Add("FirstValue is removed from stack.");
     int secondValue = stack.Pop();
     Program.form.listBox1.Items.Add("SecondValue is removed from stack.");
     if (mod == Modifier.Add){
         Push(firstValue+secondValue);
         Program.form.listBox1.Items.Add("Pushed " + (firstValue + secondValue) + " to stack.");
     }
     else if (mod == Modifier.Divide){
         if(secondValue == 0){
             Program.form.listBox1.Items.Add("Can't devide by zero.");
             return false;
         }
         Push(firstValue/secondValue);
         Program.form.listBox1.Items.Add("Pushed " + (firstValue / secondValue) + " to stack.");
     }
     else if (mod == Modifier.Multiply){
         Push(firstValue*secondValue);
         Program.form.listBox1.Items.Add("Pushed " + (firstValue * secondValue) + " to stack.");
     }
     else if (mod == Modifier.Subtract){
         Push(firstValue-secondValue);
         Program.form.listBox1.Items.Add("Pushed " + (firstValue - secondValue) + " to stack.");
     }
     else{
         Program.form.listBox1.Items.Add("Unknown modifier: " + mod); //Just to be sure.
         return false;
     }
     return true;
 }
示例#15
0
 public void Check(Modifier allowed)
 {
     Modifier wrong = cur & (allowed ^ Modifier.All);
     if (wrong != Modifier.None) {
         parser.Error("modifier(s) " + wrong + " not allowed here");
     }
 }
示例#16
0
 public Method(string name, ReturnType type, Modifier m, IRegion region, IRegion bodyRegion)
 {
     FullyQualifiedName = name;
     returnType = type;
     this.region     = region;
     this.bodyRegion = bodyRegion;
     modifiers = (ModifierEnum)m;
 }
 public MethodDeclaration(string name, Modifier modifier, TypeReference typeReference, ArrayList parameters, ArrayList attributes)
 {
     this.name = name;
     this.modifier = modifier;
     this.typeReference = typeReference;
     this.parameters = parameters;
     this.attributes = attributes;
 }
示例#18
0
 public void Add(Modifier m)
 {
     if (!this.HasModifier(m))
     {
         this.items[this.count] = m;
         this.count++;
     }
 }
 public EventDeclaration(TypeReference typeReference, string name, Modifier modifier, ArrayList attributes)
 {
     this.typeReference = typeReference;
     this.name = name;
     this.variableDeclarators = null;
     this.modifier = modifier;
     this.attributes = attributes;
 }
示例#20
0
 public void Add(Modifier m)
 {
     if ((cur & m) == 0) {
         cur |= m;
     } else {
         parser.Error("modifier " + m + " already defined");
     }
 }
示例#21
0
	// Use this for initialization
	void Start () {
		gameControl = GameObject.Find("GameControl").GetComponent("GameControl") as GameControl;
		mod			= gameObject.GetComponent<Modifier>();
		boot_boom	= PlayerPrefs.GetInt("Boot_Boom");
		item_revive		= PlayerPrefs.GetInt("Revive");

		_fb = gameObject.GetComponent<GUIFB>();
	}
 protected FieldDef(Namespace ns, string name, Modifier modifiers)
     : base(
         null,
         (ns is GlobalRootNamespace
              ? new MemberName(name)
              : new MemberName(ns.MemberName, Separators.DoubleColon, name)), modifiers)
 {
 }
示例#23
0
    private void AddProjectileModifier(Modifier modifier)
    {
        ModifierEnumifier.WriteNewModifier(modifier, replacementIndex, 1); //1 should be the index for Projectile modifiers

        ModifierEnumifier.GenerateFile();

        Close();
    }
示例#24
0
 public Field(ReturnType type, string fullyQualifiedName, Modifier m, IRegion region)
 {
     this.returnType = type;
     this.FullyQualifiedName = fullyQualifiedName;
     this.region = region;
     modifiers = (ModifierEnum)m;
     //			Console.WriteLine("modifiers for field {0} are {1} were {2}", fullyQualifiedName, modifiers, m);
 }
示例#25
0
    private void AddMineModifier(Modifier modifier)
    {
        ModifierEnumifier.WriteNewModifier(modifier, replacementIndex, 3); //0 should be the index for mine modifiers

        ModifierEnumifier.GenerateFile();

        Close();
    }
示例#26
0
 public ClassName(Type ty)
     : this(ty.Namespace, Modifier.Public, ty.Name)
 {
     if (ty.IsPublic)
         this.modifier = Modifier.Public;
     else
         this.modifier = Modifier.Internal;
 }
示例#27
0
    private void AddBeamModifier(Modifier modifier)
    {
        ModifierEnumifier.WriteNewModifier(modifier, replacementIndex, 4); //4 should be the index for beam modifiers

        ModifierEnumifier.GenerateFile();

        Close();
    }
示例#28
0
    private void AddScatterModifier(Modifier modifier)
    {
        ModifierEnumifier.WriteNewModifier(modifier, replacementIndex, 2); //2 should be the index for default modifiers

        ModifierEnumifier.GenerateFile();

        Close();
    }
示例#29
0
 public Indexer(ReturnType type, ParameterCollection parameters, Modifier m, IRegion region, IRegion bodyRegion)
 {
     returnType      = type;
     this.parameters = parameters;
     this.region     = region;
     this.bodyRegion = bodyRegion;
     modifiers = (ModifierEnum)m;
 }
示例#30
0
		public Property(string fullyQualifiedName, ReturnType type, Modifier m, IRegion region, IRegion bodyRegion)
		{
			this.FullyQualifiedName = fullyQualifiedName;
			returnType = type;
			this.region = region;
			this.bodyRegion = bodyRegion;
			modifiers = (ModifierEnum)m;
		}
示例#31
0
        protected override void onKeyDown(Key key, int scanCode, Modifier modifiers)
        {
            switch (key)
            {
            case Key.F:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.debugFace--;
                    if (renderer.debugFace < 0)
                    {
                        renderer.debugFace = 5;
                    }
                }
                else
                {
                    renderer.debugFace++;
                    if (renderer.debugFace >= 5)
                    {
                        renderer.debugFace = 0;
                    }
                }
                rebuildBuffers = true;
                break;

            case Key.M:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.debugMip--;
                    if (renderer.debugMip < 0)
                    {
                        renderer.debugMip = (int)renderer.envCube.prefilterCube.CreateInfo.mipLevels - 1;
                    }
                }
                else
                {
                    renderer.debugMip++;
                    if (renderer.debugMip >= renderer.envCube.prefilterCube.CreateInfo.mipLevels)
                    {
                        renderer.debugMip = 0;
                    }
                }
                rebuildBuffers = true;
                break;

            case Key.L:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.lightNumDebug--;
                    if (renderer.lightNumDebug < 0)
                    {
                        renderer.lightNumDebug = (int)renderer.lights.Length - 1;
                    }
                }
                else
                {
                    renderer.lightNumDebug++;
                    if (renderer.lightNumDebug >= renderer.lights.Length)
                    {
                        renderer.lightNumDebug = 0;
                    }
                }
                rebuildBuffers = true;
                break;

            case Key.Keypad0:
            case Key.Keypad1:
            case Key.Keypad2:
            case Key.Keypad3:
            case Key.Keypad4:
            case Key.Keypad5:
            case Key.Keypad6:
            case Key.Keypad7:
            case Key.Keypad8:
            case Key.Keypad9:
                renderer.currentDebugView = (DeferredPbrRenderer.DebugView)(int) key - 320;
                rebuildBuffers            = true;
                break;

            case Key.KeypadDivide:
                renderer.currentDebugView = DeferredPbrRenderer.DebugView.irradiance;
                rebuildBuffers            = true;
                break;

            case Key.S:
                if (modifiers.HasFlag(Modifier.Control))
                {
                    renderer.pipelineCache.Save();
                    Console.WriteLine($"Pipeline Cache saved.");
                }
                else
                {
                    renderer.currentDebugView = DeferredPbrRenderer.DebugView.shadowMap;
                    rebuildBuffers            = true;
                }
                break;

            case Key.Up:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.MoveLight(-Vector4.UnitZ);
                }
                else
                {
                    camera.Move(0, 0, 1);
                }
                break;

            case Key.Down:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.MoveLight(Vector4.UnitZ);
                }
                else
                {
                    camera.Move(0, 0, -1);
                }
                break;

            case Key.Left:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.MoveLight(-Vector4.UnitX);
                }
                else
                {
                    camera.Move(1, 0, 0);
                }
                break;

            case Key.Right:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.MoveLight(Vector4.UnitX);
                }
                else
                {
                    camera.Move(-1, 0, 0);
                }
                break;

            case Key.PageUp:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.MoveLight(Vector4.UnitY);
                }
                else
                {
                    camera.Move(0, 1, 0);
                }
                break;

            case Key.PageDown:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.MoveLight(-Vector4.UnitY);
                }
                else
                {
                    camera.Move(0, -1, 0);
                }
                break;

            case Key.F2:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.exposure -= 0.3f;
                }
                else
                {
                    renderer.exposure += 0.3f;
                }
                rebuildBuffers = true;
                break;

            case Key.F3:
                if (modifiers.HasFlag(Modifier.Shift))
                {
                    renderer.gamma -= 0.1f;
                }
                else
                {
                    renderer.gamma += 0.1f;
                }
                rebuildBuffers = true;
                break;

            case Key.KeypadAdd:
                curModelIndex++;
                if (curModelIndex >= modelPathes.Length)
                {
                    curModelIndex = 0;
                }
                reloadModel = true;
                break;

            case Key.KeypadSubtract:
                curModelIndex--;
                if (curModelIndex < 0)
                {
                    curModelIndex = modelPathes.Length - 1;
                }
                reloadModel = true;
                break;

            default:
                base.onKeyDown(key, scanCode, modifiers);
                return;
            }
            updateViewRequested = true;
        }
示例#32
0
 public static bool IsHasModifierByName(GameUnit unit, Modifier modifier)
 {
     return(unit.ModifierList.Any(mod =>
                                  string.Equals(mod.name, modifier.name, StringComparison.CurrentCultureIgnoreCase)));
 }
示例#33
0
        public static PermissionPolicyData.PermissionPolicyData CreateModifierPermissionPolicy <T>(this IObjectSpace objectSpace, Modifier modifier) where T : ModifierPermissionPolicyData
        {
            var operationPermissionData = objectSpace.CreateObject <T>();

            operationPermissionData.Modifier = modifier;
            return(operationPermissionData);
        }
示例#34
0
        public IPointShape TryToGetPoint(IBaseShape shape, Point2 target, double radius, IHitTest hitTest, Modifier modifier)
        {
            if (!(shape is ConicShape conic))
            {
                throw new ArgumentNullException("shape");
            }

            if (conic.StartPoint.Bounds?.TryToGetPoint(conic.StartPoint, target, radius, hitTest, modifier) != null)
            {
                return(conic.StartPoint);
            }

            if (conic.Point1.Bounds?.TryToGetPoint(conic.Point1, target, radius, hitTest, modifier) != null)
            {
                return(conic.Point1);
            }

            if (conic.Point2.Bounds?.TryToGetPoint(conic.Point2, target, radius, hitTest, modifier) != null)
            {
                return(conic.Point2);
            }

            foreach (var point in conic.Points)
            {
                if (point.Bounds?.TryToGetPoint(point, target, radius, hitTest, modifier) != null)
                {
                    return(point);
                }
            }

            return(null);
        }
示例#35
0
 public static T With <T>(this T modifiable, Modifier mod) where T : IModifiable
 {
     modifiable.Modifier |= mod;
     return(modifiable);
 }
示例#36
0
        public static DialogGUIContentSizer GUIContentSizer(ContentSizeFitter.FitMode widthMode, ContentSizeFitter.FitMode heightMode, Boolean useParentSize = false, Modifier <DialogGUIContentSizer> modifier = null)
        {
            DialogGUIContentSizer element = new DialogGUIContentSizer(widthMode, heightMode, useParentSize);

            if (modifier != null)
            {
                element = modifier(element);
            }
            _elements.Add(element);
            return(element);
        }
示例#37
0
        public void AddModifier(Modifier modifier, Unit9 modifierOwner)
        {
            var obstacle = new ModifierAllyObstacle(this, modifier, modifierOwner);

            this.Pathfinder.AddObstacle(obstacle);
        }
示例#38
0
 public void ConstructorTest(Modifier m, Indentation indentation, string expected)
 {
     System.Diagnostics.Contracts.Contract.Requires(m != null);
     Assert.AreEqual(expected, m.GenerateCode(indentation));
 }
 internal TimingChangeTickRateAction(TimingRecord record, Modifier mod)
     : base(record, mod)
 {
     Type = ActionType.ChangeTickRate;
 }
示例#40
0
 public KeyArgs(KeyCode code, KeyboardState state, Modifier modifier)
 {
     Code     = code;
     Modifier = modifier;
     State    = state;
 }
示例#41
0
        public override void AddModifier(Modifier modifier, Unit9 modifierOwner)
        {
            var obstacle = new ModifierEnemyObstacle(this, modifier, modifierOwner, 600);

            this.Pathfinder.AddObstacle(obstacle);
        }
 internal HitObjectSliderBatchAction(HitObjectRecord record, Modifier mod)
     : base(record, mod)
 {
     Type = ActionType.SliderBatch;
 }
示例#43
0
 public AnonymousLoginPermission(Modifier modifier)
     : base(OperationName)
 {
     Modifier = modifier;
 }
示例#44
0
        public ISet <IBaseShape> TryToGetShapes(IEnumerable <IBaseShape> shapes, Rect2 target, double radius, double scale, Modifier modifier)
        {
            var selected = new HashSet <IBaseShape>();

            foreach (var shape in shapes.Reverse())
            {
                var result = shape.Bounds?.Overlaps(shape, target, radius / scale, this, modifier);
                if (result != null)
                {
                    selected.Add(shape);
                }
            }
            return(selected.Count > 0 ? selected : null);
        }
示例#45
0
        public IBaseShape Overlaps(IBaseShape shape, Rect2 target, double radius, IHitTest hitTest, Modifier modifier)
        {
            if (!(shape is ConicShape conic))
            {
                throw new ArgumentNullException("shape");
            }

            var points = new List <IPointShape>();

            conic.GetPoints(points);

            return(HitTestHelper.Overlap(points, target) ? shape : null);
        }
示例#46
0
 public IPointShape TryToGetPoint(IEnumerable <IBaseShape> shapes, Point2 target, double radius, double scale, Modifier modifier, IPointShape exclude)
 {
     foreach (var shape in shapes.Reverse())
     {
         var result = TryToGetPoint(shape, target, radius, scale, modifier);
         if (result != null && result != exclude)
         {
             return(result);
         }
     }
     return(null);
 }
示例#47
0
文件: Expression.cs 项目: yongaru/uno
 public ModeExpression(Expression exp, Modifier mod)
 {
     Expression = exp;
     Mode       = mod;
 }
 ///<summary>Validates Player health modification.</summary>
 public float ApplyModifier(float baseValue, Modifier modifier)
 {
     return(baseValue * ((float)modifier / 2f));
 }
示例#49
0
 public IBaseShape TryToGetShape(IEnumerable <IBaseShape> shapes, Point2 target, double radius, double scale, Modifier modifier)
 {
     foreach (var shape in shapes.Reverse())
     {
         var result = shape.Bounds?.Contains(shape, target, radius / scale, this, modifier);
         if (result != null)
         {
             return(result);
         }
     }
     return(null);
 }
示例#50
0
        public IBaseShape Overlaps(IBaseShape shape, Rect2 target, double radius, IHitTest hitTest, Modifier modifier)
        {
            if (!(shape is FigureShape figure))
            {
                throw new ArgumentNullException("shape");
            }

            foreach (var figureShape in figure.Shapes)
            {
                var result = figureShape.Bounds?.Overlaps(figureShape, target, radius, hitTest, modifier);
                if (result != null)
                {
                    return(result);
                }
            }
            return(null);
        }
示例#51
0
 public IPointShape TryToGetPoint(IBaseShape shape, Point2 target, double radius, double scale, Modifier modifier)
 {
     return(shape.Bounds?.TryToGetPoint(shape, target, radius / scale, this, modifier));
 }
示例#52
0
        public IPointShape TryToGetPoint(IBaseShape shape, Point2 target, double radius, IHitTest hitTest, Modifier modifier)
        {
            if (!(shape is FigureShape figure))
            {
                throw new ArgumentNullException("shape");
            }

            foreach (var figureShape in figure.Shapes)
            {
                var result = figureShape.Bounds?.TryToGetPoint(figureShape, target, radius, hitTest, modifier);
                if (result != null)
                {
                    return(result);
                }
            }

            foreach (var figurePoint in figure.Points)
            {
                if (figurePoint.Bounds?.TryToGetPoint(figurePoint, target, radius, hitTest, modifier) != null)
                {
                    return(figurePoint);
                }
            }

            return(null);
        }
示例#53
0
        public IBaseShape Contains(IBaseShape shape, Point2 target, double radius, IHitTest hitTest, Modifier modifier)
        {
            if (!(shape is FigureShape figure))
            {
                throw new ArgumentNullException("shape");
            }

            foreach (var figureShape in figure.Shapes)
            {
                var result = figureShape.Bounds?.Contains(figureShape, target, radius, hitTest, modifier);
                if (result != null)
                {
                    if (modifier.HasFlag(Modifier.Shift))
                    {
                        return(result);
                    }
                    else
                    {
                        return(figure);
                    }
                }
            }
            return(null);
        }
示例#54
0
 public static void AddToRemove(Modifier mod)
 {
     removeList.Add(mod);
 }
示例#55
0
        public bool SetModifier(Modifier modifier)
        {
            if (activeModifier == modifier)
            {
                return(false);
            }

            switch (modifier)
            {
            case Modifier.Airboard: {
                controllable = true;
                EndDamagingMove();
                CollisionFlags &= ~CollisionFlags.ApplyGravitation;

                speedY         = 0f;
                externalForceY = 0f;
                internalForceY = 0f;

                activeModifier = Modifier.Airboard;

                MoveInstantly(new Vector2(0f, -16f), MoveType.Relative);
                break;
            }

            case Modifier.Copter: {
                controllable = true;
                EndDamagingMove();
                CollisionFlags &= ~CollisionFlags.ApplyGravitation;

                speedY         = 0f;
                externalForceY = 0f;

                activeModifier = Modifier.Copter;

                copterFramesLeft = 350;
                break;
            }

            case Modifier.LizardCopter: {
                controllable = true;
                EndDamagingMove();
                CollisionFlags &= ~CollisionFlags.ApplyGravitation;

                speedY         = 0f;
                externalForceY = 0f;
                internalForceY = 0f;

                activeModifier = Modifier.LizardCopter;

                copterFramesLeft = 150;

                CopterDecor copter = new CopterDecor();
                copter.OnActivated(new ActorActivationDetails {
                        LevelHandler = levelHandler
                    });
                copter.Parent = this;
                break;
            }

            default: {
                activeModifier = Modifier.None;

                CopterDecor copterDecor = GetFirstChild <CopterDecor>();
                if (copterDecor != null)
                {
                    copterDecor.DecreaseHealth(int.MaxValue);
                }

                CollisionFlags |= CollisionFlags.ApplyGravitation;
                canJump         = true;

                SetAnimation(AnimState.Fall);
                break;
            }
            }

#if MULTIPLAYER && SERVER
            ((LevelHandler)levelHandler).OnPlayerSetModifier(this, modifier);
#endif

            return(true);
        }
示例#56
0
        protected override async void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            PopulateDetails();

            TextEditorControl msilEditor = new TextEditorControl
            {
                IsReadOnly = true,
                Dock       = DockStyle.Fill,
                Text       = Decompiler.DecompileToIL(MethodDef.Body)
            };

            msiltab.Controls.Add(msilEditor);

            TextEditorControl codeEditor = new TextEditorControl
            {
                IsReadOnly = true,
                Dock       = DockStyle.Fill,
                Text       = await Decompiler.GetSourceCode(MethodDef),
                Document   =
                {
                    HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("C#")
                }
            };

            codetab.Controls.Add(codeEditor);

            if (!MethodDef.HasBody)
            {
                hookbutton.Enabled     = false;
                gotohookbutton.Enabled = false;
                return;
            }

            MethodSignature methodsig = Utility.GetMethodSignature(MethodDef);

            bool hookfound = false;

            foreach (Manifest manifest in MainForm.CurrentProject.Manifests)
            {
                foreach (Hook hook in manifest.Hooks)
                {
                    if (hook.Signature.Equals(methodsig) && hook.TypeName == MethodDef.DeclaringType.FullName)
                    {
                        hookfound  = true;
                        methodhook = hook;
                        break;
                    }
                }
            }
            if (hookfound)
            {
                hookbutton.Enabled     = false;
                gotohookbutton.Enabled = true;
            }
            else
            {
                hookbutton.Enabled     = true;
                gotohookbutton.Enabled = false;
            }

            bool modifierfound = false;

            foreach (Manifest manifest in MainForm.CurrentProject.Manifests)
            {
                foreach (Modifier modifier in manifest.Modifiers)
                {
                    if (modifier.Signature.Equals(Utility.GetModifierSignature(MethodDef)) && modifier.TypeName == MethodDef.DeclaringType.FullName)
                    {
                        modifierfound  = true;
                        methodmodifier = modifier;
                        break;
                    }
                }
            }
            if (modifierfound)
            {
                editbutton.Enabled     = false;
                gotoeditbutton.Enabled = true;
            }
            else
            {
                editbutton.Enabled     = true;
                gotoeditbutton.Enabled = false;
            }
        }
示例#57
0
            public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
            {
                Manifest manifest = existingValue != null ? existingValue as Manifest : new Manifest();

                while (reader.Read() && reader.TokenType != JsonToken.EndObject)
                {
                    if (reader.TokenType != JsonToken.PropertyName)
                    {
                        return(null);
                    }

                    string propname = (string)reader.Value;
                    if (!reader.Read())
                    {
                        return(null);
                    }

                    switch (propname)
                    {
                    case "AssemblyName":
                        manifest.AssemblyName = (string)reader.Value;
                        if (!IsExtensionValid(manifest.AssemblyName))
                        {
                            manifest.AssemblyName += ".dll";
                        }

                        break;

                    case "Hooks":
                        if (reader.TokenType != JsonToken.StartArray)
                        {
                            return(null);
                        }

                        while (reader.Read() && reader.TokenType != JsonToken.EndArray)
                        {
                            if (reader.TokenType != JsonToken.StartObject)
                            {
                                return(null);
                            }

                            if (!reader.Read())
                            {
                                return(null);
                            }

                            if (reader.TokenType != JsonToken.PropertyName)
                            {
                                return(null);
                            }

                            if ((string)reader.Value != "Type")
                            {
                                return(null);
                            }

                            if (!reader.Read())
                            {
                                return(null);
                            }

                            string hooktype = (string)reader.Value;
                            Type   t        = Hook.GetHookType(hooktype);
                            if (t == null)
                            {
                                throw new Exception("Unknown hook type");
                            }

                            Hook hook = Activator.CreateInstance(t) as Hook;
                            if (!reader.Read())
                            {
                                return(null);
                            }

                            if (reader.TokenType != JsonToken.PropertyName)
                            {
                                return(null);
                            }

                            if ((string)reader.Value != "Hook")
                            {
                                return(null);
                            }

                            if (!reader.Read())
                            {
                                return(null);
                            }

                            serializer.Populate(reader, hook);
                            if (!reader.Read())
                            {
                                return(null);
                            }

                            if (!Path.HasExtension(hook.AssemblyName))
                            {
                                hook.AssemblyName += ".dll";
                            }

                            manifest.Hooks.Add(hook);
                        }
                        break;

                    case "Modifiers":
                        if (reader.TokenType != JsonToken.StartArray)
                        {
                            return(null);
                        }

                        while (reader.Read() && reader.TokenType != JsonToken.EndArray)
                        {
                            if (reader.TokenType != JsonToken.StartObject)
                            {
                                return(null);
                            }

                            Modifier modifier = Activator.CreateInstance(typeof(Modifier)) as Modifier;
                            serializer.Populate(reader, modifier);

                            if (!Path.HasExtension(modifier.AssemblyName))
                            {
                                modifier.AssemblyName += ".dll";
                            }

                            manifest.Modifiers.Add(modifier);
                        }
                        break;

                    case "Fields":
                        if (reader.TokenType != JsonToken.StartArray)
                        {
                            return(null);
                        }

                        while (reader.Read() && reader.TokenType != JsonToken.EndArray)
                        {
                            if (reader.TokenType != JsonToken.StartObject)
                            {
                                return(null);
                            }

                            Field field = Activator.CreateInstance(typeof(Field)) as Field;
                            serializer.Populate(reader, field);

                            if (!Path.HasExtension(field.AssemblyName))
                            {
                                field.AssemblyName += ".dll";
                            }

                            manifest.Fields.Add(field);
                        }
                        break;
                    }
                }
                foreach (Hook hook in manifest.Hooks)
                {
                    if (!string.IsNullOrWhiteSpace(hook.BaseHookName))
                    {
                        foreach (Hook baseHook in manifest.Hooks)
                        {
                            if (baseHook.Name.Equals(hook.BaseHookName))
                            {
                                hook.BaseHook = baseHook;
                                break;
                            }
                        }

                        if (hook.BaseHook == null)
                        {
                            throw new Exception("BaseHook missing: " + hook.BaseHookName);
                        }
                    }

                    if (hook is Simple)
                    {
                        var simple = hook as Simple;
                        if (!string.IsNullOrWhiteSpace(simple.DependsOnFieldName))
                        {
                            foreach (var field in manifest.Fields)
                            {
                                if (field.Name.Equals(simple.DependsOnFieldName))
                                {
                                    simple.DependsOnField = field;
                                    break;
                                }
                            }

                            if (simple.DependsOnField == null)
                            {
                                throw new Exception("DependsOnField missing: " + simple.DependsOnFieldName);
                            }
                        }
                    }
                }
                return(manifest);
            }
示例#58
0
        public void AddModifierObstacle(Modifier modifier, Unit sender)
        {
            var obstacle = new ChronosphereObstacle(this, sender.Position, modifier);

            this.Pathfinder.AddObstacle(obstacle);
        }
示例#59
0
        public static DialogGUIScrollList GUIScrollList(Vector2 size, Vector2 contentSize, Boolean hScroll, Boolean vScroll, Action optionsBuilder, Modifier <DialogGUIScrollList> modifier = null)
        {
            DialogGUIScrollList element = new DialogGUIScollListFixed(size, contentSize, hScroll, vScroll, Declare(optionsBuilder)[0] as DialogGUILayoutBase);

            if (modifier != null)
            {
                element = modifier(element);
            }
            _elements.Add(element);
            return(element);
        }
示例#60
0
        public override void OnBeReplaced(Character target, Modifier byModifier)
        {
            base.OnBeReplaced(target, byModifier);

            targetDamageTypeComponent.RemoveOverriddenSkillDamageType(trackerId);
        }