Exemple #1
0
        string updateActionBySys(interfaceOfEngine.tryCatchAction actionDo, OrderToReturnBySystem c, string operateKey)
        {
            string conditionNotReason;

            if (actionDo.conditionsOk(c, out conditionNotReason))
            {
                List <string> notifyMsg = new List <string>();
                lock (that.PlayerLock)
                {
                    if (that._Players.ContainsKey(operateKey))
                    {
                        if (that._Players[operateKey].Bust)
                        {
                            var player = that._Players[operateKey];
                            var car    = that._Players[operateKey].getCar();
                            switch (car.state)
                            {
                            case CarState.waitOnRoad:
                            {
                                if (actionDo.carAbilitConditionsOk(player, car, c))
                                {
                                    car.setState(player, ref notifyMsg, CarState.returning);
                                    setReturn(new returnning()
                                        {
                                            c            = "returnning",
                                            changeType   = returnning.ChangeType.BeforeTax,
                                            key          = player.Key,
                                            returningOjb = player.returningOjb,
                                            target       = car.targetFpIndex
                                        });
                                }
                            }; break;
                            }
                        }
                    }
                }

                for (var i = 0; i < notifyMsg.Count; i += 2)
                {
                    var url     = notifyMsg[i];
                    var sendMsg = notifyMsg[i + 1];
                    //Console.WriteLine($"url:{url}");
                    if (!string.IsNullOrEmpty(url))
                    {
                        Startup.sendMsg(url, sendMsg);
                    }
                }
                return("");
            }
            else
            {
                return(conditionNotReason);
            }
        }
Exemple #2
0
        internal string updateAction(interfaceOfEngine.tryCatchAction actionDo, Command c, string operateKey)
        {
            string conditionNotReason;

            if (actionDo.conditionsOk(c, out conditionNotReason))
            {
                List <string> notifyMsg = new List <string>();
                lock (that.PlayerLock)
                {
                    if (that._Players.ContainsKey(operateKey))
                    {
                        if (that._Players[operateKey].Bust)
                        {
                        }
                        else
                        {
                            var player = that._Players[operateKey];
                            var car    = that._Players[operateKey].getCar();
                            switch (car.state)
                            {
                            case CarState.waitAtBaseStation:
                            case CarState.waitOnRoad:
                            {
                                if (actionDo.carAbilitConditionsOk(player, car, c))
                                {
                                    MileResultReason mrr;
                                    RoomMainF.RoomMain.commandWithTime.ReturningOjb returningOjb = actionDo.maindDo(player, car, c, ref notifyMsg, out mrr);
                                    if (mrr == MileResultReason.Abundant)
                                    {
                                        player.returningOjb = returningOjb;
                                    }
                                    else if (mrr == MileResultReason.CanNotReach)
                                    {
                                        actionDo.failedThenDo(car, player, c, ref notifyMsg);
                                        this.WebNotify(player, "小车不能到达目的地,被安排返回!");
                                    }
                                    else if (mrr == MileResultReason.CanNotReturn)
                                    {
                                        actionDo.failedThenDo(car, player, c, ref notifyMsg);
                                        this.WebNotify(player, "小车到达目的地后不能返回,在当前地点安排返回!");
                                    }
                                    else if (mrr == MileResultReason.MoneyIsNotEnougt)
                                    {
                                        actionDo.failedThenDo(car, player, c, ref notifyMsg);
                                    }
                                    else if (mrr == MileResultReason.NearestIsMoneyWhenPromote)
                                    {
                                    }
                                    else if (mrr == MileResultReason.NearestIsMoneyWhenAttack)
                                    {
                                        // this.WebNotify(player, $"离宝石最近的是钱,不是你的车。请离宝石再近点儿!");
                                    }
                                }
                                else
                                {
                                    actionDo.failedThenDo(car, player, c, ref notifyMsg);
                                }
                            }; break;

                            case CarState.working:
                            {
                                this.WebNotify(player, "您的小车正在赶往目标!");
                            }; break;

                            case CarState.returning:
                            {
                                WebNotify(player, "您的小车正在返回!");
                            }; break;
                            }
                            //  MeetWithNPC(sa);
                        }
                    }
                }
                this.sendMsg(notifyMsg);
                //for (var i = 0; i < notifyMsg.Count; i += 2)
                //{
                //    var url = notifyMsg[i];
                //    var sendMsg = notifyMsg[i + 1];
                //    //Console.WriteLine($"url:{url}");
                //    if (!string.IsNullOrEmpty(url))
                //    {
                //        Startup.sendMsg(url, sendMsg);
                //    }
                //}
                return("");
            }
            else
            {
                return(conditionNotReason);
            }
        }