Esempio n. 1
0
        public static async Task ExecuteCommandAsync(IServiceProvider serviceProvider, SocketSlashCommand command)
        {
            var scopeFactory = serviceProvider.GetService<IServiceScopeFactory>();
            using var scope = scopeFactory.CreateScope();
            var services = scope.ServiceProvider;
            var client = services.GetService<DiscordSocketClient>();
            var commandService = services.GetService<CommandService>();
            var dbContext = scope.ServiceProvider.GetService<DatabaseContext>();
            var configuration = scope.ServiceProvider.GetService<IConfigurationRoot>();

            switch (command.Data.Name)
            {
                case "stats":
                    await UserLogic.StatsSlashAsync(command, client, dbContext, configuration);
                    break;
                case "leaderboard":
                    await LeaderboardLogic.LeaderboardSlashAsync(command, dbContext, configuration);
                    break;
                case "about":
                    await UtilLogic.AboutSlashAsync(command);
                    break;
                case "help":
                    await UtilLogic.HelpSlashAsync(command, commandService);
                    break;
            }
        }
Esempio n. 2
0
        // 验证字符串
        protected bool validStr(string name, string passwd)
        {
            if (name.Length == 0)
            {
                InfoBoxParam param = Ctx.m_instance.m_poolSys.newObject <InfoBoxParam>();
                param.m_midDesc = Ctx.m_instance.m_langMgr.getText(LangTypeId.eLogin3, LangItemID.eItem2);;
                Ctx.m_instance.m_langMgr.getText(LangTypeId.eLTLog0, LangItemID.eItem22);
                UIInfo.showMsg(param);
                return(false);
            }
            else if (UtilLogic.IsIncludeChinese(name))
            {
                InfoBoxParam param = Ctx.m_instance.m_poolSys.newObject <InfoBoxParam>();
                param.m_midDesc = Ctx.m_instance.m_langMgr.getText(LangTypeId.eLogin3, LangItemID.eItem0);
                UIInfo.showMsg(param);
                return(false);
            }

            if (name.Length == 0)
            {
                InfoBoxParam param = Ctx.m_instance.m_poolSys.newObject <InfoBoxParam>();
                param.m_midDesc = Ctx.m_instance.m_langMgr.getText(LangTypeId.eLogin3, LangItemID.eItem3);
                UIInfo.showMsg(param);
                return(false);
            }
            else if (UtilLogic.IsIncludeChinese(passwd))
            {
                InfoBoxParam param = Ctx.m_instance.m_poolSys.newObject <InfoBoxParam>();
                param.m_midDesc = Ctx.m_instance.m_langMgr.getText(LangTypeId.eLogin3, LangItemID.eItem1);
                UIInfo.showMsg(param);
                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        protected void onFilterTypeBtnClk()
        {
            int       idx      = UtilLogic.findIdxByUnderline(EventSystem.current.currentSelectedGameObject.name);
            IUITuJian uiTuJian = Ctx.m_instance.m_uiMgr.getForm(UIFormID.eUITuJian) as IUITuJian;

            if (uiTuJian != null)
            {
                uiTuJian.updateFilter(idx);
            }

            m_tuJianTopData.m_form.exit();
        }
Esempio n. 4
0
        // 这个主要是更新卡牌不经常改变的属性
        public override void updateCardDataNoChangeByTable()
        {
            base.updateCardDataNoChangeByTable();

            if (m_sceneCardItem != null)
            {
                if (m_sceneCardItem.cardArea == CardArea.CARDCELLTYPE_HAND)
                {
                    UtilLogic.updateCardDataNoChangeByTable(m_sceneCardItem.m_cardTableItem, m_render.gameObject());
                }
                if (m_sceneCardItem.cardArea == CardArea.CARDCELLTYPE_COMMON)   // 场牌区没有不变属性显示
                {
                }
            }
        }
Esempio n. 5
0
        // 根据表更新卡牌数据,这个主要是用于初始卡牌更新,只用于随从牌、法术牌,并且 Render 数据是手牌的数据
        public override void updateCardDataByTable()
        {
            base.updateCardDataByTable();

            TableItemBase tableBase = Ctx.m_instance.m_tableSys.getItem(TableID.TABLE_CARD, m_sceneCardBaseData.m_startCardID);

            if (tableBase != null)
            {
                TableCardItemBody cardTableData = tableBase.m_itemBody as TableCardItemBody;
                UtilLogic.updateCardDataNoChangeByTable(cardTableData, m_render.gameObject());
            }
            else
            {
                Ctx.m_instance.m_logSys.log(string.Format("卡表查找失败, ID = {0}", m_sceneCardBaseData.m_startCardID));
            }
        }
Esempio n. 6
0
        // 点击登陆处理
        protected void onBtnClkLogin()
        {
            string textStr = "";

            if (Ctx.m_instance.m_loginSys.get_LoginState() == LoginState.eLoginSuccessGateServer || Ctx.m_instance.m_loginSys.get_LoginState() == LoginState.eLoginNewCharError)    // 网关登陆成功或者建立角色错误
            {
                AuxInputField lblName = new AuxInputField(m_GUIWin.m_uiRoot, LoginComPath.PathLblName);

                if (lblName.text.Length == 0)       // 如果没有输入名字
                {
                    // 给出一个提示
                    textStr = Ctx.m_instance.m_langMgr.getText(LangTypeId.eSelectHero2, LangItemID.eItem1);
                    InfoBoxParam param = Ctx.m_instance.m_poolSys.newObject <InfoBoxParam>();
                    param.m_midDesc = textStr;
                    UIInfo.showMsg(param);
                }
                else if (Ctx.m_instance.m_wordFilterManager.IsMatch(lblName.text))       // 如果包含非法字符
                {
                    // 给出一个提示
                    textStr = Ctx.m_instance.m_langMgr.getText(LangTypeId.eSelectHero2, LangItemID.eItem2);
                    InfoBoxParam param = Ctx.m_instance.m_poolSys.newObject <InfoBoxParam>();
                    param.m_midDesc = textStr;
                    UIInfo.showMsg(param);
                }
                else
                {
                    // 判断名字长度
                    if (UtilLogic.CalcCharCount(lblName.text) <= ProtoCV.MAX_NAMESIZE)
                    {
                        stCreateSelectUserCmd cmd = new stCreateSelectUserCmd();
                        cmd.strUserName = lblName.text;
                        cmd.country     = 1;
                        UtilMsg.sendMsg(cmd);
                    }
                    else
                    {
                        // 给出一个提示
                        textStr = Ctx.m_instance.m_langMgr.getText(LangTypeId.eSelectHero2, LangItemID.eItem0);
                        InfoBoxParam param = Ctx.m_instance.m_poolSys.newObject <InfoBoxParam>();
                        param.m_midDesc = textStr;
                        UIInfo.showMsg(param);
                    }
                }
            }
        }
Esempio n. 7
0
 public async Task HelpCategory([Name("category")] string category)
 {
     await UtilLogic.HelpCommandAsync(Context, _commands, category);
 }
Esempio n. 8
0
 public async Task Help()
 {
     await UtilLogic.HelpCommandAsync(Context, _commands);
 }
Esempio n. 9
0
 public async Task About()
 {
     await UtilLogic.AboutCommandAsync(Context);
 }