コード例 #1
0
ファイル: QingGongYanManager.cs プロジェクト: chenchungit/ky
        /// <summary>
        /// 开启庆功宴
        /// </summary>
        private void OpenQingGongYan()
        {
            QingGongYanOpenFlag = true;

            QingGongYanInfo InfoData = GetInfoData();

            if (null == InfoData)
            {
                return;
            }

            GameMap gameMap = GameManager.MapMgr.DictMaps[InfoData.MapCode];
            // 策划要求x, y改成直接传值
            NPC npc = NPCGeneralManager.GetNPCFromConfig(InfoData.MapCode, InfoData.NpcID, InfoData.X, InfoData.Y, InfoData.Direction);

            if (null != npc)
            {
                if (NPCGeneralManager.AddNpcToMap(npc))
                {
                    QingGongYanNpc = npc;
                    //播放用户行为消息
                    string guildName    = GameManager.GameConfigMgr.GetGameConfigItemStr(GameConfigNames.QGYGuildName, "");
                    string broadCastMsg = StringUtil.substitute(Global.GetLang("为庆祝{0}战盟在罗兰城战中取得胜利,慷慨的罗兰城主正在勇者大陆摆开宴席,恭候各位光临!"), guildName);
                    Global.BroadcastRoleActionMsg(null, RoleActionsMsgTypes.Bulletin, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.SysHintAndChatBox);
                }
                else
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("OpenQingGongYan, AddNpcToMap Faild !InfoData.MapCode={0}, InfoData.NpcID={1}", InfoData.MapCode, InfoData.NpcID));
                }
            }
        }
コード例 #2
0
 public void MarryPartyPeriodicUpdate(long ticks)
 {
     if (ticks >= this.NextUpdateTime)
     {
         this.NextUpdateTime = ticks + 10000L;
         bool showNPC = this.m_MarryPartyDataCache.HasPartyStarted(ticks);
         if (showNPC != this.MarryPartyNPCShow)
         {
             this.MarryPartyNPCShow = showNPC;
             if (showNPC)
             {
                 GameMap gameMap = GameManager.MapMgr.DictMaps[this.MarryPartyNPCConfig.MapCode];
                 NPC     npc     = NPCGeneralManager.GetNPCFromConfig(this.MarryPartyNPCConfig.MapCode, this.MarryPartyNPCConfig.NpcID, this.MarryPartyNPCConfig.NpcX, this.MarryPartyNPCConfig.NpcY, this.MarryPartyNPCConfig.NpcDir);
                 if (null != npc)
                 {
                     if (NPCGeneralManager.AddNpcToMap(npc))
                     {
                         this.MarryPartyNpc = npc;
                     }
                     else
                     {
                         LogManager.WriteLog(LogTypes.Error, string.Format("add marry party npc failure, MapCode={0}, NpcID={1}", this.MarryPartyNPCConfig.MapCode, this.MarryPartyNPCConfig.NpcID), null, true);
                     }
                 }
             }
             else if (null != this.MarryPartyNpc)
             {
                 NPCGeneralManager.RemoveMapNpc(this.MarryPartyNPCConfig.MapCode, this.MarryPartyNPCConfig.NpcID);
                 this.MarryPartyNpc = null;
             }
         }
     }
 }
コード例 #3
0
        private void OpenQingGongYan()
        {
            this.QingGongYanOpenFlag = true;
            QingGongYanInfo InfoData = this.GetInfoData();

            if (null != InfoData)
            {
                GameMap gameMap = GameManager.MapMgr.DictMaps[InfoData.MapCode];
                NPC     npc     = NPCGeneralManager.GetNPCFromConfig(InfoData.MapCode, InfoData.NpcID, InfoData.X, InfoData.Y, InfoData.Direction);
                if (null != npc)
                {
                    if (NPCGeneralManager.AddNpcToMap(npc))
                    {
                        GameManager.ClientMgr.BroadcastServerCmd(733, "1", false);
                        this.QingGongYanNpc = npc;
                        string guildName    = GameManager.GameConfigMgr.GetGameConfigItemStr("qinggongyan_guildname", "");
                        string broadCastMsg = StringUtil.substitute(GLang.GetLang(524, new object[0]), new object[]
                        {
                            guildName
                        });
                        Global.BroadcastRoleActionMsg(null, RoleActionsMsgTypes.Bulletin, broadCastMsg, true, GameInfoTypeIndexes.Hot, ShowGameInfoTypes.SysHintAndChatBox, 0, 0, 100, 100);
                    }
                    else
                    {
                        LogManager.WriteLog(LogTypes.Error, string.Format("OpenQingGongYan, AddNpcToMap Faild !InfoData.MapCode={0}, InfoData.NpcID={1}", InfoData.MapCode, InfoData.NpcID), null, true);
                    }
                }
            }
        }
コード例 #4
0
ファイル: LuaManager.cs プロジェクト: songxiaopeng/mu_server
        public void AddNpcToMap(int npcID, int mapCode, int toX, int toY)
        {
            NPC npc = NPCGeneralManager.GetNPCFromConfig(mapCode, npcID, toX, toY, 0);

            if (null != npc)
            {
                NPCGeneralManager.AddNpcToMap(npc);
            }
        }
コード例 #5
0
ファイル: LuaManager.cs プロジェクト: songxiaopeng/mu_server
        public void AddNPCForClient(GameClient client, int npcID, int toX, int toY)
        {
            NPC npc = NPCGeneralManager.GetNPCFromConfig(client.ClientData.MapCode, npcID, toX, toY, 0);

            if (null != npc)
            {
                GameManager.ClientMgr.NotifyMySelfNewNPC(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, npc);
            }
        }
コード例 #6
0
ファイル: MarryPartyLogic.cs プロジェクト: chenchungit/ky
        public void MarryPartyPeriodicUpdate(long ticks)
        {
            // 10秒检测一次
            if (ticks < NextUpdateTime)
            {
                return;
            }
            NextUpdateTime = ticks + 1000 * 10;

            bool showNPC = m_MarryPartyDataCache.HasPartyStarted(ticks);

            if (showNPC != MarryPartyNPCShow)
            {
                MarryPartyNPCShow = showNPC;

                if (showNPC == true)
                {
                    GameMap gameMap = GameManager.MapMgr.DictMaps[MarryPartyNPCConfig.MapCode];
                    NPC     npc     = NPCGeneralManager.GetNPCFromConfig(MarryPartyNPCConfig.MapCode, MarryPartyNPCConfig.NpcID, MarryPartyNPCConfig.NpcX, MarryPartyNPCConfig.NpcY, MarryPartyNPCConfig.NpcDir);
                    if (null != npc)
                    {
                        if (NPCGeneralManager.AddNpcToMap(npc))
                        {
                            MarryPartyNpc = npc;
                        }
                        else
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("add marry party npc failure, MapCode={0}, NpcID={1}", MarryPartyNPCConfig.MapCode, MarryPartyNPCConfig.NpcID));
                        }
                    }
                }
                else
                {
                    if (null != MarryPartyNpc)
                    {
                        NPCGeneralManager.RemoveMapNpc(MarryPartyNPCConfig.MapCode, MarryPartyNPCConfig.NpcID);
                        MarryPartyNpc = null;
                    }
                }
            }
        }