Ejemplo n.º 1
0
 public void SetObservingDock(Dock d)
 {
     if (d == null)
     {
         SelfShutOff();
         return;
     }
     else
     {
         if (dockSystem == null)
         {
             dockSystem = DockSystem.GetCurrent();
         }
         observingDock = d; isObserving = true;
         UIWorkbuildingObserver uwb = WorkBuilding.workbuildingObserver;
         if (uwb == null)
         {
             uwb = UIWorkbuildingObserver.InitializeWorkbuildingObserverScript();
         }
         else
         {
             uwb.gameObject.SetActive(true);
         }
         uwb.SetObservingPlace(observingDock);
         if (tradingListPanel.activeSelf)
         {
             PrepareTradingPanel();
         }
         else
         {
             PrepareImmigrationPanel();
         }
         dockInfoLabel.text = observingDock.UI_GetInfo();
     }
 }
Ejemplo n.º 2
0
    public bool SaveGame(string name)
    { // заменить потом на persistent -  постоянный путь
        SetPause(true);

        string path = SaveSystemUI.GetSavesPath() + '/';

        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        FileStream fs = File.Create(path + name + '.' + SaveSystemUI.SAVE_FNAME_EXTENSION);

        savename = name;
        //сразу передавать файловый поток для записи, чтобы не забивать озу
        #region gms mainPartFilling
        fs.Write(System.BitConverter.GetBytes(GameConstants.SAVE_SYSTEM_VERSION), 0, 4);
        // start writing
        fs.Write(System.BitConverter.GetBytes(gameSpeed), 0, 4);
        fs.Write(System.BitConverter.GetBytes(lifeGrowCoefficient), 0, 4);
        fs.Write(System.BitConverter.GetBytes(demolitionLossesPercent), 0, 4);
        fs.Write(System.BitConverter.GetBytes(lifepowerLossesPercent), 0, 4);
        fs.Write(System.BitConverter.GetBytes(LUCK_COEFFICIENT), 0, 4);
        fs.Write(System.BitConverter.GetBytes(sellPriceCoefficient), 0, 4);
        fs.Write(System.BitConverter.GetBytes(tradeVesselsTrafficCoefficient), 0, 4);
        fs.Write(System.BitConverter.GetBytes(upgradeDiscount), 0, 4);
        fs.Write(System.BitConverter.GetBytes(upgradeCostIncrease), 0, 4);
        fs.Write(System.BitConverter.GetBytes(warProximity), 0, 4);
        //40
        fs.WriteByte((byte)difficulty);    // 41
        fs.WriteByte((byte)startGameWith); // 42
        fs.WriteByte(prevCutHeight);       //43
        fs.WriteByte(day);                 // 44
        fs.WriteByte(month);               //45
        fs.Write(System.BitConverter.GetBytes(year), 0, 4);
        fs.Write(System.BitConverter.GetBytes(timeGone), 0, 4);
        fs.Write(System.BitConverter.GetBytes(gearsDegradeSpeed), 0, 4);
        fs.Write(System.BitConverter.GetBytes(labourTimer), 0, 4);
        fs.Write(System.BitConverter.GetBytes(RecruitingCenter.GetHireCost()), 0, 4);
        //65 (+4) end
        #endregion

        DockSystem.SaveDockSystem(fs);
        globalMap.Save(fs);
        environmentMaster.Save(fs);
        Artifact.SaveStaticData(fs);
        Crew.SaveStaticData(fs);
        mainChunk.SaveChunkData(fs);
        colonyController.Save(fs); // <------- COLONY CONTROLLER

        QuestUI.current.Save(fs);
        Expedition.SaveStaticData(fs);
        Knowledge.GetCurrent().Save(fs);
        fs.Position = 0;
        double hashsum = GetHashSum(fs, false);
        fs.Write(System.BitConverter.GetBytes(hashsum), 0, 8);
        fs.Close();
        SetPause(false);
        return(true);
    }
Ejemplo n.º 3
0
 public static DockSystem GetCurrent()
 {
     if (current == null)
     {
         current = new DockSystem();
     }
     return(current);
 }
Ejemplo n.º 4
0
 override public void Prepare()
 {
     PrepareWorkbuilding();
     if (dockSystem == null)
     {
         dockSystem = DockSystem.GetCurrent();
     }
 }
Ejemplo n.º 5
0
    private void FinishShipService(Ship s)
    {
        DockSystem.GetCurrent().HandleShip(this, s, colony);
        servicingShip   = null;
        maintainingShip = false;
        s.Undock();

        shipArrivingTimer = shipArrivingTime;
    }
Ejemplo n.º 6
0
 private static void ResetComponentsStaticValues()
 {
     if (staticResetFunctions != null)
     {
         staticResetFunctions.Invoke();
         staticResetFunctions = null;
     }
     DockSystem.ResetRequest();
     Crew.Reset();
     Expedition.GameReset();
 }
