Ejemplo n.º 1
0
	private void InitializeBarGraph () {
		if (barGraph == null) {
			barGraph = gameObject.AddComponent<BarGraph> ().GetComponent<BarGraph> ();

			//first object must be target, then default 
			barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_target_string, manager);
			barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_default_string, manager);
		}
	}
Ejemplo n.º 2
0
	private void GenerateBarGraph ()
	{
		if (barGraph == null) {
			barGraph = gameObject.AddComponent<BarGraph> ().GetComponent<BarGraph> ();

			//first object must be target, then default 
			barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_target_string, manager);
			barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_default_string, manager);

			//followed by all of the player's prior attempts
			for (int i = 0; i < attemptCount; i++) {
				barGraph.InputToCSVObject (attemptList [i].csv_string, manager);
			}
		}
		barGraph.SetActive (true);

	}
    public void ProcessConvergeNewAttempt(NetworkResponse response)
    {
        ConvergeAttempt            attempt;
        ResponseConvergeNewAttempt args = response as ResponseConvergeNewAttempt;

        attempt = args.attempt;

        //if the submission resulted in a valid attempt, add to attempt list and reinitialize
        //currAttempt for next attempt.  Otherwise, keep current attempt
        if (attempt != null && attempt.attempt_id != Constants.ID_NOT_SET)
        {
            currAttempt.attempt_id = attempt.attempt_id;
            currAttempt.SetCSV(attempt.csv_string);
            attemptList.Add(currAttempt);
            attemptCount = attemptList.Count;

            //calculate score and send back to server.
            CSVObject target = ecosystemList[ecosystem_idx].csv_target_object;
            int       score  = currAttempt.csv_object.CalculateScore(target);
            NetworkManager.Send(
                ConvergeNewAttemptScoreProtocol.Prepare(
                    player_id,
                    ecosystem_id,
                    attempt.attempt_id,
                    score
                    ),
                ProcessConvergeNewAttemptScore
                );

            //update pertinent variables with new data
            if (currAttempt.hint_id != Constants.ID_NOT_SET)
            {
                priorHintIdList.Add(currAttempt.hint_id);
            }
            //need to recalc reset slider config due to additional attempt
            isResetSliderInitialized = false;

            if (barGraph != null)
            {
                barGraph.InputToCSVObject(currAttempt.csv_string, manager);
            }

            currAttempt = new ConvergeAttempt(
                player_id,
                ecosystem_id,
                attempt.attempt_id + 1,
                allowHintsMaster,
                Constants.ID_NOT_SET,
                attempt.config,
                null,
                manager
                );

            FinalizeAttemptUpdate(attemptCount - 1, false);
        }
        else
        {
            Debug.LogError("Submission of new attempt failed to produce results.");
            SetIsProcessing(false);
        }
    }
Ejemplo n.º 4
0
    private void GenerateBarGraph()
    {
        if (barGraph == null) {
            barGraph = gameObject.AddComponent<BarGraph> ().GetComponent<BarGraph> ();

            //first object must be target, then default
            barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_target_string, manager);
            barGraph.InputToCSVObject (ecosystemList [ecosystem_idx].csv_default_string, manager);

            //followed by all of the player's prior attempts
            for (int i = 0; i < attemptCount; i++) {
                barGraph.InputToCSVObject (attemptList [i].csv_string, manager);
            }
        }
        barGraph.SetActive (true);
    }