コード例 #1
0
        public void HandleEarnedShardReward(string equipmentId, int count)
        {
            CurrentPlayer            currentPlayer = Service.CurrentPlayer;
            Dictionary <string, int> shards        = currentPlayer.Shards;
            EquipmentVO equipmentDataByID          = ArmoryUtils.GetEquipmentDataByID(equipmentId, 1);

            if (equipmentDataByID == null)
            {
                return;
            }
            int num = count;

            if (shards.ContainsKey(equipmentId))
            {
                num += shards[equipmentId];
            }
            currentPlayer.ModifyShardAmount(equipmentId, num);
            EquipmentVO nextEquipmentVOUpgrade = this.GetNextEquipmentVOUpgrade(equipmentId);

            if (nextEquipmentVOUpgrade != null && shards[equipmentId] - count < nextEquipmentVOUpgrade.UpgradeShards && nextEquipmentVOUpgrade.UpgradeShards < shards[equipmentId])
            {
                this.AllowShowEquipmentTabBadge = true;
                Service.EventManager.SendEvent(EventId.EquipmentNowUpgradable, equipmentId);
            }
            Service.EventManager.SendEvent(EventId.ShardsEarned, null);
            if (!ArmoryUtils.IsEquipmentOwned(currentPlayer, equipmentDataByID))
            {
                this.TryToUnlockPlayerEquipment(equipmentDataByID);
            }
        }