예제 #1
0
    static int getActuallyCost(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        FashionShopConfigItem obj = (FashionShopConfigItem)LuaScriptMgr.GetNetObjectSelf(L, 1, "FashionShopConfigItem");
        int  arg0 = (int)LuaScriptMgr.GetNumber(L, 2);
        uint arg1;
        uint o = obj.getActuallyCost(arg0, out arg1);

        LuaScriptMgr.Push(L, o);
        LuaScriptMgr.Push(L, arg1);
        return(2);
    }
예제 #2
0
    void OnClickSelectBuy(GameObject go)
    {
        UILabel costLabel = go.transform.parent.FindChild("Property/Num").GetComponent <UILabel>();
        int     value     = int.Parse(costLabel.text);


        int vCount = _configItem._timeDur.Count;

        for (int i = 0; i < vCount; i++)
        {
            uint type;
            uint cost = _configItem.getActuallyCost(i, out type);
            if (value == cost)
            {
                _select = i;
                break;
            }
        }


        //if (_configItem._isDiscount == 1 )
        //{
        //    for (int i = 0; i < _configItem._discountCost.Count; i++)
        //    {
        //        if (value == _configItem._discountCost[i])
        //        {
        //            _select = i;
        //            break;
        //        }
        //    }
        //}
        //else
        //{
        //    for (int i = 0; i < _configItem._costNum.Count; i++)
        //    {
        //        if (value == _configItem._costNum[i])
        //        {
        //            _select = i;
        //            break;
        //        }
        //    }

        //}



        if (_onBuySelectOne != null)
        {
            _onBuySelectOne(this);
        }
    }
예제 #3
0
    private void OnSelectDayChange(int index)
    {
        _selectIndex = index;
        if (index < 0)
        {
            return;
        }
        uint type;

        _costNumLabel.text = string.Format("{0}", _configItem.getActuallyCost(index, out type));
        if (type == 1)
        {
            _costTypeSprite.spriteName = "com_property_diamond2";
        }
        else if (type == 2)
        {
            _costTypeSprite.spriteName = "com_property_gold2";
        }
    }
예제 #4
0
    void BuyYes(GameObject go)
    {
        BuyStoreGoods    msg     = new BuyStoreGoods();
        FashionOperation msgOper = null;

        msg.store_id = StoreType.ST_FASHION;

        uint goldCost    = 0;
        uint diamondCost = 0;

        foreach (KeyValuePair <uint, UIStoreFashion.FashionSelectedItem> item in _uiStoreFashion._fashionSelected._dressOnItems)
        {
            FashionShopConfigItem configItem = item.Value._config;
            Fashion_OBB_item      obbItem    = GetOBBItem(configItem._fashionID);

            if (obbItem == null || !obbItem._isSelect)
            {
                continue;
            }
            if (item.Value._selectIndex < 0)
            {
                continue;
            }

            uint costType;
            uint costNum = configItem.getActuallyCost(item.Value._selectIndex, out costType);

            if (costType == 1)
            {
                diamondCost += costNum;
            }
            else if (costType == 2)
            {
                goldCost += costNum;
            }


            if (configItem.isInDate())
            {
                if (null == msgOper)
                {
                    msgOper = new FashionOperation();
                }

                FashionOperationInfo info = new FashionOperationInfo();
                info.type    = (uint)FashionOperationType.FOT_RENEW;
                info.uuid    = configItem.getGood().GetUUID();
                info.subtype = (uint)item.Value._selectIndex + 1;
                msgOper.info.Add(info);
                if (GlobalConst.IS_FASHION_OPEN == 1)
                {
                    msgOper.role_id = MainPlayer.Instance.CaptainID;
                }
            }
            else
            {
                if (item.Value._selectIndex >= 0)
                {
                    uint type;
                    uint cost = item.Value._config.getActuallyCost(item.Value._selectIndex, out type);

                    int pos = GameSystem.Instance.FashionShopConfig.configsSort.IndexOf(item.Value._config);

                    BuyStoreGoodsInfo info = new BuyStoreGoodsInfo();
                    info.pos  = (uint)pos + 1;
                    info.type = (uint)item.Value._selectIndex + 1;
                    msg.info.Add(info);
                }
            }
        }


        if ((diamondCost > MainPlayer.Instance.DiamondBuy + MainPlayer.Instance.DiamondFree) || goldCost > MainPlayer.Instance.Gold)
        {
            CommonFunction.ShowTip(CommonFunction.GetConstString("UI_FASHION_MONEY_NOT_ENGOUGH"));
            return;
        }

        /*
         * PlatNetwork.Instance.BuyStoreGoodsRequest(msg);
         * if (msgOper != null)
         * {
         * PlatNetwork.Instance.UpdateFashionRequest(msgOper);
         * }
         */
    }