示例#1
0
        public static void Reset()
        {
            foreach (var coroutine in coroutines)
            {
                Timing.KillCoroutines(coroutine);
            }

            CustomRoles.roles = new Dictionary <string, CustomRole>();
            CustomRoles.users = new Dictionary <string, string>();

            CustomRoles.roles.Add("all", new CustomRole("all", 2));

            scriptData = new ScriptActionsStore();
            delays     = new Dictionary <int, ScriptActionsStore>();

            Timing.CallDelayed(10f, () =>
            {
                try
                {
                    AdvancedSubclassing.PopulateCustomRoles();

                    if (EasyEvents.Singleton.Config.Events.Count > 0)
                    {
                        var selected = EasyEvents.Singleton.Config.Events.PickRandom().Trim().ToLower().Replace(" ", "");

                        if (selected == "none")
                        {
                            return;
                        }
                        if (!ScriptStore.Scripts.ContainsKey(selected))
                        {
                            throw new EventNotFoundException("The event \"" + selected + "\" was not found while attempting to automatically run an event.");
                        }
                        ScriptHandler.RunScript(ScriptStore.Scripts[selected]);
                    }
                }
                catch (Exception e)
                {
                    Log.Error(e);
                }
            });
        }