Inheritance: MonoBehaviour
        private static void CheckAchievementUnlockStatusTest()
        {
            AchievementManager am = new AchievementManager();

            // Create a new AchievementCondition with an obnoxiously long name to minimize the chance of having a duplicate
            AchievementCondition checkAchievementUnlockStatusTestAchievementCondition =
                new AchievementCondition("checkAchievementUnlockStatusTestAchievementCondition",
                    "checkAchievementUnlockStatusTestAchievementCondition", 1);

            // Register the AchievementCondition with the obnoxiously long name
            am.RegisterAchievementCondition(checkAchievementUnlockStatusTestAchievementCondition);

            // Report Progress and unlock the AchievementCondition with the obnoxiously long name
            am.ReportProgress("checkAchievementUnlockStatusTestAchievementCondition");

            // After completing the AchievementCondition with the obnoxiously long name add it to a new Achievement with an obnoxiously long name (to minimize the chance of having a duplicate, you know?)
            Achievement checkAchievementUnlockStatusTestAchievement =
                new Achievement("CheckAchievementUnlockStatusTestAchievement",
                    "Achievement with an obnoxiously long name", "DUMMY",
                    checkAchievementUnlockStatusTestAchievementCondition);

            // The new Achievement is still locked
            Debug.Assert(!checkAchievementUnlockStatusTestAchievement.Unlocked, "!CheckAchievementUnlockStatusTestAchievement.Unlocked");

            // ReEvaluate Lock-Status
            checkAchievementUnlockStatusTestAchievement.CheckUnlockStatus();

            // The Achievement should now be unlocked
            Debug.Assert(checkAchievementUnlockStatusTestAchievement.Unlocked, "CheckAchievementUnlockStatusTestAchievement.Unlocked");
        }
        protected void InlineResultRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (Type == "Race")
            {
                var achievementHolder = e.Item.FindControl("achievementsHolder") as PlaceHolder;
                if (achievementHolder != null)
                {
                    var achievementManager = new AchievementManager();
                    var race = _raceRepository.GetById(RaceId);
                    if (race != null)
                    {
                        var driverName = DataBinder.Eval(e.Item.DataItem, "Name").ToString();

                        IList<Achievement> achievements =
                            achievementManager.GetAchievementsForRaceEntry(
                                race.Entries.FirstOrDefault(ent => ent.Entrant.Driver.Name == driverName));

                        foreach (var achievement in achievements)
                        {
                            var img = new System.Web.UI.WebControls.Image();
                            img.CssClass = "achievement";
                            img.ImageUrl = "/css/atomicf1/medal_gold_3.png";
                            img.AlternateText = achievement.Description;
                            img.ToolTip = achievement.Description;

                            achievementHolder.Controls.Add(img);
                        }
                    }
                }
            }
        }
 public SaveManager(AchievementManager otherA, SkillManager otherS, PlayerController p, DayNightCycleManager otherD)
 {
     achievementManager = otherA;
     skillManager = otherS;
     if(!Directory.Exists("./save/"))
         Directory.CreateDirectory("./save/");
     player = p;
     timeManager = otherD;
 }
 void Awake()
 {
     if(master == null){
         DontDestroyOnLoad(gameObject);
         master = this;
     } else if (master != this){
         Destroy(gameObject);
     }
 }
	void Awake()
	{
		if (_ins == null)
		{
			// Populate with first instance
			_ins = this;
			DontDestroyOnLoad(this);
		}
		else
		{
			// Another instance exists, destroy
			if (this != _ins)
				Destroy(this.gameObject);
		}
	}
    void OnAchievElementDraw(Transform achievObject, AchievementManager.Achievement achieve)
    {
        //AchievementManager.Achievement achieve = AchievementManager.GetInstance().GetAchieveById(achievObject.name);

        UISlicedSprite slisedSprite = achievObject.Find("BG").GetComponent<UISlicedSprite>();
        UILabel title = achievObject.Find("Title").GetComponent<UILabel>();
        UILabel description = achievObject.Find("Description").GetComponent<UILabel>();
        UILabel progress = achievObject.Find("Progress").GetComponent<UILabel>();

        title.text = achieve.name;
        description.text = achieve.description;
        progress.text = achieve.IsCompleted() ? "" : achieve.GetProgressText();

        slisedSprite.spriteName = achieve.IsCompleted() ? "Glow" : "Dark";
    }
Beispiel #7
0
        public Game()
        {
            ClientManager = new GameClientManager();

            if (UberEnvironment.GetConfig().data["client.ping.enabled"] == "1")
            {
                ClientManager.StartConnectionChecker();
            }

            BanManager = new ModerationBanManager();
            RoleManager = new RoleManager();
            HelpTool = new HelpTool();
            Catalog = new Catalog();
            Navigator = new Navigator();
            ItemManager = new ItemManager();
            RoomManager = new RoomManager();
            AdvertisementManager = new AdvertisementManager();
            PixelManager = new PixelManager();
            AchievementManager = new AchievementManager();
            ModerationTool = new ModerationTool();
            BotManager = new BotManager();

            BanManager.LoadBans();
            RoleManager.LoadRoles();
            RoleManager.LoadRights();
            HelpTool.LoadCategories();
            HelpTool.LoadTopics();
            Catalog.Initialize();
            Navigator.Initialize();
            ItemManager.LoadItems();
            RoomManager.LoadModels();
            AdvertisementManager.LoadRoomAdvertisements();
            PixelManager.Start();
            AchievementManager.LoadAchievements();
            ModerationTool.LoadMessagePresets();
            ModerationTool.LoadPendingTickets();
            BotManager.LoadBots();

            DatabaseCleanup(1);

            StatisticsThread = new Thread(LowPriorityWorker.Process);
            StatisticsThread.Name = "Low Priority Worker";
            StatisticsThread.Priority = ThreadPriority.Lowest;
            StatisticsThread.Start();

               // UberEnvironment.GetLogging().WriteLine("Initialized - " + Version);
        }
