예제 #1
0
        public void FillBackgroundImage(IMG imageuri)
        {
            Image img = new Image();

            img.Margin              = new Thickness(0, 0, 0, 0);
            img.Width               = 750;
            img.Height              = 750;
            img.VerticalAlignment   = VerticalAlignment.Top;
            img.HorizontalAlignment = HorizontalAlignment.Center;

            var image = new BitmapImage();

            image.BeginInit();

            if (File.Exists(imageuri.Adress))
            {
                image.UriSource = new Uri(imageuri.Adress);
            }
            else
            {
                image.UriSource = new Uri(GetFilePath(4 + ".gif"));
            }
            image.EndInit();

            //ImageBehavior.SetRepeatBehavior(image,);
            ImageBehavior.SetAnimatedSource(img, image);
            ImageHere.Children.Clear();
            ImageHere.Children.Add(img);
        }
예제 #2
0
        //Filling Scenes
        protected void FillAfterOpt(object sender, EventArgs e)
        {
            int    FollowingScene = 0;
            Button button         = sender as Button;
            string ct             = button.Content.ToString();

            var SceneList   = GetScenes();
            var OptionsList = GetOptions();

            for (int l = 0; l < OptionsList.Count(); l++)
            {
                if (OptionsList[l].Description == ct)
                {
                    FollowingScene = OptionsList[l].FollowingScene;
                }
            }
            for (int i = 0; i < SceneList.Count(); i++)
            {
                if (SceneList[i].ID == FollowingScene)
                {
                    Scene s        = new Scene(SceneList[i].ID, SceneList[i].Description, SceneList[i].Type, SceneList[i].OptionCount);
                    IMG   imageuri = new IMG();
                    if (s.ID > 45 && s.ID < 53)
                    {
                        imageuri = new IMG(s.ID, GetFilePath(SceneList[i].ID + ".gif"));
                    }
                    else if (s.ID > 52 && s.ID < 66)
                    {
                        imageuri = new IMG(s.ID, GetFilePath(SceneList[i].ID + ".gif"));
                    }
                    else if (s.ID > 66 && s.ID < 81)
                    {
                        imageuri = new IMG(s.ID, GetFilePath(SceneList[i].ID + ".gif"));
                    }
                    else if (s.ID > 80 && s.ID < 87)
                    {
                        imageuri = new IMG(s.ID, GetFilePath(SceneList[i].ID + ".gif"));
                    }
                    else if (s.ID > 86 && s.ID < 98)
                    {
                        imageuri = new IMG(s.ID, GetFilePath(SceneList[i].ID + ".gif"));
                    }
                    else if (s.ID > 97 && s.ID < 109)
                    {
                        imageuri = new IMG(s.ID, GetFilePath(SceneList[i].ID + ".gif"));
                    }
                    else if (s.ID > 108 && s.ID < 118)
                    {
                        imageuri = new IMG(s.ID, GetFilePath(SceneList[i].ID + ".gif"));
                    }
                    else
                    {
                        imageuri = new IMG(s.ID, GetFilePath(SceneList[i].ID + ".gif"));
                    }

                    //  IMG imageuri = new IMG(s.ID, GetFilePath(SceneList[i].ID + ".gif"));
                    FillScene(s, imageuri);
                }
            }
        }
예제 #3
0
        public void FillNPCImage(IMG imageuri)
        {
            Image img = new Image();

            img.Width               = 300;
            img.Height              = 300;
            img.VerticalAlignment   = VerticalAlignment.Bottom;
            img.HorizontalAlignment = HorizontalAlignment.Center;

            var image = new BitmapImage();

            image.BeginInit();

            image.UriSource = new Uri(imageuri.Adress);

            image.EndInit();

            ImageBehavior.SetAnimatedSource(img, image);
            ImageHere.Children.Add(img);
            //ImageBehavior.SetRepeatBehavior(img, new RepeatBehavior(1));
        }
