public static Arbiter.CashChallenge ParseCashChallenge(JSONClass node)
        {
            if (node == null)
            {
                return(null);
            }

            Arbiter.CashChallenge.StatusType status = Arbiter.CashChallenge.StatusType.Unknown;

            switch (node["status"])
            {
            case "open":
                status = Arbiter.CashChallenge.StatusType.Open;
                break;

            case "busy":
                status = Arbiter.CashChallenge.StatusType.Busy;
                break;

            case "closed":
                status = Arbiter.CashChallenge.StatusType.Closed;
                break;

            default:
                Debug.LogError("Unknown status encountered: " + node["status"]);
                break;
            }

            Arbiter.CashChallengeWinner winner = ParseWinner(node["winner"]);
            Arbiter.CashChallenge       rv     = new Arbiter.CashChallenge(node["id"],
                                                                           node["score_to_beat"],
                                                                           node["entry_fee"],
                                                                           node["prize"],
                                                                           status,
                                                                           winner);

            return(rv);
        }
示例#2
0
 public CashChallenge(string id, string scoreToBeat, string entryFee, string prize, StatusType status, Arbiter.CashChallengeWinner winner)
 {
     this.id          = id;
     this.scoreToBeat = scoreToBeat;
     this.entryFee    = entryFee;
     this.prize       = prize;
     this.status      = status;
     this.winner      = winner;
 }