Beispiel #8
0
 public void OnRoleResetOtherInfo()//在玩家进行刷新 或者是 断线重新连接后 进行的处理
 {
     //客户端重新设置下全部的外围数据
     AchievementManager.ResetInfo();
     ActionManager.ResetInfo();
     //CheckManager.ResetInfo();
     EntityManager.ResetInfo();
     RoleGameData.ResetInfo();
     ItemManager.ResetInfo();
     MailManager.ResetInfo();
     RankManager.ResetInfo();
     RelationManager.ResetInfo();
     TaskManager.ResetInfo();
     RoleAnnouncement.ResetInfo();
     MonthManager.ResetInfo();
     RoleChar.ResetInfo();
 }
Beispiel #9
0
    public static void TreasureHunterSAchievement(String lang, Int32 mesId)
    {
        Boolean flag = false;

        if (FF9StateSystem.Common.FF9.fldMapNo == 1900 && mesId == 289)
        {
            flag = true;
        }
        else if (FF9StateSystem.Common.FF9.fldMapNo == 2801 && mesId == 236)
        {
            flag = true;
        }
        if (flag)
        {
            AchievementManager.ReportAchievement(AcheivementKey.TreasureHuntS, 1);
        }
    }
Beispiel #10
0
    public static void GetRewardFromQueenStellaAchievement()
    {
        Int32 fldMapNo = (Int32)FF9StateSystem.Common.FF9.fldMapNo;

        if (fldMapNo == 911 || fldMapNo == 1911)
        {
            Int32 num = PersistenSingleton <EventEngine> .Instance.eBin.getVarManually(91132);

            Int32 num2 = 0;
            for (Int32 i = 0; i < 12; i++)
            {
                num2 += (Int32)((num % 2 != 1) ? 0 : 1);
                num >>= 1;
            }
            AchievementManager.ReportAchievement(AcheivementKey.QueenReward10, num2);
        }
    }
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogError("More than one ServicesManager exists!");
            Application.Quit();
            return;
        }

        adManager          = GetComponentInChildren <AdManager>();
        achievementManager = GetComponentInChildren <AchievementManager>();
        iapManager         = GetComponentInChildren <IAPManager>();
        twitterBlade       = GetComponentInChildren <TwitterBlade>();
        leaderBoardManager = GetComponentInChildren <LeaderBoardManager>();

        DontDestroyOnLoad(this.gameObject);
    }
Beispiel #12
0
    public static AchievementManager GetInstance()
    {
        if (_instance == null) {
            _instance = (AchievementManager)FindObjectOfType(typeof(AchievementManager));

            if ( FindObjectsOfType(typeof(AchievementManager)).Length > 1 )
            {
                Debug.LogError("[Singleton] Something went really wrong " +
                    " - there should never be more than 1 singleton!" +
                    " Reopenning the scene might fix it.");
            }
        }
        if (_instance == null) {
            _instance = new AchievementManager();
        }
        return _instance;
    }
Beispiel #13
0
        public Game()
        {
            this._packetManager = new PacketManager();
            this._clientManager = new GameClientManager();

            this._moderationManager = new ModerationManager();
            this._moderationManager.Init();

            this._itemDataManager = new ItemDataManager();
            this._itemDataManager.Init();

            this._catalogManager = new CatalogManager();
            this._catalogManager.Init(this._itemDataManager);

            this._televisionManager = new TelevisionManager();

            this._navigatorManager = new NavigatorManager();
            this._roomManager      = new RoomManager();
            this._chatManager      = new ChatManager();
            this._groupManager     = new GroupManager();
            this._groupManager.Init();
            this._questManager       = new QuestManager();
            this._achievementManager = new AchievementManager();
            this._talentTrackManager = new TalentTrackManager();

            this._landingViewManager = new LandingViewManager();
            this._gameDataManager    = new GameDataManager();

            this._globalUpdater = new ServerStatusUpdater();
            this._globalUpdater.Init();

            this._botManager = new BotManager();
            this._botManager.Init();

            this._cacheManager  = new CacheManager();
            this._rewardManager = new RewardManager();

            this._badgeManager = new BadgeManager();
            this._badgeManager.Init();

            this._permissionManager = new PermissionManager();
            this._permissionManager.Init();

            this._subscriptionManager = new SubscriptionManager();
            this._subscriptionManager.Init();
        }
