public SplitEventEditor(IEventVar <T> block, IEnumerable <string> work, IEnumerable <string> flag)
    {
        Block = block;
        // load lines
        var workLines = work.Where(z => !string.IsNullOrWhiteSpace(z) && z.Length > 5);

        Work = EventWorkUtil.GetVars(workLines, (index, t, data) => new EventWork <T>(index, t, data));
        var flagLines = flag.Where(z => !string.IsNullOrWhiteSpace(z) && z.Length > 5);

        Flag = EventWorkUtil.GetVars(flagLines, (index, t, data) => new EventFlag(index, t, data));

        // initialize lines
        foreach (var group in Work)
        {
            foreach (var item in group.Vars)
            {
                item.RawIndex = block.GetWorkRawIndex(item.Type, item.RelativeIndex);
                ((EventWork <T>)item).Value = block.GetWork(item.RawIndex);
            }
        }
        foreach (var group in Flag)
        {
            foreach (var item in group.Vars)
            {
                item.RawIndex          = block.GetFlagRawIndex(item.Type, item.RelativeIndex);
                ((EventFlag)item).Flag = block.GetFlag(item.RawIndex);
            }
        }
    }
Beispiel #2
0
    public SAV_EventWork(SAV7b sav)
    {
        InitializeComponent();

        WinFormsUtil.TranslateInterface(this, Main.CurrentLanguage);

        SAV    = sav.Blocks.EventWork;
        Origin = sav;

        DragEnter += Main_DragEnter;
        DragDrop  += Main_DragDrop;

        CB_Stats.Items.Clear();
        for (int i = 0; i < SAV.CountWork; i++)
        {
            CB_Stats.Items.Add(i.ToString());
        }

        var work = GetStringList(sav.Version, "const");
        var flag = GetStringList(sav.Version, "flags");

        Editor = new SplitEventEditor <int>(SAV, work, flag);

        SuspendLayout();
        editing = true;
        LoadFlags(Editor.Flag);
        LoadWork(Editor.Work);
        editing = false;
        ResumeLayout();

        if (CB_Stats.Items.Count > 0)
        {
            CB_Stats.SelectedIndex = 0;
        }
        else
        {
            L_Stats.Visible = CB_Stats.Visible = NUD_Stat.Visible = false;
            TC_Features.TabPages.Remove(GB_Constants);
        }
        NUD_Flag.Maximum     = SAV.CountFlag - 1;
        NUD_Flag.Text        = "0";
        c_CustomFlag.Checked = SAV.GetFlag(0);

        Text = $"{Text} ({sav.Version})";
    }
Beispiel #3
0
 private void ChangeCustomFlag(object sender, EventArgs e)
 {
     c_CustomFlag.Checked = SAV.GetFlag((int)NUD_Flag.Value);
 }