GetValue() public method

public GetValue ( string rowHead, string ColumnHead ) : string
rowHead string
ColumnHead string
return string
Beispiel #1
0
    public void Finish(string map, bool newRecord)
    {
        finishPlaque.gameObject.SetActive(true);

        Global.save.SetRecordText(map, recordText);
        CSVReader mapList = MapList.mapData;
        int       i       = mapList.GetRow(map, "Scene name");

        string title  = mapList.GetValue(i, "Title");
        string author = mapList.GetValue(i, "Main author");

        mapTitleText.text  = title;
        mapAuthorText.text = "by " + author + ",";

        if (newRecord)
        {
            recordLabelText.text = "with a new record:";
        }
        else
        {
            recordLabelText.text = "without beating your old record:";
        }

        recordText.text += ".";
        Invoke("EndFinish", 10f);
    }
    public ValueProviderResult GetValue(string key)
    {
        if (!key.Contains('[') || !key.Contains(']') || !key.Contains('.'))
        {
            return(null);
        }
        object value  = null;
        var    header = key.Split('.').Last();
        int    index  = int.Parse(key.Split('[').Last().Split(']').First());

        value = _csvReader.GetValue(header, index);
        if (value == null)
        {
            return(null);
        }
        return(new ValueProviderResult(value, value.ToString(), CultureInfo.CurrentCulture));
    }