Ejemplo n.º 1
0
 private void OnSelected(object sender, RoutedEventArgs e)
 {
     if (sender is RadioButton btn)
     {
         PossibleSelection selection = btn.DataContext as PossibleSelection;
         this.selection.UseGameTarget    = false;
         this.selection.CurrentSelection = selection;
     }
 }
Ejemplo n.º 2
0
        private void OnSelected(object sender, RoutedEventArgs e)
        {
            if (this.lockSelection)
            {
                return;
            }

            if (sender is RadioButton btn)
            {
                PossibleSelection selection = btn.DataContext as PossibleSelection;
                this.Actor = selection;

                this.Close?.Invoke();
            }
        }
Ejemplo n.º 3
0
        private void GetEntities()
        {
            try
            {
                this.lockSelection = true;
                Actor.Modes      mode = this.selection.GetMode();
                ActorTableOffset actorTableOffset;
                BaseOffset       targetOffset;

                // clear the entity list
                this.Entities.Clear();

                if (mode == Actor.Modes.GPose)
                {
                    actorTableOffset = Offsets.Main.GposeActorTable;
                    targetOffset     = Offsets.Main.Gpose;
                }
                else if (mode == Actor.Modes.Overworld)
                {
                    actorTableOffset = Offsets.Main.ActorTable;
                    targetOffset     = Offsets.Main.Target;
                }
                else
                {
                    throw new Exception("Unknown selection mode: " + mode);
                }

                byte             count = actorTableOffset.GetCount();
                HashSet <string> ids   = new HashSet <string>();

                for (byte i = 0; i < count; i++)
                {
                    ActorTypes type = actorTableOffset.GetActorValue(i, Offsets.Main.ActorType);
                    string     name = actorTableOffset.GetActorValue(i, Offsets.Main.Name);

                    string id = SelectionService.GetActorId(mode, type, name);

                    if (ids.Contains(id))
                    {
                        continue;
                    }

                    ids.Add(id);

                    if (string.IsNullOrEmpty(name))
                    {
                        name = "Unknown";
                    }

                    PossibleSelection selection = new PossibleSelection(type, actorTableOffset.GetBaseOffset(i), id, name, mode);
                    this.Entities.Add(selection);
                }

                if (this.selection.CurrentGameTarget != null)
                {
                    this.InGameSelection = this.selection.CurrentGameTarget.Name;
                    this.InGameIcon      = this.selection.CurrentGameTarget.Type.GetIcon();
                }
                else
                {
                    this.InGameSelection = null;
                    this.InGameIcon      = IconChar.None;
                }

                this.lockSelection = false;
            }
            catch (Exception ex)
            {
                Log.Write(ex);
            }
        }
Ejemplo n.º 4
0
        private void GetEntities()
        {
            try
            {
                Selection.Modes  mode = this.selection.GetMode();
                ActorTableOffset actorTableOffset;
                BaseOffset       targetOffset;

                // clear the entity list
                this.Entities.Clear();

                if (mode == Selection.Modes.GPose)
                {
                    actorTableOffset = Offsets.GposeActorTable;
                    targetOffset     = Offsets.Gpose;
                }
                else if (mode == Selection.Modes.Overworld)
                {
                    actorTableOffset = Offsets.ActorTable;
                    targetOffset     = Offsets.Target;
                }
                else
                {
                    throw new Exception("Unknown selection mode: " + mode);
                }

                byte             count = actorTableOffset.GetCount();
                HashSet <string> ids   = new HashSet <string>();

                for (byte i = 0; i < count; i++)
                {
                    ActorTypes type = actorTableOffset.GetActorValue(i, Offsets.ActorType);
                    string     name = actorTableOffset.GetActorValue(i, Offsets.Name);

                    string id = mode.ToString() + "_" + type + "_" + name;

                    if (ids.Contains(id))
                    {
                        continue;
                    }

                    ids.Add(id);

                    if (string.IsNullOrEmpty(name))
                    {
                        name = "Unknown";
                    }

                    PossibleSelection selection = new PossibleSelection(type, targetOffset, id, name, mode);
                    selection.IsSelected = !this.selection.UseGameTarget && this.selection.CurrentSelection != null && this.selection.CurrentSelection.Name == name;
                    this.Entities.Add(selection);
                }

                this.AutoRadio.IsChecked = this.selection.UseGameTarget;

                if (this.selection.CurrentGameTarget != null)
                {
                    this.InGameSelection = this.selection.CurrentGameTarget.Name;
                    this.InGameIcon      = this.selection.CurrentGameTarget.Type.GetIcon();
                }
                else
                {
                    this.InGameSelection = null;
                    this.InGameIcon      = IconChar.None;
                }
            }
            catch (Exception ex)
            {
                Log.Write(ex);
            }
        }