Пример #1
0
        private static void InitDb(uint serverId)
        {
            var server = BasicTeraData.Instance.Servers.GetServer(serverId);

            Region = server.Region;
            var td   = new TeraData(Region);
            var lang = td.GetLanguage(Region);

            //if (TimeManager.Instance.CurrentRegion != Region)
            //{
            TimeManager.Instance.SetServerTimeZone(lang);
            SettingsManager.LastRegion = lang;
            //}
            TimeManager.Instance.SetGuildBamTime(false);

            EntitiesManager.CurrentDatabase = new MonsterDatabase(lang);
            ItemsDatabase.Reload(lang);
            AbnormalityManager.CurrentDb = new AbnormalityDatabase(lang);
            SocialDatabase.Load();
            SystemMessages.Load();
            GuildQuestDatabase.Load();
            AccountBenefitDatabase.Load();
            AchievementDatabase.Load();
            AchievementGradeDatabase.Load();
            MapDatabase.Load();
            QuestDatabase.Load();
        }
    public void ResetInventory()
    {
        //Reset narrative db
        NarrativeDatabase narrativeDB = Object.Instantiate((NarrativeDatabase)Resources.Load("NarrativeDatabase"));

        narrativeDB.ResetNarrativeFile();

        //Reset achievement db
        AchievementDatabase achievementDB = Object.Instantiate((AchievementDatabase)Resources.Load("AchievementDatabase"));

        achievementDB.ResetAchievementFile();

        ResetVariables();

        if (SceneManager.GetActiveScene().name == "Shop")
        {
            SaveManager.LoadFromTemplate(defaultInventory);
            Initiate.Fade("Shop", Color.black, 2f);
        }
        else if (SceneManager.GetActiveScene().name == "TutorialShop")
        {
            SaveManager.LoadFromTemplate(TutorialInventory);
            Initiate.Fade("TutorialShop", Color.black, 2f);
        }
    }
    public void ClearSaveData()
    {
        //Doesn't clear, just resets from defaults
        SaveManager.LoadFromTemplate(defaultInventory);
        SaveManager.LoadFromShonkyTemplate(defaultShonkyInventory);
        SaveManager.LoadFromPersistentDataTemplate();
        SaveManager.SaveInventory();
        SaveManager.SaveShonkyInventory();
        SaveManager.SavePersistentData();

        //Reset narrative db
        NarrativeDatabase narrativeDB = Object.Instantiate((NarrativeDatabase)Resources.Load("NarrativeDatabase"));

        narrativeDB.ResetNarrativeFile();

        //Reset achievement db
        AchievementDatabase achievementDB = Object.Instantiate((AchievementDatabase)Resources.Load("AchievementDatabase"));

        achievementDB.ResetAchievementFile();

        //Reset Player prefs
        PlayerPrefs.SetInt("ExistingSave", 0);

        ResetVariables();

        //Send back to main menu
        Initiate.Fade("Intro", Color.black, 2f);
    }
    public void StartNoTutorial()
    {
        goToTutorial = false;
        GameManager.Instance.ActiveGameMode        = GameMode.Story;
        GameManager.Instance.InTutorial            = false;
        GameManager.Instance.TutorialIntroComplete = true;
        GameManager.Instance.firstTownSelect       = true;
        SaveManager.LoadFromTemplate(defaultInventory);
        SaveManager.LoadFromShonkyTemplate(defaultShonkyInventory);
        SaveManager.SaveInventory();
        SaveManager.SaveShonkyInventory();
        titleScreenPrefab.SetActive(false);
        narrativeCanvas.SetActive(true);
        gameObject.SetActive(false);

        //Reset narrative db
        NarrativeDatabase narrativeDB = Object.Instantiate((NarrativeDatabase)Resources.Load("NarrativeDatabase"));

        narrativeDB.ResetNarrativeFile();

        //Reset achievement db
        AchievementDatabase achievementDB = Object.Instantiate((AchievementDatabase)Resources.Load("AchievementDatabase"));

        achievementDB.ResetAchievementFile();
    }
Пример #5
0
        /// <summary>
        /// Progresses an achievement.
        /// The target value is what the 100% marker is, the actual value is what the actual value was achieved.<para/>
        /// For example, say the achievement is to gain 1000 points (target), and the player achieved 750 points (actual).<para/>
        /// Then the achievement would be 75% (750/1000) complete.
        /// </summary>
        public void ProgressAchievement(int id, float target, float actual)
        {
            Achievement achievement = GetAchievement(id);

            achievement.Progress(target, actual);
            NotifyIfUnlocked(achievement);
            AchievementDatabase.SaveAchievementsToFile(achievements);
        }
Пример #6
0
        /// <summary>
        /// Instantly unlocks an achievement.
        /// </summary>
        public void UnlockAchievement(int id)
        {
            Achievement achievement = GetAchievement(id);

            achievement.Unlock();
            NotifyIfUnlocked(achievement);
            AchievementDatabase.SaveAchievementsToFile(achievements);
        }
Пример #7
0
 public void AddAchievementDatabaseToPlayerAchievement()
 {
     for (int i = 0; i < AchievementDatabase.GetAchievementsLength(); i++)
     {
         Achievement achievement = AchievementDatabase.GetAchievement(i);
         AddAchievementToPlayerAchievement(achievement);
     }
 }
