示例#1
0
    public void SaveJson(string filepath, TextPair textpair)
    {
        string json     = JsonUtility.ToJson(textpair);
        string savePath = Application.dataPath + "/Resources/" + filepath;

        File.WriteAllText(savePath, json, Encoding.UTF8);

        //Debug.Log("save:::" + savePath);
    }
示例#2
0
 public bool GetLine(int line, out TextPair pair)
 {
     if (line < m_Lines.Count)
     {
         pair = m_Lines[line];
     }
     pair = TextPair.empty;
     return(false);
 }
示例#3
0
        public NonBarcodePopup()
        {
            AutoScaleMode = AutoScaleMode.Font;
            ClientSize    = new Size((int)w, (int)h);
            Text          = @"Pattern Aç";
            Geometry.Rectangle v = new Geometry.Rectangle(w * 0.1f, w * 0.9f, 0f, h);


            for (var i = 0; i < _lineStrings.Count; i++)
            {
                var r   = v.SliceHorizontal((i + 1) / 12f, (i + 2) / 12f);
                var att = new TextPair(_lineStrings[i], _lineStrings[i], r);
                _lines.Add(att);
                att.Implement(Controls);
            }


            // buttons
            var buttonsRect = v.SliceHorizontal(0.9f, 0.95f);
            var conf        = new ModifiedButton("onay", "Onay");

            conf.Reorient(buttonsRect.SliceVertical(0.1f, 0.4f));
            conf.ClickAction = () =>
            {
                _confirmed = true;
                Close();
            };

            var exit = new ModifiedButton("çık", "Çık");

            exit.Reorient(buttonsRect.SliceVertical(0.6f, 0.9f));
            exit.ClickAction = Close;

            Controls.Add(conf);
            Controls.Add(exit);

            for (float i = 0; i < 3; i++)
            {
                var mrb = new ModifiedRadioButton("radio");
                mrb.Reorient(v.SliceHorizontal(0.8f, 0.9f).SliceVertical(i / 3f, (i + 1) / 3f));
                mrb.Text = $"Hücre {i + 1}";
                var i1 = i;
                mrb.ClickAction = () =>
                {
                    if (RobotNo == 0)
                    {
                        conf.Enabled = true;
                    }

                    RobotNo = (int)i1 + 1;
                };


                Controls.Add(mrb);
            }
        }
示例#4
0
 /// <summary>
 /// Writes the TextPair to the specified line. If 'autoAppend', then 'line' must be equal to current line count,
 /// or no appendage takes place.
 /// </summary>
 public void WriteLine(int line, TextPair text, bool autoAppend = false)
 {
     if (line < m_Lines.Count)
     {
         m_Lines[line] = text;
         // Mark Visuals Dirty
         columns[GetColumnIndex(line)].visualsDirty = true;
         m_VisualsDirty = true;
     }
     else if (autoAppend && line == m_Lines.Count)
     {
         Write(text);
     }
 }
示例#5
0
    void SavetoJson()
    {
        Debug.Log("saving value " + text_to_json.text + " to user.json");

        writejson obj = this.GetComponent <writejson>();

        TextPair textpair = new TextPair();

        textpair.name = text_to_json.text;
        textpair.type = "input";

        obj.SaveJson("user.json", textpair);

        TextPair status = loadjson.LoadJsonFromFile("user.json");

        Debug.Log(status.name);
    }
示例#6
0
    /// <summary>
    /// Append a new TextPair to internal lines.
    /// Returns true if successfully appended. False if line count is at 'maxLines'
    /// </summary>
    public bool Write(TextPair text)
    {
        // @TODO - Currently no Checking for text overflow (maxCharPerLine)
        int totalLines = m_Lines.Count + 1;
        int column     = GetColumnIndex(totalLines);

        if (column == -1)
        {
            return(false);
        }
        m_CurrentWriteColumn = column;
        m_Lines.Add(text);
        // Mark Visuals Dirty
        columns[m_CurrentWriteColumn].visualsDirty = true;
        m_VisualsDirty = true;

        return(true);
    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            writejson obj = this.GetComponent <writejson>();

            TextPair textpair = new TextPair();

            textpair.name = "oaishi";
            textpair.type = "input";

            obj.SaveJson("Test01.json", textpair);
        }

        if (Input.GetKeyDown(KeyCode.L))
        {
            TextPair status = loadjson.LoadJsonFromFile("Test01.json");
            //Debug.Log(status);
        }
    }
示例#8
0
 private void PrintHelp(TextPair text)
 {
     HelpTextBox.Text = text.Title + "\n\n" + text.Text;
 }