예제 #1
0
    void Awake()
    {
        instance = this;
        DontDestroyOnLoad(gameObject);

        //Set music on or off
        if (PlayerPrefs.HasKey(SaveStrings.sMusic))
        {
            musicMuted = PlayerPrefsExt.GetBool(SaveStrings.sMusic);
        }
        else
        {
            musicMuted = false;
            PlayerPrefsExt.SetBool(SaveStrings.sMusic, musicMuted);
        }

        //Set sounds on or off
        if (PlayerPrefs.HasKey(SaveStrings.sSounds))
        {
            soundMuted = PlayerPrefsExt.GetBool(SaveStrings.sSounds);
        }
        else
        {
            soundMuted = false;
            PlayerPrefsExt.SetBool(SaveStrings.sSounds, soundMuted);
        }
    }
 public void SwitchRankedMode()
 {
     if (isLoggingIn)
     {
         Popup.Make(this, "Now signing in, please wait...");
         return;
     }
     if (LocalProfile.Exists())
     {
         var ranked = PlayerPrefsExt.GetBool(PreferenceKeys.RankedMode(), false);
         ranked = !ranked;
         PlayerPrefsExt.SetBool(PreferenceKeys.RankedMode(), ranked);
         rankStatusText.text = ranked ? "On" : "Off";
         UpdateBestText();
         if (ranked && !PlayerPrefsExt.GetBool("dont_show_what_is_ranked_mode_again", false))
         {
             UIManager.ShowUiElement("WhatIsRankedModeBackground", "MusicSelection");
             UIManager.ShowUiElement("WhatIsRankedModeRoot", "MusicSelection");
         }
     }
     else
     {
         UIManager.ShowUiElement("LoginRoot", "MusicSelection");
         UIManager.ShowUiElement("LoginBackground", "MusicSelection");
     }
 }
예제 #3
0
파일: Copter.cs 프로젝트: pasketi/HeliResc
    // Use this for initialization
    protected virtual void Awake()
    {
        levelManager = GameObject.FindObjectOfType <LevelManager>();
        gameManager  = GameObject.FindObjectOfType <GameManager>();
        unlocked     = PlayerPrefsExt.GetBool(copterName + "Unlocked") || unlocked;


        UpdateMethod = NormalUpdate;

        copterSprite = GetComponent <SpriteRenderer>().sprite;

        copterUpgrades = new Dictionary <string, Upgradable>();

        AddUpgradables();
        input = new CopterInput();

        RegisterListeners();

        input.InputUpdate += HandleInput;
        input.TouchStart  += TouchStarted;
        input.TouchEnd    += TouchEnded;
        input.IdleUpdate  += IdleInput;

        copterBody  = GetComponent <Rigidbody2D>();
        copterScale = transform.localScale.x;
        SaveCopter();
    }
예제 #4
0
    public void SwitchRankedMode()
    {
        if (isLoggingIn)
        {
            Popup.Make(this, "Now signing in, please wait...");
            return;
        }

        if (OnlinePlayer.Authenticated)
        {
            var ranked = PlayerPrefsExt.GetBool("ranked", false);
            ranked = !ranked;
            PlayerPrefsExt.SetBool("ranked", ranked);
            rankStatusText.text = ranked ? "On" : "Off";
            UpdateBestText();
            if (ranked && !PlayerPrefsExt.GetBool("dont_show_what_is_ranked_mode_again", false))
            {
                UIManager.ShowUiElement("WhatIsRankedModeBackground", "MusicSelection");
                UIManager.ShowUiElement("WhatIsRankedModeRoot", "MusicSelection");
            }

            if (ranked)
            {
                EventKit.Broadcast("reload rankings");
            }
        }
        else
        {
            UIManager.ShowUiElement("LoginRoot", "MusicSelection");
            UIManager.ShowUiElement("LoginBackground", "MusicSelection");
        }
    }
