コード例 #1
0
 public Achievement()
 {
     achievementType = AchievementType.LEVEL_achievement;
     rank            = 1;
     baseValue       = (float)achievementType;
     achievementText = "";
 }
コード例 #2
0
ファイル: Achievements.cs プロジェクト: Caeden117/Eclipse
 public Achievement(string achievementName, string achievementDescription, AchievementType achievementType)
 {
     name        = achievementName;
     description = achievementDescription;
     type        = achievementType;
     linkedItem  = "";
 }
コード例 #3
0
 public Achievement(AchievementType achievementType, int rank, string achievementText)
 {
     this.achievementType = achievementType;
     this.rank            = rank;
     this.baseValue       = (float)achievementType;
     this.achievementText = achievementText;
 }
コード例 #4
0
        public static BigIntWithUnit UpdateAchievementCount(this AchievementType type, BigIntWithUnit oldValue, BigIntWithUnit update)
        {
            switch (type)
            {
            case AchievementType.AirMage:
                return(oldValue > update ? oldValue : update);

            case AchievementType.FireMage:
                return(oldValue > update ? oldValue : update);

            case AchievementType.WaterMage:
                return(oldValue > update ? oldValue : update);

            case AchievementType.EarthMage:
                return(oldValue > update ? oldValue : update);

            case AchievementType.Wave:
                return(update);

            case AchievementType.Spend:
                return(oldValue + update);

            case AchievementType.Earn:
                return(oldValue + update);

            case AchievementType.Reset:
                return(oldValue + update);
            }
            return(0);
        }
コード例 #5
0
ファイル: AchievementManager.cs プロジェクト: tosw164/Frogify
        /**
         * This is for handling whenever an action that can correspond to an
         * achievement is triggered. It will be called on this object and then it
         * will increment the field holding the counts for each of the achievement categories
         */
        public void RegisterAchievementEvent(AchievementType achType)
        {
            //Do a check to make sure the type is actually in the dictionary
            //just as a precaution.
            switch (achType)
            {
            case AchievementType.LEVEL:
                _achivementTypeCount[achType]++;
                break;

            case AchievementType.NPC_PERSUADED:
                _achivementTypeCount[achType]++;
                break;

            case AchievementType.COLLECTABLES:
                _achivementTypeCount[achType]++;
                break;

            case AchievementType.HIDDEN_ITEMS:
                _achivementTypeCount[achType]++;
                break;
            }

            ParseAchievements(achType);
        }
コード例 #6
0
        public static string GetResourceKey (AchievementType? achievementType)
        {
            if (achievementType != null)
                return "AchievementType" + (char) achievementType.Value + ".Text";
		
            return "AchievementTypeN.Text";
        }
コード例 #7
0
 private PlayerAchievement AddNextAchievement(Player player, AchievementType achievementType)
 {
     var newAchievement = new PlayerAchievement(player, achievementType);
     _playerAchievementRepository.Add(newAchievement);
     _playerAchievementRepository.SaveChanges();
     return newAchievement;
 }
コード例 #8
0
ファイル: AchievementManager.cs プロジェクト: THSJF/sjf
        public void Check(AchievementType achivtype, int achivid, Hashtable data)
        {
            int index = AchievementManager.achivIndex[(int)achivtype] + achivid;

            if (Main.Replay || Main.Mode == Modes.NETWORK)
            {
                return;
            }
            if (!this.achivs[index].get)
            {
                if (!this.achivs[index].Check(data))
                {
                    return;
                }
                this.showBoards.Add(new Board(AchievementManager.boardTex, AchievementManager.achivName[(int)achivtype][achivid]));
                this.AddFinishFlag(achivtype, achivid, this.achivs[index].finishedlevel);
            }
            else
            {
                if (this.achivs[index].finished || !this.achivs[index].Check(data))
                {
                    return;
                }
                this.AddFinishFlag(achivtype, achivid, this.achivs[index].finishedlevel);
            }
        }
