Ejemplo n.º 1
0
    void _ME(ModuleEvent <Module_Union> e)
    {
        if (!actived)
        {
            return;
        }
        switch (e.moduleEvent)
        {
        case Module_Union.EventUnionClamisInfo:
            if (m_unionReward.isOn)
            {
                ShowRewardPlane(moduleUnion.UnionClaimsInfo);
            }
            else if (m_friendReward.isOn)
            {
                ShowRewardPlane(moduleUnion.FriendClaimsInfo);
            }
            break;

        case Module_Union.EventUnionClamisGive:
            if (m_unionReward.isOn)
            {
                ShowRewardPlane(moduleUnion.UnionClaimsInfo);
            }
            else if (m_friendReward.isOn)
            {
                ShowRewardPlane(moduleUnion.FriendClaimsInfo);
            }
            break;

        case Module_Union.EventUnionRelaseSelf:
            //自己任务发布成功
            ReturnInfo();
            break;

        case Module_Union.EventUnionClamisRemove:
            var mType      = Util.Parse <int>(e.param1.ToString());
            var playerInfo = (PReleaseReward)e.param2;
            if (mType == 0)
            {
                RecivedRemove(playerInfo, mType, moduleUnion.UnionClaimsInfo);
            }
            else if (mType == 1)
            {
                RecivedRemove(playerInfo, mType, moduleUnion.FriendClaimsInfo);
            }
            break;

        case Module_Union.EventUnionClamisRecord:
            var rType = Util.Parse <int>(e.param1.ToString());
            SetRecordList(rType);
            break;

        case Module_Union.EventUnionClamisSelf:
            //刷新自己信息
            if (m_unionReward.isOn)
            {
                m_rewardData.UpdateItem(0);
            }
            break;
        }
    }
Ejemplo n.º 2
0
    void _ME(ModuleEvent <Module_Mailbox> e)
    {
        switch (e.moduleEvent)
        {
        case Module_Mailbox.NoMailsEvent:
        {
            if (moduleMailbox.allMails != null && moduleMailbox.allMails.Count > 0)
            {
                return;
            }

            nothing.SafeSetActive(true);
            mailTitle.text          = null;
            mailSender.text         = null;
            mailTitleTime.text      = null;
            mailContent.text        = null;
            getAll.interactable     = false;
            deleteRead.interactable = false;
            getBtn.SafeSetActive(false);
            mailNumber.text = "0/100";
            selectIndex     = 0;
            dataSource.SetItems(null);
            SetButtonEnable();
            break;
        }

        case Module_Mailbox.AllMailsEvent:
        {
            selectIndex = 0;
            nothing.SafeSetActive(false);
            dataSource.SetItems(moduleMailbox.allMails);
            OnClick(moduleMailbox.allMails[0]);
            mailNumber.text = Util.Format("{0}/100", moduleMailbox.allMails.Count);
            SetButtonEnable();
            break;
        }

        case Module_Mailbox.ReadMailEvent: dataSource.UpdateItem(selectIndex); break;

        case Module_Mailbox.GetAttachmentSuccessEvent:
        {
            ulong id = (ulong)e.param1;
            if (moduleMailbox.isGetAll == 1)    //不是全部领取
            {
                //RefreshGetRewardPanel(moduleMailbox.currentMail.attachment);
                List <PItem2> lists = new List <PItem2>();
                lists.AddRange(moduleMailbox.currentMail.attachment);
                string str = ConfigText.GetDefalutString(TextForMatType.MailUIText, 13);
                Window_ItemTip.Show(str, lists);
                moduleMailbox.OnDeleteRewards(true, id);
                moduleMailbox.isGetAll = 0;
            }
            else if (moduleMailbox.isGetAll == 2)
            {
                noticeTip.SafeSetActive(false);
                moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.MailUIText, 0));
                moduleMailbox.OnDeleteRewards(false);
                moduleMailbox.isGetAll = 0;
            }

            for (int i = 0; i < moduleMailbox.allMails.Count; i++)
            {
                if (moduleMailbox.allMails[i].mailId == id)
                {
                    moduleMailbox.allMails[i].isRead = 1;
                    moduleMailbox.allMails[i].isGet  = 1;
                }
            }

            SetButtonEnable();

            getBtn.SafeSetActive(false);
            awardGoods.SafeSetActive(false);
            deleteRead.interactable = true;

            dataSource.UpdateItems();
            break;
        }

        case Module_Mailbox.GetAttachmentFailedEvent:
        {
            sbyte result = (sbyte)e.param1;
            switch (result)
            {
            case 1:
                moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.MailUIText, 2));
                break;

            case 2:
                moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.MailUIText, 3));
                break;
            }
            getAll.interactable = true;
            break;
        }

        default: break;
        }
    }
Ejemplo n.º 3
0
 public void SaveEvent(ModuleEvent ev)
 {
     _moduleeventRepository.InsertOrUpdate(ev);
 }
