Пример #1
0
 public void CreateProfile(string name)
 {
     SProfilePlayer.setInstance(new SProfilePlayer(name));
     SProfilePlayer.getInstance().AchievementsManager.AddStepAchievement(AchievementEvent.createProfile);
     SProfilePlayer.getInstance().SpritesAchievements = SpritesAchievements;
     SProfilePlayer.getInstance().DefaultSprite       = DefaultSprite;
 }
Пример #2
0
 public void HideLogPanel()
 {
     PlayerNameText.text = Strings.Menu["Hi"] + SProfilePlayer.getInstance().Name;
     LogButton.SetActive(true);
     DeleteButton.SetActive(true);
     LogPanel.SetActive(false);
 }
Пример #3
0
 private void displayInfo()
 {
     if (queue.Count > 0)
     {
         AchievementInfo achInfo = queue.Peek();
         Text.text = achInfo.Name;
         Texture2D texture = SProfilePlayer.getInstance().DefaultSprite;
         if (SProfilePlayer.getInstance().SpritesAchievements != null)
         {
             foreach (var t in SProfilePlayer.getInstance().SpritesAchievements)
             {
                 if (t.name.Equals(achInfo.Name))
                 {
                     texture = t;
                 }
             }
         }
         else
         {
             Debug.LogError("Lance la scene depuis le menu !");
         }
         Image.texture = texture;
         speed         = -GameVariables.Achievements.PopUp.speedCome;
     }
 }
Пример #4
0
 public void TutorialCalled(string tutoName)
 {
     if (SProfilePlayer.getInstance().TutorialsCalled.Contains(tutoName))
     {
         return;
     }
     SProfilePlayer.getInstance().TutorialsCalled.Add(tutoName);
 }
Пример #5
0
 public void SetDiffilculty()
 {
     selectedDifficulty = SProfilePlayer.getInstance().Difficulty;
     foreach (SO.WolfStats wolfStats in wolvesStats)
     {
         wolfStats.SetDifficulty(difficultySettings, selectedDifficulty);
     }
 }
Пример #6
0
 public static SProfilePlayer getInstance()
 {
     if (instance == null)
     {
         instance = new SProfilePlayer();
     }
     return(instance);
 }
Пример #7
0
 public void OpenTutorial(string tutoName)
 {
     if (SProfilePlayer.getInstance().TutorialsCalled.Contains(tutoName))
     {
         return;
     }
     GameManager.instance.PauseGame();
     scriptTuto.ShowTuto(tutoName);
 }
Пример #8
0
 //Choose difficulty of game
 public void PlayWithDifficulty(int difficulty)
 {
     HideAllPanels();
     LogButton.SetActive(false);
     DeleteButton.SetActive(false);
     LoadingScreen.SetActive(true);
     SProfilePlayer.getInstance().Difficulty = difficulty; // to be use in game
     SceneManager.LoadSceneAsync(1);
 }
Пример #9
0
    public void SetCurrentGunStats()
    {
        gunStats.DamageMultiplier   = 1f;
        gunStats.FireRateMultiplier = 1f;

        if (SProfilePlayer.getInstance().AchievementsManager.GetAchievementByName("Shoot").IsComplete())
        {
            gunStats.DamageMultiplier = 1.1f;
        }

        // ...

        gunStats.Init();
    }
Пример #10
0
 public void Start()
 {
     // hide the panel to select profiles when we come back to this scene (from the scene of the game)
     if (SProfilePlayer.getInstance().Name.Equals("<Default>"))
     {
         LogPanel.SetActive(true);
     }
     else
     {
         PlayerNameText.text = Strings.Menu["Hi"] + SProfilePlayer.getInstance().Name;
         LogButton.SetActive(true);
         DeleteButton.SetActive(true);
         LogPanel.SetActive(false);
     }
 }
Пример #11
0
        public void callAchievement(AchievementEvent achEvent, int step = 1)
        {
            List <AchievementInfo> endedAchievements = SProfilePlayer.getInstance().AchievementsManager.AddStepAchievement(achEvent, step);

            // hack fix to prevent bug when quitting the game
            if (achEvent == AchievementEvent.quit)
            {
                return;
            }
            if (endedAchievements != null)
            {
                foreach (var achInfo in endedAchievements)
                {
                    AchievementPopUp.GetComponent <AchievementPopUpScript>().AddAchievement(achInfo);
                }
            }
        }
