public static void DisplayPopup(BasicAchievement a) { myGameObject.GetComponent<AchievementHelper>().CancelInvoke(); myGameObject.GetComponent<AchievementHelper>().Invoke ("ClearCurrent", 1f); if(numberOut +1 > max) { myGameObject.GetComponent<AchievementHelper>().ClearCurrent(); } if(current != null) { location = defaultLocation; location.y -= (distance * numberOut); } else { location = defaultLocation; } current = (GameObject)Instantiate (defaultPopup,location,defaultPopup.transform.rotation); numberOut++; myPopup = current.GetComponent<AchievementPopup>(); if(a.IsIncremental && progressBarEnabled) { myPopup.SetValues(a.Name,a.Progress,a.Icon,progressBarEnabled); } else { myPopup.SetValues("Achievement Unlocked",a.Name,a.Icon); } }
public static void DisplayPopup(BasicAchievement a) { myGameObject.GetComponent <AchievementHelper>().CancelInvoke(); myGameObject.GetComponent <AchievementHelper>().Invoke("ClearCurrent", 1f); if (numberOut + 1 > max) { myGameObject.GetComponent <AchievementHelper>().ClearCurrent(); } if (current != null) { location = defaultLocation; location.y -= (distance * numberOut); } else { location = defaultLocation; } current = (GameObject)Instantiate(defaultPopup, location, defaultPopup.transform.rotation); numberOut++; myPopup = current.GetComponent <AchievementPopup>(); if (a.IsIncremental && progressBarEnabled) { myPopup.SetValues(a.Name, a.Progress, a.Icon, progressBarEnabled); } else { myPopup.SetValues("Achievement Unlocked", a.Name, a.Icon); } }
public void Start() { if (!Instance) { Instance = this; } }
private async Task DoUpload() { var result = await MainGame.Inst.Backend.SetCustomLevelCompleted(MainGame.Inst.Profile, _level.CustomMeta_LevelID, _difficulty, _time); if (result.IsError) { MonoSAMGame.CurrentInst.DispatchBeginInvoke(() => { _btnReupload.IsVisible = true; _cannonCog.Color = FlatColors.Alizarin; _cannonCog.RotationSpeed = 0f; _centerLabel.IsVisible = false; }); } else { MonoSAMGame.CurrentInst.DispatchBeginInvoke(() => { Remove(); HUD.AddModal(new HUDSCCMScorePanel_Won(_level, result.Metadata, _difficulty, result.ScoreGain, _time), false); if (result.IsFirstClear) { AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_FIRSTCLEAR)); } else if (result.IsWorldRecord) { AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_WORLDRECORD)); } }); } }
public static AchievementPopup Instance() { if (!achievementPopup) { achievementPopup = FindObjectOfType(typeof(AchievementPopup)) as AchievementPopup; if (!achievementPopup) { Debug.LogError("There needs to be one active AchievementPopup script on a GameObject in your scene."); } } return achievementPopup; }
public static AchievementPopup Instance() { if (!achievementPopup) { achievementPopup = FindObjectOfType(typeof(AchievementPopup)) as AchievementPopup; if (!achievementPopup) { Debug.LogError("There needs to be one active AchievementPopup script on a GameObject in your scene."); } } return(achievementPopup); }
static int numberOut; //Popups out. // Use this for initialization void Start() { if (popup) { progressBarEnabled = enableProgressBar; defaultPopup = popup; myPopup = (defaultPopup.GetComponent <AchievementPopup>() != null) ? defaultPopup.GetComponent <AchievementPopup>():defaultPopup.AddComponent <AchievementPopup>(); if (popupLocation) { location = popupLocation.position; defaultLocation = popupLocation.transform.position; } else { location = FindObjectOfType <PopupMarker>() != null?FindObjectOfType <PopupMarker>().transform.position : new Vector3(0, 0, 0); defaultLocation = location; } distance = distanceBetweenNotifications; max = maxConcurrentPopups; numberOut = 0; } else { popup = (GameObject)Resources.Load("DefaultPopup"); distance = 1.5f; max = 4; if (popupLocation) { location = popupLocation.position; defaultLocation = popupLocation.transform.position; } else { location = FindObjectOfType <PopupMarker>() != null?FindObjectOfType <PopupMarker>().transform.position : new Vector3(0, 0, 0); defaultLocation = location; } numberOut = 0; } myGameObject = gameObject; }
public override void ShowScorePanel(LevelBlueprint lvl, PlayerProfile profile, HashSet <FractionDifficulty> newDifficulties, bool playerHasWon, int addPoints, int time) { ((GDGameHUD)HUD).BtnPause.IsEnabled = false; ((GDGameHUD)HUD).BtnSpeed.IsEnabled = false; GameSpeedMode = GameSpeedModes.NORMAL; HUD.AddModal(new HUDScorePanel(lvl, profile, newDifficulties, Difficulty, playerHasWon, addPoints, time), false); if (playerHasWon && (MainGame.Flavor == GDFlavor.IAB || MainGame.Flavor == GDFlavor.IAB_NOMP)) { var diff = UnlockManager.GetFullUnlockState().Except(_unlocksBefore); foreach (var d in diff) { if (d == Levels.WORLD_ID_ONLINE) { AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_UNLOCK_ONLINE)); } if (d == Levels.WORLD_ID_MULTIPLAYER) { AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_UNLOCK_MULTIPLAYER)); } if (d == Levels.WORLD_001.ID) { AchievementPopup.Show(L10N.TF(L10NImpl.STR_ACH_UNLOCK_WORLD, 1)); } if (d == Levels.WORLD_002.ID) { AchievementPopup.Show(L10N.TF(L10NImpl.STR_ACH_UNLOCK_WORLD, 2)); } if (d == Levels.WORLD_003.ID) { AchievementPopup.Show(L10N.TF(L10NImpl.STR_ACH_UNLOCK_WORLD, 3)); } if (d == Levels.WORLD_004.ID) { AchievementPopup.Show(L10N.TF(L10NImpl.STR_ACH_UNLOCK_WORLD, 4)); } } } }
// Use this for initialization void Start() { achievements = GetComponent<Achievements>(); achievementPopup = GetComponent<AchievementPopup>(); }
private void EndGame(bool playerWon, Fraction winner) { MainGame.Inst.Profile.SingleplayerGameSpeed = GameSpeedMode; MainGame.Inst.SaveProfile(); HasFinished = true; PlayerWon = playerWon; var ctime = (int)(LevelTime * 1000); if (playerWon) { int scoreGain = 0; HashSet <FractionDifficulty> gains = new HashSet <FractionDifficulty>(); for (FractionDifficulty diff = FractionDifficulty.DIFF_0; diff <= Difficulty; diff++) { if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedOrBetter(diff)) { scoreGain += FractionDifficultyHelper.GetScore(diff); gains.Add(diff); } } { if (!GDOwner.Profile.GetLevelData(Blueprint.UniqueID).HasCompletedExact(Difficulty)) { GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true); } var localdata = GDOwner.Profile.LevelData[Blueprint.UniqueID].Data[Difficulty]; if (ctime < localdata.BestTime) { // update PB GDOwner.Profile.SetCompleted(Blueprint.UniqueID, Difficulty, ctime, true); } // Fake the online data until next sync localdata.GlobalCompletionCount++; if (ctime < localdata.GlobalBestTime || localdata.GlobalBestTime == -1) { if (localdata.GlobalBestTime != -1) { // WURLD RECARD !! // Dispatch is trick to put in infront of score panel ... MainGame.Inst.DispatchBeginInvoke(() => { AchievementPopup.Show(L10N.T(L10NImpl.STR_ACH_WORLDRECORD)); }); } localdata.GlobalBestTime = ctime; localdata.GlobalBestUserID = GDOwner.Profile.OnlineUserID; } } GDOwner.SaveProfile(); ShowScorePanel(Blueprint, GDOwner.Profile, gains, true, scoreGain, ctime); MainGame.Inst.GDSound.PlayEffectGameWon(); EndGameConvert(winner); } else { ShowScorePanel(Blueprint, GDOwner.Profile, new HashSet <FractionDifficulty>(), false, 0, ctime); MainGame.Inst.GDSound.PlayEffectGameOver(); EndGameConvert(winner); } foreach (var cannon in Entities.Enumerate().OfType <Cannon>()) { cannon.ForceUpdateController(); } }
// Use this for initialization void Start() { achievements = GetComponent <Achievements>(); achievementPopup = GetComponent <AchievementPopup>(); }
// Use this for initialization void Start() { if(popup) { progressBarEnabled = enableProgressBar; defaultPopup = popup; myPopup = (defaultPopup.GetComponent<AchievementPopup>() != null) ? defaultPopup.GetComponent<AchievementPopup>():defaultPopup.AddComponent<AchievementPopup>(); if(popupLocation) { location = popupLocation.position; defaultLocation = popupLocation.transform.position; } else { location = FindObjectOfType<PopupMarker>() != null ? FindObjectOfType<PopupMarker>().transform.position:new Vector3(0,0,0); defaultLocation = location; } distance = distanceBetweenNotifications; max = maxConcurrentPopups; numberOut = 0; } else { popup = (GameObject)Resources.Load ("DefaultPopup"); distance = 1.5f; max = 4; if(popupLocation) { location = popupLocation.position; defaultLocation = popupLocation.transform.position; } else { location = FindObjectOfType<PopupMarker>() != null ? FindObjectOfType<PopupMarker>().transform.position:new Vector3(0,0,0); defaultLocation = location; } numberOut = 0; } myGameObject = gameObject; }