// Start is called before the first frame update //SHOW # items. adjust how big viewport is. //Font to use. Maybe not for this particular script but in the prefab. public void fill() { dataHandler = GetComponent <GenericDataHandler>(); display = GetComponent <displayObjDetails>(); foreach (DataFieldMap mapping in FieldMapping) { Text text = mapping.obj.GetComponent <Text>(); if (text == null) { Image img = mapping.obj.GetComponent <Image>(); int idx = int.Parse(mapping.data.getFieldFromItemID(index.ToString(), mapping.fieldName)); Sprite[] sprites = Resources.LoadAll <Sprite>("GUIicons/" + spriteSheet.name); img.sprite = sprites[idx]; } else { text.text = mapping.data.getFieldFromItemID(index.ToString(), mapping.fieldName); } } dataHandler.setData(data.getFieldsFromItemID(index)); display.displayCode = data.displayCode; /*opdown = GetComponent<Dropdown>(); * dropdown.ClearOptions(); * * //need to pair id to value when selecting. * Dictionary<string,string> opts= data.getFieldFromAllItemsKeyed(chosenField,true,true); * //options.Add("");//add extra at bottom because dropdown hides it. * optionKeys = opts.Values.ToList(); * dropdown.AddOptions(opts.Keys.ToList());*/ }
public void displayValFields(int chosen) { GenericDataHandler datah = GetComponent <GenericDataHandler>(); listObjProps uiObject = displayObj; string key = this.optionKeys[chosen]; Dictionary <string, string> dat = data.getFieldsFromItemID(key); uiObject.resetVals(); dataHandler.setData(data.getFieldsFromItemID(key)); display.uiObject = displayObj; display.displayCode = data.displayCode; display.parseFields(); }