예제 #5
0
파일: GameNote.cs 프로젝트: yuki4080/Cytoid
    public virtual void Clear(NoteGrade grade)
    {
        if (IsCleared || grade == NoteGrade.Undetermined)
        {
            return;
        }

        IsCleared = true;
        Game.OnClear(this);
        View.OnClear(grade);

        if (!(Game.Instance is StoryboardGame))
        {
            StartCoroutine(DestroyLater());
        }

        if (TimeUntilEnd > -5) // Prevent storyboard seeking
        {
            EventKit.Broadcast("note clear", this);
        }

        // Hit sound
        if (grade != NoteGrade.Miss && (!(this is HoldNote) || !PlayerPrefsExt.GetBool("early hit sounds")))
        {
            PlayHitSound();
        }

        // gameObject.GetComponent<SpriteRenderer> ().material.SetFloat("_HRate", 1.0f);
        // Animation speed = 1.0f;
    }
    public void UpdateBestText()
    {
        if (LoadedLevel == null)
        {
            return;
        }
        bool ranked = PlayerPrefsExt.GetBool(PreferenceKeys.RankedMode());

        if (Math.Abs(ZPlayerPrefs.GetFloat(
                         PreferenceKeys.BestScore(LoadedLevel, CytoidApplication.CurrentChartType, ranked),
                         defaultValue: -1) - (-1)) < 0.000001)
        {
            bestText.text = "NO HIGH SCORE YET";
        }
        else
        {
            bestText.text =
                (ranked ? "R score" : "Score") + " " + Mathf.CeilToInt(ZPlayerPrefs.GetFloat(
                                                                           PreferenceKeys.BestScore(LoadedLevel, CytoidApplication.CurrentChartType, ranked),
                                                                           0)).ToString("D6")
                + "   " + (ranked ? "R acc." : "Acc.") + " " +
                ZPlayerPrefs.GetFloat(
                    PreferenceKeys.BestAccuracy(LoadedLevel, CytoidApplication.CurrentChartType, ranked),
                    0).ToString("0.##") + "%";
        }
    }
예제 #7
0
    // Start is called before the first frame update
    void Start()
    {
		bool musicTogglePrefs = PlayerPrefsExt.GetBool("MusicToggle");
		AudioSourceToggle(musicTogglePrefs);
		checkmark.SetActive(musicTogglePrefs);
		clicked = musicTogglePrefs;
		CheckMarkToggle();
	}
예제 #8
0
 private void Start()
 {
     if (!PlayerPrefsExt.GetBool("show_scanner", defaultValue: true))
     {
         spriteRenderer.enabled = false;
     }
     spriteRenderer.sortingOrder = 30100;
 }
예제 #9
0
    // Start is called before the first frame update
    void Start()
    {
        bool sfxTogglePrefs = PlayerPrefsExt.GetBool("SFXToggle");

        sfx.SetActive(sfxTogglePrefs);
        checkmark.SetActive(sfxTogglePrefs);
        clicked = !clicked;
    }
예제 #10
0
    public void LoadInfo()
    {
        if (PlayerPrefs.HasKey(name + "Star1"))
        {
            star1 = PlayerPrefsExt.GetBool(name + "Star1");
        }
        else
        {
            PlayerPrefsExt.SetBool(name + "Star1", false);
        }

        if (PlayerPrefs.HasKey(name + "Star2"))
        {
            star2 = PlayerPrefsExt.GetBool(name + "Star2");
        }
        else
        {
            PlayerPrefsExt.SetBool(name + "Star2", false);
        }

        if (PlayerPrefs.HasKey(name + "Star3"))
        {
            star3 = PlayerPrefsExt.GetBool(name + "Star3");
        }
        else
        {
            PlayerPrefsExt.SetBool(name + "Star3", false);
        }

        if (PlayerPrefs.HasKey(name + "Ruby"))
        {
            rubyFound = PlayerPrefsExt.GetBool(name + "Ruby");
        }
        else
        {
            PlayerPrefsExt.SetBool(name + "Ruby", false);
        }

        if (PlayerPrefs.HasKey(name + "Unlocked"))
        {
            unlocked = PlayerPrefsExt.GetBool(name + "Unlocked");
        }
        else
        {
            PlayerPrefsExt.SetBool(name + "Unlocked", false);
        }

        if (PlayerPrefs.HasKey(name + "BestTime"))
        {
            bestTime = PlayerPrefs.GetFloat(name + "BestTime");
        }
        else
        {
            PlayerPrefs.SetFloat(name + "BestTime", 999f);
        }
    }