Ejemplo n.º 4
0
    private void _ME(ModuleEvent <Module_Set> e)
    {
        switch (e.moduleEvent)
        {
        case Module_Set.EventBindAccount:
        {
            var code = (int)e.param1;
            if (code == 0)
            {
                isClickRegisterBtn = true;
                moduleGlobal.ShowMessage(system_txt[31]);
                Close_tip();
                Accont_click.gameObject.SetActive(false);
            }
            else
            {
                var rstr = moduleLogin.Result(code);
                moduleGlobal.ShowMessage(rstr);
            }
            break;
        }

        case Module_Set.EventHeadChange:
        {
            AllHeadData.UpdateItems();
            Close_tip();
            break;
        }

        case Module_Set.EventIntroudChange:
            var bb = Util.Parse <int>(e.param1.ToString());
            if (bb == 0)
            {
                modulePlayer.roleInfo.sign = introduce_plane_txt.text;
                introduce_txt.text         = moduleSet.SetSignTxt(modulePlayer.roleInfo.sign);
                Close_tip();
            }
            else
            {
                moduleGlobal.ShowMessage(system_txt[33]);
            }
            break;

        case Module_Set.EventNameChange:
            //更改成功
            AudioManager.PlaySound(AudioInLogicInfo.audioConst.clickToSucc);    //更改成功的音效
            var result = Util.Parse <int>(e.param2.ToString());

            if (result == 0)
            {
                var formatText = e.param1 as string;
                Util.SetText(m_name, formatText);
                Close_tip();
            }
            else
            {
                Nametips(result);
                change_name.gameObject.SetActive(true);
                sure_name_change.gameObject.SetActive(false);
                name_txt.text = string.Empty;
            }
            break;

        case Module_Set.EventBangAward:
            var reward  = e.param1 as PReward;
            var result1 = Util.Parse <int>(e.param2.ToString());
            award_txt.text = string.Empty;

            if (result1 == 0)    //出现奖励条例
            {
                Window_ItemTip.Show(system_txt[70], reward);
                Close_tip();
            }
            break;
        }
    }
Ejemplo n.º 5
0
 public virtual void _ME(ModuleEvent <Module_Pet> e)
 {
     dataSource.UpdateItems();
 }
Ejemplo n.º 6
0
 internal void SendEvent(ModuleBase source, EventBase e)
 {
     ModuleEvent?.Invoke(source, e);
 }
Ejemplo n.º 7
0
        public void InitializeTest()
        {
            _container = new GwnClassBase().GetContainer();

            // Framework registration for catalog
            _container
                .RegisterType<IModuleManager, ModuleManager>(new Singleton())
                .RegisterType<IModuleCatalog, ModuleCatalog>(new Singleton());

            var eventManager = _container.Resolve<EventManager>();
            _moduleEvent = eventManager.GetEvent<ModuleEvent>();
        }
Ejemplo n.º 8
0
    private void _ME(ModuleEvent <Module_Chat> e)
    {
        switch (e.moduleEvent)
        {
        case Module_Chat.EventChatRecWordMes:
            if (!word_mes.isOn)
            {
                return;
            }
            ScChatRoomMessage wordmes = e.msg as ScChatRoomMessage;
            string[]          info    = wordmes.tag.Split('/');
            if (info.Length < 5)
            {
                return;
            }
            SetClone(false, wordmes.type, wordmes.content, wordmes.sendId, info);
            SetTipTxtShow(OpenWhichChat.WorldChat);
            break;

        case Module_Chat.EventChatRecSysMes:
            if (!sys_mes.isOn)
            {
                return;
            }
            string sysmes = e.param1.ToString();
            SysAdd(sysmes);
            SetTipTxtShow(OpenWhichChat.SysChat);
            break;

        case Module_Chat.EventChatRecUnionMes:
            if (!m_unionBtn.isOn)
            {
                return;
            }
            ScChatGroup union = e.msg as ScChatGroup;
            AddUnionMes(union);
            SetTipTxtShow(OpenWhichChat.UnionChat);
            break;

        case Module_Chat.EventChatRecTeamMes:
            RecieveMsg(e.msg as ScChatPrivate);
            break;

        case Module_Chat.EventChatSendTeamMes:
            SendPrivateMsg(e.msg as CsChatPrivate);
            break;

        case Module_Chat.EventChatChangeRoom:
            int result = Util.Parse <int>(e.param1.ToString());
            ChangeRoom(result);
            break;

        case Module_Chat.EventChatRoomList:
            roomchange_btn.interactable = true;
            roomchange_btn_txt.text     = moduleChat.RoomChatNum.ToString();
            room_all.text = moduleChat.Chat_list.Count.ToString();
            break;

        case Module_Chat.EventChatPlayerDetails:
            var playerInfo = e.msg as PPlayerInfo;
            FriendDetailInfo playerDetail = m_detailPlane.GetComponentDefault <FriendDetailInfo>();
            playerDetail.IsfriendDetails(playerInfo, true, SetInvate);
            m_detailPlane.gameObject.SetActive(true);
            break;

        case Module_Chat.EventChatWindowHide:
            if (actived)
            {
                Hide(true);
            }
            break;
        }
    }