Beispiel #14
0
        public static void UnlockAll()
        {
            //Goes through resource file containing all unlockables... Easily updatable, just paste "RoR2.UnlockCatalog" and GetAllUnlockable does the rest.
            //This is needed to unlock logs
            foreach (var unlockableName in Main.unlockableNames)
            {
                var         unlockableDef = UnlockableCatalog.GetUnlockableDef(unlockableName);
                NetworkUser networkUser   = Util.LookUpBodyNetworkUser(Main.LocalPlayerBody);
                if (networkUser)
                {
                    networkUser.ServerHandleUnlock(unlockableDef);
                }
            }

            //Gives all achievements.
            var achievementManager = AchievementManager.GetUserAchievementManager(LocalUserManager.GetFirstLocalUser());

            foreach (var achievement in AchievementManager.allAchievementDefs)
            {
                achievementManager.GrantAchievement(achievement);
            }

            //Give all survivors
            var profile = LocalUserManager.GetFirstLocalUser().userProfile;

            foreach (var survivor in SurvivorCatalog.allSurvivorDefs)
            {
                if (profile.statSheet.GetStatValueDouble(RoR2.Stats.PerBodyStatDef.totalTimeAlive, survivor.bodyPrefab.name) == 0.0)
                {
                    profile.statSheet.SetStatValueFromString(RoR2.Stats.PerBodyStatDef.totalTimeAlive.FindStatDef(survivor.bodyPrefab.name), "0.1");
                }
            }

            //All items and equipments
            foreach (string itemName in Enum.GetNames(typeof(ItemIndex)))
            {
                ItemIndex itemIndex = (ItemIndex)Enum.Parse(typeof(ItemIndex), itemName);
                profile.DiscoverPickup(PickupCatalog.FindPickupIndex(itemIndex));
            }

            foreach (string equipmentName in Enum.GetNames(typeof(EquipmentIndex)))
            {
                EquipmentIndex equipmentIndex = (EquipmentIndex)Enum.Parse(typeof(EquipmentIndex), equipmentName);
                profile.DiscoverPickup(PickupCatalog.FindPickupIndex(equipmentIndex));
            }
        }
Beispiel #15
0
 internal void method_13()
 {
     for (int i = 0; i < this.Clients.Length; i++)
     {
         GameClient @class = this.Clients[i];
         if (@class != null)
         {
             try
             {
                 @class.SendMessage(AchievementManager.smethod_1(@class));
             }
             catch
             {
             }
         }
     }
 }
Beispiel #16
0
        private static void HideSkinIfLocked(ILContext il)
        {
            ILCursor c = new ILCursor(il);
            var      skinDefVariable = -1;

            if (c.TryGotoNext(MoveType.Before,
                              x => x.MatchLdloc(2),
                              x => x.MatchLdcI4(out _),
                              x => x.MatchAdd(),
                              x => x.MatchStloc(2)))
            {
                var labelLoopStart = c.MarkLabel();

                c.GotoPrev(MoveType.After,
                           x => x.MatchLdloc(1),
                           x => x.MatchLdloc(2),
                           x => x.MatchLdelemRef(),
                           x => x.MatchStloc(out skinDefVariable));

                c.Emit(OpCodes.Ldloc, skinDefVariable);
                c.EmitDelegate <Func <SkinDef, bool> >((skinDef) =>
                {
                    if (hiddenIfLockedSkins.Contains(skinDef))
                    {
                        if (skinDef.unlockableDef != null)
                        {
                            if (LocalUserManager.isAnyUserSignedIn)
                            {
                                var localUser = LocalUserManager.GetFirstLocalUser();
                                if (localUser != null)
                                {
                                    // shhhh just pretend this isn't a thing
                                    return(!AchievementManager.GetUserAchievementManager(localUser).userProfile.HasUnlockable(skinDef.unlockableDef));
                                }
                            }
                        }
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                });
                c.Emit(OpCodes.Brtrue, labelLoopStart);
            }
        }
Beispiel #17
0
    private void RewindTime()
    {
        if (!isRecording)
        {
            player.gameObject.SetActive(true); isRecording = true;
        }

        if (position.Count > 0)
        {
            PlayerStatsistics.Instance.totalTimeRewinded += Time.deltaTime;
            AchievementManager.CheckTimeRewindedAchiev();
            player._rb2d.position        = position.Pop();
            player._rb2d.rotation        = rotation.Pop();
            player._rb2d.velocity        = velocity.Pop();
            player._rb2d.angularVelocity = angularVelocity.Pop();
        }
    }
    // Use this for initialization
    protected override void Start()
    {
        base.Start();

        toolbarStrings = new string[2];
        toolbarStrings[0] = LanguageManager.Instance.GetTextValue("MainMenu.unlock");
        toolbarStrings[1] = LanguageManager.Instance.GetTextValue("MainMenu.lock");

        // Récupère la sauvegarde des achievements accomplis
        AchievementsSaveReader asr = FindObjectOfType<AchievementsSaveReader>();

        am = FindObjectOfType<AchievementManager>();

        List<string> achievCompleted = asr.getAchievementsCompleted();
        if (achievCompleted != null)
            am.loadAchievements(achievCompleted);
    }
Beispiel #19
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        if (AutoLoad)
        {
            LoadAchievementState();
        }
    }
    private void Awake()
    {
        if (_instance != null && _instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            _instance = this;
        }

        DontDestroyOnLoad(gameObject);

        // Heads Up: these two originally belongs to Start()
        sampleInventory = GameObject.FindGameObjectWithTag("Inventory").GetComponent <SampleInventory>();
        CreateAchievementPrefabs();
    }
 void Awake()
 {
     if (_ins == null)
     {
         // Populate with first instance
         _ins = this;
         DontDestroyOnLoad(this);
     }
     else
     {
         // Another instance exists, destroy
         if (this != _ins)
         {
             Destroy(this.gameObject);
         }
     }
 }
