コード例 #1
0
    public override void OnReady()
    {
        ok_words.Clear();
        wrong_words.Clear();
        signal.SetActive(false);
        cards.Clear();
        Utils.RemoveAllChildsIn(container);
        ok = 0;
        base.OnReady();
        string story_id = Data.Instance.storiesData.activeContent.id;

        content = Data.Instance.gamesData.GetContent(story_id);

        StoriesData.Content story_content   = Data.Instance.storiesData.activeContent;
        GamesData.Content   gameDataContent = Data.Instance.gamesData.GetContent(story_content.id);
        List <string>       arr             = gameDataContent.GetContentFor(type, gameID);

        TextsData.Content tipContent = Data.Instance.daysData.GetTip("toca_empiezan_igual");
        int  id   = 0;
        bool isOk = true;

        foreach (string text in arr)
        {
            if (text == "-" || text.Contains("-"))
            {
                isOk = false;
            }
            else
            {
                string _text = GetParsedString(text);
                if (isOk)
                {
                    ok_words.Add(_text);
                }
                else
                {
                    wrong_words.Add(_text);
                }
                SimpleButton sb = Instantiate(simonCard);
                sb.transform.localScale = Vector2.one;

                // string _text = GetParsedString(text);
                Sprite sprite = Data.Instance.assetsData.GetContent(_text).sprite;
                sb.Init(id, sprite, _text, OnClicked);
                cards.Add(sb);
            }
            id++;
        }
        Utils.Shuffle(cards);
        foreach (SimpleButton sb in cards)
        {
            sb.transform.SetParent(container);
            sb.transform.localScale = Vector2.one;
        }

        Events.OnCharacterSay(tipContent, OnTipDone, tipContent.character_type);
    }
コード例 #2
0
    public override void OnReady()
    {
        signal.SetActive(false);
        field.text = "";
        cards.Clear();
        Utils.RemoveAllChildsIn(container);

        base.OnReady();
        string story_id = Data.Instance.storiesData.activeContent.id;

        content = Data.Instance.gamesData.GetContent(story_id);

        StoriesData.Content story_content   = Data.Instance.storiesData.activeContent;
        GamesData.Content   gameDataContent = Data.Instance.gamesData.GetContent(story_content.id);
        List <string>       arr             = gameDataContent.GetContentFor(type, gameID);

        field.text = "";
        TextsData.Content tipContent = Data.Instance.daysData.GetTip("cual_esDiferente");
        int  id   = 0;
        bool isOk = true;

        foreach (string text in arr)
        {
            if (id == 0)
            {
                wrongWord = text;
                AddCard(text); // agrega 2 bien:
            }
            else
            {
                okWord = text;
            }

            AddCard(text);
            id++;
        }
        Utils.Shuffle(cards);
        foreach (SimpleButton sb in cards)
        {
            sb.transform.SetParent(container);
            sb.transform.localScale = Vector2.one;
        }

        Events.OnCharacterSay(tipContent, OnTipDone, tipContent.character_type);
    }