public void OnClick(GameObject[] affectedObjectsArray)
        {
            CustomModule.SHOW_StringInput("Find:", EditorPrefs.GetString("EModules/MultyRenamer/Find", ""), (find) =>
                                          { if (string.IsNullOrEmpty(find))
                                            {
                                                return;
                                            }

                                            EditorPrefs.SetString("EModules/MultyRenamer/Find", find);
                                            CustomModule.SHOW_StringInput("Replace:", EditorPrefs.GetString("EModules/MultyRenamer/Replace", ""), (replace) =>
                                                                          { EditorPrefs.SetString("EModules/MultyRenamer/Replace", replace);

                                                  foreach (var item in affectedObjectsArray)
                                                  {
                                                      if (!item)
                                                      {
                                                          continue;
                                                      }

                                                      Undo.RecordObject(item, "Multy Renamer");
                                                      item.name = item.name.Replace(find, replace);
                                                      EditorUtility.SetDirty(item);
                                                  }
                                                                          }); });
        }
Ejemplo n.º 2
0
        public void Register_Unregister_ModuleCountUnchanged()
        {
            int initialCount             = GetModuleCount();
            IAuthenticationModule module = new CustomModule();

            AuthenticationManager.Register(module);
            AuthenticationManager.Unregister(module);
            Assert.Equal(initialCount, GetModuleCount());
        }
Ejemplo n.º 3
0
 public void Register_UnregisterByScheme_ModuleCountUnchanged()
 {
     RemoteExecutor.Invoke(() =>
     {
         int initialCount             = GetModuleCount();
         IAuthenticationModule module = new CustomModule();
         AuthenticationManager.Register(module);
         AuthenticationManager.Unregister("custom");
         Assert.Equal(initialCount, GetModuleCount());
     }).Dispose();
 }
Ejemplo n.º 4
0
        public void Register_Unregister_ModuleCountUnchanged()
        {
            RemoteInvoke(() =>
            {
                int initialCount             = GetModuleCount();
                IAuthenticationModule module = new CustomModule();
                AuthenticationManager.Register(module);
                AuthenticationManager.Unregister(module);
                Assert.Equal(initialCount, GetModuleCount());

                return(SuccessExitCode);
            }).Dispose();
        }
Ejemplo n.º 5
0
        static void Main()
        {
            Console.WriteLine(" CodeCamp 2009 Ninject Sample ");

            var module = new CustomModule();
            IKernel kernel = new StandardKernel(module);

            var logService = kernel.Get<TextLogService>();

            try
            {
                throw new Exception(" CodeCamp Ninject Sample ");
            }
            catch (Exception e)
            {
                logService.LogIt(DateTime.Now, e.Source, e.Message);
            }

            Console.ReadLine();
        }
