Beispiel #1
0
        // 是否有足够的钱购买
        public bool IsCanBuyShare(ChanceShares shares, int num)
        {
            var canbuy    = true;
            var heroInfor = playerInfor;
            var tmpMoney  = 0f;

            for (var i = 0; i < _changeVoList.Count; i++)
            {
                var tmpVo = _changeVoList[i];
                if (tmpVo.shareData.id == shares.id)
                {
                    tmpMoney += num * tmpVo.shareData.payment;
                }
                else
                {
                    tmpMoney += tmpVo.changeNum * tmpVo.shareData.payment;
                }
            }

            if (heroInfor.totalMoney + tmpMoney < 0)
            {
                canbuy = false;
                if (PlayerManager.Instance.IsHostPlayerTurn() == true)
                {
                    MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfGold);
                }
            }
            return(canbuy);
        }
Beispiel #2
0
    /// <summary>
    /// Tos the chance shares. 根据数据返回股票卡牌数据
    /// </summary>
    /// <returns>The chance shares.</returns>
    /// <param name="jsonValue">Json value.</param>
    public static ChanceShares ToChanceSharesCard(JsonData jsonValue)
    {
        var cardVo = new ChanceShares();

        Console.Warning.WriteLine(jsonValue.ToString());

        cardVo.id = int.Parse(jsonValue["id"].ToString());

        // kind of card
        cardVo.belongsTo = int.Parse(jsonValue["type"].ToString());

        // name of card
        cardVo.title = jsonValue["name"].ToString();

        cardVo.cardPath = jsonValue["path"].ToString();

        // infor
        cardVo.desc = jsonValue["instructions"].ToString();

        // code
        cardVo.ticketCode = jsonValue["stockCode"].ToString();

        // name of ticket
        cardVo.ticketName = jsonValue["billName"].ToString();

        // pay of card
        cardVo.payment = int.Parse(jsonValue["todayPrice"].ToString());

        // show the rate of trun
        cardVo.returnRate = jsonValue["investmentIncome"].ToString();

        //show
        cardVo.shareOut = jsonValue["dividend"].ToString();

        // score for quality
        cardVo.qualityScore = int.Parse(jsonValue["qualityIntegral"].ToString());

        // infor of qualityScore
        cardVo.qualityDesc = jsonValue["qualityIntegralInstruction"].ToString();

        // income without labor
        cardVo.income = int.Parse(jsonValue["nonLaborIncome"].ToString());

        // show the rangeprice
        cardVo.priceRagne = jsonValue["priceScope"].ToString();

        cardVo.shareNum = int.Parse(jsonValue["stockNumber"].ToString());

        /// <summary>
        /// The rank score.排名积分
        /// </summary>
        cardVo.rankScore = int.Parse(jsonValue["cardIntegral"].ToString());


        return(cardVo);
    }
Beispiel #3
0
        public void IsBuyShare(bool value)
        {
            _isBuyShare = value;

            if (value == false)
            {
                _InitChangeShareData();
            }
            else
            {
                _changeVoList.Clear();

                var tmpChange = new ChangeShareVo();

                var tmpShareData = new ChanceShares();
                tmpShareData.belongsTo    = _carddata.belongsTo;
                tmpShareData.cardPath     = _carddata.cardPath;
                tmpShareData.desc         = _carddata.desc;
                tmpShareData.id           = _carddata.id;
                tmpShareData.income       = _carddata.income;
                tmpShareData.payment      = _carddata.payment;
                tmpShareData.priceRagne   = _carddata.priceRagne;
                tmpShareData.qualityDesc  = _carddata.qualityDesc;
                tmpShareData.qualityScore = _carddata.qualityScore;
                tmpShareData.returnRate   = _carddata.returnRate;
                tmpShareData.shareNum     = 0;
                tmpShareData.shareOut     = _carddata.shareOut;
                tmpShareData.ticketCode   = _carddata.ticketCode;
                tmpShareData.ticketName   = _carddata.ticketName;
                tmpShareData.title        = _carddata.title;


                tmpChange.shareData = tmpShareData;
                _changeVoList.Add(tmpChange);
            }
        }
Beispiel #4
0
        private void SetChanceShaersData(ChanceShares go, string imgPath)
        {
            lb_cardName.text = go.title;

//			lb_desc.text = go.desc;

            var str  = go.desc;
            var str1 = str.Replace("\\u3000", "\u3000");
            var str2 = str1.Replace("\\n", "\n");

            lb_desc.text = str2;

            lb_ticketTxt.text  = go.ticketCode;
            lb_ticketName.text = String.Concat(go.ticketName, " :");

            //lb_paymentTxt.text = String.Concat ("¥",Math.Abs (go.payment));

            //lb_paymentTxt.text="¥ "+Math.Abs(go.payment);

            var stringbuilder = new StringBuilder();

            stringbuilder.Append("¥");
            stringbuilder.Append(Mathf.Abs(go.payment));

            lb_paymentTxt.text = stringbuilder.ToString();

            if (null == go.returnRate || go.returnRate == "")
            {
                lb_profitNameTxt.SetActiveEx(false);
            }
            else
            {
//				var tmpProfit = float.Parse(go.returnRate);

                var tmpProfit = go.returnRate;
                if (tmpProfit == "")
                {
                    lb_profitNameTxt.SetActiveEx(false);
                }
                else
                {
                    //					lb_profitTxt.text=go.returnRate;
                    var tmpRate = "";
                    if (GameModel.GetInstance.isPlayNet == false)
                    {
                        tmpRate = string.Format("{0}%", (float.Parse(tmpProfit) * 100).ToString());
                    }
                    else
                    {
                        tmpRate = tmpProfit;
                    }

                    lb_profitTxt.text = tmpRate;
                }
            }


            if (null == go.priceRagne || go.priceRagne == "")
            {
                lb_priceRangeTxt.SetActiveEx(false);
                lb_priceRangeName.SetActiveEx(false);
            }
            else
            {
                lb_priceRangeTxt.text = go.priceRagne;
            }


            //lb_incomeTxt.text = String.Format ("¥{0} ", (Math.Abs (go.income)).ToString);

            if (go.income == 0)
            {
                lb_incomeTxt.SetActiveEx(false);
                lb_incomeName.SetActiveEx(false);
            }
            else
            {
                lb_incomeTxt.text = "¥ " + Math.Abs(go.income);
            }

            if (go.qualityScore == 0)
            {
                lb_qualityName.SetActiveEx(false);
                lb_qualityTxt.SetActiveEx(false);
                lb_qualityDescTxt.SetActiveEx(false);
            }
            else
            {
                lb_qualityTxt.text     = "" + go.qualityScore;
                lb_qualityDescTxt.text = "品质积分用于进入内圈后乘以10倍";
            }

            if ("" != imgPath)
            {
                if (null != _cardPic)
                {
                    _cardPic.Load(imgPath);
                }
            }
        }