Пример #12
0
 public void LoadProfile(string fullName)
 {
     if (File.Exists("./saves/" + fullName))
     {
         BinaryFormatter bf   = new BinaryFormatter();
         FileStream      file = File.Open("./saves/" + fullName, FileMode.Open);
         SProfilePlayer.setInstance((SProfilePlayer)bf.Deserialize(file));
         file.Close();
         SProfilePlayer.getInstance().AchievementsManager.ResetManagerOnAchievementInfos();
         SProfilePlayer.getInstance().SpritesAchievements = SpritesAchievements;
         SProfilePlayer.getInstance().DefaultSprite       = DefaultSprite;
     }
     else
     {
         Debug.LogWarning("file not found");
         CreateProfile("Lost Save");
     }
 }
Пример #13
0
    static public void SaveProfile()
    {
        if (SProfilePlayer.getInstance().Name.Equals("<Default>"))
        {
            return;
        }
        if (!File.Exists("./saves"))
        {
            System.IO.Directory.CreateDirectory("./saves");
        }
        DeleteProfile(SProfilePlayer.getInstance().Name);
        FileStream file = File.Create("./saves/" + SProfilePlayer.getInstance().Name + "-" +
                                      DateTime.Now.ToLongDateString().Split(',')[1] + ".save");
        BinaryFormatter bf = new BinaryFormatter();

        bf.Serialize(file, SProfilePlayer.getInstance());
        file.Close();
    }
Пример #14
0
 private void Start()
 {
     soundManager      = gameObject.GetComponent <SoundManager>();
     _enclosureManager = EnclosureManager.Instance;
     cycleManager      = CycleManagerObject.GetComponent <CycleManager>();
     cycleManager.SubscribCycle(this);
     cycleManager.GoToAngle(1, 30);
     TotalSheeps    = GameVariables.Initialisation.numberSheeps;
     Time.timeScale = 1;
     GetComponent <DifficultyManager>().SetDiffilculty();
     Cursor.visible   = false;
     Cursor.lockState = CursorLockMode.Locked;
     if (SProfilePlayer.getInstance().AchievementsManager.GetAchievementByName("Player").IsComplete())
     {
         TotalSuperSheeps = 1;
     }
     else
     {
         TotalSuperSheeps = 0;
     }
     DayStart();
 }
Пример #15
0
    public void CreateListPanel()
    {
        if (elements == null)
        {
            elements = new List <GameObject>();
        }
        else
        {
            foreach (var go in elements)
            {
                UnityEngine.Object.Destroy(go);
            }
        }
        elements = new List <GameObject>();
        float padding  = 150f;
        int   sizeList = SProfilePlayer.getInstance().AchievementsManager.getAchivements().Count;

        if (sizeList % 2 != 0)
        {
            sizeList++;
        }

        ListAchievements.GetComponent <RectTransform>().sizeDelta = new Vector2(padding * sizeList + 20f, 0);
        ListAchievements.transform.localPosition += new Vector3((sizeList * padding) / 2, 0, 0);

        float x            = ((sizeList * padding) + padding) / 2f + 50f;
        bool  createBottom = false;

        foreach (var achInfo in SProfilePlayer.getInstance().AchievementsManager.getAchivements())
        {
            x -= (createBottom)? 0 : padding * 2f;
            int y = (int)((createBottom) ? padding : -padding);
            createBottom = !createBottom;

            GameObject r = Instantiate(AchievementPrefab, ListAchievements.transform);
            elements.Add(r);
            Texture2D texture = ObjectMainMenu.GetComponent <ProfileManager>().DefaultSprite;
            if (achInfo.IsComplete())
            {
                texture = ObjectMainMenu.GetComponent <ProfileManager>().CompletedSprite;
            }
            else
            {
                foreach (var t in ObjectMainMenu.GetComponent <ProfileManager>().SpritesAchievements)
                {
                    if (t.name.Equals(achInfo.Name))
                    {
                        texture = t;
                    }
                }
            }
            r.GetComponent <RawImage>().texture = texture;
            r.GetComponent <ScriptDisplayAchievement>().Name   = achInfo;
            r.GetComponent <ScriptDisplayAchievement>().MenuGO = ObjectMainMenu;
            r.GetComponent <Button>().onClick.AddListener(r.GetComponent <ScriptDisplayAchievement>().Load);
            r.transform.localScale    = new Vector3(1f, 1f, 1f);
            r.transform.localPosition = new Vector3(x, y, 0);

            //set attributes
            Text name = r.transform.Find("Name").GetComponent <Text>();
            name.text = achInfo.Name;
        }
    }
Пример #16
0
 public void DeleteCurrentProfile()
 {
     ProfileManager.DeleteProfile(SProfilePlayer.getInstance().Name);
     ShowLogPanel();
 }
Пример #17
0
 public static void setInstance(SProfilePlayer spp)
 {
     instance = spp;
 }