コード例 #1
0
ファイル: StartSceneCanves.cs プロジェクト: GHZaher/CB
    public void SetBallSprite(Ball ball)
    {
        choosedBall = ball;//set the coosed ball which the player choosed it

        if (ball.IsAdNeeded)
        {
            ShowLockedPanel(ball);//show this ball is locked because of not enough score
            print("AdNeeded");
        }
        else if (!ball.IsAdNeeded && ball.BallScoreOpen == 0)
        {
            unlockedBallsFile.BallsLockStates[ball.BallName] = true;                                  //unlock the ball
            SaveFiles.SaveObjectAsJSONAtPersDataPath(unlockedBallsFile, SaveFilesName.UnlockedBalls); //save the new ball lock state
            RemoveUsedBallPanel();                                                                    //remove the UsedBallPanel from the other balls
            ball.UsedBallPanel.SetActive(true);                                                       //active the UsedBallPanel of this ball
            SaveFiles.SetStringPlayerPref("BallName", ball.BallName.ToString());
            print("BallChoosed");
        }
        else
        {
            if (topScore >= ball.BallScoreOpen)     //if he has enough score then use this ball
            {
                RemoveUsedBallPanel();              //remove the UsedBallPanel from the other balls
                ball.UsedBallPanel.SetActive(true); //active the UsedBallPanel of this ball
                SaveFiles.SetStringPlayerPref("BallName", ball.BallName.ToString());
                print("BallChoosed");
            }
            else
            {
                ShowLockedPanel(ball);//show this ball is locked because of not enough score
                print("BallLocked");
            }
        }
    }
コード例 #2
0
ファイル: StartSceneCanves.cs プロジェクト: GHZaher/CB
    private void Start()
    {
        print(Application.persistentDataPath);

        if (SceneManager.GetActiveScene().name == "StartScene")//to get the high score
        {
            topScore           = ScoreManager.GetTopScore();
            highScoreText.text = "High Score:" + topScore;//show top score on the screen
        }

        if (audioManager.IsMusicsMuted)
        {
            buttonMusicControl.GetComponent <Image>().sprite = muteMusicSprite;
        }
        if (audioManager.IsSoundsMuted)
        {
            buttonSoundsControl.GetComponent <Image>().sprite = muteSoundSprite;
        }

        if (PlayerPrefs.HasKey("BallName"))                              //if the player choosed a ball
        {
            string ballName = SaveFiles.GetStringPlayerPref("BallName"); //get the choosen bal name

            RemoveUsedBallPanel();
            for (int i = 0; i < usedBallPanels.Length; i++)
            {
                if (usedBallPanels[i].transform.parent.GetComponent <Ball>().BallName.ToString() == ballName)
                {
                    usedBallPanels[i].SetActive(true);
                }
            }
        }
    }
コード例 #3
0
    private void Start()
    {
        if (!instance)
        {
            instance = true;
        }
        else
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
        playerScore = 0;
        //print(Application.persistentDataPath);
        if (SaveFiles.JsonFileExistsAtPersPath("PlayerScore"))//if there is a player score file already
        {
            playerScoreManager = SaveFiles.LoadObjectFromJSONFile <PlayerScoreManagerFile>("PlayerScore");
            topPlayerScore     = playerScoreManager.TopPlayerScore;//load the top score from it
        }
        else
        {
            playerScoreManager.TopPlayerScore = 0;
            topPlayerScore = 0;
            SaveFiles.SaveObjectAsJSONAtPersDataPath(playerScoreManager, "PlayerScore");//make a new player score file
        }

        scoreTxt.text = playerScoreManager.TopPlayerScore.ToString();//show it on the screen
    }
