Example #1
0
 private MovableContentControl AddAlchemyElementToGameSurface(AlchemyElement e)
 {
     var mcc = new MovableContentControl() { Width = 100, Height = 115, Content = e, ContentTemplate = Resources["elementDataTemplate"] as DataTemplate };
     mcc.MoveCompleted += mcc_MoveCompleted;
     gameSurface.Children.Add(mcc);
     return mcc;
 }
Example #2
0
        public AlchemyElement TestForReaction(AlchemyElement e1, AlchemyElement e2)
        {
            if (e1.Name != e2.Name)
            {
                var reaction = from r in reactions
                               where
                                    r.Source.Where(_ => _.Name == e1.Name).Any() &&
                                    r.Source.Where(_ => _.Name == e2.Name).Any()
                               select r;

                if (reaction.Any())
                {
                    var element = reaction.First().Result;
                    if (!elements.Where(_ => _.Name == element.Name).Any())
                    {
                        elements.Add(element);
                    }
                    return element;
                }
                return null;
            }
            else
            {
                var reaction = from r in reactions
                               where
                                    r.Source.Where(_ => _.Name == e1.Name).Count() == 2
                               select r;

                if (reaction.Any())
                {
                    var element = reaction.First().Result;
                    if (!elements.Where(_ => _.Name == element.Name).Any())
                    {
                        elements.Add(element);
                    }
                    return element;
                }
                return null;
            }
        }
Example #3
0
        public AlchemyElement TestForReaction(AlchemyElement e1, AlchemyElement e2)
        {
            if (e1.Name != e2.Name)
            {
                var reaction = from r in reactions
                               where
                               r.Source.Where(_ => _.Name == e1.Name).Any() &&
                               r.Source.Where(_ => _.Name == e2.Name).Any()
                               select r;

                if (reaction.Any())
                {
                    var element = reaction.First().Result;
                    if (!elements.Where(_ => _.Name == element.Name).Any())
                    {
                        elements.Add(element);
                    }
                    return(element);
                }
                return(null);
            }
            else
            {
                var reaction = from r in reactions
                               where
                               r.Source.Where(_ => _.Name == e1.Name).Count() == 2
                               select r;

                if (reaction.Any())
                {
                    var element = reaction.First().Result;
                    if (!elements.Where(_ => _.Name == element.Name).Any())
                    {
                        elements.Add(element);
                    }
                    return(element);
                }
                return(null);
            }
        }