Exemple #1
0
    //
    private void autoSaveNurture()
    {
        Nurture.Calendar calendar = NurtureMode.Calendar;
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.YEAR, calendar.Year);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.MONTH, calendar.Month);

        Nurture.Character nurtureCharacter = NurtureMode.Character;
        int condition = (int)nurtureCharacter.Condition;

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.CONDITION, condition);

        int actionCount = Manager.Instance.DT.Action.Count;

        for (int id = 0; id < actionCount; ++id)
        {
            string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ACTION_COUNT, id);
            CustomPlayerPrefs.SetInt(key, nurtureCharacter.GetActionCount(id));
        }

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.MONEY, nurtureCharacter.Money);

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.STRESS, nurtureCharacter.Stress);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.STAMINA, nurtureCharacter.Stamina);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.INTELLECT, nurtureCharacter.Intellect);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.GRACE, nurtureCharacter.Grace);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.CHARM, nurtureCharacter.Charm);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.ATTACK, nurtureCharacter.Attack);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.DEFENSE, nurtureCharacter.Defense);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.LEADERSHIP, nurtureCharacter.Leadership);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.TACTIC, nurtureCharacter.Tactic);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.MORALITY, nurtureCharacter.Morality);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.GOODNESS, nurtureCharacter.Goodness);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.SENSIBILITY, nurtureCharacter.Sensibility);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.ARTS, nurtureCharacter.Arts);
    }
Exemple #2
0
    void OnApplicationQuit()
    {
        CustomPlayerPrefs.SetBool("isMaskFlipped", isFlipped, true);
        CustomPlayerPrefs.SetFloat("maskScale", maskScale, true);
        CustomPlayerPrefs.SetInt("selectedMaskID", selectedMaskID, true);

        CustomPlayerPrefs.SetFloat("maskAlpha", maskMat.GetColor("_Color").a, true);
        CustomPlayerPrefs.SetFloat("maskColor_R", maskMat.GetColor("_Color").r, true);
        CustomPlayerPrefs.SetFloat("maskColor_G", maskMat.GetColor("_Color").g, true);
        CustomPlayerPrefs.SetFloat("maskColor_B", maskMat.GetColor("_Color").b, true);
    }
Exemple #3
0
        public override bool Play()
        {
            Log.Debug(ToString());

            Mode.CmdPictureEvent.Invoke(Id);

            string key   = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISLOCKED_PICTURE, Id);
            int    value = PlayerPrefsKey.GetBoolToInt(false);

            CustomPlayerPrefs.SetInt(key, value);

            return(false);   // no more child to play
        }
Exemple #4
0
        protected override void first()
        {
            string prefixKey = null;
            if (_mode.Character.IsChildHood())
                prefixKey = PlayerPrefsKey.ISLOCKED_VACATION_CHILD;
            else
                prefixKey = PlayerPrefsKey.ISLOCKED_VACATION_ADULT;

            string key = PlayerPrefsKey.GetKey(prefixKey, _seasonId);
            int value = PlayerPrefsKey.GetBoolToInt(false);
            CustomPlayerPrefs.SetInt(key, value);

            _mode.Schedule.ActionFirstEvent.Invoke();
        }
Exemple #5
0
    public void CreateTargetCharacter(int targetId)
    {
        if (false == ExtTarget.isValid(targetId))
        {
            Log.Error(string.Format("invalid target id; {0}", targetId));
            return;
        }

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.TARGET, targetId);
        Story.TargetCharacter tc = loadTargetCharacter();
        StoryMode.Set(tc);

        startTargetPrologue(tc);
    }
Exemple #6
0
    private void onScenarioEnd()
    {
        if (false == _isStartTargetScenario)
        {
            return;
        }

        _isStartTargetScenario = false;

        Story.TargetCharacter target = StoryMode.TargetCharacter;
        target.NextScenarioNo();

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.FEELING, target.Feeling);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.LAST_OPENED_SCENARIO_NO, target.LastOpenedScenarioNo);
    }
    public void FinishLevel()
    {
        if (oldStars == 0)
        {
            float prop_coin = score / (float)num_coins_start;
            stars = (prop_coin > .5f) ? (prop_coin > .8f ? 2 : 1) : 0;
            if (health > 0)
            {
                stars++;
            }
        }
        else
        {
            stars = oldStars;
        }
        if (this.transform.position.y < 0 || health <= 0)
        {
            stars = 0;
        }
        else
        {
            this.audioSource.PlayOneShot(victorySound);
            CustomPlayerPrefs.SetString("Level", nextLevel);
            CustomPlayerPrefs.SetInt("Score", score + CustomPlayerPrefs.GetInt("Score", 0));
            CustomPlayerPrefs.SetInt("LastStars", stars);
            Helpers.ChangeUserProgress(saveLevel == null ? Application.loadedLevelName : saveLevel, stars);
        }

        if (nextLevel.Contains("boss") && stars > 0 && !Application.loadedLevelName.Contains("boss"))
        {
            Application.LoadLevel(nextLevel);
        }

        else if (!Application.loadedLevelName.Contains("boss") || stars == 0)
        {
            EndScreen end = Instantiate(endScreen, GameObject.Find("UI").transform).GetComponent <EndScreen>();
            end.checkpoint = checkpoint;
            end.nextLevel  = nextLevel;
            Time.timeScale = 0;
            GameObject.Find("music").GetComponent <AudioSource>().mute = true;
        }
    }
