Ejemplo n.º 1
0
        /// <summary>
        /// Converts an API dto objec to a business object
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public IBusinessObjectEntity ToBusinessFormat(IAPIEntity entity)
        {
            BuildableItemAPI api = entity as BuildableItemAPI;

            if (api.WorkItem != null)
            {
                return api.WorkItem;
            }

            if (api.ProductionItem != null)
            {
                return api.ProductionItem;
            }

            if (api.StorageItem != null)
            {
                return api.StorageItem;
            }

            if (api.ConsumableItem != null)
            {
                return api.ConsumableItem;
            }

            return null;
        }
        /// <summary>
        /// Converts an API dto objec to a business object
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public IBusinessObjectEntity ToBusinessFormat(IAPIEntity entity)
        {
            ExperienceLevelAPI other = entity as ExperienceLevelAPI;
            ExperienceLevel clone = new ExperienceLevel();

            clone.Level = other.Level;
            clone.ExperienceRequired = other.ExperienceRequired;

            return clone;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Converts an API dto objec to a business object
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public IBusinessObjectEntity ToBusinessFormat(IAPIEntity entity)
        {
            GamePlayer clone = new GamePlayer();
            GamePlayerAPI other = entity as GamePlayerAPI;

            clone.Coins = other.Coins;
            clone.Coupons = other.Coupons;
            clone.Experience = other.Experience;
            clone.Level = other.Level;
            clone.TutorialStage = other.TutorialStage;
            clone.StateChanged = other.StateChanged;
            clone.Locations = other.Locations;
            clone.WorkInProgress = other.WorkInProgress;

            return clone;
        }