Ejemplo n.º 9
0
    void _ME(ModuleEvent <Module_Active> e)
    {
        switch (e.moduleEvent)
        {
        case Module_Active.EventActiveCoopInvate:
            //接到可邀请列表
            OpenInvatePlane();
            break;

        case Module_Active.EventActiveCoopInfo:
            //所有任务
            SetCoolPlane();
            SetHint();
            break;

        case Module_Active.EventActiveCoopInvateSuc:
            //邀请成功
            var invate = Util.Parse <int>(e.param1.ToString());
            CoopAllInfo.UpdateItem(invate);
            break;

        case Module_Active.EventActiveCoopKiced:
            //踢出成功
            var kiced = Util.Parse <int>(e.param1.ToString());
            CoopAllInfo.UpdateItem(kiced);
            break;

        case Module_Active.EventActiveCoopBeKiced:
            //被踢出
            CoopAllInfo.SetItems(moduleActive.CoopTaskList);
            break;

        case Module_Active.EventActiveCoopValue:
            //进度变化
            var value = Util.Parse <int>(e.param1.ToString());
            CoopAllInfo.UpdateItem(value);
            break;

        case Module_Active.EventActiveCoopCanGet:
            //可领取
            var get = Util.Parse <int>(e.param1.ToString());
            CoopAllInfo.UpdateItem(get);
            SetHint();
            break;

        case Module_Active.EventActiveCoopGet:
            //领取成功
            var      succed = Util.Parse <int>(e.param1.ToString());
            PItem2[] reward = e.param2 as PItem2[];
            CoopAllInfo.UpdateItem(succed);
            if (actived && reward != null)
            {
                Window_ItemTip.Show(active_text[59], reward);
            }
            break;

        case Module_Active.EventActiveCoopApply:
            CoopAllInfo.SetItems(moduleActive.CoopTaskList);
            break;

        case Module_Active.EventActiveDayInfo:
            //上线接收日常详情
            DailyAllInfo.SetItems(moduleActive.DailyOpenList);
            NoDailyTask();
            SetHint();
            break;

        case Module_Active.EventActiveDayValue:
            // 日常进度值有变化
            PDailyInfo info  = e.msg as PDailyInfo;
            int        index = GetDIndex(info.taskId);
            if (index != -1)
            {
                DailyAllInfo.SetItem(info, index);
            }
            break;

        case Module_Active.EventActiveDayReach:
            //日常任务达成可以领取奖励
            PDailyInfo cinfo = e.msg as PDailyInfo;
            DailyAllInfo.RemoveItem(cinfo);
            DailyAllInfo.AddItem(cinfo, 0);
            DailyAllInfo.UpdateItems();
            SetHint();
            break;

        case Module_Active.EventActiveDayGet:
            //日常任务奖励领取成功
            PDailyInfo dinfo = e.param1 as PDailyInfo;
            PDailyTask tinfo = e.param2 as PDailyTask;
            DailyAllInfo.RemoveItem(dinfo);
            GetAwardShow(tinfo.reward);
            ActiveNum();    //更改今日活跃度进度值
            NoDailyTask();
            break;

        case Module_Active.EventActiveDayOpen:
            //日常任务开启类似早午餐那种
            DailyAllInfo.UpdateItems();
            NoDailyTask();
            SetHint();
            break;

        case Module_Active.EventActiveDayClose:
            //日常任务过期了 直接删掉
            PDailyInfo overinfo = e.param1 as PDailyInfo;
            DailyAllInfo.RemoveItem(overinfo);
            NoDailyTask();
            SetHint();
            break;

        case Module_Active.EventActiveAchieveInfo:
            //上线接收成就详情每次都刷新
            AchieveAllInfo.SetItems(moduleActive.Achieveinfo);
            SetHint();
            break;

        case Module_Active.EventActiveAchieveValue:
            //进度值变化
            PAchieve pinfo  = e.msg as PAchieve;
            int      pindex = GetPIndex(pinfo.id);
            if (pindex != -1)
            {
                AchieveAllInfo.SetItem(pinfo, pindex);
            }
            break;

        case Module_Active.EventActiveAchieveCanGet:
            //成就达成可领取奖励调用同一个方法
            PAchieve ainfo = e.msg as PAchieve;
            AchieveAllInfo.RemoveItem(ainfo);
            AchieveAllInfo.AddItem(ainfo, 0);
            SetHint();
            break;

        case Module_Active.EventActiveAchieveGet:
            //成就奖励领取完毕调用同一个方法
            PAchieve ainfo1 = e.msg as PAchieve;
            GetAwardShow(ainfo1.reward, true);
            AchieveAllInfo.SetItems(moduleActive.Achieveinfo);
            break;

        case Module_Active.EventActiveAchieveOpen:
            //某些活动开启 删掉重新创建
            AchieveAllInfo.UpdateItems();
            SetHint();
            break;

        case Module_Active.EventActiveDailyCanGet:
            // 日活跃度可以领取奖励
            PActiveBox activeindo = e.msg as PActiveBox;
            ActiveShua(activeindo);    //可领取
            SetHint();
            break;

        case Module_Active.EventActiveDailyGet:
            //日常活跃度奖励领取成功
            award_plane.gameObject.SetActive(false);
            PActiveBox activeinfos = e.msg as PActiveBox;
            ActiveShua(activeinfos);    //可领取
            Activetask();
            GetAwardShow(activeinfos.reward);
            break;

        case Module_Active.EventActiveWeekCanGet:
            //周活跃度达成可以领取奖励
            PActiveBox WCanInfo = e.msg as PActiveBox;
            WhichShua(WCanInfo.id);
            SetHint();
            break;

        case Module_Active.EventActiveWeekGet:
            //周活跃度奖励领取成功
            PActiveBox WInfo = e.msg as PActiveBox;
            award_plane.gameObject.SetActive(false);
            WhichShua(WInfo.id);
            GetAwardShow(WInfo.reward);
            break;

        default:
            break;
        }
    }