Ejemplo n.º 7
0
 new private void OnEnable()
 {
     if (dockSystem == null)
     {
         dockSystem = DockSystem.GetCurrent();
     }
     transform.SetAsLastSibling();
     UpdateResourceButtons();
     UIController.current.ChangeActiveWindow(ActiveWindowMode.TradePanel);
     if (!subscribedToUpdate)
     {
         UIController.current.statusUpdateEvent += StatusUpdate;
         subscribedToUpdate = true;
     }
 }
Ejemplo n.º 8
0
    public static void LoadDockSystem(System.IO.Stream fs, int saveVersion)
    {
        current = null;
        int x = fs.ReadByte();

        if (x == 0)
        {
            return;
        }
        else
        {
            current = new DockSystem();
            current.Load(fs);
        }
    }
Ejemplo n.º 9
0
    public void ShipLoading(Ship s)
    {
        if (loadingShip == null)
        {
            loadingTimer = LOADING_TIME;
            loadingShip  = s;
            if (announceNewShips)
            {
                GameLogUI.MakeAnnouncement(Localization.GetAnnouncementString(GameAnnouncements.ShipArrived));
            }
            return;
        }
        availableVolume = workersCount * WORK_PER_WORKER;
        DockSystem.GetCurrent().HandleShip(this, s, colony);
        loadingShip     = null;
        maintainingShip = false;
        s.Undock();

        shipArrivingTimer = GameConstants.GetShipArrivingTimer();
    }
Ejemplo n.º 10
0
 public void SetObservingDock(Dock d)
 {
     if (d == null)
     {
         SelfShutOff();
         return;
     }
     else
     {
         if (dockSystem == null)
         {
             dockSystem = DockSystem.GetCurrent();
         }
         observingDock = d; isObserving = true;
         UIWorkbuildingObserver uwb = WorkBuilding.workbuildingObserver;
         if (uwb == null)
         {
             uwb = UIWorkbuildingObserver.InitializeWorkbuildingObserverScript();
         }
         else
         {
             uwb.gameObject.SetActive(true);
         }
         uwb.SetObservingWorkBuilding(observingDock);
         if (tradingListPanel.activeSelf)
         {
             PrepareTradingPanel();
         }
         else
         {
             PrepareImmigrationPanel();
         }
         if (observingDock.correctLocation)
         {
             nextShipTimer.text = observingDock.shipArrivingTimer.ToString();
         }
     }
 }