コード例 #4
0
ファイル: Program.cs プロジェクト: Janika2201/Snake
        static void WriteGameOver(int x)
        {
            int xOffset = 40;
            int yOffset = 8;

            SaveFiles saveFiles = new SaveFiles();

            Console.ForegroundColor = ConsoleColor.Red;
            Console.SetCursorPosition(xOffset, yOffset++);
            WriteText("============================", xOffset, yOffset++);
            WriteText("И Г Р А    О К О Н Ч Е Н А", xOffset + 1, yOffset++);
            yOffset++;
            WriteText("Введите свое имя:", xOffset + 2, yOffset++);
            yOffset++;
            StreamReader from_file = new StreamReader(@"C:\Users\morgo\source\repos\Snake-game\Users.txt", true);

            for (int i = 0; i <= 5; i++)
            {
                string text = from_file.ReadToEnd();
                Console.WriteLine(text);
                yOffset++;
            }
            from_file.Close();
            WriteText("Автор: Veronika Jefimova", xOffset + 2, yOffset++);
            WriteText("Группа: TARpv19", xOffset + 2, yOffset++);
            WriteText("============================", xOffset, yOffset++);

            Console.SetCursorPosition(xOffset + 2, yOffset - 9);
            string NameU = Console.ReadLine();


            saveFiles.to_file(NameU, x);
        }
コード例 #5
0
ファイル: Helper.cs プロジェクト: HukumkaDD/ShootingGallery
    static Helper()
    {
        Tags.Add(TagName.Room, "Room");
        Tags.Add(TagName.MovementCurvy, "MoveCurvy");
        Tags.Add(TagName.Difficulty, "Difficulty");

        Resource.Add(TagName.RightTarget, "Sprites/RightTarget");
        Resource.Add(TagName.WrongTarget, "Sprites/WrongTarget");
        Resource.Add(TagName.NeutralTarget, "Sprites/NeutralTarget");
        Resource.Add(TagName.DeadTarget, "Sprites/DeadTarget/among-dead");
        Resource.Add(TagName.TargetPrefab, "Assets/Client/Prefabs/Target.prefab");

        Difficulty.Add(TagName.Easy, "Easy");
        Difficulty.Add(TagName.Medium, "Medium");
        Difficulty.Add(TagName.Hard, "Hard");

        Scenes.Add(TagName.DefaultShootingGallery, "DefaultShootingGallery");
        Scenes.Add(TagName.MainMenu, "Menu");

        SaveFiles.Add(TagName.PlayerSave, "/SaveFiles.save");

        Audio.Add(TagName.AmongDeathSound, "among-death");
        Audio.Add(TagName.GunShotSound, "gun-shot");
        Audio.Add(TagName.RicochetSound, "ricochet");
        Audio.Add(TagName.MistakeShotSound, "mistake-shot");
    }
コード例 #6
0
ファイル: PlayingSceneManager.cs プロジェクト: GHZaher/CB
    public IEnumerator checkInternetConnection()
    {
        WWW www = new WWW("http://ph-scince.000webhostapp.com/zaherGame/getPermission.php");

        yield return(www);

        if (www.error != null)
        {
            print("Disconnected");

            isItAuthorized = SaveFiles.GetStringPlayerPref("Authorization");
            if (isItAuthorized == "false")
            {
                Application.Quit();//close the game
                print("NotAuthorized  " + isItAuthorized);
            }
            else if (isItAuthorized == "true")
            {
                print("Authorized  " + isItAuthorized);
            }
        }
        else//if there was an internet connection the git datetime from internet
        {
            print("connected");
            StartCoroutine(GetAuthorization());
        }
        yield return(null);
    }
コード例 #7
0
    private void Start()
    {
        SaveFiles.InitFiles();
        m_TotalSaves = SaveFiles.Saves.Length;

        Debug.Log(m_TotalSaves);
        ConfigSaveBtns();
    }
コード例 #8
0
 private void FileWalker_ProgressChanged(object sender, ProgressChangedEventArgs e)
 {
     if (e.UserState is SaveFileInfo info)
     {
         TheSettings.WelcomeList.Add(info.Path);
         SaveFiles.Add(info);
     }
 }
コード例 #9
0
ファイル: AudioManager.cs プロジェクト: GHZaher/CB
 public void MuteMainMusic()
 {
     if (audioSourceMusic.isPlaying)
     {
         isMusicMuted = true;
         audioSourceMusic.Pause();
         SaveFiles.SetStringPlayerPref("IsMusicMuted", isMusicMuted.ToString());//save the current music state
     }
 }
コード例 #10
0
 /// <summary>
 /// Loads the given save file into the current game values.
 /// </summary>
 /// <param name="fileIndex"></param>
 public void SaveSaveFile()
 {
     fileChecks = 0;
     if (saveFiles == null)
     {
         saveFiles = new SaveFiles(3);
     }
     startSavingEvent.Invoke();
     StartCoroutine(WaitForSaveChecks());
 }