Beispiel #22
0
    void Awake()
    {
        if (m_instance == null)
        {
            m_instance = this;
            //Debug.Log("List looks like null, trying to make a new list");
            //Debug.Log(AchievementsAlreadyUnlocked.ToString());
        }
        else if (m_instance != this)
        {
            Debug.Log("Function 2");
            Destroy(gameObject);
            return;
        }

        DontDestroyOnLoad(gameObject);
    }
        private void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                steamIdTextBox.Text = Master.SteamUserId;

                using (IAchievementManager manager = new AchievementManager())
                {
                    User user = manager.GetUser(Master.FacebookUserId);

                    if (user != null)
                    {
                        autoUpdateCheckBox.Checked = user.AutoUpdate;
                    }
                }
            }
        }
Beispiel #24
0
    public static void LevelFinished()
    {
        if (Instance.practiceMode)
        {
            Instance.levelInfo.levelFinishedPractice = true;
            AchievementManager.AchievementCollected(Instance.lvlCompletePracticeAchievID);
        }
        else
        {
            if (Instance.levelInfo.shardsCollected.x == 0 && Instance.shardsCollected.x == 1)
            {
                Instance.levelInfo.shardsCollected.x = 1; PlayerStatsistics.Instance.totalHiddenShardsCollected++;
            }
            if (Instance.levelInfo.shardsCollected.y == 0 && Instance.shardsCollected.y == 1)
            {
                Instance.levelInfo.shardsCollected.y = 1; PlayerStatsistics.Instance.totalHiddenShardsCollected++;
            }
            if (Instance.levelInfo.shardsCollected.z == 0 && Instance.shardsCollected.z == 1)
            {
                Instance.levelInfo.shardsCollected.z = 1; PlayerStatsistics.Instance.totalHiddenShardsCollected++;
            }

            if (Instance.shardsCollected == Vector3.one)
            {
                AchievementManager.AchievementCollected(Instance.allHiddenShardsAchievID);
            }

            AchievementManager.CheckHiddenShardsAchiev();

            if (!Instance.levelInfo.levelFinished)
            {
                PlayerStatsistics.Instance.totalStarsCollected += Instance.levelInfo.maxStars;
                Instance.levelInfo.levelFinished = true;
                AchievementManager.AchievementCollected(Instance.lvlCompleteAchievID);
            }

            AchievementManager.CheckStarsCollectedAchiev();
        }

        Instance.SaveLevel();
        Instance.gameplayUI.ShowLevelCompletePanel();
        PauseGame();
        Instance.totalAttempts   = 0;
        Instance.totalJumps      = 0;
        Instance.shardsCollected = Vector3.zero;
    }
        public static void PostAchievements(string steamUserId)
        {
            if (steamUserId == null)
            {
                throw new ArgumentNullException("steamUserId");
            }

            string appKey    = WebConfigurationManager.AppSettings["APIKey"];
            string appSecret = WebConfigurationManager.AppSettings["Secret"];
            List <Enums.ExtendedPermissions> permissions =
                new List <Enums.ExtendedPermissions> {
                Enums.ExtendedPermissions.publish_stream
            };
            IFrameCanvasSession session = new IFrameCanvasSession(appKey, appSecret, permissions);
            Api api = new Api(session);

            AchievementManager        manager            = new AchievementManager();
            IEnumerable <Achievement> latestAchievements = manager.GetLatestAchievements(steamUserId);

            foreach (Achievement achievement in latestAchievements)
            {
                string description = String.Format("earned the {0} achievement in {1}.", achievement.Name,
                                                   achievement.Game.Name);
                attachment attachment = new attachment
                {
                    caption = achievement.Description,
                    name    = achievement.Name,
                    href    = String.Format("http://steamcommunity.com/id/{0}/stats/{1}",
                                            steamUserId, achievement.Game.Abbreviation),
                    media = new List <attachment_media>
                    {
                        new attachment_media_image
                        {
                            src  = achievement.ImageUrl,
                            href =
                                String.Format(
                                    "http://steamcommunity.com/id/{0}/stats/{1}?tab=achievements",
                                    steamUserId, achievement.Game.Abbreviation)
                        }
                    }
                };

                api.Stream.Publish(description, attachment, null, null, 0);
            }
        }
Beispiel #26
0
 // Use this for initialization
 void Start()
 {
     if (!AchievementManager.IsAchievementDone(unlockname))
     {
         foreach (MeshRenderer rend in GetComponentsInChildren <MeshRenderer>())
         {
             foreach (Material mat in rend.materials)
             {
                 var avg = (mat.color.r + mat.color.g + mat.color.b) / 3;
                 mat.color = new Color(avg, avg, avg);
             }
         }
     }
     else
     {
         isUnlocked = true;
     }
 }
Beispiel #27
0
        public void RegisterAchievementCondition_GivenANewAchievementCondition_AddsTheAchievementCondition()
        {
            // Arrange
            AchievementManager am = new AchievementManager();

            string key = "key";
            Mock <IAchievementCondition> iAchievmentConditionMock = new Mock <IAchievementCondition>();

            iAchievmentConditionMock.SetupGet(x => x.UniqueId).Returns("uniqueId");
            iAchievmentConditionMock.SetupGet(x => x.AchievementConditionKey).Returns(key);

            // Act
            am.RegisterAchievementCondition(iAchievmentConditionMock.Object);
            am.ReportProgress(key);

            // Assert
            iAchievmentConditionMock.Verify(x => x.MakeProgress(), Times.Once);
        }
