Esempio n. 1
0
    public JSONObject jsonify()
    {
        JSONObject json = new JSONObject(JSONObject.Type.OBJECT);

        json.AddField("name", name);
        json.AddField("location", JSONTemplates.FromVector2Int(location));
        json.AddField("level", regionLevel.ToString());
        if (tournament != null)
        {
            json.AddField("tournament", tournament.jsonify());
        }

        return(json);
    }
Esempio n. 2
0
    public JSONObject jsonify()
    {
        JSONObject json = new JSONObject(JSONObject.Type.OBJECT);

        json.AddField("position", JSONTemplates.FromVector2Int(position));
        json.AddField("name", regionName);
        json.AddField("landmass", landMass);
        json.AddField("capitolindex", capitolIndex);
        json.AddField("level", level.ToString());

        JSONObject distance = new JSONObject(JSONObject.Type.ARRAY);

        foreach (int key in distances.Keys)
        {
            JSONObject record = new JSONObject(JSONObject.Type.OBJECT);

            record.AddField("key", key);
            record.AddField("value", distances[key]);

            distance.Add(record);
        }
        json.AddField("distances", distance);

        JSONObject town = new JSONObject(JSONObject.Type.ARRAY);

        foreach (int index in townIndexes)
        {
            town.Add(index);
        }
        json.AddField("townindexes", town);

        JSONObject manager = new JSONObject(JSONObject.Type.ARRAY);

        foreach (int index in managerProtocolIndexes)
        {
            manager.Add(index);
        }
        json.AddField("managerindexes", manager);

        return(json);
    }
Esempio n. 3
0
 public void logBoxerStats(TournamentProtocol.Level boxerLevel)
 {
     Debug.Log("Acc " + accuracy + ", End " + endurance + ", Hlt " + health + ", spd " + speed + ", str " + strength + ", ftg " + fatigue +
               "AccG " + accuracyGrowth + ", EndG " + enduranceGrowth + ", HltG " + healthGrowth + ", SpdG " + speedGrowth + ", StrG " + strengthGrowth +
               ", Class " + boxerClass.ToString() + ", WR " + WeeksRemaining + ", " + boxerLevel.ToString() + ", W " + record.Wins + " L " + record.Losses
               );
 }
Esempio n. 4
0
 public string getDetails()
 {
     return(name + " - " + level.ToString() + " - " + prizes[0] + " - " + date + " - " + managerIndexes.Count + "/" + size);
 }
Esempio n. 5
0
 public void setupNode(TournamentProtocol.Level level, int qCount, int tCount)
 {
     uiElements[WeekNodeLabel.Rank].SetText(level.ToString());
     //uiElements[WeekNodeLabel.QualifierCount].SetText(qCount.ToString());
     //uiElements[WeekNodeLabel.TournamentCount].SetText(tCount.ToString());
 }
Esempio n. 6
0
    public JSONObject jsonify()
    {
        JSONObject json = new JSONObject(JSONObject.Type.OBJECT);

        json.AddField("weightclass", Class.ToString());

        json.AddField("boxerindex", boxerIndex);

        json.AddField("age", JSONTemplates.FromVector2Int(Age));
        json.AddField("firstname", FirstName);
        json.AddField("lastname", LastName);
        json.AddField("townindex", TownIndex);
        json.AddField("weight", Weight);
        json.AddField("weeksremaining", WeeksRemaining);

        json.AddField("preference", preference.ToString());
        json.AddField("record", record.jsonify());

        json.AddField("atsea", atSea);
        json.AddField("attournament", atTournament);
        json.AddField("homebase", homebase.jsonify());
        json.AddField("ship", ship.jsonify());
        json.AddField("finance", finance.jsonify());

        json.AddField("boxerelo", currentBoxerELO);
        json.AddField("managerelo", currentManagerELO);

        json.AddField("record", record.jsonify());
        json.AddField("tournamentsattended", tournamentCount);
        json.AddField("priority", tournamentPriority);
        json.AddField("rank", currentRanking.ToString());

        JSONObject regime = new JSONObject(JSONObject.Type.ARRAY);

        foreach (ManagerProtocol.FacilityShortcut facility in trainingRegime)
        {
            regime.Add(facility.ToString());
        }
        json.AddField("trainingregime", regime);

        JSONObject archivedBoxer = new JSONObject(JSONObject.Type.ARRAY);

        foreach (float elo in archivedBoxerELO)
        {
            archivedBoxer.Add(elo);
        }
        json.AddField("archivedboxerelo", archivedBoxer);

        JSONObject archivedManager = new JSONObject(JSONObject.Type.ARRAY);

        foreach (float elo in archivedManagerELO)
        {
            archivedManager.Add(elo);
        }
        json.AddField("archivedmanagerelo", archivedManager);

        JSONObject prevOpp = new JSONObject(JSONObject.Type.ARRAY);

        foreach (int index in previousOpponents)
        {
            prevOpp.Add(index);
        }
        json.AddField("previousopponents", prevOpp);

        JSONObject consume = new JSONObject(JSONObject.Type.ARRAY);

        foreach (Consumable c in consumables)
        {
            consume.Add(c.jsonify());
        }
        json.AddField("consumables", consume);

        JSONObject arm = new JSONObject(JSONObject.Type.ARRAY);

        foreach (Arm a in arms)
        {
            arm.Add(a.jsonify());
        }
        json.AddField("arms", arm);

        JSONObject leg = new JSONObject(JSONObject.Type.ARRAY);

        foreach (Legs l in legs)
        {
            leg.Add(l.jsonify());
        }
        json.AddField("legs", leg);

        JSONObject impl = new JSONObject(JSONObject.Type.ARRAY);

        foreach (Implant i in implants)
        {
            impl.Add(i.jsonify());
        }
        json.AddField("implants", impl);

        return(json);
    }
Esempio n. 7
0
 public static Tournament createQuarterlyTournament(TournamentProtocol.Level level, CalendarDate date)
 {
     return(new Tournament("Regional " + level.ToString() + " Qualifier", date, getPrizeMoney(level) + 1000.0f, 16, level, true));
 }