Example #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            // Create a new SpriteBox.
            Global.spriteBox = new SpriteBox();

            cursor = Content.Load <Texture2D>("MouseCursor");
            SoundEffect se = Content.Load <SoundEffect>("Town-of-Forgotten-Souls");

            // Create layers.
            FileStream      fs                = (FileStream)TitleContainer.OpenStream("Content/Tilemaps/tilemap1.tm");
            GameObjectLayer GOLayer           = new GameObjectLayer("GameObjectLayer");
            GUILayer        guiLayer          = new GUILayer("GUILayer");
            Tilemap         tm                = new Tilemap("tilemap1", fs);
            EffectLayer     bottomEffectLayer = new EffectLayer("BottomEffectLayer", true);
            EffectLayer     topEffectLayer    = new EffectLayer("TopEffectLayer");

            // Add layers to world. The order is important.
            Global.world.AddLayers(tm, GOLayer, bottomEffectLayer, guiLayer, topEffectLayer);

            GOLayer.elements.Add(Player.GetPlayer(100, 100));
            GOLayer.elements.Add(new Boundary(300, 300));
            GOLayer.elements.Add(new Lantern(200, 200));
            List <Enemy> enemyFrontList  = new List <Enemy>();
            List <Enemy> enemyBehindList = new List <Enemy>();

            enemyFrontList.Add(new Goul());
            GOLayer.elements.Add(new EnemySoul(400, 400, new Combat(enemyFrontList, enemyBehindList)));

            Global.soulBox = new SoulBox();

            Hero1 hero  = new Hero1(FighterState.Front);
            Hero2 hero2 = new Hero2(FighterState.Front);
            Ring1 ring1 = new Ring1();

            Global.world.GetPlayer().AddHero(hero);
            Global.world.GetPlayer().AddHero(hero2);
            Global.world.GetPlayer().AddItem(ring1);

            ChangeState(new ExploreState());
        }
