Пример #1
0
 public void OnModelChange(Player player, PlayerModelController controller)
 {
     if (!NetworkUtils.IsServer())
     {
         return;
     }
     Channel.Send(nameof(Network_ChangeModel), ECall.Others, player.User.Identity, controller.Name);
 }
Пример #2
0
 public void SendUpdate(Identity target, Player toUpdate, PlayerModelController updateModel)
 {
     if (!NetworkUtils.IsServer())
     {
         return;
     }
     Channel.Send(nameof(Network_ChangeModel), target, toUpdate.User.Identity, updateModel.Name);
 }
Пример #3
0
 public static void RegisterPlayerModel(Plugin plugin, PlayerModelController modelController)
 {
     if (plugin == null)
     {
         throw new ArgumentNullException(nameof(plugin));
     }
     RegisterPlayerModelInternal(plugin, modelController);
 }
Пример #4
0
        private void Network_ChangeModel(Identity sender, Identity target, string modelController)
        {
            var clients    = Connection.Clients.ToList();
            var owner      = target.Owner;
            var player     = owner.Player;
            var controller = PlayerModelController.GetPlayerModelController(modelController);

            controller.ApplyLocal(player);
        }
Пример #5
0
        internal static void RegisterPlayerModelInternal(Plugin plugin, PlayerModelController modelController)
        {
            if (GetPlayerModelController(modelController.GetType()) != null)
            {
                LogUtils.LogError($"RegisterPlayerModel: The class \"{modelController.GetType().FullName}\" is already a registered controller!");
            }
            if (GetPlayerModelController(modelController.Name) != null)
            {
                LogUtils.LogError($"RegisterPlayerModel: A model with the name \"{modelController.Name}\" already exists!");
                modelController.Name = modelController.Name + "_";
                RegisterPlayerModelInternal(plugin, modelController);
                return;
            }

            modelController._plugin = plugin;
            RegisteredModels.Add(modelController);
        }