예제 #1
0
    public static GameCommand GenerateSyncDiceCommand()
    {
        JSONObject[] diceResultArray = new JSONObject[DiceRoll.CurrentDiceRoll.DiceList.Count];
        for (int i = 0; i < DiceRoll.CurrentDiceRoll.DiceList.Count; i++)
        {
            DieSide    side     = DiceRoll.CurrentDiceRoll.DiceList[i].Side;
            string     sideName = side.ToString();
            JSONObject sideJson = new JSONObject();
            sideJson.AddField("side", sideName);
            diceResultArray[i] = sideJson;
        }
        JSONObject dieSides   = new JSONObject(diceResultArray);
        JSONObject parameters = new JSONObject();

        parameters.AddField("sides", dieSides);

        return(GameController.GenerateGameCommand(
                   GameCommandTypes.SyncDiceResults,
                   Phases.CurrentSubPhase.GetType(),
                   parameters.ToString()
                   ));
    }
예제 #2
0
    public DiceStatsEntry(DiceKind diceKind, DieSide dieSide, PlayerDiceStats playerStats, StatsViewScript script)
    {
        DiceKind    = diceKind;
        DieSide     = dieSide;
        PlayerStats = playerStats;

        if (script != null)
        {
            Text = script.transform.Find(DiceKind.ToString()).Find("P" + Tools.PlayerToInt(PlayerStats.PlayerNo)).Find(DieSide.ToString()).GetComponent <Text>();
        }
    }