示例#1
0
        private void updateBuildingView()
        {
            ushort buildingID        = this.getSelectedBuildingID();
            Level  buildingLockLevel = Buildings.getLockLevel(buildingID);

            this.updateBuildingView(buildingID, buildingLockLevel);
        }
示例#2
0
        private void BuildingProgressBarClick(UIComponent progressBar, UIMouseEventParameter eventParam)
        {
            ushort buildingID        = this.getSelectedBuildingID();
            Level  buildingLockLevel = Buildings.getLockLevel(buildingID);
            Level  progressBarLevel  = this.getProgressBarLevel(progressBar);

            if (buildingLockLevel == Level.None)
            {
                Buildings.add(buildingID, progressBarLevel);
                this.updateBuildingView(buildingID, progressBarLevel);
                #if DEBUG
                Logger.Info("building lock level (" + buildingID + "): " + progressBarLevel);
                #endif
            }
            else
            {
                if (buildingLockLevel == progressBarLevel)
                {
                    Buildings.remove(buildingID);
                    this.updateBuildingView(buildingID, Level.None);
                    #if DEBUG
                    Logger.Info("building lock level (" + buildingID + "): none");
                    #endif
                }
                else
                {
                    Buildings.update(buildingID, progressBarLevel);
                    this.updateBuildingView(buildingID, progressBarLevel);
                    #if DEBUG
                    Logger.Info("building lock level (" + buildingID + "): " + progressBarLevel);
                    #endif
                }
            }
        }
        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);
                }
            }
        }