Beispiel #1
0
        public string getValue(IDSData data)
        {
            switch (data.type)
            {
            case DSDataType.Bool:
                return(((DSBool)data).value.ToString());

            case DSDataType.Int:
                return(((DSInt)data).value.ToString());

            case DSDataType.Float:
                return(((DSFloat)data).value.ToString());

            case DSDataType.String:
                return(((DSString)data).value);
            }
            return("");
        }
Beispiel #2
0
        public void updateFieldType(int dataIndex, DSDataType type)
        {
            if (_fields [dataIndex].type != type)
            {
                IDSData toReplace = _fields [dataIndex];
                _fields.RemoveAt(dataIndex);
                switch (type)
                {
                case DSDataType.Bool:
                    DSBool newBool = new DSBool();
                    newBool.name = toReplace.name;
                    newBool.type = DSDataType.Bool;
                    _fields.Insert(dataIndex, newBool);
                    break;

                case DSDataType.Float:
                    DSFloat newFloat = new DSFloat();
                    newFloat.name = toReplace.name;
                    newFloat.type = DSDataType.Float;
                    _fields.Insert(dataIndex, newFloat);
                    break;

                case DSDataType.Int:
                    DSInt newInt = new DSInt();
                    newInt.name = toReplace.name;
                    newInt.type = DSDataType.Int;
                    _fields.Insert(dataIndex, newInt);
                    break;

                case DSDataType.String:
                    DSString newString = new DSString();
                    newString.name = toReplace.name;
                    newString.type = DSDataType.String;
                    _fields.Insert(dataIndex, newString);
                    break;
                }
            }
        }
Beispiel #3
0
 public override void draw()
 {
     rect.height = 25f + dataList.Count * 20f + (actionType == DSOutputType.Export ? 55f : 0) + 75f;
     drawInOutPoint();
     titleRect           = rect;
     titleRect.height    = 20f;
     extendedRect        = rect;
     extendedRect.y      = rect.y + titleRect.height - 1f;
     extendedRect.height = rect.height - titleRect.height;
     GUILayout.BeginArea(titleRect, title, GUI.skin.box);
     GUILayout.EndArea();
     GUILayout.BeginArea(extendedRect, GUI.skin.box);
     GUILayout.BeginVertical();
     GUILayout.Space(5f);
     GUILayout.BeginHorizontal();
     GUILayout.Label("Type:", GUILayout.Width(labelWidth));
     actionType = (DSOutputType)EditorGUILayout.EnumPopup(actionType);
     GUILayout.EndHorizontal();
     if (actionType == DSOutputType.Export)
     {
         GUILayout.BeginHorizontal();
         GUILayout.Label("Save To:", GUILayout.Width(labelWidth));
         GUILayout.Label(exportPath, GUILayout.Width(rect.width - labelWidth - 20f - 15f));
         if (GUILayout.Button("..", GUILayout.Width(20f)))
         {
             exportPath = EditorUtility.OpenFolderPanel("Save To", "", "");
         }
         GUILayout.EndHorizontal();
         GUILayout.BeginHorizontal();
         GUILayout.Label("File Name:", GUILayout.Width(labelWidth));
         exportName = EditorGUILayout.TextField(exportName);
         GUILayout.EndHorizontal();
         GUILayout.BeginHorizontal();
         GUILayout.Label("Action:", GUILayout.Width(labelWidth));
         exportType = (DSExportType)EditorGUILayout.EnumPopup(exportType);
         GUILayout.EndHorizontal();
     }
     GUILayout.Label("Output Data:");
     for (int n = 0; n < dataList.Count; n++)
     {
         if (GUILayout.Button(dataList[n].name))
         {
             DSOutputData data         = dataList [n];
             GenericMenu  dropDownMenu = new GenericMenu();
             for (int i = 0; i < ds.datas.Count; i++)
             {
                 for (int j = 0; j < ds.datas [i].fields.Count; j++)
                 {
                     string  itemName = ds.datas [i].name + "/" + ds.datas [i].fields [j].name;
                     IDSData item     = ds.datas [i].fields [j];
                     dropDownMenu.AddItem(new GUIContent(itemName), false, () => {
                         data.data = item;
                         data.name = itemName;
                     });
                 }
             }
             dropDownMenu.ShowAsContext();
         }
     }
     if (GUILayout.Button("+", GUILayout.Width(20f)))
     {
         DSOutputData newData = new DSOutputData();
         newData.data = null;
         newData.name = "";
         dataList.Add(newData);
     }
     GUILayout.EndVertical();
     GUILayout.EndArea();
 }