Ejemplo n.º 11
0
    public bool LoadGame(string fullname)
    {
        bool   debug_noresource = weNeedNoResources, refreshUI = false;
        Stream fs = File.Open(fullname, FileMode.Open);
        double realHashSum = GetHashSum(fs, true);
        var    data        = new byte[8];

        fs.Read(data, 0, 8);
        double readedHashSum = System.BitConverter.ToDouble(data, 0);
        string errorReason   = "reason not stated";

        if (realHashSum == readedHashSum)
        {
            fs.Position = 0;
            SetPause(true);
            loading = true;


            // НАЧАЛО ЗАГРУЗКИ
            #region gms mainPartLoading
            data = new byte[5];
            fs.Read(data, 0, data.Length);
            int saveSystemVersion = System.BitConverter.ToInt32(data, 0); // может пригодиться в дальнейшем
            gameMode = (GameMode)data[4];
            //
            if (sessionPrepared)
            {
                ClearPreviousSessionData();
                refreshUI = true;
            }
            else
            {
                PrepareSession();
            }
            //start reading
            data = new byte[68];
            fs.Read(data, 0, data.Length);
            gameSpeed                      = System.BitConverter.ToSingle(data, 0);
            lifeGrowCoefficient            = System.BitConverter.ToSingle(data, 4);
            demolitionLossesPercent        = System.BitConverter.ToSingle(data, 8);
            lifepowerLossesPercent         = System.BitConverter.ToSingle(data, 12);
            LUCK_COEFFICIENT               = System.BitConverter.ToSingle(data, 16);
            sellPriceCoefficient           = System.BitConverter.ToSingle(data, 20);
            tradeVesselsTrafficCoefficient = System.BitConverter.ToSingle(data, 24);
            upgradeDiscount                = System.BitConverter.ToSingle(data, 28);
            upgradeCostIncrease            = System.BitConverter.ToSingle(data, 32);
            warProximity                   = System.BitConverter.ToSingle(data, 36);

            difficulty = (Difficulty)data[40];
            int i = 41;
            prevCutHeight = data[i++];
            day           = data[i++];
            month         = data[i++];

            year              = System.BitConverter.ToUInt32(data, i); i += 4;
            timeGone          = System.BitConverter.ToSingle(data, i); i += 4;
            gearsDegradeSpeed = System.BitConverter.ToSingle(data, i); i += 4;
            labourTimer       = System.BitConverter.ToSingle(data, i); i += 4;
            RecruitingCenter.SetHireCost(System.BitConverter.ToSingle(data, i)); i += 4;
            gameID = System.BitConverter.ToInt32(data, i); i += 4;
            #endregion

            DockSystem.LoadDockSystem(fs, saveSystemVersion);
            var b = fs.ReadByte();
            if (b == 1)
            {
                globalMap.Load(fs, saveSystemVersion);
            }
            if (loadingFailed)
            {
                errorReason = "global map error";
                goto FAIL;
            }

            environmentMaster.Load(fs);
            if (loadingFailed)
            {
                errorReason = "environment error";
                goto FAIL;
            }

            Artifact.LoadStaticData(fs); // crews & monuments
            if (loadingFailed)
            {
                errorReason = "artifacts load failure";
                goto FAIL;
            }

            Crew.LoadStaticData(fs);
            if (loadingFailed)
            {
                errorReason = "crews load failure";
                goto FAIL;
            }
            //
            if (colonyController == null)
            {
                PrepareColonyController(false);
            }
            //
            if (mainChunk == null)
            {
                mainChunk = Chunk.InitializeChunk();
            }
            mainChunk.LoadChunkData(fs);
            if (loadingFailed)
            {
                errorReason = "chunk load failure";
                goto FAIL;
            }
            else
            {
                if (blockersRestoreEvent != null)
                {
                    blockersRestoreEvent();
                }
            }

            Settlement.TotalRecalculation(); // Totaru Annihiration no imoto-chan
            if (loadingFailed)
            {
                errorReason = "settlements load failure";
                goto FAIL;
            }

            colonyController.Load(fs); // < --- COLONY CONTROLLER
            if (loadingFailed)
            {
                errorReason = "colony controller load failure";
                goto FAIL;
            }

            if (loadingFailed)
            {
                errorReason = "dock load failure";
                goto FAIL;
            }
            QuestUI.current.Load(fs);
            if (loadingFailed)
            {
                errorReason = "quest load failure";
                goto FAIL;
            }
            Expedition.LoadStaticData(fs);
            Knowledge.Load(fs);
            b = fs.ReadByte();
            if (b == 1)
            {
                executingScenario = Scenario.StaticLoad(fs);
            }
            FollowingCamera.main.Load(fs);
            fs.Close();

            FollowingCamera.main.WeNeedUpdate();
            loading         = false;
            currentSavename = fullname;

            //Debug.Log("recalculation event");
            if (afterloadRecalculationEvent != null)
            {
                afterloadRecalculationEvent();
                afterloadRecalculationEvent = null;
            }
            SetPause(false);
            //Debug.Log("power grid");
            colonyController.FORCED_PowerGridRecalculation();
            //Debug.Log("docks");
            colonyController.SYSTEM_DocksRecalculation();
            //Debug.Log("end");

            if (refreshUI)
            {
                UIController.GetCurrent().GameWasReloaded();
            }

            DEBUG_STOP = true;
            return(true);
        }
        else
        {
            AnnouncementCanvasController.MakeImportantAnnounce(Localization.GetAnnouncementString(GameAnnouncements.LoadingFailed) + " : hashsum incorrect");
            if (soundEnabled)
            {
                audiomaster.Notify(NotificationSound.SystemError);
            }
            SetPause(true);
            fs.Close();
            return(false);
        }
FAIL:
        AnnouncementCanvasController.MakeImportantAnnounce(Localization.GetAnnouncementString(GameAnnouncements.LoadingFailed) + " : data corruption");
        if (soundEnabled)
        {
            audiomaster.Notify(NotificationSound.SystemError);
        }
        Debug.Log(errorReason);
        SetPause(true);
        fs.Close();
        if (debug_noresource)
        {
            weNeedNoResources = true;
        }
        return(false);
    }
