public void InputToCSVObject(string text, ConvergeManager convergeManager = null) { this.convergeManager = convergeManager; CSVObject csvObject = Functions.ParseCSV(text); CreateSeriesSet(csvObject); }
//Factory method for creating new Database component with specified mode public static Database NewDatabase(GameObject gameObject, int mode, ConvergeManager manager) { Database thisObj = gameObject.AddComponent<Database> ().GetComponent<Database> (); //calls Start() on the object and initializes it. thisObj.mode = mode; thisObj.manager = manager; return thisObj; }
//Factory method for creating new View component with specified mode and manager public static View NewView(GameObject gameObject, int mode, ConvergeManager manager) { View thisObj = gameObject.AddComponent<View> ().GetComponent<View> (); //calls Start() on the object and initializes it. thisObj.mode = mode; thisObj.manager = manager; return thisObj; }
//Factory method for creating new Database component with specified mode public static Database NewDatabase(GameObject gameObject, int mode, ConvergeManager manager) { Database thisObj = gameObject.AddComponent <Database> ().GetComponent <Database> (); //calls Start() on the object and initializes it. thisObj.mode = mode; thisObj.manager = manager; return(thisObj); }
//Factory method for creating new View component with specified mode and manager public static View NewView(GameObject gameObject, int mode, ConvergeManager manager) { View thisObj = gameObject.AddComponent <View> ().GetComponent <View> (); //calls Start() on the object and initializes it. thisObj.mode = mode; thisObj.manager = manager; return(thisObj); }
private bool isActiveLegend = false; //disabled permanently public GraphsCompare( CSVObject csv1, CSVObject csv2, float left, float top, float pageWidth, float height, string title1, string title2, int xNumMarkers, Database foodWeb, ConvergeManager manager ) { this.left = left; this.top = top; this.height = height; if (isActiveLegend) { widthGraph = (pageWidth - widthLegend - (bufferGraph * 2)) / 2; } else { widthGraph = (pageWidth - (bufferGraph * 2)) / 2;; } this.foodWeb = foodWeb; //object for handling common graph control info this.manager = manager; graph1 = new GraphUnit( csv1, left, top, widthGraph, height, title1, xNumMarkers, manager, true ); graph2 = new GraphUnit( csv2, left + widthGraph + bufferGraph, top, widthGraph, height, title2, xNumMarkers, manager, false ); NormalizeYScale(); }
public GraphsCompare( CSVObject csv1, CSVObject csv2, float left, float top, float pageWidth, float height, string title1, string title2, int xNumMarkers, Database foodWeb, ConvergeManager manager ) { this.left = left; this.top = top; this.height = height; if (isActiveLegend) { widthGraph = (pageWidth - widthLegend - (bufferGraph * 2)) / 2; } else { widthGraph = (pageWidth - (bufferGraph * 2)) / 2;; } this.foodWeb = foodWeb; //object for handling common graph control info this.manager = manager; graph1 = new GraphUnit ( csv1, left, top, widthGraph, height, title1, xNumMarkers, manager, true ); graph2 = new GraphUnit ( csv2, left + widthGraph + bufferGraph, top, widthGraph, height, title2, xNumMarkers, manager, false ); NormalizeYScale (); }
public GraphUnit( CSVObject csv, float left, float top, float width, float height, string title, int xNumMarkers, ConvergeManager convergeManager, bool isFirstGraph ) { this.csv = csv; this.labels = this.csv.xLabels; this.left = left + (isFirstGraph ? 0 : yLabelingWidth / 2); this.top = top; this.width = width + (isFirstGraph ? yLabelingWidth / 2 : - yLabelingWidth / 2); this.height = height; this.title = title; this.xNumMarkers = xNumMarkers; this.convergeManager = convergeManager; this.isFirstGraph = isFirstGraph; xTitle = "Month"; yTitle = "Score"; yTitle = "Biomass"; seriesList = new Dictionary<string, Series> (); graphRect = new Rect (this.left, this.top, this.width, this.height); hStart = new Vector2 ((isFirstGraph ? yLabelingWidth : 0) + bufferBorder, graphRect.height - 35); hEnd = new Vector2 (graphRect.width - bufferBorder, hStart.y); xAxisLength = Vector2.Distance (hStart, hEnd); // * 0.95f; xUnitLength = xAxisLength / xNumMarkers; vStart = new Vector2 (hStart.x, hStart.y); vEnd = new Vector2 (vStart.x, bufferBorder); yAxisLength = Vector2.Distance (vStart, vEnd); // * 0.95f; yUnitLength = yAxisLength / yNumMarkers; lineMarkerTex = Resources.Load<Texture2D> ("chart_dot"); font = Resources.Load<Font> ("Fonts/" + "Chalkboard"); UpdateData (); }
public GraphUnit( CSVObject csv, float left, float top, float width, float height, string title, int xNumMarkers, ConvergeManager convergeManager, bool isFirstGraph ) { this.csv = csv; this.labels = this.csv.xLabels; this.left = left + (isFirstGraph ? 0 : yLabelingWidth / 2); this.top = top; this.width = width + (isFirstGraph ? yLabelingWidth / 2 : -yLabelingWidth / 2); this.height = height; this.title = title; this.xNumMarkers = xNumMarkers; this.convergeManager = convergeManager; this.isFirstGraph = isFirstGraph; xTitle = "Month"; yTitle = "Score"; yTitle = "Biomass"; seriesList = new Dictionary <string, Series> (); graphRect = new Rect(this.left, this.top, this.width, this.height); hStart = new Vector2((isFirstGraph ? yLabelingWidth : 0) + bufferBorder, graphRect.height - 35); hEnd = new Vector2(graphRect.width - bufferBorder, hStart.y); xAxisLength = Vector2.Distance(hStart, hEnd); // * 0.95f; xUnitLength = xAxisLength / xNumMarkers; vStart = new Vector2(hStart.x, hStart.y); vEnd = new Vector2(vStart.x, bufferBorder); yAxisLength = Vector2.Distance(vStart, vEnd); // * 0.95f; yUnitLength = yAxisLength / yNumMarkers; lineMarkerTex = Resources.Load <Texture2D> ("chart_dot"); font = Resources.Load <Font> ("Fonts/" + "Chalkboard"); UpdateData(); }
void Awake() { seriesSets = new List <SeriesSet> (); csvList = new List <CSVObject> (); convergeManager = null; title = "Progress Report: Average Biomass Difference from Target"; xTitle = "Attempt #"; yTitle = "Biomass Difference"; left = (Screen.width - width) / 2; top = 100; windowRect = new Rect(left, top, width, height); graphRect = new Rect(20, 30, 650, 325); sliderRect = new Rect( graphRect.x + (graphRect.width / 2) - 100, graphRect.x + graphRect.height + 20, 200, 30 ); hStart = new Vector2(85, graphRect.height - 75); hEnd = new Vector2(graphRect.width - 50, hStart.y); xAxisLength = Vector2.Distance(hStart, hEnd) * 0.95f; xUnitLength = xAxisLength / xNumMarkers; interBarWidth = (xAxisLength - (barWidth * perPage)) / perPage; vStart = new Vector2(hStart.x, hStart.y); vEnd = new Vector2(vStart.x, 30); yAxisLength = Vector2.Distance(vStart, vEnd) * 0.95f; yUnitLength = yAxisLength / yNumMarkers; lineMarkerTex = Resources.Load <Texture2D> ("chart_dot"); barTexture = Functions.CreateTexture2D(Color.white); barLegend = new BarLegend(new Rect(width - 200 - 20, 30, 200, 325), this); //gameObject.AddComponent<GraphInput>().graph = this; jtc-commented out // DH change scores = new List <int>(); // arraylist of scores, starting from initial }
public ConvergeAttempt(int player_id, int ecosystem_id, int attempt_id, bool allow_hints, int hint_id, string config, string csv_string, ConvergeManager manager ) { this.player_id = player_id; this.ecosystem_id = ecosystem_id; this.attempt_id = attempt_id; this.allow_hints = allow_hints; this.hint_id = hint_id; this.config = config; SetCSV(csv_string); this.seriesParams = null; }
//update variables and graph configuration as necessary with updated attempt info private void FinalizeAttemptUpdate(int attemptIdx, bool newEcosystem) { referenceAttemptIdx = attemptIdx; if (newEcosystem) { manager = new ConvergeManager(); } //refresh or replace graphs as appropriate GenerateGraphs(newEcosystem); //extract data entry field data //note: has dependency on manager info generated in graphs, //so has to appear following GenerateGraphs currAttempt.ParseConfig(manager); SetIsProcessing(false); }
//separate out parameter value information from configuration string //note: link level parameters are not supported in this implementation public void ParseConfig(ConvergeManager manager) { this.manager = manager; this.seriesParams = new Dictionary <string, ConvergeParam>(); string remainder = config; int nodeCnt = 0; int nodeId; int start, end, nodeIdx; int paramCnt; float value, valNotNeeded; string name; string paramId; //sequence is nodeCnt,[node0],biomass0,perunitbiomass0,paramCnt0,(if any)paramID0,value0,paramID1,value1,... //[node1],biomass1,perunitbiomass1,paramCnt1,...,[nodeN],biomassN,... if (remainder != null) { //"nodeCnt," nodeCnt = int.Parse(remainder.Substring(0, remainder.IndexOf(","))); } for (int i = 0; i < nodeCnt; i++) { //"[node_Id(i)],biomass(i)," start = remainder.IndexOf("["); end = remainder.IndexOf("],"); nodeId = int.Parse(remainder.Substring(start + 1, end - start - 1)); nodeIdx = manager.seriesNodes.IndexOf(nodeId); name = manager.seriesLabels[nodeIdx]; remainder = remainder.Substring(end + 2); //"]," end = remainder.IndexOf(","); valNotNeeded = float.Parse(remainder.Substring(0, end)); //biomass remainder = remainder.Substring(end + 1); end = remainder.IndexOf(","); valNotNeeded = float.Parse(remainder.Substring(0, end)); //per-unit-biomass remainder = remainder.Substring(end + 1); end = remainder.IndexOf(","); //get counts of node parameters for current node paramCnt = int.Parse(remainder.Substring(0, end)); remainder = remainder.Substring(end + 1); //get node parameters for (int j = 0; j < paramCnt; j++) { //"paramID(j)=value(j)," start = remainder.IndexOf("="); paramId = remainder.Substring(0, start).ToUpper(); end = remainder.IndexOf(","); value = float.Parse(remainder.Substring(start + 1, end - start - 1)); remainder = remainder.Substring(end + 1); ConvergeParam param = new ConvergeParam(name, nodeId, paramId, value); seriesParams.Add(param.nodeIdParamId, param); } //get link parameters end = remainder.IndexOf(","); if (end == Constants.ID_NOT_SET) { end = remainder.Length; } paramCnt = int.Parse(remainder.Substring(0, end)); if (paramCnt != 0) { Debug.LogError("Error in ConvergeAttempt::ParseConfig() - link parameters found but not supported."); } } }
public void InputToCSVObject(string text, ConvergeManager convergeManager = null) { this.convergeManager = convergeManager; CSVObject csvObject = Functions.ParseCSV (text); CreateSeriesSet (csvObject); }
//update variables and graph configuration as necessary with updated attempt info private void FinalizeAttemptUpdate(int attemptIdx, bool newEcosystem) { referenceAttemptIdx = attemptIdx; if (newEcosystem) { manager = new ConvergeManager (); } //refresh or replace graphs as appropriate GenerateGraphs (newEcosystem); //extract data entry field data //note: has dependency on manager info generated in graphs, //so has to appear following GenerateGraphs currAttempt.ParseConfig (manager); SetIsProcessing (false); }
//separate out parameter value information from configuration string //note: link level parameters are not supported in this implementation public void ParseConfig(ConvergeManager manager) { //this.manager = manager; this.seriesParams = new Dictionary<string, ConvergeParam>(); string remainder = config; int nodeCnt = 0; int nodeId; int start, end, nodeIdx; int paramCnt; float value, valNotNeeded; string name; string paramId; //sequence is nodeCnt,[node0],biomass0,perunitbiomass0,paramCnt0,(if any)paramID0,value0,paramID1,value1,... //[node1],biomass1,perunitbiomass1,paramCnt1,...,[nodeN],biomassN,... if (remainder != null) { //"nodeCnt," nodeCnt = int.Parse(remainder.Substring(0, remainder.IndexOf(","))); } for (int i = 0; i < nodeCnt; i++) { //"[node_Id(i)],biomass(i)," start = remainder.IndexOf("["); end = remainder.IndexOf("],"); nodeId = int.Parse(remainder.Substring(start + 1, end - start - 1)); nodeIdx = manager.seriesNodes.IndexOf (nodeId); name = manager.seriesLabels[nodeIdx]; remainder = remainder.Substring(end + 2); //"]," end = remainder.IndexOf(","); valNotNeeded = float.Parse(remainder.Substring(0, end)); //biomass remainder = remainder.Substring(end + 1); end = remainder.IndexOf(","); valNotNeeded = float.Parse(remainder.Substring(0, end)); //per-unit-biomass remainder = remainder.Substring(end + 1); end = remainder.IndexOf(","); //get counts of node parameters for current node paramCnt = int.Parse(remainder.Substring(0, end)); remainder = remainder.Substring(end + 1); //get node parameters for (int j = 0; j < paramCnt; j++) { //"paramID(j)=value(j)," start = remainder.IndexOf("="); paramId = remainder.Substring(0, start).ToUpper(); end = remainder.IndexOf(","); value = float.Parse(remainder.Substring(start + 1, end - start - 1)); remainder = remainder.Substring(end + 1); ConvergeParam param = new ConvergeParam (name, nodeId, paramId, value); seriesParams.Add (param.nodeIdParamId, param); } //get link parameters end = remainder.IndexOf(","); if (end == Constants.ID_NOT_SET) { end = remainder.Length; } paramCnt = int.Parse(remainder.Substring(0, end)); if (paramCnt != 0) { Debug.LogError ("Error in ConvergeAttempt::ParseConfig() - link parameters found but not supported."); } } }