예제 #1
0
    public void callSong(NetworkPlayer player, string name, string subtitle, int step, int difficulty, int level)
    {
        if(!isSearching)
        {
            var theSIP = new SongInfoProfil(name, subtitle, step, (Difficulty)difficulty, level);
            if(lastSongChecked.Equals(default(KeyValuePair<Difficulty, Dictionary<Difficulty, Song>>)) || !lastSongChecked.Value[lastSongChecked.Key].sip.CompareId(theSIP))
            {
                for(int i=0; i < LANManager.Instance.players.Count; i++)
                {
                    LANManager.Instance.players.ElementAt(i).Value.songChecked = 0;
                }
                isSearching = true;
                networkView.RPC("setSearching", RPCMode.Others, true);
                networkView.RPC ("checkSong", RPCMode.Others, name, subtitle, step, difficulty, level);
                playerSearching = player;
                lastSongChecked = LoadManager.Instance.FindSong(theSIP);
                LANManager.Instance.players[Network.player].songChecked = lastSongChecked.Equals(default(KeyValuePair<Difficulty, Dictionary<Difficulty, Song>>)) ? 2 : 1;

            }else
            {
                isSearching = true;
                playerSearching = player;
            }

        }
    }
예제 #2
0
 public SongInfoProfil FindTheSongStat(SongInfoProfil sip)
 {
     if(currentProfile.scoreOnSong.Count > 0){
         var fod = currentProfile.scoreOnSong.FirstOrDefault(c => c.CompareId(sip));
         return fod;
     }
     return null;
 }
예제 #3
0
 public void saveASong(SongInfoProfil sip, float scoreEarned, double speedmodPref, bool fail)
 {
     SongInfoProfil thesip = sip.Copy();
     thesip.score = scoreEarned;
     thesip.speedmodpref = speedmodPref;
     thesip.fail = fail;
     if(scoreOnSong.Any(c => c.CompareId(thesip))){
         var theold = scoreOnSong.FirstOrDefault(c => c.CompareId(thesip));
         if(theold.score < scoreEarned){
             scoreOnSong.Remove(theold);
             scoreOnSong.Add(thesip);
         }else{
             theold.speedmodpref = speedmodPref;
         }
     }else{
         scoreOnSong.Add(thesip);
     }
 }
예제 #4
0
    public KeyValuePair<double, string> FindTheBestScore(SongInfoProfil sip)
    {
        double score = -1;
        var name = "-";
        var others = 0;
        for(int i=0;i<profiles.Count;i++){
            var fod = profiles[i].scoreOnSong.FirstOrDefault(c => c.CompareId(sip));
            if(fod != null && !fod.fail){
                if(score < fod.score){
                    score = fod.score;
                    name = profiles[i].name;
                    others = 0;
                }else if(score == fod.score){
                    others++;
                }
            }
        }

        if(others > 0) name += "\n(+ " + others + ")";
        return new KeyValuePair<double, string>(score, name);
    }
예제 #5
0
    public void transfertSave(Song s, string packname, string songname)
    {
        this.packName = packname;
        this.songFileName = songname;
        this.title = s.title;
        this.subtitle = s.subtitle;
        this.artist = s.artist;
        this.banner = s.banner;
        this.bpmToDisplay = s.bpmToDisplay;
        this.background = s.background;
        this.offset = s.offset;
        this.samplestart = s.samplestart;
        this.samplelenght = s.samplelenght;
        this.mesureBPMS = s.mesureBPMS;
        this.mesureSTOPS = s.mesureSTOPS;

        this.stepartist = s.stepartist;
        this.difficulty = s.difficulty;

        for(int i=0; i<s.bpms.Count; i++){
            this.bpmsKey.Add(s.bpms.ElementAt(i).Key);
            this.bpmsValue.Add(s.bpms.ElementAt(i).Value);
        }

        for(int i=0; i<s.stops.Count; i++){
            this.stopsKey.Add(s.stops.ElementAt(i).Key);
            this.stopsValue.Add(s.stops.ElementAt(i).Value);
        }

        this.level = s.level;
        this.numberOfSteps = s.numberOfSteps;
        this.numberOfStepsWithoutJumps = s.numberOfStepsWithoutJumps;
        this.numberOfStepsAbsolute = s.numberOfStepsAbsolute;
        this.numberOfFreezes = s.numberOfFreezes;
        this.numberOfRolls = s.numberOfRolls;
        this.numberOfMines = s.numberOfMines;
        this.numberOfJumps = s.numberOfJumps;
        this.numberOfHands = s.numberOfHands;
        this.duration = s.duration;
        this.intensityGraph = s.intensityGraph;
        this.stepPerSecondAverage = s.stepPerSecondAverage;
        this.stepPerSecondMaximum = s.stepPerSecondMaximum;
        this.stepPerSecondStream = s.stepPerSecondStream;
        this.longestStream = s.longestStream;
        this.numberOfCross = s.numberOfCross;
        this.numberOfFootswitch = s.numberOfFootswitch;
        this.song = s.song;
        this.sip = s.sip;
        this.stepchart = s.stepchart;
        this.distanceRed = s.distanceRed;
    }
예제 #6
0
 public bool CompareId(SongInfoProfil sid)
 {
     return sid.songName == this.songName && sid.subtitle == this.subtitle &&
         sid.numberOfSteps == this.numberOfSteps && sid.difficulty == this.difficulty &&
             sid.level == this.level;
 }
예제 #7
0
 public int SearchPlaceOnSong(SongInfoProfil sip, float scoreEarned)
 {
     var allChallenger = profiles.Where(c => c.scoreOnSong.Any(d => d.CompareId(sip))).OrderByDescending(c => c.scoreOnSong.FirstOrDefault(d => d.CompareId(sip)).score).ToList();
     var thesip = FindTheSongStat(sip);
     if(allChallenger.Count <= 1){
         if(thesip != null && scoreEarned > thesip.score) return 0;
         return -1;
     }else if(scoreEarned > thesip.score){
         if(allChallenger.ElementAt(0).scoreOnSong.FirstOrDefault(d => d.CompareId(sip)).score <= scoreEarned){
             return 1;
         }
         if(allChallenger.ElementAt(1).scoreOnSong.FirstOrDefault(d => d.CompareId(sip)).score <= scoreEarned){
             return 2;
         }
         if(allChallenger.ElementAt(2).scoreOnSong.FirstOrDefault(d => d.CompareId(sip)).score <= scoreEarned){
             return 3;
         }
         return 0;
     }
     return -1;
 }