예제 #1
0
    void UpdateCost()
    {
        uint diamondCost = 0;
        uint goldCost    = 0;

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

            if (obbItem == null || !obbItem._isSelect)
            {
                continue;
            }
            if (item.Value._selectIndex >= 0)
            {
                uint type;
                uint cost = item.Value._config.getActuallyCost(item.Value._selectIndex, out type);

                if (type == 1)
                {
                    diamondCost += cost;
                }
                else if (2 == type)
                {
                    goldCost += cost;
                }
            }
        }



        _diamondCostLabel.text = string.Format("{0}", diamondCost);
        //  _goldCostLabel.text = string.Format("{0}", goldCost);
    }
예제 #2
0
 void OnItemChangeDelegate(Fashion_OBB_item item)
 {
     _uiStoreFashion._fashionSelected.ChangeState(item.ConfigItem._fashionID, item._selectIndex);
     UpdateCost();
 }
예제 #3
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);
         * }
         */
    }