Example #1
0
 private void _controlShop_Dispose()
 {
     if (_controlShop != null)
     {
         _controlShop.Dispose();
         _controlShop = null;
     }
 }
Example #2
0
        private void ControlShopButton_MouseLeave(object sender, MouseEventArgs e)
        {
            DoubleAnimation WidthAnimation = new DoubleAnimation();

            WidthAnimation.From     = ControlShop.Width;
            WidthAnimation.To       = 165;
            WidthAnimation.Duration = TimeSpan.FromSeconds(0.1);
            ControlShop.BeginAnimation(Border.WidthProperty, WidthAnimation);
        }
Example #3
0
    public void ShowWithData(SerializablePropertys dataRaw, SerializablePackages.Package package, CallBackClose onCloseShop, CallBackBuy onBuy)
    {
        // ShowWithDataOnGUi(dataRaw, package, onCloseShop);
        // Repair data
        // mOnCloseShop = onCloseShop;
        mOnBuy              = onBuy;
        m_dataRaw           = dataRaw;
        m_package           = package;
        m_indextItemSeleted = 0;
        var propertys = m_package.data;

        string[] m_s_Left  = new string[propertys.Count];
        string[] m_s_Right = new string[propertys.Count];
        for (int i = 0; i < propertys.Count; i++)
        {
            var slug = propertys[i].property;
            if (string.IsNullOrEmpty(slug))
            {
                m_s_Left[i] = "Item is empty";
            }
            else
            {
                var propertyData = m_dataRaw.PropertyBySlug(slug);
                m_s_Left[i] = NameOf(propertyData, slug);
            }
            var payBy = m_package.data[i].payBy;
            if (payBy == null)
            {
                m_s_Right[i] = "NULL";
            }
            else
            {
                m_s_Right[i] = payBy.coin.ToString() + " " + DefineAON.CoinName;
            }
        }
        // UI
        _controlShop_Dispose();
        if (_controlShop == null)
        {
            _controlShop = new ControlShop();
            _controlShop._btClose.onClick.Add(() =>
            {
                // _controlShop.Hide();
                _controlShop_Dispose();
                UnTryCostume(null);
                if (onCloseShop != null)
                {
                    var callback = onCloseShop;
                    onCloseShop  = null;
                    callback();
                }
            });
        }
        else
        {
            _controlShop.ResetListItem();
        }
        _controlShop.SetTitle(m_package.Name);
        for (int i = 0; i < m_s_Left.Length; i++)
        {
            int ii = i;
            var bt = _controlShop.AddItem(m_s_Left[i], m_s_Right[i], () =>
            {
                SetSelectItem(ii);
            });
        }
        m_indextItemSeleted = -1;
        RefreshDataSelect();
        _controlShop.ShowOn(InputFieldHelper.Instance.PopUp);
    }