Esempio n. 1
0
        protected override void CustomizeCompiler(Boo.Lang.Compiler.BooCompiler compiler, Boo.Lang.Compiler.CompilerPipeline pipeline, string[] urls)
        {
            compiler.Parameters.Ducky = true;

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(
                _baseType, "Prepare", _namespaces));
        }
 public override void OnModule(Boo.Lang.Compiler.Ast.Module module)
 {
     EnterNamespace(InternalModule.ScopeFor(module));
     VisitTypeDefinitionBody(module);
     Visit(module.AssemblyAttributes);
     LeaveNamespace();
 }
 /// <summary>
 /// Enters the module.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <returns></returns>
 public override bool EnterModule(Boo.Lang.Compiler.Ast.Module node)
 {
     currentModule = node.Name;
     if (moduleNameToContainedTypes.ContainsKey(currentModule) == false)
         moduleNameToContainedTypes[currentModule] = new List<string>();
     return base.EnterModule(node);
 }
Esempio n. 4
0
 public override void OnModule(Boo.Lang.Compiler.Ast.Module module)
 {
     EnterNamespace((INamespace)TypeSystemServices.GetEntity(module));
     Visit(module.Members);
     Visit(module.Globals);
     LeaveNamespace();
 }
Esempio n. 5
0
        /// <summary>
        /// Called when visting a reference expression.
        /// Will turn reference expressions with initial @ to string literals
        /// </summary>
        /// <param name="node">The node.</param>
        public override void OnReferenceExpression(Boo.Lang.Compiler.Ast.ReferenceExpression node)
        {
            if(node.Name.StartsWith("@")==false)
                return;

            ReplaceCurrentNode(new StringLiteralExpression(node.Name.Substring(1)));
        }
Esempio n. 6
0
		public static WSABooParser CreateParser(int tabSize, string readerName, TextReader reader, Boo.Lang.Parser.ParserErrorHandler errorHandler)
		{
			var parser = new WSABooParser(CreateBooLexer(tabSize, readerName, reader));
			parser.setFilename(readerName);
			parser.Error += errorHandler;
			return parser;
		}
Esempio n. 7
0
 public override void OnArrayTypeReference(Boo.Lang.Compiler.Ast.ArrayTypeReference node)
 {
     MethodInvocationExpression mie = new MethodInvocationExpression(
             node.LexicalInfo,
             CreateReference(node, "Boo.Lang.Compiler.Ast.ArrayTypeReference"));
     mie.Arguments.Add(Serialize(node.LexicalInfo));
     if (ShouldSerialize(node.IsPointer))
     {
         mie.NamedArguments.Add(
             new ExpressionPair(
                 CreateReference(node, "IsPointer"),
                 Serialize(node.IsPointer)));
     }
     if (ShouldSerialize(node.ElementType))
     {
         mie.NamedArguments.Add(
             new ExpressionPair(
                 CreateReference(node, "ElementType"),
                 Serialize(node.ElementType)));
     }
     if (ShouldSerialize(node.Rank))
     {
         mie.NamedArguments.Add(
             new ExpressionPair(
                 CreateReference(node, "Rank"),
                 Serialize(node.Rank)));
     }
     Push(mie);
 }
Esempio n. 8
0
		public virtual void OnTypeMemberStatement(Boo.Lang.Compiler.Ast.TypeMemberStatement node)
		{	
			if (EnterTypeMemberStatement(node))
			{
				StatementModifier currentModifierValue = node.Modifier;
				if (null != currentModifierValue)
				{			
					StatementModifier newValue = (StatementModifier)VisitNode(currentModifierValue);
					if (!object.ReferenceEquals(newValue, currentModifierValue))
					{
						node.Modifier = newValue;
					}
				}
				TypeMember currentTypeMemberValue = node.TypeMember;
				if (null != currentTypeMemberValue)
				{			
					TypeMember newValue = (TypeMember)VisitNode(currentTypeMemberValue);
					if (!object.ReferenceEquals(newValue, currentTypeMemberValue))
					{
						node.TypeMember = newValue;
					}
				}

				LeaveTypeMemberStatement(node);
			}
		}