Beispiel #28
0
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            output.TagName = "span";
            var achievedAt = context.AllAttributes["data-achieved-at"]?.Value as DateTime?;
            var content    = await output.GetChildContentAsync();

            var achievementId = content.GetContent();
            var achievement   = AchievementManager.GetAchievementInfo(achievementId);

            if (achievement != null)
            {
                output.TagName = "a";
                output.Attributes.SetAttribute("class", output.Attributes["class"]?.Value + " achievement");
                output.Attributes.SetAttribute("title", achievement.GetName(language));
                output.Attributes.SetAttribute("href", $"/Achievement?id={achievement.Id}");
                output.Content.SetContent(achievement.Icon);
            }
        }
Beispiel #29
0
    // Start is called before the first frame update
    void Start()
    {
        instance = this;

        try
        {
            SteamClient.Init(1552250);
        }
        catch (System.Exception)
        {
            // Something went wrong - it's one of these:
            //
            //     Steam is closed?
            //     Can't find steam_api dll?
            //     Don't have permission to play app?
            //
        }
    }
Beispiel #30
0
 public void BossKilled()
 {
     if (AchievementManager.CompleteAchievement(AchievementManager.AchievementName.KillABoss))
     {
         ShowCompleted(AchievementManager.AchievementName.KillABoss);
     }
     foreach (bool b in GameController.maincontroller.bosskilled)
     {
         if (!b)
         {
             return;
         }
     }
     if (AchievementManager.CompleteAchievement(AchievementManager.AchievementName.KillAllBosses))
     {
         ShowCompleted(AchievementManager.AchievementName.KillAllBosses);
     }
 }
    // Use this for initialization
    void LateUpdate()
    {   //ALLOWS CLICKING TO START RIGHT AWAY\\
        achievementManager = AchievementManager.Instance;
        achievement        = achievementManager.GetAchievement(title);

        if (achievement.IsUnlocked)
        {
            transform.Find("AchievementImage").GetComponent <Image>().sprite = achievementSprite;
        }
        else
        {
            transform.Find("AchievementImage").GetComponent <Image>().sprite = lockedSprite;
        }

        transform.Find("TitleText").GetComponent <Text>().text       = achievement.Title;
        transform.Find("DescriptionText").GetComponent <Text>().text = achievement.Description;
        transform.Find("ProgressText").GetComponent <Text>().text    = achievement.CurrentProgress + "/" + achievement.Goal;
    }
Beispiel #32
0
 internal WorldManager(EventManager p_eventManager)
 {
     CurrentSaveGameFolder    = GamePaths.UserGamePath;
     QuickSaveAllowed         = true;
     m_mapData                = new Dictionary <String, MapData>();
     m_objects                = new List <BaseObject>();
     m_invalidSpawner         = new List <Int32>();
     m_questHandler           = new QuestHandler();
     m_loreBookHandler        = new LoreBookHandler();
     m_bestiaryHandler        = new BestiaryHandler();
     m_achievementManager     = new AchievementManager();
     m_hintManager            = new HintManager();
     m_mapNotesController     = new MapNotesController(p_eventManager);
     m_npcFactory             = new NpcFactory(p_eventManager);
     m_saveGameManager        = new DefaultSaveGameManager();
     m_spiritBeaconController = new SpiritBeaconController(p_eventManager);
     m_worldMapController     = new WorldMapController(p_eventManager);
 }
Beispiel #33
0
        private void StartAutoCheckForAchievements()
        {
            if (Interlocked.Exchange(ref isAutoChecking, 1) == 1)
            {
                return;
            }

            var featureObserver = new CachingObserver <bool>();

            achievementFeatureSubscription = IoCManager.Resolve <IFeatureToggleRouter>()
                                             .IsFeatureEnabled(FeatureId.Achievements)
                                             .Subscribe(featureObserver);

            async Task DequeueAndRepeatAsync()
            {
                try
                {
                    if (featureObserver.Last /* feature is enabled */)
                    {
                        await BackupData.WaitForInitAsync();

                        var pending = await AchievementManager.DequeuePendingAchievementNotifications();

                        AchievementNotification.QueueAchievementNotifications(pending);
                    }
                }
                catch (InvalidTransactionException)
                {
                    // Safe to ignore in this case, just retry later.
                    // This can happen because the auto-refresh can interleave
                    // with other transactions that execute asynchronous code
                    // inside them.
                }

                await Task.Delay(5000);

                if (isAutoChecking == 1)
                {
                    Device.BeginInvokeOnMainThread(async() => await DequeueAndRepeatAsync());
                }
            }

            Device.BeginInvokeOnMainThread(async() => await DequeueAndRepeatAsync());
        }