Ejemplo n.º 10
0
 public ModuleEventArgs(ModuleEvent e, String message)
 {
     Event   = e;
     Message = message;
 }
Ejemplo n.º 11
0
    private void _ME(ModuleEvent <Module_PVE> e)
    {
        switch (e.moduleEvent)
        {
        //复活
        case Module_PVE.EventRebornState:
            bool isSuccess = (bool)e.param1;
            if (isSuccess)
            {
                countDownPanel.UnInitialize();
            }
            else
            {
                var levelBattle = Level.current as Level_Battle;
                countDownPanel.enableUpdate = levelBattle?.IsPlayerAllDead() ?? false;
            }
            //复活成功处理
            if (isSuccess && !modulePVE.isTeamMode)
            {
                //复活次数+1
                modulePVE.currentReviveTimes++;
                m_pvePlayerRevivePanel.SetPanelVisible(false);
                m_hero1.Revive();
                modulePVEEvent.pauseEvent = false;
            }
            break;

        case Module_PVE.EventMonsterTip:
            EnumMonsterTipArrow tip = (EnumMonsterTipArrow)e.param1;
            if (m_leftMonTip != null)
            {
                m_leftMonTip.SetMonsterTipVisible(tip);
            }
            if (m_rightMonTip != null)
            {
                m_rightMonTip.SetMonsterTipVisible(tip);
            }
            break;

        case Module_PVE.EventTransportSceneToUI:
            bool begin = (bool)e.param1;
            if (begin)
            {
                if (m_pvePlayerRevivePanel.enable)
                {
                    m_pvePlayerRevivePanel?.SetPanelVisible(false);
                }
                if (m_labyrinthTipPanel.enable)
                {
                    m_labyrinthTipPanel?.SetPanelVisible(false);
                }
            }
            else if (!begin && m_player)
            {
                if (m_player.health == 0)
                {
                    var levelBattle = Level.current as Level_Battle;
                    if (!modulePVE.isTeamMode)
                    {
                        m_pvePlayerRevivePanel?.OpenRevivePanel();
                    }
                    else if (levelBattle != null)
                    {
                        if (levelBattle.IsPlayerAllDead())
                        {
                            m_pvePlayerRevivePanel?.OpenRevivePanel();
                            countDownPanel.Initialize(PveCombat_CountDown.Mode.ReviveCountDown);
                        }

                        if (levelBattle.IsState(BattleStates.Watch))
                        {
                            levelBattle.QuitState(BattleStates.Watch);
                            levelBattle.EnterState(BattleStates.Watch);
                        }
                    }
                }
                else if (m_player.health > 0)
                {
                    ApplyAutoBattle();
                }
            }
            break;

        case Module_PVE.EventTriggerTransportTip:
            int dir = (int)e.param1;
            if (dir != m_lastTransportDir)
            {
                m_lastTransportDir = dir;
                m_transportTip.SetActive(dir != 0);
                m_leftTransortTip.SetActive((dir & (int)EnumMonsterTipArrow.MonserLeft) > 0);
                m_rightTransportTip.SetActive((dir & (int)EnumMonsterTipArrow.MonsterRight) > 0);
            }
            break;

        case Module_PVE.EventBossCameraAnimWhiteFadeIn: OnBossCameraAnimWhiteFadeIn(); break;

        case Module_PVE.EventDisplayBossReward: OnShowBossReward((PItem2[])e.param1); break;
        }
    }