Esempio n. 9
0
        protected override void CustomizeCompiler(Boo.Lang.Compiler.BooCompiler compiler, Boo.Lang.Compiler.CompilerPipeline pipeline, string[] urls)
        {
            compiler.Parameters.Ducky = true;

            List<Assembly> asmss = new List<Assembly>();
            if (RefAllLoadedAssemblies)
            {
                asmss.AddRange(AppDomain.CurrentDomain.GetAssemblies());
            }
            if (ReferencedAssemblies != null) asmss.AddRange(ReferencedAssemblies);

            foreach (Assembly asm in asmss)
            {
                try
                {
                    string loc = asm.Location;
                    if (!compiler.Parameters.References.Contains(asm)) compiler.Parameters.References.Add(asm);
                }
                catch (Exception) { log.Debug("Error adding assembly dependency: {0}", asm.FullName); }
            }

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(ScriptDSLBase), "Prepare", Namespaces));
            var st2 = new AutoReferenceFilesCompilerStep(_baseDir + "\\include");
            pipeline.Insert(2, st2);
        }
Esempio n. 10
0
 protected void reply_with_one_of(Boo.Lang.List replies)
 {
     var random = new Random();
     var indexToUse = random.Next(replies.Count);
     Console.WriteLine("replies.Count = {0}, using index {1}", replies.Count, indexToUse);
     reply(replies[indexToUse] as string);
 }
Esempio n. 11
0
		public override void LeaveEnumDefinition(Boo.Lang.Compiler.Ast.EnumDefinition node)
		{
			var designator=new StringBuilder();
			designator.Append("T:");
			designator.Append(node.FullName);
			this.ProcessDocumentation(designator.ToString(), node);
			base.LeaveEnumDefinition(node);
		}
 public static void Prepare(Boo.Lang.Compiler.Pipelines.Parse result)
 {
     if(-1!=result.Find(typeof(BooParsingStep))){
         result.InsertAfter(typeof (BooParsingStep), new IncludeAstMacroExpandStep());
     }else if (-1!=result.Find(typeof(WSABooParsingStep))){
         result.InsertAfter(typeof(WSABooParsingStep), new IncludeAstMacroExpandStep());
     }
 }
Esempio n. 13
0
 public static CompilerError AttributeApplicationError(Exception error, Boo.Lang.Compiler.Ast.Attribute attribute, Type attributeType)
 {
     return new CompilerError("BCE0009",
                               attribute.LexicalInfo,
                               error,
                               attributeType,
                               error.Message);
 }
Esempio n. 14
0
		public virtual void OnCompileUnit(Boo.Lang.Compiler.Ast.CompileUnit node)
		{				
			if (EnterCompileUnit(node))
			{
				Visit(node.Modules);
				LeaveCompileUnit(node);
			}
		}
Esempio n. 15
0
		public virtual void OnExplicitMemberInfo(Boo.Lang.Compiler.Ast.ExplicitMemberInfo node)
		{				
			if (EnterExplicitMemberInfo(node))
			{
				Visit(node.InterfaceType);
				LeaveExplicitMemberInfo(node);
			}
		}
Esempio n. 16
0
		public virtual void OnTypeMemberStatement(Boo.Lang.Compiler.Ast.TypeMemberStatement node)
		{				
			if (EnterTypeMemberStatement(node))
			{
				Visit(node.Modifier);
				Visit(node.TypeMember);
				LeaveTypeMemberStatement(node);
			}
		}
Esempio n. 17
0
		protected string GetDocumentation(Boo.Lang.Compiler.Ast.Module module)
		{
			string doc = module.Documentation;
			if (null == module.Documentation)
			{
				Assert.Fail(string.Format("Test case '{0}' does not have a docstring!", module.LexicalInfo.FileName));
			}
			return doc;
		}
Esempio n. 18
0
        protected override void CustomizeCompiler(Boo.Lang.Compiler.BooCompiler compiler, Boo.Lang.Compiler.CompilerPipeline pipeline, string[] urls)
        {
            Logger log = LogManager.GetCurrentClassLogger();
            compiler.Parameters.Ducky = true;
            compiler.Parameters.Debug = true;

            

            pipeline.Insert(1, new ImplicitBaseClassCompilerStep(typeof(ProcessDefDSLBase), "Prepare", _namespaces));
        }