Ejemplo n.º 12
0
    private void SetDefaultValues()
    {
        Time.timeScale = 1;
        gameSpeed      = 1;
        pauseRequests  = 0;
        if (currentSavename == null || currentSavename == string.Empty)
        {
            currentSavename = "autosave";
        }
        if (gameMode != GameMode.Editor)
        {
            lifeGrowCoefficient = 1;
            switch (difficulty)
            {
            case Difficulty.Utopia:
                LUCK_COEFFICIENT               = 1;
                demolitionLossesPercent        = 0;
                lifepowerLossesPercent         = 0;
                sellPriceCoefficient           = 1;
                tradeVesselsTrafficCoefficient = 2;
                upgradeDiscount   = 0.5f; upgradeCostIncrease = 1.1f;
                gearsDegradeSpeed = 0;
                break;

            case Difficulty.Easy:
                LUCK_COEFFICIENT               = 0.7f;
                demolitionLossesPercent        = 0.2f;
                lifepowerLossesPercent         = 0.1f;
                sellPriceCoefficient           = 0.9f;
                tradeVesselsTrafficCoefficient = 1.5f;
                upgradeDiscount   = 0.3f; upgradeCostIncrease = 1.3f;
                gearsDegradeSpeed = 0.00001f;
                break;

            case Difficulty.Normal:
                LUCK_COEFFICIENT               = 0.5f;
                demolitionLossesPercent        = 0.4f;
                lifepowerLossesPercent         = 0.3f;
                sellPriceCoefficient           = 0.75f;
                tradeVesselsTrafficCoefficient = 1;
                upgradeDiscount   = 0.25f; upgradeCostIncrease = 1.5f;
                gearsDegradeSpeed = 0.00002f;
                break;

            case Difficulty.Hard:
                LUCK_COEFFICIENT               = 0.1f;
                demolitionLossesPercent        = 0.7f;
                lifepowerLossesPercent         = 0.5f;
                sellPriceCoefficient           = 0.5f;
                tradeVesselsTrafficCoefficient = 0.9f;
                upgradeDiscount   = 0.2f; upgradeCostIncrease = 1.7f;
                gearsDegradeSpeed = 0.00003f;
                break;

            case Difficulty.Torture:
                LUCK_COEFFICIENT               = 0.01f;
                demolitionLossesPercent        = 1;
                lifepowerLossesPercent         = 0.85f;
                sellPriceCoefficient           = 0.33f;
                tradeVesselsTrafficCoefficient = 0.75f;
                upgradeDiscount   = 0.1f; upgradeCostIncrease = 2f;
                gearsDegradeSpeed = 0.00005f;
                break;
            }
            RenderSettings.skybox.SetFloat("_Saturation", 0.75f + 0.25f * GameConstants.START_HAPPINESS);
        }
        else
        {
            RenderSettings.skybox.SetFloat("_Saturation", 1f);
        }
        DockSystem.ResetRequest();
    }