Ejemplo n.º 12
0
    void _ME(ModuleEvent <Module_Team> e)
    {
        if (!modulePVE.isTeamMode)
        {
            return;
        }

        switch (e.moduleEvent)
        {
        case Module_Team.EventStart:
        {
            // Loading complete, start logic update!
            foreach (var member in m_teamMembers)
            {
                member.enableUpdate = true;
                if (member.pet)
                {
                    member.pet.enableUpdate = true;
                }
            }
            EnterState(BattleStates.Prepare);

            //active pve process
            OnPVELoadingWindowClose();
            break;
        }

        case Module_Team.EventEnd:
            if (modulePVE.lastSendState == PVEOverState.GameOver || modulePVE.lastSendState == PVEOverState.Success)
            {
                m_isEnding = true;
                if (!IsState(BattleStates.SlowMotion) && !loading)      // Wait slowmotion state or loading end
                {
                    EnterState(modulePVE.isSendWin ? BattleStates.Winning : BattleStates.Losing);
                }
            }
            break;

        case Module_Team.EventQuit:
            OnMemberQuit(e.param1 as PTeamMemberInfo, (EnumTeamQuitState)e.param2);
            break;
        }

        if (session.connected && e.moduleEvent == Module_Team.EventRoomLostConnection && !m_isEnding && !m_isPVEFinish && !moduleTeam.useGameSession) // Do not handle disconnect event if use gamesession
        {
            foreach (var item in m_unitSceneEvents)
            {
                if (item.hasDestoryed)
                {
                    continue;
                }

                if (m_currentUnitSceneEvent == null)
                {
                    m_currentUnitSceneEvent = item;
                }
                //必须要把场景打开,否则会导致objectmanager里面部分资源不会被释放,导致内存泄漏
                item.SetSceneActive(true);
            }
            SetLevelBehaviourCanDestory();
            Game.GoHome();
        }
    }
Ejemplo n.º 13
0
        private void SaveRdlcInEventList(RdlcReportModel tbReport, long reportId, long tbReportId, string code)
        {
            //表格解析地址
            var analysis = _analysisRepository.FirstOrDefault(p => p.Url == "Report/RdlcReport");

            #region 内置事件保存
            //内置事件列表
            var inEvList = _inEventRepository.GetAllList(p => p.ReportType == (short)ReportEnum.ReportType.Rdlc).ToList();
            var inEvIds  = inEvList.Select(p => p.Id);

            string inlambda = "p=>p.Code==\"" + code + "\" && p.EventFrom==\"内置\" && p.SourceTable==\"EM_INEVENT\" &&p.AnalysisId==" + analysis.Id;
            Expression <Func <ModuleEvent, bool> > exp1 = StringToLambda.LambdaParser.Parse <Func <ModuleEvent, bool> >(inlambda);
            var mdInEvList = _moduleManager.GetModuleEventList(exp1);
            if (mdInEvList != null && mdInEvList.Count > 0)
            {
                //删除不在内置事件列表中的模版事件
                var delInEvList = mdInEvList.Where(p => !inEvIds.Contains(p.SourceTableId)).ToList();
                if (delInEvList != null && delInEvList.Count > 0)
                {
                    foreach (var inEv in delInEvList)
                    {
                        if (analysis != null)
                        {
                            //删除事件解析表事件及赋权信息
                            _moduleManager.DeleteEvent(analysis.Id, code, inEv.SourceTableId);
                        }
                    }
                }
                //查找没有添加的内置事件List
                var insertInEvList = inEvList.Where(p => !mdInEvList.Select(k => k.SourceTableId).Contains(p.Id));
                if (insertInEvList != null && insertInEvList.Count() > 0)
                {
                    //循环添加内置事件
                    foreach (var inev in insertInEvList)
                    {
                        ModuleEvent mdEv = new ModuleEvent
                        {
                            AnalysisId    = analysis.Id,
                            Code          = code,
                            EventName     = inev.DisplayName + "(rdlc)",
                            EventFrom     = "内置",
                            SourceTable   = "EM_INEVENT",
                            SourceTableId = inev.Id,
                        };
                        _moduleManager.SaveEvent(mdEv);
                    }
                }
            }
            else//未找到时,添加内置事件
            {
                if (inEvList != null && inEvList.Count > 0)
                {
                    foreach (var inEv in inEvList)
                    {
                        //保存事件至EM_MODULE_EVENT
                        ModuleEvent mdEv = new ModuleEvent
                        {
                            AnalysisId    = analysis.Id,
                            Code          = code,
                            EventName     = inEv.DisplayName + "(rdlc)",
                            EventFrom     = "内置",
                            SourceTable   = "EM_INEVENT",
                            SourceTableId = inEv.Id
                        };
                        _moduleManager.SaveEvent(mdEv);
                    }
                }
            }
            #endregion
        }
Ejemplo n.º 14
0
 protected virtual void OnModuleEvent(object arg1, ModuleEvent arg2)
 {
     IsEnabled = arg2 == Modules.ModuleEvent.Enabled;
     OnLogEvent(this, new LogModel(LoggerTypes.Info, $"{ModuleName} : {arg2}"));
     ModuleEvent?.Invoke(arg1, arg2);
 }