コード例 #11
0
    public void SavePlayerScore()
    {
        if (playerScore > playerScoreManager.TopPlayerScore)//if the new score is bigger the the top score
        {
            playerScoreManager.TopPlayerScore = playerScore;
            topPlayerScore = playerScoreManager.TopPlayerScore;//make it the top score
        }

        SaveFiles.SaveObjectAsJSONAtPersDataPath(playerScoreManager, "PlayerScore");//save new score
    }
コード例 #12
0
ファイル: Form1.cs プロジェクト: sylwek845/Odoo-Mobile-Parser
        private void btnSave_Click(object sender, EventArgs e)
        {
            SaveFiles save = new SaveFiles(config);

            save.OModel       = OModel;
            save.SyncProvider = SyncProvider;
            save.SyncService  = SyncService;
            save.XmlAdapter   = xmlAdapter;
            save.SaveData();
        }
コード例 #13
0
ファイル: AudioManager.cs プロジェクト: GHZaher/CB
    //private void OnApplicationQuit()
    //{
    //    SaveFiles.SetStringPlayerPref("IsMusicMuted", isMusicMuted.ToString());//save the current music state
    //    SaveFiles.SetStringPlayerPref("IsSoundsMuted", isSoundsMuted.ToString());//save the current sounds state
    //}


    public void UnMuteMainMusic()
    {
        if (!audioSourceMusic.isPlaying)
        {
            isMusicMuted          = false;
            audioSourceMusic.clip = soundInfo.mainMusicClip;
            audioSourceMusic.loop = true;
            audioSourceMusic.Play();
            SaveFiles.SetStringPlayerPref("IsMusicMuted", isMusicMuted.ToString());//save the current music state
        }
    }
コード例 #14
0
        /// <summary>
        /// Initialize the difficulty
        /// </summary>
        private void InitDifficultyData()
        {
            // Set the save file instance
            m_DifficultyDataFile = new SaveFiles(Application.dataPath, "DifficultyData", ".json");

            // Create a new CustomLobbyData instance
            m_DifficultyData = new DifficultyData()
            {
                Difficulty = m_DifficultyScaler.scaleValue
            };
        }
コード例 #15
0
 private void Start()
 {
     if (SaveFiles.JsonFileExistsAtPersPath(SaveFilesName.UnlockedBalls))//if there is a player score file already
     {
         unlockedBalls = SaveFiles.LoadObjectFromJSONFile <UnlockedBallsFile>(SaveFilesName.UnlockedBalls);
         UnLockBall(unlockedBalls);
     }
     else
     {
         SaveFiles.SaveObjectAsJSONAtPersDataPath(unlockedBalls, SaveFilesName.UnlockedBalls);//make a new player score file
     }
 }
コード例 #16
0
ファイル: NewGamePanel.cs プロジェクト: alexvmvm/village
    public void CreateGame()
    {
        InputField.gameObject.SetActive(false);
        InputField.gameObject.SetActive(true);

        var text = InputField.text;

        if (!string.IsNullOrEmpty(text))
        {
            SaveFiles.SetSaveAndLoad(InputField.text, true);
        }
    }
コード例 #17
0
        /// <summary>
        /// Initialize the custom lobby data
        /// </summary>
        private void InitCustomLobbyData()
        {
            // Set the save file instance
            m_LobbyDataFile = new SaveFiles(Application.dataPath, "LobbyData", ".json");

            // Create a new CustomLobbyData instance
            m_CustomLobbyData = new CustomLobbyData()
            {
                PlayerLimit = m_PlayerScaler.scaleValue,
                EnemyLimit  = m_EnemyScaler.scaleValue
            };
        }
コード例 #18
0
ファイル: Session.cs プロジェクト: alexvmvm/village
    IEnumerator LoadGameC()
    {
        var gameSave = SaveFiles.LoadGameFromName(SaveFileName);

        if (gameSave != null)
        {
            yield return(StartCoroutine(Game.LoadGame(gameSave)));
        }
        else
        {
            Debug.Log($"Unable to find save: ${SaveFileName}");
        }
    }