コード例 #9
0
    public void CheckAchievementsByType(AchievementType achievementType)
    {
        List <int> achievementList = new List <int>();

        if (achievementType == AchievementType.PlayerPlayTime)
        {
            achievementList = StoredIDs_PlayerPlayTime;
        }
        else
        {
            achievementList = GetAchievementIDsByType(achievementType);
        }

        float?achievementField = GetAchievementField(achievementType);

        if (achievementField.HasValue)
        {
            foreach (int achievementID in achievementList)
            {
                if (achievementField.Value >= Achievements[achievementID].TargetValue)
                {
                    GameMaster.Instance.Player.UnlockAchievement(achievementID);
                }
            }
        }
        else
        {
            Debug.Log(string.Format("No logic set for achievement type '{0}'!", achievementType.ToString()));
        }
    }
コード例 #10
0
    private float?GetAchievementField(AchievementType achievementType)
    {
        float?genericField = null;

        switch (achievementType)
        {
        case AchievementType.OrdersCompleted:
            genericField = GameMaster.Instance.OrderManager.CountCompleted;
            break;

        case AchievementType.OrdersFailed:
            genericField = GameMaster.Instance.OrderManager.CountFailed;
            break;

        case AchievementType.PlayerLevel:
            genericField = GameMaster.Instance.Player.Level;
            break;

        case AchievementType.PlayerMoney:
            genericField = GameMaster.Instance.Player.Business.Money;
            break;

        case AchievementType.PlayerPlayTime:
            genericField = GameMaster.Instance.Player.PlayTime;
            break;

        case AchievementType.UpgradeCount:
            genericField = GameMaster.Instance.Player.UnlockedUpgradesPassive.Count;
            break;
        }

        return(genericField);
    }
コード例 #11
0
 public AchievementDefinition(IntPtr o)
 {
     Type           = CAPI.ovr_AchievementDefinition_GetType(o);
     Name           = CAPI.ovr_AchievementDefinition_GetName(o);
     BitfieldLength = CAPI.ovr_AchievementDefinition_GetBitfieldLength(o);
     Target         = CAPI.ovr_AchievementDefinition_GetTarget(o);
 }
コード例 #12
0
ファイル: Achievements.cs プロジェクト: mrdivdiz/bpvita
    public static bool GetAchievementStatus(AchievementType achievement)
    {
        switch (achievement)
        {
        case Achievements.AchievementType.Time:
            if (WPFMonoBehaviour.levelManager.TimeElapsed < WPFMonoBehaviour.levelManager.TimeLimit)
            {
                return(true);
            }
            break;

        case Achievements.AchievementType.CoolPilot:
            if ((float)WPFMonoBehaviour.levelManager.m_totalDestroyedParts / (float)WPFMonoBehaviour.levelManager.m_totalAvailableParts < 0.25f)
            {
                return(true);
            }
            break;

        case Achievements.AchievementType.CrazyPilot:
            if ((float)WPFMonoBehaviour.levelManager.m_totalDestroyedParts / (float)WPFMonoBehaviour.levelManager.m_totalAvailableParts > 0.5f)
            {
                return(true);
            }
            break;
        }
        return(false);
    }
コード例 #13
0
    public void ShowAchievement(AchievementType achievement)
    {
        m_AchievementBanner.sprite  = m_AchievementSprites[(int)achievement];
        m_AchievementBanner.enabled = true;

        m_Timer = m_TimeThatAchievementShown;
    }
コード例 #14
0
        private Dictionary <int, string> GetAchievementValueListByType(AchievementType achievementType)
        {
            Dictionary <int, string> result = null;

            switch (achievementType)
            {
            case AchievementType.PveStars:
                result = this.pveStarsAchievements;
                break;

            case AchievementType.LootCreditsPvp:
                result = this.lootCreditsAchievements;
                break;

            case AchievementType.LootAlloyPvp:
                result = this.lootAlloyAchievements;
                break;

            case AchievementType.LootContrabandPvp:
                result = this.lootContrabandAchievements;
                break;

            case AchievementType.PvpWon:
                result = this.pvpBattlesWonAchievements;
                break;
            }
            return(result);
        }
