Beispiel #1
0
        async void Init(string _path, Stream _stream)
        {
            Lbl_RulePath.Text = $"Rule文件路径:{_path}";
            battleRec         = new BattleREC(_path, _stream);
            await Task.Delay(1000);

            this.Sel_BtfToolStripMenuItem.Enabled = true;
            RTB_RulePage.Text = BattleREC.rule.content;
        }
Beispiel #2
0
        private void OFDBtf_FileOk(object sender, CancelEventArgs e)
        {
            if (ofd_Btf.CheckFileExists)
            {
                var _btfPage = new System.Windows.Forms.TabPage();
                _btfPage.Location = new System.Drawing.Point(4, 22);
                _btfPage.Name     = ofd_Btf.FileName;
                _btfPage.Padding  = new System.Windows.Forms.Padding(3);
                _btfPage.Size     = new System.Drawing.Size(792, 373);
                _btfPage.Text     = ofd_Btf.SafeFileName;
                _btfPage.UseVisualStyleBackColor = true;
                _btfPage.ContextMenuStrip        = new ContextMenuStrip();
                _btfPage.ToolTipText             = _btfPage.Name;

                var _closeToolStripItem = new ToolStripMenuItem();
                _closeToolStripItem.Name   = "_closeToolStripItem";
                _closeToolStripItem.Size   = new System.Drawing.Size(180, 22);
                _closeToolStripItem.Text   = "关闭";
                _closeToolStripItem.Click += new EventHandler(OnBtfCloseClick);

                _btfPage.ContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { _closeToolStripItem });
                _btfPage.ContextMenuStrip.Name = "_btfPageContextMenu";
                _btfPage.ContextMenuStrip.Size = new System.Drawing.Size(181, 48);

                var _RTB_BtfPage = new System.Windows.Forms.RichTextBox();
                _RTB_BtfPage.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                             | System.Windows.Forms.AnchorStyles.Left)
                                                                            | System.Windows.Forms.AnchorStyles.Right)));
                _RTB_BtfPage.Location         = new System.Drawing.Point(0, 0);
                _RTB_BtfPage.Name             = "RTB_RulePage";
                _RTB_BtfPage.Size             = new System.Drawing.Size(792, 373);
                _RTB_BtfPage.TabIndex         = 0;
                _RTB_BtfPage.Text             = "";
                _RTB_BtfPage.ReadOnly         = true;
                _RTB_BtfPage.BackColor        = Color.White;
                _RTB_BtfPage.ContextMenuStrip = _btfPage.ContextMenuStrip;

                _btfPage.Controls.Add(_RTB_BtfPage);
                if (btfPageDic.TryGetValue(ofd_Btf.FileName, out var _page))
                {
                    tableCtrl.Controls.Remove(_page);
                    btfPageDic[ofd_Btf.FileName] = _btfPage;
                }
                else
                {
                    btfPageDic.Add(_btfPage.Name, _btfPage);
                }
                tableCtrl.Controls.Add(_btfPage);
                _btfPage.Show();

                var _stream = ofd_Btf.OpenFile();
                var _btf    = Loader.LoadBtfFile(_stream);
                this.Sel_BtfToolStripMenuItem.Enabled = true;
                _RTB_BtfPage.Text = BattleREC.ShowRec(_btf);
            }
        }
Beispiel #3
0
    void Read()
    {
        string _path = Application.streamingAssetsPath + "/rec.btf";

        using (var _fs = new FileStream(_path, FileMode.Open, FileAccess.Read))
        {
            BinaryFormatter _bf    = new BinaryFormatter();
            var             _cache = _bf.Deserialize(_fs) as CacheFile;

            var _str = BattleREC.ShowRec(_cache);
            Debug.Log($"Recorder: {_str}");

            _fs.Close();
        }
    }
Beispiel #4
0
    void Start()
    {
        _rec = new BattleREC(Application.streamingAssetsPath + "/Rule.json");

        Test();
    }