Example #1
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            if (previousClickedButtonIndex == -1)
            {
                return;
            }

            if (sectionpreview != null)
            {
                foreach (var g in sectionpreview)
                {
                    RhinoDoc.ActiveDoc.Objects.Delete(g, true);
                }
            }



            //법규선체크
            //var tttt = new RegulationChecker(tempOutput[previousClickedButtonIndex]);
            //this.sectionpreview.Add(LoadManager.getInstance().DrawObjectWithSpecificLayer(tttt.ByLightingHigh, LoadManager.NamedLayer.ETC));
            //this.sectionpreview.Add(LoadManager.getInstance().DrawObjectWithSpecificLayer(tttt.FromNorthHigh, LoadManager.NamedLayer.Guide));
            //this.sectionpreview.Add(LoadManager.getInstance().DrawObjectWithSpecificLayer(tttt.FromSurroundings, LoadManager.NamedLayer.Model));

            DrawSection drawsection = new DrawSection(tempOutput[previousClickedButtonIndex]);

            RhinoDoc.ActiveDoc.Views.ActiveView.Redraw();
        }
        public virtual void FoldSection(string title, DrawSection OnDrawSection, ref bool foldSection)
        {
            foldSection = EditorGUILayout.Foldout(foldSection, title, FoldOut());

            if (foldSection)
            {
                OnDrawSection();
            }
        }
 public virtual void Section(string title, DrawSection OnDrawSection)
 {
     Header(title);
     OnDrawSection();
     Footer();
 }
        protected override void OnEnable()
        {
            base.OnEnable();
            m_Controller = target as ThirdPersonSystem;

            m_GroundMask = serializedObject.FindProperty("m_GroundMask");
            customProperties.Add(m_GroundMask.name);

            m_GroundCheckDistance = serializedObject.FindProperty("m_GroundCheckDistance");
            customProperties.Add(m_GroundCheckDistance.name);

            m_MaxAngleSlope = serializedObject.FindProperty("m_MaxAngleSlope");
            customProperties.Add(m_MaxAngleSlope.name);

            gravityAcc = serializedObject.FindProperty("m_GravityAcceleration");
            customProperties.Add(gravityAcc.name);

            alwaysZoomProperty = serializedObject.FindProperty("m_AlwaysZoomCamera");
            customProperties.Add(alwaysZoomProperty.name);

            OnAnyAbilityEnters = serializedObject.FindProperty("OnAnyAbilityEnters");
            customProperties.Add(OnAnyAbilityEnters.name);

            OnAnyAbilityExits = serializedObject.FindProperty("OnAnyAbilityExits");
            customProperties.Add(OnAnyAbilityExits.name);

            OnGroundedEvent = serializedObject.FindProperty("OnGrounded");
            customProperties.Add(OnGroundedEvent.name);

            if (EditorPrefs.HasKey("Selection"))
            {
                selection = (Selection)EditorPrefs.GetInt("Selection");
            }

            if (EditorPrefs.HasKey("SelectedAbility"))
            {
                selectedAbility = EditorPrefs.GetInt("SelectedAbility");
            }

            if (EditorPrefs.HasKey("AbilitySelection"))
            {
                m_AbilitySection = (DrawSection)EditorPrefs.GetInt("AbilitySelection");
            }

            UpdateAbilitiesList();

            allAvailablesAbilities.Clear();
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();

            for (int i = 0; i < assemblies.Length; i++)
            {
                var types = assemblies[i].GetTypes();
                for (int j = 0; j < types.Length; ++j)
                {
                    // Must derive from Modifier.
                    if (!typeof(ThirdPersonAbility).IsAssignableFrom(types[j]))
                    {
                        continue;
                    }

                    // Ignore abstract classes.
                    if (types[j].IsAbstract)
                    {
                        continue;
                    }

                    allAvailablesAbilities.Add(types[j]);
                }
            }

            Undo.undoRedoPerformed += UpdateAbilitiesList;
        }
        public virtual void DrawInspector(GUIStyle active, GUIStyle normal, GUISkin contentSkin, GUISkin header, string abilityName, ref DrawSection drawSection)
        {
            serializedObject.Update();
            GUILayout.Space(20);
            EditorGUILayout.PropertyField(serializedObject.FindProperty("m_Script"));

            GUILayout.Space(10);

            #region Buttons
            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("Ability Settings", (drawSection == DrawSection.Properties) ? active : normal))
            {
                if (drawSection == DrawSection.Properties)
                {
                    drawSection = DrawSection.Noone;
                }
                else
                {
                    drawSection = DrawSection.Properties;
                }
            }

            if (GUILayout.Button("Animation", (drawSection == DrawSection.Animation) ? active : normal))
            {
                drawSection = DrawSection.Animation;
            }
            if (GUILayout.Button("Abilities To Ignore", (drawSection == DrawSection.AbilitiesToIgnore) ? active : normal))
            {
                drawSection = DrawSection.AbilitiesToIgnore;
            }
            if (GUILayout.Button("Events", (drawSection == DrawSection.Events) ? active : normal))
            {
                drawSection = DrawSection.Events;
            }

            EditorGUILayout.EndHorizontal();
            #endregion

            EditorGUILayout.BeginVertical();

            EditorGUILayout.Space();

            switch (drawSection)
            {
            case DrawSection.Properties:
                DrawProperties(contentSkin);
                break;

            case DrawSection.Animation:
                DrawAnimation(contentSkin);
                EditorGUILayout.Space();
                DrawRootMotionProperties();
                break;

            case DrawSection.AbilitiesToIgnore:
                DrawIgnoreAbilities();
                break;

            case DrawSection.Events:
                DrawEvents();
                break;

            default:
                break;
            }

            EditorGUILayout.EndVertical();

            serializedObject.ApplyModifiedProperties();
        }