Esempio n. 1
0
    //
    public TomeObject GetCard(string cardId)
    {
        TomeObject card = GetCrewCard(cardId) as TomeObject;

        if (card == null)
        {
            card = GetUnitCard(cardId) as TomeObject;
        }

        return(card);
    }
Esempio n. 2
0
    //
    public TomeObject GetCrewCard(string cardId)
    {
        TomeObject card = staticData["cardsCrew"][cardId] as TomeObject;

        if (card == null)
        {
            card = staticData["cardsPilot"][cardId] as TomeObject;
        }

        return(card);
    }
Esempio n. 3
0
    //
    public IEnumerator SetupCurrentGame(string gameId, Action <Exception> cb)
    {
        // Get new current game and set it to tCurrentGame
        Exception error = null;

        tCurrentGame = null;

        JObject queryGame = new JObject();

        queryGame.Add("topic", new JValue("game"));

        JObject indexGame = new JObject();

        indexGame.Add("gameId", new JValue(gameId));
        queryGame.Add("index", indexGame);

        JObject queryGameSecrets = new JObject();

        queryGameSecrets.Add("topic", new JValue("gameSecrets"));

        JObject indexGameSecrets = new JObject();

        indexGameSecrets.Add("userId", new JValue(GameSettings.UserId));
        queryGameSecrets.Add("index", indexGameSecrets);

        JObject queries = new JObject();

        queries.Add("tGame", queryGame);
        queries.Add("tGameSecrets", queryGameSecrets);

        mage.archivist.mget(queries, null, (Exception _error, JToken results) => {
            if (_error != null)
            {
                error = _error;
                return;
            }

            tCurrentGame        = (TomeObject)results["tGame"];
            tCurrentGameSecrets = (TomeObject)results["tGameSecrets"];
        });

        // Wait for response
        while (error == null && tCurrentGame == null)
        {
            yield return(null);
        }

        cb(error);
    }
Esempio n. 4
0
    //
    public TomeObject GetUnitCard(string cardId)
    {
        TomeObject card = staticData["cardsUnit"][cardId] as TomeObject;

        if (card == null)
        {
            card = staticData["cardsEvent"][cardId] as TomeObject;
        }
        if (card == null)
        {
            card = staticData["cardsCounter"][cardId] as TomeObject;
        }

        return(card);
    }
Esempio n. 5
0
    //
    public void CleanupCurrentGame()
    {
        if (tCurrentGame != null)
        {
            JObject gameIndex = new JObject();
            gameIndex.Add("gameId", new JValue((string)tCurrentGame["gameId"]));
            mage.archivist.DeleteCacheItem("game", gameIndex);
            tCurrentGame = null;
        }

        if (tCurrentGameSecrets != null)
        {
            JObject gameSecretsIndex = new JObject();
            gameSecretsIndex.Add("userId", new JValue(GameSettings.UserId));
            mage.archivist.DeleteCacheItem("gameSecrets", gameSecretsIndex);
            tCurrentGameSecrets = null;
        }
    }
 public void SetData(TomeObject cardData)
 {
     textObj.text = (string)cardData["description"][0];
     //textObj.text = cardData["description"][1];
 }