//修改道具数量,同时修改对应UI public void UpdatePropAmount(string propName, int amount) { props[propName] += amount; PropsPanel propsPanel = player_PropPanel.GetComponent <PropsPanel>(); propsPanel.UpdatePropAmount(propName, props[propName]); }
//改变某个道具按钮可互动状态方法 public void ChangeButtonState(string name, bool state) { PropsPanel propsPanel = player_PropPanel.GetComponent <PropsPanel>(); Dictionary <string, Text> propsDic = propsPanel.propsDic; Button propBtn = propsDic[name].GetComponentInParent <Button>(); propBtn.interactable = false; }
private void changeState() { if (MODE == Mode.SubjectEdit) { PropsPanel.Show(); TaskInfoPanel.Hide(); } if (MODE == Mode.TaskEdit) { PropsPanel.Hide(); TaskInfoPanel.Show(); if (selectednode.Text != "Добавить задание") { foreach (TaskClass tsk in subject.Tasks) { if (selectednode.Text == tsk.Label) { runtime = tsk; } } HeaderTask.Text = runtime.Label; TextTaskBox.Text = runtime.Text; ImageList imglist = new ImageList(); ImageView.View = View.LargeIcon; ImageView.Items.Clear(); int counter = 0; foreach (KeyValuePair <Image, string> img in runtime.Images) { imglist.Images.Add(img.Key); ListViewItem item = new ListViewItem(); item.Tag = img.Value; if (img.Key.Tag != null) { item.Text = (string)img.Key.Tag; } else { item.Text = "В ресурсах"; } item.ImageIndex = counter; counter++; ImageView.Items.Add(item); } imglist.ImageSize = new Size(80, 80); ImageView.LargeImageList = imglist; } } }