private void OnSliderValueChanged(float value) { if (!selectedType.IsDefined()) { quality = 0; QualitySlider.value = 0; return; } quality = (int)value; bool isEnoughResource = CheckEnoughtResource(); if (isEnoughResource) { AcceptBtn.Interactable = true; QualityNum.text = quality + "/" + QualitySlider.maxValue; } else { AcceptBtn.Interactable = false; QualityNum.text = string.Format("<color=red>{0}</color>/{1}", quality, QualitySlider.maxValue); } SetCostInfo(); if (SyncData.CurrentMainBase.TrainingUnit_ID.IsDefined()) { AcceptBtn.Interactable = false; } QualityInput.SetContent(quality.ToString()); }
public override void Load(params object[] input) { BaseInfoRow baseInfo = SyncData.CurrentMainBase; ListUpgrade tranningType = baseInfo.TrainingUnit_ID; if (tranningType.IsDefined()) { ITable table = dBReference[tranningType]; int level = SyncData.CurrentBaseUpgrade[tranningType].Level; ITableData typeInfo = table[level - 1]; TranningProgress.Slider.MaxValue = fieldReflection.GetPublicField <int>(typeInfo, "TrainingTime") * baseInfo.TrainingQuality; AcceptBtn.Interactable = false; TranningProgress.gameObject.SetActive(true); } else { AcceptBtn.Interactable = true; TranningProgress.gameObject.SetActive(false); } }
private int GetResearchMaxTime() { ListUpgrade type = baseInfo.ResearchWait_ID; if (type.IsDefined()) { int level = SyncData.CurrentBaseUpgrade[type].Level; ITableData data = dbRef[type][level - 1]; return(fieldReflection.GetPublicField <int>(data, "TimeInt")); } return(0); }
private int GetTraingMaxTime() { ListUpgrade type = baseInfo.TrainingUnit_ID; if (type.IsDefined()) { int level = SyncData.CurrentBaseUpgrade[type].Level; ITableData data = dbRef[type][level - 1]; int trainingTime = fieldReflection.GetFieldValue <int>(data, "TrainingTime", BindingFlags.Public | BindingFlags.Instance); return(trainingTime * baseInfo.TrainingQuality); } return(0); }
private bool ValidateResearchTask(MiniTaskWDOElement taskElement) { ListUpgrade type = baseInfo.ResearchWait_ID; if (type.IsDefined()) { taskElement.SetGetTimeFunc ( delegate { return(GetResearchTimeString(taskElement)); }, GetResearchMaxTime() ); taskElement.SetTitleFunc(delegate { return("Researching " + type.ToString().InsertSpace() + "..."); }); taskElement.SetSliderValue(GetResearchTime); taskElement.gameObject.SetActive(true); return(true); } return(false); }