private Level determineLockLevel(ushort buildingID) { Level buildingLockLevel = Buildings.getLockLevel(buildingID); if (buildingLockLevel != Level.None) { return(buildingLockLevel); } else { Byte districtID = Buildings.getDistrictID(buildingID); int buildingType = Buildings.getBuildingType(buildingID); Level districtLockLevel = Districts.getLockLevels(districtID)[buildingType]; if (districtLockLevel != Level.None) { return(districtLockLevel); } else { return(Level.None); } } }
private void updateDistrictView() { Level[] districtLockLevels = Districts.getLockLevels(this.getSelectedDistrictID()); int index = 0; foreach (UIPanel progressPanel in this.districtProgressPanels) { this.updateProgressPanel(progressPanel, districtLockLevels[index], true); index++; } }
private void updateBuildingView(ushort buildingID, Level buildingLockLevel) { if (buildingLockLevel != Level.None) { this.updateProgressPanel(this.panelBuildingProgress, buildingLockLevel, false); } else { Byte districtID = Buildings.getDistrictID(buildingID); int buildingType = Buildings.getBuildingType(buildingID); Level districtLockLevel = Districts.getLockLevels(districtID)[buildingType]; if (districtLockLevel != Level.None) { this.updateProgressPanel(this.panelBuildingProgress, districtLockLevel, true); } else { this.updateProgressPanel(this.panelBuildingProgress, Level.None, false); } } }
private void DistrictProgressBarClick(UIComponent progressBar, UIMouseEventParameter eventParam) { ushort districtID = this.getSelectedDistrictID(); int districtType = this.getProgressBarType(progressBar.parent); UIComponent progressPanel = progressBar.parent; Level[] districtLockLevels = Districts.getLockLevels(districtID); Level progressBarLevel = this.getProgressBarLevel(progressBar); if (districtLockLevels[districtType] == Level.None) { Districts.add(districtID, progressBarLevel, districtType); this.updateProgressPanel(progressPanel, progressBarLevel, true); #if DEBUG Logger.Info("district lock level (" + districtType + " | " + districtID + "): " + progressBarLevel); #endif } else { if (districtLockLevels[districtType] == progressBarLevel) { Districts.update(districtID, Level.None, districtType); this.updateProgressPanel(progressPanel, Level.None, true); #if DEBUG Logger.Info("district lock level (" + districtType + " | " + districtID + "): " + Level.None); #endif } else { Districts.update(districtID, progressBarLevel, districtType); this.updateProgressPanel(progressPanel, progressBarLevel, true); #if DEBUG Logger.Info("district lock level (" + districtType + " | " + districtID + "): " + progressBarLevel); #endif } } }