public void StartHiring()
 {
     if (observingRCenter.finding)
     {
         observingRCenter.finding = false;
         hireButton.GetComponent <Image>().overrideSprite = null;
         return;
     }
     else
     {
         if (Crew.crewSlots > 0)
         {
             if (GameMaster.colonyController.energyCrystalsCount >= RecruitingCenter.GetHireCost())
             {
                 GameMaster.colonyController.GetEnergyCrystals(RecruitingCenter.GetHireCost());
                 observingRCenter.finding = true;
                 hireButton.gameObject.SetActive(true);
                 hireButton.GetComponent <Image>().overrideSprite = PoolMaster.gui_overridingSprite;
             }
             else
             {
                 UIController.current.MakeAnnouncement(Localization.GetAnnouncementString(GameAnnouncements.NotEnoughEnergyCrystals));
                 hireButton.GetComponent <Image>().overrideSprite = null;
             }
         }
         else
         {
             UIController.current.MakeAnnouncement(Localization.GetRefusalReason(RefusalReason.NotEnoughSlots));
         }
     }
 }
示例#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);
    }
示例#3
0
    public bool SaveGame(string name)         // заменить потом на persistent -  постоянный путь
    {
        Time.timeScale = 0;
        GameMasterSerializer gms = new GameMasterSerializer();

        #region gms mainPartFilling
        gms.gameSpeed                      = gameSpeed;
        gms.lifeGrowCoefficient            = lifeGrowCoefficient;
        gms.demolitionLossesPercent        = demolitionLossesPercent;
        gms.lifepowerLossesPercent         = lifepowerLossesPercent;
        gms.luckCoefficient                = LUCK_COEFFICIENT;
        gms.sellPriceCoefficient           = sellPriceCoefficient;
        gms.tradeVesselsTrafficCoefficient = tradeVesselsTrafficCoefficient;
        gms.upgradeDiscount                = upgradeDiscount;
        gms.upgradeCostIncrease            = upgradeCostIncrease;
        gms.environmentalConditions        = environmentalConditions;
        gms.warProximity                   = warProximity;
        gms.difficulty                     = difficulty;
        gms.startGameWith                  = startGameWith;
        gms.prevCutHeight                  = prevCutHeight;
        gms.diggingSpeed                   = diggingSpeed;
        gms.pouringSpeed                   = pouringSpeed;
        gms.manufacturingSpeed             = manufacturingSpeed;
        gms.clearingSpeed                  = clearingSpeed;
        gms.gatheringSpeed                 = gatheringSpeed;
        gms.miningSpeed                    = miningSpeed;
        gms.machineConstructingSpeed       = machineConstructingSpeed;
        gms.day          = day; gms.week = week; gms.month = month; gms.year = year; gms.millenium = millenium; gms.t = timeGone;
        gms.windVector_x = windVector.x;
        gms.windVector_z = windVector.y;

        gms.windTimer      = windTimer; gms.windChangeTime = windChangeTime;
        gms.labourTimer    = labourTimer;
        gms.lifepowerTimer = lifepowerTimer;

        gms.recruiting_hireCost = RecruitingCenter.GetHireCost();
        #endregion
        gms.chunkSerializer            = mainChunk.SaveChunkData();
        gms.colonyControllerSerializer = colonyController.Save();
        gms.dockStaticSerializer       = Dock.SaveStaticDockData();
        gms.shuttleStaticSerializer    = Shuttle.SaveStaticData();
        gms.crewStaticSerializer       = Crew.SaveStaticData();
        gms.questStaticSerializer      = QuestUI.current.Save();
        gms.expeditionStaticSerializer = Expedition.SaveStaticData();
        string path = Application.persistentDataPath + "/Saves/";
        if (!Directory.Exists(path))
        {
            Directory.CreateDirectory(path);
        }
        FileStream fs = File.Create(path + name + '.' + SaveSystemUI.SAVE_FNAME_EXTENSION);
        savename = name;
        BinaryFormatter bf = new BinaryFormatter();
        bf.Serialize(fs, gms);
        fs.Close();
        Time.timeScale = 1;
        return(true);
    }
 public void LocalizeButtonTitles()
 {
     hireButton.transform.GetChild(0).GetComponent <Text>().text    = Localization.GetPhrase(LocalizedPhrase.HireNewCrew) + " (" + RecruitingCenter.GetHireCost() + ')';
     dismissButton.transform.GetChild(0).GetComponent <Text>().text = Localization.GetWord(LocalizedWord.Dismiss);
 }
    public void PrepareCrewsDropdown()
    {
        List <Dropdown.OptionData> crewButtons = new List <Dropdown.OptionData>();

        crewButtons.Add(new Dropdown.OptionData(Localization.GetPhrase(LocalizedPhrase.HireNewCrew) + " (" + RecruitingCenter.GetHireCost() + ')'));
        var crews = Crew.crewsList;

        if (crews.Count > 0)
        {
            for (int i = 0; i < crews.Count; i++)
            {
                crewButtons.Add(new Dropdown.OptionData('\"' + crews[i].name + '\"'));
            }
        }
        crewListDropdown.options = crewButtons;
    }
 public void PrepareWindow()
 {
     PrepareCrewsDropdown();
     PrepareButtons();
     crewSlotsInfo.text = Crew.crewsList.Count.ToString() + " / " + RecruitingCenter.GetCrewsSlotsCount().ToString();
     hireButton.transform.GetChild(0).GetComponent <Text>().text = Localization.GetPhrase(LocalizedPhrase.HireNewCrew) + " (" + RecruitingCenter.GetHireCost().ToString() + ')';
 }