コード例 #15
0
        /// <summary>
        /// Gives an achievement to a player's account (by CD key).
        /// If the player already has this achievement, nothing will happen.
        /// </summary>
        /// <param name="player">The player to give the achievement to.</param>
        /// <param name="achievementType">The achievement to grant.</param>
        public static void GiveAchievement(uint player, AchievementType achievementType)
        {
            if (!GetIsPC(player) || GetIsDM(player))
            {
                return;
            }

            var cdKey   = GetPCPublicCDKey(player);
            var account = DB.Get <Account>(cdKey) ?? new Account();

            if (account.Achievements.ContainsKey(achievementType))
            {
                return;
            }

            var playerId = GetObjectUUID(player);
            var dbPlayer = DB.Get <Player>(playerId);
            var now      = DateTime.UtcNow;

            account.Achievements[achievementType] = now;
            DB.Set(cdKey, account);

            // Player turned off achievement notifications. Nothing left to do here.
            if (!dbPlayer.Settings.DisplayAchievementNotification)
            {
                return;
            }

            var achievement = _activeAchievements[achievementType];

            DisplayAchievementNotificationWindow(player, achievement.Name);
            Core.NWNX.Player.PlaySound(player, "gui_prompt", OBJECT_INVALID);
        }
コード例 #16
0
    public void ShowAchievement(AchievementType achievement)
    {
        m_AchievementBanner.sprite = m_AchievementSprites[(int) achievement];
        m_AchievementBanner.enabled = true;

        m_Timer = m_TimeThatAchievementShown;
    }
コード例 #17
0
 public void UpdateAchievement(AchievementType type, params object[] param)
 {
     if (m_AchievementInfo.TrackingAchievements.ContainsKey((int)type) && m_AchievementInfo.TrackingAchievements[(int)type] != null)
     {
         m_AchievementUpdaters[(int)type](param);
     }
 }
コード例 #18
0
        private static AchievementType CreateAchievementType(
            string name,
            string accountGuid,
            bool includeChildAccounts = false,
            bool isActive             = true,
            int maxAllowed            = 1,
            bool allowOver            = false,
            int numberToAccumulate    = 1)
        {
            var achievement = new AchievementType
            {
                Name     = name,
                IsActive = isActive,
                ComponentEntityTypeId     = EntityTypeCache.GetId(ComponentEntityTypeName) ?? 0,
                MaxAccomplishmentsAllowed = maxAllowed,
                AllowOverAchievement      = allowOver,
                ComponentConfigJson       = "{ \"GivingToAccountAchievement\": \"null\" }",
                ForeignKey = KEY
            };

            _achievementTypeService.Add(achievement);
            _rockContext.SaveChanges(true);

            achievement.LoadAttributes();
            achievement.SetAttributeValue(Rock.Achievement.Component.GivingToAccountAchievement.AttributeKey.IncludeChildFinancialAccounts, includeChildAccounts.ToString());
            achievement.SetAttributeValue(Rock.Achievement.Component.GivingToAccountAchievement.AttributeKey.FinancialAccount, accountGuid);
            achievement.SetAttributeValue(Rock.Achievement.Component.GivingToAccountAchievement.AttributeKey.StartDateTime, _startDate.ToISO8601DateString());
            achievement.SetAttributeValue(Rock.Achievement.Component.GivingToAccountAchievement.AttributeKey.EndDateTime, _endDate.ToISO8601DateString());
            achievement.SetAttributeValue(Rock.Achievement.Component.GivingToAccountAchievement.AttributeKey.NumberToAccumulate, numberToAccumulate.ToString());
            achievement.SaveAttributeValues();

            return(achievement);
        }
コード例 #19
0
        public override bool TakeAction()
        {
            var achievement = GetAchievement.AchievementList.Find(t => (t.ID == id));
            var config      = new ShareCacheStruct <Config_Achievement>().FindKey(id);

            if (achievement == null || config == null ||
                achievement.ID == 0 || achievement.Status != TaskStatus.Finished)
            {
                return(false);
            }
            type = achievement.Type;

            switch (config.RewardsType)
            {
            case TaskAwardType.Gold:
            {
                BigInteger bi = BigInteger.Parse(config.RewardsItemNum);
                UserHelper.RewardsGold(Current.UserId, bi);
            }
            break;

            case TaskAwardType.Diamond:
            {
                UserHelper.RewardsDiamond(Current.UserId, Convert.ToInt32(config.RewardsItemNum));
            }
            break;

            case TaskAwardType.Item:
            {
                UserHelper.RewardsItem(Current.UserId, config.RewardsItemID, Convert.ToInt32(config.RewardsItemNum));
            }
            break;
            }


            // 新成就
            var stock  = new ShareCacheStruct <Config_Achievement>().FindAll(t => (t.AchievementType == achievement.Type));
            var select = stock.Find(t => (t.id > achievement.ID));

            if (select != null)
            {
                achievement.ID     = select.id;
                achievement.Status = TaskStatus.No;
            }
            else
            {
                achievement.Status = TaskStatus.Received;
            }

            //achievement.Count = 0;
            if (type == AchievementType.Gem)
            {
                achievement.Count = "0";
            }
            //else if (type == AchievementType.OpenSoul)
            //    achievement.Count = "0";

            receipt = achievement;
            return(true);
        }
