public void WriteXml(string xml)
 {
     try
     {
         //because this is mock we don't need add Report Xml element to real report so only id's will be added to output
         var report = MyAssaysObjectSerializer.DeserializeString <Report>(AddRootReportTag(xml));
         if (report?.Items != null)
         {
             foreach (var baseReportElement in report.Items.OfType <BaseReportElementWithId>())
             {
                 OutStrings.Add($"Element with id {baseReportElement.Id} successfully added.");
             }
         }
     }
     catch (Exception e)
     {
         LogError(e);
     }
 }
Exemple #2
0
    public void OnGUI()
    {
        //Debug.Log(path);
        Texture2D [] tlist = new Texture2D[2];
        tlist [0] = new Texture2D(1, 1);
        tlist[1]  = new Texture2D(1, 1);
        GUIStyle guiStyle = new GUIStyle();

        guiStyle.padding = new RectOffset(0, 0, 0, 0);

        guiStyle.active.background = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "icon_d.png", typeof(Texture2D));
        //guiStyle.active.background.LoadImage(File.ReadAllBytes("./Assets/VisualEditorUILayout/Editor/res/icon/icon_d.png"));
        guiStyle.onNormal.background = guiStyle.active.background;
        tlist[0] = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "icon_0.png", typeof(Texture2D));
        tlist[1] = (Texture2D)AssetDatabase.LoadAssetAtPath(path + "icon_1.png", typeof(Texture2D));
        //tlist[0].LoadImage(File.ReadAllBytes("./Assets/VisualEditorUILayout/Editor/res/icon/icon_0.png"));
        //tlist[1].LoadImage(File.ReadAllBytes("./Assets/VisualEditorUILayout/Editor/res/icon/icon_1.png"));
        Rect wr = new Rect(200, 200, 700, 500);

        if (mInstance != null)
        {
            wr = mInstance.position;
            //Debug.Log ("here");
        }
        int   ww   = (int)wr.width;
        int   wh   = (int)wr.height;
        Event cure = Event.current;

        if (cure != null && (cure.type == EventType.MouseDown || cure.type == EventType.MouseDrag || cure.type == EventType.MouseUp))
        {
            //Debug.Log(cure);
            var mpos = cure.mousePosition;
            if (cure.type == EventType.MouseDown)
            {
                curkey = "";
            }
            if (curkey == "")
            {
                foreach (string key in map.Keys)
                {
                    if (map[key].Contains(mpos))
                    {
                        curkey = key;
                        Debug.Log(map[key]);
                        break;
                    }
                }
                if (curkey == "")
                {
                    if (aroll.wr.Contains(mpos))
                    {
                        aroll.reciver(cure, "");
                    }
                }
            }
            if (curkey != "")
            {
                gdata.ctrlist[curkey].reciver(cure, curkey);
                //Debug.Log(map[curkey]);
                //Debug.Log("kkkk");
            }
            if (cure.type == EventType.MouseUp)
            {
                curkey = "";
            }
        }
        wr.width  -= 2 * lena + tiw + lenb;
        wr.height -= 2 * lena + tbh + lenb;
        mww        = (int)wr.width;
        mwh        = (int)wr.height;
        //		if (vlen > wh)
        //			vlen = wh;


        wr.x = lena;
        wr.y = lena;
        //wr.height =vlen- 20;
        //wr.width = wr.height;

        stpos = GUI.BeginScrollView(wr, stpos, new Rect(lena, lena, 2000, 1000), true, true);

        //GUI.Box(wr, "--------");

        if (aroll != null)
        {
            aroll.paint();
            Vector2 sp = Vector2.zero;
            sp = GUI.BeginScrollView(aroll.wr, sp, aroll.wr);
            //Debug.Log(gdata);
            if (gdata.ctrlist != null)
            {
                foreach (var ctr in gdata.ctrlist)
                {
                    ctr.Value.paint();
                }
            }

            GUI.EndScrollView();
        }
        if (ash != null)
        {
            ash.paint();
        }
        GUI.EndScrollView();
        wr.x    += wr.width + lenb;
        wr.width = tiw;
        GUI.Box(wr, "Property");
        if (pctr != null)
        {
            pctr[0].paintprop(wr);
        }
        wr.x      = lena;
        wr.y     += wr.height + lenb;
        wr.width  = ww - 2 * lena - tiw - lenb;
        wr.height = tbh;
        GUI.Box(wr, "");

        wr.y     += (tbh - iconh) / 2;
        wr.width  = iconw * 2;
        wr.height = iconh;


        sel = GUI.Toolbar(wr, sel, tlist, guiStyle);

        wr.x      = ww - lena - iconwa;
        wr.y      = wh - lena - iconha;
        wr.width  = iconwa;
        wr.height = iconha;
        if (GUI.Button(wr, "s"))
        {
            string     jsfile = gdata.jsthis();
            OutStrings oss    = new OutStrings();
            oss.OutInc();
            oss.BeginCls("test");
            oss.OutMenu();
            oss.BeginGui();
            foreach (var ctr in gdata.ctrlist)
            {
                oss.OutCtr(ctr.Value);
            }
            oss.EndGui();
            oss.EndCls();
            Debug.Log(oss.output);
            Debug.Log(jsfile);
        }

        wr.x -= iconwa;
        GUI.Button(wr, "o");

        wr.x -= iconwa;
        GUI.Button(wr, "n");

        wr.x     -= 2 * iconwa;
        wr.width += 5;
        snapon    = GUI.Toggle(wr, snapon, "Grid");
    }
 public void WriteTextElement(string s, int rowSpacingBefore = 0, int rowSpacingAfter = 0)
 {
     OutStrings.Add(s);
 }