Пример #1
0
    public BaseWorld(WorldInfo worldInfo, RelationshipMap relationshipMap, Vector3 firePlace)
    {
        _worldInfo = worldInfo;

        EntityMapping = new EntityMapping(relationshipMap);
        Entities      = new EntitiesController(EntityMapping);
        FreeCitizens  = new Queue <Actor>();
        Stockpile     = new Stockpile();
        Events        = new WorldEventsController();

        MaxPopulation   = _worldInfo.MaxPopulation;
        RelationshipMap = relationshipMap;
        MinPopulation   = _worldInfo.MinPopulation;
        FirePlace       = firePlace;

        TaxController = new PerCitizenResourceController(new[] { -2, -1, 0, 1, 2 }, new[] { 2, 1, 0, -1, -2 });

        // TODO: Flawed logic, food can be 1/8 at least. Might need to redesign food amounts and shieeet
        FoodController = new PerCitizenResourceController(new[] { 0, 1, 2, 3 }, new[] { -1, 0, 1, 2 });

        TaxController.SetValueIndex(2);
        FoodController.SetValueIndex(1);

        _popularityInternal = _worldInfo.MaxPopularity;
    }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel()
        {
            PalletItems.Add(new DiagramModel()
            {
                ImagePath = "/Demo.YuriOnIce.Relationship;component/ImagesResource/Yuri.png",
                Name      = "Yuri",
                Detail    = "He has a glass heart.",
                Index     = 1,
            });
            PalletItems.Add(new DiagramModel()
            {
                ImagePath = "/Demo.YuriOnIce.Relationship;component/ImagesResource/Victory.png",
                Name      = "Victory",
                Detail    = "He is Legend!!!",
                Index     = 2,
            });
            PalletItems.Add(new DiagramModel()
            {
                ImagePath = "/Demo.YuriOnIce.Relationship;component/ImagesResource/Yurio.png",
                Name      = "Yurio",
                Detail    = "He is Tigger(Cat?).",
                Index     = 3,
            });
            PalletItems.Add(new DiagramModel()
            {
                ImagePath = "/Demo.YuriOnIce.Relationship;component/ImagesResource/Maccachin.png",
                Name      = "Maccachin",
                Detail    = "Maccachin is dog.",
                Index     = 4,
            });

            _layoutRelationshipMap = new RelationshipMap();
        }
Пример #3
0
        private BaseWorld CreateWorld(RelationshipMap relationshipMap)
        {
            var world = new BaseWorld(_worldData.WorldInfo, relationshipMap,
                                      _worldData.Fireplace.position);

            //init unit factory
            _unitFactory.Initialize(world, _worldData);
            return(world);
        }
Пример #4
0
        private RelationshipMap CreateRelationshipMap()
        {
            var relationshipMap = new RelationshipMap();

            relationshipMap.SetRelationship(0, 1, RelationshipMap.RelationshipType.Hostile); // Players A and B
            relationshipMap.SetRelationship(0, 2, RelationshipMap.RelationshipType.Neutral); // Other players and nature
            relationshipMap.SetRelationship(1, 2, RelationshipMap.RelationshipType.Neutral);
            return(relationshipMap);
        }
Пример #5
0
    public void InitPanel(List <ActorData> actor, RelationshipMap map)
    {
        actors = actor;
        Rmap   = map;

        buttons = new List <RelationshipButton>();

        gameObject.SetActive(true);

        PopulateList();
    }
 public RelationshipTrackingInfo(ObjectTrackingInfo thisObjectTrackingInfo, RelationshipMap map, RelationshipTrackingInfoPair pair)
 {
     ObjectTrackingInfo       = thisObjectTrackingInfo;
     RelationshipMap          = map;
     RelationshipTrackingPair = pair;
 }
Пример #7
0
 public EntityMapping(RelationshipMap relationshipMap)
 {
     _relationshipMap = relationshipMap;
 }
 public async Task <RelationshipMap> Update(RelationshipMap entity)
 {
     return(await _repository.Update(entity));
 }
 public async Task <RelationshipMap> Add(RelationshipMap entity)
 {
     return(await _repository.Add(entity));
 }
Пример #10
0
 public EffectMapsDataContainer()
 {
     relationshipMap = new RelationshipMap();
 }
Пример #11
0
        protected static ContextMap SetupMaps(ContextBase thisItem)
        {
            if (ContextMaps == null)
            {
                ContextMaps = new ConcurrentDictionary <Type, ContextMap>();
            }

            ContextMap contextMap = new ContextMap();

            foreach (var prop in thisItem.GetType().GetProperties())
            {
                if (prop.PropertyType.Name == "KVSDbSet`1" || prop.PropertyType.Name == "ICollection`1")
                {
                    Type entityType = prop.PropertyType.GetGenericArguments().Last();

                    var entityProps = entityType.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance);
                    var keyProp     = entityProps.SingleOrDefault(q => q.Name == "Key" || q.Name == "Id");

                    var entityMap = new EntityMap(entityType, prop.GetGetMethod(), prop.GetSetMethod(), prop.PropertyType.GetConstructor(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic, null, new Type[] { typeof(EntityMap), typeof(ContextBase) }, new System.Reflection.ParameterModifier[] { }), keyProp.Name, keyProp.GetGetMethod());
                    contextMap.EntityMaps.Add(entityMap);
                }
            }

            foreach (var entityMap in contextMap.EntityMaps)
            {
                foreach (var prop in entityMap.EntityType.GetProperties())
                {
                    if (prop.PropertyType.Name == "KVSCollection`1" || prop.PropertyType.Name == "ICollection`1")
                    {
                        Type targetEntityType = prop.PropertyType.GetGenericArguments().Last();
                        var  targetEntityMap  = contextMap.EntityMaps.SingleOrDefault(q => q.EntityType == targetEntityType);

                        if (targetEntityMap != null)
                        {
                            var relationshipMap = new RelationshipMap()
                            {
                                LocalObjectMap  = entityMap,
                                TargetObjectMap = targetEntityMap,
                                PropertyName    = prop.Name,
                                IsManyToTarget  = true
                            };

                            contextMap.RelationshipMaps.Add(relationshipMap);
                            entityMap.RelationshipMaps.Add(relationshipMap);
                        }
                        //many relationship
                    }
                    else if (contextMap.EntityMaps.Any(q => q.EntityType == prop.PropertyType))
                    {
                        //foreign key ref (single relationship)

                        Type targetEntityType = prop.PropertyType;
                        var  targetEntityMap  = contextMap.EntityMaps.SingleOrDefault(q => q.EntityType == targetEntityType);

                        if (targetEntityMap != null)
                        {
                            var relationshipMap = new RelationshipMap()
                            {
                                LocalObjectMap = entityMap, TargetObjectMap = targetEntityMap, PropertyName = prop.Name
                            };
                            contextMap.RelationshipMaps.Add(relationshipMap);
                            entityMap.RelationshipMaps.Add(relationshipMap);
                        }
                    }
                }

                //find relationships
            }

            ContextMaps.TryAdd(thisItem.GetType(), contextMap);

            return(contextMap);
        }