예제 #4
0
        public FR(int SceneID, Player p, List <Item> i)
        {
            InitializeComponent();
            #region
            CurrentPlayer.Add(p);
            Versus.Visibility           = Visibility.Hidden;
            EnemyProgressBar.Visibility = Visibility.Hidden;
            for (int r = 0; r < i.Count(); r++)
            {
                InventoryCollection.Add(i[r]);
            }

            PlayerName.Content = p.Name;
            PlayerLVL.Content  = "LVL " + p.Level;
            PGB.Value          = p.hp;
            #endregion
            var Scenes = GetScenes();

            Scene s        = new Scene(SceneID, Scenes[SceneID].Description, Scenes[SceneID].Type, Scenes[SceneID].OptionCount);
            IMG   imageuri = new IMG(s.ID, GetFilePath(Scenes[SceneID].ID + ".gif"));
            FillScene(s, imageuri);
        }
예제 #5
0
        //Images
        public IMG ReturnNpcUri(int ID)
        {
            IMG someimg = new IMG();

            if (ID > 45 && ID < 53 || ID == 122)
            {
                someimg = new IMG(ID, GetFilePath(50 + "NPC.gif"));
            }
            else if (ID > 52 && ID < 66 || ID == 126)
            {
                someimg = new IMG(ID, GetFilePath(60 + "NPC.gif"));
            }
            else if (ID > 66 && ID < 81 || ID == 123)
            {
                someimg = new IMG(ID, GetFilePath(70 + "NPC.gif"));
            }
            else if (ID > 80 && ID < 87 || ID == 125)
            {
                someimg = new IMG(ID, GetFilePath(80 + "NPC.gif"));
            }
            else if (ID > 86 && ID < 98 || ID == 127)
            {
                someimg = new IMG(ID, GetFilePath(90 + "NPC.gif"));
            }
            else if (ID > 97 && ID < 109 || ID == 128)
            {
                someimg = new IMG(ID, GetFilePath(100 + "NPC.gif"));
            }
            else if (ID > 108 && ID < 118 || ID == 124)
            {
                someimg = new IMG(ID, GetFilePath(110 + "NPC.gif"));
            }
            else
            {
                someimg = new IMG(ID, GetFilePath(ID + "NPC.gif"));
            }
            return(someimg);
        }
예제 #6
0
        public void FillScene(Scene Scene, IMG imageuri)
        {
            CurrentPlayer[0].FrameID = Scene.ID;
            PlaySound(Scene.ID);
            //NPC
            if (Scene.Type == 2)
            {
                IMG NPCuri = ReturnNpcUri(Scene.ID);
                imageuri = ReturnBackgroundUri(Scene.ID);
                FillBackgroundImage(imageuri);
                FillNPCImage(NPCuri);
                Description.Text = Scene.Description;

                FillOptions(Scene.ID, Scene.OptionCount);
            }
            //Casual scene
            else if (Scene.Type == 4 || Scene.Type == 1)
            {
                imageuri = ReturnBackgroundUri(Scene.ID);
                FillBackgroundImage(imageuri);
                Description.Text = Scene.Description;

                FillOptions(Scene.ID, Scene.OptionCount);
            }
            //Fight
            else if (Scene.Type == 5)

            {
                IMG NPCuri = ReturnNpcUri(Scene.ID);
                imageuri = ReturnBackgroundUri(Scene.ID);
                FillBackgroundImage(imageuri);
                FillNPCImage(NPCuri);
                Description.Text = Scene.Description;
                FillOptions(Scene.ID, Scene.OptionCount);

                var NPCS    = GetNpc();
                NPC Monster = new NPC();

                try
                {
                    for (int u = 0; u < NPCS.Count(); u++)
                    {
                        if (NPCS[u].ID == Scene.ID)
                        {
                            Monster = NPCS[u];
                        }
                    }
                    Fight(Monster, CurrentPlayer[0]);
                }
                catch
                {
                    MessageBox.Show("NE, TOHLE NEPŮJDE?");
                    MessageBox.Show(Monster.ID + " " + Monster.HP);
                }
            }
            //
            else
            {
                imageuri = ReturnBackgroundUri(Scene.ID);
                FillBackgroundImage(ReturnBackgroundUri(Scene.ID));
                Description.Text = Scene.Description;

                FillOptions(Scene.ID, Scene.OptionCount);
            }
        }