void DisplayItemCategoryList() { List <string> CategoryList = new List <string>(); CategoryList.Add("All"); 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 (CategoryCarrier.transform.childCount > CategoryList.Count) { for (int i = CategoryCarrier.transform.childCount - 1; i <= CategoryList.Count; i--) { Destroy(CategoryCarrier.transform.GetChild(i).gameObject); } } else if (CategoryCarrier.transform.childCount < CategoryList.Count) { for (int i = CategoryCarrier.transform.childCount; i < CategoryList.Count; i++) { GameObject.Instantiate(CategoryCarrier.transform.GetChild(0).gameObject, CategoryCarrier.transform); } } for (int i = 0; i < CategoryList.Count; i++) { CategoryCarrier.transform.GetChild(i).gameObject.SetActive(true); CategoryCarrier.transform.GetChild(i).GetChild(0).gameObject.GetComponent <Text>().text = " " + CategoryList[i]; } }
void GetProcessingStateValue() { foreach (var State in ProcessingStateList) { State.Value.Add(0); } int CurrentIndex = ProcessingStateList[0].Value.Count - 1; ProcessingStateList[0].Value[CurrentIndex] += CallGoodsValue.GetStoredGoods().Count; int TotalWorkLoad = 0; foreach (var State in ProcessingStateList) { foreach (var FacilityInfo in CallFacilityValue.FacilityList) { if (FacilityInfo.ObjectActCall.Info.Type != "Processor") { continue; } ProcessorAct TargetProcessorValue = FacilityInfo.Object.GetComponent <ProcessorAct>(); if (TargetProcessorValue.TargetGoodsRecipe != null) { if (TargetProcessorValue.TargetGoodsRecipe.OutputName == State.Title) { State.Value[CurrentIndex] += TargetProcessorValue.WorkLoadPerDay; TotalWorkLoad += TargetProcessorValue.WorkLoadPerDay; } } } } ProcessingStateList[1].Value[CurrentIndex] += TotalWorkLoad; for (int i = 0; i < ProcessingStateList.Count; i++) { if (ProcessingStateList[i].Value.Count > xValueMaximum) { ProcessingStateList[i].Value.RemoveAt(0); } } }
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]; } }