Пример #1
0
    // Start is called before the first frame update
    void Start()
    {
        int categoryId = GlobalStorage.CurrentCategory;

        string categoryTitleImge = string.Format(@"images/category-title-{0}", categoryId);

        categorySprite.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(categoryTitleImge);

        CommonButton button = categorySprite.GetComponent <CommonButton>();

        button.SetCallback(() => { this.EnterCategory(); });

        leftArror.SetActive(categoryId > 1);
        rightArror.SetActive(categoryId < 3);

        leftArror.GetComponent <CommonButton>().SetCallback(() => { this.ChangeCategory(false); });
        rightArror.GetComponent <CommonButton>().SetCallback(() => { this.ChangeCategory(true); });
    }
Пример #2
0
    // Start is called before the first frame update
    void Start()
    {
        CommonButton button = enterGameButton.GetComponent <CommonButton>();

        button.SetCallback(() => { this.EnterGame(); });

        Debug.Log("Application.persistentDataPath: " + Application.persistentDataPath);

        if (GlobalStorage.LoadGameData() == null)
        {
            // Create a new GameData
            GameData data = new GameData();
            data.RevealCount = 0;
            GlobalStorage.SaveGame(data);
        }

        var backgroundImage = string.Format(@"images/welcome_{0}", Random.Range(1, 4));

        background.GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(backgroundImage);
    }