Esempio n. 1
0
 /// <summary>
 /// 刷新时,会更新宝石状况(diamondInCar="")。
 /// </summary>
 public void Refresh(RoleInGame player, Car car, ref List <string> notifyMsg)
 {
     //this.Data["mile"].RemoveAll(item => (item - this.CreateTime).TotalMinutes > 120);
     //this.Data["business"].RemoveAll(item => (item - this.CreateTime).TotalMinutes > 120);
     //this.Data["volume"].RemoveAll(item => (item - this.CreateTime).TotalMinutes > 120);
     //this.Data["speed"].RemoveAll(item => (item - this.CreateTime).TotalMinutes > 120);
     this._costMiles    = 0;
     this._costBusiness = 0;
     this._costVolume   = 0;
     if (player.playerType == RoleInGame.PlayerType.player)
     {
         MileChanged((Player)player, car, ref notifyMsg, "mile");
         BusinessChanged((Player)player, car, ref notifyMsg, "business");
         VolumeChanged((Player)player, car, ref notifyMsg, "volume");
         SpeedChanged((Player)player, car, ref notifyMsg, "speed");
     }
     this.setCostMiles(0, player, car, ref notifyMsg);
     // this.costMiles = 0;
     this.setCostBusiness(0, player, car, ref notifyMsg);
     //this.set
     //this.costBusiness = 0;
     this.setCostVolume(0, player, car, ref notifyMsg);
     //this.costVolume = 0;
     this.setDiamondInCar("", player, car, ref notifyMsg);
     //  this.diamondInCar = "";
     //  this.setSubsidize(0, player, car, ref notifyMsg);
     //   this.subsidize = 0;
 }
Esempio n. 2
0
 internal void setAnimateData(RoleInGame player, ref List <string> notifyMsg, AnimateData2 data)
 {
     this.animateData = data;
     this._changeState++;
     SetAnimateChanged(player, this, ref notifyMsg);
     //  throw new NotImplementedException();
 }
Esempio n. 3
0
 public void setState(RoleInGame player, ref List <string> notifyMsg, CarState s)
 {
     this._state = s;
     if (player.playerType == RoleInGame.PlayerType.player)
     {
         SendStateAndPurpose((Player)player, this, ref notifyMsg);
     }
 }
Esempio n. 4
0
 internal void Refresh(RoleInGame player, ref List <string> notifyMsg)
 {
     this.setState(player, ref notifyMsg, CarState.waitAtBaseStation);
     //this.state = CarState.waitAtBaseStation;
     this.targetFpIndex = -1;
     this.setPurpose(player, ref notifyMsg, Purpose.@null);
     //this.purpose = Purpose.@null;
 }
Esempio n. 5
0
 public void setCostVolume(long costVolumeCostInput, RoleInGame role, Car car, ref List <string> notifyMsg)
 {
     this._costVolume = costVolumeCostInput;
     if (role.playerType == RoleInGame.PlayerType.player)
     {
         VolumeChanged((Player)role, car, ref notifyMsg, "volume");
     }
 }
Esempio n. 6
0
 public void setCostBusiness(long costBusinessCostInput, RoleInGame player, Car car, ref List <string> notifyMsg)
 {
     this._costBusiness = costBusinessCostInput;
     if (player.playerType == RoleInGame.PlayerType.player)
     {
         BusinessChanged((Player)player, car, ref notifyMsg, "business");
     }
 }
Esempio n. 7
0
 public void setCostMiles(long costMileInput, RoleInGame role, Car car, ref List <string> notifyMsg)
 {
     this._costMiles = costMileInput;
     if (role.playerType == RoleInGame.PlayerType.player)
     {
         MileChanged((Player)role, car, ref notifyMsg, "mile");
     }
 }
Esempio n. 8
0
 public void setDiamondInCar(string diamondInCarInput, RoleInGame role, Car car, ref List <string> notifyMsg)
 {
     this._diamondInCar = diamondInCarInput;
     if (role.playerType == RoleInGame.PlayerType.player)
     {
         this.DiamondInCarChanged((Player)role, car, ref notifyMsg, this.diamondInCar);
     }
 }
Esempio n. 9
0
 internal void setPurpose(RoleInGame role, ref List <string> notifyMsg, Purpose p)
 {
     this.purpose = p;
     if (role.playerType == RoleInGame.PlayerType.player)
     {
         this.SendPurposeOfCar((Player)role, this, ref notifyMsg);
     }
     //throw new NotImplementedException();
 }
Esempio n. 10
0
        public void AbilityAdd(string pType, RoleInGame role, Car car, ref List <string> notifyMsg)
        {
            if (this.Data.ContainsKey(pType))
            {
                this.Data[pType].Add(DateTime.Now);
                switch (pType)
                {
                case "mile":
                {
                    if (role.playerType == RoleInGame.PlayerType.player)
                    {
                        var player = (Player)role;
                        this.MileChanged(player, car, ref notifyMsg, pType);
                    }
                }; break;

                case "business":
                {
                    if (role.playerType == RoleInGame.PlayerType.player)
                    {
                        var player = (Player)role;
                        this.BusinessChanged(player, car, ref notifyMsg, pType);
                    }
                }; break;

                case "volume":
                {
                    if (role.playerType == RoleInGame.PlayerType.player)
                    {
                        var player = (Player)role;
                        this.VolumeChanged(player, car, ref notifyMsg, pType);
                    }
                }; break;

                case "speed":
                {
                    if (role.playerType == RoleInGame.PlayerType.player)
                    {
                        var player = (Player)role;
                        this.SpeedChanged(player, car, ref notifyMsg, pType);
                    }
                }; break;
                }
            }
        }
Esempio n. 11
0
        //internal delegate void AbilityChanged(Player player, Car car, ref List<string> notifyMsgs, string pType);
        /// <summary>
        /// 依次用辅助、business、volume来支付。
        /// </summary>
        /// <param name="needMoney"></param>
        internal void payForPromote(long needMoney, RoleInGame player, Car car, ref List <string> notifyMsgs)
        {
            //var pay1 = needMoney;// Math.Min(needMoney, this.subsidize);
            // this.subsidize -= pay1;

            //var subsidizeNew = this.subsidize - pay1;
            //if (subsidizeNew != this.subsidize)
            //{
            //    this.setSubsidize(subsidizeNew, player, car, ref notifyMsgs);
            //}

            //   needMoney -= pay1;

            var pay2 = Math.Min(needMoney, this.costBusiness);
            // this.costBusiness -= pay2;
            var costBusinessNew = this.costBusiness - pay2;

            if (costBusinessNew != this.costBusiness)
            {
                this.setCostBusiness(costBusinessNew, player, car, ref notifyMsgs);
            }
            needMoney -= pay2;
            if (pay2 > 0)
            {
                //needToUpdateCostBussiness = true;
            }

            /*
             * 在获得能力提升宝石过程中,不可能动costVolume上的钱。
             * 状态变成收集后,只能攻击或者继续收集
             */
            //var pay3 = Math.Min(needMoney, this.costVolume);
            //this.costVolume -= pay3;
            //needMoney -= pay3;

            if (needMoney != 0)
            {
                throw new Exception("");
            }
        }