Beispiel #1
0
        /// <summary>
        /// 判定某个UniqueID是否处于激活状态
        /// </summary>
        /// <returns><c>true</c>, if under active status was ised, <c>false</c> otherwise.</returns>
        /// <param name="camp">Camp.</param>
        /// <param name="UniqueID">Unique I.</param>
        public ServerLifeNpc findActionNpc(WarUIInfo switchInfo)
        {
            ServerLifeNpc activeOne = null;

            if (switchInfo != null)
            {
                WarCamp camp     = switchInfo.camp;
                string  UID      = switchInfo.ClientID;
                int     UniqueID = switchInfo.uniqueId;

                List <RoomCharactor> CharactorList = null;
                bool found = allCharactors.TryGetValue(camp, out CharactorList);
                if (found)
                {
                    RoomCharactor existC = CharactorList.Find(c => c.UID == UID);
                    if (existC != null)
                    {
                        WrapperTeam wrapperTeam = (WrapperTeam)existC.team;
                        if (wrapperTeam.activeNpc.UniqueID == UniqueID)
                        {
                            activeOne = wrapperTeam.activeNpc;
                        }
                    }
                }
            }

            return(activeOne);
        }
Beispiel #2
0
        public void ManualAuto(string autoInfo)
        {
            ManualOrAuto auto = JSON.Instance.ToObject <ManualOrAuto>(autoInfo);

            processedMsg = new NetMQMessage();

            bool isAuto = false;
            bool ok     = monitor.CharactorPool.SwitchManulOrAuto(auto, ref isAuto);

            if (ok)
            {
                processedMsg.Append(WarMsgConsts.ManualOrAutoRep);
                processedMsg.Append(isAuto ? "1" : "0");


                //如果战斗开始了,切换AI
                if (WarServerManager.Instance.battleStart)
                {
                    WarUIInfo ui = new WarUIInfo();
                    ui.camp     = auto.camp;
                    ui.ClientID = auto.ClientID;
                    ui.uniqueId = auto.UniqueID;

                    ServerLifeNpc npc = monitor.CharactorPool.findActionNpc(ui);

                    //TODO : switch AI
                    AsyncTask.QueueOnMainThread(() => {
                        if (npc != null)
                        {
                            npc.SwitchAutoBattle(isAuto);
                        }
                    });
                }
            }
            else
            {
                processedMsg.Append(WarMsgConsts.ManualOrAutoRepE);
            }
        }