Beispiel #34
0
        internal void start()
        {
            using (IQueryAdapter queryReactor = CyberEnvironment.GetDatabaseManager().getQueryReactor())
            {
                uint itemsLoaded         = 0;
                uint catalogPageLoaded   = 0;
                uint navigatorLoaded     = 0;
                uint roomModelLoaded     = 0;
                uint videoPlaylistLoaded = 0;
                uint achievementLoaded   = 0;
                uint pollLoaded          = 0;

                this.BanManager.LoadBans(queryReactor);
                this.RoleManager.LoadRights(queryReactor);
                this.ItemManager.LoadItems(queryReactor, out itemsLoaded);
                Logging.WriteLine("Loaded a total of " + itemsLoaded + " item definition(s).");
                this.PinataHandler.Initialize(queryReactor);
                this.globalInventory = new InventoryGlobal();
                this.VideoManager.Load(queryReactor, out videoPlaylistLoaded);
                Logging.WriteLine("Loaded a total of " + videoPlaylistLoaded + " video playlist(s).");
                this.Catalog.Initialize(queryReactor, out catalogPageLoaded);
                Logging.WriteLine("Loaded a total of " + catalogPageLoaded + " catalogue page(s).");
                this.Navigator.Initialize(queryReactor, out navigatorLoaded);
                Logging.WriteLine("Loaded a total of " + navigatorLoaded + " official room(s).");
                this.RoomManager.LoadModels(queryReactor, out roomModelLoaded);
                Logging.WriteLine("Loaded a total of " + roomModelLoaded + " room model(s).");
                this.RoomManager.InitVotedRooms(queryReactor);
                this.AchievementManager = new AchievementManager(queryReactor, out achievementLoaded);
                Logging.WriteLine("Loaded a total of " + achievementLoaded + " achievement(s).");
                this.questManager.Initialize(queryReactor);
                this.PollManager.Init(queryReactor, out pollLoaded);
                Logging.WriteLine("Loaded a total of " + pollLoaded + " poll(s).");
                this.talentManager.Initialize(queryReactor);
                this.ModerationTool.LoadMessagePresets(queryReactor);
                this.ModerationTool.LoadPendingTickets(queryReactor);
                PetRace.Init(queryReactor);
                AntiPublicistas.Load(queryReactor);
                this.GetGroupManager().InitGroups();
                SongManager.Initialize();
                LowPriorityWorker.Init(queryReactor);
            }
            this.StartGameLoop();
            PixelManager.StartPixelTimer();
        }
        private static void CheckExperience()
        {
            if (Profile.Instance.CurrentProfile.PrincessTitle == EnumsModel.PrincessTitle.MASTER)
            {
                CurrentLevel         = 3;
                CurrentPrincessTitle = EnumsModel.PrincessTitle.MASTER;
                return;
            }


            if (CurrentExperience >= LevelExperience[2])
            {
                if (CurrentPrincessTitle == EnumsModel.PrincessTitle.Queen)
                {
                    return;
                }

                AchievementManager.AchieveQueenRank();
                CurrentPrincessTitle = EnumsModel.PrincessTitle.Queen;
                CurrentLevel         = (int)CurrentPrincessTitle;
            }
            else if (CurrentExperience >= LevelExperience[1])
            {
                if (CurrentPrincessTitle == EnumsModel.PrincessTitle.Princess)
                {
                    return;
                }

                AchievementManager.AchievePrincessRank();
                CurrentPrincessTitle = EnumsModel.PrincessTitle.Princess;
                CurrentLevel         = (int)CurrentPrincessTitle;
            }
            else if (CurrentExperience >= LevelExperience[0])
            {
                if (CurrentPrincessTitle == EnumsModel.PrincessTitle.Duchess)
                {
                    return;
                }

                AchievementManager.AchieveDuchessRank();
                CurrentPrincessTitle = EnumsModel.PrincessTitle.Duchess;
                CurrentLevel         = (int)CurrentPrincessTitle;
            }
        }
    void Awake()
    {
        aManager = GameObject.Find("AchievementManager").GetComponent <AchievementManager>();
        if (PlayerPrefs.HasKey("playerName"))
        {
            m_nameOfPlayer = PlayerPrefs.GetString("playerName");
            menuObjs[0].GetComponent <InputField>().text = m_nameOfPlayer;
        }
        else
        {
            m_nameOfPlayer = "";
            PlayerPrefs.SetString("playerName", m_nameOfPlayer);
        }
        if (PlayerPrefs.HasKey("locHighScore"))
        {
            m_localHighscore = PlayerPrefs.GetInt("locHighScore");
        }
        else
        {
            m_localHighscore = 0;
            PlayerPrefs.SetInt("locHighScore", m_localHighscore);
        }
        if (PlayerPrefs.HasKey("Coins"))
        {
            m_coins = PlayerPrefs.GetInt("Coins");
        }
        else
        {
            PlayerPrefs.SetInt("Coins", m_coins);
        }

        if (PlayerPrefs.HasKey("gamesPlayed"))
        {
            m_gamesPlayed = PlayerPrefs.GetInt("gamesPlayed");
        }
        else
        {
            m_gamesPlayed = 0;
            PlayerPrefs.SetInt("gamesPlayed", m_gamesPlayed);
        }

        m_highScoreTxt.text = "Loading Highscore....";
    }