Esempio n. 19
0
        public void AnotherUnflatTest()
        {
            var flat = new FlatBoo { Boo1Id = 5 };
            var boo = new Boo();

            boo.InjectFrom<UnflatLoopInjection>(flat);

            boo.Boo1Id.IsEqualTo(5);
            boo.Boo1.IsEqualTo(null);
        }
Esempio n. 20
0
		void IAstVisitor.OnExplicitMemberInfo(Boo.Lang.Compiler.Ast.ExplicitMemberInfo node)
		{	
			{
				var interfaceType = node.InterfaceType;
				if (interfaceType != null)
					interfaceType.Accept(this);
			}
			var handler = OnExplicitMemberInfo;
			if (handler != null)
				handler(node);
		}
Esempio n. 21
0
        protected override void CustomizeCompiler(Boo.Lang.Compiler.BooCompiler compiler, Boo.Lang.Compiler.CompilerPipeline pipeline, string[] urls)
        {
            compiler.Parameters.Ducky = true;

            var customStep = new AnonymousBaseClassCompilerStep(typeof(ArghSettings), "Build", "Argh");

            pipeline.Insert(1, customStep);
            pipeline.Insert(2, new UseSymbolsStep());

            pipeline.InsertBefore(typeof(ProcessMethodBodiesWithDuckTyping), new CapitalisationCompilerStep());
            pipeline.InsertBefore(typeof(ProcessMethodBodiesWithDuckTyping), new UnderscorNamingConventionsToPascalCaseCompilerStep());

            compiler.Parameters.Pipeline.Replace(typeof(ProcessMethodBodiesWithDuckTyping), new UnknownHashLiteralKeyToStringLiteral());
        }
 public void AssertValid()
 {
     ValidatorEngine ve = new ValidatorEngine();
     ve.AssertValid(new AnyClass()); // not cause exception
     try
     {
         Boo b = new Boo();
         ve.AssertValid(b);
         Assert.Fail("An invalid entity not throw exception.");
     }
     catch (InvalidStateException)
     {
         // OK
     }
 }
Esempio n. 23
0
		void IAstVisitor.OnTypeMemberStatement(Boo.Lang.Compiler.Ast.TypeMemberStatement node)
		{	
			{
				var modifier = node.Modifier;
				if (modifier != null)
					modifier.Accept(this);
			}
			{
				var typeMember = node.TypeMember;
				if (typeMember != null)
					typeMember.Accept(this);
			}
			var handler = OnTypeMemberStatement;
			if (handler != null)
				handler(node);
		}
Esempio n. 24
0
 public override void LeaveUnaryExpression(Boo.Lang.Compiler.Ast.UnaryExpression node)
 {
     switch (node.Operator)
     {
         case UnaryOperatorType.UnaryNegation:
         {
             LeaveUnaryNegation(node);
             break;
         }
         case UnaryOperatorType.OnesComplement:
         {
             LeaveOnesCompliment(node);
             break;
         }
     }
 }
Esempio n. 25
0
		void IAstVisitor.OnCompileUnit(Boo.Lang.Compiler.Ast.CompileUnit node)
		{	
			{
				var modules = node.Modules;
				if (modules != null)
				{
					var innerList = modules.InnerList;
					var count = innerList.Count;
					for (var i=0; i<count; ++i)
						innerList.FastAt(i).Accept(this);
				}
			}
			var handler = OnCompileUnit;
			if (handler != null)
				handler(node);
		}
Esempio n. 26
0
		public override void LeaveModule(Boo.Lang.Compiler.Ast.Module module)
		{
			if (module.ContainsAnnotation("merged-module"))
				return;

			var moduleNamespace = module.EnclosingNamespace != null ? module.EnclosingNamespace.Name : string.Empty;
			foreach (Import import in module.Imports)
			{
				if (import.Entity == Error.Default)
					continue;

				//do not be pedantic about System, the corlib is to be ref'ed anyway
				if (ImportAnnotations.IsUsedImport(import) || import.Namespace == moduleNamespace || import.Namespace == "System")
					continue;
				Warnings.Add(CompilerWarningFactory.NamespaceNeverUsed(import) );
			}
		}
