Beispiel #1
0
        private void btnNew_Click(object sender, EventArgs e)
        {
            Mesaj Msj = new Mesaj();

            MesajSonuç Msonuc = Msj.Input(String.GetLangText("PRF_ADD_INPUT", string.Join(", ", ProfilSiniflar.UserProfileUtils.FileNameErroredChars)), String.GetLangText("PRF_ADD_INPUT_HDR"), "");

            if (Msonuc.MesajCevap != DialogResult.OK)
            {
                return;
            }
            string errormsg;

            if (!UserProfileUtils.CanCreateUserProfile(Msonuc.Sonuç, out errormsg))
            {
                Msj.Göster(String.GetLangText("PRF_ADD_ERR_HM", errormsg), String.GetLangText("PRF_ADD_ERR_HDR"));
                return;
            }
            UserProfile UProfil = UserProfileUtils.CreateUserProfile(Msonuc.Sonuç);

            if (UProfil == null)
            {
                Msj.Göster(String.GetLangText("PRF_ADD_ERR_NOTCREATE"), String.GetLangText("PRF_ADD_ERR_HDR"));
            }
            ListViewItem Lvi = new ListViewItem()
            {
                Text = (lvProfiles.Items.Count + 1).ToString()
            };

            Lvi.SubItems.Add(UProfil.ProfileName);
            lvProfiles.Items.Add(Lvi);
        }
Beispiel #2
0
        private async void btnContinue_Click(object sender, EventArgs e)
        {
            string SelectedProfile = "";


            if (lvProfiles.SelectedItems.Count == 0)
            {
                return;
            }
            SelectedProfile = lvProfiles.SelectedItems[0].SubItems[1].Text;
            //Devam etmek istenen profil aktif profil ise yeniden yükleme yapmayacak.
            if (SelectedProfile == GlobalVariants.ActiveProfile?.ProfileName)
            {
                goto endofaction;
            }
            pbLoadProfile.Visible = true;
            UserProfile Uprofil = await Task.Run <UserProfile>(() => UserProfileUtils.LoadUserProfile(SelectedProfile));

            if (Uprofil == null)
            {
                new Mesaj().Göster(String.GetLangText("PRF_ERR_PROFILE_LOAD"));
                goto endofaction;
            }
            if (GlobalSettings.Settings.RebemmerChecked)
            {
                GlobalSettings.Settings.RebemmerName = SelectedProfile;
            }
            Uprofil.LastactivityDate = DateTime.Now;
            uProfil = Uprofil;

endofaction:
            pbLoadProfile.Visible = false;
            this.Close();
        }
Beispiel #3
0
    // программа, запускающая определённые действия при выигрыше в игре
    IEnumerator YouWin()
    {
        AudioAssistant.Shot("YouWin");
        SteamAchiments.main.TakeAchievement("WIN_GAME");
        PlayerPrefs.SetInt("FirstPass", 1);
        isPlaying = false;

        if (ProfileAssistant.main.local_profile.current_level == LevelProfile.main.level)
        {
            if (Level.all.ContainsKey(ProfileAssistant.main.local_profile.current_level + 1))
            {
                ProfileAssistant.main.local_profile.current_level++;
            }
        }
        ProfileAssistant.main.local_profile.SetScore(LevelProfile.main.level, score);
        GameCamera.main.HideField();
        yield return(0);

        while (CPanel.uiAnimation > 0)
        {
            yield return(0);
        }
        yield return(0);

        UIAssistant.main.ShowPage("YouWin");
        Debug.Log("YouWin");
        AnimationAssistant.main.Ferverk(1);
        UserProfileUtils.WriteProfileOnDevice(ProfileAssistant.main.local_profile);
    }