Ejemplo n.º 13
0
    public bool LoadGame(string fullname)
    {
        bool       debug_noresource = weNeedNoResources;
        FileStream fs          = File.Open(fullname, FileMode.Open);
        double     realHashSum = GetHashSum(fs, true);
        var        data        = new byte[8];

        fs.Read(data, 0, 8);
        double readedHashSum = System.BitConverter.ToDouble(data, 0);
        string errorReason   = "reason not stated";

        if (realHashSum == readedHashSum)
        {
            fs.Position = 0;
            SetPause(true);
            loading = true;
            // ОЧИСТКА
            StopAllCoroutines();
            if (Zeppelin.current != null)
            {
                Destroy(Zeppelin.current);
            }
            if (mainChunk != null)
            {
                mainChunk.ClearChunk();
            }
            // очистка подписчиков на ивенты невозможна, сами ивенты к этому моменту недоступны
            Crew.Reset();
            Expedition.GameReset();
            Structure.ResetToDefaults_Static(); // все наследуемые resetToDefaults внутри
            if (colonyController != null)
            {
                colonyController.ResetToDefaults();                           // подчищает все списки
            }
            else
            {
                colonyController = gameObject.AddComponent <ColonyController>();
                colonyController.Prepare();
            }
            //UI.current.Reset();


            // НАЧАЛО ЗАГРУЗКИ
            if (gameStarted)
            {
                SetDefaultValues();
            }
            #region gms mainPartLoading
            data = new byte[4];
            fs.Read(data, 0, 4);
            uint saveSystemVersion = System.BitConverter.ToUInt32(data, 0); // может пригодиться в дальнейшем
            //start writing
            data = new byte[65];
            fs.Read(data, 0, data.Length);
            gameSpeed                      = System.BitConverter.ToSingle(data, 0);
            lifeGrowCoefficient            = System.BitConverter.ToSingle(data, 4);
            demolitionLossesPercent        = System.BitConverter.ToSingle(data, 8);
            lifepowerLossesPercent         = System.BitConverter.ToSingle(data, 12);
            LUCK_COEFFICIENT               = System.BitConverter.ToSingle(data, 16);
            sellPriceCoefficient           = System.BitConverter.ToSingle(data, 20);
            tradeVesselsTrafficCoefficient = System.BitConverter.ToSingle(data, 24);
            upgradeDiscount                = System.BitConverter.ToSingle(data, 28);
            upgradeCostIncrease            = System.BitConverter.ToSingle(data, 32);
            warProximity                   = System.BitConverter.ToSingle(data, 36);

            difficulty    = (Difficulty)data[40];
            startGameWith = (GameStart)data[41];
            prevCutHeight = data[42];
            day           = data[43];
            month         = data[44];

            year              = System.BitConverter.ToUInt32(data, 45);
            timeGone          = System.BitConverter.ToSingle(data, 49);
            gearsDegradeSpeed = System.BitConverter.ToSingle(data, 53);
            labourTimer       = System.BitConverter.ToSingle(data, 57);
            RecruitingCenter.SetHireCost(System.BitConverter.ToSingle(data, 61));
            #endregion

            DockSystem.LoadDockSystem(fs);
            globalMap.Load(fs);
            if (loadingFailed)
            {
                errorReason = "global map error";
                goto FAIL;
            }

            environmentMaster.Load(fs);
            if (loadingFailed)
            {
                errorReason = "environment error";
                goto FAIL;
            }

            Artifact.LoadStaticData(fs); // crews & monuments
            if (loadingFailed)
            {
                errorReason = "artifacts load failure";
                goto FAIL;
            }

            Crew.LoadStaticData(fs);
            if (loadingFailed)
            {
                errorReason = "crews load failure";
                goto FAIL;
            }

            if (mainChunk == null)
            {
                GameObject g = new GameObject("chunk");
                mainChunk = g.AddComponent <Chunk>();
            }
            mainChunk.LoadChunkData(fs);
            if (loadingFailed)
            {
                errorReason = "chunk load failure";
                goto FAIL;
            }
            else
            {
                if (blockersRestoreEvent != null)
                {
                    blockersRestoreEvent();
                }
            }


            Settlement.TotalRecalculation(); // Totaru Annihirationu no imoto-chan
            if (loadingFailed)
            {
                errorReason = "settlements load failure";
                goto FAIL;
            }

            colonyController.Load(fs); // < --- COLONY CONTROLLER
            if (loadingFailed)
            {
                errorReason = "colony controller load failure";
                goto FAIL;
            }

            if (loadingFailed)
            {
                errorReason = "dock load failure";
                goto FAIL;
            }
            QuestUI.current.Load(fs);
            if (loadingFailed)
            {
                errorReason = "quest load failure";
                goto FAIL;
            }
            Expedition.LoadStaticData(fs);
            Knowledge.Load(fs);
            fs.Close();

            FollowingCamera.main.WeNeedUpdate();
            loading  = false;
            savename = fullname;

            if (afterloadRecalculationEvent != null)
            {
                afterloadRecalculationEvent();
                afterloadRecalculationEvent = null;
            }
            SetPause(false);
            colonyController.FORCED_PowerGridRecalculation();

            return(true);
        }
        else
        {
            GameLogUI.MakeImportantAnnounce(Localization.GetAnnouncementString(GameAnnouncements.LoadingFailed) + " : hashsum incorrect");
            if (soundEnabled)
            {
                audiomaster.Notify(NotificationSound.SystemError);
            }
            SetPause(true);
            fs.Close();
            return(false);
        }
FAIL:
        GameLogUI.MakeImportantAnnounce(Localization.GetAnnouncementString(GameAnnouncements.LoadingFailed) + " : data corruption");
        if (soundEnabled)
        {
            audiomaster.Notify(NotificationSound.SystemError);
        }
        print(errorReason);
        SetPause(true);
        fs.Close();
        if (debug_noresource)
        {
            weNeedNoResources = true;
        }
        return(false);
    }
