private void _OnSendPacketHandler(GameObject go) { Audio.AudioManager.Instance.BtnMusic(); var player = PlayerManager.Instance.HostPlayerInfo; int cashCount = GetCashCount(); // if (cashCount > MaxCashCount) // { // MessageHint.Show("红包金额过高。"); // } if (cashCount > player.totalMoney) { MessageHint.Show("您没有这么多钱。"); } else if (cashCount < MinCashCount) { MessageHint.Show("请输入大于0的金额"); } else { // string _redText="<color=#e53232>{0}</color>"; // string _greenText="<color=#00b050>+{0}</color>"; // MessageHint.Show("红包发送成功~!"); //TODO 此处应该调用通用接口,玩家减少这些钱,NPC增加这些钱 //MessageHint.Show(string.Format("您给<color=#00b050>{0}</color>包了一个<color=#f1df17>{1}</color>元的红包",_controller.player.playerName,cashCount.ToString())); MessageTips.Show(string.Format(GameTipManager.Instance.gameTips.overOuterSendRed, _controller.player.playerName)); if (GameModel.GetInstance.isPlayNet == false) { player.totalMoney -= cashCount; var battleControll = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleControll) { battleControll.SetCashFlow((int)player.totalMoney, -1); if (GameModel.GetInstance.isPlayNet == false) //单机状态下,刷新目标玩家的金币 { _controller.player.totalMoney += cashCount; var index = Array.IndexOf(PlayerManager.Instance.Players, _controller.player); if (index > 0) { battleControll.SetPersonInfor(_controller.player, index); } } } } if (cashCount > 0) { Audio.AudioManager.Instance.Tip_RedPackage(PlayerManager.Instance.HostPlayerInfo.careerID); } if (GameModel.GetInstance.isPlayNet == true) { NetWorkScript.getInstance().Send_RedPocket(GameModel.GetInstance.curRoomId, -cashCount); } _ClosePanel(); } }
private void _OnTimeOutAutoSendpackey() { SetMenuType(2); var player = PlayerManager.Instance.HostPlayerInfo; int cashCount = UnityEngine.Random.Range(0, Mathf.FloorToInt(player.totalMoney * 0.3f)); _inputcash.text = cashCount.ToString(); //MessageHint.Show(string.Format("您给<color=#00b050>{0}</color>包了一个<color=#f1df17>{1}</color>元的红包",_controller.player.playerName,cashCount.ToString())); MessageTips.Show(string.Format(GameTipManager.Instance.gameTips.overOuterSendRed, _controller.player.playerName)); if (GameModel.GetInstance.isPlayNet == false) { player.totalMoney -= cashCount; var battleControll = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleControll) { battleControll.SetCashFlow((int)player.totalMoney, -1); if (GameModel.GetInstance.isPlayNet == false) //单机状态下,刷新目标玩家的金币 { _controller.player.totalMoney += cashCount; var index = Array.IndexOf(PlayerManager.Instance.Players, _controller.player); if (index > 0) { battleControll.SetPersonInfor(_controller.player, index); } } } } if (GameModel.GetInstance.isPlayNet == true) { NetWorkScript.getInstance().Send_RedPocket(GameModel.GetInstance.curRoomId, -cashCount); } _tempTimer = new Counter(1); }
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); } } } }
public bool HandlerCardData() { var canGet = false; if (null != cardData) { var heroTurn = Array.IndexOf(PlayerManager.Instance.Players, playerInfor); //Client.Unit.BattleController.Instance.CurrentPlayerIndex; var heroInfor = this.playerInfor; if (heroInfor.totalMoney + cardData.payment * castRate < 0) { if (PlayerManager.Instance.HostPlayerInfo.playerID == playerInfor.playerID) { MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfGold); } return(canGet); } else { canGet = true; if (GameModel.GetInstance.isPlayNet == false) { heroInfor.totalMoney += cardData.payment * castRate; heroInfor.innerFlowMoney += cardData.income; heroInfor.timeScore += cardData.timeScore; heroInfor.totalPayment -= cardData.payment * castRate; } heroInfor.relaxFlow += cardData.income; heroInfor.Settlement._richleisureNum += 1; heroInfor.PlayerIntegral += cardData.rankScore; heroInfor.Settlement._relaxIntegral += cardData.rankScore; if (cardData.timeScore != 0) { var timeRecord = new InforRecordVo(); timeRecord.title = cardData.title; timeRecord.num = cardData.timeScore; heroInfor.AddTimeScoreInfor(timeRecord); } if (cardData.income != 0) { var flowRecordVo = new InforRecordVo(); flowRecordVo.title = cardData.title; flowRecordVo.num = cardData.income; heroInfor.AddInnerFlowInfor(flowRecordVo); } //if (cardData.timeScore > 0) //{ // MessageHint.Show (string.Format(SubTitleManager.Instance.subtitle.timeAndMoneyGateMoneyAndScore4,heroInfor.playerName,cardData.title,(-cardData.payment).ToString(),cardData.income.ToString(),cardData.timeScore.ToString()),null,true); //} //else //{ // MessageHint.Show (string.Format(SubTitleManager.Instance.subtitle.timeAndMondeyGetMoney3,heroInfor.playerName,cardData.title,(-cardData.payment).ToString(),cardData.income.ToString()),null,true); //} if (PlayerManager.Instance.HostPlayerInfo.playerID != playerInfor.playerID) { //if (cardData.timeScore > 0) //{ // MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.timeAndMoneyGateMoneyAndScore4, heroInfor.playerName, cardData.title, (-cardData.payment*castRate).ToString(), cardData.income.ToString(), cardData.timeScore.ToString()), null, true); //} //else //{ // MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.timeAndMondeyGetMoney3, heroInfor.playerName, cardData.title, (-cardData.payment*castRate).ToString(), cardData.income.ToString()), null, true); //} } else { MessageTips.Show(GameTipManager.Instance.gameTips.overInnerRelax); } } var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { if (PlayerManager.Instance.HostPlayerInfo.playerID == playerInfor.playerID) { battleController.SetQualityScore((int)heroInfor.qualityScore, heroInfor.targetQualityScore); battleController.SetTimeScore((int)heroInfor.timeScore, heroInfor.targetTimeScore); battleController.SetNonLaberIncome((int)heroInfor.CurrentIncome, heroInfor.TargetIncome); battleController.SetCashFlow((int)heroInfor.totalMoney, heroInfor.TargetIncome); } else { battleController.SetPersonInfor(heroInfor, heroTurn, false); } } } return(canGet); }
public void HandlerCardData() { var turnIndex = Client.Unit.BattleController.Instance.CurrentPlayerIndex; if ((int)SpecialCardType.GiveChildType == _cardID) { var battleController = Client.UIControllerManager.Instance.GetController <UIBattleController> (); if (GameModel.GetInstance.isPlayNet == false) { if (player.childNum >= player.childNumMax) { var paymoney = (int)(player.totalMoney * 0.1f); if (player.totalMoney <= 0) { paymoney = 0; } player.totalMoney -= paymoney; player.totalPayment += paymoney; if (PlayerManager.Instance.IsHostPlayerTurn() == false) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.moreChildForTip, player.playerName, paymoney.ToString()), null, true); } else { MessageTips.Show(string.Format(GameTipManager.Instance.gameTips.overOuterMoreChild, paymoney.ToString())); } if (null != battleController) { if (PlayerManager.Instance.IsHostPlayerTurn()) { battleController.SetCashFlow((int)player.totalMoney, player.TargetIncome); } else { battleController.SetPersonInfor(player, turnIndex); } } return; } } player.childNum++; if (player.childNum > player.childNumMax) { player.childNum = player.childNumMax; } else { if (PlayerManager.Instance.IsHostPlayerTurn() == false) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.getChildDesc2, player.playerName, player.oneChildPrise), null, true); } else { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterGiveChild); } } if (GameModel.GetInstance.isPlayNet == false) { if (null != battleController) { if (PlayerManager.Instance.IsHostPlayerTurn()) { battleController.SetCashFlow((int)player.totalMoney, player.TargetIncome); battleController.SetNonLaberIncome((int)player.totalIncome, (int)player.MonthPayment); } else { battleController.SetPersonInfor(player, turnIndex); } } } } else if ((int)SpecialCardType.CheckDayType == _cardID || (int)SpecialCardType.InnerCheckDayType == _cardID) { var checkoutMoney = (player.cashFlow + player.totalIncome + player.innerFlowMoney - player.MonthPayment); if (GameModel.GetInstance.isPlayNet == true) { checkoutMoney = player.netCheckDayNum; } // if (GameModel.GetInstance.isPlayNet == false) // { // // } player.totalMoney += checkoutMoney; if (PlayerManager.Instance.IsHostPlayerTurn() == false) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.getCheckOutMoney2, player.playerName, checkoutMoney.ToString()), null, true); } else { if ((int)SpecialCardType.CheckDayType == _cardID) { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardCheckOut); } else { MessageTips.Show(GameTipManager.Instance.gameTips.overInnerCheckOut); } } player.checkOutCount++; var battleController = Client.UIControllerManager.Instance.GetController <UIBattleController> (); if (null != battleController) { if (PlayerManager.Instance.IsHostPlayerTurn()) { battleController.SetCashFlow((int)player.totalMoney, player.TargetIncome); } else { battleController.SetPersonInfor(player, turnIndex, false); } } } else { var paymoney = (int)((player.cashFlow + player.totalIncome + player.innerFlowMoney) * 0.1f); if (player.totalMoney - paymoney > 0) { if (GameModel.GetInstance.isPlayNet == false) { player.totalMoney -= paymoney; player.totalPayment += paymoney; } if ((int)SpecialCardType.CharityType == _cardID) { if (PlayerManager.Instance.IsHostPlayerTurn() == false) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.involveCharity2, player.playerName, paymoney.ToString()), null, true); } else { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardCharity); } player._charityNum += 1; } else if ((int)SpecialCardType.HealthType == _cardID || (int)SpecialCardType.InnerHealthType == _cardID) { if (PlayerManager.Instance.IsHostPlayerTurn() == false) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.involveHealth2, player.playerName, paymoney.ToString()), null, true); } else { if ((int)SpecialCardType.HealthType == _cardID) { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardHealth); } else { MessageTips.Show(GameTipManager.Instance.gameTips.overInnerHealth); } } player._healthNum += 1; } else if ((int)SpecialCardType.StudyType == _cardID || (int)SpecialCardType.InnerStudyType == _cardID) { if (PlayerManager.Instance.IsHostPlayerTurn() == false) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.involeStudy2, player.playerName, paymoney.ToString()), null, true); } else { if ((int)SpecialCardType.StudyType == _cardID) { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardStudy); } else { MessageTips.Show(GameTipManager.Instance.gameTips.overInnerStudy); } } player._learnNum += 1; } if (GameModel.GetInstance.isPlayNet == false) { var battleController = Client.UIControllerManager.Instance.GetController <UIBattleController> (); if (null != battleController) { if (PlayerManager.Instance.IsHostPlayerTurn()) { battleController.SetCashFlow((int)player.totalMoney, player.TargetIncome); } else { battleController.SetPersonInfor(player, turnIndex); } } player.isThreeRoll = true; } Console.WriteLine("ssdfenwdnfweofnsdofnsdf扔三个筛子," + player.isThreeRoll.ToString()); } else { if (PlayerManager.Instance.IsHostPlayerTurn() == true) { MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfGold); } } } }
/// <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); } }
public bool HandlerCardData() { var canGet = false; var turnIndex = Client.Unit.BattleController.Instance.CurrentPlayerIndex; var heroInfor = PlayerManager.Instance.Players[turnIndex]; if (heroInfor.totalMoney + cardData.payment < 0) { if (PlayerManager.Instance.IsHostPlayerTurn() == true) { MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfGold); } return(canGet); } else { canGet = true; heroInfor.totalMoney += cardData.payment; heroInfor.totalPayment -= cardData.payment; heroInfor.totalDebt -= cardData.mortgage; heroInfor.totalIncome += cardData.income; //人物评分 heroInfor.PlayerIntegral += cardData.rankScore; if (PlayerManager.Instance.IsHostPlayerTurn()) { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardChallenge); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.buyChanceCard2, heroInfor.playerName, cardData.title), null, true); } if (cardData.belongsTo == (int)CardManager.BalacneKind.House) { heroInfor.housePayment -= cardData.payment; heroInfor.houseDebt -= cardData.mortgage; } else if (cardData.belongsTo == (int)CardManager.BalacneKind.Antique) { heroInfor.antiquePayment -= cardData.payment; } else if (cardData.belongsTo == (int)CardManager.BalacneKind.Company) { heroInfor.companyPayment -= cardData.payment; heroInfor.companyDebt -= cardData.mortgage; } heroInfor.opportCardList.Add(cardData); heroInfor.AddCapticalData(); heroInfor._bigOpportunitiesNum += 1; } var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { if (PlayerManager.Instance.IsHostPlayerTurn()) { 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); } } return(canGet); }
public bool HandlerCardData() { var canHandle = false; if (null != cardData) { var turnIndex = Client.Unit.BattleController.Instance.CurrentPlayerIndex; var heroInfor = PlayerManager.Instance.Players[turnIndex]; var isHostTurn = PlayerManager.Instance.IsHostPlayerTurn(); if (cardData.fateType == 1) { if (heroInfor.totalMoney + cardData.paymeny < 0) { Console.WriteLine("余额不足了"); if (isHostTurn == true) { MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfGold); } canHandle = false; return(canHandle); } var tmppayment = cardData.paymeny; if (cardData.paymenyMethod == 1) { tmppayment = cardData.paymeny; } else if (cardData.paymenyMethod == 2) { tmppayment = -heroInfor.totalMoney * cardData.paymeny; } heroInfor.PlayerIntegral += cardData.rankScore; heroInfor.Settlement._innerFateIntegral += cardData.rankScore; if (isHostTurn == false) { crapNum = UnityEngine.Random.Range(1, 6); if (GameModel.GetInstance.isPlayNet == true) { crapNum = GameModel.GetInstance.innerCardRollPoint; } } var isRollSuccess = false; if (cardData.dice_condition == 1) { if (crapNum >= cardData.dice_number) { tmppayment += cardData.dice_prise; isRollSuccess = true; } } else if (cardData.dice_condition == 2) { if (crapNum <= cardData.dice_number) { tmppayment += cardData.dice_prise; isRollSuccess = true; } } if (GameModel.GetInstance.isPlayNet == false) { heroInfor.totalMoney += tmppayment; heroInfor.totalPayment -= tmppayment; } canHandle = true; if (isRollSuccess == true) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.rollSuccessInnerfate, heroInfor.playerName, crapNum.ToString(), cardData.dice_prise.ToString())); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.rollFail, heroInfor.playerName, crapNum.ToString())); } //MessageHint.Show (string.Concat( heroInfor.playerName,"失去金币",tmppayment)); } else if (cardData.fateType == 2) { //保险 if (heroInfor.totalMoney + cardData.paymeny < 0) { Console.WriteLine("余额不足了"); if (isHostTurn == true) { MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfGold); } canHandle = false; return(canHandle); } else { heroInfor.PlayerIntegral += cardData.rankScore; heroInfor.Settlement._innerFateIntegral += cardData.rankScore; if (GameModel.GetInstance.isPlayNet == false) { heroInfor.totalMoney += cardData.paymeny; heroInfor.totalPayment -= cardData.paymeny; } if (isHostTurn == true) { MessageTips.Show(GameTipManager.Instance.gameTips.overInnerFate); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.innerFateSafe2, heroInfor.playerName, cardData.title), null, true); } Console.WriteLine("失去钱", cardData.paymeny); canHandle = true; heroInfor.InsuranceList.Add(cardData.id); } } else if (cardData.fateType == 3) { //赔付金额 if (heroInfor.InsuranceList.Count > 0) { heroInfor.InsuranceList.RemoveAt(0); if (isHostTurn) { MessageTips.Show(GameTipManager.Instance.GetRandomCare()); } //MessageHint.Show (string.Concat(heroInfor.playerName,"因为保险避免了损失"),null,true); canHandle = true; return(canHandle); } if (heroInfor.totalMoney <= 0) { return(true); } var tmppayment = cardData.paymeny; if (cardData.paymenyMethod == 1) { tmppayment = cardData.paymeny; } else if (cardData.paymenyMethod == 2) { var tmpfix = cardData.paymeny; //离婚 if (cardData.id == 90006) { if (heroInfor.playerSex == 1) { tmpfix = 1; } else { tmpfix = 0.5f; } heroInfor.Settlement._divorceNum += 1; } tmppayment = -heroInfor.totalMoney * tmpfix; } if (heroInfor.totalMoney + tmppayment < 0) { Console.WriteLine("余额不足了"); canHandle = false; return(canHandle); } else { if (cardData.id == 90009) { // 审计 heroInfor.Settlement._auditNum += 1; } if (cardData.id == 90004) { heroInfor.Settlement._moneyLoss += 1; } heroInfor.PlayerIntegral += cardData.rankScore; heroInfor.Settlement._innerFateIntegral += cardData.rankScore; if (GameModel.GetInstance.isPlayNet == false) { heroInfor.totalMoney += tmppayment; heroInfor.totalPayment -= tmppayment; Console.WriteLine("失去钱", cardData.paymeny); } canHandle = true; //MessageHint.Show (string.Format(SubTitleManager.Instance.subtitle.innerFateLose2,heroInfor.playerName,cardData.title),null,true); if (isHostTurn == true) { MessageTips.Show(GameTipManager.Instance.GetRandomInnerFate()); } } } if (GameModel.GetInstance.isPlayNet == false) { var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { if (PlayerManager.Instance.IsHostPlayerTurn()) { battleController.SetQualityScore((int)heroInfor.qualityScore, heroInfor.targetQualityScore); battleController.SetTimeScore((int)heroInfor.timeScore, heroInfor.targetTimeScore); battleController.SetNonLaberIncome((int)heroInfor.CurrentIncome, (int)heroInfor.TargetIncome); battleController.SetCashFlow((int)heroInfor.totalMoney, heroInfor.TargetIncome); } else { battleController.SetPersonInfor(heroInfor, turnIndex); } } } } return(canHandle); }
public void HandlerCardData() { if (null != cardData) { // 遇到风险,必定会扣钱的 ,如果钱不足,就不能后买自由选择项目 var heroTurn = Client.Unit.BattleController.Instance.CurrentPlayerIndex; var heroInfor = PlayerManager.Instance.Players[heroTurn]; var tmppayment = cardData.payment; // if (isSlect == true) // { // } // if(heroInfor.totalMoney<0) // { // MessageHint.Show (SubTitleManager.Instance.subtitle.lackOfGold); // } if (GameModel.GetInstance.isPlayNet == true) { if (PlayerManager.Instance.IsHostPlayerTurn() == false) { if (GameModel.GetInstance.innerCardRollPoint > 0) { isSlect = true; } } } if (isSlect == true) { if (heroInfor.totalMoney + tmppayment + cardData.payment2 >= 0) { tmppayment += cardData.payment2; if (cardData.score > 0) { if (cardData.scoreType == (int)CardManager.ScoreType.TimeScore) { heroInfor.timeScore += cardData.score; if (cardData.score != 0) { var timeRecord = new InforRecordVo(); timeRecord.title = cardData.title; timeRecord.num = cardData.score; heroInfor.AddTimeScoreInfor(timeRecord); } } else { heroInfor.qualityScore += cardData.score; if (cardData.score != 0) { var recordInfor = new InforRecordVo(); recordInfor.title = cardData.title; recordInfor.num = cardData.score; heroInfor.AddQualityScoreInfor(recordInfor); } } } } else { MessageHint.Show(string.Format("{0}的金币不足,不能购买自由选择项", heroInfor.playerName)); } } heroInfor.PlayerIntegral += cardData.rankScore; heroInfor.Settlement._riskIntegral += cardData.rankScore; heroInfor.totalMoney += tmppayment; // MessageHint.Show (string.Format(SubTitleManager.Instance.subtitle.riskCoast3,heroInfor.playerName,cardData.title,(-tmppayment).ToString()),null,true); if (PlayerManager.Instance.IsHostPlayerTurn() == false) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.riskCoast3, heroInfor.playerName, cardData.title, (-tmppayment).ToString()), null, true); } else { //MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardRisk); var tmpStrs = ""; if (cardData.tipType == (int)CardRiskType.Frastration) { tmpStrs = GameTipManager.Instance.GetRandomRiskFrustration(); } else if (cardData.tipType == (int)CardRiskType.Loss) { tmpStrs = GameTipManager.Instance.GetRandomRiskLoss(); } else { tmpStrs = GameTipManager.Instance.GetRandomRiskNormal(); } MessageTips.Show(tmpStrs); } heroInfor.otherPayment += tmppayment; if (cardData.id == 10045) { if (GameModel.GetInstance.isPlayNet == false) { heroInfor.isEmployment = false; } heroInfor.Settlement._unemploymentNum += 1; } var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { if (PlayerManager.Instance.IsHostPlayerTurn()) { 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); } } } }
public int HandlerCardData() { var canGet = 0; if (null != cardData) { var heroTurn = Client.Unit.BattleController.Instance.CurrentPlayerIndex; var heroInfor = PlayerManager.Instance.Players[heroTurn]; if (heroInfor.totalMoney + cardData.payment < 0) { if (PlayerManager.Instance.IsHostPlayerTurn() == true) { MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfGold); } return(canGet); } else if (heroInfor.timeScore + cardData.timeScore < 0) { if (PlayerManager.Instance.IsHostPlayerTurn() == true) { MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfTimeScore); } canGet = -1; return(canGet); } else { canGet = 1; heroInfor.PlayerIntegral += cardData.rankScore; if (GameModel.GetInstance.isPlayNet == false) { heroInfor.totalMoney += cardData.payment; heroInfor.qualityScore += cardData.qualityScore; heroInfor.timeScore += cardData.timeScore; heroInfor.totalPayment -= cardData.payment; } if (cardData.timeScore != 0) { var timeRecord = new InforRecordVo(); timeRecord.title = cardData.title; timeRecord.num = cardData.timeScore; heroInfor.AddTimeScoreInfor(timeRecord); } if (cardData.qualityScore != 0) { var recordInfor = new InforRecordVo(); recordInfor.title = cardData.title; recordInfor.num = cardData.qualityScore; heroInfor.AddQualityScoreInfor(recordInfor); } heroInfor._qualityNum += 1; if (PlayerManager.Instance.IsHostPlayerTurn()) { MessageTips.Show(GameTipManager.Instance.gameTips.overInnerQuality); } else { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.qualityGetSocre4, heroInfor.playerName, cardData.title, (-cardData.payment).ToString(), cardData.timeScore.ToString(), cardData.qualityScore.ToString()), null, true); } } var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { if (PlayerManager.Instance.IsHostPlayerTurn()) { battleController.SetQualityScore((int)heroInfor.qualityScore, heroInfor.targetQualityScore); battleController.SetTimeScore((int)heroInfor.timeScore, heroInfor.targetTimeScore); battleController.SetNonLaberIncome((int)heroInfor.CurrentIncome, heroInfor.TargetIncome); battleController.SetCashFlow((int)heroInfor.totalMoney, heroInfor.TargetIncome); } else { battleController.SetPersonInfor(heroInfor, heroTurn); } } } return(canGet); }
/// <summary> /// Handlers the card data. 如果遇到掷色子的 如果是npc随机判断下数字 处理大于小于的逻辑 本人的,点击确定,掷色子,判断得分 /// </summary> /// <returns><c>true</c>, if card data was handlered, <c>false</c> otherwise.</returns> public bool HandlerCardData() { var canGet = false; if (null != cardData) { var turnIndex = Array.IndexOf(PlayerManager.Instance.Players, playerInfor); // Client.Unit.BattleController.Instance.CurrentPlayerIndex; var heroInfor = playerInfor; // PlayerManager.Instance.Players[turnIndex]; if (heroInfor.totalMoney + cardData.payment * this.castRate < 0) { if (PlayerManager.Instance.HostPlayerInfo.playerID == playerInfor.playerID) { MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfGold); } return(canGet); } else { canGet = true; if (PlayerManager.Instance.HostPlayerInfo.playerID != playerInfor.playerID) { crapNum = UnityEngine.Random.Range(1, 6); if (GameModel.GetInstance.isPlayNet == true) { crapNum = GameModel.GetInstance.innerCardRollPoint; } } var tmpIncome = 0f; if (cardData.isDice != 0) { var isRollSuccess = false; if (cardData.disc_condition == 1) { if (crapNum >= cardData.disc_number) { tmpIncome = cardData.income; isRollSuccess = true; } } else if (cardData.disc_condition == 2) { if (crapNum <= cardData.disc_number) { tmpIncome = cardData.income; isRollSuccess = true; } } //if (GameModel.GetInstance.isPlayNet == false) //{ // if (isRollSuccess == true) // { // MessageHint.Show (string.Format(SubTitleManager.Instance.subtitle.rollSuccessInvestment,heroInfor.playerName,crapNum.ToString(),cardData.income.ToString())); // } // else // { // MessageHint.Show (string.Format(SubTitleManager.Instance.subtitle.rollFail,heroInfor.playerName,crapNum.ToString())); // } //} if (PlayerManager.Instance.HostPlayerInfo.playerID != playerInfor.playerID) //== false { //if (GameModel.GetInstance.isPlayNet == false) //{ // if (isRollSuccess == true) // { // MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.rollSuccessInvestment, heroInfor.playerName, crapNum.ToString(), cardData.income.ToString())); // } // else // { // MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.rollFail, heroInfor.playerName, crapNum.ToString())); // } //} } else { MessageTips.Show(GameTipManager.Instance.gameTips.overInnerInvestment); } } else { tmpIncome = cardData.income; if (PlayerManager.Instance.HostPlayerInfo.playerID != playerInfor.playerID) //== false { //MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.investmentGetMoney3, heroInfor.playerName, cardData.title, tmpIncome.ToString(), (-cardData.payment * this.castRate).ToString()), null, true); } else { MessageTips.Show(GameTipManager.Instance.gameTips.overInnerInvestment); } } heroInfor.PlayerIntegral += cardData.rankScore; heroInfor.Settlement._investmentNum += 1; heroInfor.Settlement._investmentIntegral += cardData.rankScore; if (GameModel.GetInstance.isPlayNet == false) { heroInfor.totalMoney += cardData.payment * this.castRate; heroInfor.innerFlowMoney += tmpIncome; heroInfor.investFlow += tmpIncome; heroInfor.totalPayment -= cardData.payment * this.castRate; } if (tmpIncome != 0) { var flowRecordVo = new InforRecordVo(); flowRecordVo.title = cardData.title; flowRecordVo.num = cardData.income; heroInfor.AddInnerFlowInfor(flowRecordVo); } } if (GameModel.GetInstance.isPlayNet == false) { var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { if (PlayerManager.Instance.HostPlayerInfo.playerID == playerInfor.playerID) { battleController.SetQualityScore((int)heroInfor.qualityScore, heroInfor.targetQualityScore); battleController.SetTimeScore((int)heroInfor.timeScore, heroInfor.targetTimeScore); battleController.SetNonLaberIncome((int)heroInfor.CurrentIncome, heroInfor.TargetIncome); battleController.SetCashFlow((int)heroInfor.totalMoney, heroInfor.TargetIncome); } else { battleController.SetPersonInfor(heroInfor, turnIndex, false); } } } } return(canGet); }
public bool HandlerCardData() { var canGet = false; if (null != cardData) { var turnIndex = Client.Unit.BattleController.Instance.CurrentPlayerIndex; var heroInfor = this.playerInfor;// PlayerManager.Instance.Players[turnIndex]; if (heroInfor.totalMoney + cardData.payment < 0) { if (PlayerManager.Instance.IsHostPlayerTurn() == true) { MessageHint.Show(SubTitleManager.Instance.subtitle.lackOfGold); } return(canGet); } else { canGet = true; if (GameModel.GetInstance.isPlayNet == false) { heroInfor.totalMoney += cardData.payment; if (cardData.scoreType == (int)CardManager.ScoreType.TimeScore) { heroInfor.timeScore += cardData.scoreNumber; if (cardData.scoreNumber != 0) { var recordInfor = new InforRecordVo(); recordInfor.title = cardData.title; recordInfor.num = cardData.scoreNumber; heroInfor.AddTimeScoreInfor(recordInfor); } } else if (cardData.scoreType == (int)CardManager.ScoreType.QualityScore) { heroInfor.qualityScore += cardData.scoreNumber; if (cardData.scoreNumber != 0) { var recordInfor = new InforRecordVo(); recordInfor.title = cardData.title; recordInfor.num = cardData.scoreNumber; heroInfor.AddQualityScoreInfor(recordInfor); } } heroInfor.totalPayment -= cardData.payment; heroInfor.totalDebt -= cardData.mortgage; heroInfor.totalIncome += cardData.income; if (cardData.belongsTo == (int)CardManager.BalacneKind.House) { heroInfor.housePayment -= cardData.payment; heroInfor.houseDebt -= cardData.mortgage; } else if (cardData.belongsTo == (int)CardManager.BalacneKind.Antique) { heroInfor.antiquePayment -= cardData.payment; } else if (cardData.belongsTo == (int)CardManager.BalacneKind.Company) { heroInfor.companyPayment -= cardData.payment; heroInfor.companyDebt -= cardData.mortgage; } } //MessageHint.Show (string.Format(SubTitleManager.Instance.subtitle.buyChanceCard2,heroInfor.playerName,cardData.title),null,true); heroInfor.PlayerIntegral += cardData.rankScore; heroInfor.Settlement._smallIntegral += cardData.rankScore; heroInfor.Settlement._smallOpportunitiesNum += 1; heroInfor.chanceFixedCardList.Add(cardData); heroInfor.AddCapticalData(); } if (PlayerManager.Instance.IsHostPlayerTurn() == true) { MessageTips.Show(GameTipManager.Instance.gameTips.overOuterCardSmallFixed); } else { if (GameModel.GetInstance.isPlayNet == false) { MessageHint.Show(string.Format(SubTitleManager.Instance.subtitle.buyChanceCard2, heroInfor.playerName, cardData.title), null, true); } } if (GameModel.GetInstance.isPlayNet == false) { var battleController = UIControllerManager.Instance.GetController <UIBattleController>(); if (null != battleController) { if (PlayerManager.Instance.IsHostPlayerTurn()) { 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); } } } } return(canGet); }