コード例 #20
0
    //Checks if achievement has been unlocked, if it has update and show the unlcoked achievement
    private void updateAchievement(AchievementType ach)
    {
        int curCount = achievementsMap[ach].count;
        List <AchievementName> achievements = achievementsMap[ach].achievementNames;

        foreach (AchievementName achievement in achievements)
        {
            bool waslocked = !achievement.isUnlocked;
            if (curCount >= achievement.unlockCount)
            {
                achievement.isUnlocked = true;
                if (waslocked)
                {
                    if (curCount != 0)
                    {
                        StartCoroutine(ShowAndFade());

                        message.text = achievementsMap[ach].msg0 + achievement.unlockCount + achievementsMap[ach].msg1;
                        name.text    = achievement.name;
                    }
                    achievementsMap[ach].unlockedAchievements++;
                }
            }
        }
    }
コード例 #21
0
        public static void ReportAchievement(AchievementType inType)
        {
            string achievementStringIOS     = "";
            string achievementStringAndroid = "";

            int intType = (int)inType;

            intType++;
            achievementStringIOS     = "FRACH_0" + intType.ToString("00");
            achievementStringAndroid = GameCenterWrapper.GetGoogleAchievementCode((int)inType);

//		if (!Globals.g_loadSave.achievementGot[(int)inType])
//		{
//			Globals.g_achievementQueue.ShowAchievement(inType);
//			Globals.g_loadSave.achievementGot[(int)inType] = true;
//		}

#if UNITY_EDITOR
            return;
#endif

#if UNITY_IOS
            Social.ReportProgress(achievementStringIOS, 100.0f, (bool success) => {});
#else
            Social.ReportProgress(achievementStringAndroid, 100.0f, (bool success) => {});

            //		GoogleGPGS.Instance().UnlockAchievement(achievementStringAndroid);
#endif
        }
コード例 #22
0
    // Token: 0x06000928 RID: 2344 RVA: 0x0003A53C File Offset: 0x0003873C
    public static Texture2D GetAchievementBadgeTexture(AchievementType achievement)
    {
        switch (achievement)
        {
        case AchievementType.MostValuable:
            return(AchievementIcons.Achievement1MostValuablePlayer);

        case AchievementType.MostAggressive:
            return(AchievementIcons.Achievement2MostAggressive);

        case AchievementType.SharpestShooter:
            return(AchievementIcons.Achievement3SharpestShooter);

        case AchievementType.TriggerHappy:
            return(AchievementIcons.Achievement4TriggerHappy);

        case AchievementType.HardestHitter:
            return(AchievementIcons.Achievement5HardestHitter);

        case AchievementType.CostEffective:
            return(AchievementIcons.Achievement6CostEffective);

        default:
            return(AchievementIcons.AchievementDefault);
        }
    }
コード例 #23
0
 void UpdateAchievements(AchievementType type, long previousValue, long newValue)
 {
     if (IsAchievementJustUnlocked(type, previousValue, newValue))
     {
         m_AchievementsManager.ShowAchievement(type);
     }
 }
コード例 #24
0
    // Token: 0x06000C78 RID: 3192 RVA: 0x00054014 File Offset: 0x00052214
    private string GetAchievementTitle(AchievementType type)
    {
        switch (type)
        {
        case AchievementType.MostValuable:
            return("MOST VALUABLE");

        case AchievementType.MostAggressive:
            return("MOST AGGRESSIVE");

        case AchievementType.SharpestShooter:
            return("SHARPEST SHOOTER");

        case AchievementType.TriggerHappy:
            return("TRIGGER HAPPY");

        case AchievementType.HardestHitter:
            return("HARDEST HITTER");

        case AchievementType.CostEffective:
            return("COST EFFECTIVE");

        default:
            return(string.Empty);
        }
    }