Beispiel #4
0
        /// <summary>
        /// Diğer formdan profil seçtirmek için kullanacağımız fonksiyon.
        /// </summary>
        /// <returns></returns>
        public static UserProfile SelectProfile()
        {
            ProfileSelector pselector = new ProfileSelector();

            pselector.ShowDialog();
            //Başlıca istatistikler yoksa sıralamada üstte görünsünler diye otomatik eklenecek.
            UserProfileUtils.InitializeStatistics(pselector.uProfil);
            return(pselector.uProfil);
        }
 public void ClearData()
 {
     local_profile = new UserProfile();
     PlayerPrefs.DeleteAll();
     UserProfileUtils.WriteProfileOnDevice(local_profile);
     if (LevelMap.main)
     {
         LevelMap.main.UpdateMapParameters();
     }
 }
 private void KelimeOyunu_FormClosed(object sender, FormClosedEventArgs e)
 {
     //Uygulamadan çıkış yapıldığında geçerli profil dosyasına kayıt yapar.
     if (ActiveGame.IsGameStarted)
     {
         ActiveGame.Abort();
     }
     UserProfileUtils.SaveUserProfile(GlobalVariants.ActiveProfile);
     GlobalSettings.SaveSettings();
 }
 public void UnlockAllLevels()
 {
     local_profile = UserProfileUtils.ReadProfileFromDevice();
     local_profile.current_level = 9999;
     UserProfileUtils.WriteProfileOnDevice(local_profile);
     if (LevelMap.main)
     {
         LevelMap.main.Refresh();
     }
 }
Beispiel #8
0
 /// <summary>
 /// Bir önceki uygulama açılışında seçimi hatırla seçeneği işaretlenen profili dönderir.
 /// </summary>
 /// <returns>Profil yüklenemediyse null diğer türlü UserProfile türünden dönüş yapar</returns>
 public static Task <UserProfile> GetRebemberProfile()
 {
     return(Task.Run <UserProfile>(() =>
     {
         if (!GlobalSettings.Settings.RebemmerChecked)
         {
             return null;
         }
         return UserProfileUtils.LoadUserProfile(GlobalSettings.Settings.RebemmerName);
     }));;
 }
        private void btnResetStats_Click(object sender, EventArgs e)
        {
            MesajSonuç Msonuc = Mesaj.mbox.Göster(String.GetLangText("STS_DEL_STS", ActiveProfile.ProfileName), String.GetLangText("STS_DEL_STS_CPT", ActiveProfile.ProfileName), MessageBoxButtons.YesNo);

            if (Msonuc.MesajCevap != DialogResult.Yes)
            {
                return;
            }
            UserProfileUtils.ResetUserStatistis(ActiveProfile);
            Mesaj.mbox.Göster(String.GetLangText("STS_DEL_STS_SCC"));
            btnResetStats.Enabled = false;
        }
    void Start()
    {
        local_profile = UserProfileUtils.ReadProfileFromDevice();

                #if UNITY_EDITOR
        if (PlayerPrefs.GetInt("TestLevel") != 0)
        {
            Level.TestLevel(PlayerPrefs.GetInt("TestLevel"));
            return;
        }
        #endif
    }
 public void ClearData()
 {
     local_profile = new UserProfile();
     PlayerPrefs.DeleteAll();
     UserProfileUtils.WriteProfileOnDevice(local_profile);
     if (LevelMap.main)
     {
         LevelMap.main.UpdateMapParameters();
     }
     if (Application.isPlaying)
     {
         ItemCounter.RefreshAll();
     }
 }
        private void closeProfileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MesajSonuç mesajSonuç = Mesaj.mbox.Göster(String.GetLangText("MENU_PROF_CLOSE_PRMPT"), "", MessageBoxButtons.YesNo);

            if (mesajSonuç.MesajCevap == DialogResult.Yes)
            {
                UserProfileUtils.SaveUserProfile(GlobalVariants.ActiveProfile);
                if (ActiveGame.IsGameStarted)
                {
                    ActiveGame.Abort();
                }
                GlobalVariants.ActiveProfile = null;
                CheckProfile(true);
            }
        }
    public void DrawLocalProfile()
    {
        main = (ProfileAssistant)metaTarget;
        Undo.RecordObject(main, "");

        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Clear Data", GUILayout.Width(80)))
        {
            main.ClearData();
        }
        if (GUILayout.Button("Unlock All Levels", GUILayout.Width(110)))
        {
            main.UnlockAllLevels();
        }
        EditorGUILayout.EndHorizontal();

        if (main.local_profile == null)
        {
            main.local_profile = UserProfileUtils.ReadProfileFromDevice();
        }

        EditorGUILayout.LabelField("Current level", main.local_profile.current_level.ToString(), EditorStyles.boldLabel);
        EditorGUILayout.LabelField("Last save", main.local_profile.lastSave.ToShortDateString() + " " + main.local_profile.lastSave.ToLongTimeString(), EditorStyles.boldLabel);

        EditorGUILayout.EndFadeGroup();

        scoresFade.target = GUILayout.Toggle(scoresFade.target, "Score", EditorStyles.foldout);
        if (EditorGUILayout.BeginFadeGroup(scoresFade.faded))
        {
            if (main.local_profile.score.Count > 0)
            {
                foreach (KeyValuePair <int, int> score in main.local_profile.score)
                {
                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(20);
                    EditorGUILayout.LabelField("Level " + score.Key.ToString(), score.Value.ToString(), EditorStyles.boldLabel);
                    EditorGUILayout.EndHorizontal();
                }
            }
            else
            {
                GUILayout.Label("Empty");
            }
        }
        EditorGUILayout.EndFadeGroup();
    }
