Пример #1
0
        public override void load(string save)
        {
            List <string> nodeStrings = new List <string> ();
            StringBuilder buffer      = new StringBuilder();
            int           level       = 0;

            for (int i = 0; i < save.Length; i++)
            {
                if (level > 0)
                {
                    buffer.Append(save [i]);
                }
                else
                {
                    if (save [i] != DataSimulator.DS_SAVELOAD_SEPERATOR)
                    {
                        buffer.Append(save [i]);
                    }
                    if ((i == save.Length - 1 || save [i] == DataSimulator.DS_SAVELOAD_SEPERATOR) && buffer.Length > 0)
                    {
                        nodeStrings.Add(buffer.ToString());
                        buffer.Length   = 0;
                        buffer.Capacity = 0;
                    }
                }
                if (save [i] == DataSimulator.DS_SAVELOAD_CHILD_END)
                {
                    level -= 1;
                    if (level == 0)
                    {
                        nodeStrings.Add(buffer.ToString());
                        buffer.Length   = 0;
                        buffer.Capacity = 0;
                    }
                }
                if (save [i] == DataSimulator.DS_SAVELOAD_CHILD_START)
                {
                    level += 1;
                }
            }
            actionType = (DSOutputType)int.Parse(nodeStrings [4]);
            parseNodeString(nodeStrings [5]);
            if (actionType == DSOutputType.Export)
            {
                exportPath = nodeStrings [6];
                exportName = nodeStrings [7];
                exportType = (DSExportType)int.Parse(nodeStrings [8]);
            }
        }
Пример #2
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();
 }