Beispiel #37
0
    void OnGUI()
    {
        AchievementManager am    = new AchievementManager();
        List <Achievement> al    = am.getAchievements();
        GUIStyle           style = new GUIStyle(GUI.skin.label);

        style.font             = (Font)Resources.Load("font/Animated");
        style.normal.textColor = Color.black;
        style.fontSize         = 32;
        float highscore = PlayerPrefs.GetFloat("HighScore");

        GUI.Label(new Rect(Screen.width * 0.1f, Screen.height * 0.05f, Screen.width * 0.8f, Screen.height * 0.1f), "High score: " + highscore, style);

        //Building GUILabel of all achievements
        for (int i = 0; i <= 4; i++)
        {
            Rect tempRect = new Rect(Screen.width * 0.1f, Screen.height * (0.1f * (i + 2)), Screen.width * 0.8f, Screen.height * 0.1f);

            if (PlayerPrefs.GetInt(al[i].getKey()) == 1)
            {
                style.normal.textColor = Color.black;
                GUI.Label(tempRect, al[i].getKey() + " ✔", style);
            }
            else
            {
                style.normal.textColor = Color.grey;
                GUI.Label(tempRect, al[i].getKey(), style);
            }
        }

        style.normal.textColor = Color.white;

        GUIStyle styles = new GUIStyle(GUI.skin.label);

        styles.font             = (Font)Resources.Load("font/Animated");
        styles.fontSize         = 32;
        styles.normal.textColor = Color.black;

        if (GUI.Button(new Rect(Screen.width * 0.4f, Screen.height * 0.8f, Screen.width * 0.2f, Screen.height * 0.1f), "Back", styles))
        {
            Application.LoadLevel("WelcomeScreen");
        }
    }
    // Make an offer on the player's behalf.
    public void MakeOffer()
    {
        // Don't let the player move the wheel anymore.
        // TODO: make it obvious that the wheel is inactive? (A light on top of it?)
        //this.wheelActive = false;
        this.offerButton.interactable  = false;
        this.acceptButton.interactable = false;

        float counter;
        float offer = manager.fPrice;
        bool  cont  = CounterOffer(offer, out counter);

        // NPC is fed up --
        if (!cont && counter == 0f)
        {
            this.noDeal.SetActive(true);
            this.offerButton.interactable = false;
            ShowUIButtons();
            // NPC has taken the offer --
        }
        else if (!cont)
        {
            this.deal.SetActive(true);
            this.offerButton.interactable = false;
            effects.Play();
            Inventory.Instance.AddGold((int)offer);
            ShonkyInventory.Instance.RemoveItem(GameManager.Instance.ShonkyIndexTransfer);
            AchievementManager.Get("barter_sell_01");
            ShowUIButtons();
            // NPC has countered.
        }
        else
        {
            //while (this.backgroundrb.velocity.x != 0f)
            //kthis.offerButton.enabled = false;
            //this.wheelActive = true;
            this.offerButton.interactable  = true;
            this.acceptButton.interactable = true;
            // ?? work is already done in CounterOffer().
        }

        return;
    }
Beispiel #39
0
        private void Page_Load(object sender, EventArgs e)
        {
            // set FacebookUserId and SteamUserId
            FacebookUserId = login.FacebookUserId;

            try
            {
                using (IAchievementManager manager = new AchievementManager())
                {
                    SteamUserId = manager.GetSteamUserId(FacebookUserId);

                    Session["SteamUserId"] = SteamUserId;
                }
            }
            catch (Exception ex)
            {
                errorLiteral.Text = ex.Message;
            }
        }
