Beispiel #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);
    }
    void DisplayInfo(string Name)
    {
        if (Name == "None")
        {
            NameTextObject.GetComponent <Text>().text = "None";

            ChangeCostPanel.transform.GetChild(1).gameObject.GetComponent <Text>().text = "$ 0";
            string ButtonName = "";
            if (CallTargetProcessorAct.TargetGoodsRecipe != null)
            {
                ButtonName = "Remove Process";
                MainFunctionButton.GetComponent <Button>().interactable = true;
            }
            else
            {
                ButtonName = "Change";
                MainFunctionButton.GetComponent <Button>().interactable = false;
            }

            MainFunctionButton.transform.GetChild(0).gameObject.GetComponent <Text>().text = ButtonName;
        }
        else
        {
            TechValue.RecipeInfo        TargetItemRecipe = CallTechValue.GetRecipe(Name);
            TechRecipe.ProcessActorInfo TargetActorInfo  = CallTechRecipe.GetProcessActorInfo(CurrentCategory);

            ImageObject.GetComponent <Image>().sprite          = Resources.Load <Sprite>("GameSystem/Goods/Sprite/" + TargetItemRecipe.Recipe.Type);
            ImageObject.GetComponent <Image>().color           = new Color(1f, 1f, 1f, 1f);
            NameTextObject.GetComponent <Text>().text          = TargetItemRecipe.Recipe.OutputName;
            TypeTextObject.GetComponent <Text>().text          = TargetItemRecipe.Recipe.Type;
            CompanyTextObject.GetComponent <Text>().text       = TargetItemRecipe.Owner;
            ExpectQualityTextObject.GetComponent <Text>().text = "TEST";

            MaterialPointTextObject.GetComponent <Text>().text   = "x " + (Mathf.RoundToInt(TargetItemRecipe.Recipe.Attractiveness.MaterialPoint * 10) * 0.1).ToString();
            TechPointTextObject.GetComponent <Text>().text       = "x " + (Mathf.RoundToInt(TargetItemRecipe.Recipe.Attractiveness.TechPoint * 10) * 0.1).ToString();
            LookPointTextObject.GetComponent <Text>().text       = "x " + (Mathf.RoundToInt(TargetItemRecipe.Recipe.Attractiveness.LookPoint * 10) * 0.1).ToString();
            PerfectionPointTextObject.GetComponent <Text>().text = "x " + (Mathf.RoundToInt(TargetItemRecipe.Recipe.Attractiveness.PerfectionPoint * 10) * 0.1).ToString();
            TotalPointTextObject.GetComponent <Text>().text      = "x " + (Mathf.RoundToInt(TargetItemRecipe.Recipe.Attractiveness.TotalPoint * 10) * 0.1).ToString();
            if (TargetItemRecipe.Recipe.Attractiveness.isPackaged)
            {
                PackagedValueImage.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/InGameUI/Sprite/PossitiveMark");
            }
            else
            {
                PackagedValueImage.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/InGameUI/Sprite/NegativeMark");
            }

            for (int i = 1; i < RequirementProductInfoPanel.transform.childCount - 1; i++)
            {
                for (int j = 0; j < RequirementProductInfoPanel.transform.GetChild(i + 1).childCount; j++)
                {
                    RequirementProductInfoPanel.transform.GetChild(i + 1).GetChild(j).gameObject.SetActive(false);
                }
            }

            if (TargetItemRecipe.Recipe.InputName != null)
            {
                for (int i = 0; i < TargetItemRecipe.Recipe.InputName.Length; i++)
                {
                    for (int j = 0; j < RequirementProductInfoPanel.transform.GetChild(i + 1).childCount; j++)
                    {
                        RequirementProductInfoPanel.transform.GetChild(i + 1).GetChild(j).gameObject.SetActive(true);
                    }
                    GoodsRecipe.Recipe InputItem = CallGoodsRecipe.GetRecipe(TargetItemRecipe.Recipe.InputName[i]);
                    RequirementProductInfoPanel.transform.GetChild(i + 1).GetChild(0).GetChild(0).gameObject.GetComponent <Image>().color  = new Color(1f, 1f, 1f, 1f);
                    RequirementProductInfoPanel.transform.GetChild(i + 1).GetChild(0).GetChild(0).gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/Goods/Sprite/" + InputItem.Type);
                    RequirementProductInfoPanel.transform.GetChild(i + 1).GetChild(2).GetChild(0).gameObject.GetComponent <Text>().text    = InputItem.OutputName;
                    RequirementProductInfoPanel.transform.GetChild(i + 1).GetChild(2).GetChild(1).gameObject.GetComponent <Text>().text    = InputItem.Type;
                    if (TargetItemRecipe.Owner == PlayerCompanyName)
                    {
                        RequirementProductInfoPanel.transform.GetChild(i + 1).gameObject.GetComponent <Button>().interactable = true;
                    }
                    else
                    {
                        RequirementProductInfoPanel.transform.GetChild(i + 1).gameObject.GetComponent <Button>().interactable = false;
                    }
                }
            }

            string ButtonName = "";
            if (CallTargetProcessorAct.ProcessorActorName == CurrentCategory)
            {
                if (CallTargetProcessorAct.TargetGoodsRecipe != null)
                {
                    ButtonName = "Change Goods";
                    if (CallTargetProcessorAct.TargetGoodsRecipe.OutputName == CurrentItem)
                    {
                        MainFunctionButton.GetComponent <Button>().interactable = false;
                    }
                    else
                    {
                        MainFunctionButton.GetComponent <Button>().interactable = true;
                    }

                    ChangeCostPanel.transform.GetChild(1).gameObject.GetComponent <Text>().text = "$ 0";
                }
            }
            else
            {
                MainFunctionButton.GetComponent <Button>().interactable = true;

                if (CallTargetProcessorAct.TargetGoodsRecipe != null)
                {
                    if (CallTargetProcessorAct.TargetGoodsRecipe.OutputName == CurrentItem)
                    {
                        ButtonName = "Change Processor";
                    }
                    else
                    {
                        ButtonName = "Change Processor & Goods";
                    }
                }
                else
                {
                    ButtonName = "Change Processor & Goods";
                }

                ChangeCostPanel.transform.GetChild(1).gameObject.GetComponent <Text>().text = "$ " + TargetActorInfo.Cost.ToString();
            }
            MainFunctionButton.transform.GetChild(0).gameObject.GetComponent <Text>().text = ButtonName;
        }
    }