예제 #1
0
        void UpdateInspectorData(GameObject selection, bool fullReload)
        {
            var listView = m_InspectorUI.listView;

            if (fullReload)
            {
                var inspectorData = new List <InspectorData>();

#if UNITY_EDITOR
                var objectChildren = new List <InspectorData>();
                foreach (var component in selection.GetComponents <Component>())
                {
                    var obj = new SerializedObject(component);

                    var componentChildren = new List <InspectorData>();

                    var property = obj.GetIterator();
                    while (property.NextVisible(true))
                    {
                        if (property.depth == 0)
                        {
                            componentChildren.Add(SerializedPropertyToPropertyData(property, obj));
                        }
                    }

                    var componentData = new InspectorData("InspectorComponentItem", obj, componentChildren);
                    objectChildren.Add(componentData);
                }

                var objectData = new InspectorData("InspectorHeaderItem", new SerializedObject(selection), objectChildren);
                inspectorData.Add(objectData);
#else
                // TODO: Runtime serialization
#endif

                listView.data = inspectorData;
            }
            else
            {
                listView.OnObjectModified();
            }
        }
예제 #2
0
    public override void Setup(InspectorData data)
    {
        base.Setup(data);

        var target = data.serializedObject.targetObject;

        StopAllCoroutines();
        StartCoroutine(GetAssetPreview());

        m_TargetGameObject = target as GameObject;

        if (m_TargetGameObject)
        {
            m_ActiveToggle.isOn = m_TargetGameObject.activeSelf;
            m_StaticToggle.isOn = m_TargetGameObject.isStatic;
        }

        m_NameField.text = target.name;
        m_NameField.ForceUpdateLabel();

        if (m_TargetGameObject)
        {
            var tags = UnityEditorInternal.InternalEditorUtility.tags;
            m_TagDropDown.options = tags;
            var tagIndex = Array.IndexOf(tags, m_TargetGameObject.tag);
            if (tagIndex > -1)
            {
                m_TagDropDown.value = tagIndex;
            }
            m_TagDropDown.valueChanged += SetTag;

            var layers = UnityEditorInternal.InternalEditorUtility.layers;
            m_LayerDropDown.options = layers;
            var layerIndex = Array.IndexOf(layers, LayerMask.LayerToName(m_TargetGameObject.layer));
            if (layerIndex > -1)
            {
                m_LayerDropDown.value = layerIndex;
            }
            m_LayerDropDown.valueChanged += SetLayer;
        }
    }
예제 #3
0
    public override void Setup(InspectorData data)
    {
        base.Setup(data);

        var vector = Vector4.zero;
        var count  = 4;

        switch (m_SerializedProperty.propertyType)
        {
        case SerializedPropertyType.Vector2:
            ZGroup.SetActive(false);
            WGroup.SetActive(false);
            vector = m_SerializedProperty.vector2Value;
            count  = 2;
            break;

        case SerializedPropertyType.Quaternion:
            vector = m_SerializedProperty.quaternionValue.eulerAngles;
            ZGroup.SetActive(true);
            WGroup.SetActive(false);
            count = 3;
            break;

        case SerializedPropertyType.Vector3:
            vector = m_SerializedProperty.vector3Value;
            ZGroup.SetActive(true);
            WGroup.SetActive(false);
            count = 3;
            break;

        case SerializedPropertyType.Vector4:
            vector = m_SerializedProperty.vector4Value;
            ZGroup.SetActive(true);
            WGroup.SetActive(true);
            break;
        }

        m_CuboidLayout.UpdateObjects();

        UpdateInputFields(count, vector);
    }
