示例#1
0
    //Put content everything into SequenceTerm classes
    List <SequenceTerm> convertCSV(List <string[]> inputString)
    {
        List <SequenceTerm> listToReturn = new List <SequenceTerm>();

        foreach (string[] thisLine in inputString)
        {
            if (thisLine.Length > 1)
            {
                SequenceTerm termToAdd;
                if (useImages)
                {
                    if (thisLine[1][0] == ' ')
                    {
                        thisLine[1] = thisLine[1].Substring(1, thisLine[1].Length - 1);
                    }
                    string imgPathToUse = directoryForAssignment + "/" + thisLine[1].ToLower() + ".png";
                    imgPathToUse = imgPathToUse.Replace("\"", "");
                    termToAdd    = new SequenceTerm(thisLine, imgPathToUse);                 //, newImg);
                }
                else
                {
                    termToAdd = new SequenceTerm(thisLine);
                }
                termToAdd.mastery = ((int)Mathf.Ceil(((float)(currMastery / 100f)) * requiredMastery));
                listToReturn.Add(termToAdd);
            }
        }
        return(listToReturn);
    }
示例#2
0
    public void configureGame(int thisInt)
    {
        assignIndex = thisInt;
        Assignment assignToUse = AppManager.s_instance.currentAssignments[assignIndex];

        matrixOfCSVData = parseContent(AppManager.s_instance.currentAssignments[assignIndex].content);
        useImages       = AppManager.s_instance.currentAssignments[assignIndex].hasImages;
        if (useImages)
        {
            directoryForAssignment = AppManager.s_instance.currentAssignments[assignIndex].imgDir;
        }
        myCanvas           = GameObject.Find("Canvas").GetComponent <Canvas>();
        screenWidth        = myCanvas.GetComponent <RectTransform> ().rect.width;
        submitButton       = GameObject.Find("SubmitButton");    //TODO GET RID OF ALL .FINDS
        scaleFactor        = GameObject.Find("Canvas").GetComponent <Canvas> ().scaleFactor;
        greenCheck         = GameObject.Find("greenCheck").GetComponent <PopUpGraphic> ();
        parentCanvas       = GameObject.FindGameObjectWithTag("shaker");
        draggableGUIHolder = GameObject.Find("DraggableGUIHolder");
        redX = GameObject.Find("redX").GetComponent <PopUpGraphic> ();
        Input.multiTouchEnabled = true;

        //list init
        allTerms = new List <SequenceTerm> ();                //use this to store per sequence mastery values
        randomizedListSequences = new List <SequenceTerm> (); //can remove from this list once mastered

        //parsing

        for (int i = 0; i < matrixOfCSVData.Count; i++)           //fill out list of Sequence class instances
        {
            SequenceTerm tempSequence = new SequenceTerm();
            tempSequence.initIndex      = i;
            tempSequence.arrayOfStrings = matrixOfCSVData[i];
            allTerms.Add(tempSequence);
        }
        for (int i = 0; i < allTerms.Count; i++)
        {
            totalMastery += requiredMastery;
        }

        PropagateMastery(assignToUse);

        List <SequenceTerm> tempListSequences = new List <SequenceTerm>(allTerms);        //copy list

        while (tempListSequences.Count > 0)                                               //shuffle list
        {
            int randomIndex = Mathf.FloorToInt(Random.Range(0, tempListSequences.Count)); //r.Next(0, inputList.Count); //Choose a random object in the list
            randomizedListSequences.Add(tempListSequences[randomIndex]);                  //add it to the new, random list
            tempListSequences.RemoveAt(randomIndex);                                      //remove to avoid duplicates
        }
        CheckForSequenceMastery();

        readyToConfigure = true;
    }
示例#3
0
 //Put content everything into SequenceTerm classes
 List<SequenceTerm> convertCSV(List<string[]> inputString)
 {
     List<SequenceTerm> listToReturn = new List<SequenceTerm>();
     foreach(string[] thisLine in inputString){
         if(thisLine.Length > 1){
             SequenceTerm termToAdd;
             if(useImages){
                 if(thisLine[1][0] == ' '){
                     thisLine[1] = thisLine[1].Substring(1,thisLine[1].Length-1);
                 }
                 string imgPathToUse =  directoryForAssignment + "/" + thisLine[1].ToLower() + ".png";
                 imgPathToUse = imgPathToUse.Replace("\"", "");
                 termToAdd = new SequenceTerm(thisLine, imgPathToUse);//, newImg);
             }else{
                 termToAdd = new SequenceTerm(thisLine);
             }
             termToAdd.mastery = ((int)Mathf.Ceil(((float)(currMastery/100f))*requiredMastery));
             listToReturn.Add(termToAdd);
         }
     }
     return listToReturn;
 }