private void LoadConfig(string config)
    {
        this.m_Shop = JSON.Load(config).Make <CShop>();
        var shopItems = this.m_Shop.shopItems;

        for (int i = 0; i < shopItems.Length; i++)
        {
            if (i >= this.m_OpenShop.Count)
            {
                var roomInstantiate = GameObject.Instantiate(this.m_ShopItemPrefab);
                roomInstantiate.transform.SetParent(this.m_ShopContent.transform);
                roomInstantiate.transform.localPosition = Vector3.zero;
                roomInstantiate.transform.localRotation = Quaternion.identity;
                roomInstantiate.transform.localScale    = Vector3.one;
                this.m_OpenShop.Add(roomInstantiate);
            }
            var item   = shopItems[i];
            var sprite = CGameSetting.GetSprite(item.displaySprite);
            if (item.type == CShopItem.EShopType.FRAME)
            {
                this.m_OpenShop[i].Setup(i, sprite, item.value == CGameSetting.USER_FRAME, item.price, this.OnItemClick);
            }
            else if (item.type == CShopItem.EShopType.AVATAR)
            {
                this.m_OpenShop[i].Setup(i, sprite, item.value == CGameSetting.USER_AVATAR, item.price, this.OnItemClick);
            }
            else
            {
                this.m_OpenShop[i].Setup(i, sprite, item.isUsing, item.price, this.OnItemClick);
            }
        }
    }
示例#2
0
    public virtual void Setup(int frame, int avatar, string word)
    {
        // BG
        var bgPath = CGameSetting.BACKGROUND_PATHS[frame % CGameSetting.BACKGROUND_PATHS.Length];

        this.m_BackgroundImage.sprite = CGameSetting.GetSprite(bgPath);
        // UI
        this.m_AvatarImage.sprite = CGameSetting.GetAvatarSprite(avatar);
        this.m_WordText.text      = word;
        // ANIMATOR
        this.m_Animator.SetTrigger("IsShowUp");
    }