Пример #1
0
        public void ConvertToDialogueCode()
        {
            DialogueCodes.Clear();
            foreach (var inst in Instructions)
            {
                var code = new DialogueCode();
                switch (_game)
                {
                case Game.DateALiveRioReincarnation:
                    switch (inst.Name)
                    {
                    case "MesTitle":
                        byte titleID = inst.GetArgument <byte>(0);
                        code.Type = "Title";
                        code.ID   = string.Format("0x{0:X2}", titleID);
                        if (_database != null)
                        {
                            code.Text = titleID == 0xFF
                                        ? "None"
                                        : _database.Characters.FirstOrDefault(t => t.ID == titleID)?.FriendlyName;
                        }
                        else
                        {
                            code.Text = titleID == 0xFF ? "None" : titleID.ToString();
                        }
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x00, 0x80));
                        break;

                    case "PlayVoice":
                        code.Type  = "Voice";
                        code.ID    = inst.GetArgument <string>(2);
                        code.Text  = inst.GetArgument <string>(2);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x80, 0x80));
                        break;

                    case "Mes":
                        code.Type  = "Msg";
                        code.ID    = inst.GetArgument <short>(3).ToString();
                        code.Text  = inst.GetArgument <string>(2);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x80, 0x00));
                        break;

                    case "FileJump":
                        code.Type  = "Script";
                        code.ID    = inst.GetArgument <string>(0);
                        code.Text  = inst.GetArgument <string>(0);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x80, 0x00, 0x00));
                        break;

                    case "SetChoice":
                        code.Type  = "Choice";
                        code.ID    = inst.GetArgument <string>(0);
                        code.Text  = inst.GetArgument <string>(1);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x80, 0x80, 0x00));
                        break;

                    case "MapPlace":
                        code.Type  = "Map";
                        code.ID    = inst.GetArgument <string>(0);
                        code.Text  = inst.GetArgument <string>(1);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x80, 0x80, 0x80));
                        break;

                    case "EnableMonologue":
                        byte mode = inst.GetArgument <byte>(0);
                        code.Type  = "Monologue";
                        code.ID    = inst.GetArgument <string>(0);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x80, 0x80, 0x40));
                        switch (mode)
                        {
                        case 0:
                            code.Text = "0: Hidden";
                            break;

                        case 1:
                            code.Text = "1: Show";
                            break;

                        case 2:
                            code.Text = "2: Unknown";
                            break;

                        default:
                            code.Text = mode + ": Unknown, Please report";
                            break;
                        }

                        break;

                    default:
                        continue;
                    }
                    break;

                case Game.PsychedelicaOfTheBlackButterfly:
                    switch (inst.Name)
                    {
                    case "Name":
                        int index = Instructions.IndexOf(inst);
                        if (Instructions.Count > index &&
                            (Instructions[index + 1].Name == "Message" ||
                             Instructions[index + 1].Name == "MessageVoice"))
                        {
                            code.Type  = "Name";
                            code.ID    = inst.GetArgument <string>(0);
                            code.Text  = inst.GetArgument <string>(0);
                            code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x00, 0x80));
                            break;
                        }
                        continue;

                    case "MessageVoice":
                        code.Type  = "Voice";
                        code.ID    = inst.GetArgument <string>(0);
                        code.Text  = inst.GetArgument <string>(0);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x80, 0x80));
                        break;

                    case "Message":
                        code.Type  = "Msg";
                        code.ID    = inst.GetArgument <short>(3).ToString();
                        code.Text  = inst.GetArgument <string>(2);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x80, 0x00));
                        break;

                    case "FileJump":
                        code.Type  = "Script";
                        code.ID    = inst.GetArgument <string>(0);
                        code.Text  = inst.GetArgument <string>(0);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x80, 0x00, 0x00));
                        break;

                    case "Choice":
                        code.Type  = "Choice";
                        code.ID    = inst.GetArgument <string>(0);
                        code.Text  = inst.GetArgument <string>(1);
                        code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x80, 0x80, 0x00));
                        break;

                    default:
                        continue;
                    }
                    break;
                }

                code.Index = Instructions.IndexOf(inst);
                DialogueCodes.Add(code);
            }
        }
Пример #2
0
        public void ConvertToDialogueCode()
        {
            DialogueCodes.Clear();
            foreach (var inst in Instructions)
            {
                var code = new DialogueCode();
                switch (inst.Name)
                {
                case "MesTitle":
                    byte titleID = inst.GetArgument <byte>(0);
                    code.Type = "Title";
                    code.ID   = string.Format("0x{0:X2}", titleID);
                    if (_database != null)
                    {
                        code.Text = titleID == 0xFF ? "None" : _database.Characters.FirstOrDefault(t => t.ID == titleID)?.FriendlyName;
                    }
                    else
                    {
                        code.Text = titleID == 0xFF ? "None" : titleID.ToString();
                    }
                    code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x00, 0x80));
                    break;

                case "PlayVoice":
                    code.Type  = "Voice";
                    code.ID    = inst.GetArgument <string>(2);
                    code.Text  = inst.GetArgument <string>(2);
                    code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x80, 0x80));
                    break;

                case "Mes":
                    code.Type  = "Msg";
                    code.ID    = inst.GetArgument <short>(3).ToString();
                    code.Text  = inst.GetArgument <string>(2);
                    code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x00, 0x80, 0x00));
                    break;

                case "FileJump":
                    code.Type  = "Script";
                    code.ID    = inst.GetArgument <string>(0);
                    code.Text  = inst.GetArgument <string>(0);
                    code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x80, 0x00, 0x00));
                    break;

                case "SetChoice":
                    code.Type  = "Opt";
                    code.ID    = inst.GetArgument <string>(0);
                    code.Text  = inst.GetArgument <string>(1);
                    code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x80, 0x80, 0x00));
                    break;

                case "MapPlace":
                    code.Type  = "Map";
                    code.ID    = inst.GetArgument <string>(0);
                    code.Text  = inst.GetArgument <string>(1);
                    code.Brush = new SolidColorBrush(Color.FromArgb(0x30, 0x80, 0x80, 0x80));
                    break;

                default:
                    continue;
                }
                code.Index = Instructions.IndexOf(inst);
                DialogueCodes.Add(code);
            }
        }