예제 #11
0
        private void Awake()
        {
            toggle = GetComponentInChildren <Toggle>();
            toggle.onValueChanged.AddListener(OnValueChanged);
            if (!PlayerPrefs.HasKey(Key))
            {
                PlayerPrefsExt.SetBool(Key, toggle.isOn);
            }

            toggle.isOn = PlayerPrefsExt.GetBool(Key);
        }
예제 #12
0
    public IEnumerator LoginCoroutine()
    {
        if (OnlinePlayer.Authenticated || !PlayerPrefs.HasKey(PreferenceKeys.LastUsername()) ||
            !PlayerPrefs.HasKey(PreferenceKeys.LastPassword()))
        {
            isLoggingIn = false;
            yield break;
        }

        // If not logged in previously
        yield return(OnlinePlayer.Authenticate());

        CloseLoginWindows();
        isLoggingIn = false;

        var authenticationResult = OnlinePlayer.LastAuthenticationResult;

        switch (authenticationResult.status)
        {
        case 0:
            Popup.Make(this, "Signed in.");
            rankStatusText.text = PlayerPrefsExt.GetBool("ranked") ? "On" : "Off";
            StartCoroutine(LoadAvatarCoroutine());
            if (PlayerPrefsExt.GetBool("ranked"))
            {
                EventKit.Broadcast("reload rankings");
            }
            BestScoreText.WillInvalidate = true;

            break;

        case -1:
            LoadedAvatar = true;
            Popup.Make(this, "Could not fetch player data.");
            break;

        case 1:     // User not exist
            LoadedAvatar = true;
            Popup.Make(this, authenticationResult.message);
            PlayerPrefs.DeleteKey(PreferenceKeys.LastUsername());
            PlayerPrefs.DeleteKey(PreferenceKeys.LastPassword());
            usernameInput.text = "";
            passwordInput.text = "";
            break;

        case 2:     // Incorrect password
            LoadedAvatar = true;
            Popup.Make(this, authenticationResult.message);
            PlayerPrefs.DeleteKey(PreferenceKeys.LastPassword());
            passwordInput.text = "";
            break;
        }
    }
예제 #13
0
 private BulletCurtainManager()
 {
     this.IsBulletCurtainOnList.set_Item(1, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 1, false));
     this.IsBulletCurtainOnList.set_Item(2, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 2, false));
     this.IsBulletCurtainOnList.set_Item(32, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 32, true));
     this.IsBulletCurtainOnList.set_Item(128, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 128, false));
     this.IsBulletCurtainOnList.set_Item(4, PlayerPrefsExt.GetBool("IsBulletCurtainOn" + 4, true));
     BulletCurtainManager.CreatePools();
     TimerHeap.AddTimer(0u, 1000, delegate
     {
         this.CheckStack();
     });
 }
예제 #14
0
        private void ReloadRankings()
        {
            if (!OnlinePlayer.Authenticated || !PlayerPrefsExt.GetBool("ranked"))
            {
                return;
            }

            if (reloadCoroutine != null)
            {
                StopCoroutine(reloadCoroutine);
            }
            reloadCoroutine = StartCoroutine(ReloadRankingsCoroutine());
        }
예제 #15
0
 private ChatManager()
 {
     this.ChannelTipOnList.set_Item(4, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 4, true));
     this.ChannelMaskOnList.set_Item(1, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 1, false));
     this.ChannelMaskOnList.set_Item(2, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 2, false));
     this.ChannelMaskOnList.set_Item(32, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 32, false));
     this.ChannelMaskOnList.set_Item(128, PlayerPrefsExt.GetBool("CHANNEL_TIP_TAG" + 128, false));
     BulletCurtainManager.Instance.Init();
     ChatManager.CreatePools();
     this.InitChatQueues();
     this.m_talkTime      = int.Parse(GameDataUtils.SplitString4Dot0(DataReader <GlobalParams> .Get("talkTime").value));
     this.m_talkRepeatNum = int.Parse(GameDataUtils.SplitString4Dot0(DataReader <GlobalParams> .Get("talkRepeatNum").value));
 }