Esempio n. 27
0
        public override void LeaveModule(Boo.Lang.Compiler.Ast.Module module)
        {
            if (module.ContainsAnnotation("merged-module"))
                return;

            foreach (Import import in module.Imports)
            {
                //do not be pedantic about System, the corlib is to be ref'ed anyway
                if (import.NamespaceUsed || import.Namespace == "System") continue;
                if (null == module.EnclosingNamespace
                    || module.EnclosingNamespace.Name != import.Namespace)
                {
                    Warnings.Add(
                        CompilerWarningFactory.NamespaceNeverUsed(import) );
                }
            }
        }
        public override void LeaveMethodInvocationExpression(Boo.Lang.Compiler.Ast.MethodInvocationExpression node)
        {
            ICallableType callable = node.Target.ExpressionType as ICallableType;
            if (callable != null)
            {
                CallableSignature signature = callable.GetSignature();
                if (!signature.AcceptVarArgs) return;

                ExpandInvocation(node, signature.Parameters);
                return;
            }

            IMethod method = TypeSystemServices.GetOptionalEntity(node.Target) as IMethod;
            if (null == method || !method.AcceptVarArgs) return;

            ExpandInvocation(node, method.GetParameters());
        }
    static void Main(string[] args)
    {
        Boo b = new Boo {
            BooMember = 5
        };

        Console.WriteLine(b.BooMember);

        Foo f = new Foo(b);

        // b is unaffected by the method code which is making new object
        Console.WriteLine(b.BooMember);

        Foo g = new Foo(ref b);

        // b started pointing to new memory location (changed in the method code)
        Console.WriteLine(b.BooMember);
    }
Esempio n. 30
0
            public void should_validate()
            {
                var payload = new Boo {
                    Num = 13, Str = string.Empty
                };

                var validator = new BooValidator();

                ValidationResult result = validator.Validate(new Message <Boo>("label".ToMessageLabel(), payload));

                result.IsValid.Should().
                BeFalse();
                result.BrokenRules.Should().
                HaveCount(1);
                result.BrokenRules.First().
                Description.Should().
                Contain("Str");
            }
Esempio n. 31
0
		public override void OnImport(Boo.Lang.Compiler.Ast.Import import)
		{
			if (IsAlreadyBound(import))
				return;

			if (null != import.AssemblyReference)
			{
				ImportFromAssemblyReference(import);
				return;
			}

			var entity = ResolveImport(import);
			if (HandledAsImportError(import, entity) || HandledAsDuplicatedNamespace(import, entity))
				return;

			Context.TraceInfo("{1}: import reference '{0}' bound to {2}.", import, import.LexicalInfo, entity.FullName);
			import.Entity = ImportedNamespaceFor(import, entity);
		}
        public override void LeaveMethodInvocationExpression(Boo.Lang.Compiler.Ast.MethodInvocationExpression node)
        {
            IMethod method = node.Target.Entity as IMethod;
            if (null != method && method.AcceptVarArgs)
            {
                ExpandInvocation(node, method.GetParameters());
                return;
            }

            ICallableType callable = node.Target.ExpressionType as ICallableType;
            if (callable != null)
            {
                CallableSignature signature = callable.GetSignature();
                if (!signature.AcceptVarArgs) return;

                ExpandInvocation(node, signature.Parameters);
                return;
            }
        }
        public static void Test()
        {
            Foo foo = new Foo();

            // Usage #1 //
            ClassA classA = foo;

            classA.ClassAMethod();

            // Usage #2
            ((ClassB)foo).ClassBMethod();

            ln();

            Boo boo = new Boo();

            ((ClassA)boo).ClassAMethod();
            ((ClassB)boo).ClassBMethod();
            ((ClassC)boo).ClassCMethod();
        }
