void DisplayInfo(string Name) { if (Name == "None") { NameTextObject.GetComponent <Text>().text = Name; } else { GoodsRecipe.Recipe TargetItemRecipe = CallGoodsRecipe.GetRecipe(Name); ImageObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/Goods/Sprite/" + TargetItemRecipe.Type); ImageObject.GetComponent <Image>().color = new Color(1f, 1f, 1f, 1f); NameTextObject.GetComponent <Text>().text = TargetItemRecipe.OutputName; TypeTextObject.GetComponent <Text>().text = TargetItemRecipe.Type; MaterialPointTextObject.GetComponent <Text>().text = " x " + (Mathf.RoundToInt(TargetItemRecipe.Attractiveness.MaterialPoint * 10) * 0.1).ToString(); TechPointTextObject.GetComponent <Text>().text = " x " + (Mathf.RoundToInt(TargetItemRecipe.Attractiveness.TechPoint * 10) * 0.1).ToString(); LookPointTextObject.GetComponent <Text>().text = " x " + (Mathf.RoundToInt(TargetItemRecipe.Attractiveness.LookPoint * 10) * 0.1).ToString(); TotalPointTextObject.GetComponent <Text>().text = " x " + (Mathf.RoundToInt(TargetItemRecipe.Attractiveness.TotalPoint * 10) * 0.1).ToString(); if (Name == CallTargetGoodsCreator.TargetGoodsName) { MainFunctionButton.GetComponent <Button>().interactable = false; } if (Name != CallTargetGoodsCreator.TargetGoodsName) { MainFunctionButton.GetComponent <Button>().interactable = true; } } CurrentItem = Name; UpdateRemainQuantityText(); }
// Start is called before the first frame update void Start() { GoodsValueCall = GameObject.Find("CompanyManager").GetComponent <CompanyManager>().GetPlayerCompanyValue().GetGoodsValue().GetComponent <GoodsValue>(); GoodsRecipeCall = GameObject.Find("BaseSystem").GetComponent <GoodsRecipe>();; Goods = GameObject.Find("Goods"); ObjectActCall = gameObject.GetComponent <InstallableObjectAct>(); TimeManagerCall = GameObject.Find("TimeManager").GetComponent <TimeManager>(); TargetGoodsRecipe = null; Mover = new GameObject[InputNumber]; PrevBelt = new GameObject[InputNumber]; MoverDetector = new GameObject[InputNumber]; Transform DetectorCarrier = transform.GetChild(2); for (int i = 0; i < InputNumber; i++) { MoverDetector[i] = DetectorCarrier.GetChild(0).GetChild(i).gameObject; } RegisteredInput = new int[InputNumber]; for (int i = 0; i < InputNumber; i++) { RegisteredInput[i] = -1; } WorkLoadPerDay = 0; RealTimeWorkLoadPerDay = 0; TargetSetTime = -1; isWaiting = false; }
public void AddRecipe(GoodsRecipe.Recipe Recipe, string CompanyName) { RecipeInfo newRecipe = new RecipeInfo(); newRecipe.Recipe = Recipe; newRecipe.Maker = CompanyName; newRecipe.Owner = CompanyName; AvailableRecipe.Add(newRecipe); }
void DisplayInputInfo() { if (CurrentSelector == "FirstItem") { if (CurrentFisrtItem != "None") { GoodsRecipe.Recipe TargetRecipe = CallGoodsRecipe.GetRecipe(CurrentFisrtItem); FirstItemImageObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/Goods/Sprite/" + TargetRecipe.Type); FirstItemNameTextObject.GetComponent <Text>().text = CurrentFisrtItem; FirstItemImageObject.GetComponent <Image>().color = new Color(1f, 1f, 1f, 1f); } else { FirstItemImageObject.GetComponent <Image>().sprite = null; FirstItemNameTextObject.GetComponent <Text>().text = ""; FirstItemImageObject.GetComponent <Image>().color = new Color(0, 0, 0, 0); } } else if (CurrentSelector == "SecondItem") { if (CurrentSecondItem != "None") { GoodsRecipe.Recipe TargetRecipe = CallGoodsRecipe.GetRecipe(CurrentSecondItem); SecondItemImageObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/Goods/Sprite/" + TargetRecipe.Type); SecondItemNameTextObject.GetComponent <Text>().text = CurrentSecondItem; SecondItemImageObject.GetComponent <Image>().color = new Color(1f, 1f, 1f, 1f); } else { SecondItemImageObject.GetComponent <Image>().sprite = null; SecondItemNameTextObject.GetComponent <Text>().text = ""; SecondItemImageObject.GetComponent <Image>().color = new Color(0, 0, 0, 0); } } else if (CurrentSelector == "Processor") { if (CurrentProcessor != "None") { ProcessorImageObject.GetComponent <Image>().sprite = null; ProcessorNameTextObject.GetComponent <Text>().text = CurrentProcessor.Split('?')[0] + "-" + CurrentProcessor.Split('?')[1]; ProcessorImageObject.GetComponent <Image>().color = new Color(1f, 1f, 1f, 1f); } else { ProcessorImageObject.GetComponent <Image>().sprite = null; ProcessorNameTextObject.GetComponent <Text>().text = ""; ProcessorImageObject.GetComponent <Image>().color = new Color(0, 0, 0, 0); } } }
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; } }
void DisplayItemList(string Category) { List <string> StoredList = CallGoodsValue.GetAllGoodsName(true); List <string> ItemList = new List <string>(); int RowLimit = 0; ItemList.Add("None"); if (Category != "All") { foreach (var Item in StoredList) { GoodsRecipe.Recipe TargetItemRecipe = CallGoodsRecipe.GetRecipe(Item); if (TargetItemRecipe.Type == Category) { ItemList.Add(Item); } } } else { ItemList.AddRange(StoredList); } RowLimit = Mathf.CeilToInt(((float)ItemList.Count) / 3f); if (RowLimit > ItemCarrier.transform.childCount) { for (int i = ItemCarrier.transform.childCount; i < RowLimit; i++) { GameObject.Instantiate(ItemCarrier.transform.GetChild(0).gameObject, ItemCarrier.transform); } } else if (RowLimit < ItemCarrier.transform.childCount) { for (int i = ItemCarrier.transform.childCount - 1; i >= RowLimit; i--) { Destroy(ItemCarrier.transform.GetChild(i).gameObject); } } for (int i = 0; i < RowLimit; i++) { for (int j = 0; j < 3; j++) { ItemCarrier.transform.GetChild(i).GetChild(j).GetChild(0).gameObject.SetActive(false); } } for (int i = 0; i < RowLimit; i++) { for (int j = 0; j < 3; j++) { if (i * 3 + j >= ItemList.Count) { ItemCarrier.transform.GetChild(i).GetChild(j).GetChild(0).GetChild(0).gameObject.GetComponent <Image>().sprite = null; ItemCarrier.transform.GetChild(i).GetChild(j).GetChild(0).GetChild(1).gameObject.GetComponent <Text>().text = ""; break; } ItemCarrier.transform.GetChild(i).GetChild(j).GetChild(0).gameObject.SetActive(true); if (ItemList[i * 3 + j] == "None") { ItemCarrier.transform.GetChild(i).GetChild(j).GetChild(0).GetChild(0).gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/InGameUI/Sprite/InsideEmptyCircle"); } else { ItemCarrier.transform.GetChild(i).GetChild(j).GetChild(0).GetChild(0).gameObject.GetComponent <Image>().sprite = Resources.Load <Sprite>("GameSystem/Goods/Sprite/" + CallGoodsRecipe.GetRecipe(ItemList[i * 3 + j]).Type); } ItemCarrier.transform.GetChild(i).GetChild(j).GetChild(0).GetChild(1).gameObject.GetComponent <Text>().text = ItemList[i * 3 + j]; } } CurrentCategory = Category; }
void DisplayInfo(string Name) { TechValue.RecipeInfo TargetItemRecipe = CallTechValue.GetRecipe(Name); 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; CostTextObject.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>().color = new Color(0, 1f, 0, 1f); } else { PackagedValueImage.GetComponent <Image>().color = new Color(1f, 0, 0, 1f); } 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; } } } if (TargetItemRecipe.Recipe.RequiredProcessor == null) { RequireProcessorPanel.SetActive(false); } else { string ProcessorType = TargetItemRecipe.Recipe.RequiredProcessor.Split('?')[0]; string ProcessorName = TargetItemRecipe.Recipe.RequiredProcessor.Split('?')[1]; RequireProcessorPanel.SetActive(true); RequireProcessorImage.GetComponent <Image>().color = new Color(1f, 1f, 1f, 1f); RequireProcessorNameText.GetComponent <Text>().text = ProcessorName; RequireProcessorTypeText.GetComponent <Text>().text = ProcessorType; } }
void DisplayCategoryList() { List <string> CategoryList = new List <string>(); foreach (var Item in CallGoodsValue.GetStoredGoods()) { bool isDuplicated = false; foreach (var Category in CategoryList) { if (Category == Item.Type) { isDuplicated = true; break; } } if (!isDuplicated) { CategoryList.Add(Item.Type); } } if (CallTargetGoodsCreator.TargetGoodsName != "None") { if (CallGoodsValue.GetStoredGoods(CallTargetGoodsCreator.TargetGoodsName).Count == 0) { GoodsRecipe.Recipe TargetRecipe = CallGoodsRecipe.GetRecipe(CallTargetGoodsCreator.TargetGoodsName); bool isDuplicate = false; foreach (var Item in CategoryList) { if (Item == TargetRecipe.Type) { isDuplicate = true; break; } } if (!isDuplicate) { CategoryList.Add(TargetRecipe.Type); } } } int PresetCategoryCount = 1; int RowLimit = CategoryList.Count + PresetCategoryCount; if (RowLimit > CategoryCarrier.transform.childCount) { for (int i = CategoryCarrier.transform.childCount; i < RowLimit; i++) { GameObject.Instantiate(CategoryCarrier.transform.GetChild(0).gameObject, CategoryCarrier.transform); } } else if (RowLimit < CategoryCarrier.transform.childCount) { for (int i = CategoryCarrier.transform.childCount - 1; i >= RowLimit; i--) { Destroy(CategoryCarrier.transform.GetChild(i).gameObject); } } for (int i = PresetCategoryCount; i < RowLimit; i++) { CategoryCarrier.transform.GetChild(i).gameObject.SetActive(false); } for (int i = PresetCategoryCount; i < RowLimit; i++) { CategoryCarrier.transform.GetChild(i).gameObject.SetActive(true); CategoryCarrier.transform.GetChild(i).GetChild(0).gameObject.GetComponent <Text>().text = " " + CategoryList[i - PresetCategoryCount]; } }
public void SetTargetGoods(string Name) { TargetGoodsRecipe = GoodsRecipeCall.GetRecipe(Name); TargetSetTime = TimeManagerCall.TimeValue; }