Example #2
0
        public void PageEnter(Room Room)
        {
            CurrentRoom = Room;

            TypeName.Text = BattleTypeDictionary[Room.BattleType];
            for (int i = 0; i < Room.Groups.Count; i++)
            {
                var Panel = new WrapPanel()
                {
                    Height = 130, Width = Room.Groups[i].Capacity * 150
                };
                foreach (var Participant in Room.Groups[i].Participants)
                {
                    var DisplayItem = new ParticipantDisplayLarge()
                    {
                        Height = 130, Width = 150
                    };
                    if (Participant.Avator != null)
                    {
                        using (MemoryStream Stream = new MemoryStream())
                        {
                            Participant.Avator.Save(Stream, ImageFormat.Png);
                            BitmapImage Temp = new BitmapImage();
                            Temp.BeginInit();
                            Temp.CacheOption  = BitmapCacheOption.OnLoad;
                            Temp.StreamSource = Stream;
                            Temp.EndInit();
                            DisplayItem.AvatorImage.ImageSource = Temp;
                        }
                    }
                    DisplayItem.PlayerName.Text    = Participant.Name;
                    DisplayItem.ShadowEffect.Color = Room.Groups[i].Color;
                    Panel.Children.Add(DisplayItem);
                }
                DisplayGrid.Children.Add(Panel);
                SetItemPosition(Panel, Room.Groups.Count, i);
            }

            var OpacityAnimation = new DoubleAnimation()
            {
                From           = 0,
                To             = 1,
                Duration       = TimeSpan.FromSeconds(1),
                EasingFunction = new ExponentialEase()
                {
                    EasingMode = EasingMode.EaseOut
                }
            };

            OpacityAnimation.Completed += delegate
            {
                DispatcherTimer Timer = new DispatcherTimer()
                {
                    Interval = TimeSpan.FromSeconds(0.25)
                };
                int TickCount = 0;
                Timer.Tick += delegate
                {
                    switch (TickCount)
                    {
                    case 0:
                        Ring1.Visibility = Visibility.Visible;
                        Ring1.BeginAnimation(OpacityProperty, new DoubleAnimation()
                        {
                            From           = 0,
                            To             = 1,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        Ring1.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation()
                        {
                            From           = 0,
                            To             = 235,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        Ring1.BeginAnimation(Canvas.TopProperty, new DoubleAnimation()
                        {
                            From           = -200,
                            To             = 35,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });

                        Ring2.Visibility = Visibility.Visible;
                        Ring2.BeginAnimation(OpacityProperty, new DoubleAnimation()
                        {
                            From           = 0,
                            To             = 1,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        Ring2.BeginAnimation(Canvas.RightProperty, new DoubleAnimation()
                        {
                            From           = 0,
                            To             = 235,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        Ring2.BeginAnimation(Canvas.BottomProperty, new DoubleAnimation()
                        {
                            From           = -200,
                            To             = 35,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        break;

                    case 1:
                        Arc1.Visibility = Visibility.Visible;
                        Arc1.BeginAnimation(OpacityProperty, new DoubleAnimation()
                        {
                            From           = 0,
                            To             = 1,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        Arc1.BeginAnimation(Canvas.RightProperty, new DoubleAnimation()
                        {
                            From           = 0,
                            To             = 235,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        Arc1.BeginAnimation(Canvas.TopProperty, new DoubleAnimation()
                        {
                            From           = -200,
                            To             = 35,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });

                        Arc2.Visibility = Visibility.Visible;
                        Arc2.BeginAnimation(OpacityProperty, new DoubleAnimation()
                        {
                            From           = 0,
                            To             = 1,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        Arc2.BeginAnimation(Canvas.LeftProperty, new DoubleAnimation()
                        {
                            From           = 0,
                            To             = 235,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        Arc2.BeginAnimation(Canvas.BottomProperty, new DoubleAnimation()
                        {
                            From           = -200,
                            To             = 35,
                            Duration       = TimeSpan.FromSeconds(0.5),
                            EasingFunction = new ExponentialEase()
                            {
                                EasingMode = EasingMode.EaseOut
                            }
                        });
                        break;

                    case 2:
                        RotateTransform.BeginAnimation(RotateTransform.AngleProperty, GenerateRotateAnimation());
                        InitalizeBattlefield();
                        Timer.Stop();
                        break;
                    }
                    TickCount++;
                };
                Timer.Start();
            };
            this.BeginAnimation(OpacityProperty, OpacityAnimation);
        }
Example #3
0
        public void LoadProfilePath(String path)
        {
            try
            {
                _profileText = File.ReadAllText(path);
                var profileText = _profileText;
                //Parse and update values.
                var nameClassRegex = new Regex("([^=]+)=\"?([^\r\n\"]+)\"?");
                var specRegex      = new Regex("spec=(\\w+)");
                var ilvlRegex      = new Regex("gear_ilvl=(\\d+.?\\d*)");
                var tierRegex      = new Regex("set_bonus=tier(\\d+)_(\\d)pc=1");
                var potionRegex    = new Regex("potion=(\\w+)");
                var flaskRegex     = new Regex("flask=(\\w+)");
                var foodRegex      = new Regex("food=(\\w+)");
                var augmentRegex   = new Regex("augmentation=(\\w+)");

                var nameClassMatch = nameClassRegex.Match(profileText);
                Name  = nameClassMatch.Groups[2].Value;
                Class = nameClassMatch.Groups[1].Value.UppercaseWords().Replace("Deathk", "Death K").Replace("Demonh", "Demon H").UppercaseWords();
                Spec  = specRegex.Match(profileText).Groups[1].Value.UppercaseWords().Replace("Beastm", "Beast M");
                var fixedCulture = CultureInfo.CreateSpecificCulture("en-US");
                ILvl = float.Parse(ilvlRegex.Match(profileText).Groups[1].Value, fixedCulture); // Easy fix to convert EU to US style decimal notation.
                // Ring 1
                Ring1.Add("None");
                Ring1.Add("");
                Ring1.Add("- " + Class + " -");
                Ring1.Add("    - " + Spec + " -");
                AzeriteMapping[Class.ToLower().Replace(" ", "_")][Spec.ToLower().Replace(" ", "_")].ForEach(x => { Ring1.Add(x.Name); Ring1Mapping.Add(x); });
                Ring1.Add("");
                Ring1.Add("- PVE -");
                Ring1.Add("    - Magni -");
                AzeriteMapping["pve"]["magni"].ForEach(x => { Ring1.Add(x.Name); Ring1Mapping.Add(x); });
                Ring1.Add("");
                Ring1.Add("    - Uldir -");
                AzeriteMapping["pve"]["uldir"].ForEach(x => { Ring1.Add(x.Name); Ring1Mapping.Add(x); });
                Ring1.Add("");
                Ring1.Add("    - World -");
                AzeriteMapping["pve"]["location"].ForEach(x => { Ring1.Add(x.Name); Ring1Mapping.Add(x); });
                Ring1.Add("");
                Ring1.Add("    - Dungeons -");
                AzeriteMapping["pve"]["dungeon"].ForEach(x => { Ring1.Add(x.Name); Ring1Mapping.Add(x); });
                Ring1.Add("");
                Ring1.Add("- PVP -");
                Ring1.Add("    - Horde -");
                AzeriteMapping["pvp"]["horde"].ForEach(x => { Ring1.Add(x.Name); Ring1Mapping.Add(x); });
                Ring1.Add("");
                Ring1.Add("    - Alliance -");
                AzeriteMapping["pvp"]["alliance"].ForEach(x => { Ring1.Add(x.Name); Ring1Mapping.Add(x); });
                Ring1.Add("");
                Ring1.Add("- Professions -");
                Ring1.Add("    - Engineering -");
                AzeriteMapping["profession"]["engineering"].ForEach(x => { Ring1.Add(x.Name); Ring1Mapping.Add(x); });
                // Ring 2
                Ring2.Add("None");
                Ring2.Add("");
                Ring2.Add("- Role -");
                if (new List <String> {
                    "Demon Hunter", "Death Knight", "Monk", "Paladin", "Druid", "Warrior"
                }.Contains(Class))
                {
                    Ring2.Add("    - Tank -");
                    AzeriteMapping["role"]["tank"].ForEach(x => { Ring2.Add(x.Name); Ring2Mapping.Add(x); });
                    Ring2.Add("");
                }
                if (new List <String> {
                    "Paladin", "Priest", "Shaman", "Monk", "Druid"
                }.Contains(Class))
                {
                    Ring2.Add("    - Healer -");
                    AzeriteMapping["role"]["healer"].ForEach(x => { Ring2.Add(x.Name); Ring2Mapping.Add(x); });
                    Ring2.Add("");
                }
                Ring2.Add("    - DPS -");
                AzeriteMapping["role"]["dps"].ForEach(x => { Ring2.Add(x.Name); Ring2Mapping.Add(x); });
                Ring2.Add("");
                Ring2.Add("    - Any -");
                AzeriteMapping["role"]["any"].ForEach(x => { Ring2.Add(x.Name); Ring2Mapping.Add(x); });
                // Ring 4
                Ring4.Add("None");
                AzeriteMapping["generic"]["center"].ForEach(x => { Ring4.Add(x.Name); Ring4Mapping.Add(x); });

                HeadRing1      = "None";
                HeadRing2      = "None";
                HeadRing4      = "None";
                ChestRing1     = "None";
                ChestRing2     = "None";
                ChestRing4     = "None";
                ShouldersRing1 = "None";
                ShouldersRing2 = "None";
                ShouldersRing4 = "None";

                var potionName = potionRegex.Match(profileText).Groups[1].Value;
                var flaskName  = flaskRegex.Match(profileText).Groups[1].Value;
                var foodName   = foodRegex.Match(profileText).Groups[1].Value;
                var runeName   = augmentRegex.Match(profileText).Groups[1].Value;
                if (PotionNameMapping.Exists(x => x.simc_names.Contains(potionName)))
                {
                    Potion = PotionNameMapping.First(x => x.simc_names.Contains(potionName)).name;
                }
                if (FlaskNameMapping.Exists(x => x.simc_names.Contains(flaskName)))
                {
                    Flask = FlaskNameMapping.First(x => x.simc_names.Contains(flaskName)).name;
                }
                if (FoodNameMapping.Exists(x => x.simc_names.Contains(foodName)))
                {
                    Food = FoodNameMapping.First(x => x.simc_names.Contains(foodName)).name;
                }
                if (AugmentNameMapping.Exists(x => x.simc_names.Contains(runeName)))
                {
                    Rune = AugmentNameMapping.First(x => x.simc_names.Contains(runeName)).name;
                }
                if (PotionNameMapping.Exists(x => x.simc_names.Contains(potionName)))
                {
                    Potion = PotionNameMapping.First(x => x.simc_names.Contains(potionName)).name;
                }
                LoadAzerite(profileText);

                var tierMatches = tierRegex.Matches(profileText);
                for (int i = 0; i < tierMatches.Count; i++)
                {
                    var match = tierMatches[i];
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Ran into an issue loading your profile: " + e.Message, "Error", MessageBoxButton.OK);
            }
        }