コード例 #19
0
    public void LoadPlayer()
    {
        PlayerData data = SaveFiles.LoadData();

        level            = data.Level;
        money            = data.Money;
        HighScoreTime[1] = data.TopTime1;
        HighScoreTime[2] = data.TopTime2;
        HighScoreTime[3] = data.TopTime3;
        HighScoreTime[4] = data.TopTime4;
        HighScoreTime[5] = data.TopTime5;
        Rstatus[2]       = data.Rocket2status;
        Rstatus[3]       = data.Rocket3status;
        Rstatus[4]       = data.Rocket4status;
    }
コード例 #20
0
ファイル: GameMenuPanel.cs プロジェクト: alexvmvm/village
 void RefreshLoadSaves()
 {
     Load.DeactivateAll();
     foreach (var saveFile in SaveFiles.GetSaves())
     {
         var obj = Load.GetPooledObject();
         obj.GetComponentInChildren <Text>().text = saveFile.FileNameWithoutExt;
         var btn = obj.GetComponentInChildren <Button>();
         btn.onClick.RemoveAllListeners();
         btn.onClick.AddListener(() => {
             _session.SaveFileName = saveFile.FileNameWithoutExt;
             _session.LoadGame();
         });
         obj.SetActive(true);
     }
 }
コード例 #21
0
ファイル: GameMenuPanel.cs プロジェクト: alexvmvm/village
 void RefreshDeleteSaves()
 {
     Delete.DeactivateAll();
     foreach (var saveFile in SaveFiles.GetSaves())
     {
         var obj = Delete.GetPooledObject();
         obj.GetComponentInChildren <Text>().text = saveFile.FileNameWithoutExt;
         var btn = obj.GetComponentInChildren <Button>();
         btn.onClick.RemoveAllListeners();
         btn.onClick.AddListener(() => {
             SaveFiles.DeleteSave(saveFile);
             Refresh();
         });
         obj.SetActive(true);
     }
 }
コード例 #22
0
    public static float GetTopScore()
    {
        PlayerScoreManagerFile playerScoreManager = new PlayerScoreManagerFile();

        if (SaveFiles.JsonFileExistsAtPersPath("PlayerScore"))//if there is a player score file already
        {
            playerScoreManager = SaveFiles.LoadObjectFromJSONFile <PlayerScoreManagerFile>("PlayerScore");
            return(playerScoreManager.TopPlayerScore);//load the top score from it
        }
        else
        {
            playerScoreManager.TopPlayerScore = 0;
            SaveFiles.SaveObjectAsJSONAtPersDataPath(playerScoreManager, "PlayerScore");//make a new player score file
            return(0);
        }
    }
コード例 #23
0
ファイル: AudioManager.cs プロジェクト: GHZaher/CB
    void Awake()
    {
        if (!instance && SceneManager.GetActiveScene().name == "StartScene")
        {
            instance = true;

            if (SaveFiles.GetStringPlayerPref("IsMusicMuted") != null)       //if there are music state before nad this is not the first time you play the game
            {
                if (SaveFiles.GetStringPlayerPref("IsMusicMuted") == "True") //check the old music state
                {
                    isMusicMuted = true;
                }
                else
                {
                    isMusicMuted = false;
                    UnMuteMainMusic();//play main music
                }
            }
            else//if this the first time you play the game
            {
                isMusicMuted = false;
                UnMuteMainMusic();
                SaveFiles.SetStringPlayerPref("IsMusicMuted", "False");
            }
            if (SaveFiles.GetStringPlayerPref("IsSoundsMuted") != null)       //if there are sounds state before nad this is not the first time you play the game
            {
                if (SaveFiles.GetStringPlayerPref("IsSoundsMuted") == "True") //check the old sounds state
                {
                    isSoundsMuted = true;
                }
                else
                {
                    isSoundsMuted = false;
                }
            }
            else//if this the first time you play the game
            {
                isSoundsMuted = false;
                SaveFiles.SetStringPlayerPref("IsSoundsMuted", "False");
            }
            DontDestroyOnLoad(gameObject);
        }
        else if (SceneManager.GetActiveScene().name == "StartScene")
        {
            Destroy(gameObject);
        }
    }
