コード例 #1
0
 private void OnDisable()
 {
     try
     {
         U.Events.OnPlayerConnected -= addPlayerComponents;
         unturnedPlayerComponents    = unturnedPlayerComponents.Where(p => p.Assembly != assembly).ToList();
         List <Type> playerComponents = RocketHelper.GetTypesFromParentClass(assembly, typeof(UnturnedPlayerComponent));
         foreach (Type playerComponent in playerComponents)
         {
             //Provider.Players.ForEach(p => p.Player.gameObject.TryRemoveComponent(playerComponent.GetType()));
         }
     }
     catch (Exception ex)
     {
         Core.Logging.Logger.LogException(ex);
     }
 }
コード例 #2
0
        private void OnDisable()
        {
            try
            {
                U.Events.OnPlayerConnected -= addPlayerComponents;
                unturnedPlayerComponents    = unturnedPlayerComponents.Where(p => p.Assembly != assembly).ToList();
                List <Type> playerComponents = RocketHelper.GetTypesFromParentClass(assembly, typeof(UnturnedPlayerComponent));

                /*for(int i = 0; i < playerComponents.Count; i++)
                 * {
                 *  Type playerComponent = playerComponents[i];
                 *  Provider.clients.ForEach(p => p.player.gameObject.TryRemoveComponent(playerComponent.GetType()));
                 * }*/
            }
            catch (Exception ex)
            {
                Core.Logging.Logger.LogException(ex);
            }
        }
コード例 #3
0
        private void OnEnable()
        {
            try
            {
                IRocketPlugin plugin = GetComponent <IRocketPlugin>();
                assembly = plugin.GetType().Assembly;

                U.Events.OnBeforePlayerConnected += addPlayerComponents;
                unturnedPlayerComponents.AddRange(RocketHelper.GetTypesFromParentClass(assembly, typeof(UnturnedPlayerComponent)));

                foreach (Type playerComponent in unturnedPlayerComponents)
                {
                    Core.Logging.Logger.Log("Adding UnturnedPlayerComponent: " + playerComponent.Name);
                    //Provider.Players.ForEach(p => p.Player.gameObject.TryAddComponent(playerComponent.GetType()));
                }
            }
            catch (Exception ex)
            {
                Core.Logging.Logger.LogException(ex);
            }
        }