public void Clear() { level = null; levelManager = null; cameraInput = null; if (entityLoader != null) { ReferencePool.Release(entityLoader); } entityLoader = null; uiMaskFormSerialId = null; dataPlayer = null; dataTower = null; previewTowerData = null; previewTowerEntity = null; previewTowerEntityLogic = null; isBuilding = false; dicTowerInfo.Clear(); dicEntityEnemy.Clear(); }
public void ShowPreviewTower(TowerData towerData) { if (towerData == null) { return; } previewTowerData = towerData; uiMaskFormSerialId = GameEntry.UI.OpenUIForm(EnumUIForm.UIMask); entityLoader.ShowEntity <EntityTowerPreview>(towerData.PreviewEntityId, (entity) => { previewTowerEntity = entity; previewTowerEntityLogic = entity.Logic as EntityTowerPreview; if (previewTowerEntityLogic == null) { Log.Error("Entity '{0}' logic type invaild, need EntityTowerPreview", previewTowerEntity.Id); return; } TowerLevelData towerLevelData = towerData.GetTowerLevelData(0); if (towerLevelData == null) { Log.Error("Tower '{0}' Level '{1}' data is null.", towerData.Name, 0); } EntityDataRadiusVisualiser entityDataRadiusVisualiser = EntityDataRadiusVisualiser.Create(towerLevelData.Range); entityLoader.ShowEntity <EntityRadiusVisualizer>(EnumEntity.RadiusVisualiser, (entityRadiusVisualizer) => { GameEntry.Entity.AttachEntity(entityRadiusVisualizer, previewTowerEntity); }, entityDataRadiusVisualiser); isBuilding = true; }, EntityDataTowerPreview.Create(towerData)); }