Esempio n. 34
0
        public void Init()
        {
            _dataset = new Boo[Count];
            for (var i = 0; i < _dataset.Length; i++)
            {
                _dataset[i] = new Boo
                {
                    Bool   = i % 10 == 0,
                    Float  = i,
                    Int    = i,
                    Double = i
                };
            }

            _basicMapper    = new BasicMapper <Foo>();
            _compiledMapper = new CompiledMapper <Foo>();

            var config = new MapperConfiguration(cfg => cfg.CreateMap <Boo, Foo>());

            _autoMapper = config.CreateMapper();
        }
        public void InitializeValidators()
        {
            ValidatorEngine  ve   = new ValidatorEngine();
            XmlConfiguration nhvc = new XmlConfiguration();

            nhvc.Properties[Environment.ApplyToDDL]               = "false";
            nhvc.Properties[Environment.AutoregisterListeners]    = "false";
            nhvc.Properties[Environment.ValidatorMode]            = "overrideattributewithExternal";
            nhvc.Properties[Environment.MessageInterpolatorClass] = typeof(PrefixMessageInterpolator).AssemblyQualifiedName;
            string an = Assembly.GetExecutingAssembly().FullName;

            nhvc.Mappings.Add(new MappingConfiguration(an, "NHibernate.Validator.Tests.Base.Address.nhv.xml"));
            ve.Configure(nhvc);
            Assert.IsNotNull(ve.GetValidator <Address>());

            Assert.IsNull(ve.GetValidator <Boo>());
            // Validate something and then its validator is initialized
            Boo b = new Boo();

            ve.IsValid(b);
            Assert.IsNotNull(ve.GetValidator <Boo>());
        }
            public void should_replace_validator()
            {
                var registry = new MessageValidatorRegistry();

                registry.Register(new BooValidator());

                var stubValidator = new Mock <IMessageValidatorOf <Boo> >();

                stubValidator.Setup(v => v.Validate(It.IsAny <IMessage>())).
                Returns(ValidationResult.Valid);

                registry.Register(stubValidator.Object);

                var payload = new Boo {
                    Num = 3, Str = "this"
                };

                registry.Invoking(r => r.Validate(new Message <Boo>("label".ToMessageLabel(), payload))).
                ShouldNotThrow();

                stubValidator.Verify(v => v.Validate(It.IsAny <IMessage>()), Times.Once);
            }
Esempio n. 37
0
            public void should_change_message_payload()
            {
                var processor = new Translator(
                    m => string.Format("Got : {0}", ((Boo)m.Payload).A));

                var payload = new Boo {
                    A = 10
                };

                var message = new Message <Boo>(
                    "boo".ToMessageLabel(),
                    new Dictionary <string, object> {
                    { "This", "That" }
                },
                    payload);

                var result = processor.Apply(message).ToList();

                result.Should().HaveCount(1);
                result.Single().Label.Name.Should().Be("boo");
                result.Single().Payload.Should().Be("Got : 10");
            }
Esempio n. 38
0
        public void LogWithDifferentLevels(Guid arg1, float arg2, TimeSpan arg3, Boo arg4)
        {
            _testLogWriter.Verify = (context, message) => context.Level.Should().Be(LogLevel.Trace);

            _logger.Trace(Template0);
            _logger.Trace(Template1, arg1);
            _logger.Trace(Template2, arg1, arg2);
            _logger.Trace(Template3, arg1, arg2, arg3);
            _logger.Trace(Template4, arg1, arg2, arg3, arg4);

            _testLogWriter.Verify = (context, message) => context.Level.Should().Be(LogLevel.Debug);

            WriteDebug(_logger, arg1, arg2, arg3, arg4);

            _testLogWriter.Verify = (context, message) => context.Level.Should().Be(LogLevel.Info);

            _logger.Info(Template0);
            _logger.Info(Template1, arg1);
            _logger.Info(Template2, arg1, arg2);
            _logger.Info(Template3, arg1, arg2, arg3);
            _logger.Info(Template4, arg1, arg2, arg3, arg4);

            _testLogWriter.Verify = (context, message) => context.Level.Should().Be(LogLevel.Warning);

            _logger.Warning(Template0);
            _logger.Warning(Template1, arg1);
            _logger.Warning(Template2, arg1, arg2);
            _logger.Warning(Template3, arg1, arg2, arg3);
            _logger.Warning(Template4, arg1, arg2, arg3, arg4);

            _testLogWriter.Verify = (context, message) => context.Level.Should().Be(LogLevel.Error);

            _logger.Error(Template0);
            _logger.Error(Template1, arg1);
            _logger.Error(Template2, arg1, arg2);
            _logger.Error(Template3, arg1, arg2, arg3);
            _logger.Error(Template4, arg1, arg2, arg3, arg4);
        }