예제 #16
0
        private void Awake()
        {
            EventKit.Subscribe("reload rankings", ReloadRankings);
            Button.onClick.AddListener(OnButtonPressed);

            enabled = OnlinePlayer.Authenticated && PlayerPrefsExt.GetBool("ranked");

            if (!enabled)
            {
                RootTransform.gameObject.SetActive(false);
            }

            rootRectTransform = RootTransform.GetComponent <RectTransform>();
        }
예제 #17
0
 public void ReadSetting()
 {
     SystemConfig.IsGuideSystemOn = PlayerPrefsExt.GetBool("IsGuideOnName", SysConfigID.GetBool(11));
     SystemConfig.IsPostProcessOn = PlayerPrefsExt.GetBool("IsPostProcessOnName", SystemConfig.IsPostProcessOn);
     SystemConfig.PP_MotionBlurOn = PlayerPrefsExt.GetBool("PP_MotionBlurOnName", SystemConfig.PP_MotionBlurOn);
     SystemConfig.PP_BloomOn      = PlayerPrefsExt.GetBool("PP_BloomOnName", SystemConfig.PP_BloomOn);
     SettingManager.ReadResolution();
     GameLevelManager.GameLevelVariable.PeopleNum = PlayerPrefs.GetInt("PeopleNumName", 45);
     SettingManager.ReadLOD();
     SystemConfig.IsMusicOn    = PlayerPrefsExt.GetBool("IsMusicOnName", SystemConfig.IsMusicOn);
     SystemConfig.IsSoundOn    = PlayerPrefsExt.GetBool("IsMusicOnName", SystemConfig.IsMusicOn);
     SystemConfig.IsHeadInfoOn = PlayerPrefsExt.GetBool("IsHeadInfoOnName", SystemConfig.IsHeadInfoOn);
     SystemConfig.IsManNumOn   = PlayerPrefsExt.GetBool("IsManNumOnName", SystemConfig.IsManNumOn);
 }
예제 #18
0
        public override void OnLateUpdate()
        {
            if (Note.IsHolding && Game.Time >= Note.Note.start_time)
            {
                Triangle.IsShowing = true;
            }
            else
            {
                Triangle.IsShowing = false;
            }

            if (!Note.IsCleared)
            {
                Line.flipY                   = Note.Note.direction == -1;
                CompletedLine.flipY          = Line.flipY;
                CompletedLine.color          = Fill.color;
                Line.sortingOrder            = Ring.sortingOrder;
                CompletedLine.sortingOrder   = Ring.sortingOrder + 1;
                SpriteMask.frontSortingOrder = CompletedLine.sortingOrder + 1;
                SpriteMask.backSortingOrder  = Line.sortingOrder - 1;

                SpriteMask.enabled = Game.Time >= Note.Note.intro_time;

                if (Note.IsHolding)
                {
                    if (Note.Game.Time > Note.Note.start_time)
                    {
                        if (!playedEarlyHitSound && PlayerPrefsExt.GetBool("early hit sounds"))
                        {
                            playedEarlyHitSound = true;

                            Note.PlayHitSound();
                        }

                        ProgressRing.FillColor  = Fill.color;
                        ProgressRing.MaxCutoff  = Mathf.Min(1, 1.333f * Note.Progress);
                        ProgressRing.FillCutoff = Mathf.Min(1, Note.Progress);
                        CompletedLine.size      = new Vector2(1, Note.Note.holdlength * Note.Progress);

                        if (TicksUntilHoldFx == MaxTicksBetweenHoldFx)
                        {
                            TicksUntilHoldFx = 0;
                            SimpleEffects.Instance.PlayHoldFx(this);
                        }

                        TicksUntilHoldFx++;
                    }
                }
            }
        }
예제 #19
0
    public void SwitchDifficulty(string type, bool newLevel)
    {
        if (CytoidApplication.CurrentChartType == type && !newLevel)
        {
            return;
        }
        SetDifficulty(level, level.charts.Find(it => it.type == type));
        CytoidApplication.CurrentChartType = type;
        LevelSelectionController.Instance.UpdateBestText();

        if (PlayerPrefsExt.GetBool("ranked"))
        {
            EventKit.Broadcast("reload rankings");
        }
    }