Beispiel #14
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            string SelectedProfile = "";

            if (lvProfiles.SelectedItems.Count == 0)
            {
                return;
            }
            SelectedProfile = lvProfiles.SelectedItems[0].SubItems[1].Text;
            Mesaj      Msj    = new Mesaj();
            MesajSonuç Msonuc = Msj.Göster(String.GetLangText("PRF_DEL_CONFIRM"), String.GetLangText("PRF_DEL_CONFIRM_HDR", SelectedProfile), MessageBoxButtons.YesNo);

            if (Msonuc.MesajCevap == DialogResult.Yes)
            {
                UserProfileUtils.DeleteUserProfile(SelectedProfile);
                lvProfiles.Items.Remove(lvProfiles.SelectedItems[0]);
            }
        }
        private void profilDeğiştirToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string      oldname = GlobalVariants.ActiveProfile.ProfileName;
            UserProfile uProfil = ProfileSelector.SelectProfile();

            if (uProfil != null && oldname != uProfil.ProfileName)
            {
                if (ActiveGame.IsGameStarted)
                {
                    ActiveGame.Resign();
                }
                grpStartNew.Visible = true;
                grpGame.Visible     = false;
                UserProfileUtils.SaveUserProfile(GlobalVariants.ActiveProfile);
                GlobalVariants.ActiveProfile = uProfil;
                UserProfileStatsGenerator.RecordProfile(GlobalVariants.ActiveProfile, ActiveGame);
            }
        }
    void Start()
    {
        local_profile = UserProfileUtils.ReadProfileFromDevice();
        StartCoroutine(LifeSystemRoutine());


        #if UNITY_EDITOR
        if (PlayerPrefs.GetInt("TestLevel") != 0)
        {
            Level.TestLevel(PlayerPrefs.GetInt("TestLevel"));
            return;
        }
        #endif

        if (PlayerPrefs.GetInt("FirstPass") != 1)
        {
            StartCoroutine(FirstPass());
            return;
        }
    }
    IEnumerator SaveUserInventoryRoutine()
    {
        yield return(0);

        UserProfileUtils.WriteProfileOnDevice(local_profile);
    }
 void TryToSaveProfile(string page)
 {
     UserProfileUtils.WriteProfileOnDevice(local_profile);
 }