public void UpdateLabel() { label.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "虫害模拟" : " Insect Simulation"; }
void SetGCLabel() { GCLabel.text = (LScene.GetInstance().Language == SystemLanguage.Chinese ? "生长周期: " : "Growth Cycle: ") + GrowthCycle; }
void SetBiomassLabel() { BiomassLabel.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "生物量: " + Biomass.ToString("f1") + "克" : "Biomass: " + Biomass.ToString("f1") + "g"; }
public void UpdateLabel() { label.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "光合作用模型" : "Photosynthesis"; }
public void OnSceneStartForExp() { LScene scene = LScene.GetInstance(); bool defaultParam = scene.HaveAnimator; scene.LoadTrees(); //不进行动画效果 scene.HaveAnimator = false; for (int i = 0; i < 20; i++) { scene.NextDay(); } OutlineEffect.Instance.UpdateOutlineControl(); if (environmentParams != null) { foreach (var treeGroup in scene.TreeGroups) { treeGroup.EnvirParamsDepthCopy(environmentParams); } } scene.HaveAnimator = defaultParam; }
public void NextDay() { foreach (var treeModel in TreeModels) { if (LScene.GetInstance().HaveAnimator) { if (treeModel.ComputeGrowthCycle() < 1) { treeModel.NextDay(true); } else { treeModel.NextDay(false); } ////出苗后 if (treeModel.ComputeGrowthCycle() >= 1 && !treeModel.IsStopDevelopment) { TreeAnimator animator = new TreeAnimator(); animator.PlayAnimation(treeModel.PairedBranchIndexes, treeModel.PairedOrganIndexes, LScene.GetInstance().AnimationCount); } } else { treeModel.NextDay(true); } } }
public void UpdateLabel() { label.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "相机自适应" : "Camera Adaption"; }
//温光照 void SetSunshineLabel() { string label = ""; SystemLanguage language = LScene.GetInstance().Language; switch (SunshineType) { case SunshineType.Normal: label = language == SystemLanguage.Chinese ? "正常" : "Normal"; break; case SunshineType.High: label = language == SystemLanguage.Chinese ? "高光照" : "High"; break; case SunshineType.Low: label = language == SystemLanguage.Chinese ? "低光照" : "Low"; break; } SunshineLabel.text = (language == SystemLanguage.Chinese ? "光照情况: " : "Illumination is: ") + label; }
public void UpdateLabel() { label.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "养分" : "Nutrient"; }
void SetWaterContentLabel() { //int index = MaizeParams.WaterContents.IndexOf(WaterContent); //if (LScene.GetInstance().Language == SystemLanguage.Chinese) // WaterContentLabel.text = "水分含量: " + WC_Labels_Tw[index]; //else // WaterContentLabel.text = "Water Content: " + WC_Labels_En[index]; if (WaterContent <= MaizeParams.WP) { WaterContentLabel.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "水分含量: 极度缺乏" : "Water Content: Too low"; } else if (WaterContent < MaizeParams.FC - 0.03) { WaterContentLabel.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "水分含量: 缺乏" : "Water Content: Low"; } else if (WaterContent <= MaizeParams.FC) { WaterContentLabel.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "水分含量: 充足" : "Water Content: Plenty"; } else { WaterContentLabel.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "水分含量: 过多" : "Water Content: Too high"; } }
//温度 void SetTemperatureLabel() { string label = ""; SystemLanguage language = LScene.GetInstance().Language; switch (TemperatureType) { case TemperatureType.Normal: label = language == SystemLanguage.Chinese ? "常温" : "Normal"; break; case TemperatureType.High: label = language == SystemLanguage.Chinese ? "高温" : "High"; break; case TemperatureType.Low: label = language == SystemLanguage.Chinese ? "低温" : "Low"; break; } TemperatureLabel.text = (language == SystemLanguage.Chinese ? "温度情况: " : "Temperatrue is: ") + label; }
void SetHeightLabel() { HeightLabel.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "株高: " + Height.ToString("f3") + "米" : "Height: " + Height.ToString("f3") + "m"; }
void SetLeafAreaLabel() { LeafAreaLabel.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "叶面积: " + LeafArea.ToString("f5") + "m2" : "Leaf Area: " + LeafArea.ToString("f5") + "m2"; }
public void Click() { LScene.GetInstance().LoadTrees(); HidePlaneSettingButtons(); SetLabel(); }
public void UpdateLabel() { label.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "水分含量" : "Water Content"; }
private void Detection() { if (screenShot == null) { return; } /* * 获取指针位置 * 用于读取对应纹理中的颜色 */ Vector2 mousePosition = Input.mousePosition; int x = (int)mousePosition.x; int y = (int)mousePosition.y; Color pixelColor = screenShot.GetPixel(x, y); for (int i = 0; i < lineColors.Length; i++) { if (lineColors[i] == pixelColor) { LScene.GetInstance().TreeGroups[i].Selected = true; } else { LScene.GetInstance().TreeGroups[i].Selected = false; } } }
public void UpdateLabel() { label.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "背景" : "Background"; }
public void UpdateOptions() { List <Dropdown.OptionData> datas = GetComponent <Dropdown>().options; if (LScene.GetInstance().Language == SystemLanguage.Chinese) { for (int i = 0; i < datas.Count; i++) { switch (i) { case 0: datas[i].text = "正常"; break; case 1: datas[i].text = "缺氮"; break; case 2: datas[i].text = "缺磷"; break; case 3: datas[i].text = "缺钾"; break; default: throw new System.IndexOutOfRangeException("Index out of range of nutrient dropdown."); } } } else { for (int i = 0; i < datas.Count; i++) { switch (i) { case 0: datas[i].text = "Normal"; break; case 1: datas[i].text = "Lack of N"; break; case 2: datas[i].text = "Lack of P"; break; case 3: datas[i].text = "Lack of K"; break; default: throw new System.IndexOutOfRangeException("Index out of range of nutrient dropdown."); } } } }
// Use this for initialization void Start() { label = transform.Find("Label").GetComponent <Text>(); LanguageNotification.GetInstance().AddListener(UpdateLabel); GetComponent <Toggle>().isOn = LScene.GetInstance().HaveBackground; }
// Use this for initialization void Start() { GetComponent <Dropdown>().value = LScene.GetInstance().Language == SystemLanguage.Chinese ? 0 : 1; LanguageNotification.GetInstance().AddListener(UpdateLabel); }
public void UpdateLabel() { if (title == null) { transform.parent.Find("Title").GetComponent <Text>(); } if (XAxisLabel == null) { transform.parent.Find("X Axis Label").GetComponent <Text>(); } if (LScene.GetInstance().Language == SystemLanguage.Chinese) { switch (chartType) { case ChartType.Biomass: title.text = "生物量"; break; case ChartType.Height: title.text = "株高"; break; case ChartType.LeafArea: title.text = "叶片面积"; break; default: throw new System.Exception("Chart type error!"); } XAxisLabel.text = "天数"; } else { switch (chartType) { case ChartType.Biomass: title.text = "Biomass"; break; case ChartType.Height: title.text = "Height"; break; case ChartType.LeafArea: title.text = "Leaf Area"; break; default: throw new System.Exception("Chart type error!"); } XAxisLabel.text = "Day"; } }
public void ValueChange(int value) { LScene.GetInstance().Language = value == 0 ? SystemLanguage.Chinese : SystemLanguage.English; LanguageNotification.GetInstance().Notification(); }
private void OnEnable() { if (label == null) { label = transform.GetComponentInChildren <Text>(); } label.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? label_tw : label_en; }
private Bounds ViewportBounds() { /* * 获取当前植物的所有对象 * 逐个遍历 * 将对象的顶点坐标(世界坐标系下)转换成视窗坐标(viewport 以左下角为原点(0, 0), 右上角为(1, 1)的坐标系) * 根据视窗坐标最大最小值生成包围盒 * 用于确定当前对象在视窗中的位置,便于相机调整其自身位置 * 使视点合适 */ List <GameObject> objects = new List <GameObject>(); foreach (TreeModel treeModel in LScene.GetInstance().TreeModels) { objects.AddRange(GameObjectOperation.GetGameObjects(treeModel.TreeModelInstance)); } Vector3 max = Vector3.zero, min = Vector3.zero; /* * 判断是否初始化 max 和 min */ bool flag = true; foreach (GameObject _object in objects) { //无顶点 if (!GameObjectValidate.HavaVertices(_object)) { continue; } Vector3[] vertices = GameObjectOperation.GetVerticesInWorld(_object); foreach (Vector3 vertex in vertices) { Vector3 viewport = mainCamera.WorldToViewportPoint(vertex); if (flag) { max = viewport; min = viewport; flag = false; continue; } else { max = Vector3.Max(max, viewport); min = Vector3.Min(min, viewport); } } } Bounds bounds = new Bounds((max + min) / 2.0f, max - min); return(bounds); }
private void Update() { if (LScene.GetInstance().IsPlaying()) { button.interactable = false; } else { button.interactable = true; } }
public void UpdateLabel() { if (label == null) { label = transform.Find("Label").Find("Text").GetComponent <Text>(); } label.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "设置" : "Setting"; }
// Start is called before the first frame update protected override void Start() { base.Start(); if (slider == null) { slider = GetComponent <Slider>(); } slider.value = (int)(LScene.GetInstance().PlaybackSpeed / 0.5f); UpdateSpeedLabel(); }
private void SetLabel() { if (label == null) { label = transform.Find("Text").GetComponent <Text>(); } label.text = LScene.GetInstance().Language == SystemLanguage.Chinese ? "重新开始" : "Restart"; }
// Start is called before the first frame update protected override void Start() { base.Start(); if (slider == null) { slider = GetComponent <Slider>(); } slider.value = LScene.GetInstance().Duration / 10; UpdateDayLabel(); }
private IEnumerator NextWithDuration() { LScene scene = LScene.GetInstance(); for (int i = 0; i < LScene.GetInstance().Duration; i++) { scene.NextDay(); yield return(new WaitWhile(TreeAnimator.IsPlaying)); } OutlineEffect.Instance.UpdateOutlineControl(); }