/// <summary> Load a data var as its restored as part of a project </summary> /// <param name="dvs"></param> /// <param name="index">index within the collection of dataVarUIHandlers at which to place the data var</param> /// <param name="newDataVar"></param> /// <returns></returns> public bool LoadDataVarFromStorage(DataVarStorage dvs, out DataVariable newDataVar) { //NOTE - probably will need to improve this for x-plat needs, although maybe not // since path is stored from local path anyway string path = dvs.pathOnly + "\\" + dvs.filename; string errorMsg; newDataVar = null; //make sure the file exists, so we can give a simpler error than we'd get otherwise when calling LoadAddFile if (!File.Exists(path)) { UIManager.I.ShowMessageDialog("File not found: " + path); return(false); } //Actually load it now if (!DataManager.I.LoadAddFile(path, dvs.hasRowHeaders, dvs.hasColumnHeaders, out newDataVar, out errorMsg)) { UIManager.I.ShowMessageDialog("Loading data failed.\n" + path + "\n" + errorMsg); return(false); } newDataVar.Label = dvs.label; DataVarUIHandler.SetDataVarAtIndex(newDataVar, dvs.UIindex); return(true); }
public static void Clear(DataVariable dataVar) { DataVarUIHandler h = GetHandlerForDataVar(dataVar); if (h != null) { h.Clear(); } }
/// <summary> /// Call this when something needs refershing, e.g. data has been updated in some way the will need a UI refresh (i.e. DataVariables) /// Awkward, I know. /// </summary> public void RefreshUI() { visualMappingUIHandler.RefreshUI(); InputManager.I.Reset(); VRManager.I.UIupdate(); DataVarUIHandler.RefreshUIall(); //Debug //dataMgr.DebugDumpVariables(false/*verbose*/); }
public override void Clear() { //Debug.Log("DataVariable:Clear()"); base.Clear(); DataVarUIHandler.Clear(this); MinValue = float.MinValue; MaxValue = float.MaxValue; range = 0f; minMaxReady = false; label = "DefaultLabel"; filename = "None"; UIhandler = null; }
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); }
/// <summary> Set up the list of game objects for action prompting </summary> private void UIActionPromptInit() { UIActionPromptees = new List <GameObject>(); //Add relevant UI elemetns for first two data vars for (int index = 0; index < 2; index++) { DataVarUIHandler obj = DataVarUIHandler.GetHandlerAtIndex(index); UIActionPromptees.Add(obj.ChooseFileButton); UIActionPromptees.Add(obj.HeadersDropdown); UIActionPromptees.Add(obj.LoadButton); UIActionPromptees.Add(obj.InputField); } //Now add the mapping UI elements UIActionPromptees.Add(mappingHeightDropdown); UIActionPromptees.Add(mappingTopColorDropdown); UIActionPromptees.Add(mappingSideColorDropdown); UIActionPromptees.Add(redrawButton); currentAutoUIActionPrompteeIndex = -1; mostRecentUIActionPrompteeObj = null; }
// Use this for initialization instead of Awake, since this is MonoBehaviorSingleton //void Awake () { protected override void Initialize() { //UI Canvas canvasDesktop = GetAndCheckGameObject("CanvasScreenSpace"); //Graph panels mainPanel = GetAndCheckGameObject("MainPanel"); optionsTopPanel = GetAndCheckGameObject("OptionsTopPanel"); //Sub panels and components //assigned thru inspector if (toolTipPanel == null) { Debug.LogError("toolTipPanel == null"); } if (statusPanel == null) { Debug.LogError("statusPanel == null"); } //find and get ref visualMappingPanel = GetAndCheckGameObject("VisualMappingPanel"); visualMappingUIHandler = visualMappingPanel.GetComponent <VisualMappingUIHandler>(); if (visualMappingUIHandler == null) { Debug.LogError("visualMappingUIHandler == null"); } //dataVarsTopPanel = GetAndCheckGameObject("DataVarsTopPanel"); SetupVRmenus(); TooltipHide(); //Make sure this is called to init the list of dataVar handlers DataVarUIHandler.InitializeListOfAll(); UIActionPromptInit(); }