Ejemplo n.º 15
0
        /// <summary>
        /// 保存事件信息(外置),同时向模版事件表中添加内置事件信息
        /// </summary>
        /// <param name="tbReport"></param>
        /// <param name="reportId"></param>
        /// <param name="tbReportId"></param>
        /// <param name="code"></param>
        private void SaveRpEventList(TbReportModel tbReport, long reportId, long tbReportId, string code)
        {
            //表格解析地址
            var analysis = _analysisRepository.FirstOrDefault(p => p.Url == "Report/TbReport");

            #region 外置事件保存
            if (tbReport.OutEventListJson != null && tbReport.OutEventListJson.Length > 0)
            {
                //当前事件列表
                var eventList = JSON.EncodeToEntity <List <TbReportOutEventModel> >(tbReport.OutEventListJson);
                //var nullEventL = eventList.Where(p => string.IsNullOrEmpty(p.DisplayName) || string.IsNullOrEmpty(p.Url));
                eventList.RemoveAll(p => string.IsNullOrEmpty(p.DisplayName) || string.IsNullOrEmpty(p.Url));//移除空事件
                //原事件列表
                var oldEventList = _tbReportOutEventRepository.GetAllList(p => p.TbReportId == tbReportId);

                //循环从表中删除未在新事件列表中的事件及事件参数
                //同时,删除在解析表中的模块事件和事件赋权信息
                foreach (var ev in oldEventList)
                {
                    if (!eventList.Select(p => p.Id).Contains(ev.Id))
                    {
                        _tbReportOutEventRepository.Delete(ev);//删除事件
                        //循环删除事件的参数列表
                        var parList = _paramRepository.GetAllList(p => p.TbReportOutEventId == ev.Id);
                        if (parList.Any())
                        {
                            foreach (var par in parList)
                            {
                                _paramRepository.Delete(par);//删除一个事件参数
                            }
                        }

                        if (analysis != null)
                        {
                            //删除事件解析表事件及赋权信息
                            _moduleManager.DeleteEvent(analysis.Id, code, ev.Id);
                        }
                    }
                }

                //循环修改或新增事件
                if (eventList.Any())
                {
                    foreach (var ev in eventList)
                    {
                        TbReportOutEvent even = new TbReportOutEvent();
                        var oldEv             = oldEventList.FirstOrDefault(p => p.Id == ev.Id);
                        if (oldEv != null)
                        {
                            even = oldEv;
                        }

                        even            = AutoMapper.Mapper.Map(ev, even);
                        even.TbReportId = tbReportId;
                        //新增或修改事件信息
                        var eventId = _tbReportOutEventRepository.InsertOrUpdateAndGetId(even);

                        //修改已在解析事件表中的事件信息(url)
                        //更新EM_MODULE_EVENT(url)
                        if (oldEv != null)
                        {
                            string lambda = "p=>p.SourceTableId==" + oldEv.Id + " && p.SourceTable==\"EM_TB_REPORT_OUTEVENT\" && p.Code==\"" + code + "\"";
                            Expression <Func <ModuleEvent, bool> > exp = StringToLambda.LambdaParser.Parse <Func <ModuleEvent, bool> >(lambda);
                            var mdEvList = _moduleManager.GetModuleEventList(exp);
                            if (mdEvList != null && mdEvList.Count > 0)
                            {
                                var mdev = mdEvList[0];
                                mdev.Url       = ev.Url;
                                mdev.EventFrom = "外置";
                                mdev.EventName = ev.DisplayName;
                                mdev.EventType = ev.EventType;
                                _moduleManager.SaveModuleEvent(mdev);
                            }
                            else
                            {
                                //保存事件至EM_MODULE_EVENT
                                ModuleEvent mdEv = new ModuleEvent
                                {
                                    AnalysisId    = analysis.Id,
                                    Code          = code,
                                    EventName     = ev.DisplayName,
                                    EventType     = ev.EventType,
                                    SourceTable   = "EM_TB_REPORT_OUTEVENT",
                                    SourceTableId = eventId,
                                    EventFrom     = "外置",
                                    Url           = ev.Url//链接
                                };
                                _moduleManager.SaveEvent(mdEv);
                            }
                        }
                        if (ev.Id == 0)//新增事件到解析事件表
                        {
                            //保存事件至EM_MODULE_EVENT
                            ModuleEvent mdEv = new ModuleEvent
                            {
                                AnalysisId    = analysis.Id,
                                Code          = code,
                                EventName     = ev.DisplayName,
                                EventType     = ev.EventType,
                                SourceTable   = "EM_TB_REPORT_OUTEVENT",
                                SourceTableId = eventId,
                                EventFrom     = "外置",
                                Url           = ev.Url//链接
                            };
                            _moduleManager.SaveEvent(mdEv);
                        }

                        #region 覆盖式更新事件参数列表(先删除再添加)
                        //删除参数列表
                        var parList = _paramRepository.GetAllList(p => p.TbReportOutEventId == eventId);
                        if (parList.Any())
                        {
                            foreach (var par in parList)
                            {
                                _paramRepository.Delete(par);
                            }
                        }
                        //保存事件的参数列表
                        if (ev.ParamListJson != null && ev.ParamListJson.Length > 0)
                        {
                            var paramList = JSON.EncodeToEntity <List <ParamModel> >(ev.ParamListJson);
                            foreach (var param in paramList)
                            {
                                var pm = AutoMapper.Mapper.Map <Param>(param);
                                pm.Id = 0;                           //新增方式插入
                                pm.TbReportOutEventId = eventId;     //事件ID
                                _paramRepository.InsertOrUpdate(pm); //保存参数
                            }
                        }
                        #endregion
                    }
                }
            }
            #endregion

            #region 内置事件保存
            //内置事件列表
            var inEvList = _inEventRepository.GetAllList(p => p.ReportType == tbReport.ReportType).ToList();
            var inEvIds  = inEvList.Select(p => p.Id);

            string inlambda = "p=>p.Code==\"" + code + "\" && p.EventFrom==\"内置\" && p.SourceTable==\"EM_INEVENT\" &&p.AnalysisId==" + analysis.Id;
            Expression <Func <ModuleEvent, bool> > exp1 = StringToLambda.LambdaParser.Parse <Func <ModuleEvent, bool> >(inlambda);
            var mdInEvList = _moduleManager.GetModuleEventList(exp1);
            if (mdInEvList != null && mdInEvList.Count > 0)
            {
                //删除不在内置事件列表中的模版事件
                var delInEvList = mdInEvList.Where(p => !inEvIds.Contains(p.SourceTableId)).ToList();
                if (delInEvList != null && delInEvList.Count > 0)
                {
                    foreach (var inEv in delInEvList)
                    {
                        if (analysis != null)
                        {
                            //删除事件解析表事件及赋权信息
                            _moduleManager.DeleteEvent(analysis.Id, code, inEv.SourceTableId);
                        }
                    }
                }
                //查找没有添加的内置事件List
                var insertInEvList = inEvList.Where(p => !mdInEvList.Select(k => k.SourceTableId).Contains(p.Id));
                if (insertInEvList != null && insertInEvList.Count() > 0)
                {
                    //循环添加内置事件
                    foreach (var inev in insertInEvList)
                    {
                        ModuleEvent mdEv = new ModuleEvent
                        {
                            AnalysisId    = analysis.Id,
                            Code          = code,
                            EventName     = inev.DisplayName,
                            EventFrom     = "内置",
                            SourceTable   = "EM_INEVENT",
                            SourceTableId = inev.Id,
                        };
                        _moduleManager.SaveEvent(mdEv);
                    }
                }
            }
            else//未找到时,添加内置事件
            {
                if (inEvList != null && inEvList.Count > 0)
                {
                    foreach (var inEv in inEvList)
                    {
                        //保存事件至EM_MODULE_EVENT
                        ModuleEvent mdEv = new ModuleEvent
                        {
                            AnalysisId    = analysis.Id,
                            Code          = code,
                            EventName     = inEv.DisplayName,
                            EventFrom     = "内置",
                            SourceTable   = "EM_INEVENT",
                            SourceTableId = inEv.Id
                        };
                        _moduleManager.SaveEvent(mdEv);
                    }
                }
            }
            #endregion
        }