예제 #20
0
    private static void ReadResolution()
    {
        SystemConfig.IsSetHardwareResolutionOn = PlayerPrefsExt.GetBool("IsResolutionOnName", SystemConfig.IsSetHardwareResolutionOn);
        int @int = PlayerPrefs.GetInt("ResolutionWidthName", SystemConfig.RESOLUTION_WIDTH);
        int num  = @int;

        if (num != 960 && num != 1280 && num != 1920)
        {
            UIUtils.SetHardwareResolution();
        }
        else
        {
            SystemConfig.RESOLUTION_WIDTH = @int;
            UIUtils.SetHardwareResolution();
        }
    }
예제 #21
0
        public virtual void SpawnNote(ChartNote note)
        {
            GameNote gameNote;

            switch (note.type)
            {
            case NoteType.Click:
                gameNote = Instantiate(ClickNotePrefab, transform.parent).GetComponent <GameNote>();
                break;

            case NoteType.Hold:
                gameNote = Instantiate(HoldNotePrefab, transform.parent).GetComponent <GameNote>();
                break;

            case NoteType.LongHold:
                gameNote = Instantiate(LongHoldNotePrefab, transform.parent).GetComponent <GameNote>();
                break;

            case NoteType.DragHead:
                gameNote = Instantiate(DragHeadNotePrefab, transform.parent).GetComponent <GameNote>();
                break;

            case NoteType.DragChild:
                gameNote = Instantiate(DragChildNotePrefab, transform.parent).GetComponent <GameNote>();
                break;

            case NoteType.Flick:
                gameNote = Instantiate(FlickNotePrefab, transform.parent).GetComponent <GameNote>();
                break;

            default:
                gameNote = Instantiate(ClickNotePrefab, transform.parent).GetComponent <GameNote>();
                break;
            }

            gameNote.Init(Chart.Root, note);
            GameNotes.Add(note.id, gameNote);

            // Generate note id holder

            if (this is StoryboardGame || PlayerPrefsExt.GetBool("note ids"))
            {
                var canvas = Instantiate(InfoCanvas, GameNotes[note.id].transform.Find("NoteFill"));
                canvas.GetComponentInChildren <Text>().text = "" + note.id;
            }
        }
예제 #22
0
        protected override void Awake()
        {
            base.Awake();

            Application.targetFrameRate = 120;

            IsLoaded         = false;
            IsPlaying        = false;
            IsCompleted      = false;
            IsFailed         = false;
            UnpauseCountdown = -1;
            PauseTime        = -1;
            PauseDuration    = 0;
            PauseAt          = -1;

            // Play data
            var isRanked = PlayerPrefsExt.GetBool("ranked") && OnlinePlayer.Authenticated;

            Play      = new Play(isRanked);
            Play.Mods = new HashSet <Mod>(PlayerPrefsExt.GetStringArray("mods", new string[0]).ToList()
                                          .ConvertAll(mod => (Mod)Enum.Parse(typeof(Mod), mod)));
            CytoidApplication.CurrentPlay = Play;

            View = new GameView(this);

            // Enable/disable FPS counter
            var fpsCounter = GameObject.FindGameObjectWithTag("FpsCounter");

            if (fpsCounter != null)
            {
                fpsCounter.SetActive(PlayerPrefsExt.GetBool("fps counter"));
            }

            boundaryTopAnimator    = BoundaryTop.GetComponentInChildren <Animator>();
            boundaryBottomAnimator = BoundaryBottom.GetComponentInChildren <Animator>();
            if (!PlayerPrefsExt.GetBool("boundaries"))
            {
                BoundaryTop.GetComponentInChildren <SpriteRenderer>().enabled    = false;
                BoundaryBottom.GetComponentInChildren <SpriteRenderer>().enabled = false;
            }

            BackgroundCanvasHelper.SetupBackgroundCanvas(gameObject.scene);
        }