예제 #4
0
        bool FindElementAndUpdateParent(InspectorData parent, PropertyData element)
        {
            if (parent.children != null)
            {
                foreach (var child in parent.children)
                {
                    if (child == element)
                    {
                        var propertyData = (PropertyData)parent;
                        propertyData.children = GetSubProperties(propertyData.property.Copy(), propertyData.serializedObject);
                        return(true);
                    }

                    if (FindElementAndUpdateParent(child, element))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
예제 #5
0
    public override void Setup(InspectorData data)
    {
        base.Setup(data);

        if (m_SerializedProperty.propertyType == SerializedPropertyType.LayerMask)
        {
            m_DropDown.multiSelect = true;

            var options = new List <string> {
                kNothing, kEverything
            };
            options.AddRange(InternalEditorUtility.layers);
            m_DropDown.options = options.ToArray();

            switch (m_SerializedProperty.intValue)
            {
            case 0:
                m_DropDown.values = new[] { 0 };
                break;

            case ~0:
                m_DropDown.values = EverythingValues();
                m_DropDown.LabelOverride("Everything");
                break;

            default:
                m_DropDown.values = LayerMaskToIndices(m_SerializedProperty.intValue);
                break;
            }
        }
        else
        {
            m_DropDown.multiSelect = false;
            m_DropDown.options     = m_SerializedProperty.enumDisplayNames;
            m_DropDown.value       = m_SerializedProperty.enumValueIndex;
        }
    }
예제 #6
0
#pragma warning restore 649

        public override void Setup(InspectorData data, bool firstTime)
        {
            base.Setup(data, firstTime);

            UpdateInputFields();
        }
예제 #7
0
        public override void Setup(InspectorData data)
        {
            base.Setup(data);

            UpdateDropdown();
        }
예제 #8
0
    public override void Setup(InspectorData data)
    {
        base.Setup(data);

        UpdateInputFields(m_SerializedProperty.colorValue);
    }
예제 #9
0
 public InspectorState(ReorderableList list, InspectorData data, bool dataIsNotNull = false)
 {
     reorderableList        = list;
     inspectorData          = data;
     inspectorDataIsNotNull = dataIsNotNull;
 }
예제 #10
0
    public override void Setup(InspectorData data)
    {
        base.Setup(data);

        m_TypeLabel.text = U.Object.NicifySerializedPropertyType(m_SerializedProperty.type);
    }
예제 #11
0
    public override void Setup(InspectorData data)
    {
        base.Setup(data);

        m_Toggle.isOn = m_SerializedProperty.boolValue;
    }
예제 #12
0
 public override void Setup(InspectorData data)
 {
     base.Setup(data);
     memberMono = (MemberMono)data.serializedObject.targetObject;
 }
        public ActionResult BackLogMemberDetail(FormCollection fc)
        {
            try
            {
                int result = 0;
                List <SelectListItem> lstSL  = new List <SelectListItem>();
                List <SelectListItem> lstI   = new List <SelectListItem>();
                ARCSData            objARCSD = new ARCSData();
                InspectorData       objID    = new InspectorData();
                ForwardToIncepector objFTI   = new ForwardToIncepector();

                if (Convert.ToInt32(Session["RoleId"]) == 3)
                {
                    string IPAddress = GetIPAddress();
                    string Browser   = GetWebBrowserName();
                    ForwardToARCSOfficers objFTAO = new ForwardToARCSOfficers
                    {
                        IncepectorCode = Convert.ToInt32(Session["InsceptorCode"]),
                        SocietyTransId = Convert.ToString(Session["SocietyTransID"]),
                        Remarks        = fc.Get("ARCSRemarks").ToString()
                    };
                    if (Convert.ToInt16(Session["InspectorCount"]) >= 1)
                    {
                        Boolean         IsCheck         = Convert.ToBoolean(fc.Get("Insprctorchk1"));
                        SaveDeclaration savedeclaration = new SaveDeclaration
                        {
                            UserId         = Convert.ToInt32(Session["UserId"]),
                            IPAddress      = IPAddress,
                            BrowserName    = Browser,
                            Ischeck        = IsCheck,
                            Remark         = objFTAO.Remarks,
                            SocietyTransID = objFTAO.SocietyTransId,
                        };
                        objARCSD.SaveDeclaration(savedeclaration);
                    }
                    result = objID.BackLogForwardToARCS(objFTAO);
                    if (result >= 1)
                    {
                        if (Convert.ToInt32(Session["InspectorCount"]) > 1)
                        {
                            ViewBag.InspectorChange = "Yes";
                        }
                        ViewBag.show      = "BackLog Application successfully forwarded to ARCS Officer";
                        ViewBag.result    = "1";
                        ViewBag.tabResult = "1";
                    }
                    else
                    {
                        ViewBag.show      = "BackLog Application not successfully forwarded to ARCS Officer";
                        ViewBag.result    = "0";
                        ViewBag.tabResult = "0";
                    }
                    lstSL         = GetSocietyList();
                    ViewBag.lstSL = lstSL;
                }
                if (Convert.ToInt32(Session["RoleId"]) == 2)
                {
                    if (string.IsNullOrEmpty(fc.Get("IncepectorList")))
                    {
                        ViewBag.show      = "Kindly Select Inspector";
                        ViewBag.result    = "0";
                        ViewBag.tabResult = "5";
                        return(View());
                    }
                    if (string.IsNullOrEmpty(fc.Get("ARCSRemarks")))
                    {
                        ViewBag.show      = "fill your remarks";
                        ViewBag.result    = "0";
                        ViewBag.tabResult = "5";
                        return(View());
                    }
                    objFTI.OfficerCode = Convert.ToInt32(fc.Get("IncepectorList"));
                    var SocietyTransID = Convert.ToString(Session["SocietyTransID"]);
                    Session["SocietyTransID"] = SocietyTransID;
                    objFTI.SocietyTransId     = Convert.ToString(Session["SocietyTransID"]);
                    objFTI.Remarks            = fc.Get("ARCSRemarks").ToString();
                    result = objARCSD.BackLogForwardToIncepector(objFTI);
                    if (result >= 1)
                    {
                        ViewBag.show      = "Application successfully forwarded to incepector";
                        ViewBag.result    = "1";
                        ViewBag.tabResult = "1";
                    }
                    else
                    {
                        ViewBag.show      = "Application not successfully forwarded to incepector";
                        ViewBag.result    = "0";
                        ViewBag.tabResult = "0";
                    }
                    lstSL           = GetSocietyList();
                    ViewBag.lstSL   = lstSL;
                    lstI            = GetInspectorSocietyList();
                    ViewBag.BcklstI = lstI;
                }
                lstGD            = GetDistrict();
                ViewBag.District = lstGD;

                lstR = GetRelationship();
                ViewBag.Relationship          = lstR;
                lstMember                     = GetAllShareTransferMember();
                ViewBag.MemberDetail          = lstMember;
                lstMCDCM                      = GetMemberCommDesignation();
                ViewBag.MemberCommDesignation = lstMCDCM;
                lstARCSCode                   = GetsubClassSocieties();
                ViewBag.lstARCSCode           = lstARCSCode;
                CommunityofSociety            = GetCommunityofSociety();
                ViewBag.CommunityofSociety    = CommunityofSociety;
                lstSL          = GetSocietyList();
                ViewBag.lstSL  = lstSL;
                Inspkl         = GetInspectorSocietyList();
                ViewBag.Inspkl = Inspkl;
                lstI           = GetInspectorList();
                ViewBag.lstI   = lstI;
            }

            catch (Exception ex)
            {
                return(RedirectToAction("Error", "Unauthorised"));

                throw ex;
            }
            return(View());
        }
예제 #14
0
#pragma warning restore 649

        public override void Setup(InspectorData data, bool firstTime)
        {
            base.Setup(data, firstTime);
            UpdateDropdown();
        }
예제 #15
0
    // END Inspector data classes

    private InspectorState UpdateInspectorState(SerializedProperty property, ReorderableList list, InspectorData data, bool dataIsNotNull)
    {
        return(UpdateInspectorState(property, new InspectorState(list, data, dataIsNotNull)));
    }
예제 #16
0
        public override void Setup(InspectorData data)
        {
            base.Setup(data);

            UpdateInputFields();
        }
예제 #17
0
        public ActionResult SocietyMemberDetails(FormCollection fc, IEnumerable <HttpPostedFileBase> files)
        {
            ByeLawsModel           objBL  = new ByeLawsModel();
            ContentFileUploadModel objCFU = new ContentFileUploadModel();

            try
            {
                int i = 4;
                foreach (var file in files)
                {
                    if (file != null)
                    {
                        AttachmentType aa  = new AttachmentType();
                        Stream         str = file.InputStream;
                        objCFU.File_Name  = file.FileName;
                        objBL.ByeLawsName = file.FileName;
                        string       extenstion = "pdf";
                        BinaryReader Br         = new BinaryReader(str);
                        byte[]       FileDet    = Br.ReadBytes((Int32)str.Length);
                        string       base64ImageRepresentation = Convert.ToBase64String(FileDet);
                        objBL.Docs            = base64ImageRepresentation;
                        objCFU.ContentUpload  = base64ImageRepresentation;
                        objBL.SocietyTransID  = Convert.ToString(Session["SocietyTransID"]);
                        objCFU.USER_ID        = Convert.ToInt32(Session["UserId"]);
                        objCFU.SocietyTransID = Convert.ToString(Session["SocietyTransID"]);
                        aa            = GetMimeType(base64ImageRepresentation);
                        objCFU.FormId = i;
                        if (extenstion.IndexOf(aa.Extension.Replace(".", "")) < 0 || aa.Extension == "")
                        {
                        }
                        else
                        {
                            Int64 filesizeallowedfor_FileUpload = 2048 * 5;
                            if (file.ContentLength < filesizeallowedfor_FileUpload)
                            {
                                int a = objSSF.SaveContentFileUpload(objCFU);
                            }
                        }
                    }
                    i = i + 1;
                }
                List <SelectListItem> lstSL   = new List <SelectListItem>();
                List <SelectListItem> lstI    = new List <SelectListItem>();
                InspectorData         objID   = new InspectorData();
                ForwardToARCSOfficers objFTAO = new ForwardToARCSOfficers
                {
                    IncepectorCode = Convert.ToInt32(Session["InsceptorCode"]),
                    SocietyTransId = Convert.ToString(Session["SocietyTransID"]),
                    Remarks        = fc.Get("ARCSRemarks").ToString()
                };
                int result = objID.ForwardToARCS(objFTAO);
                if (result >= 1)
                {
                    ViewBag.show      = "Application successfully forwarded to incepector";
                    ViewBag.result    = "1";
                    ViewBag.tabResult = "1";
                }
                else
                {
                    ViewBag.show      = "Application not successfully forwarded to incepector";
                    ViewBag.result    = "0";
                    ViewBag.tabResult = "0";
                }
                lstSL         = GetSocietyList();
                ViewBag.lstSL = lstSL;
            }
            catch (Exception ex)
            {
                return(RedirectToAction("Error", "Unauthorised"));

                throw ex;
            }
            return(View());
        }
예제 #18
0
        public PersistentCallData(InspectorData inspectorData, int index, int indentLevel, Rect position, SerializedProperty property, SerializedProperty listProperty, GenericMenu.MenuFunction2 menuSelectionHandler, GenericMenu.MenuFunction2 noFunctionHandler)
        {
            this.inspectorData           = inspectorData;
            this.index                   = index;
            this.persistentCallProperty  = listProperty.GetArrayElementAtIndex(index);
            this.genericMenuDataProperty = persistentCallProperty.FindPropertyRelative("genericMenuData");
            this.componentIndexProperty  = genericMenuDataProperty.FindPropertyRelative("selectedComponent");
            this.memberIndexProperty     = genericMenuDataProperty.FindPropertyRelative("selectedMember");
            this.isDynamicDataProperty   = genericMenuDataProperty.FindPropertyRelative("isDynamic");

            this.targetProperty        = persistentCallProperty.FindPropertyRelative("target");
            this.memberNameProperty    = persistentCallProperty.FindPropertyRelative("memberName");
            this.memberTypeProperty    = persistentCallProperty.FindPropertyRelative("memberType");
            this.isDynamicProperty     = persistentCallProperty.FindPropertyRelative("isDynamic");
            this.isCallEnabledProperty = persistentCallProperty.FindPropertyRelative("isCallEnabled");
            this.argumentTypeProperty  = persistentCallProperty.FindPropertyRelative("argument").FindPropertyRelative("supportedType");

            // Try to cast assigned target to GameObject type
            targetGameObject = targetProperty.objectReferenceValue as GameObject;
            Component targetComponent = targetProperty.objectReferenceValue as Component;

            if (targetGameObject == null)
            {
                // If that doesn't work, perhaps a component was assigned
                if (targetComponent != null)
                {
                    targetGameObject = targetComponent.gameObject;
                }
                // If it wasn't a component or not an instance then set the field to null
                if (targetGameObject == null)
                {
                    targetProperty.objectReferenceValue = null;
                }
            }

            if (targetGameObject == null)
            {
                return;
            }

            // Add all components and the game object reference to the selectable list
            Component[] components = targetGameObject.GetComponents(typeof(Component));
            Object[]    gameObjectAndComponents = new Object[components.Length + 1];
            gameObjectAndComponents[0] = targetGameObject;
            components.CopyTo(gameObjectAndComponents, 1);
            genericMenuData = new MemberMenuData(inspectorData, gameObjectAndComponents);

            // Check if components have been added or moved up/down in the inspector
            if (componentIndexProperty.intValue != -1)
            {
                for (int i = 0; i < components.Length; i++)
                {
                    if (components[i] == targetComponent)
                    {
                        componentIndexProperty.intValue = i + 1;
                    }
                }
            }

            // Check if members have been renamed or removed
            if (componentIndexProperty.intValue >= 0 && memberIndexProperty.intValue >= 0)
            {
                MemberMenuComponent selectedComponent  = genericMenuData.components[Mathf.Clamp(componentIndexProperty.intValue, 0, genericMenuData.components.Length - 1)];
                MemberMenuItem      selectedMemberItem = selectedComponent.GetMemberItem(memberIndexProperty.intValue, isDynamicDataProperty.boolValue);
                if (selectedMemberItem != null)
                {
                    // Check if string value at memberIndexProperty.intValue equals the expected member name
                    string selectedMemberName = selectedMemberItem.memberInfo.Name;
                    if (selectedMemberName != memberNameProperty.stringValue)
                    {
                        // Get the relevant members array
                        MemberMenuItem[] members = isDynamicDataProperty.boolValue ? selectedComponent.dynamicMembers : selectedComponent.staticMembers;

                        // Try to find the correct index
                        for (int i = 0; i < members.Length; i++)
                        {
                            if (members[i].memberInfo.Name == memberNameProperty.stringValue)
                            {
                                memberIndexProperty.intValue = i;
                            }
                        }

                        // Ensure that if the member has been renamed we keep our current index and update the memberNameProperty value
                        memberNameProperty.stringValue = members[Mathf.Clamp(memberIndexProperty.intValue, 0, members.Length - 1)].memberInfo.Name;
                    }
                }
            }

            genericMenu = new GenericMenu();
            bool isNoFunctionSelected = componentIndexProperty.intValue == -1;

            genericMenu.AddItem(new GUIContent("No Function"), isNoFunctionSelected, noFunctionHandler, new MemberMenuIndex(property, index, 0, 0, false));
            genericMenu.AddSeparator("");

            for (int i = 0; i < genericMenuData.components.Length; i++)
            {
                MemberMenuComponent component = genericMenuData.components[i];

                for (int j = 0; j < component.dynamicMembers.Length; j++)
                {
                    string prefix = component.displayName + "/";
                    if (j == 0)
                    {
                        genericMenu.AddDisabledItem(new GUIContent(prefix + "Dynamic " + GetCleanTypeName(inspectorData.eventType)));
                    }

                    bool isSelected = (isDynamicProperty.boolValue && i == componentIndexProperty.intValue && component.GetMemberItem(j, true).index == memberIndexProperty.intValue);
                    genericMenu.AddItem(new GUIContent(prefix + component.dynamicMembers[j].memberInfo.Name), isSelected, menuSelectionHandler, new MemberMenuIndex(property, index, i, j, true));
                }

                if (component.dynamicMembers.Length > 0 && component.staticMembers.Length > 0)
                {
                    genericMenu.AddDisabledItem(new GUIContent(component.displayName + "/ "));
                }

                for (int j = 0; j < component.staticMembers.Length; j++)
                {
                    string prefix = component.displayName + "/";
                    if (j == 0)
                    {
                        genericMenu.AddDisabledItem(new GUIContent(prefix + "Static Parameters"));
                    }

                    bool isSelected = (!isDynamicProperty.boolValue && i == componentIndexProperty.intValue && component.GetMemberItem(j, false).index == memberIndexProperty.intValue);
                    genericMenu.AddItem(new GUIContent(prefix + component.staticMembers[j].menuDisplayName), isSelected, menuSelectionHandler, new MemberMenuIndex(property, index, i, j, false));
                }
            }

            selectedOptionText      = "No Function";
            shortSelectedOptionText = selectedOptionText;

            if (componentIndexProperty.intValue >= 0)
            {
                MemberMenuComponent menuComponent = genericMenuData.components[Mathf.Clamp(componentIndexProperty.intValue, 0, genericMenuData.components.Length - 1)];
                MemberMenuItem      menuItem      = menuComponent.GetMemberItem(memberIndexProperty.intValue, isDynamicProperty.boolValue);
                if (menuItem != null)
                {
                    shortSelectedOptionText = menuItem.shortDisplayName;
                    selectedOptionText      = menuComponent.component.GetType().Name + "." + shortSelectedOptionText;
                }
            }

            property.serializedObject.ApplyModifiedProperties();
        }