Ejemplo n.º 16
0
 /// <summary>
 /// Dispatch a module event for UI system, use ModuleEvent
 /// </summary>
 /// <param name="e">The module event name</param>
 /// <param name="msg">The PacketObject from server or local</param>
 public virtual void DispatchModuleEvent(string e, PacketObject msg)
 {
     DispatchEvent(ModuleEvent.GLOBAL, ModuleEvent.Pop(this, e, msg));
 }
Ejemplo n.º 17
0
    void _ME(ModuleEvent <Module_Shop> e)
    {
        if (!actived || moduleShop.curShopPos != ShopPos.Npc)
        {
            return;
        }
        switch (e.moduleEvent)
        {
        case Module_Shop.EventShopData:
            var list = e.param1 as List <ShopMessage>;
            if (list == null || list.Count < 1)
            {
                break;
            }
            moduleShop.SetCurrentShop(list[0]);
            break;

        case Module_Shop.EventTargetShopData:
            RefreshNpcShop();
            break;

        case Module_Shop.EventPaySuccess:
            unlockTip.SafeSetActive(false);
            Window_ItemTip.Show(ConfigText.GetDefalutString(TextForMatType.TravalShopUIText, 13), moduleShop.curClickItem);
            suiteData.UpdateItems();
            unlockBtn.interactable = true;
            unlockBtn.SafeSetActive(false);
            equipBtn.SafeSetActive(true);
            break;

        case Module_Shop.EventPromoChanged:
            var msg = e.param1 as ShopMessage;
            if (msg != null && msg.pos == ShopPos.Maze)
            {
                DefaultState();
                int page = suiteView.currentPage;
                suiteData.UpdateItems();
                suiteView.ScrollToPage(page);
            }
            break;

        case Module_Shop.EventNpcChangeEquip:
            var result = (sbyte)e.param1;
            if (result != 0)
            {
                equipBtn.interactable = true;
            }
            else
            {
                if (moduleNpc.curNpc != null)
                {
                    ChangeNpcMode(moduleNpc.curNpc.mode);
                }
                suiteData.UpdateItems();
                equipBtn.SafeSetActive(false);
            }
            break;

        default:
            break;
        }
    }