コード例 #25
0
    // Token: 0x06000C77 RID: 3191 RVA: 0x00053FF8 File Offset: 0x000521F8
    private IEnumerator StartBadgeShow()
    {
        int coroutineId = Singleton <PreemptiveCoroutineManager> .Instance.IncrementId(new PreemptiveCoroutineManager.CoroutineFunction(this.StartBadgeShow));

        if (this._achievementList.Count > 0 && this._curPlayerStats != null && this._curPlayerStats.Achievements.Count == this._achievementList.Count)
        {
            this._curAchievementIndex = 0;
            while (Singleton <PreemptiveCoroutineManager> .Instance.IsCurrent(new PreemptiveCoroutineManager.CoroutineFunction(this.StartBadgeShow), coroutineId))
            {
                AchievementType type = this._achievementList[this._curAchievementIndex];
                this.SetCurrentAchievementBadge(type, (int)this._curPlayerStats.Achievements[(byte)type], string.Empty);
                yield return(new WaitForSeconds(2f));

                if (this._achievementList.Count > 0)
                {
                    this._curAchievementIndex = ++this._curAchievementIndex % this._achievementList.Count;
                }
            }
            yield break;
        }
        if (this._curPlayerStats != null)
        {
            this.SetCurrentAchievementBadge(AchievementType.None, Mathf.RoundToInt((float)Math.Max(this._curPlayerStats.Kills, 0) / Math.Max((float)this._curPlayerStats.Deaths, 1f) * 10f), this._curPlayerStats.Name);
        }
        yield break;
    }
コード例 #26
0
        public void GenerateImage(string achievementName, long gs, AchievementType type, ulong imageID)
        {
            // first determine background image path
            string backgroundImagePath;

            switch (type)
            {
            case AchievementType.XboxOneRare:
                backgroundImagePath = Configuration.PathAchievementXboxOneRareBackground;
                break;

            case AchievementType.Xbox360:
                backgroundImagePath = Configuration.PathAchievementXbox360Background;
                break;

            default:
                backgroundImagePath = Configuration.PathAchievementXboxOneBackground;
                break;
            }

            // passing the relative path was breaking it, so now just going to pass it the file stream instead
            string path = Path.Combine(Directory.GetCurrentDirectory(), backgroundImagePath);

            using (var backgroundStream = new FileStream(path, FileMode.Open))
            {
                // now do stuff with the image
                using (MagickImage image = new MagickImage(backgroundImagePath))
                {
                    MagickImage headerLayer = new MagickImage(MagickColor.FromRgba(0, 0, 0, 0), image.Width, image.Height);

                    if (type == AchievementType.XboxOne || type == AchievementType.XboxOneRare)
                    {
                        headerLayer.Settings.FontFamily    = "Segoe UI";
                        headerLayer.Settings.FontPointsize = 36;
                        headerLayer.Settings.TextGravity   = Gravity.Southwest;
                        headerLayer.Settings.FillColor     = MagickColor.FromRgb(255, 255, 255);
                    }

                    if (type == AchievementType.XboxOne || type == AchievementType.Xbox360)
                    {
                        var s = $"{gs} - {achievementName}";
                        headerLayer.Annotate(s, new MagickGeometry(225, 30, 700, 80), Gravity.West);
                    }
                    else if (type == AchievementType.XboxOneRare)
                    {
                        int    rarePercent;
                        Random r = new Random();
                        rarePercent = r.Next(1, 5);
                        headerLayer.Annotate($"Rare achievement unlocked - {rarePercent}%", new MagickGeometry(155, 5, 400, 70), Gravity.West);
                        headerLayer.Annotate($"{gs} - {achievementName}", new MagickGeometry(195, 55, 400, 70), Gravity.West);
                    }

                    image.Composite(headerLayer, CompositeOperator.Over);
                    image.Write(GenerateImagePath(imageID));
                }
            }
            // increment the generation counter
            GenerationCounter++;
        }
