예제 #1
0
        static void Init()
        {
            prefab = WeaverAssets.LoadWeaverAsset <GameObject>("Weaver Settings Screen").GetComponent <SettingsScreen>();

            WeaverGameManager.OnGameStateChange += GameStateChange;
#if UNITY_EDITOR
            SpawnMenu();
#endif
        }
예제 #2
0
        /// <summary>
        /// Adds a button to the settings menu
        /// </summary>
        /// <param name="methodName">The name of the method to call when the button is pressed</param>
        /// <returns>The UIElement that has been added to the panel</returns>
        public UIElement AddButtonElement(string methodName)
        {
            var method = GetType().GetMethod(methodName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static);

            if (method == null)
            {
                throw new Exception("The method " + methodName + " does not exist on the type " + GetType().FullName);
            }
            return(AddButtonElement(method, SettingsScreen.GetDisplayNameOfMember(method), SettingsScreen.GetDescriptionOfMember(method)));
        }
예제 #3
0
        /// <summary>
        /// Adds a UI element to the panel for displaying the property in the settings menu.
        ///
        /// Returns null if the Settings Menu isn't open or the property is not compatible
        /// </summary>
        /// <param name="propertyName">The name of the property to display</param>
        /// <returns>The UIElement that has been added to the panel</returns>
        public UIElement AddPropertyElement(string propertyName)
        {
            var property = GetType().GetProperty(propertyName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            if (property == null)
            {
                throw new Exception("The property " + propertyName + " does not exit on the type " + GetType().FullName);
            }
            return(AddPropertyElement(property, SettingsScreen.GetDisplayNameOfMember(property), SettingsScreen.GetDescriptionOfMember(property)));
        }
예제 #4
0
        /// <summary>
        /// Adds a UI element to the panel for displaying the field in the settings menu.
        ///
        /// Returns null if the Settings Menu isn't open or the field is not compatible
        /// </summary>
        /// <param name="fieldName">The name of the field to display</param>
        /// <returns>The UIElement that has been added to the panel</returns>
        public UIElement AddFieldElement(string fieldName)
        {
            var field = GetType().GetField(fieldName, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            if (field == null)
            {
                throw new Exception("The field " + fieldName + " does not exit on the type " + GetType().FullName);
            }
            return(AddFieldElement(field, SettingsScreen.GetDisplayNameOfMember(field), SettingsScreen.GetDescriptionOfMember(field)));
        }
예제 #5
0
 /// <summary>
 /// Adds a button to the settings menu
 /// </summary>
 /// <param name="methodInfo">The method to call when the button is pressed</param>
 /// <returns>The UIElement that has been added to the panel</returns>
 public UIElement AddButtonElement(MethodInfo methodInfo)
 {
     return(AddButtonElement(methodInfo, SettingsScreen.GetDisplayNameOfMember(methodInfo), SettingsScreen.GetDescriptionOfMember(methodInfo)));
 }
예제 #6
0
 /// <summary>
 /// Adds a UI element to the panel for displaying the property in the settings menu.
 ///
 /// Returns null if the Settings Menu isn't open or the property is not compatible
 /// </summary>
 /// <param name="property">The property to display</param>
 /// <returns>The UIElement that has been added to the panel</returns>
 public UIElement AddPropertyElement(PropertyInfo property)
 {
     return(AddPropertyElement(property, SettingsScreen.GetDisplayNameOfMember(property), SettingsScreen.GetDescriptionOfMember(property)));
 }
예제 #7
0
 /// <summary>
 /// Adds a UI element to the panel for displaying the field in the settings menu.
 ///
 /// Returns null if the Settings Menu isn't open or the field is not compatible
 /// </summary>
 /// <param name="field">The field to display</param>
 /// <returns>The UIElement that has been added to the panel</returns>
 public UIElement AddFieldElement(FieldInfo field)
 {
     return(AddFieldElement(field, SettingsScreen.GetDisplayNameOfMember(field), SettingsScreen.GetDescriptionOfMember(field)));
 }