Ejemplo n.º 18
0
    private void _ME(ModuleEvent <Module_Pet> e)
    {
        if (!Root.activeInHierarchy)
        {
            return;
        }
        switch (e.moduleEvent)
        {
        case Module_Pet.PetStatusChange:
            RefreshButtonState();
            RefreshAttribute();
            RefreshDescColor();
            PlayPetFightAction();
            break;

        case Module_Pet.PetGradeChange:
            var p = e.param1 as PetInfo;
            if ((p?.ID ?? -1) == SelectPet?.ID)
            {
                RefreshStar();
                RefreshModule();
                RefreshAttribute();
                RefreshSkill();
            }
            break;

        case Module_Pet.ResponseStatus:
            ResponseChageStatus(e.msg as ScPetStatus);
            break;

        case Module_Pet.ResponseTease:
            ResponseTease(e.msg as ScPetTease);
            break;

        case Module_Pet.MoodChange:
            RefreshMood();
            break;

        case Module_Pet.PetListChange:
            petSelectModule.ResetDataSource(Module_Pet.GetAllPet());
            RefreshButtonState();
            break;

        case Module_Pet.EventGetNewPet:
            var pet = e.param1 as PetInfo;
            if (null == pet)
            {
                break;
            }
            petSelectModule.SetItem(pet);
            if (null != SelectPet && SelectPet.ID == pet.ID)
            {
                SelectPet = pet;
            }
            Refresh();
            RefreshHintCompose(SelectPet);
            PlayUnlockEffect();
            break;

        default:
            Refresh();
            break;
        }
        petSelectModule?._ME(e);
    }
Ejemplo n.º 19
0
 public ModuleEvent SaveModuleEvent(ModuleEvent mdEv)
 {
     return(_moduleeventRepository.InsertOrUpdate(mdEv));
 }
Ejemplo n.º 20
0
 public override void Create(object args)
 {
     base.Create(args);
     onStartServer = Event("onStartServer");
     onCloseServer = Event("onCloseServer");
 }
Ejemplo n.º 21
0
    void _ME(ModuleEvent <Module_NPCDating> e)
    {
        if (!actived)
        {
            return;
        }
        switch (e.moduleEvent)
        {
        case Module_NPCDating.EventEnterDatingPanel:
            if (moduleNPCDating.forceSettlement)
            {
                moduleNPCDating.forceSettlement = false;
                Window_Alert.ShowAlert(ConfigText.GetDefalutString(TextForMatType.NpcDating, 24), true, false, false, () => { Window.ShowAsync <Window_Home>(); });
                RefreshPanel();
                moduleNPCDating.ClearDatingData();
            }
            else if (moduleNPCDating.isNpcBattelSettlement)
            {
                moduleNPCDating.isNpcBattelSettlement = false;
                //助战导致约会结算,开始一个特殊的结算事件流程,特殊id需要配表
                moduleNPCDating.DoDatingEvent(GeneralConfigInfo.defaultConfig.datingEndEventId);
            }
            else
            {
                bool needReconnect = moduleNPCDating.CheckDatingReconnect(EnumNPCDatingSceneType.DatingHall);
                if (!needReconnect)
                {
                    moduleNPCDating.ContinueBehaviourCallBack(RefreshPanel);
                }
            }
            break;

        case Module_NPCDating.EventRealEnterDatingScene:
            //点击娱乐街场景按钮
            switch ((sbyte)e.param1)
            {
            case 0:
                //成功
                int sceneId = moduleNPCDating.enterSceneData.sceneId;
                Game.LoadLevel(sceneId);
                moduleNPCDating.isEnterSceneMark = true;
                break;

            case 1:
                //当前没有约会Npc,请选择Npc
                moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.NpcDating, 4));
                break;

            case 2:
                //已经进入过该场景
                moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.NpcDating, 5));
                break;

            case 3:
                //约会已经结束
                moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.NpcDating, 6));
                break;

            case 4:
                //图书馆答错,未去其他场景再进图书馆提示
                moduleGlobal.ShowMessage(ConfigText.GetDefalutString(TextForMatType.NpcDating, 20));
                break;

            case 5:
                //Npc体力不足,无法进行约会
                string str = ConfigText.GetDefalutString(TextForMatType.NpcDating, 23);
                moduleGlobal.ShowMessage(Util.Format(str, moduleNPCDating.curDatingNpcMsg == null ? "": moduleNPCDating.curDatingNpcMsg.name));
                break;

            default:
                break;
            }
            break;

        case Module_NPCDating.EventClickDatingBuild: OpenSecondScenePanel((EnumNPCDatingSceneType)e.param1); break;
        }
    }