示例#1
0
        public ItemBaseInfoBlock(SerializedObject serializedObject, string IDPrefix)
        {
            contentContainer.style.paddingRight = 0;
            this.serializedObject = serializedObject;
            this.IDPrefix         = IDPrefix;
            ID          = serializedObject.FindAutoProperty("ID");
            Name        = serializedObject.FindAutoProperty("Name");
            Icon        = serializedObject.FindAutoProperty("Icon");
            Description = serializedObject.FindAutoProperty("Description");
            type        = serializedObject.FindProperty("type");
            quality     = serializedObject.FindProperty("quality");
            Weight      = serializedObject.FindAutoProperty("Weight");
            StackLimit  = serializedObject.FindAutoProperty("StackLimit");
            Discardable = serializedObject.FindAutoProperty("Discardable");
            text        = "基本信息";
            RefreshCache();
            helpBox             = new HelpBox();
            helpBox.text        = "无错误";
            helpBox.messageType = HelpBoxMessageType.Info;
            Add(helpBox);
            IMGUIContainer inspector = new IMGUIContainer(() =>
            {
                if (serializedObject.targetObject)
                {
                    OnInspectorGUI(serializedObject);
                }
            });

            Add(inspector);
            CheckError();
        }
示例#2
0
        public void CheckError()
        {
            SerializedProperty id = serializedObject.FindAutoProperty("ID");
            bool empty            = string.IsNullOrEmpty(id.stringValue);
            bool dump             = ids.Contains(id.stringValue);
            bool invalid          = empty || dump;

            if (invalid)
            {
                text                = "基本信息(存在错误)";
                helpBox.text        = empty ? "ID为空!" : "ID重复!";
                helpBox.messageType = HelpBoxMessageType.Error;
            }
            else
            {
                SerializedProperty name = serializedObject.FindAutoProperty("Name");
                if (string.IsNullOrEmpty(name.stringValue))
                {
                    text                = "基本信息(可能有误)";
                    helpBox.text        = "道具名为空";
                    helpBox.messageType = HelpBoxMessageType.Warning;
                }
                else
                {
                    SerializedProperty icon = serializedObject.FindAutoProperty("Icon");
                    if (!icon.objectReferenceValue)
                    {
                        text                = "基本信息(可能有误)";
                        helpBox.text        = "图标为空";
                        helpBox.messageType = HelpBoxMessageType.Warning;
                    }
                    else
                    {
                        text                = "基本信息";
                        helpBox.text        = "无错误";
                        helpBox.messageType = HelpBoxMessageType.Info;
                    }
                }
            }
        }
示例#3
0
        public void CheckError()
        {
            SerializedProperty name = serializedObject.FindAutoProperty("Name");

            if (string.IsNullOrEmpty(name.stringValue))
            {
                text                = "基本信息(可能有误)";
                helpBox.text        = "模板名为空";
                helpBox.messageType = HelpBoxMessageType.Warning;
            }
            else
            {
                text                = "基本信息";
                helpBox.text        = "无错误";
                helpBox.messageType = HelpBoxMessageType.Info;
            }
        }