internal void setAnimateData(Player player, ref List <string> notifyMsg, AnimateData data) { this.animateData = data; this._changeState++; SetAnimateChanged(player, this, ref notifyMsg); // throw new NotImplementedException(); }
/// <summary> /// 删除对象时,这个要释放 /// </summary> //List<Model.MapGo.nyrqPosition> returningRecord(string playerKey, string carKey) //{ // if (this._Players.ContainsKey(key)) // { // return this._Players[key].returningRecord; // } // else // { // return new List<Model.MapGo.nyrqPosition>(); // } //} /// <summary> /// 当没有抢到宝石-或者收集、保护费,在路上待命。 /// </summary> /// <param name="target"></param> /// <param name="car"></param> private void carParkOnRoad(int target, ref Car car, Player player, ref List <string> notifyMsgs) { var fp = Program.dt.GetFpByIndex(target); double endX, endY; CommonClass.Geography.calculatBaideMercatorIndex.getBaiduPicIndex(fp.positionLongitudeOnRoad, fp.positionLatitudeOnRoad, out endX, out endY); var animate = new AnimateData() { animateData = new List <Data.PathResult>() { new Data.PathResult() { t0 = 0, x0 = endX, y0 = endY, t1 = 200000, x1 = endX, y1 = endY } }, recordTime = DateTime.Now }; car.setAnimateData(player, ref notifyMsgs, animate); //car.animateData = new AnimateData() //{ // animateData = new List<Data.PathResult>() // { // new Data.PathResult() // { // t0=0, // x0=endX, // y0=endY, // t1=200000, // x1=endX, // y1=endY // } // }, // recordTime = DateTime.Now //}; if (this.debug) { //var goPath = Program.dt.GetAFromB(car.targetFpIndex, this.collectPosition); //var returnPath = Program.dt.GetAFromB(this.collectPosition, player.StartFPIndex); //var goMile = GetMile(goPath); //var returnMile = GetMile(returnPath); //if (goMile + returnMile > car.ability.leftMile) //{ // for (int i = 0; i < 3; i++) // { // Console.WriteLine($"现在回收是要返回的!"); // } //} } }
private void EditCarStateWhenAttackStartOK(Player player, ref Car car, int to, Model.FastonPosition fp1, SetAttack sa, List <Model.MapGo.nyrqPosition> goPath, out int startT, ref List <string> notifyMsg) { car.targetFpIndex = to;//A.更改小车目标,在其他地方引用。 car.setPurpose(this._Players[sa.Key], ref notifyMsg, Purpose.attack); // car.purpose = Purpose.attack;//B.更改小车目的,小车变为攻击状态! // car.changeState++;//C.更改状态用去前台更新动画 /* * D.更新小车动画参数 */ var speed = car.ability.Speed; startT = 0; List <Data.PathResult> result; if (car.state == CarState.waitAtBaseStation) { result = getStartPositon(fp1, sa.car, ref startT); } else if (car.state == CarState.waitForCollectOrAttack) { result = new List <Data.PathResult>(); } else if (car.state == CarState.waitForTaxOrAttack) { result = new List <Data.PathResult>(); } else if (car.state == CarState.waitOnRoad) { result = new List <Data.PathResult>(); } else { throw new Exception("错误的汽车类型!!!"); } car.setState(this._Players[sa.Key], ref notifyMsg, CarState.roadForAttack); //car.state = CarState.roadForAttack; // this.SendStateAndPurpose(this._Players[sa.Key], car, ref notifyMsg); Program.dt.GetAFromBPoint(goPath, fp1, speed, ref result, ref startT); result.RemoveAll(item => item.t0 == item.t1); var animateData = new AnimateData() { animateData = result, recordTime = DateTime.Now }; car.setAnimateData(player, ref notifyMsg, animateData); //car.animateData = new AnimateData() //{ // animateData = result, // recordTime = DateTime.Now //}; }
private void EditCarStateWhenPromoteStartOK(Player player, ref Car car, int to, Model.FastonPosition fp1, int to2, SetPromote sp, List <Model.MapGo.nyrqPosition> goPath, ref List <string> nofityMsgs, out int startT) { car.targetFpIndex = to; //A.更改小车目标,在其他地方引用。 // car.changeState++;//B.更改状态用去前台更新动画 /* * C.更新小车动画参数 */ var speed = car.ability.Speed; startT = 0; List <Data.PathResult> result; if (car.state == CarState.waitOnRoad) { result = new List <Data.PathResult>(); } else if (car.state == CarState.waitAtBaseStation) { result = getStartPositon(fp1, sp.car, ref startT); } else if (car.state == CarState.waitForCollectOrAttack) { result = new List <Data.PathResult>(); } else if (car.state == CarState.waitForTaxOrAttack) { result = new List <Data.PathResult>(); } else { Console.WriteLine($"{Newtonsoft.Json.JsonConvert.SerializeObject(car)}"); throw new Exception("错误的汽车类型!!!"); } Program.dt.GetAFromBPoint(goPath, fp1, speed, ref result, ref startT); result.RemoveAll(item => item.t0 == item.t1); var animateData = new AnimateData() { animateData = result, recordTime = DateTime.Now }; car.setAnimateData(player, ref nofityMsgs, animateData); //car.animateData = new AnimateData() //{ // animateData = result, // recordTime = DateTime.Now //}; car.setState(player, ref nofityMsgs, CarState.buying); // car.state = CarState.buying;//更改汽车状态 //Thread th = new Thread(() => setDiamondOwner(startT, new commandWithTime.diamondOwner() //{ // c = "diamondOwner", // key = sp.Key, // car = sp.car, // returnPath = returnPath, // target = to,//新的起点 // changeType = sp.pType, // costMile = goMile //})); //th.Start(); //car.changeState++;//更改状态 //getAllCarInfomations(sp.Key, ref notifyMsg); }
void DoCollectTaxF(Player player, Car car, SetTax st, ref List <string> notifyMsg, out MileResultReason reason) { var from = this.getFromWhenDoCollectTax(player, car); var to = st.target; var fp1 = Program.dt.GetFpByIndex(from); var fp2 = Program.dt.GetFpByIndex(to); var baseFp = Program.dt.GetFpByIndex(player.StartFPIndex); // var goPath = Program.dt.GetAFromB(from, to); var goPath = this.GetAFromB(from, to, player, ref notifyMsg); // var returnPath = Program.dt.GetAFromB(to, player.StartFPIndex); var returnPath = this.GetAFromB(to, player.StartFPIndex, player, ref notifyMsg); var goMile = GetMile(goPath); var returnMile = GetMile(returnPath); if (car.ability.leftMile >= goMile + returnMile) { car.targetFpIndex = to; Console.WriteLine($"{car.name}的目标设置成了{Program.dt.GetFpByIndex(to).FastenPositionName}"); car.setPurpose(player, ref notifyMsg, Purpose.tax); //car.purpose = Purpose.tax; var speed = car.ability.Speed; int startT = 0; List <Data.PathResult> result; if (car.state == CarState.waitAtBaseStation) { result = getStartPositon(fp1, st.car, ref startT); } else if (car.state == CarState.waitForTaxOrAttack) { result = new List <Data.PathResult>(); } else if (car.state == CarState.waitOnRoad && car.ability.diamondInCar == "" && (car.purpose == Purpose.@null || car.purpose == Purpose.tax)) { result = new List <Data.PathResult>(); } else { throw new Exception($"未知情况!{Newtonsoft.Json.JsonConvert.SerializeObject(car)}"); } car.setState(player, ref notifyMsg, CarState.roadForTax); //car.state = CarState.roadForTax; Program.dt.GetAFromBPoint(goPath, fp1, speed, ref result, ref startT); result.RemoveAll(item => item.t0 == item.t1); var animateData = new AnimateData() { animateData = result, recordTime = DateTime.Now }; car.setAnimateData(player, ref notifyMsg, animateData); //car.animateData = new AnimateData() //{ // animateData = result, // recordTime = DateTime.Now //}; Thread th = new Thread(() => setArrive(startT, new commandWithTime.placeArriving() { c = "placeArriving", key = st.Key, car = st.car, returnPath = returnPath, target = to, costMile = goMile })); th.Start(); reason = MileResultReason.Abundant; // car.changeState++;//更改状态 car.setPurpose(player, ref notifyMsg, Purpose.tax); //car.purpose = Purpose.tax; //getAllCarInfomations(st.Key, ref notifyMsg); } else if (car.ability.leftMile >= goMile) { //当攻击失败,必须返回 Console.Write($"去程{goMile},回程{returnMile}"); Console.Write($"你去了回不来"); #warning 这里要在前台进行提示 reason = MileResultReason.CanNotReturn; } else { #warning 这里要在web前台进行提示 //当攻击失败,必须返回 Console.Write($"去程{goMile},回程{returnMile}"); Console.Write($"你去不了"); reason = MileResultReason.CanNotReach; } }