Beispiel #40
0
	void Start()
	{
		achievementManager = AchievementManager.ins;
		if (achievementManager == null)
		{
			Debug.LogError("No AchievementManager found!");
		}
		applicationManager = ApplicationManager.ins;
		if (applicationManager == null)
		{
			Debug.LogError("No ApplicationManager found!");
		}

		if (Application.loadedLevelName == "CourseView")
		{
			SetupCourseView();
		}
		
	}
    // Use this for initialization
    void Awake()
    {
        labels = new List<UILabel>();
        portraits = new List<UISprite>();

        npcs = MainDatabase.Instance.getCompletedNPCs(1);
        am = GameObject.Find("Camera").GetComponent<AchievementManager>();

        int i = 0;
        foreach (GameObject go in PortaitFramesGO) //looping all cells
        {
            if(i<npcs.Count)
            {
                foreach (Transform child in go.transform) // looping though all children
                {
                    if(child.name == "label")
                        labels.Add(child.GetComponent<UILabel>());
                    else if(child.name == "portait")
                        portraits.Add(child.GetComponent<UISprite>());

                    // Turn on collider if its a npc
                    if(child.name == "FrameCollider")
                    {
                        child.GetComponent<potraitClicked>().manager = am;
                        child.collider.enabled = true;
                        child.GetComponent<UISprite>().spriteName = "Blank White Photo";
                        child.localPosition = new Vector3(0,0,0);
                    }
                }
            // if its less then number of npcs completed then replace with their name and portrait
                labels[i].text = npcs[i].NPCName;
                portraits[i].spriteName = npcs[i].NPCName;
                portraits[i].enabled = true;
                go.name = npcs[i].NPCName;
            }
            else
                break;

            i++;
        }
    }
        /// <summary>
        /// A basic overview of a set of Achievements
        /// </summary>
        /// <param name="achievements">A set of Achievements to be desplyed</param>
        /// <param name="achievementManager">The AchievementManager to get all the infos from</param>
        public AchievementOverviewControl(IEnumerable<Achievement> achievements, AchievementManager achievementManager)
        {
            this.achievementManager = achievementManager;
            InitializeComponent();

            // initialize the achievementList
            achievementList = new ObservableCollection<Achievement>();

            if (achievements == null)
            {
                // If the Control is invoked without a list of Achivements to display it will register
                // to AchievementManager.Instance.AchievementsChanged and will load all registered Achievements
                achievementManager.AchievementRegistered += AchievementRegisteredHandler;

                // Get all already registered Achievements and add them to the list
                achievements = achievementManager.AchievementList;
            }

            // Add all Achievements to our List
            foreach (Achievement achievement in achievements)
                AchievementList.Add(achievement);
        }
	void OnGUI(){

		AchievementManager am = new AchievementManager ();
		List<Achievement> al = am.getAchievements ();
		GUIStyle style = new GUIStyle (GUI.skin.label);
		style.font = (Font)Resources.Load ("font/Animated");
		style.normal.textColor = Color.black;
		style.fontSize = 32;
		float highscore = PlayerPrefs.GetFloat ("HighScore");

		GUI.Label (new Rect (Screen.width * 0.1f, Screen.height * 0.05f, Screen.width * 0.8f, Screen.height * 0.1f), "High score: " + highscore, style);

		//Building GUILabel of all achievements
		for (int i = 0; i <=4; i++) {
			Rect tempRect = new Rect (Screen.width * 0.1f, Screen.height * (0.1f * (i+2)), Screen.width * 0.8f, Screen.height * 0.1f);
			
			if (PlayerPrefs.GetInt(al[i].getKey()) == 1) {
				style.normal.textColor = Color.black;
				GUI.Label (tempRect, al[i].getKey () + " ✔", style);
			}else{
				style.normal.textColor = Color.grey;
				GUI.Label (tempRect, al[i].getKey (), style);
			}	

		}

		style.normal.textColor = Color.white;

		GUIStyle styles = new GUIStyle (GUI.skin.label);
		
		styles.font = (Font)Resources.Load ("font/Animated");
		styles.fontSize = 32;
		styles.normal.textColor = Color.black;
		
		if (GUI.Button (new Rect (Screen.width * 0.4f, Screen.height * 0.8f, Screen.width * 0.2f, Screen.height * 0.1f), "Back", styles)) {
			Application.LoadLevel("WelcomeScreen");	
		}
	}
 public TimedKillAchievement(AchievementManager am, string name, string description, int requiredKills, float timeGive)
     : base(am, name, description)
 {
     this.requiredKills = requiredKills;
     this.timeGive = timeGive;
 }
 public void alert(AchievementManager.Achievement achieve)
 {
     achieveList.Add(achieve);
 }
 private void playAnimation(AchievementManager.Achievement achieve)
 {
     achieveText.text = "[00BB00]Achievement unlocked:[-] " + achieve.name;
     ActiveAnimation.Play(alertAnimation, AnimationOrTween.Direction.Toggle);
 }
 public UntouchedAchievement(AchievementManager am, string name, string description, float requiredUntouchedTime)
     : base(am, name, description)
 {
     this.requiredUntouchedTime = requiredUntouchedTime;
 }
    // Runs before Start
    void Awake()
    {
        // Makes sure that there is only ever one of this script in the game
        if (data == null)
        {
            DontDestroyOnLoad(gameObject);
            data = this;

            // Initialise achievement data
            achievementManager = GetComponent<AchievementManager>();
            achievementManager.Initialise();

            // Load game data from file when starting
            Load();

            // Initialise weapon data
            weaponManager = GetComponent<WeaponManager>();
            weaponManager.Initialise(weaponCount);
        }
        else if (data != this)
        {
            Destroy(gameObject);
        }
    }
 public Achievement(AchievementManager am, string name, string description)
 {
     this.am = am;
     this.name = name;
     this.description = description;
 }
 public WalkingAchievement(AchievementManager am, string name, string description, float requiredDistance)
     : base(am, name, description)
 {
     this.requiredDistance = requiredDistance;
 }
 public SimultaneousKillsAchievement(AchievementManager am, string name, string description, int requiredSimultaneousKills)
     : base(am, name, description)
 {
     this.requiredSimultaneousKills = requiredSimultaneousKills;
 }
 public KillingBersekerAchievement(AchievementManager am, string name, string description, int requiredKills)
     : base(am, name, description)
 {
     this.requiredKills = requiredKills;
 }
 public AssassinAchievement(AchievementManager am, string name, string description, int requiredKills)
     : base(am, name, description)
 {
     this.requiredKills = requiredKills;
 }
    private void PopulateAchievements(uint authGeneration,
                                      AchievementManager.FetchAllResponse response) {

        if (authGeneration != mAuthGeneration) {
            Logger.d("Received achievement callback after signout occurred, ignoring");
            return;
        }

        Logger.d("Populating Achievements");
        lock (AuthStateLock) {
            if (response.Status() != Status.ResponseStatus.VALID &&
                response.Status() != Status.ResponseStatus.VALID_BUT_STALE) {
                Logger.e("Error retrieving achievements - check the log for more information. " +
                    "Failing signin.");
                var localLoudAuthCallbacks = mPendingAuthCallbacks;
                mPendingAuthCallbacks = null;

                if (localLoudAuthCallbacks != null) {
                    InvokeCallbackOnGameThread(localLoudAuthCallbacks, false);
                }
                SignOut();
                return;
            }

            var achievements = new Dictionary<string, Achievement>();
            foreach (var achievement in response) {
                using (achievement) {
                    achievements[achievement.Id()] = achievement.AsAchievement();
                }
            }
            mAchievements = achievements;
        }

        Logger.d("Maybe finish for Achievements");
        MaybeFinishAuthentication();
    }
 public ZoneAchievement(AchievementManager am, string name, string description, string nameZone)
     : base(am, name, description)
 {
     this.nameZone = nameZone;
 }
Beispiel #56
0
 public void AlertUnlockAchievement(AchievementManager.Achievement achieve)
 {
     Debug.Log("Unlock achive: " + achieve.name);
     ahievementUnlockAlert.alert(achieve);
 }
Beispiel #57
0
 void Start()
 {
     achievementManager = AchievementManager.ins;
     if (achievementManager == null)
     {
         Debug.LogError("No AchievementManager found!");
     }
     applicationManager = ApplicationManager.ins;
     if (applicationManager == null)
     {
         Debug.LogError("No ApplicationManager found!");
     }
 }
 private void Awake()
 {
     instance = this;
 }