Esempio n. 1
0
 EventHandler<PlayerIndexEventArgs> RenameProfile(Profile prof)
 {
     return (object sender, PlayerIndexEventArgs e) =>
     {
         InputDialog dialog = new InputDialog("Please rename the profile:", prof.Name);
         dialog.Buttons[0].Pressed += DoneRenaming(dialog, prof);
         ScreenManager.AddScreen(dialog, ControllingPlayer);
     };
 }
Esempio n. 2
0
        EventHandler<PlayerIndexEventArgs> DoneRenaming(InputDialog dialog, Profile prof)
        {
            return (object sender, PlayerIndexEventArgs e) =>
            {
                prof.Name = dialog.Content;
                int index = mProfiles.IndexOf(prof);
                (MenuEntries[index] as ButtonGroup).Label.Text = prof.Name;

                if (mDefault == prof.ProfileNumber)
                    Profile.SaveProfile(prof, "default.sav", mDevice);
                else
                    Profile.SaveProfile(prof, "profile" + prof.ProfileNumber + ".sav", mDevice);
                PositionElements();
            };
        }
Esempio n. 3
0
 void MakeProfile(object sender, PlayerIndexEventArgs e)
 {
     InputDialog dialog = new InputDialog("Please Enter a name for your profile:", "");
     dialog.Buttons[0].Pressed += AddProfile(dialog);
     ScreenManager.AddScreen(dialog, ControllingPlayer);
 }
Esempio n. 4
0
        EventHandler<PlayerIndexEventArgs> AddProfile(InputDialog dialog)
        {
            return (object sender, PlayerIndexEventArgs e) =>
            {
                Profile prof = new Profile();
                prof.Name = dialog.Content;
                prof.ProfileNumber = mNextProfile++;

                string[] profileOptions = { "Delete", "Rename", "Make Active" };
                ButtonGroup profileGroup = new ButtonGroup(prof.Name, profileOptions);
                profileGroup.HideInactive = true;
                profileGroup.LoadContent(this);

                profileGroup.Buttons[0].Pressed += ConfirmDeleteProfile(prof);
                profileGroup.Buttons[1].Pressed += RenameProfile(prof);
                profileGroup.Buttons[2].Pressed += SetDefaultProfile(prof);

                MenuEntries.Insert(MenuEntries.Count - 2, profileGroup);
                mProfiles.Add(prof);
                PositionElements();
                prof.Register();

                if (mProfiles.Count == 1)
                {
                    Default = prof.ProfileNumber;
                    Profile.SaveProfile(prof, "default.sav", mDevice);
                    (this.ScreenManager.Game as HalfCakedGame).CurrentProfile = prof;

                    if (ProfileSelected != null)
                        ProfileSelected.Invoke(this, e);
                }
                else
                    Profile.SaveProfile(prof, "profile" + prof.ProfileNumber + ".sav", mDevice);
            };
        }