Beispiel #1
0
        public void UserInitialize(CoreList AddonInjections)
        {
            this.ServerQueryConnection = AddonInjections[typeof(ServerQueryConnection.ServerQueryConnection).Name] as ServerQueryConnection.ServerQueryConnection;
            this.UserManager           = AddonInjections[typeof(UserManager.UserManager).Name] as UserManager.UserManager;

            this.ServerQueryConnection.BotCommandAttempt += onBotCommand;

            ModelCustomizer.AddModelCustomization(Hooks.ModelCustomizer.OnModelCreating);
        }
Beispiel #2
0
        public void UserInitialize(CoreList AddonInjections)
        {
            this.ServerQueryConnection = AddonInjections[typeof(ServerQueryConnection.ServerQueryConnection).Name] as ServerQueryConnection.ServerQueryConnection;
            this.UserManager           = AddonInjections[typeof(UserManager.UserManager).Name] as UserManager.UserManager;

            this.ServerQueryConnection.QueryRunner.Notifications.ClientMessageReceived += Notifications_ClientMessageReceived;

            ModelCustomizer.AddModelCustomization(Hooks.ModelCustomizer.OnModelCreating);

            //logger.Info("I have been initialized yo!");
        }
Beispiel #3
0
    public override void OnInspectorGUI()
    {
        if (targets.Length > 1)
        {
            material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), false);

            if (GUILayout.Button("Apply material to all children") && material != null)
            {
                Undo.RecordObjects(targets.SelectMany(t => ((ModelCustomizer)t).gameObject.GetComponentsInChildren <MeshRenderer>()).ToArray(), "Apply Model Customizer materials");
                foreach (UnityEngine.Object obj in targets)
                {
                    ModelCustomizer modelCustomizer = (ModelCustomizer)obj;
                    modelCustomizer.ApplyMaterial(material);
                }
            }

            EditorGUILayout.Space();

            EditorGUILayout.HelpBox("Part customization is not allowed for multiple objects.", MessageType.Info);
        }
        else
        {
            customizer = target as ModelCustomizer;

            material = (Material)EditorGUILayout.ObjectField("Material", material, typeof(Material), false);

            if (GUILayout.Button("Apply material to all children") && material != null)
            {
                customizer.ApplyMaterial(material);
            }

            EditorGUILayout.Space();

            if (start)
            {
                customizer.DoReset();
                start = false;
            }
            bools = customizer.GetBools();
            names = customizer.GetNames();
            for (int i = 0; i < names.Length; i++)
            {
                //draw and handle bools
                EditorGUI.BeginChangeCheck();
                bool b = EditorGUILayout.Toggle(names[i], bools[i]);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(customizer, "toggled model part");
                    EditorUtility.SetDirty(customizer);
                    customizer.SetBool(i, b);
                }
            }
        }
    }
Beispiel #4
0
        public void UserInitialize(Bot.ComponentList ComponentList)
        {
            // Hello
            this.Name = this.GetType().Name;
            ModelCustomizer.AddModelCustomization(Hooks.ModelCustomizer.OnModelCreating);

            this.ServerQueryConnection = ComponentList[typeof(Core.ServerQueryConnection.ServerQueryConnection).Name] as Core.ServerQueryConnection.ServerQueryConnection;
            this.ServerQueryAddon      = ComponentList[typeof(Core.ServerQueryShell.ServerQueryShell).Name] as Core.ServerQueryShell.ServerQueryShell;
            this.testAddon             = ComponentList[typeof(TestAddon).Name] as TestAddon;

            // Native serverquery events are in queryRunner object.
            this.ServerQueryConnection.BotCommandAttempt += ServerQueryConnection_BotCommandReceived;
            this.ServerQueryConnection.QueryRunner.Notifications.ClientMoved += Notifications_ClientMoved;
        }
Beispiel #5
0
        public void UserInitialize(CoreList AddonInjections)
        {
            this.Name = this.GetType().Name;
            ModelCustomizer.AddModelCustomization(Hooks.ModelCustomizer.OnModelCreating);

            this.ServerQueryConnection = AddonInjections[typeof(ServerQueryConnection.ServerQueryConnection).Name] as ServerQueryConnection.ServerQueryConnection;
            this.ServerQueryAddon      = AddonInjections[typeof(ServerQueryShell.ServerQueryShell).Name] as ServerQueryShell.ServerQueryShell;

            // Native serverquery events are in queryRunner object. Uncomment if you want to use them.
            this.ServerQueryConnection.BotCommandAttempt += ServerQueryConnection_BotCommandReceived;
            this.ServerQueryConnection.QueryRunner.Notifications.ClientMoved += Notifications_ClientMoved;

            //logger.Debug("TestAddon initialized!");
        }
Beispiel #6
0
        public void UserInitialize(Bot.ComponentList ComponentList)
        {
            // Hello
            this.Name = this.GetType().Name;
            ModelCustomizer.AddModelCustomization(Hooks.ModelCustomizer.OnModelCreating);

            this.ServerQueryConnection = ComponentList[typeof(Core.ServerQueryConnection.ServerQueryConnection).Name] as Core.ServerQueryConnection.ServerQueryConnection;
            this.testAddon             = ComponentList[typeof(TestAddon.TestAddon).Name] as TestAddon.TestAddon;

            // Native serverquery events are in queryRunner object.
            this.ServerQueryConnection.QueryRunner.Notifications.ClientMoved  += Notifications_ClientMoved;
            this.ServerQueryConnection.QueryRunner.Notifications.ClientJoined += onClientConnect;

            BotHasReturnedMessage(); //Tell everyone you're back
        }
Beispiel #7
0
        // Example of how the model can be extended
        static void extendingClass()
        {
            using (var databaseAccess = new DatabaseAccessService(new CarRentalContext()))
            {
                ModelCustomizer.RegisterModelCustomization(
                    test =>
                {
                    test.Entity <ExtendedCustomer>();
                });

                var customer = new BasicCustomer {
                    name = "Christie", dateOfBirth = new DateTime(1990, 1, 1)
                };
                var extendedCustomer = new ExtendedCustomer {
                    name = "Medda", dateOfBirth = new DateTime(1990, 1, 1), someNewValue = "hej"
                };

                databaseAccess.addCustomer(customer).Wait();
                databaseAccess.addCustomer(extendedCustomer).Wait();
            }
        }
 public PostgreSqlModelCustomizer(ModelCustomizerDependencies dependencies)
 {
     _modelCustomizer = new ModelCustomizer(dependencies);
 }
 public SqlServerModelCustomizer(ModelCustomizerDependencies dependencies)
 {
     _modelCustomizer = new ModelCustomizer(dependencies);
 }
 protected override void OnModelCreating(DbModelBuilder modelBuilder)
 {
     base.OnModelCreating(modelBuilder);
     ModelCustomizer.ApplyCustomization(modelBuilder);
     modelBuilder.Conventions.Remove <OneToManyCascadeDeleteConvention>();
 }