public void Refresh(SaleRecordVo value) { lb_title.text = value.title; lb_price.text = value.price.ToString(); lb_number.text = Mathf.Abs(value.number).ToString(); var tmpMorget = value.mortage.ToString(); if (value.mortage < 0) { tmpMorget = "-"; } lb_morget.text = tmpMorget; lb_sale.text = value.saleMoney.ToString(); lb_income.text = value.income.ToString(); lb_quality.text = value.quality.ToString(); lb_zhuan.text = value.getMoney.ToString(); // 净赚大于0,是绿色 。 否则是红色 if (value.getMoney < 0) { lb_quality.color = Color.red; lb_zhuan.text = string.Format(_redText, value.getMoney.ToString()); } else { // lb_zhuan.color = Color.green; lb_zhuan.text = string.Format(_greenText, value.getMoney.ToString()); } }
public void HandlerChangeCardData(ChangeShareVo valuess) { _netSaleList.Clear(); var heroInfor = playerInfor; var turnIndex = Client.Unit.BattleController.Instance.CurrentPlayerIndex; if (playerInfor.playerID == PlayerManager.Instance.HostPlayerInfo.playerID) { if (_isBuyShare == false) { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardSellShare); } else { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardSmallShare); heroInfor.Settlement._smallIntegral += cardData.rankScore; } } for (var k = 0; k < _changeVoList.Count; k++) { var isAddCard = true; var value = _changeVoList[k]; if (GameModel.GetInstance.isPlayNet == false) { //Console.Error.WriteLine("当前玩家的金币:----:"+value.changeMoney); heroInfor.totalMoney += value.changeMoney; } value.shareData.shareNum += value.changeNum; if (value.shareData.shareNum <= 0) { value.shareData.shareNum = 0; isAddCard = false; } for (var i = heroInfor.shareCardList.Count - 1; i >= 0; i--) { var tmpValue = heroInfor.shareCardList[i]; if (tmpValue.id == value.shareData.id) { if (_isBuyShare == false) { tmpValue.shareNum = value.shareData.shareNum; if (GameModel.GetInstance.isPlayNet == true) { var tmpsale = new NetSaleCardVo(); tmpsale.cardId = tmpValue.id; tmpsale.cardNumber = Math.Abs(value.changeNum); tmpsale.cardType = (int)SpecialCardType.sharesChance; _netSaleList.Add(tmpsale); } } else { tmpValue.shareNum += value.shareData.shareNum; heroInfor.PlayerIntegral += cardData.rankScore; heroInfor.Settlement._smallOpportunitiesNum += 1; } if (tmpValue.shareNum <= 0) { if (GameModel.GetInstance.isPlayNet == false) { heroInfor.shareCardList.Remove(tmpValue); heroInfor.totalIncome += value.changeNum * tmpValue.income; } } // 记录卖股票记录 if (_isBuyShare == false) { var tmpVo = new SaleRecordVo(); tmpVo.title = tmpValue.title; tmpVo.price = -tmpValue.payment; tmpVo.number = value.changeNum; tmpVo.mortage = -1; tmpVo.saleMoney = -cardData.payment; tmpVo.income = tmpValue.income; tmpVo.quality = tmpValue.qualityScore; tmpVo.getMoney = (cardData.payment - tmpValue.payment) * value.changeNum; playerInfor.saleRecordList.Add(tmpVo); playerInfor.Settlement._saleNums += 1; if (tmpVo.getMoney < 0) { playerInfor.Settlement._smallIntegral += tmpValue.quitScore; } } if (GameModel.GetInstance.isPlayNet == false) { heroInfor.qualityScore += value.changeNum * value.shareData.qualityScore; } if (cardData.qualityScore != 0) { var recordInfor = new InforRecordVo(); recordInfor.title = value.shareData.title; recordInfor.num = value.changeNum * value.shareData.qualityScore;; heroInfor.AddQualityScoreInfor(recordInfor); } isAddCard = false; break; } } if (isAddCard == true) { if (GameModel.GetInstance.isPlayNet == false) { heroInfor.shareCardList.Add(value.shareData); heroInfor.totalIncome += value.changeNum * value.shareData.income; heroInfor.qualityScore += value.changeNum * value.shareData.qualityScore; } if (cardData.qualityScore != 0) { var recordInfor = new InforRecordVo(); recordInfor.title = value.shareData.title; recordInfor.num = value.changeNum * value.shareData.qualityScore; heroInfor.AddQualityScoreInfor(recordInfor); } } } if (GameModel.GetInstance.isPlayNet == false) { var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { if (PlayerManager.Instance.HostPlayerInfo.playerID == heroInfor.playerID) { battleController.SetQualityScore((int)heroInfor.qualityScore); battleController.SetTimeScore((int)heroInfor.timeScore); battleController.SetNonLaberIncome((int)heroInfor.totalIncome, (int)heroInfor.MonthPayment); battleController.SetCashFlow((int)heroInfor.totalMoney); } else { battleController.SetPersonInfor(heroInfor, turnIndex); } } } }
// 总的处理卡牌方法,适用与npc和整体变化的处理 public void HandlerCardData() { if (null != cardData) { //当前玩家和索引值 var heroInfor = playerInfor; var heroTurn = 0; // 点击确定是添加评分的 heroInfor.PlayerIntegral += cardData.rankScore; for (var i = 0; i < PlayerManager.Instance.Players.Length; i++) { if (heroInfor.playerID == PlayerManager.Instance.Players [i].playerID) { heroTurn = i; break; } } _IsFitConditionForAllEffect(heroInfor); var isAddBalance = false; var fitcondition_share = false; // 处理股票的数据 for (var i = heroInfor.shareCardList.Count - 1; i >= 0; i--) { var sharecard = heroInfor.shareCardList[i]; var fitcondition = false; if (cardData.handleRange == 2) { if (sharecard.belongsTo == cardData.relateID || sharecard.id == cardData.relateID) { fitcondition = true; isAddBalance = true; } } if (fitcondition == true) { fitcondition_share = true; // 处理现金 if (cardData.isHandle_peymeny == 1) { if (cardData.fateType == 3) { // 成倍增加的 暂时没有 var tmpPay = sharecard.payment * (cardData.payment - 1); if (heroInfor.totalMoney + tmpPay < 0) { break; } else { heroInfor.totalMoney += tmpPay; } } else { if (cardData.payment > 0) { heroInfor.totalMoney += cardData.payment; } } } // 处理非劳务收入 if (cardData.isHandle_income == 1) { if (cardData.handler_income_type == 2) { // 变成一个数 var tmpincome = sharecard.income - cardData.handler_income_number; heroInfor.totalIncome -= tmpincome; } else if (cardData.handler_income_type == 1) // 加减乘一个数 { var tmpincome = 0f; if (cardData.fateType == 3) //倍数变化 { tmpincome = sharecard.income * (cardData.handler_income_number - 1); heroInfor.totalIncome += tmpincome; } else { tmpincome = cardData.handler_income_number; heroInfor.totalIncome += tmpincome; } if (tmpincome > 0) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectShareOneInTwo2, heroInfor.playerName, cardData.title), null, true); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectShareTwoInOne2, heroInfor.playerName, cardData.title), null, true); } } } if (cardData.fateType == 1) { //卖 heroInfor.shareCardList.RemoveAt(i); MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.salseFateCard3, heroInfor.playerName, cardData.title, (-cardData.payment).ToString()), null, true); } } } var fitcondition_fixChance = false; for (var i = heroInfor.chanceFixedCardList.Count - 1; i >= 0; i--) { var fixedCard = heroInfor.chanceFixedCardList[i]; var fitcondition = false; // 处理一类的 if (cardData.handleRange == 2) { if (fixedCard.belongsTo == cardData.relateID || fixedCard.id == cardData.relateID) { fitcondition = true; isAddBalance = true; } } else if (cardData.handleRange == 1) { // 单个处理 if (cardData.relateID == fixedCard.id) { fitcondition = true; isAddBalance = true; } } var tmpPay = 0f; if (fitcondition == true) { fitcondition_fixChance = true; // 处理金币 if (cardData.isHandle_peymeny == 1) { // 倍数变化的,一般是全局 if (cardData.fateType == 3) { tmpPay = fixedCard.payment * (cardData.payment - 1); } else { if (cardData.payment > 0) { tmpPay = cardData.payment * fixedCard.baseNumber + fixedCard.mortgage; } } heroInfor.totalMoney += tmpPay; } if (cardData.isHandle_income == 1) { var tmpincome = fixedCard.income; if (cardData.handler_income_type == 2) { // 变成一个数 tmpincome = cardData.handler_income_number - fixedCard.income; if (tmpincome > 0) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectIncreaseIncone3, heroInfor.playerName, cardData.title, tmpincome.ToString()), null, true); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectReduceIncome3, heroInfor.playerName, cardData.title, (-tmpincome).ToString()), null, true); } } else if (cardData.handler_income_type == 1) // 加减乘一个数 { if (cardData.fateType == 3) //倍数变化 { tmpincome = fixedCard.income * (cardData.handler_income_number - 1); if (tmpincome > 0) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectIncreaseIncone3, heroInfor.playerName, cardData.title, ((cardData.handler_income_number - 1) * 100).ToString() + "%"), null, true); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectMutipleReduceIncome3, heroInfor.playerName, cardData.title, ((1 - cardData.handler_income_number) * 100).ToString() + "%"), null, true); } } else { tmpincome = cardData.handler_income_number; if (tmpincome > 0) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectIncreaseIncone3, heroInfor.playerName, cardData.title, tmpincome.ToString()), null, true); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectReduceIncome3, heroInfor.playerName, cardData.title, (-tmpincome).ToString()), null, true); } } } heroInfor.totalIncome += tmpincome; } if (cardData.fateType == 1) { //卖 heroInfor.chanceFixedCardList.RemoveAt(i); var getMoney = cardData.payment * fixedCard.baseNumber + fixedCard.mortgage; var saleRecord = new SaleRecordVo(); saleRecord.title = fixedCard.title; saleRecord.price = Mathf.Abs(fixedCard.payment); saleRecord.number = fixedCard.baseNumber; saleRecord.income = fixedCard.income; saleRecord.mortage = Mathf.Abs(fixedCard.mortgage); saleRecord.quality = fixedCard.scoreNumber; saleRecord.getMoney = getMoney; saleRecord.saleMoney = cardData.payment; playerInfor.saleRecordList.Add(saleRecord); MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.salseFateCard3, heroInfor.playerName, cardData.title, tmpPay.ToString()), null, true); } } } var fitcondition_opportunity = false; for (var i = heroInfor.opportCardList.Count - 1; i >= 0; i--) { var opportuniycard = heroInfor.opportCardList[i]; var fitcondition = false; if (cardData.handleRange == 2) { if (opportuniycard.belongsTo == cardData.relateID || opportuniycard.id == cardData.relateID) { fitcondition = true; isAddBalance = true; } } else if (cardData.handleRange == 1) { if (cardData.relateID == opportuniycard.id) { fitcondition = true; isAddBalance = true; } } var tmpPay = 0f; if (fitcondition == true) { fitcondition_opportunity = true; // 处理命运 if (cardData.isHandle_peymeny == 1) { // 全局的倍数变化 if (cardData.fateType == 3) { tmpPay = opportuniycard.payment * (cardData.payment - 1); } else { if (cardData.payment > 0) { tmpPay = cardData.payment * opportuniycard.baseNumber + opportuniycard.mortgage; } } heroInfor.totalMoney += tmpPay; } if (cardData.isHandle_income == 1) { var tmpincome = opportuniycard.income; if (cardData.handler_income_type == 2) { // 变成一个数 tmpincome = cardData.handler_income_number - opportuniycard.income; if (tmpincome > 0) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectIncreaseIncone3, heroInfor.playerName, cardData.title, tmpincome.ToString()), null, true); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectReduceIncome3, heroInfor.playerName, cardData.title, (-tmpincome).ToString()), null, true); } } else if (cardData.handler_income_type == 1) // 加减乘一个数 { if (cardData.fateType == 3) //倍数变化 { tmpincome = opportuniycard.income * (cardData.handler_income_number - 1); if (tmpincome > 0) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectIncreaseIncone3, heroInfor.playerName, cardData.title, ((cardData.handler_income_number - 1) * 100).ToString() + "%"), null, true); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectMutipleReduceIncome3, heroInfor.playerName, cardData.title, ((1 - cardData.handler_income_number) * 100).ToString() + "%"), null, true); } } else { tmpincome = cardData.handler_income_number; if (tmpincome > 0) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectIncreaseIncone3, heroInfor.playerName, cardData.title, tmpincome.ToString()), null, true); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.effectReduceIncome3, heroInfor.playerName, cardData.title, (-tmpincome).ToString()), null, true); } } } heroInfor.totalIncome += tmpincome; } if (cardData.fateType == 1) { //卖 MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.salseFateCard3, heroInfor.playerName, cardData.title, tmpPay.ToString()), null, true); heroInfor.opportCardList.RemoveAt(i); var getMoney = cardData.payment * opportuniycard.baseNumber + opportuniycard.mortgage; var saleRecord = new SaleRecordVo(); saleRecord.title = opportuniycard.title; saleRecord.price = Mathf.Abs(opportuniycard.payment); saleRecord.number = opportuniycard.baseNumber; saleRecord.income = opportuniycard.income; saleRecord.mortage = Mathf.Abs(opportuniycard.mortgage); saleRecord.quality = 0; saleRecord.getMoney = getMoney; saleRecord.saleMoney = cardData.payment; playerInfor.saleRecordList.Add(saleRecord); } // if (cardData.fateType != 3) // { // heroInfor.totalMoney += opportuniycard.mortgage * opportuniycard.baseNumber; // heroInfor.totalDebt += opportuniycard.mortgage * opportuniycard.baseNumber; // // if(opportuniycard.belongsTo==(int)CardManager.BalacneKind.House) // { // heroInfor.houseDebt += opportuniycard.mortgage; // // } // else if(opportuniycard.belongsTo==(int)CardManager.BalacneKind.Antique) // { // } // else if(opportuniycard.belongsTo==(int)CardManager.BalacneKind.Company) // { // heroInfor.companyDebt += opportuniycard.mortgage; // } // } } } if (isAddBalance == true) { heroInfor.AddCapticalData(); } if (fitcondition_fixChance == true || fitcondition_opportunity == true || fitcondition_share == true) { var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { if (heroTurn == 0) { battleController.SetQualityScore((int)heroInfor.qualityScore); battleController.SetTimeScore((int)heroInfor.timeScore); battleController.SetNonLaberIncome((int)heroInfor.totalIncome, (int)heroInfor.MonthPayment); battleController.SetCashFlow((int)heroInfor.totalMoney); } else { battleController.SetPersonInfor(heroInfor, heroTurn, false); } } } } }
/// <summary> /// 卖出固定资产 /// </summary> public void SaleFiexedData() { _netSaleList.Clear(); var playerInfor = PlayerManager.Instance.HostPlayerInfo; for (var i = 0; i < _saleFixedList.Count; i++) { var tmpvalue = _saleFixedList[i]; if (tmpvalue.isSlected == true) { for (var k = playerInfor.chanceFixedCardList.Count - 1; k >= 0; k--) { var tmpFixed = playerInfor.chanceFixedCardList[k]; if (tmpvalue.id == tmpFixed.id) { var getMoney = tmpvalue.saleMoney * tmpvalue.baseNum + tmpvalue.mortgage; playerInfor.totalMoney += getMoney; playerInfor.totalIncome += tmpvalue.income; playerInfor.qualityScore += tmpvalue.quality; playerInfor.chanceFixedCardList.Remove(tmpFixed); if (GameModel.GetInstance.isPlayNet == true) { var saleVo = new NetSaleCardVo(); saleVo.cardId = tmpFixed.id; saleVo.cardNumber = 1; saleVo.cardType = (int)SpecialCardType.fixedChance; _netSaleList.Add(saleVo); } if (tmpvalue.quality != 0) { var recordInfor = new InforRecordVo(); recordInfor.title = cardData.title; recordInfor.num = tmpvalue.quality; playerInfor.AddQualityScoreInfor(recordInfor); } var saleRecord = new SaleRecordVo(); saleRecord.title = tmpFixed.title; saleRecord.price = Mathf.Abs(tmpFixed.payment); saleRecord.number = tmpFixed.baseNumber; saleRecord.income = tmpFixed.income; saleRecord.mortage = Mathf.Abs(tmpFixed.mortgage); saleRecord.quality = tmpFixed.scoreNumber; saleRecord.getMoney = getMoney; saleRecord.saleMoney = tmpvalue.saleMoney; playerInfor.saleRecordList.Add(saleRecord); playerInfor.Settlement._saleNums += 1; playerInfor.Settlement._outerFateIntegral += cardData.rankScore; playerInfor.Settlement._smallIntegral += cardData.rankScore; break; } } for (var k = playerInfor.opportCardList.Count - 1; k >= 0; k--) { var tmpFixed = playerInfor.opportCardList[k]; if (tmpvalue.id == tmpFixed.id) { var getMoney = tmpvalue.saleMoney * tmpvalue.baseNum + tmpvalue.mortgage; playerInfor.totalMoney += getMoney; playerInfor.totalIncome += tmpvalue.income; playerInfor.qualityScore += tmpvalue.quality; playerInfor.opportCardList.Remove(tmpFixed); if (tmpvalue.quality != 0) { var recordInfor = new InforRecordVo(); recordInfor.title = cardData.title; recordInfor.num = tmpvalue.quality; playerInfor.AddQualityScoreInfor(recordInfor); } if (GameModel.GetInstance.isPlayNet == true) { var saleVo = new NetSaleCardVo(); saleVo.cardId = tmpFixed.id; saleVo.cardNumber = 1; saleVo.cardType = (int)SpecialCardType.bigChance; _netSaleList.Add(saleVo); } var saleRecord = new SaleRecordVo(); saleRecord.title = tmpFixed.title; saleRecord.price = Mathf.Abs(tmpFixed.payment); saleRecord.number = tmpFixed.baseNumber; saleRecord.income = tmpFixed.income; saleRecord.mortage = Mathf.Abs(tmpFixed.mortgage); saleRecord.quality = 0; saleRecord.getMoney = getMoney; saleRecord.saleMoney = tmpvalue.saleMoney; playerInfor.saleRecordList.Add(saleRecord); playerInfor.Settlement._saleNums += 1; playerInfor.Settlement._outerFateIntegral += cardData.rankScore; playerInfor.Settlement._bigIntegral += cardData.rankScore; break; } } } } playerInfor.AddCapticalData(); if (playerInfor.playerID == PlayerManager.Instance.HostPlayerInfo.playerID) { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardOuerFate); } var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { battleController.SetQualityScore((int)playerInfor.qualityScore); battleController.SetTimeScore((int)playerInfor.timeScore); battleController.SetNonLaberIncome((int)playerInfor.totalIncome, (int)playerInfor.MonthPayment); battleController.SetCashFlow((int)playerInfor.totalMoney); } }