コード例 #27
0
        public static AchievementStateBase Instance(AchievementType type)
        {
            var instance = Services.First(c => c.Key.Equals(type)).Value;
            if (instance == null)
                throw new NotImplementedException("AchievementState was not implemented");

            return instance;
        }
コード例 #28
0
ファイル: SteamHelper.cs プロジェクト: zerk-js/SOTSII-SOS
 public void DoAchievement(AchievementType cheevo)
 {
     if (!this._initialized || this.HasAchievement(cheevo))
     {
         return;
     }
     this.AddAchievement(cheevo);
 }
コード例 #29
0
 public Achievement GetAchievement(int rank, AchievementType achievementType)
 {
     if (rank == this.rank && achievementType == this.achievementType)
     {
         return(new Achievement(this.achievementType, this.rank, this.achievementText));
     }
     return(new Achievement());
 }
コード例 #30
0
 public AchievementDefinition(string name, Bundle serverData)
 {
     Name = name;
     Type = Common.ParseEnum<AchievementType>(serverData["type"]);
     Config = serverData["config"];
     Progress = serverData["progress"];
     GameData = serverData["gameData"];
     GamerData = serverData["gamerData"];
 }
コード例 #31
0
ファイル: Achievement.cs プロジェクト: safonce/sayur
 public Achievement(int id, string name, string description, int rewardGold, int countToUnlock, AchievementType type)
 {
     Id            = id;
     Name          = name;
     Description   = description;
     RewardGold    = rewardGold;
     CountToUnlock = countToUnlock;
     Type          = type;
 }
コード例 #32
0
 public static void AddSuccess(AchievementType AchievementId, int UserID)
 {
     if (!UserAlreadyHasThisAchiviement(UserID, AchievementId))
     {
         List <Achievement> all             = GetCollectionOfAllAchievements();
         string             achievementName = all.Where <Achievement>(a => a.Id == AchievementId).FirstOrDefault().Name;
         AddSuccess(AchievementId, achievementName, UserID);
     }
 }
コード例 #33
0
        public async Task ShowAchievement(AchievementType name, string value)
        {
            double height = Window.Current.Bounds.Height;
            int    index  = (int)name;

            _txtName.Text  = _achievements[index].Description;
            _txtValue.Text = value;
            await Show(true);
        }
コード例 #34
0
        /// <summary>
        /// Update or complete player achievements of <see cref="AchievementType"/> as <see cref="Player"/> with supplied object ids.
        /// </summary>
        public override void CheckAchievements(Player target, AchievementType type, uint objectId, uint objectIdAlt = 0u, uint count = 1u)
        {
            CheckAchievements(target, GlobalAchievementManager.Instance.GetCharacterAchievements(type), objectId, objectIdAlt, count);

            // TODO

            /*if (inGuild)
             *  guild.AchievementManager.CheckAchievements(target, GlobalAchievementManager.GetGuildAchievements(type), objectId, objectIdAlt, count);*/
        }
