public void changeOrder(object changedCombo) { rememberCombo comboToChange = (rememberCombo)changedCombo; string pathToSave = "distance=" + chosenSituationForRecord.distance + " and life=" + chosenSituationForRecord.lifeDiff + " and angle=" + chosenSituationForRecord.angle; /*int oldScore = (int)((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"])).Cast<DictionaryEntry>().ElementAt(0).Value; * ((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"])).Remove(comboToChange.id); * int howManyRows = ((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"])).Count; * for(int i=0; i<howManyRows; i++){ * //for(int i2=0; i2<((OrderedDictionary)(EchoRank.Select(pathToSave)[i]["echoCombo"])).Count; i2++) { * if(comboToChange.score>(int)((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"]))[i]) { * ((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"])).Insert(i, comboToChange.id, comboToChange.score); * break; * } * //} * }*/ int howManyRows = ((List <rememberCombo>)(EchoRank.Select(pathToSave)[0]["combo"])).Count; for (int i = 0; i < howManyRows; i++) { if (comboToChange.score > (int)((List <rememberCombo>)(EchoRank.Select(pathToSave)[0]["combo"]))[i].score) { ((List <rememberCombo>)(EchoRank.Select(pathToSave)[0]["combo"])).Insert(i, comboToChange); break; } } }
//tutaj wiele wiecej sciezek do zapisu public void addComboToEcho(object newCombo) { rememberCombo comboFromInput = (rememberCombo)newCombo; /*string pathToSave="distance="+ comboFromInput.situation.distance + " and life=" + comboFromInput.situation.lifeDiff + " and angle=" + comboFromInput.situation.angle; + + for(int i=0; i<((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"])).Count; i++) { + if(comboFromInput.score>(int)((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"]))[i]) { + ((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"])).Insert(i, comboFromInput.id, comboFromInput.score); + } + } */ Debug.Log(comboFromInput.situation.distance); //((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"])).Add(comboFromInput.id, comboFromInput.score); /*string pathToSave="distance="+ comboFromInput.situation.distance + " or life=" + comboFromInput.situation.lifeDiff + " or angle=" + comboFromInput.situation.angle; + + int howManyRows = EchoRank.Select(pathToSave).Length; + for(int i=0; i<howManyRows; i++){ + if(((OrderedDictionary)(EchoRank.Select(pathToSave)[i]["echoCombo"])).Count==0) { + ((OrderedDictionary)(EchoRank.Select(pathToSave)[i]["echoCombo"])).Add(comboFromInput.id, comboFromInput.score); + } else { + for(int i2=0; i2<((OrderedDictionary)(EchoRank.Select(pathToSave)[i]["echoCombo"])).Count; i2++) { + if(comboFromInput.score>(int)((OrderedDictionary)(EchoRank.Select(pathToSave)[i]["echoCombo"]))[i2]) { + ((OrderedDictionary)(EchoRank.Select(pathToSave)[i]["echoCombo"])).Insert(i2, comboFromInput.id, comboFromInput.score); + break; + } + } + } + + }*/ string pathToSave = "distance=" + comboFromInput.situation.distance + " or life=" + comboFromInput.situation.lifeDiff + " or angle=" + comboFromInput.situation.angle; int howManyRows = EchoRank.Select(pathToSave).Length; for (int i = 0; i < howManyRows; i++) { if (((List <rememberCombo>)(EchoRank.Select(pathToSave)[i]["combo"])).Count == 0) { ((List <rememberCombo>)(EchoRank.Select(pathToSave)[i]["combo"])).Add(comboFromInput); } else { for (int i2 = 0; i2 < ((List <rememberCombo>)(EchoRank.Select(pathToSave)[i]["combo"])).Count; i2++) { if (comboFromInput.score > (int)((List <rememberCombo>)(EchoRank.Select(pathToSave)[i]["combo"]))[i2].score) { ((List <rememberCombo>)(EchoRank.Select(pathToSave)[i]["combo"])).Insert(i2, comboFromInput); break; } } } } }
public InputControl.Combo getCombo() { /* string pathToSave="distance="+ actualSituation.distance + " and life=" + actualSituation.lifeDiff + " and angle=" + actualSituation.angle; + DictionaryEntry chosenEntry = ((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"])).Cast<DictionaryEntry>().ElementAt(0); + // string chosenID = (string)[0].Add(); + string chosenID = (string)chosenEntry.Key; + InputControl.Combo chosenCombo = GameObject.Find("Main Camera").GetComponent<InputControl>().everyCombo[chosenID]; + return chosenCombo;*/ /*string pathToSave="distance="+ actualSituation.distance + " or life=" + actualSituation.lifeDiff + " or angle=" + actualSituation.angle; + DictionaryEntry chosenEntry = ((OrderedDictionary)(EchoRank.Select(pathToSave)[0]["echoCombo"])).Cast<DictionaryEntry>().ElementAt(0); + for(int i=0; i<EchoRank.Select(pathToSave).Length; i++) { + if((int)chosenEntry.Value<(int)((OrderedDictionary)(EchoRank.Select(pathToSave)[i]["echoCombo"])).Cast<DictionaryEntry>().ElementAt(0).Value) { + chosenEntry = ((OrderedDictionary)(EchoRank.Select(pathToSave)[i]["echoCombo"])).Cast<DictionaryEntry>().ElementAt(0); + } + } + string chosenID = (string)chosenEntry.Key; + InputControl.Combo chosenCombo = GameObject.Find("Main Camera").GetComponent<InputControl>().everyCombo[chosenID]; + + chosenSituationForRecord = actualSituation; */ string pathToSave = "distance=" + actualSituation.distance + " or life=" + actualSituation.lifeDiff + " or angle=" + actualSituation.angle; //DictionaryEntry chosenEntry = ((List<rememberCombo>)(EchoRank.Select(pathToSave)[0]["combo"])).Cast<DictionaryEntry>().ElementAt(0); rememberCombo chosenEntry = ((List <rememberCombo>)(EchoRank.Select(pathToSave)[0]["combo"]))[0]; int chosenSituation = 0; for (int i = 0; i < EchoRank.Select(pathToSave).Length; i++) { if ((int)chosenEntry.score < (int)((List <rememberCombo>)(EchoRank.Select(pathToSave)[i]["combo"]))[0].score) { chosenEntry = ((List <rememberCombo>)(EchoRank.Select(pathToSave)[i]["combo"]))[0]; chosenSituation = i; } } ((List <rememberCombo>)(EchoRank.Select(pathToSave)[chosenSituation]["combo"])).RemoveAt(0); string chosenID = (string)chosenEntry.id; InputControl.Combo chosenCombo = GameObject.Find("Main Camera").GetComponent <InputControl>().everyCombo[chosenID]; chosenSituationForRecord = actualSituation; return(chosenCombo); }