Ejemplo n.º 1
0
        public void OpenValueSelecter(Arg arg)
        {
            CurrentArg = arg;
            IsLoadCmp  = false;
            DefaultPanel.Visibility      = Visibility.Collapsed;
            CodeSelecterPanel.Visibility = Visibility.Collapsed;
            StringTextBox.Visibility     = Visibility.Collapsed;
            ValueInput.Visibility        = Visibility.Collapsed;
            UPUS.Visibility = Visibility.Collapsed;
            SearchBox.Text  = "";


            TriggerManger tm = Global.WindowTool.triggerManger;

            if (tm.IsArgParseable(arg.ARGTYPE))
            {
                DefaultPanel.Visibility = Visibility.Visible;

                DefaultArgSelecter.Items.Clear();

                Dictionary <uint, string> args = tm.GetArgList(arg.ARGTYPE, true);

                uint[] keys = args.Keys.ToArray();
                for (int i = 0; i < keys.Length; i++)
                {
                    ListBoxItem listBoxItem = new ListBoxItem();
                    listBoxItem.Tag     = keys[i];
                    listBoxItem.Content = args[keys[i]];



                    DefaultArgSelecter.Items.Add(listBoxItem);
                    if (arg.IsInit)
                    {
                        DefaultArgSelecter.SelectedIndex = -1;
                    }
                    else
                    {
                        if (arg.VALUE == keys[i])
                        {
                            DefaultArgSelecter.SelectedItem = listBoxItem;
                            DefaultArgSelecter.ScrollIntoView(listBoxItem);
                        }
                    }
                }

                if (keys.Length > 10)
                {
                    SearchBoxDockPanel.Visibility = Visibility.Visible;
                }
                else
                {
                    SearchBoxDockPanel.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                switch (arg.ARGTYPE)
                {
                case TriggerManger.ArgType.UNIT:
                    CodeSelecterPanel.Visibility = Visibility.Visible;

                    if (arg.VALUE < 228)
                    {
                        UnitType.SelectedIndex  = 0;
                        CodeSelecter.Visibility = Visibility.Visible;
                        if (arg.IsInit)
                        {
                            CodeSelecter.SetIndex(-1);
                        }
                        else
                        {
                            CodeSelecter.SetIndex((int)arg.VALUE);
                        }
                    }
                    else
                    {
                        UnitType.SelectedIndex  = (int)(arg.VALUE - 228);
                        CodeSelecter.Visibility = Visibility.Collapsed;
                    }

                    break;

                case TriggerManger.ArgType.LOCATION:
                    DefaultPanel.Visibility       = Visibility.Visible;
                    SearchBoxDockPanel.Visibility = Visibility.Visible;
                    DefaultArgSelecter.Items.Clear();
                    for (int i = 1; i < mapEditor.mapdata.LocationDatas.Count; i++)
                    {
                        ListBoxItem listBoxItem = new ListBoxItem();
                        listBoxItem.Tag     = mapEditor.mapdata.LocationDatas[i];
                        listBoxItem.Content = mapEditor.mapdata.LocationDatas[i].STRING.String;


                        DefaultArgSelecter.Items.Add(listBoxItem);
                    }
                    DefaultArgSelecter.SelectedIndex = -1;
                    break;

                case TriggerManger.ArgType.WAV:
                    DefaultPanel.Visibility       = Visibility.Visible;
                    SearchBoxDockPanel.Visibility = Visibility.Visible;
                    DefaultArgSelecter.Items.Clear();
                    for (int i = 0; i < mapEditor.mapdata.WAV.Length; i++)
                    {
                        string d = mapEditor.mapdata.WAV[i].String;
                        if (mapEditor.mapdata.WAV[i].IsLoaded)
                        {
                            ListBoxItem listBoxItem = new ListBoxItem();
                            listBoxItem.Tag     = d;
                            listBoxItem.Content = d;

                            DefaultArgSelecter.Items.Add(listBoxItem);
                        }
                    }
                    DefaultArgSelecter.SelectedIndex = -1;
                    break;

                case TriggerManger.ArgType.SWITCH:
                    DefaultPanel.Visibility       = Visibility.Visible;
                    SearchBoxDockPanel.Visibility = Visibility.Visible;
                    DefaultArgSelecter.Items.Clear();
                    for (int i = 0; i < mapEditor.mapdata.SWNM.Length; i++)
                    {
                        ListBoxItem listBoxItem = new ListBoxItem();
                        listBoxItem.Tag = (uint)i;

                        string d = mapEditor.mapdata.SWNM[i].String;
                        if (mapEditor.mapdata.SWNM[i].IsLoaded)
                        {
                            listBoxItem.Content = d;
                        }
                        else
                        {
                            listBoxItem.Content = "스위치 " + (i + 1);
                        }



                        DefaultArgSelecter.Items.Add(listBoxItem);
                    }
                    DefaultArgSelecter.SelectedIndex = -1;

                    break;

                case TriggerManger.ArgType.STRING:
                    StringTextBox.Visibility = Visibility.Visible;
                    StringText.Text          = arg.STRING.String;
                    break;

                case TriggerManger.ArgType.OFFSET:
                    ValueInput.Visibility  = Visibility.Visible;
                    AllCheckBox.Visibility = Visibility.Collapsed;
                    ValueText.IsEnabled    = true;
                    ValueText.Text         = "0x" + arg.VALUE.ToString("X");
                    break;

                case TriggerManger.ArgType.VALUE:
                    ValueInput.Visibility  = Visibility.Visible;
                    AllCheckBox.Visibility = Visibility.Collapsed;
                    ValueText.IsEnabled    = true;
                    ValueText.Text         = arg.VALUE.ToString();
                    break;

                case TriggerManger.ArgType.COUNT:
                    ValueInput.Visibility  = Visibility.Visible;
                    AllCheckBox.Visibility = Visibility.Visible;
                    if (arg.VALUE == 0)
                    {
                        AllCheckBox.IsChecked = true;
                        ValueText.IsEnabled   = false;
                        ValueText.Text        = "0";
                    }
                    else
                    {
                        AllCheckBox.IsChecked = false;
                        ValueText.IsEnabled   = true;
                        ValueText.Text        = arg.VALUE.ToString();
                    }

                    break;

                case TriggerManger.ArgType.UPRP:
                    UPUS.Visibility      = Visibility.Visible;
                    HPTextbox.Text       = arg.UPRP.HITPOINT.ToString();
                    ShildTextbox.Text    = arg.UPRP.SHIELDPOINT.ToString();
                    EnergyTextbox.Text   = arg.UPRP.ENERGYPOINT.ToString();
                    ResourceTextbox.Text = arg.UPRP.RESOURCE.ToString();
                    HangerTextbox.Text   = arg.UPRP.HANGAR.ToString();

                    ushort status = arg.UPRP.STATUSFLAG;

                    ClackeCb.IsChecked = (status & (0b1 << 0)) > 0;
                    BurrowCb.IsChecked = (status & (0b1 << 1)) > 0;
                    LiftCb.IsChecked   = (status & (0b1 << 2)) > 0;
                    HallCb.IsChecked   = (status & (0b1 << 3)) > 0;
                    InviCb.IsChecked   = (status & (0b1 << 4)) > 0;


                    ushort pointval = arg.UPRP.POINTVALID;
                    HPDefault.IsChecked       = (pointval & (0b1 << 1)) > 0;
                    ShildDefault.IsChecked    = (pointval & (0b1 << 2)) > 0;
                    EnergyDefault.IsChecked   = (pointval & (0b1 << 3)) > 0;
                    ResourceDefault.IsChecked = (pointval & (0b1 << 4)) > 0;
                    HangerDefault.IsChecked   = (pointval & (0b1 << 5)) > 0;


                    ushort statusval = arg.UPRP.STATUSVALID;
                    Clackefault.IsChecked   = (statusval & (0b1 << 0)) > 0;
                    BurrowDefault.IsChecked = (statusval & (0b1 << 1)) > 0;
                    LiftDefault.IsChecked   = (statusval & (0b1 << 2)) > 0;
                    HallDefault.IsChecked   = (statusval & (0b1 << 3)) > 0;
                    InviDefault.IsChecked   = (statusval & (0b1 << 4)) > 0;

                    break;
                }
            }

            IsLoadCmp = true;
        }
Ejemplo n.º 2
0
 public void SetMapEditor(MapEditor mapEditor)
 {
     this.mapEditor = mapEditor;
     CodeSelecter.SetCodeType(Data.Map.MapData.Codetype.Unit, mapEditor, true);
 }