internal void Push(DefaultHandle item) { Thread currentThread = Thread.CurrentThread; if (_threadRef.TryGetTarget(out Thread thread) && thread == currentThread) { // The current Thread is the thread that belongs to the Stack, we can try to push the object now. PushNow(item); }
public static GameObject GetPrefab(DefaultHandle handle) { switch (handle) { case DefaultHandle.PositionHandle: if (s_PositionPrefab == null) { s_PositionPrefab = Resources.Load <GameObject>("Handles/position-handle"); } return(s_PositionPrefab); } return(null); }
/// <summary> /// 收到群消息 /// </summary> /// <param name="sender">事件来源</param> /// <param name="e">事件参数</param> public void GroupMessage(object sender, CQGroupMessageEventArgs e) { if (sender == null || e == null) { return; } this.eventArgs = e; ConsoleLog.Info($"收到信息[群:{eventArgs.FromGroup.Id}]", $"{(eventArgs.Message.Text).Replace("\r\n", "\\r\\n")}"); //读取配置文件 ConfigIO config = new ConfigIO(eventArgs.CQApi.GetLoginQQ().Id, false); //Module moduleEnable = config.LoadedConfig.ModuleSwitch; //以#开头的消息全部交给PCR处理 if (eventArgs.Message.Text.Trim().StartsWith("#") && //检查指令开头 config.LoadConfig() //加载配置文件 ) { //检查模块使能 if (!config.LoadedConfig.ModuleSwitch.PCR_GuildManager) { SendDisableMessage(); return; } PCRGuildHandle pcrGuild = new PCRGuildHandle(sender, eventArgs); pcrGuild.GetChat(); return; } //全字指令匹配 WholeMatchCmd.KeyWords.TryGetValue(eventArgs.Message, out WholeMatchCmdType cmdType); //查找关键字 if (cmdType != 0) { ConsoleLog.Info("触发关键词", $"消息类型={cmdType}"); //加载配置文件 if (!config.LoadConfig()) { return; } } switch (cmdType) { //输入debug case WholeMatchCmdType.Debug: if (!config.LoadedConfig.ModuleSwitch.Debug) { SendDisableMessage(); return; } DefaultHandle dh = new DefaultHandle(sender, eventArgs); dh.GetChat(cmdType); return; //娱乐功能 case WholeMatchCmdType.SurpriseMFK_Random: case WholeMatchCmdType.SurpriseMFK_Ban: case WholeMatchCmdType.SurpriseMFK_RedTea: case WholeMatchCmdType.SurpriseMFK_24YearsOld: if (!config.LoadedConfig.ModuleSwitch.HaveFun) { SendDisableMessage(); return; } SurpriseMFKHandle smfh = new SurpriseMFKHandle(sender, eventArgs); smfh.GetChat(cmdType); return; //慧酱签到啦 case WholeMatchCmdType.Suisei_SignIn: if (!config.LoadedConfig.ModuleSwitch.Suisei) { SendDisableMessage(); return; } SuiseiHanlde suisei = new SuiseiHanlde(sender, eventArgs); suisei.GetChat(cmdType); return; //来点色图! case WholeMatchCmdType.Setu: if (!config.LoadedConfig.ModuleSwitch.Setu) { SendDisableMessage(); return; } return; default: break; } //参数指令匹配 KeywordCmdType keywordType = KeywordCmd.TryGetKeywordType(eventArgs.Message.Text); if (keywordType != 0) { ConsoleLog.Info("触发关键词", $"消息类型={cmdType}"); //加载配置文件 if (!config.LoadConfig()) { return; } } switch (keywordType) { case KeywordCmdType.PCRTools_GetGuildRank: if (!config.LoadedConfig.ModuleSwitch.PCR_GuildRank) { SendDisableMessage(); return; } PCRToolsHandle pcrTools = new PCRToolsHandle(sender, eventArgs); pcrTools.GetChat(keywordType); return; case KeywordCmdType.At_Bot: ConsoleLog.Info("机器人事件", "机器人被AT"); break; default: break; } eventArgs.Handler = true; }
public GameObject CreateHandle(DefaultHandle handle) { return(CreateHandle(DefaultHandles.GetPrefab(handle))); }