Exemple #8
0
    private void onNurtureEndingScenarioEnd()
    {
        Log.Debug("onNurtureEndingScenarioEnd");

        StoryMode.ScenarioEndEvent.Detach(onNurtureEndingScenarioEnd);

        string key   = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISLOCKED_NURTURE_ENDING, _nurtureEndingId);
        int    value = PlayerPrefsKey.GetBoolToInt(false);

        CustomPlayerPrefs.SetInt(key, value);

        if (Def.NURTURE_BAD_ENDING_ID == _nurtureEndingId)
        {
            Manager.Instance.End();
            return;
        }

        _nurtureEndingId = -1;

        EndNurtureEvent.Invoke();
    }
Exemple #9
0
 private void SaveUserStats(IUserStats userStats)
 {
     CustomPlayerPrefs.SetBool(StringConstants.PlayerPrefsKeys.FirstSession, userStats.IsFirstSession);
     CustomPlayerPrefs.SetInt(StringConstants.PlayerPrefsKeys.TutorialStage, userStats.TutorialStage);
 }
Exemple #10
0
 public void SetAbilityLevel(AbilityType abilityType, int value)
 {
     value = Mathf.Clamp(value, 0, abilityInfo[abilityType].maxLevel + 1);
     CustomPlayerPrefs.SetInt($"{AbilityLevelKey}_{abilityType}", value, true);
 }
    void Awake()
    {
        muteSfx   = CustomPlayerPrefs.GetInt("MuteSfx", 0) == 1;
        muteMusic = CustomPlayerPrefs.GetInt("MuteMusic", 0) == 1;

        muteSfxImg   = GameObject.Find("mute-sfx").GetComponent <Image>();
        muteMusicImg = GameObject.Find("mute-music").GetComponent <Image>();


        GameObject.Find("mute-sfx").GetComponent <Button>().onClick.AddListener(delegate { muteSfx = !muteSfx;
                                                                                           CustomPlayerPrefs.SetInt("MuteSfx", muteSfx ? 1 : 0);
                                                                                           GameObject.FindGameObjectWithTag("Player").GetComponent <PlayableCharacter>().muteSfx = muteSfx;
                                                                                           PrefsChanged.Invoke();
                                                                                           CustomPlayerPrefs.Save(); });
        GameObject.Find("mute-music").GetComponent <Button>().onClick.AddListener(delegate { muteMusic = !muteMusic;
                                                                                             CustomPlayerPrefs.SetInt("MuteMusic", muteMusic ? 1 : 0);
                                                                                             GameObject.FindGameObjectWithTag("Player").GetComponent <PlayableCharacter>().muteMusic = muteMusic;
                                                                                             PrefsChanged.Invoke();
                                                                                             CustomPlayerPrefs.Save(); });
        GameObject.Find("resume").GetComponent <Button>().onClick.AddListener(delegate { Time.timeScale = 1.0f; Destroy(this.gameObject); });
        GameObject.Find("restart").GetComponent <Button>().onClick.AddListener(delegate { Time.timeScale = 1.0f; Application.LoadLevel(Application.loadedLevel); });

#if UNITY_WEBGL
        Destroy(GameObject.Find("main-menu"));
#else
        GameObject.Find("main-menu").GetComponent <Button>().onClick.AddListener(delegate { Time.timeScale = 1.0f; Application.LoadLevel("main-menu"); });
#endif
    }
Exemple #12
0
    private void initialize()
    {
        SetContinueData(PlayerInitProperty.Name);

        int constitutionId = (int)PlayerInitProperty.Constitution;
        int zodiacId       = (int)PlayerInitProperty.Zodiac;
        int condition      = (int)Nurture.ECondition.Healthy;

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.YEAR, Def.INIT_YEAR);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.MONTH, Def.INIT_MONTH);

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.ZODIAC, zodiacId);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.CONDITION, condition);

        int actionCount = DT.Action.Count;

        for (int id = 0; id < actionCount; ++id)
        {
            string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ACTION_COUNT, id);
            CustomPlayerPrefs.SetInt(key, 0);
        }

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.MONEY, Def.INIT_MONEY);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.CONSTITUTION, constitutionId);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.WEARING_COSTUME, Def.DEFAULT_COSTUME_ID);

        int costumeCount = DT.MainCharacterCostume.Count;

        for (int id = 0; id < costumeCount; ++id)
        {
            string key = PlayerPrefsKey.GetKey(PlayerPrefsKey.ISBUY_COSTUME, id);

            bool isBuy = false;
            if (Def.DEFAULT_COSTUME_ID == id)
            {
                isBuy = true;
            }

            int isBuyInteger = PlayerPrefsKey.GetBoolToInt(isBuy);

            CustomPlayerPrefs.SetInt(key, isBuyInteger);
        }

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.STRESS, Def.MIN_STAT);
        Zodiac zodiac = DT.Zodiac[zodiacId];

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.STAMINA, zodiac.stamina);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.INTELLECT, zodiac.intellect);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.GRACE, zodiac.grace);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.CHARM, zodiac.charm);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.ATTACK, zodiac.attack);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.DEFENSE, zodiac.defense);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.LEADERSHIP, zodiac.leadership);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.TACTIC, zodiac.tactic);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.MORALITY, zodiac.morality);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.GOODNESS, zodiac.goodness);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.SENSIBILITY, zodiac.sensibility);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.ARTS, zodiac.arts);

        CustomPlayerPrefs.SetInt(PlayerPrefsKey.TARGET, -1);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.FEELING, Def.MIN_FEELING);
        CustomPlayerPrefs.SetInt(PlayerPrefsKey.LAST_OPENED_SCENARIO_NO, Def.MIN_SCENARIO - 1);
    }