Esempio n. 39
0
    static void Main(string[] args)
    {
        Foo f = new Foo {
            I = 1
        };

        //Reference object passed by value.
        //We can change reference object itself, but we can't change reference
        ClassByValue1(f);
        Debug.Assert(f.I == 2);

        ClassByValue2(f);
        //"f" still referenced to the same object!
        Debug.Assert(f.I == 2);

        ClassByReference(ref f);
        //Now "f" referenced to newly created object.
        //Passing by references allow change referenced itself,
        //not only referenced object
        Debug.Assert(f.I == -1);

        Boo b = new Boo {
            I = 1
        };

        StructByValue(b);
        //Value type passes by value "b" can't changed!
        Debug.Assert(b.I == 1);

        StructByReference(ref b);
        //Value type passed by referenced.
        //We can change value type object!
        Debug.Assert(b.I == 2);

        Console.ReadKey();
    }
Esempio n. 40
0
        public void LifetimeTest()
        {
            List <ServiceDescriptor> serviceDescriptors = new List <ServiceDescriptor>();

            serviceDescriptors.Add(ServiceDescriptor.Describe(typeof(Foo), typeof(Foo), ServiceLifetime.Singleton));
            serviceDescriptors.Add(ServiceDescriptor.Describe(typeof(Foo), typeof(Foo), ServiceLifetime.Singleton));
            serviceDescriptors.Add(ServiceDescriptor.Describe(typeof(Boo), typeof(Boo), ServiceLifetime.Transient));

            ServiceProvider service = new ServiceProvider(serviceDescriptors);

            Boo transientBoo1 = service.GetService(typeof(Boo)) as Boo;
            Boo transientBoo2 = service.GetService(typeof(Boo)) as Boo;

            Foo singletonFoo1      = service.GetService(typeof(Foo)) as Foo;
            Foo singletonFoo2      = service.GetService(typeof(Foo)) as Foo;
            IEnumerable <Foo> foos = service.GetService(typeof(IEnumerable <Foo>)) as IEnumerable <Foo>;

            Assert.AreNotSame(transientBoo1, transientBoo2);

            Assert.AreSame(singletonFoo1, singletonFoo2);
            Assert.AreSame(singletonFoo1, transientBoo1.Foo);
            Assert.AreSame(transientBoo1.Foo, transientBoo2.Foo);
            Assert.AreSame(singletonFoo1, foos.Last());
        }
Esempio n. 41
0
 private static float ResultBuilder(Boo b, Foo f) => b.Float;
Esempio n. 42
0
        public void Deserialize(Boo value)
        {
            var serialized = JsonConvert.SerializeObject(value);

            _converter.Deserialize(serialized).Should().BeEquivalentTo(value);
        }
Esempio n. 43
0
 public Promise <Boo> HandleBoo(Boo boo, IHandler composer)
 {
     return(Promise.Resolved(new Boo {
         HasComposer = true
     }));
 }
Esempio n. 44
0
 public void CallWithoutResults(LogLevel level, Type sender, string template, int arg1, string arg2, Guid arg3, Boo arg4)
 {
     _provider.Write(level, sender, template);
     _provider.Write(level, sender, template, arg1);
     _provider.Write(level, sender, template, arg1, arg2);
     _provider.Write(level, sender, template, arg1, arg2, arg3);
     _provider.Write(level, sender, template, arg1, arg2, arg3, arg4);
 }
Esempio n. 45
0
        public void ReadObject(Boo value)
        {
            var jsonObject = _converter.Write(value);

            _converter.ReadObject(jsonObject).Should().BeEquivalentTo(value);
        }
Esempio n. 46
0
 //Passing value tye by reference
 //We can change Boo object
 static void StructByReference(ref Boo b)
 {
     b.I++;
 }
