예제 #1
0
    public bool CompleteResearch(ResearchState TargetResearch)
    {
        TargetResearch.TargetState.Completed = true;

        CheckTechPossible();

        foreach (var FacilityName in TargetResearch.TargetState.Info.UnlockFacility)
        {
            if (FacilityName == "None")
            {
                break;
            }
            TechRecipe.FacilityInfo TargetFacility = TechRecipeCall.GetFacilityInfo(FacilityName);
            FacilityList.Add(TargetFacility);
        }

        foreach (var ActorName in TargetResearch.TargetState.Info.UnlockActor)
        {
            if (ActorName == "None")
            {
                break;
            }
            TechRecipe.ProcessActorInfo TargetActor = TechRecipeCall.GetProcessActorInfo(ActorName);
            ActorList.Add(TargetActor);
        }

        switch (TargetResearch.TargetState.Info.UpgradeValueType)
        {
        case "Work":
            CompanyValueCall.GetEmployeeValue().GetComponent <EmployeeValue>().WorkEifficiency = TargetResearch.TargetState.Info.UpgradeValueAmount;
            break;

        case "Energy":
            CompanyValueCall.GetElectricityValue().GetComponent <ElectricityValue>().EnergyEfficiency = TargetResearch.TargetState.Info.UpgradeValueAmount;
            break;

        case "Organize":
            CompanyValueCall.GetGoodsValue().GetComponent <GoodsValue>().OrganizeEfficiency = TargetResearch.TargetState.Info.UpgradeValueAmount;
            break;
        }

        ResearchPanelUpdate(TargetResearch);

        int limit = TargetResearch.LabatoryList.Count;

        for (int i = 0; i < limit; i++)
        {
            LabatoryAct TargetLabatoryAct = TargetResearch.LabatoryList[0].GetComponent <LabatoryAct>();

            TargetLabatoryAct.StopResearch();
        }

        ResearchStateList.Remove(TargetResearch);
        TargetResearch = null;

        return(true);
    }
예제 #2
0
    public void UpdateProgressInfo()
    {
        TechValue.ResearchState TargetResearchState = CallTechValue.GetResearchState(CurrnetResearchName);
        if (TargetResearchState == null)
        {
            ProgressPanelClear();
            return;
        }

        float CompletePercentage  = Mathf.CeilToInt(TargetResearchState.GainedWorkLoad / (float)TargetResearchState.TargetState.Info.RequiredWorkLoad * 100f) * 0.01f;
        float CurrentGainingPoint = 0f;

        foreach (var Labatory in TargetResearchState.LabatoryList)
        {
            LabatoryAct TargetLabatoryAct = Labatory.GetComponent <LabatoryAct>();

            CurrentGainingPoint += TargetLabatoryAct.ResearchPower;
        }

        ProgressBarImageObject.GetComponent <Image>().fillAmount = CompletePercentage;
        if (CompletePercentage >= 1)
        {
            UpdateCompleteState();
        }
        else
        {
            ProgressPercentageTextObject.GetComponent <Text>().text = (CompletePercentage * 100).ToString() + " %";
        }

        PassedTimeTextObject.GetComponent <Text>().text = CallTimeManager.GetPeriodString(CallTimeManager.TimeValue - TargetResearchState.StartTime, "Short");
        RemainTimeTextObject.GetComponent <Text>().text = " / " +
                                                          CallTimeManager.GetPeriodString((CallTimeManager.TimeValue - TargetResearchState.StartTime) + (Mathf.CeilToInt(((float)TargetResearchState.TargetState.Info.RequiredWorkLoad - TargetResearchState.GainedWorkLoad) / CurrentGainingPoint) * CallTimeManager.Hour), "Short");

        CompletedPointTextObject.GetComponent <Text>().text = (Mathf.CeilToInt(TargetResearchState.GainedWorkLoad)).ToString();
        GainingPointTextObject.GetComponent <Text>().text   = "(+" + (Mathf.CeilToInt(CurrentGainingPoint)).ToString() + ")";
        RemainPointTextObject.GetComponent <Text>().text    = " / " + TargetResearchState.TargetState.Info.RequiredWorkLoad.ToString();
    }
 void GetTargetObject()
 {
     TargetObject          = CallPanelController.CurrentFloatingPanel.GetComponent <ObjectInfoPanelController>().TargetObject;
     CallTargetLabatoryAct = TargetObject.GetComponent <LabatoryAct>();
 }