Пример #8
0
 private void Start()
 {
     music         = FindObjectOfType <Music>();
     ui            = FindObjectOfType <UIManager>();
     achievementDB = FindObjectOfType <AchievementDatabase>();
     Load();
     music.ChangeTrack(App.Instance.soundDB.MenuTrack());
 }
Пример #9
0
    void Start()
    {
        database = GameObject.Find("Databases").transform.Find("AchievementDatabase").GetComponent <AchievementDatabase> ();
        float totalRows = Mathf.Ceil((database.achievements.Count * 1f) / (achievementsPerRow * 1f));

        int currentIndex = 0;

        for (int i = 0; i < totalRows; i++)
        {
            GameObject panel = Instantiate(achievementRowPrefab) as GameObject;
            panel.transform.SetParent(transform, false);

            for (int j = 0; j < achievementsPerRow; j++)
            {
                if (database.achievements.Count > currentIndex)
                {
                    GameObject achievement = Instantiate(achievementPrefab) as GameObject;
                    achievement.transform.SetParent(panel.transform, false);

                    Text  title       = achievement.transform.Find("Title").GetComponent <Text> ();
                    Text  description = achievement.transform.Find("Description").GetComponent <Text> ();
                    Image image       = achievement.transform.Find("Image").GetComponent <Image> ();
                    Image background  = achievement.GetComponent <Image> ();

                    title.text       = database.achievements [currentIndex].title;
                    description.text = database.achievements [currentIndex].description;
                    image.sprite     = database.achievements [currentIndex].image;

                    if (!database.achievements [currentIndex].awarded)
                    {
                        title.color       = new Color(title.color.r, title.color.g, title.color.b, unobtainedOpacity);
                        description.color = new Color(description.color.r, description.color.g, description.color.b, unobtainedOpacity);
                        image.color       = new Color(image.color.r, image.color.g, image.color.b, unobtainedOpacity);
                        background.color  = new Color(background.color.r, background.color.g, background.color.b, unobtainedOpacity);
                    }

                    currentIndex++;
                }
                else
                {
                    if (currentIndex % achievementsPerRow != 0)
                    {
                        GameObject achievement = Instantiate(achievementPrefab) as GameObject;
                        achievement.transform.SetParent(panel.transform, false);

                        foreach (Transform child in achievement.transform)
                        {
                            Destroy(child.transform.gameObject);
                        }

                        Image background = achievement.GetComponent <Image> ();
                        background.color = new Color(background.color.r, background.color.g, background.color.b, 0f);
                    }
                }
            }
        }
    }
Пример #10
0
    private void Start()
    {
        databaseScript = FindObjectOfType <AchievementDatabase>();
        database       = databaseScript.achievementDatabase;

        playerController = FindObjectOfType <PlayerController>();

        gameObject.SetActive(false);
        closeButton.SetActive(false);
        openButton.SetActive(true);

        CreateList();
        UpdateList();
    }
    public void ExitToShop()
    {
        //Wipe existing save and send back to main menu
        PlayerPrefs.SetInt("ExistingSave", 0);


        //Reset GameManager
        GameManager.Instance.InTutorial               = false;
        GameManager.Instance.TutorialIntroComplete    = false;
        GameManager.Instance.TutorialIntroTopComplete = false;
        GameManager.Instance.InMap          = false;
        GameManager.Instance.BarterTutorial = false;
        GameManager.Instance.OfferNPC       = false;
        GameManager.Instance.HasInspectedAllInventoryItems = false;
        GameManager.Instance.TutorialGolemMade             = false;
        GameManager.Instance.MineGoleminteractGolem        = false;
        GameManager.Instance.SendToMine         = false;
        GameManager.Instance.HasMinePouch       = false;
        GameManager.Instance.WaitingForTimer    = false;
        GameManager.Instance.TimerComplete      = false;
        GameManager.Instance.ReturnPouch        = false;
        GameManager.Instance.OpenPouch          = false;
        GameManager.Instance.firstTownSelect    = false;
        GameManager.Instance.introduceTrueGolem = false;
        GameManager.Instance.canUseTools        = true;

        //Doesn't clear, just resets from defaults
        SaveManager.LoadFromTemplate(defaultInventory);
        SaveManager.LoadFromShonkyTemplate(defaultShonkyInventory);
        SaveManager.LoadFromPersistentDataTemplate();
        SaveManager.SaveInventory();
        SaveManager.SaveShonkyInventory();
        SaveManager.SavePersistentData();

        //Reset narrative db
        NarrativeDatabase narrativeDB = Object.Instantiate((NarrativeDatabase)Resources.Load("NarrativeDatabase"));

        narrativeDB.ResetNarrativeFile();

        //Reset achievement db
        AchievementDatabase achievementDB = Object.Instantiate((AchievementDatabase)Resources.Load("AchievementDatabase"));

        achievementDB.ResetAchievementFile();

        //Show Credits
        creditCanvas.gameObject.SetActive(true);
        creditCanvas.GetComponent <HideCredits>().StartCredits();
    }
Пример #12
0
 void Start()
 {
     database        = GameObject.Find("Databases").transform.Find("AchievementDatabase").GetComponent <AchievementDatabase> ();
     gameModeManager = GetComponent <GameModeManager> ();
 }
Пример #13
0
 private void Start()
 {
     achievements = AchievementDatabase.LoadAchievementsFromFile();
 }
 public static void Reinit()
 {
     achievementDB = Object.Instantiate((AchievementDatabase)Resources.Load("AchievementDatabase"));
 }
 private void OnEnable()
 {
     database = target as AchievementDatabase;
 }