Esempio n. 47
0
        private void initSkills()
        {
            SoundEffect booSfx    = LoadingUtils.load <SoundEffect>(content, "QuickShot");
            SoundEffect shriekSfx = LoadingUtils.load <SoundEffect>(content, "Boo");
            SoundEffect whooshSfx = LoadingUtils.load <SoundEffect>(content, "Whoosh");

            SkillFinished appear = delegate() {
                int alpha = 255;
                resetFadeEffect(this.fadeEffect, alpha, FadeEffect.FadeState.PartialIn);
                resetFadeEffect(this.selectedFadeEffect, alpha, FadeEffect.FadeState.PartialIn);
                this.state = State.Visisble;
            };
            SkillFinished disappear = delegate() {
                int alpha = 75;
                resetFadeEffect(this.fadeEffect, alpha, FadeEffect.FadeState.PartialOut);
                resetFadeEffect(this.selectedFadeEffect, alpha, FadeEffect.FadeState.PartialOut);
                this.state = State.Invisible;
                this.observerHandler.notifyGhostChange(this);
            };

            SkillFinished shriek = delegate() {
                int alpha = 255;
                resetFadeEffect(this.fadeEffect, alpha, FadeEffect.FadeState.PartialIn);
                resetFadeEffect(this.selectedFadeEffect, alpha, FadeEffect.FadeState.PartialIn);
                this.state = State.Visisble;

                float effectLife;
                Base2DSpriteDrawable shockWave = ModelGenerationUtil.generateWaveEffect(content, base.Position, Color.Orange, out effectLife);
                VisualEffect         effect    = new VisualEffect(shockWave, effectLife);
                EffectsManager.getInstance().Visuals.Add(effect);
            };

            SkillFinished boo = delegate() {
                int alpha = 255;
                resetFadeEffect(this.fadeEffect, alpha, FadeEffect.FadeState.PartialIn);
                resetFadeEffect(this.selectedFadeEffect, alpha, FadeEffect.FadeState.PartialIn);
                this.state = State.Visisble;


                float effectLife;
                Base2DSpriteDrawable shockWave = ModelGenerationUtil.generateWaveEffect(content, base.Position, Color.Green, out effectLife);
                VisualEffect         effect    = new VisualEffect(shockWave, effectLife);
                EffectsManager.getInstance().Visuals.Add(effect);
            };
            Skill booSkill    = new Boo(booSfx, boo);
            Skill shriekSkill = new Shriek(shriekSfx, shriek);
            Skill appearSkill = new Appear(whooshSfx, appear);
            Skill hideSkill   = new Disappear(whooshSfx, disappear);

            this.aggressiveSkills = new Dictionary <Keys, Skill>();
            this.aggressiveSkills.Add(Keys.D1, booSkill);
            this.aggressiveSkills.Add(Keys.D2, shriekSkill);

            this.passiveskills = new Dictionary <Keys, Skill>();
            this.passiveskills.Add(Keys.D3, appearSkill);
            this.passiveskills.Add(Keys.D4, hideSkill);

            this.Skills = new List <Skill>();
            this.Skills.Add(booSkill);
            this.Skills.Add(shriekSkill);
            this.Skills.Add(appearSkill);
            this.Skills.Add(hideSkill);
        }
Esempio n. 48
0
 //Passing value type by value
 //We can't change Boo object
 static void StructByValue(Boo b)
 {
     b.I++;
 }
 void Bar2(Boo b, string a)
 {
 }
 void ClassAndInterface(Boo a, string b)
 {
     Bar2(a, b);       // Compliant
     Bar3(a, b);       // Compliant
     Bar3(b: a, a: b); // Compliant
 }
Esempio n. 51
0
 public void ThrowIfTemplateUsedWrong(int arg1, string arg2, Boo wrong1, DateTime?wrong2)
 {
     _logger.Debug(Template2, arg1, arg2);
     Assert.Throws <InvalidCastException>(() => _logger.Error(Template2, wrong1, wrong2));
 }
Esempio n. 52
0
 private static void WriteDebug <T>(ILogger <T> logger, Guid arg1, float arg2, TimeSpan arg3, Boo arg4)
 {
     logger.Debug(Template0);
     logger.Debug(Template1, arg1);
     logger.Debug(Template2, arg1, arg2);
     logger.Debug(Template3, arg1, arg2, arg3);
     logger.Debug(Template4, arg1, arg2, arg3, arg4);
 }
Esempio n. 53
0
 private static int OuterKeySelector(Boo b) => b.Id;