예제 #23
0
        private void Update()
        {
            if (WillInvalidate)
            {
                if (LevelSelectionController.Instance.LoadedLevel == null)
                {
                    return;
                }

                WillInvalidate = false;

                var ranked    = PlayerPrefsExt.GetBool("ranked") && OnlinePlayer.Authenticated;
                var bestScore = ZPlayerPrefs.GetFloat(
                    PreferenceKeys.BestScore(LevelSelectionController.Instance.LoadedLevel.id,
                                             CytoidApplication.CurrentChartType, ranked),
                    -1
                    );

                if (Math.Abs(bestScore + 1) < 0.000001)
                {
                    Text.text = "No best score yet.";
                }
                else
                {
                    var bestAccuracy = ZPlayerPrefs.GetFloat(
                        PreferenceKeys.BestAccuracy(LevelSelectionController.Instance.LoadedLevel.id,
                                                    CytoidApplication.CurrentChartType, ranked)
                        );

                    var grade = ScoreGrades.From(bestScore);

                    Text.text = string.Format(
                        "<b><color=#{0}>{1} </color></b> {2:D6} / {3:0.00}%",
                        ColorUtility.ToHtmlStringRGB(grade.Color()),
                        grade.ToString(),
                        Mathf.FloorToInt(bestScore),
                        Math.Floor(bestAccuracy * 100) / 100
                        );
                }

                StartCoroutine(RebuildLayout());
            }
        }
예제 #24
0
파일: Engine.cs 프로젝트: pasketi/HeliResc
    public override void Init(Copter copter)
    {
        base.Init(copter);

        copterTr = playerRb.transform;
        copter.fuelTank.TankDepleted += OutOfFuel;      //Subscribe to the fuel tanks TankEmpty event
        copter.fuelTank.TankFilled   += TankFilled;
        UpdateDelegate = FuelUpdate;                    //Start with having fuel

        tempHoldTime = holdTime;
        if (PlayerPrefs.HasKey(SaveStrings.sAutoHoover))
        {
            useAutoHoover = PlayerPrefsExt.GetBool(SaveStrings.sAutoHoover);
        }
        else
        {
            useAutoHoover = true;
        }
    }
예제 #25
0
        private void Update()
        {
            if (!enabled && PlayerPrefsExt.GetBool("ranked") && OnlinePlayer.Authenticated)
            {
                enabled = true;
                RootTransform.gameObject.SetActive(true);
                LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent <RectTransform>());
            }
            else if (enabled && (!PlayerPrefsExt.GetBool("ranked") || !OnlinePlayer.Authenticated))
            {
                enabled = false;
                RootTransform.gameObject.SetActive(false);
                LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent <RectTransform>());
            }
            Wheel.transform.eulerAngles = new Vector3(0, 0, Wheel.transform.eulerAngles.z - 135 * Time.deltaTime);

            rootRectTransform.SetWidth(ButtonTrueWidthTransform.GetWidth());

            LayoutRebuilder.MarkLayoutForRebuild(GetComponent <RectTransform>());
        }
예제 #26
0
    public void OnLevelLoaded()
    {
        EventKit.Broadcast("level loaded");
        CytoidApplication.CurrentLevel = LoadedLevel;

        UpdateBestText();

        chartRelativeOffsetInput.text =
            ZPlayerPrefs.GetFloat(PreferenceKeys.ChartRelativeOffset(CytoidApplication.CurrentLevel.id), 0f).ToString();

        deleteButton.SetActive(!LoadedLevel.IsInternal);

        PlayerPrefs.SetString("last_level", LoadedLevel.id);

        if (PlayerPrefsExt.GetBool("ranked"))
        {
            EventKit.Broadcast("reload rankings");
        }

        StartCoroutine(OnlineMeta.FetchMeta(LoadedLevel.id));
    }
예제 #27
0
    void Start()
    {
        //Set autohoover on or off
        if (PlayerPrefs.HasKey(SaveStrings.sAutoHoover))
        {
            autoHooverOn = PlayerPrefsExt.GetBool(SaveStrings.sAutoHoover);
        }
        else
        {
            autoHooverOn = true;
            PlayerPrefsExt.SetBool(SaveStrings.sAutoHoover, autoHooverOn);
        }

        manager          = GameObject.FindObjectOfType <GameManager>();
        settingsAnimator = GetComponent <Animator>();
        showSettings     = false;

        musicMuted = SoundMusic.MusicMuted;
        soundMuted = SoundMusic.SoundMuted;
        InitButtons();
    }
