Esempio n. 1
0
        private void btn_Load_Click(object sender, RoutedEventArgs e)
        {
            SinglePet singlePet = new SinglePet();

            string[] lines = File.ReadAllLines($"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\\save.sav");

            singlePet.petName        = lines[0];
            singlePet.totalDays      = Convert.ToInt32(lines[1]);
            singlePet.happiness      = Convert.ToInt32(lines[2]);
            singlePet.happinessBonus = Convert.ToInt32(lines[3]);
            singlePet.hunger         = Convert.ToInt32(lines[4]);
            singlePet.hungerModifier = Convert.ToInt32(lines[5]);
            singlePet.pet            = lines[6];
            singlePet.petDescription = lines[7];
            singlePet.age            = lines[8];
            singlePet.ageDescription = lines[9];

            mMediaPlayer.Stop();

            (Parent as Window).Content = new UserControl_Game(singlePet,
                                                              Convert.ToInt32(lines[10]),
                                                              Convert.ToInt32(lines[11]),
                                                              Convert.ToInt32(lines[12]),

                                                              Convert.ToBoolean(lines[13]),
                                                              Convert.ToBoolean(lines[14]),

                                                              Convert.ToBoolean(lines[15])
                                                              );
        }
Esempio n. 2
0
        public Window_Menu(SinglePet singlePet, int coins, int freeHours, int currentDay, bool vegetablesPurchased, bool bigBonePurchased, bool dailyChoice3Available)
        {
            InitializeComponent();

            mSinglePet = singlePet;

            mCoins      = coins;
            mFreeHours  = freeHours;
            mCurrentDay = currentDay;

            mVegetablesPurchased = vegetablesPurchased;
            mBigBonePurchased    = bigBonePurchased;

            mDailyChoice3Available = dailyChoice3Available;
        }
Esempio n. 3
0
        public UserControl_Game(SinglePet singlePet, int coins = 1, int freeHours = 1, int currentDay = 1, bool vegetablesPurchased = false, bool bigBonePurchased = false, bool dailyChoice3Available = false)
        {
            InitializeComponent();

            mSinglePet = singlePet;

            tblc_pet.Text         = mSinglePet.pet;
            tblc_description.Text = mSinglePet.petDescription;

            tblc_age.Text             = mSinglePet.age;
            tblc_description_age.Text = mSinglePet.ageDescription;

            ImageSourceConverter imgs = new ImageSourceConverter();

            img_Pet.SetValue(Image.SourceProperty, imgs.ConvertFromString(string.Format("pack://application:,,,/Images/{0}.png", mSinglePet.pet)));

            mMediaPlayer.Open(new Uri(string.Format("{0}\\Rainbow_Forest.mp3", AppDomain.CurrentDomain.BaseDirectory)));
            mMediaPlayer.MediaEnded += new EventHandler(Media_Ended);
            if ((bool)Settings.Default["music"] == true)
            {
                mMediaPlayer.Play();
            }

            mMoney               = coins;
            mFreeHours           = freeHours;
            mCurrentDay          = currentDay;
            mVegetablesPurchased = vegetablesPurchased;
            mBigBonePurchased    = bigBonePurchased;

            mDailyChoice3Available = dailyChoice3Available;

            if (mDailyChoice3Available)
            {
                DailyChoice3.Visibility = Visibility.Visible;
            }

            // Show buttons to buy items that can be afforded
            CheckItemsAvailability();

            pb_days.Value = ((double)mCurrentDay / mSinglePet.totalDays) * 100;
        }