Ejemplo n.º 14
0
    public void CheckQuestConditions()
    {
        ColonyController colony = GameMaster.realMaster.colonyController;

        switch (type)
        {
        case QuestType.Progress:
            switch ((ProgressQuestID)subIndex)
            {
            case ProgressQuestID.Progress_HousesToMax:
            {
                float hl  = colony.housingLevel;
                byte  hql = colony.hq.level;
                if (hql > ColonyController.MAX_HOUSING_LEVEL)
                {
                    hql = ColonyController.MAX_HOUSING_LEVEL;
                }
                stepsAddInfo[0] = string.Format("{0:0.##}", hl) + '/' + hql.ToString();
                if (hl >= hql)
                {
                    MakeQuestCompleted();
                }
            }
            break;

            case ProgressQuestID.Progress_2Docks:
                stepsAddInfo[0] = colony.docks.Count.ToString() + "/2";
                if (colony.docks.Count >= 2)
                {
                    MakeQuestCompleted();
                }
                break;

            case ProgressQuestID.Progress_2Storages:
                stepsAddInfo[0] = (colony.storage.warehouses.Count - 1).ToString() + "/2";
                if (colony.storage.warehouses.Count >= 3)
                {
                    MakeQuestCompleted();
                }
                break;

            case ProgressQuestID.Progress_Tier2:
                if (colony.hq.level >= 2)
                {
                    MakeQuestCompleted();
                }
                break;

            case ProgressQuestID.Progress_300Population:
                stepsAddInfo[0] = colony.citizenCount.ToString() + "/300";
                if (colony.citizenCount >= 300)
                {
                    MakeQuestCompleted();
                }
                break;

            case ProgressQuestID.Progress_OreRefiner:
            {
                List <Building> powerGrid = colony.powerGrid;
                foreach (Building b in powerGrid)
                {
                    if (b == null)
                    {
                        continue;
                    }
                    else
                    {
                        if (b.ID == Structure.ORE_ENRICHER_2_ID)
                        {
                            MakeQuestCompleted();
                            break;
                        }
                    }
                }
            }
            break;

            case ProgressQuestID.Progress_HospitalCoverage:
                stepsAddInfo[0] = string.Format("{0:0.###}", colony.hospitals_coefficient) + " / 1";
                if (colony.hospitals_coefficient >= 1)
                {
                    MakeQuestCompleted();
                }
                break;

            case ProgressQuestID.Progress_Tier3:
                if (colony.hq.level >= 3)
                {
                    MakeQuestCompleted();
                }
                break;

            case ProgressQuestID.Progress_4MiniReactors:
            {
                List <Building> powerGrid = colony.powerGrid;
                byte            mrc       = 0;
                foreach (Building b in powerGrid)
                {
                    if (b == null)
                    {
                        continue;
                    }
                    else
                    {
                        if (b.ID == Structure.MINI_GRPH_REACTOR_3_ID)
                        {
                            mrc++;
                        }
                    }
                }
                stepsAddInfo[0] = mrc.ToString() + "/4";
                if (mrc >= 4)
                {
                    MakeQuestCompleted();
                }
            }
            break;

            case ProgressQuestID.Progress_100Fuel:
            {
                int f = (int)colony.storage.standartResources[ResourceType.FUEL_ID];
                stepsAddInfo[0] = f.ToString() + "/100";
                if (f >= 100)
                {
                    MakeQuestCompleted();
                }
            }
            break;

            case ProgressQuestID.Progress_XStation:
                if (XStation.current != null)
                {
                    MakeQuestCompleted();
                }
                break;

            case ProgressQuestID.Progress_Tier4:
                if (colony.hq.level >= 4)
                {
                    MakeQuestCompleted();
                }
                break;

            case ProgressQuestID.Progress_CoveredFarm:
            {
                List <Building> powerGrid = colony.powerGrid;
                foreach (Building b in powerGrid)
                {
                    if (b == null)
                    {
                        continue;
                    }
                    else
                    {
                        if (b.ID == Structure.COVERED_FARM | b.ID == Structure.FARM_BLOCK_ID)
                        {
                            MakeQuestCompleted();
                            break;
                        }
                    }
                }
            }
            break;

            case ProgressQuestID.Progress_CoveredLumbermill:
            {
                List <Building> powerGrid = colony.powerGrid;
                foreach (Building b in powerGrid)
                {
                    if (b == null)
                    {
                        continue;
                    }
                    else
                    {
                        if (b.ID == Structure.COVERED_LUMBERMILL | b.ID == Structure.LUMBERMILL_BLOCK_ID)
                        {
                            MakeQuestCompleted();
                            break;
                        }
                    }
                }
            }
            break;

            case ProgressQuestID.Progress_Reactor:
            {
                List <Building> powerGrid = colony.powerGrid;
                foreach (Building b in powerGrid)
                {
                    if (b == null)
                    {
                        continue;
                    }
                    else
                    {
                        if (b.ID == Structure.GRPH_REACTOR_4_ID)
                        {
                            MakeQuestCompleted();
                            break;
                        }
                    }
                }
            }
            break;

            case ProgressQuestID.Progress_FirstExpedition:
            {
                byte completeness = 0;
                int  count        = Crew.crewsList.Count;
                if (count > 0)
                {
                    completeness++;
                    stepsFinished[0] = true;
                    stepsAddInfo[0]  = count.ToString() + "/1";
                }
                else
                {
                    stepsFinished[0] = false;
                    stepsAddInfo[0]  = "0/1";
                }
                // shuttles
                count = Hangar.GetTotalShuttlesCount();
                if (count > 0)
                {
                    completeness++;
                    stepsFinished[1] = true;
                    stepsAddInfo[1]  = count.ToString() + "/1";
                }
                else
                {
                    stepsFinished[1] = false;
                    stepsAddInfo[1]  = "0/1";
                }
                //observatory
                if (Observatory.alreadyBuilt)
                {
                    completeness++;
                    stepsFinished[2] = true;
                }
                else
                {
                    stepsFinished[2] = false;
                }
                //transmitter\
                count = QuantumTransmitter.transmittersList.Count;
                if (count > 0)
                {
                    completeness++;
                    stepsFinished[3] = true;
                    stepsAddInfo[1]  = count.ToString() + "/1";
                }
                else
                {
                    stepsFinished[3] = false;
                    stepsAddInfo[1]  = "0/1";
                }
                // expeditions
                if (Expedition.expeditionsLaunched > 0)
                {
                    completeness++;
                    stepsFinished[4] = true;
                    stepsAddInfo[4]  = Expedition.expeditionsLaunched.ToString() + "/1";
                }
                else
                {
                    stepsFinished[4] = false;
                    stepsAddInfo[4]  = "0/1";
                }
                // expeditions completed
                if (Expedition.expeditionsSucceed >= 1)
                {
                    completeness++;
                    stepsAddInfo[5]  = Expedition.expeditionsSucceed.ToString() + "/1";
                    stepsFinished[5] = true;
                }
                else
                {
                    stepsAddInfo[5]  = "0/1";
                    stepsFinished[5] = false;
                }
                if (completeness == 6)
                {
                    MakeQuestCompleted();
                }
            }
            break;

            case ProgressQuestID.Progress_Tier5:
                if (colony.hq.level >= 5)
                {
                    MakeQuestCompleted();
                }
                break;

            case ProgressQuestID.Progress_FactoryComplex:
            {
                List <Building> powerGrid = colony.powerGrid;
                List <ChunkPos> blocksPositions = new List <ChunkPos>(), factoriesPositions = new List <ChunkPos>();
                foreach (Building b in powerGrid)
                {
                    if (b == null)
                    {
                        continue;
                    }
                    else
                    {
                        if (b.ID == Structure.SMELTERY_BLOCK_ID)
                        {
                            blocksPositions.Add(b.GetBlockPosition());
                        }
                        else
                        {
                            if (b.ID == Structure.SMELTERY_3_ID | b.ID == Structure.SMELTERY_2_ID | b.ID == Structure.SMELTERY_1_ID)
                            {
                                factoriesPositions.Add(b.GetBlockPosition());
                            }
                        }
                    }
                }
                if (blocksPositions.Count != 0 & factoriesPositions.Count != 0)
                {
                    bool founded = false;
                    foreach (ChunkPos cpos in blocksPositions)
                    {
                        foreach (ChunkPos uppos in factoriesPositions)
                        {
                            if (uppos.x == cpos.x && uppos.y == cpos.y + 1 && uppos.z == cpos.z + 1)
                            {
                                MakeQuestCompleted();
                                founded = true;
                                break;
                            }
                            if (founded)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            break;

            case ProgressQuestID.Progress_SecondFloor:
            {
                /*
                 * List<ChunkPos> checkForBuildings = new List<ChunkPos>();
                 * var slist = GameMaster.realMaster.mainChunk.GetSurfacesList();
                 * foreach (Plane sb in slist)
                 * {
                 *  if (sb == null || sb.noEmptySpace == false) continue;
                 *  {
                 *      foreach (Structure s in sb.structures)
                 *      {
                 *          if (!s.isBasement) continue;
                 *          if (s.ID == Structure.COLUMN_ID)
                 *          {
                 *              if (sb.pos.y < Chunk.CHUNK_SIZE) checkForBuildings.Add(new ChunkPos(sb.pos.x, sb.pos.y + 1, sb.pos.z));
                 *          }
                 *      }
                 *  }
                 * }
                 * if (checkForBuildings.Count > 0)
                 * {
                 *  Chunk ch = GameMaster.realMaster.mainChunk;
                 *  foreach (ChunkPos cpos in checkForBuildings)
                 *  {
                 *      Block b = ch.GetBlock(cpos);
                 *      if (b == null) continue;
                 *      else
                 *      {
                 *          Plane sb = b as Plane;
                 *          if (sb == null) continue;
                 *          else
                 *          {
                 *              if (sb.noEmptySpace != false & sb.artificialStructures > 0)
                 *              {
                 *                  MakeQuestCompleted();
                 *                  break;
                 *              }
                 *          }
                 *      }
                 *  }
                 *  stepsFinished[0] = true;
                 * }
                 * else stepsFinished[0] = false;
                 */
            }
            break;

            case ProgressQuestID.Progress_FoodStocks:
            {
                var f   = colony.storage.standartResources[ResourceType.FOOD_ID];
                var fmc = colony.foodMonthConsumption;
                stepsAddInfo[0] = ((int)f).ToString() + '/' + ((int)fmc).ToString();
                if (f >= fmc)
                {
                    MakeQuestCompleted();
                }
                break;
            }
            }
            break;

        case QuestType.Endgame:
            switch ((EndgameQuestID)subIndex)
            {
            case EndgameQuestID.Endgame_TransportHub_step1:
            {
                byte conditionsMet = 0;

                int docksNeeded = 4;
                int docksCount  = colony.docks.Count;
                if (docksCount >= docksNeeded)
                {
                    stepsFinished[0] = true;
                    conditionsMet++;
                }
                else
                {
                    stepsFinished[0] = false;
                }
                stepsAddInfo[0] = docksCount.ToString() + " / " + docksNeeded.ToString();

                if (colony.docksLevel >= 3)
                {
                    stepsFinished[1] = true;
                    conditionsMet++;
                }
                else
                {
                    stepsFinished[1] = false;
                }

                int storagesNeeded = 2;
                int storagesCount  = 0;
                foreach (StorageHouse sh in colony.storage.warehouses)
                {
                    if (sh.level == 5)
                    {
                        storagesCount++;
                    }
                }
                if (storagesCount >= storagesNeeded)
                {
                    stepsFinished[2] = true;
                    conditionsMet++;
                }
                else
                {
                    stepsFinished[2] = false;
                }
                stepsAddInfo[2] = storagesCount.ToString() + " / " + storagesNeeded.ToString();

                if (conditionsMet == 3)
                {
                    MakeQuestCompleted();
                }
            }
            break;

            case EndgameQuestID.Endgame_TransportHub_step2:
            {
                byte conditionsMet = 0;
                //if (ControlCenter.current != null)
                {
                    stepsFinished[0] = true;
                    conditionsMet++;
                }
                // else stepsFinished[0] = false;

                if (ConnectTower.current != null)
                {
                    stepsFinished[1] = true;
                    conditionsMet++;
                }
                else
                {
                    stepsFinished[1] = false;
                }
                if (conditionsMet == 2)
                {
                    MakeQuestCompleted();
                }
                break;
            }

            case EndgameQuestID.Endgame_TransportHub_step3:
            {
                byte conditionsMet = 0;
                foreach (Building b in colony.powerGrid)
                {
                    if (b.ID == Structure.REACTOR_BLOCK_5_ID)
                    {
                        stepsFinished[0] = true;
                        conditionsMet++;
                        break;
                    }
                }
                if (conditionsMet == 0)
                {
                    stepsFinished[0] = false;
                }

                byte housingMastsNeeded = 5, housingMastsCount = 0;
                bool hotelFound = false;
                foreach (Building b in colony.houses)
                {
                    if (b.ID == Structure.HOUSING_MAST_6_ID)
                    {
                        housingMastsCount++;                                                  // можно запихнуть и в проверку выше
                    }
                    else
                    {
                        if (b.ID == Structure.HOTEL_BLOCK_6_ID)
                        {
                            hotelFound = true;
                        }
                    }
                }
                if (housingMastsCount >= housingMastsNeeded)
                {
                    stepsFinished[1] = true;
                    conditionsMet++;
                }
                else
                {
                    stepsFinished[1] = false;
                }
                stepsAddInfo[1]  = housingMastsCount.ToString() + " / " + housingMastsNeeded.ToString();
                stepsFinished[2] = hotelFound;
                if (conditionsMet == 2 & hotelFound)
                {
                    MakeQuestCompleted();
                    GameMaster.realMaster.GameOver(GameEndingType.FoundationRoute);
                }
            }
            break;

            case EndgameQuestID.FoundationEnd:
            {
                int a = colony.citizenCount, b = Knowledge.R_F_QUEST_POPULATION_COND;
                steps[0] = "Текущее население: " + a.ToString() + " / " + b.ToString();
                if (a == b)
                {
                    MakeQuestCompleted();
                    GameMaster.realMaster.GameOver(GameEndingType.FoundationRoute);
                }
                break;
            }
            }
            break;

        case QuestType.Foundation:
            switch ((Knowledge.FoundationRouteBoosters)subIndex)
            {
            case Knowledge.FoundationRouteBoosters.HappinessBoost:
                steps[0] = "Уровень довольства: " + string.Format("{0:0.##}", colony.happiness_coefficient * 100) + '%'
                           + " / " + string.Format("{0:0.##}", Knowledge.R_F_HAPPINESS_COND * 100) + '%';
                break;

            case Knowledge.FoundationRouteBoosters.ImmigrantsBoost:
                steps[0] = "Количество прибывших: " + DockSystem.GetImmigrantsTotalCount().ToString() + " / " + Knowledge.R_F_IMMIGRANTS_CONDITION.ToString();
                break;

            case Knowledge.FoundationRouteBoosters.PopulationBoost:
                steps[0] = "Текущее население: " + colony.citizenCount.ToString() + " / " + Knowledge.R_F_POPULATION_COND.ToString();
                break;
            }
            break;
        }
    }