コード例 #1
0
    private void SetDropdownValueByMapping(DataManager.Mapping mapping, int value)
    {
        //Set value via SMV so VR menu gets updated too
        switch (mapping)
        {
        case DataManager.Mapping.Height: HeightLabelDropdownValue = value; break;

        case DataManager.Mapping.TopColor: TopColorLabelDropdownValue = value; break;

        case DataManager.Mapping.SideColor: SideColorLabelDropdownValue = value; break;
        }
    }
コード例 #2
0
 /// <summary>
 /// Set the color table selection for a given mapping. If we just set it here and then call
 /// Redraw, the new values will get picked up.
 /// </summary>
 /// <param name="index">Index into color table dropdown</param>
 public void SetColorTableByMappingAndIndex(DataManager.Mapping mapping, int index)
 {
     if (mapping == DataManager.Mapping.Height)
     {
         return;
     }
     if (mapping == DataManager.Mapping.SideColor)
     {
         SideColortableDropdownValue = index;
     }
     else
     {
         TopColortableDropdownValue = index;
     }
 }
コード例 #3
0
    /// <summary>
    /// Set the UI dropdown choice (Value) according to data variable label.
    /// This lets us change the dropdown options/list and set the
    /// choice back to what it was pointing at before (or the default if
    /// its variable was removed).
    /// Note that labels guaranteed to be unique, see DataManager.ForceUniqueLabels()
    /// </summary>
    /// <param name="dd"></param>
    /// <param name="var"></param>
    private void SetDropdownValueByVarLabel(DataManager.Mapping mapping, DataVariable var)
    {
        Dropdown dd = null;

        switch (mapping)
        {
        case DataManager.Mapping.Height: dd = heightLabelDropdown; break;

        case DataManager.Mapping.TopColor: dd = topColorLabelDropdown; break;

        case DataManager.Mapping.SideColor: dd = sideColorLabelDropdown; break;
        }
        int index;

        if (var == null)
        {
            index = 0;
        }
        else
        {
            //Look at each item in the choice list until we get a match
            for (index = 0; index < dd.options.Count; index++)
            {
                if (dd.options[index].text == var.Label)
                {
                    break;
                }
            }
        }
        //If no match, defaults to first item in dropdown
        if (index == dd.options.Count)
        {
            index = 0;
        }
        SetDropdownValueByMapping(mapping, index);
    }
コード例 #4
0
    private bool DemoData_LoadSingleDataFile(string filename, out DataVariable dataVar, DataManager.Mapping mapping, int count)
    {
        string path = Application.streamingAssetsPath + "/sampleData/" + filename;
        string errorMsg;

        if (!DataManager.I.LoadAddFile(path, true, true, out dataVar, out errorMsg))
        {
            UIManager.I.ShowMessageDialog("Loading sample data failed.\n" + filename + "\n" + errorMsg);
            return(false);
        }
        DataManager.I.AssignVariableMapping(mapping, dataVar);
        DataVarUIHandler.SetDataVarAtIndex(dataVar, count);
        return(true);
    }
コード例 #5
0
 /// <summary>
 /// Set the color table selection for a given mapping. If we just set it here and then call
 /// Redraw, the new values will get picked up.
 /// </summary>
 /// <param name="index">Index into color table dropdown</param>
 public void SetColorTableByMappingAndIndex(DataManager.Mapping mapping, int index)
 {
     visualMappingUIHandler.SetColorTableByMappingAndIndex(mapping, index);
 }