Ejemplo n.º 6
0
 // This should always be called in the module constructor to
 // provide a direct reference to the parent module.
 public void SetParentModule(CustomModule parent)
 {
     m_ParentModule = parent;
 }
        public void OnClick(GameObject[] affectedObjectsArray)
        {
            var onlytop = MyMenu_Utils.GetOnlyTopObjects(affectedObjectsArray).OrderBy(go => go.transform.GetSiblingIndex()).ToArray();

            if (onlytop.Length == 0)
            {
                return;
            }

            var center_object = onlytop[onlytop.Length - 1];

            var groupParent       = center_object.transform.parent;
            var groupSiblingIndex = center_object.transform.GetSiblingIndex();

            var reference = center_object;
            var NEW_NAME  = reference.name + " Group";

            // Save Previous Name Variant
            // CustomModule.SHOW_StringInput( "Group Name:", EditorPrefs.GetString( "EModules/MultyRenamer/GroupName", NEW_NAME ) , ( name ) =>
            // {   EditorPrefs.SetString( "EModules/MultyRenamer/GroupName", name );

            // Top Object Name Variant
            CustomModule.SHOW_StringInput("Group Name:", NEW_NAME, (name) =>
            {
                var groupRoot = new GameObject(name);
                groupRoot.transform.SetParent(groupParent, false);
                //groupRoot.transform.localScale = Vector3.one;
                groupRoot.transform.SetSiblingIndex(groupSiblingIndex);
                //********************************//
                //groupRoot.transform.position = center_object.transform.position;
                //groupRoot.transform.rotation = center_object.transform.rotation;
                //********************************//

                //MyMenu_Utils.AssignUniqueName( groupRoot ); // name
                if (reference.GetComponent <RectTransform>())            // canvas
                {
                    var source              = reference.GetComponent <RectTransform>();
                    var dest                = groupRoot.AddComponent <RectTransform>();
                    dest.sizeDelta          = source.sizeDelta;
                    dest.pivot              = source.pivot;
                    dest.anchoredPosition3D = source.anchoredPosition3D;
                    dest.localRotation      = source.localRotation;
                    dest.localScale         = source.localScale;
                    dest.anchorMin          = source.anchorMin;
                    dest.anchorMax          = source.anchorMax;
                    dest.offsetMin          = source.offsetMin;
                    dest.offsetMax          = source.offsetMax;
                    groupRoot.AddComponent <CanvasRenderer>();
                }

                /*  if ( groupRoot.GetComponentsInParent<Canvas>( true ).Length != 0 )     // canvas
                 * {   var rect = groupRoot.AddComponent<RectTransform>();
                 *    rect.anchorMin = Vector2.zero;
                 *    rect.anchorMax = Vector2.one;
                 *    rect.offsetMin = Vector2.zero;
                 *    rect.offsetMax = Vector2.zero;
                 *    groupRoot.AddComponent<CanvasRenderer>();
                 * }*/

                Undo.RegisterCreatedObjectUndo(groupRoot, groupRoot.name);

                foreach (var gameObject in onlytop)
                {
                    Undo.SetTransformParent(gameObject.transform, groupRoot.transform, groupRoot.name);
                }

                HierarchyExtensions.Utilities.SetExpanded(groupRoot.GetInstanceID(), true);

                Selection.objects = onlytop.ToArray();
            });

            //Selection.objects = new[] { groubObject };
        }
        public void OnClick(GameObject[] affectedObjectsArray)
        {
            var onlytop = MyMenu_Utils.GetOnlyTopObjects(affectedObjectsArray).OrderBy(go => go.transform.GetSiblingIndex()).ToArray();

            if (onlytop.Length == 0)
            {
                return;
            }

            var last_object = onlytop[onlytop.Length - 1];

            var groupParent       = onlytop[0].transform.parent;
            var groupSiblingIndex = onlytop[0].transform.GetSiblingIndex();


            var NEW_NAME = last_object.name + " Group";


            // Save Previous Name Variant
            // CustomModule.SHOW_StringInput( "Group Name:", EditorPrefs.GetString( "EModules/MultyRenamer/GroupName", NEW_NAME ) , ( name ) =>
            // {   EditorPrefs.SetString( "EModules/MultyRenamer/GroupName", name );

            // Top Object Name Variant
            CustomModule.SHOW_StringInput("Group Name:", NEW_NAME, (name) =>
            {
                var groupRoot = new GameObject(name);
                groupRoot.transform.SetParent(groupParent, false);
                groupRoot.transform.localScale = Vector3.one;
                groupRoot.transform.SetSiblingIndex(groupSiblingIndex);
                //********************************//
                Vector3 center = Vector3.zero;
                Vector3 rot    = Vector3.zero;

                foreach (var item in onlytop)
                {
                    center += item.transform.position;
                    rot    += item.transform.eulerAngles;
                }

                center /= onlytop.Length;
                rot    /= onlytop.Length;
                groupRoot.transform.position    = center;
                groupRoot.transform.eulerAngles = rot;
                //********************************//

                //MyMenu_Utils.AssignUniqueName( groupRoot ); // name
                if (groupRoot.GetComponentsInParent <Canvas>(true).Length != 0)            // canvas
                {
                    var rect       = groupRoot.AddComponent <RectTransform>();
                    rect.anchorMin = Vector2.zero;
                    rect.anchorMax = Vector2.one;
                    rect.offsetMin = Vector2.zero;
                    rect.offsetMax = Vector2.zero;
                    groupRoot.AddComponent <CanvasRenderer>();
                }

                Undo.RegisterCreatedObjectUndo(groupRoot, groupRoot.name);

                foreach (var gameObject in onlytop)
                {
                    Undo.SetTransformParent(gameObject.transform, groupRoot.transform, groupRoot.name);
                }

                HierarchyExtensions.Utilities.SetExpanded(groupRoot.GetInstanceID(), true);

                Selection.objects = onlytop.ToArray();
            });
            //Selection.objects = new[] { groubObject };
        }