public BuildingModule(BuilderManager builderManager) { this.m_BuilderManager = builderManager; this.m_ResourceManager = new SelfResourceManager(this); this.m_ArmyCampManager = new ArmyCampManager(); this.m_ItemCampManager = new ItemCampManager(); this.m_ArmyFactoryManager = new ArmyFactoryManager(); this.m_ItemFactoryManager = new ItemFactoryManager(); this.m_CommunicationHelper = new BuildingObjectCommunicationHelper(); }
public BuildingLogicObject(BuildingData data, int functionMask, bool isNeedCommunicate) { this.m_CommunicationHelper = isNeedCommunicate ? new BuildingObjectCommunicationHelper() : null; this.m_Data = data; this.m_BuildingLogicData = new BuildingLogicData(data, this); if (data.AvailableArmy != null && (functionMask & ((int)BuildingFunction.StoreArmy)) != 0) { foreach (ArmyIdentity army in data.AvailableArmy) { this.m_AlreadyArmyCapacity += LogicController.Instance.GetArmyObjectData(army).CapacityCost; } } if (data.AvailableMercenary != null && (functionMask & ((int)BuildingFunction.StoreArmy)) != 0) { foreach (MercenaryIdentity mercenary in data.AvailableMercenary) { this.m_AlreadyArmyCapacity += LogicController.Instance.GetMercenaryData(mercenary).CapacityCost; } } if (data.ProduceArmy != null && (functionMask & ((int)BuildingFunction.ProduceArmy)) != 0) { foreach (KeyValuePair <ArmyType, List <ArmyIdentity> > product in data.ProduceArmy) { foreach (ArmyIdentity id in product.Value) { this.m_AlreadyProduceArmyCapacity += LogicController.Instance.GetArmyObjectData(id).CapacityCost; } } } if (data.AvailableItem != null && (functionMask & ((int)BuildingFunction.StoreItem)) != 0) { this.m_AlreadyItemCapacity = data.AvailableItem.Count; } if (data.ProduceItem != null && (functionMask & ((int)BuildingFunction.ProduceItem)) != 0) { foreach (KeyValuePair <ItemType, List <ItemIdentity> > product in data.ProduceItem) { this.m_AlreadyProduceArmyCapacity += product.Value.Count; } } if ((functionMask & ((int)BuildingFunction.Update)) != 0) { BuildingUpgradeLogicComponent upgradeComponent = new BuildingUpgradeLogicComponent(); this.InitialComponent(upgradeComponent); upgradeComponent.UpgradeTimeUp += this.BuildingUpgradeTimeUp; } this.AddComponentAccordingToConfigData(data.ConfigData, functionMask); if (data.RemainResourceAccelerateTime.HasValue && (functionMask & ((int)BuildingFunction.AccelerateResource)) != 0) { this.AddResourceAccelerateWithoutCommunication(); } if (data.RemainArmyAccelerateTime.HasValue && (functionMask & ((int)BuildingFunction.AccelerateArmy)) != 0) { this.AddArmyAccelerateWithoutCommunication(); } if (data.RemainItemAccelerateTime.HasValue && (functionMask & ((int)BuildingFunction.AccelerateItem)) != 0) { this.AddItemAccelerateWithoutCommunication(); } }