예제 #28
0
        public void SetupGraphics()
        {
            if (Controllers.Count > 0)
            {
                switch (PlayerPrefs.GetString("storyboard effects"))
                {
                case "High":
                    Screen.SetResolution(CytoidApplication.OriginalWidth, CytoidApplication.OriginalHeight, true);
                    break;

                case "Medium":
                    Screen.SetResolution((int)(CytoidApplication.OriginalWidth * 0.75),
                                         (int)(CytoidApplication.OriginalHeight * 0.75), true);
                    break;

                case "Low":
                    Screen.SetResolution((int)(CytoidApplication.OriginalWidth * 0.5),
                                         (int)(CytoidApplication.OriginalHeight * 0.5), true);
                    break;

                case "None":
                    ShowEffects = false;
                    break;
                }
            }

            if (PlayerPrefsExt.GetBool("low res"))
            {
                Screen.SetResolution((int)(CytoidApplication.OriginalWidth * 0.5),
                                     (int)(CytoidApplication.OriginalHeight * 0.5), true);
            }

            // Enable PRISM only if supported
            if (Prism.m_Shader.isSupported && Prism.m_Shader2.isSupported && Prism.m_Shader3.isSupported)
            {
                Prism.enabled = true;
                Prism.EnableEffects();
            }
        }
예제 #29
0
        private IEnumerator ReloadRankingsCoroutine()
        {
            reloadingRankings = true;

            Wheel.SetActive(true);
            PlayerRankText.gameObject.SetActive(false);

            foreach (var entry in EntryHolder.GetComponentsInChildren <RankingEntryComponent>())
            {
                entry.Destroy();
            }

            EntryHolder.gameObject.SetActive(false);
            MessageText.gameObject.SetActive(true);
            MessageText.text = "Loading rankings...";
            ViewMoreButton.gameObject.SetActive(false);

            if (SceneManager.GetActiveScene().name == "GameResult")
            {
                while (GameResultController.Instance.IsUploading)
                {
                    yield return(null);
                }
            }

            yield return(OnlinePlayer.QueryRankings(CytoidApplication.CurrentLevel.id,
                                                    CytoidApplication.CurrentChartType));

            if (!PlayerPrefsExt.GetBool("ranked"))
            {
                yield break;
            }

            var result = OnlinePlayer.LastRankingQueryResult;

            if (result.status == -1)
            {
                MessageText.text    = "Could not fetch rankings.";
                PlayerRankText.text = "N/A";
                Wheel.SetActive(false);
                PlayerRankText.gameObject.SetActive(true);
                LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent <RectTransform>());
                failed = true;
                yield break;
            }

            if (result.rankings.Length == 0)
            {
                MessageText.text    = "No ranked plays yet.\nBe the first!";
                PlayerRankText.text = "N/A";
                Wheel.SetActive(false);
                PlayerRankText.gameObject.SetActive(true);
                LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent <RectTransform>());
                failed = true;
                yield break;
            }

            Wheel.SetActive(false);
            PlayerRankText.text = result.player_rank == -1 ? "N/A" : "#" + result.player_rank;
            PlayerRankText.gameObject.SetActive(true);
            EntryHolder.gameObject.SetActive(true);

            foreach (var ranking in result.rankings)
            {
                var entry = Instantiate(EntryPrefab, EntryHolder).GetComponent <RankingEntryComponent>();

                entry.Ranking = ranking;
                entry.Load();
            }

            MessageText.gameObject.SetActive(false);
            ViewMoreButton.gameObject.SetActive(true);
            ViewMoreButton.transform.SetAsLastSibling();

            LayoutRebuilder.ForceRebuildLayoutImmediate(GetComponent <RectTransform>());

            reloadingRankings = false;
        }
