void Awake() { death_positions = new List<Vector3>(); //Check if there is already an instance of ScoreManager if (instance == null){ //if not, set it to this. instance = this; DontDestroyOnLoad(gameObject); RestartValues(); //testValues(); if (!loadHiscores()) { print("No valid highscore file detected. Creating new one."); hscores.Clear(); createHiscoresFile(); } } //If instance already exists: else if (instance != this) { //Destroy this, this enforces our singleton pattern so there can only be one instance Destroy(gameObject); } }
void Awake() { startPosition = GameObject.FindGameObjectWithTag("Position-Start").transform.position; player = GameObject.FindGameObjectWithTag("Player").GetComponent<Character>(); platformManager = this.GetComponent<PlatformManager>(); scoreManager = this.GetComponent<ScoreManager>(); }
void Awake() { Time.timeScale = 1f; Application.targetFrameRate = 60; //gameStatus = true; MakeInstance(); savedCoins = false; _ingameUiManager = this.GetComponent<IngameUIManager>(); _scoreManager = this.gameObject.GetComponent<ScoreManager>(); _levelEnvironmentSpawner = GameObject.Find("LevelSpawner").GetComponent<LevelEnvironmentSpawner>(); if (LevelTypeController.instance != null) { gameType = LevelTypeController.instance.GetGameType(); } else // In the editor this runs if you are not playing from the menu scene { gameType = "Level0"; //gameType = "Level0"; Endless } if (LevelTypeController.instance.GetLastGameSlider() == false) { StartCoroutine(FadeInMusic()); } }
/// <summary> /// [Read only outside script] Checks if the match has started /// </summary> /*bool MatchStarted { public get {return MatchStarted;} private set {value = MatchStarted;} }*/ // Use this for initialization public void Init() { scriptmanager = GameObject.FindGameObjectWithTag("ScriptManager"); scoremanager = GetComponent<ScoreManager>(); gamemodes = scriptmanager.transform.FindChild("GameModes").GetComponents<GameModeScript>(); initialized = true; }
void Start() { currGameBoardPlayer = (int)Sabotage.Enums.Player.ONE; // Player One starts off the game. activePlayer = (int)Sabotage.Enums.PlayerType.GAMEBOARD; // The GameBoard Player starts playing first. scoreManagerScript = FindObjectOfType<ScoreManager>(); startTileGameObject = GameObject.Find("Start Tile"); startTileScript = startTileGameObject.GetComponent<StartTile>(); playerGameObject = (GameObject)Resources.Load("Prefabs/Player"); Vector3 playerSpawnLocation = startTileGameObject.transform.position + new Vector3(0, 0, -0.5f); GameObject instantiatedPlayer = (GameObject)Instantiate(playerGameObject, playerSpawnLocation, startTileGameObject.transform.rotation); instantiatedPlayer.transform.localScale = new Vector3(.5f, .5f, .5f); playerGameObject = instantiatedPlayer.gameObject; playerGameObject.AddComponent<GameBoardPlayer>(); playerGameObject.AddComponent<MouseMovement>(); playerGameObject.GetComponent<BoxCollider>().isTrigger = true; playerGameObject.AddComponent<Rigidbody>().useGravity = false; playerOneGameBoardInventory = new ArrayList(); playerOneGodInventory = new ArrayList(); playerTwoGameBoardInventory = new ArrayList(); playerTwoGodInventory = new ArrayList(); maxGameBoardItems = 5; maxGodItems = 10; }
// Use this for initialization void Start () { scoreManager = GameObject.FindObjectOfType<ScoreManager>(); string[] names = scoreManager.getPlayerNames (); int i, j; for (i = 0; i < names.Length-1; i++) { for (j = i + 1; j < names.Length; j++) { if (Convert.ToInt32 (scoreManager.GetScore (names [i], "score")) < Convert.ToInt32 (scoreManager.GetScore (names [j], "score"))) { string temp = names[i]; names [i] = names [j]; names [j] = temp; } } } int k = 1; foreach(string name in names){ GameObject go = (GameObject)Instantiate (playerScoreEntryPrefab); go.transform.SetParent (this.transform); go.transform.Find ("Player").GetComponent<Text> ().text = name; go.transform.Find ("Score").GetComponent<Text> ().text = scoreManager.GetScore(name,"score"); go.transform.Find ("Date").GetComponent<Text> ().text = scoreManager.GetScore (name, "date"); go.transform.Find ("Rank").GetComponent<Text> ().text = k.ToString(); k++; } }
void Awake() { score = GetComponent<ScoreManager>(); ListJoystickButtons(); Init(); StartCoroutine("UpdateDifficulty"); }
void Start() { SoundManager.SOUNDS.playSound(SoundManager.UI_CLICK,CameraCollider.MATHIUS_EARTH_CAM); stats = MasterController.BRAIN.sm(); gs = GAMESTATE.RESUME; MUI = gameObject.GetComponent<Mathius_UI>(); }
void Awake() { if (instance != null) { Debug.LogError("Instance already created!"); } instance = this; }
public void BackToStart() { noGUI = false; i = null; Destroy (gameObject); Application.LoadLevel ("Start"); }
void Awake() { LevelIndex = Application.loadedLevel; instance = this; if (controlsManager == null) { GameObject newCM = new GameObject("Control_Manager"); controlsManager = newCM.AddComponent<ControlsManager>(); newCM.transform.SetParent(this.transform); } // GET THE SCORE MANAGER // if (scoreManager == null) { GameObject newScM = new GameObject("Score_Manager"); scoreManager = newScM.AddComponent<ScoreManager>(); newScM.transform.SetParent(this.transform); } // LETS SETUP A SCENE // if (sceneManager == null) { GameObject newSM = new GameObject("Scene_Manager"); sceneManager = newSM.AddComponent<SceneManager>(); newSM.transform.SetParent(this.transform); } // link the debugger // GameObject dbg = GameObject.Find ("Debugger"); debugger = dbg.GetComponent<Debugger> (); }
public void Awake() { instance = this; team1Score = new TeamScore(); team2Score = new TeamScore(); }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Awake() { Application.targetFrameRate = 60; m_players = new GameObject[2]; if(GameObject.Find("PLAYER0")) m_players[0] = GameObject.Find("PLAYER0"); else m_players[0] = GameObject.Find("PLAYER0_concept"); if(GameObject.Find("PLAYER1")) m_players[1] = GameObject.Find("PLAYER1"); else m_players[1] = GameObject.Find("PLAYER1_concept"); targetCameraManager = GameObject.Find("TargetCamera"); num_levels = PlayerPrefs.GetInt("num_levels"); if(bConcept) triangle = (GameObject)Instantiate(Resources.Load("triangle", typeof(GameObject))); guiManager = GetComponent<GUIManager>(); scoreManager = GetComponent<ScoreManager>(); goAudioManager = GameObject.Find("goAudioManager"); }
void Awake() { player1pos = GameObject.FindWithTag("Player1").transform.position; player2pos = GameObject.FindWithTag("Player2").transform.position; scoreManager = GameObject.FindWithTag("GameManager").GetComponent<ScoreManager>(); startRotation = transform.eulerAngles; }
// Update is called once per frame void Update() { if(mScoreController == null) { mScoreController = FindObjectOfType<ScoreManager>(); } }
void Awake() { scoreManager = GameObject.FindWithTag("GameManager").GetComponent<ScoreManager>(); ladyAnimation = transform.GetChild(0).GetComponent<LadyAnimation>(); heartParticles.SetActive(false); dinnerParticles.SetActive(false); }
void Start() { dropable = PlayerManager.instance.dropable.prefab; scoreManager = GetComponent<ScoreManager>(); scoreManager.score = 0; UpdateDropSize(); }
void Awake() { levelManager = FindObjectOfType<LevelManager>(); scoreManager = FindObjectOfType<ScoreManager>(); ballController = FindObjectOfType<BallController>(); anim = GetComponent<Animator>(); }
// Update is called once per frame void Update() { if(mScoreManager != null) { if(mScoreManager.mLivesRemaining >= mIconNumber) { //GetComponent<Image>().enabled = true; GetComponent<Animator>().SetBool("LifeLost", false); //GetComponent<Animator>().Play("LifeIcon_Idle"); if(GetComponent<Image>().enabled == false) { ToggleLifeIcon(); } } else { //GetComponent<Image>().enabled = false; GetComponent<Animator>().SetBool("LifeLost", true); } } else { GetComponent<Image>().enabled = false; mScoreManager = FindObjectOfType<ScoreManager>(); } }
void Start() { RangeBox = GetComponent<BoxCollider>(); EnemyOnRange = new ArrayList(); scoreManager = GameObject.Find("Score Manager").GetComponent<ScoreManager>(); PlayerAnim = gameObject.GetComponent<Animator>(); }
// Use this for initialization void Awake() { scr_ObjectFactory = GameObject.FindGameObjectWithTag("ObjectFactory").GetComponent<objectFactory>(); scoreText = GameObject.FindGameObjectWithTag("scoreText").GetComponent<ScoreManager>(); passedTop = false; rotation = new Vector3(0, 0, 0); blueClimbRotation = new Vector3(0, 0, 0); redClimbRotation = new Vector3(0, 0, 0); isGrounded = true; allowFalling = true; colTrggerCount = 0; redDirectionValue = runningSpeed; blueDirectionValue = -runningSpeed; running = new Vector3(runningSpeed,0.0f); runningSlope = new Vector3(slopeRunningSpeed, slopeRunningSpeed); climbing = new Vector3(0.0f, climbingSpeed); falling = new Vector3(0.0f, -climbingSpeed); currentState = manState.Running; //directionValue = 10.0f; //frontCollider = Instantiate(objectFactory.pdf_ManMiniCollider) as GameObject; //frontCollider.GetComponent<BoxCollider2D>().isTrigger = true; //frontCollider.GetComponent<scr_manMiniCollider>().Initialize(this.gameObject); groundCollider = Instantiate(scr_ObjectFactory.pdf_ManGroundCollider) as GameObject; groundCollider.GetComponent<scr_manGroundCollider>().Initialize(this.gameObject); backCollider = Instantiate(scr_ObjectFactory.pdf_ManMiniCollider) as GameObject; backCollider.GetComponent<scr_manMiniCollider>().Initialize(this.gameObject); manRenderer = GetComponent<Renderer>(); }
// Use this for initialization void Start() { DangerTag = transform.parent.GetComponent<FloorRythm>().DangerTag; audioSys = GameObject.Find("Audio System").GetComponent<AudioSystem>(); scoreManager = GameObject.Find("Score Manager").GetComponent<ScoreManager>(); BPM = 280;// GameObject.Find("Main Camera").GetComponent<SceneSetup>().BPM; }
// Use this for initialization void Start () { if (_Instance == null) _Instance = this; //PlayerPrefs.SetInt("IsFirst", 1); SetIsFirst (); m_highScoreText.text = "Best " + PlayerPrefs.GetInt("HighScore"); }
void Awake() { if(Instance == null){ Instance = this; }else{ Destroy(this); } }
void Awake() { puck = GameObject.FindGameObjectWithTag("puck"); GameObject gameManager = GameObject.Find("_GameManager"); scManager = gameManager.GetComponent<ScoreManager>(); playerOneSpawnPoint = GameObject.FindGameObjectWithTag("spawn-point-player-one"); puckBody = puck.GetComponent<Rigidbody>(); }
void Awake() { playerManager = GetComponent<PlayerManager>(); timeManager = GetComponent<TimeManager>(); scoreManager = GetComponent<ScoreManager>(); soundManager = GetComponent<SoundManager>(); TheCommandList.timeManager = timeManager; }
private IEnumerator GotoGameOver() { ScoreManager sm = new ScoreManager(); sm.AddScore(new ScoreEntry() { ScoreInt = this.score, Date = DateTime.Now }); yield return new WaitForSeconds(2f); Globals.GameScore = score; Application.LoadLevel("highScoresScene"); }
// float beatTime = 60.0f/132.0f*8.0f; void Start () { addpoint = temp; _scoreManager = GetComponent<ScoreManager>(); _soundManager = sndManager.GetComponent<SoundManager>(); _currentPhase = 0; _isPlayer2Win = false; _isPlayer1Win = false; }
void Start() { if (m_Score) return; GameObject go = GameObject.Find("ScoreManager"); m_Score = go.GetComponent<ScoreManager>(); }
void Awake () { if (Instance == null) { Instance = this; } else { Destroy(gameObject); } }
// Use this for initialization void Start() { playerControl = FindObjectOfType <PlayerController>(); theScoreManager = FindObjectOfType <ScoreManager>(); fairySound = GameObject.Find("FairyDustSound").GetComponent <AudioSource>(); }
void Awake() { ScoreManager.SetupNewGame(); }
private void load(ReadableKeyCombinationProvider keyCombinationProvider) { try { using (var str = File.OpenRead(typeof(OsuGameBase).Assembly.Location)) VersionHash = str.ComputeMD5Hash(); } catch { // special case for android builds, which can't read DLLs from a packed apk. // should eventually be handled in a better way. VersionHash = $"{Version}-{RuntimeInfo.OS}".ComputeMD5Hash(); } Resources.AddStore(new DllResourceStore(OsuResources.ResourceAssembly)); dependencies.Cache(contextFactory = new DatabaseContextFactory(Storage)); runMigrations(); dependencies.Cache(RulesetStore = new RulesetStore(contextFactory, Storage)); dependencies.CacheAs <IRulesetStore>(RulesetStore); dependencies.Cache(realmFactory = new RealmContextFactory(Storage, "client", contextFactory)); new EFToRealmMigrator(contextFactory, realmFactory, LocalConfig).Run(); dependencies.CacheAs(Storage); var largeStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures"))); largeStore.AddStore(Host.CreateTextureLoaderStore(new OnlineStore())); dependencies.Cache(largeStore); dependencies.CacheAs(this); dependencies.CacheAs(LocalConfig); InitialiseFonts(); Audio.Samples.PlaybackConcurrency = SAMPLE_CONCURRENCY; dependencies.Cache(SkinManager = new SkinManager(Storage, realmFactory, Host, Resources, Audio, Scheduler)); dependencies.CacheAs <ISkinSource>(SkinManager); EndpointConfiguration endpoints = UseDevelopmentServer ? (EndpointConfiguration) new DevelopmentEndpointConfiguration() : new ProductionEndpointConfiguration(); MessageFormatter.WebsiteRootUrl = endpoints.WebsiteRootUrl; dependencies.CacheAs(API ??= new APIAccess(LocalConfig, endpoints, VersionHash)); dependencies.CacheAs(spectatorClient = new OnlineSpectatorClient(endpoints)); dependencies.CacheAs(multiplayerClient = new OnlineMultiplayerClient(endpoints)); var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures); dependencies.Cache(fileStore = new FileStore(contextFactory, Storage)); // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, contextFactory, Scheduler, Host, () => difficultyCache, LocalConfig)); dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, contextFactory, RulesetStore, API, Audio, Resources, Host, defaultBeatmap, performOnlineLookups: true)); dependencies.Cache(BeatmapDownloader = new BeatmapModelDownloader(BeatmapManager, API)); dependencies.Cache(ScoreDownloader = new ScoreModelDownloader(ScoreManager, API)); // the following realm components are not actively used yet, but initialised and kept up to date for initial testing. realmRulesetStore = new RealmRulesetStore(realmFactory, Storage); dependencies.Cache(realmRulesetStore); // this should likely be moved to ArchiveModelManager when another case appears where it is necessary // to have inter-dependent model managers. this could be obtained with an IHasForeign<T> interface to // allow lookups to be done on the child (ScoreManager in this case) to perform the cascading delete. List <ScoreInfo> getBeatmapScores(BeatmapSetInfo set) { var beatmapIds = BeatmapManager.QueryBeatmaps(b => b.BeatmapSetInfoID == set.ID).Select(b => b.ID).ToList(); return(ScoreManager.QueryScores(s => beatmapIds.Contains(s.BeatmapInfo.ID)).ToList()); } BeatmapManager.ItemRemoved += item => ScoreManager.Delete(getBeatmapScores(item), true); BeatmapManager.ItemUpdated += item => ScoreManager.Undelete(getBeatmapScores(item), true); dependencies.Cache(difficultyCache = new BeatmapDifficultyCache()); AddInternal(difficultyCache); dependencies.Cache(userCache = new UserLookupCache()); AddInternal(userCache); dependencies.Cache(beatmapCache = new BeatmapLookupCache()); AddInternal(beatmapCache); var scorePerformanceManager = new ScorePerformanceCache(); dependencies.Cache(scorePerformanceManager); AddInternal(scorePerformanceManager); dependencies.CacheAs <IRulesetConfigCache>(rulesetConfigCache = new RulesetConfigCache(realmFactory, RulesetStore)); var powerStatus = CreateBatteryInfo(); if (powerStatus != null) { dependencies.CacheAs(powerStatus); } dependencies.Cache(SessionStatics = new SessionStatics()); dependencies.Cache(new OsuColour()); RegisterImportHandler(BeatmapManager); RegisterImportHandler(ScoreManager); RegisterImportHandler(SkinManager); // drop track volume game-wide to leave some head-room for UI effects / samples. // this means that for the time being, gameplay sample playback is louder relative to the audio track, compared to stable. // we may want to revisit this if users notice or complain about the difference (consider this a bit of a trial). Audio.Tracks.AddAdjustment(AdjustableProperty.Volume, globalTrackVolumeAdjust); Beatmap = new NonNullableBindable <WorkingBeatmap>(defaultBeatmap); dependencies.CacheAs <IBindable <WorkingBeatmap> >(Beatmap); dependencies.CacheAs(Beatmap); fileStore.Cleanup(); // add api components to hierarchy. if (API is APIAccess apiAccess) { AddInternal(apiAccess); } AddInternal(spectatorClient); AddInternal(multiplayerClient); AddInternal(rulesetConfigCache); GlobalActionContainer globalBindings; var mainContent = new Drawable[] { MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }, // to avoid positional input being blocked by children, ensure the GlobalActionContainer is above everything. globalBindings = new GlobalActionContainer(this) }; MenuCursorContainer.Child = content = new OsuTooltipContainer(MenuCursorContainer.Cursor) { RelativeSizeAxes = Axes.Both }; base.Content.Add(CreateScalingContainer().WithChildren(mainContent)); KeyBindingStore = new RealmKeyBindingStore(realmFactory, keyCombinationProvider); KeyBindingStore.Register(globalBindings, RulesetStore.AvailableRulesets); dependencies.Cache(globalBindings); PreviewTrackManager previewTrackManager; dependencies.Cache(previewTrackManager = new PreviewTrackManager(BeatmapManager.BeatmapTrackStore)); Add(previewTrackManager); AddInternal(MusicController = new MusicController()); dependencies.CacheAs(MusicController); Ruleset.BindValueChanged(onRulesetChanged); }
protected void LoadScore(ScoreInfo score, bool silent) { if (silent) { return; } scoreLoad?.Cancel(); var menu = intro.ChildScreen; if (menu == null) { scoreLoad = Schedule(() => LoadScore(score, false)); return; } var databasedScore = ScoreManager.GetScore(score); var databasedScoreInfo = databasedScore.ScoreInfo; if (databasedScore.Replay == null) { Logger.Log("The loaded score has no replay data.", LoggingTarget.Information); return; } var databasedBeatmap = BeatmapManager.QueryBeatmap(b => b.ID == databasedScoreInfo.Beatmap.ID); if (databasedBeatmap == null) { Logger.Log("Tried to load a score for a beatmap we don't have!", LoggingTarget.Information); return; } if (!currentScreen.AllowExternalScreenChange) { notifications.Post(new SimpleNotification { Text = $"Click here to watch {databasedScoreInfo.User.Username} on {databasedScoreInfo.Beatmap}", Activated = () => { loadScore(); return(true); } }); return; } loadScore(); void loadScore() { if (!menu.IsCurrentScreen) { menu.MakeCurrent(); this.Delay(500).Schedule(loadScore, out scoreLoad); return; } ruleset.Value = databasedScoreInfo.Ruleset; Beatmap.Value = BeatmapManager.GetWorkingBeatmap(databasedBeatmap); Beatmap.Value.Mods.Value = databasedScoreInfo.Mods; currentScreen.Push(new PlayerLoader(() => new ReplayPlayer(databasedScore))); } }
private void ShowLeaderboardsButton_Clicked() { ScoreManager.ShowNativeScoresPage("Level1", showNativePageCallback); }
// Use this for initialization void Start() { theScoreManager = FindObjectOfType <ScoreManager>(); }
void Awake() { Instance = this; }
private void Start() { scoreManager = this; StartScreenOn(); }
private void CollisionWithTarget(Collision2D collision) { if (ConstantManager.IsDebugMode) { Debug.Log("BulletCollider CollisionWithTarget"); } TargetManager scriptTargetManager = collision.gameObject.GetComponent <TargetManager>(); ParentManager scriptParentManager = null; GameObject objectGroupParent = null; GameObject objectBulletParent = this.scriptBulletManager.ObjectMyParent; GameObject objectTargetParent = scriptTargetManager.ObjectMyParent; bool bulletIsIsolated = objectBulletParent.tag != "GroupParent"; bool targetIsIsolated = objectTargetParent.tag != "GroupParent"; if (objectBulletParent == objectTargetParent) { return; } this.scriptSEManager.PlaySEBulletHit(); if (bulletIsIsolated) { ScoreManager.AddScoreWhenBulletCollideWithTarget(); } else { ScoreManager.AddScoreWhenGroupBulletCollideWithTarget(); } if (bulletIsIsolated && targetIsIsolated) { objectGroupParent = Instantiate(this.prefabGroupParent) as GameObject; if (!TipsBoolManager.isAlreadyTipsCollisionTargetAndBullet) { this.scriptOutputTips.SetNextTips(TipsTextManager.TipsCollisionTargetAndBullet); TipsBoolManager.isAlreadyTipsCollisionTargetAndBullet = true; } } else if (bulletIsIsolated) { objectGroupParent = objectTargetParent; } else { objectGroupParent = objectBulletParent; } scriptParentManager = objectGroupParent.GetComponent <ParentManager>(); if (bulletIsIsolated && targetIsIsolated) { scriptParentManager.SyncChild(scriptTargetManager); objectGroupParent.transform.SetParent(this.objectParentOfGroups.transform); } if (bulletIsIsolated) { this.scriptBulletManager.BecomeChild(objectGroupParent); scriptParentManager.NumOfBulletChildren++; } if (targetIsIsolated) { scriptTargetManager.BecomeChild(objectGroupParent); scriptParentManager.NumOfTargetChildren++; } if (!bulletIsIsolated && !targetIsIsolated) { // Debug.Log("parent " + objectTargetParent.name); ParentManager scriptTargetParentManager = objectTargetParent.GetComponent <ParentManager>(); foreach (GameObject child in scriptTargetParentManager.ListObjectChildren) { Debug.Log("child " + child.gameObject.name); if (child.tag == "Bullet") { child.GetComponent <BulletManager>().BecomeChild(objectGroupParent); Debug.Log("child Bullet " + child.name); } else if (child.tag == "Target") { child.GetComponent <TargetManager>().BecomeChild(objectGroupParent); Debug.Log("child Target " + child.name); } } /* 親要素のforeachで、時々、子要素を取得漏れする不具合あり * * foreach (Transform child in objectTargetParent.transform) { * // Debug.Log("child " + child.gameObject.name); * * if (child.gameObject.tag == "Bullet") { * child.gameObject.GetComponent<BulletManager>().BecomeChild(objectGroupParent); * // Debug.Log("child Bullet " + child.gameObject.name); * * } else if (child.gameObject.tag == "Target") { * child.gameObject.GetComponent<TargetManager>().BecomeChild(objectGroupParent); * // Debug.Log("child Target " + child.gameObject.name); * * } * } */ scriptParentManager.NumOfBulletChildren += scriptTargetParentManager.NumOfBulletChildren; scriptParentManager.NumOfTargetChildren += scriptTargetParentManager.NumOfTargetChildren; Destroy(objectTargetParent); } scriptParentManager.UpdateParametersWhenChildrenIsIncreasing(); /* * Debug.Log("----------"); * Debug.Log("Bullet " + scriptParentManager.NumOfBulletChildren); * Debug.Log("Target " + scriptParentManager.NumOfTargetChildren); * Debug.Log("----------"); */ }
private void load(IAPIProvider api, OsuColour colour, ScoreManager scoreManager) { var user = Score.User; statisticsLabels = GetStatistics(Score).Select(s => new ScoreComponentLabel(s)).ToList(); ClickableAvatar innerAvatar; Children = new Drawable[] { new RankLabel(rank) { RelativeSizeAxes = Axes.Y, Width = rank_width, }, content = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = rank_width }, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, CornerRadius = corner_radius, Masking = true, Children = new[] { background = new Box { RelativeSizeAxes = Axes.Both, Colour = user.OnlineID == api.LocalUser.Value.Id && isOnlineScope ? colour.Green : Color4.Black, Alpha = background_alpha, }, }, }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(edge_margin), Children = new[] { avatar = new DelayedLoadWrapper( innerAvatar = new ClickableAvatar(user) { RelativeSizeAxes = Axes.Both, CornerRadius = corner_radius, Masking = true, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Radius = 1, Colour = Color4.Black.Opacity(0.2f), }, }) { RelativeSizeAxes = Axes.None, Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), }, new Container { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Position = new Vector2(HEIGHT - edge_margin, 0f), Children = new Drawable[] { nameLabel = new OsuSpriteText { Text = user.Username, Font = OsuFont.GetFont(size: 23, weight: FontWeight.Bold, italics: true) }, new FillFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0f), Children = new Drawable[] { flagBadgeAndDateContainer = new FillFlowContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Y, Direction = FillDirection.Horizontal, Spacing = new Vector2(5f, 0f), Width = 87f, Masking = true, Children = new Drawable[] { new UpdateableFlag(user.Country) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(28, 20), }, new DateLabel(Score.Date) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, }, }, new FillFlowContainer { Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Margin = new MarginPadding { Left = edge_margin }, Children = statisticsLabels }, }, }, }, }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Direction = FillDirection.Horizontal, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { ScoreText = new GlowingSpriteText { TextColour = Color4.White, GlowColour = Color4Extensions.FromHex(@"83ccfa"), Current = scoreManager.GetBindableTotalScoreString(Score), Font = OsuFont.Numeric.With(size: 23), }, RankContainer = new Container { Size = new Vector2(40f, 20f), Children = new[] { scoreRank = new UpdateableRank(Score.Rank) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(40f) }, }, }, }, }, modsContainer = new FillFlowContainer <ModIcon> { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, ChildrenEnumerable = Score.Mods.Select(mod => new ModIcon(mod) { Scale = new Vector2(0.375f) }) }, }, }, }, }, }; innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200); }
private void Start() { score = ScoreManager.Instance; }
private void load() { Resources.AddStore(new DllResourceStore(OsuResources.ResourceAssembly)); dependencies.Cache(contextFactory = new DatabaseContextFactory(Storage)); var largeStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures"))); largeStore.AddStore(Host.CreateTextureLoaderStore(new OnlineStore())); dependencies.Cache(largeStore); dependencies.CacheAs(this); dependencies.Cache(LocalConfig); AddFont(Resources, @"Fonts/osuFont"); AddFont(Resources, @"Fonts/Torus-Regular"); AddFont(Resources, @"Fonts/Torus-Light"); AddFont(Resources, @"Fonts/Torus-SemiBold"); AddFont(Resources, @"Fonts/Torus-Bold"); AddFont(Resources, @"Fonts/Noto-Basic"); AddFont(Resources, @"Fonts/Noto-Hangul"); AddFont(Resources, @"Fonts/Noto-CJK-Basic"); AddFont(Resources, @"Fonts/Noto-CJK-Compatibility"); AddFont(Resources, @"Fonts/Venera-Light"); AddFont(Resources, @"Fonts/Venera-Bold"); AddFont(Resources, @"Fonts/Venera-Black"); runMigrations(); dependencies.Cache(SkinManager = new SkinManager(Storage, contextFactory, Host, Audio, new NamespacedResourceStore<byte[]>(Resources, "Skins/Legacy"))); dependencies.CacheAs<ISkinSource>(SkinManager); if (API == null) API = new APIAccess(LocalConfig); dependencies.CacheAs(API); var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures); dependencies.Cache(RulesetStore = new RulesetStore(contextFactory)); dependencies.Cache(FileStore = new FileStore(contextFactory, Storage)); // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Storage, API, contextFactory, Host)); dependencies.Cache(BeatmapManager = new BeatmapManager(Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap)); // this should likely be moved to ArchiveModelManager when another case appers where it is necessary // to have inter-dependent model managers. this could be obtained with an IHasForeign<T> interface to // allow lookups to be done on the child (ScoreManager in this case) to perform the cascading delete. List<ScoreInfo> getBeatmapScores(BeatmapSetInfo set) { var beatmapIds = BeatmapManager.QueryBeatmaps(b => b.BeatmapSetInfoID == set.ID).Select(b => b.ID).ToList(); return ScoreManager.QueryScores(s => beatmapIds.Contains(s.Beatmap.ID)).ToList(); } BeatmapManager.ItemRemoved += i => ScoreManager.Delete(getBeatmapScores(i), true); BeatmapManager.ItemAdded += i => ScoreManager.Undelete(getBeatmapScores(i), true); dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore)); dependencies.Cache(SettingsStore = new SettingsStore(contextFactory)); dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore)); dependencies.Cache(new SessionStatics()); dependencies.Cache(new OsuColour()); fileImporters.Add(BeatmapManager); fileImporters.Add(ScoreManager); fileImporters.Add(SkinManager); // tracks play so loud our samples can't keep up. // this adds a global reduction of track volume for the time being. Audio.Tracks.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8)); Beatmap = new NonNullableBindable<WorkingBeatmap>(defaultBeatmap); // ScheduleAfterChildren is safety against something in the current frame accessing the previous beatmap's track // and potentially causing a reload of it after just unloading. // Note that the reason for this being added *has* been resolved, so it may be feasible to removed this if required. Beatmap.BindValueChanged(b => ScheduleAfterChildren(() => { // compare to last beatmap as sometimes the two may share a track representation (optimisation, see WorkingBeatmap.TransferTo) if (b.OldValue?.TrackLoaded == true && b.OldValue?.Track != b.NewValue?.Track) b.OldValue.RecycleTrack(); })); dependencies.CacheAs<IBindable<WorkingBeatmap>>(Beatmap); dependencies.CacheAs(Beatmap); FileStore.Cleanup(); if (API is APIAccess apiAcces) AddInternal(apiAcces); AddInternal(RulesetConfigCache); GlobalActionContainer globalBinding; MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }; MenuCursorContainer.Child = globalBinding = new GlobalActionContainer(this) { RelativeSizeAxes = Axes.Both, Child = content = new OsuTooltipContainer(MenuCursorContainer.Cursor) { RelativeSizeAxes = Axes.Both } }; base.Content.Add(CreateScalingContainer().WithChild(MenuCursorContainer)); KeyBindingStore.Register(globalBinding); dependencies.Cache(globalBinding); PreviewTrackManager previewTrackManager; dependencies.Cache(previewTrackManager = new PreviewTrackManager()); Add(previewTrackManager); Ruleset.BindValueChanged(onRulesetChanged); }
private void Awake() { _instance = this; }
// Use this for initialization void Start() { GameObject e = GameObject.Find("SM"); scoreManager = e.GetComponent <ScoreManager>(); }
// Start is called before the first frame update void Start() { nextSceneLoad = SceneManager.GetActiveScene().buildIndex + 1; scoreManager = FindObjectOfType <ScoreManager>(); }
private void Start() { numCoins = initialCoins; APIHUD.instance.notifyMoney(numCoins); score = new ScoreManager(); }
private void load(AudioManager audio, DialogOverlay dialog, OsuColour colours, SkinManager skins, ScoreManager scores, CollectionManager collections, ManageCollectionsDialog manageCollectionsDialog) { // initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter). transferRulesetValue(); LoadComponentAsync(Carousel = new BeatmapCarousel { AllowSelection = false, // delay any selection until our bindables are ready to make a good choice. Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Both, BleedTop = FilterControl.HEIGHT, BleedBottom = Footer.HEIGHT, SelectionChanged = updateSelectedBeatmap, BeatmapSetsChanged = carouselBeatmapsLoaded, GetRecommendedBeatmap = recommender.GetRecommendedBeatmap, }, c => carouselContainer.Child = c); AddRangeInternal(new Drawable[] { recommender, new ResetScrollContainer(() => Carousel.ScrollToSelected()) { RelativeSizeAxes = Axes.Y, Width = 250, }, new VerticalMaskingContainer { Children = new Drawable[] { new GridContainer // used for max width implementation { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 850), }, Content = new[] { new Drawable[] { new ParallaxContainer { ParallaxAmount = 0.005f, RelativeSizeAxes = Axes.Both, Child = new WedgeBackground { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Right = -150 }, }, }, carouselContainer = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = FilterControl.HEIGHT, Bottom = Footer.HEIGHT }, Child = new LoadingSpinner(true) { State = { Value = Visibility.Visible } } } }, } }, FilterControl = new FilterControl { RelativeSizeAxes = Axes.X, Height = FilterControl.HEIGHT, FilterChanged = ApplyFilterToCarousel, }, new GridContainer // used for max width implementation { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 650), }, Content = new[] { new Drawable[] { new Container { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { beatmapInfoWedge = new BeatmapInfoWedge { Height = WEDGE_HEIGHT, RelativeSizeAxes = Axes.X, Margin = new MarginPadding { Top = left_area_padding, Right = left_area_padding, }, }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Bottom = Footer.HEIGHT, Top = WEDGE_HEIGHT + left_area_padding, Left = left_area_padding, Right = left_area_padding * 2, }, Child = BeatmapDetails = CreateBeatmapDetailArea().With(d => { d.RelativeSizeAxes = Axes.Both; d.Padding = new MarginPadding { Top = 10, Right = 5 }; }) }, } }, }, } } } }, }); if (ShowFooter) { AddRangeInternal(new Drawable[] { new GridContainer // used for max height implementation { RelativeSizeAxes = Axes.Both, RowDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.Relative, 1f, maxSize: ModSelectOverlay.HEIGHT + Footer.HEIGHT), }, Content = new[] { null, new Drawable[] { FooterPanels = new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Bottom = Footer.HEIGHT }, Children = new Drawable[] { BeatmapOptions = new BeatmapOptionsOverlay(), ModSelect = new ModSelectOverlay { Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, } } } } } }, Footer = new Footer() }); } if (Footer != null) { Footer.AddButton(new FooterButtonMods { Current = Mods }, ModSelect); Footer.AddButton(new FooterButtonRandom { Action = triggerRandom }); Footer.AddButton(new FooterButtonOptions(), BeatmapOptions); BeatmapOptions.AddButton(@"Manage", @"collections", FontAwesome.Solid.Book, colours.Green, () => manageCollectionsDialog?.Show()); BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo)); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo)); } dialogOverlay = dialog; sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty"); sampleChangeBeatmap = audio.Samples.Get(@"SongSelect/select-expand"); SampleConfirm = audio.Samples.Get(@"SongSelect/confirm-selection"); if (dialogOverlay != null) { Schedule(() => { // if we have no beatmaps but osu-stable is found, let's prompt the user to import. if (!beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.Minimal).Any() && beatmaps.StableInstallationAvailable) { dialogOverlay.Push(new ImportFromStablePopup(() => { Task.Run(beatmaps.ImportFromStableAsync) .ContinueWith(_ => { Task.Run(scores.ImportFromStableAsync); Task.Run(collections.ImportFromStableAsync); }, TaskContinuationOptions.OnlyOnRanToCompletion); Task.Run(skins.ImportFromStableAsync); })); } }); } }
// Start is called before the first frame update void Start() { scoreManager = FindObjectOfType <ScoreManager>(); summoningAudio = GetComponent <AudioSource>(); }
private void Awake() { Instance = this;// Create An Instance of "this" script }
// ====================================================== // NOTE about users confused over Reign-Scores // Reign-Scores is an API target option, just as GooglePlay version GamceCircle is. // Reign-Scores is NOT required to use native services like GooglePlay, GameCenter ect. // Its a self-hosted option you can put on any ASP.NET server you own for platforms like WP8, BB10 ect. // ====================================================== void Start() { // bind button events BackButton.Select(); LogoutButton.onClick.AddListener(LogoutButton_Clicked); BackButton.onClick.AddListener(BackButton_Clicked); ReportScoreButton.onClick.AddListener(ReportScoreButton_Clicked); ReportAchievementButton.onClick.AddListener(ReportAchievementButton_Clicked); ShowLeaderboardsButton.onClick.AddListener(ShowLeaderboardsButton_Clicked); ShowAchievementsButton.onClick.AddListener(ShowAchievementsButton_Clicked); // make sure we don't init the same Score data twice if (created) { return; } created = true; // classic GUI stuff if (!UseUnityUI) { uiStyle = new GUIStyle() { alignment = TextAnchor.MiddleCenter, fontSize = 32, normal = new GUIStyleState() { textColor = Color.white }, }; } // Leaderboards --------------------------- var leaderboards = new LeaderboardDesc[1]; var leaderboard = new LeaderboardDesc(); leaderboards[0] = leaderboard; var reignScores_LeaderboardID = new System.Guid("f55e3800-eacd-4728-ae4f-31b00aaa63bf"); leaderboard.SortOrder = LeaderboardSortOrders.Ascending; leaderboard.ScoreFormat = LeaderbaordScoreFormats.Numerical; leaderboard.ScoreFormat_DecimalPlaces = 0; #if UNITY_IOS leaderboard.ScoreTimeFormat = LeaderboardScoreTimeFormats.Centiseconds; #else leaderboard.ScoreTimeFormat = LeaderboardScoreTimeFormats.Milliseconds; #endif // Global leaderboard.ID = "Level1"; // Any unique ID value you want leaderboard.Desc = "Level1 Desc..."; // Any desc you want // Editor leaderboard.Editor_ReignScores_ID = reignScores_LeaderboardID; // Any unique value // WinRT leaderboard.WinRT_ReignScores_ID = reignScores_LeaderboardID; // Any unique value // WP8 leaderboard.WP8_ReignScores_ID = reignScores_LeaderboardID; // Any unique value // BB10 leaderboard.BB10_ReignScores_ID = reignScores_LeaderboardID; // Any unique value // iOS leaderboard.iOS_ReignScores_ID = reignScores_LeaderboardID; // Any unique value leaderboard.iOS_GameCenter_ID = ""; // Set to your GameCenter leaderboard ID // Android leaderboard.Android_ReignScores_ID = reignScores_LeaderboardID; // Any unique value leaderboard.Android_GooglePlay_ID = ""; // Set to your GooglePlay leaderboard ID (Not Name) leaderboard.Android_GameCircle_ID = ""; // Set to your GameCircle leaderboard ID (Not Name) // Win32 leaderboard.Win32_ReignScores_ID = reignScores_LeaderboardID; // Any unique value // OSX leaderboard.OSX_ReignScores_ID = reignScores_LeaderboardID; // Any unique value // Linux leaderboard.Linux_ReignScores_ID = reignScores_LeaderboardID; // Any unique value // Achievements --------------------------- var achievements = new AchievementDesc[1]; var achievement = new AchievementDesc(); achievements[0] = achievement; var reignScores_AchievementID = new System.Guid("352ce53d-142f-4a10-a4fb-804ad38be879"); // Global achievement.ID = "Achievement1"; // Any unique ID value you want achievement.Name = "Achievement1"; // Any name you want achievement.Desc = "Achievement1 Desc..."; // Any desc you want // When you report an achievement you pass a PercentComplete value. // Example: This allows you to change that ratio to something like (0-1000) before the achievement is unlocked. achievement.PercentCompletedAtValue = 100; // NOTE: For GooglePlay you must match this value in the developer dashboard under "How many steps are needed?" option. // Mark if you want Achievement to use PercentCompleted value or not. // Marking this true will make the "PercentComplete" value irrelevant. achievement.IsIncremental = true; // Editor achievement.Editor_ReignScores_ID = reignScores_AchievementID; // Any unique value // WinRT achievement.WinRT_ReignScores_ID = reignScores_AchievementID; // Any unique value // WP8 achievement.WP8_ReignScores_ID = reignScores_AchievementID; // Any unique value // BB10 achievement.BB10_ReignScores_ID = reignScores_AchievementID; // Any unique value // iOS achievement.iOS_ReignScores_ID = reignScores_AchievementID; // Any unique index value achievement.iOS_GameCenter_ID = ""; // Set to your GameCenter achievement ID // Android achievement.Android_ReignScores_ID = reignScores_AchievementID; // Any unique value achievement.Android_GooglePlay_ID = ""; // Set to your GooglePlay achievement ID (Not Name) achievement.Android_GameCircle_ID = ""; // Set to your GameCircle achievement ID (Not Name) // Win32 achievement.Win32_ReignScores_ID = reignScores_AchievementID; // Any unique value // OSX achievement.OSX_ReignScores_ID = reignScores_AchievementID; // Any unique value // Linux achievement.Linux_ReignScores_ID = reignScores_AchievementID; // Any unique value // Desc --------------------------- const string reignScores_gameID = "B2A24047-0487-41C4-B151-0F175BB54D0E"; // Get this ID from the Reign-Scores Console. var desc = new ScoreDesc(); if (UseUnityUI) { desc.ReignScores_UI = ReignScores_ModernRenderer.GetComponent <Reign.Plugin.ReignScores_UnityUI>() as IScores_UI; } else { desc.ReignScores_UI = ReignScores_ClassicRenderer.GetComponent <MonoBehaviour>() as IScores_UI; } desc.ReignScores_UI.ScoreFormatCallback += scoreFormatCallback; desc.ReignScores_ServicesURL = "http://localhost:5537/Services/"; // Set to your server! desc.ReignScores_GameKey = "04E0676D-AAF8-4836-A584-DE0C1D618D84"; // Set to your servers game_api_key! desc.ReignScores_UserKey = "CE8E55E1-F383-4F05-9388-5C89F27B7FF2"; // Set to your servers user_api_key! desc.LeaderboardDescs = leaderboards; desc.AchievementDescs = achievements; // Editor desc.Editor_ScoreAPI = ScoreAPIs.ReignScores; desc.Editor_ReignScores_GameID = reignScores_gameID; // WinRT desc.WinRT_ScoreAPI = ScoreAPIs.ReignScores; desc.WinRT_ReignScores_GameID = reignScores_gameID; // WP8 desc.WP8_ScoreAPI = ScoreAPIs.ReignScores; desc.WP8_ReignScores_GameID = reignScores_gameID; // BB10 desc.BB10_ScoreAPI = ScoreAPIs.ReignScores; desc.BB10_ReignScores_GameID = reignScores_gameID; // iOS desc.iOS_ScoreAPI = ScoreAPIs.GameCenter; desc.iOS_ReignScores_GameID = reignScores_gameID; // Android #if GOOGLEPLAY desc.Android_ScoreAPI = ScoreAPIs.GooglePlay; desc.Android_GooglePlay_DisableUsernameRetrieval = false; // This lets you remove the android.permission.GET_ACCOUNTS requirement if enabled #elif AMAZON desc.Android_ScoreAPI = ScoreAPIs.GameCircle; #else desc.Android_ScoreAPI = ScoreAPIs.ReignScores; #endif desc.Android_ReignScores_GameID = reignScores_gameID; // Win32 desc.Win32_ScoreAPI = ScoreAPIs.ReignScores; desc.Win32_ReignScores_GameID = reignScores_gameID; // OSX desc.OSX_ScoreAPI = ScoreAPIs.ReignScores; desc.OSX_ReignScores_GameID = reignScores_gameID; // Linux desc.Linux_ScoreAPI = ScoreAPIs.ReignScores; desc.Linux_ReignScores_GameID = reignScores_gameID; // init ScoreManager.Init(desc, createdCallback); // <<< Reign-Scores manual methods >>> //ScoreManager.RequestScores(...); //ScoreManager.RequestAchievements(...); //ScoreManager.ManualLogin(...); //ScoreManager.ManualCreateUser(...); }
private void ShowAchievementsButton_Clicked() { ScoreManager.ShowNativeAchievementsPage(showNativePageCallback); }
// Start is called before the first frame update void Start() { scoreManager = GameObject.FindGameObjectWithTag("Score Manager").GetComponent <ScoreManager>(); }
private void ReportAchievementButton_Clicked() { string value = "Achievement" + 1; ScoreManager.ReportAchievement(value, 100, reportAchievementCallback); }
// Use this for initialization void Start() { theScoreManager = FindObjectOfType <ScoreManager> (); coinSound = GameObject.Find("CoinSound").GetComponent <AudioSource> (); }
public void mainMenu() { //Metodo que permite regresar al menu principal. SceneManager.LoadScene(0); ScoreManager.setScore(0); }
// Use this for initialization void Start() { instance = this; score = 0; highscore = PlayerPrefs.GetInt("highscore", highscore); }
private void LogoutButton_Clicked() { ScoreManager.Logout(); StatusText.text = "Logged out..."; }
// Update is called once per frame void Update() { TextMeshProUGUI score_text = scoreObject.GetComponent <TextMeshProUGUI>(); score_text.text = "Score:" + ScoreManager.Increment(); }
private void load() { Resources.AddStore(new DllResourceStore(@"osu.Game.Resources.dll")); dependencies.Cache(contextFactory = new DatabaseContextFactory(Host.Storage)); var largeStore = new LargeTextureStore(Host.CreateTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures"))); largeStore.AddStore(Host.CreateTextureLoaderStore(new OnlineStore())); dependencies.Cache(largeStore); dependencies.CacheAs(this); dependencies.Cache(LocalConfig); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Basic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Hangul")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Basic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Compatibility")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Bold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Light")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-LightItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light")); runMigrations(); dependencies.Cache(SkinManager = new SkinManager(Host.Storage, contextFactory, Host, Audio)); dependencies.CacheAs <ISkinSource>(SkinManager); API = new APIAccess(LocalConfig); dependencies.CacheAs <IAPIProvider>(API); var defaultBeatmap = new DummyWorkingBeatmap(this); dependencies.Cache(RulesetStore = new RulesetStore(contextFactory)); dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage)); // ordering is important here to ensure foreign keys rules are not broken in ModelStore.Cleanup() dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, () => BeatmapManager, Host.Storage, contextFactory, Host)); dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, API, Audio, Host, defaultBeatmap)); // this should likely be moved to ArchiveModelManager when another case appers where it is necessary // to have inter-dependent model managers. this could be obtained with an IHasForeign<T> interface to // allow lookups to be done on the child (ScoreManager in this case) to perform the cascading delete. List <ScoreInfo> getBeatmapScores(BeatmapSetInfo set) { var beatmapIds = BeatmapManager.QueryBeatmaps(b => b.BeatmapSetInfoID == set.ID).Select(b => b.ID).ToList(); return(ScoreManager.QueryScores(s => beatmapIds.Contains(s.Beatmap.ID)).ToList()); } BeatmapManager.ItemRemoved += i => ScoreManager.Delete(getBeatmapScores(i), true); BeatmapManager.ItemAdded += (i, existing) => ScoreManager.Undelete(getBeatmapScores(i), true); dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore)); dependencies.Cache(SettingsStore = new SettingsStore(contextFactory)); dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore)); dependencies.Cache(new OsuColour()); fileImporters.Add(BeatmapManager); fileImporters.Add(ScoreManager); fileImporters.Add(SkinManager); // tracks play so loud our samples can't keep up. // this adds a global reduction of track volume for the time being. Audio.Track.AddAdjustment(AdjustableProperty.Volume, new BindableDouble(0.8)); beatmap = new OsuBindableBeatmap(defaultBeatmap, Audio); dependencies.CacheAs <IBindable <WorkingBeatmap> >(beatmap); dependencies.CacheAs(beatmap); FileStore.Cleanup(); AddInternal(API); GlobalActionContainer globalBinding; MenuCursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both }; MenuCursorContainer.Child = globalBinding = new GlobalActionContainer(this) { RelativeSizeAxes = Axes.Both, Child = content = new OsuTooltipContainer(MenuCursorContainer.Cursor) { RelativeSizeAxes = Axes.Both } }; base.Content.Add(new ScalingContainer(ScalingMode.Everything) { Child = MenuCursorContainer }); KeyBindingStore.Register(globalBinding); dependencies.Cache(globalBinding); PreviewTrackManager previewTrackManager; dependencies.Cache(previewTrackManager = new PreviewTrackManager()); Add(previewTrackManager); }
void Update() { if (fframe == 0) { ep.AllAwake(0); ep.AllAwake(1); EnemyManager.gi.AllAwake(0); for (int i = 0; i < 16; ++i) { ep.Run(); } ++fframe; } else if (fframe == 1) { ++fframe; } else if (fframe == 2) { ep.AllSleep(0); ep.AllSleep(1); var v0 = Vector3.zero; for (int i = 0; i < 2048; ++i) { ep.GetObject(0, v0).SetSmall(); } for (int i = 0; i < 512; ++i) { ep.GetObject(1, v0).SetSmall(); } Enemy ene; EnemyManager.gi.AllSleep(0); for (int i = 0; i < 512; ++i) { ene = EnemyManager.gi.GetObject(0, v0); // ene.SetModel(0); } ep.Run(); ++fframe; } else if (fframe == 3) { ep.AllSleep(0); ep.AllSleep(1); var v0 = Vector3.zero; for (int i = 0; i < 2048; ++i) { ep.GetObject(0, v0).SetSmall(); } for (int i = 0; i < 512; ++i) { ep.GetObject(1, v0).SetSmall(); } Enemy ene; EnemyManager.gi.AllSleep(0); for (int i = 0; i < 512; ++i) { ene = EnemyManager.gi.GetObject(0, v0); // ene.SetModel(0); } ep.Run(); ++fframe; } else if (fframe == 4) { ep.AllSleep(0); ep.AllSleep(1); EnemyManager.gi.AllSleep(0); EnemyManager.gi.AllSleep(1); ++fframe; bgm.SetActive(true); } //fps.Update(); //var sc = fpsView.transform.localScale; //sc.x = (fps.GetFPS() - 50) / 10f * 0.75f; //if (sc.x <= 0f) { sc.x = 0f; } //fpsView.transform.localScale = sc; if (isGameOver) { if (gowait < 24) { pl.trans.localScale = Effect.v0; ++gowait; for (int i = 0; i < 12; ++i) { var obj = EffectPool.gi.GetObject(0, pl.trans.position); obj.SpdExt(Random.Range(1f, 2.25f)); } goto goWaitNormalLoop; } scManager.UpdateView(); cManager.UpdateView(); if (!isScoreBoardProcEnd && useRanking) { isScoreBoardProcEnd = true; naichilab.RankingLoader.Instance.SendScoreAndShowRanking(ScoreManager.GetScore()); goCnt = 1; } if (useRanking) { if (naichilab.RankingSceneManager.windowClosed) { useRanking = false; } } else { if (goCnt == 60) { fc.isFadeIn = false; fc.Time = 60; fc.StartProc(); } if (goCnt == 120) { SceneManager.LoadScene("title"); } ++goCnt; } return; } goWaitNormalLoop: ++cnt; // BGProc(); if (cnt < 10) { return; } if (isBossStage && !beforeIsBoss) { beforeIsBoss = true; stage.StartBoss(); } pl.SetBefPosToCurrentPos(); stage.Run(); EnemyManager.gi.Run(); ep.Run(); crManager.Run(); pl.Run(); // scManager.UpdateView(); cManager.UpdateView(); // Physics.SyncTransforms(); Physics.Simulate(0.01666666f); }