コード例 #24
0
ファイル: PlayingSceneManager.cs プロジェクト: GHZaher/CB
    public IEnumerator GetAuthorization()
    {
        UnityWebRequest myHttpWebRequest = UnityWebRequest.Get("http://ph-scince.000webhostapp.com/zaherGame/getPermission.php");

        yield return(myHttpWebRequest.Send());

        isItAuthorized = myHttpWebRequest.downloadHandler.text;

        if (isItAuthorized == "false")//if it was not authorized
        {
            SaveFiles.SetStringPlayerPref("Authorization", "false");
            print("Not Authorized  " + isItAuthorized);
            Application.Quit();//close the game
        }
        else if (isItAuthorized == "true")
        {
            SaveFiles.SetStringPlayerPref("Authorization", "true");
            print("Authorized  " + isItAuthorized);
        }
    }
コード例 #25
0
        public void Search()
        {
            if (IsSearching)
            {
                SearchPending = true;
                CancelSearch();
                return;
            }

            SearchPending = false;
            if (Directory.Exists(SelectedDirectory))
            {
                TheSettings.WelcomeList.Clear();
                SaveFiles.Clear();

                SearchWorker.RunWorkerAsync();
                IsSearching = true;

                Log.Info($"Searching for GTA:LCS save files...{(RecursiveSearch ? " (recursive)" : "")}");
            }
        }
コード例 #26
0
        public void PopulateList()
        {
            List <string> toRemove = new List <string>();

            foreach (string path in TheSettings.WelcomeList)
            {
                if (!SaveFileInfo.TryGetInfo(path, out SaveFileInfo info))
                {
                    toRemove.Add(path);
                    continue;
                }
                SaveFiles.Add(info);
            }

            if (toRemove.Count > 0)
            {
                foreach (string path in toRemove)
                {
                    TheSettings.WelcomeList.Remove(path);
                }
            }
        }
コード例 #27
0
ファイル: LoadingPanel.cs プロジェクト: alexvmvm/village
    void RefreshSaveFiles()
    {
        LoadPool.DeactivateAll();
        foreach (var save in SaveFiles.GetSaves())
        {
            var obj             = LoadPool.GetPooledObject();
            var loadingLineItem = obj.GetComponent <LoadingLineItem>();

            loadingLineItem.Text.text = save.FileNameWithoutExt;

            loadingLineItem.Load.onClick.RemoveAllListeners();
            loadingLineItem.Load.onClick.AddListener(() => {
                LoadSave(save);
            });

            loadingLineItem.Delete.onClick.RemoveAllListeners();
            loadingLineItem.Delete.onClick.AddListener(() => {
                DeleteSave(save);
            });

            obj.SetActive(true);
        }
    }
コード例 #28
0
    /// <summary>
    /// Reads the save file if it exists and sets the values.
    /// Creates a new empty save file if there is none.
    /// </summary>
    void Load()
    {
        if (!loadGame)
        {
            return;
        }

        //Load save data
        if (File.Exists(savePath))
        {
            XmlSerializer serializer = new XmlSerializer(typeof(SaveFiles));
            FileStream    file       = File.Open(savePath, FileMode.Open);
            SaveFiles     loadedData = serializer.Deserialize(file) as SaveFiles;
            file.Close();

            if (loadedData == null)
            {
                Debug.LogWarning("Could not open the file: " + savePath);
                saveFiles = new SaveFiles(3);
                Debug.Log("SAVE WAS NULL");
                Save();
            }
            else
            {
                saveFiles = loadedData;
                Debug.Log("Successfully loaded the save data!");
            }
        }
        else
        {
            Debug.LogWarning("Could not open the file: " + savePath);
            saveFiles = new SaveFiles(3);
            Debug.Log("SAVE WS NULL");
            Save();
        }
    }
コード例 #29
0
 public Career(List <ISaveFile> saves, string charName)
 {
     CharacterName = charName;
     SaveFiles.ReplaceAll(saves);
 }
コード例 #30
0
    private IEnumerator WaitForName(int aId)
    {
        yield return(new WaitUntil(() => m_NameConfirmed));

        SaveFiles.StartNewGame(aId, m_NameLabel.text);
    }