当前位置: 首页>>代码示例>>C#>>正文


C# Modifiers.HasModifier方法代码示例

本文整理汇总了C#中Modifiers.HasModifier方法的典型用法代码示例。如果您正苦于以下问题:C# Modifiers.HasModifier方法的具体用法?C# Modifiers.HasModifier怎么用?C# Modifiers.HasModifier使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Modifiers的用法示例。


在下文中一共展示了Modifiers.HasModifier方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoControlGroup

        public void DoControlGroup(World world, int group, Modifiers mods, int MultiTapCount)
        {
            var addModifier = Platform.CurrentPlatform == PlatformType.OSX ? Modifiers.Meta : Modifiers.Ctrl;
            if (mods.HasModifier(addModifier))
            {
                if (actors.Count == 0)
                    return;

                if (!mods.HasModifier(Modifiers.Shift))
                    controlGroups[group].Clear();

                for (var i = 0; i < 10; i++)	/* all control groups */
                    controlGroups[i].RemoveAll(a => actors.Contains(a));

                controlGroups[group].AddRange(actors);
                return;
            }

            if (mods.HasModifier(Modifiers.Alt) || MultiTapCount >= 2)
            {
                Game.viewport.Center(controlGroups[group]);
                return;
            }

            Combine(world, controlGroups[group],
                mods.HasModifier(Modifiers.Shift), false);
        }
开发者ID:nevelis,项目名称:OpenRA,代码行数:27,代码来源:Selection.cs

示例2: DoControlGroup

		public void DoControlGroup(World world, WorldRenderer worldRenderer, int group, Modifiers mods, int MultiTapCount)
		{
			var addModifier = Platform.CurrentPlatform == PlatformType.OSX ? Modifiers.Meta : Modifiers.Ctrl;
			if (mods.HasModifier(addModifier))
			{
				if (actors.Count == 0)
					return;

				if (!mods.HasModifier(Modifiers.Shift))
					controlGroups[group].Clear();

				for (var i = 0; i < 10; i++)	/* all control groups */
					controlGroups[i].RemoveAll(a => actors.Contains(a));

				controlGroups[group].AddRange(actors.Where(a => a.Owner == world.LocalPlayer));
				return;
			}

			var groupActors = controlGroups[group].Where(a => !a.IsDead());

			if (mods.HasModifier(Modifiers.Alt) || MultiTapCount >= 2)
			{
				worldRenderer.Viewport.Center(groupActors);
				return;
			}

			Combine(world, groupActors, mods.HasModifier(Modifiers.Shift), false);
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:28,代码来源:Selection.cs

示例3: DoControlGroup

        public void DoControlGroup(World world, int group, Modifiers mods)
        {
            if (mods.HasModifier(Modifiers.Ctrl))
            {
                if (actors.Count == 0)
                    return;

                controlGroups[group].Clear();

                for (var i = 0; i < 10; i++)	/* all control groups */
                    controlGroups[i].RemoveAll(a => actors.Contains(a));

                controlGroups[group].AddRange(actors);
                return;
            }

            if (mods.HasModifier(Modifiers.Alt))
            {
                Game.viewport.Center(controlGroups[group]);
                return;
            }

            Combine(world, controlGroups[group],
                mods.HasModifier(Modifiers.Shift), false);
        }
开发者ID:comradpara,项目名称:OpenRA,代码行数:25,代码来源:Selection.cs

示例4: HandleEvent

		bool HandleEvent(ProductionIcon icon, MouseButton btn, Modifiers modifiers)
		{
			var startCount = modifiers.HasModifier(Modifiers.Shift) ? 5 : 1;
			var cancelCount = modifiers.HasModifier(Modifiers.Ctrl) ? CurrentQueue.QueueLength : startCount;
			var item = icon.Queued.FirstOrDefault();
			var handled = btn == MouseButton.Left ? HandleLeftClick(item, icon, startCount)
				: btn == MouseButton.Right ? HandleRightClick(item, icon, cancelCount)
				: btn == MouseButton.Middle ? HandleMiddleClick(item, icon, cancelCount)
				: false;

			if (!handled)
				Game.Sound.Play(DisabledTabClick);

			return true;
		}
开发者ID:CH4Code,项目名称:OpenRA,代码行数:15,代码来源:ProductionPaletteWidget.cs

示例5: ProcessVariableDeclaration

        private FixedOffsetVariable ProcessVariableDeclaration(Token variableType, DataGroup container, Token parent, Modifiers modifiers)
        {
            FixedOffsetVariable newVariable;
            int thisSize = 0;
            if (variableType.Type == TokenType.StructType)
            {
                ScriptStruct childStruct = (ScriptStruct)variableType.Value;
                if (childStruct.IsManaged)
                {
                    thisSize = FixedOffsetVariable.POINTER_SIZE_IN_BYTES;
                    newVariable = new FixedOffsetVariable(variableType, container.SizeInBytes, true);

                    if ((childStruct != container) &&
                        (parent != null) &&
                        (childStruct.HasNonImportedMemberOfType(parent)))
                    {
                        throw new CompilerMessage(ErrorCode.CircularReference, "The type '" + childStruct.Name + "' has a reference to this struct, so you cannot also have a reference this way round");
                    }
                }
                else if (childStruct == container)
                {
                    throw new CompilerMessage(ErrorCode.StructInsideItself, "A struct cannot be contained within itself");
                }
                else
                {
                    thisSize = childStruct.SizeInBytes;
                    newVariable = new FixedOffsetVariable(variableType, container.SizeInBytes, thisSize);
                }
            }
            else if (variableType is ScalarVariableTypeToken)
            {
                thisSize = ((ScalarVariableTypeToken)variableType).SizeInBytes;
                newVariable = new FixedOffsetVariable(variableType, container.SizeInBytes, thisSize);
            }
            else if (variableType.Type == TokenType.EnumType)
            {
                thisSize = FixedOffsetVariable.ENUM_SIZE_IN_BYTES;
                newVariable = new FixedOffsetVariable(variableType, container.SizeInBytes, thisSize);
            }
            else
            {
                throw new CompilerMessage(ErrorCode.CannotUseTypeInStruct, "Cannot add variable of type '" + variableType.Name + "' to struct");
            }
            newVariable.IsAttributeProperty = modifiers.HasModifier(Modifiers.ATTRIBUTE);
            newVariable.IsImported = modifiers.HasModifier(Modifiers.IMPORT);

            if ((newVariable.IsAttributeProperty) &&
                (!newVariable.IsImported))
            {
                throw new CompilerMessage(ErrorCode.AttributesMustBeImported, "Attribute types must be imported");
            }

            if ((newVariable.IsImported) &&
                (!newVariable.IsAttributeProperty) &&
                (parent != null))
            {
                throw new CompilerMessage(ErrorCode.InvalidUseOfKeyword, "'import' is invalid in this context");
            }

            if (newVariable.IsImported)
            {
                // No memory needed for imported vars
                newVariable.Offset = 0;
                thisSize = 0;
            }

            container.Members.Add(newVariable);
            container.SizeInBytes += thisSize;
            return newVariable;
        }
开发者ID:Aquilon96,项目名称:ags,代码行数:70,代码来源:ScriptCompiler.cs


注:本文中的Modifiers.HasModifier方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。