예제 #30
0
    protected override void Awake()
    {
        base.Awake();

        CytoidApplication.SetAutoRotation(true);
        CytoidApplication.ResetResolution();

        var ringColorDef    = "#FFFFFF";
        var ringColorAltDef = "#FFFFFF";
        var fillColorDef    = "#6699CC";
        var fillColorAltDef = "#FF3C38";

        SetDefaultPref("main offset", Application.platform == RuntimePlatform.Android ? 0f : 0.1f);
        SetDefaultPref("headset offset", -0.05f);
        SetDefaultPref("show_scanner", true);
        SetDefaultPref("inverse", false);
        SetDefaultPref("ring_color", ringColorDef);
        SetDefaultPref("ring_color_alt", ringColorAltDef);
        SetDefaultPref("fill_color", fillColorDef);
        SetDefaultPref("fill_color_alt", fillColorAltDef);
        SetDefaultPref("hit_sound", "None");

        var list = HitSounds.ToList();

        list.Insert(0, new HitSound {
            Name = "None"
        });
        HitSounds = list.ToArray();
        UpdateHitSound(HitSounds[1], save: false);

        var userHitSound = PlayerPrefs.GetString("hit_sound");

        for (var index = 0; index < HitSounds.Length; index++)
        {
            if (HitSounds[index].Name == userHitSound)
            {
                UpdateHitSound(HitSounds[index]);
                HitSoundIndex = index;
            }
        }

        mainOffsetInput.text          = PlayerPrefs.GetFloat("main offset").ToString();
        headsetOffsetInput.text       = PlayerPrefs.GetFloat("headset offset").ToString();
        earlyLateIndicatorToggle.isOn = PlayerPrefsExt.GetBool("early_late_indicator");
        largerHitboxesToggle.isOn     = PlayerPrefsExt.GetBool("larger_hitboxes");

        mainOffsetInput.onEndEdit.AddListener(text =>
        {
            float offset;
            if (!float.TryParse(text, out offset))
            {
                mainOffsetInput.text = PlayerPrefs.GetFloat("main offset").ToString();
            }
            else
            {
                PlayerPrefs.SetFloat("main offset", offset);
            }
        });
        chartRelativeOffsetInput.onEndEdit.AddListener(text =>
        {
            float offset;
            if (!float.TryParse(text, out offset))
            {
                chartRelativeOffsetInput.text = ZPlayerPrefs.GetFloat(PreferenceKeys.ChartRelativeOffset(CytoidApplication.CurrentLevel.id)).ToString();
            }
            else
            {
                ZPlayerPrefs.SetFloat(PreferenceKeys.ChartRelativeOffset(CytoidApplication.CurrentLevel.id), offset);
            }
        });
        headsetOffsetInput.onEndEdit.AddListener(text =>
        {
            float offset;
            if (!float.TryParse(text, out offset))
            {
                headsetOffsetInput.text = PlayerPrefs.GetFloat("headset offset").ToString();
            }
            else
            {
                PlayerPrefs.SetFloat("headset offset", offset);
            }
        });

        usernameInput.text = PlayerPrefs.GetString(PreferenceKeys.LastUsername());
        passwordInput.text = PlayerPrefs.GetString(PreferenceKeys.LastPassword());

        if (!PlayerPrefs.HasKey("ranked"))
        {
            PlayerPrefsExt.SetBool("ranked", false);
        }

        rankStatusText.text = OnlinePlayer.Authenticated && PlayerPrefsExt.GetBool("ranked") ? "On" : "Off";

        // Initialize background
        blackout.SetActive(false);

        var backgrounds = GameObject.FindGameObjectsWithTag("Background");

        if (backgrounds.Length > 1) // Already have persisted background? (i.e. returning from Game/GameResult scene)
        {
            var localBackground = backgrounds.ToList().Find(it => it.scene == gameObject.scene);
            // Destroy local background
            Destroy(localBackground);
            // Setup the persisted background
            BackgroundCanvasHelper.SetupBackgroundCanvas(gameObject.scene);
        }
        else // Setup the local background
        {
            BackgroundCanvasHelper.SetupBackgroundCanvas(gameObject.scene);
        }

        if (OnlinePlayer.Authenticated && OnlinePlayer.AvatarTexture != null)
        {
            LoadedAvatar = true;
        }

        if (Application.platform == RuntimePlatform.Android)
        {
            headsetOffsetInput.gameObject.SetActive(false);
            LayoutRebuilder.ForceRebuildLayoutImmediate(headsetOffsetInput.transform.parent.GetComponent <RectTransform>());
        }

        EventKit.Subscribe <string>("meta reloaded", OnLevelMetaReloaded);
    }