コード例 #35
0
    bool IsAchievementJustUnlocked(AchievementType type, long previousValue, long newValue)
    {
        bool achievementUnlocked = false;

        switch (type)
        {
        case AchievementType.e_DrunkDriver:
            if (previousValue + m_CarsDestroyedGlobal < m_CarsDestroyedAchievement &&
                newValue + m_CarsDestroyedGlobal >= m_CarsDestroyedAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_FourthOfJuly:
            if (previousValue + m_TrucksDestroyedGlobal < m_TrucksDestroyedAchievement &&
                newValue + m_TrucksDestroyedGlobal >= m_TrucksDestroyedAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_LastProtector:
            if (previousValue + m_MiniUFOsShotGlobal < m_MiniUFOsShotAchievement &&
                newValue + m_MiniUFOsShotGlobal >= m_MiniUFOsShotAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_StillTrying:
            if (previousValue + m_BossesKilledGlobal < m_BossesKilledAchievement &&
                newValue + m_BossesKilledGlobal >= m_BossesKilledAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_TrueFriend:
            if (previousValue + m_BirdsShotGlobal < m_BirdsShotAchievement &&
                newValue + m_BirdsShotGlobal >= m_BirdsShotAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_WillSmith:
            if (previousValue + m_BossesKilledGlobal < 1 &&
                newValue + m_BossesKilledGlobal >= 1)
            {
                achievementUnlocked = true;
            }
            break;
        }

        return(achievementUnlocked);
    }
コード例 #36
0
 public AchievementTypeInfo (AchievementType achievementType)
 {
     AchievementType = achievementType;
 }
コード例 #37
0
    public bool IsAchievementUnlocked(AchievementType type)
    {
        bool achievementUnlocked = false;

        switch(type)
        {
        case AchievementType.e_DrunkDriver:
            if(m_CarsDestroyed + m_CarsDestroyedGlobal >= m_CarsDestroyedAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_FourthOfJuly:
            if(m_TrucksDestroyed + m_TrucksDestroyedGlobal >= m_TrucksDestroyedAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_LastProtector:
            if(m_MiniUFOsShot + m_MiniUFOsShotGlobal >= m_MiniUFOsShotAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_StillTrying:
            if(m_BossesKilled + m_BossesKilledGlobal >= m_BossesKilledAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_TrueFriend:
            if(m_BirdsShot + m_BirdsShotGlobal >= m_BirdsShotAchievement)
            {
                achievementUnlocked = true;
            }
            break;

        case AchievementType.e_WillSmith:
            if(m_BossesKilled + m_BossesKilledGlobal >= 1)
            {
                achievementUnlocked = true;
            }
            break;
        }

        return achievementUnlocked;
    }
コード例 #38
0
        internal Achievement(IDictionary<string, object> dict)
        {
            foreach (string key in dict.Keys) {
            object value;
            dict.TryGetValue (key, out value);
            if (value == null) {
              continue;
            }
            string valueString = value.ToString ();

            switch (key) {
            case "public_id":
              PublicId = valueString;
              break;
            case "name":
              Name = valueString;
              break;
            case "description":
              Description = valueString;
              break;
            case "type":
              switch (valueString) {
              case "incremental":
            Type = AchievementType.INCREMENTAL;
            break;
              case "normal":
            Type = AchievementType.NORMAL;
            break;
              }
              break;
            case "points":
              Points = (long)value;
              break;
            case "state":
              switch (valueString) {
              case "visible":
            State = AchievementState.VISIBLE;
            break;
              case "secret":
            State = AchievementState.SECRET;
            break;
              case "hidden":
            State = AchievementState.HIDDEN;
            break;
              }
              break;
            case "required_count":
              RequiredCount = (long)value;
              break;
            case "count":
              Count = (long)value;
              break;
            case "progress_at":
              ProgressAt = (long)value;
              break;
            case "completed_at":
              CompletedAt = (long)value;
              break;
            }
              }
        }
コード例 #39
0
 public PlayerAchievement(Player player, AchievementType achievementType)
 {
     Player = player;
     Type = achievementType;
 }
コード例 #40
0
 void UpdateAchievements(AchievementType type, long previousValue, long newValue)
 {
     if(IsAchievementJustUnlocked(type, previousValue, newValue))
     {
         m_AchievementsManager.ShowAchievement(type);
     }
 }
コード例 #41
0
        private void setAchiveTexts()
        {
            List<AchievementType> alist = new List<AchievementType>( this.orginalAchivements.achievementTypes);

            List<AchievementType> addlist = new List<AchievementType>();

            foreach (AchievementType at in alist)
            {
                AchievementType nat = new AchievementType();


                //add other stuff from orginal
                nat.goldReward = at.goldReward;
                nat.group = at.group;
                nat.icon = at.icon;
                nat.id = at.id;
                nat.partType = at.partType;
                nat.sortId = at.sortId;
                nat.name = at.name;
                nat.description = at.description;

                if (this.achivementlist.ContainsKey(at.id.ToString()))
                {
                    achivementding ad = this.achivementlist[at.id.ToString()];

                    if (ad.oname == at.name && ad.odescription == at.description)
                    {
                        //change name + desc!
                        nat.name = ad.name;
                        nat.description = ad.description;
                        Console.WriteLine("### " + nat.name + " " + nat.description);
                    }
                    
                }

                addlist.Add(nat);
            }
            
            AchievementTypeManager.getInstance().reset();
            AchievementTypeManager.getInstance().feed(addlist.ToArray());
        }