예제 #1
0
 public void InteriorSet()
 {
     if (!this.masterMake)
     {
         this.backNo = this.save.ValList[13];
         this.back   = BackgroundBase.BackMake(this.backNo);
         for (int index = 0; index < this.Events.Count; ++index)
         {
             if (this.Events[index].ID.Contains("InteriorItem"))
             {
                 this.masterList.Add(this.Events[index]);
             }
         }
         this.masterMake = true;
     }
     this.Events.RemoveAll(i => i.ID.Contains("InteriorItem"));
     foreach (Interior interior in this.save.interiors)
     {
         Interior i = interior;
         if (i.set)
         {
             MapEventBase     mapEventBase1 = this.masterList.Find(iv => iv.ID.Contains($"InteriorItem{i.number + 1}"));
             MapEventBase     mapEventBase2 = new MapEventBase(this.sound, this.parent, new Point(i.posiX, i.posiY), 0, MapCharacterBase.ANGLE.DOWN, this, mapEventBase1.ID, this.save, "");
             List <EventPage> eventPageList = new List <EventPage>();
             foreach (EventPage eventPage1 in mapEventBase1.eventPages)
             {
                 EventPage eventPage2 = eventPage1.Clone(mapEventBase2);
                 if (i.rebirth)
                 {
                     eventPage2.Rebirth();
                 }
                 eventPageList.Add(eventPage2);
             }
             EventPage[] array = eventPageList.ToArray();
             mapEventBase2.eventPages = array;
             foreach (EventPage eventPage in mapEventBase2.eventPages)
             {
                 eventPage.ParentSet(mapEventBase2);
             }
             this.Events.Add(mapEventBase2);
         }
     }
 }
예제 #2
0
 public void SetBack(int number)
 {
     this.back = BackgroundBase.BackMake(number);
 }
예제 #3
0
        private static void InitializeGameData()
        {
            var totalDataToLoad = (double)(LoadingWindowViewModel.Settings.EnemyCount + LoadingWindowViewModel.Settings.ChipCount + LoadingWindowViewModel.Settings.AddOnCount + LoadingWindowViewModel.Settings.InteriorCount + LoadingWindowViewModel.Settings.BackgroundCount);
            var dataLoaded      = 0;

            // Prints multiple NullReferenceExceptions as EnemyBase in ShanghaiEXE has undefined ids caught in the game code
            Constants.BaseEnemyDefinitions = new Dictionary <int, EnemyDefinition>();
            for (int enemyID = 0; enemyID < LoadingWindowViewModel.Settings.EnemyCount; enemyID++)
            {
                Constants.BaseEnemyDefinitions[enemyID] = EnemyDefinition.GetEnemyDefinition(enemyID, 0, 0, 1);
                dataLoaded++;
                Constants.ConstantsLoadProgressEventUpdated?.Invoke(null, new ConstantsLoadProgressEventUpdatedEventArgs("Data: Enemy: ", dataLoaded / totalDataToLoad));
            }

            Constants.ChipDefinitions = new Dictionary <int, ChipDefinition>();
            for (int chipID = 0; chipID < LoadingWindowViewModel.Settings.ChipCount; chipID++)
            {
                var chipDefinition = ChipDefinition.GetChipDefinition(chipID);
                if (chipDefinition != null)
                {
                    Constants.ChipDefinitions[chipID] = chipDefinition;
                }
                dataLoaded++;
                Constants.ConstantsLoadProgressEventUpdated?.Invoke(null, new ConstantsLoadProgressEventUpdatedEventArgs("Data: Chip: ", dataLoaded / totalDataToLoad));
            }

            Constants.AddOnDefinitions = new Dictionary <int, AddOnDefinition>();
            for (int addOnID = 0; addOnID < LoadingWindowViewModel.Settings.AddOnCount; addOnID++)
            {
                var addOnDefiniton = AddOnDefinition.GetAddOnDefinition(addOnID);
                if (addOnDefiniton != null)
                {
                    Constants.AddOnDefinitions[addOnID] = addOnDefiniton;
                }
                dataLoaded++;
                Constants.ConstantsLoadProgressEventUpdated?.Invoke(null, new ConstantsLoadProgressEventUpdatedEventArgs("Data: AddOn: ", dataLoaded / totalDataToLoad));
            }

            Constants.InteriorDefinitions = new Dictionary <int, string>();
            for (int interiorID = 0; interiorID < LoadingWindowViewModel.Settings.InteriorCount; interiorID++)
            {
                var interiorKey = $"Interior.Item{interiorID + 1}";
                if (Constants.TranslationService.CanTranslate(interiorKey))
                {
                    Constants.InteriorDefinitions[interiorID] = Constants.TranslationService.Translate(interiorKey).Text;
                }
                dataLoaded++;
                Constants.ConstantsLoadProgressEventUpdated?.Invoke(null, new ConstantsLoadProgressEventUpdatedEventArgs("Data: Interior: ", dataLoaded / totalDataToLoad));
            }

            Constants.BackgroundDefinitions = new Dictionary <int, BackgroundDefinition>();
            for (int i = 0; i < LoadingWindowViewModel.Settings.BackgroundCount; i++)
            {
                Constants.BackgroundDefinitions[i] = new BackgroundDefinition(BackgroundBase.BackMake(i));
                dataLoaded++;
                Constants.ConstantsLoadProgressEventUpdated?.Invoke(null, new ConstantsLoadProgressEventUpdatedEventArgs("Data: Background: ", dataLoaded / totalDataToLoad));
            }

            CharacterInfo.LoadCharacterInfo(out FloatingCharacters, out NoShadowCharacters);

            var keyItemDoc = new XmlDocument();

            keyItemDoc.Load($"data/data/KeyItems.xml");
            var keyItemDefintions = Constants.LoadKeyItems(keyItemDoc);

            Constants.KeyItemDefinitions = new ObservableConcurrentDictionary <int, KeyItemDefinition>();
            foreach (var kvp in keyItemDefintions)
            {
                Constants.KeyItemDefinitions.Add(kvp.Key, kvp.Value);
            }

            var mailDoc = new XmlDocument();

            mailDoc.Load($"data/data/Mail.xml");
            var mailDefinitions = Constants.LoadMail(mailDoc);

            Constants.MailDefinitions = new ObservableConcurrentDictionary <int, MailDefinition>();
            foreach (var kvp in mailDefinitions)
            {
                Constants.MailDefinitions.Add(kvp.Key, kvp.Value);
            }
        }
예제 #4
0
        public MapField(IAudioEngine s, string txtname, SaveData save, SceneMap p)
            : base(s)
        {
            this.save   = save;
            this.parent = p;
            this.parent.parent.KeepActiveTexList.RemoveAll(e => !e.Contains(txtname));
            this.parent.parent.TexClear(false);
            this.mapname = txtname;
            save.nowMap  = txtname;
            string path = NSGame.Debug.MaskMapFile ? "data/" + txtname + ".she" : "map/" + txtname + ".txt";

            if (!File.Exists(path))
            {
                return;
            }
            StreamReader reader = new StreamReader(path, Encoding.GetEncoding("Shift_JIS"));
            string       A1     = reader.ReadLine();

            if (NSGame.Debug.MaskMapFile)
            {
                A1 = TCDEncodeDecode.EncMapScript(A1);
            }
            string[] strArray1 = A1.Split(',');
            int      length1   = int.Parse(strArray1[0]);
            int      length2   = int.Parse(strArray1[1]);
            int      length3   = int.Parse(strArray1[8]);

            this.rendX         = int.Parse(strArray1[2]);
            this.rendY         = int.Parse(strArray1[3]);
            this.rect          = new Rectangle(0, 0, int.Parse(strArray1[4]), int.Parse(strArray1[5]));
            save.plase         = ShanghaiEXE.Translate(strArray1[6]);
            this.height        = int.Parse(strArray1[7]);
            this.map           = new UnboundedMap(new byte[length3, length1, length2]);
            this.backNo        = int.Parse(strArray1[9]);
            this.back          = BackgroundBase.BackMake(this.backNo);
            this.encountCap[0] = int.Parse(strArray1[10]);
            this.encountCap[1] = int.Parse(strArray1[11]);
            string str1 = strArray1[12];

            this.graphicName = new string[length3 + (length3 - 1)];
            for (int index = 0; index < ((IEnumerable <string>) this.graphicName).Count <string>(); ++index)
            {
                this.graphicName[index] = str1 + (index + 1).ToString();
            }
            string str2;

            for (int index1 = 0; index1 < this.map.GetLength(0); ++index1)
            {
                for (int index2 = 0; index2 < this.map.GetLength(2); ++index2)
                {
                    string A2 = reader.ReadLine();
                    if (NSGame.Debug.MaskMapFile)
                    {
                        A2 = TCDEncodeDecode.EncMapScript(A2);
                    }
                    string[] strArray2 = A2.Split(',');
                    for (int index3 = 0; index3 < this.map.GetLength(1); ++index3)
                    {
                        this.map[index1, index3, index2] = 0;
                        this.map[index1, index3, index2] = byte.Parse(strArray2[index3]);
                    }
                }
                string A3 = reader.ReadLine();
                if (NSGame.Debug.MaskMapFile)
                {
                    str2 = TCDEncodeDecode.EncMapScript(A3);
                }
            }
            this.encounts.Clear();
            string A4;

            while ((A4 = reader.ReadLine()) != "")
            {
                if (NSGame.Debug.MaskMapFile)
                {
                    A4 = TCDEncodeDecode.EncMapScript(A4);
                }
                if (!(A4 == ""))
                {
                    EventManager m         = new EventManager(this.sound);
                    string[]     strArray2 = A4.Split(':');
                    m.AddEvent(new BgmSave(this.sound, m, this, save));
                    Battle battle;
                    if (strArray2.Length >= 20)
                    {
                        battle = new NSEvent.Battle(this.sound,
                                                    m,
                                                    int.Parse(strArray2[1]),
                                                    byte.Parse(strArray2[2]),
                                                    int.Parse(strArray2[3]),
                                                    int.Parse(strArray2[4]),
                                                    int.Parse(strArray2[5]),
                                                    int.Parse(strArray2[6]),
                                                    int.Parse(strArray2[7]),
                                                    int.Parse(strArray2[8]),
                                                    ShanghaiEXE.Translate(strArray2[9]),
                                                    int.Parse(strArray2[10]),
                                                    byte.Parse(strArray2[11]),
                                                    int.Parse(strArray2[12]),
                                                    int.Parse(strArray2[13]),
                                                    int.Parse(strArray2[14]),
                                                    int.Parse(strArray2[15]),
                                                    int.Parse(strArray2[16]),
                                                    int.Parse(strArray2[17]),
                                                    ShanghaiEXE.Translate(strArray2[18]),
                                                    int.Parse(strArray2[19]),
                                                    byte.Parse(strArray2[20]),
                                                    int.Parse(strArray2[21]),
                                                    int.Parse(strArray2[22]),
                                                    int.Parse(strArray2[23]),
                                                    int.Parse(strArray2[24]),
                                                    int.Parse(strArray2[25]),
                                                    int.Parse(strArray2[26]),
                                                    ShanghaiEXE.Translate(strArray2[27]),
                                                    (Panel.PANEL) int.Parse(strArray2[28]),
                                                    (Panel.PANEL) int.Parse(strArray2[29]),
                                                    int.Parse(strArray2[30]),
                                                    bool.Parse(strArray2[31]),
                                                    bool.Parse(strArray2[32]),
                                                    bool.Parse(strArray2[33]),
                                                    bool.Parse(strArray2[34]),
                                                    strArray2[35],
                                                    this.backNo,
                                                    save);
                    }
                    else
                    {
                        battle = new NSEvent.Battle(this.sound,
                                                    m,
                                                    (EnemyBase.VIRUS)Enum.Parse(typeof(EnemyBase.VIRUS), strArray2[1]),
                                                    byte.Parse(strArray2[2]),
                                                    int.Parse(strArray2[3]),
                                                    int.Parse(strArray2[4]),
                                                    (EnemyBase.VIRUS)Enum.Parse(typeof(EnemyBase.VIRUS), strArray2[5]),
                                                    byte.Parse(strArray2[6]),
                                                    int.Parse(strArray2[7]),
                                                    int.Parse(strArray2[8]),
                                                    (EnemyBase.VIRUS)Enum.Parse(typeof(EnemyBase.VIRUS), strArray2[9]),
                                                    byte.Parse(strArray2[10]),
                                                    int.Parse(strArray2[11]),
                                                    int.Parse(strArray2[12]),
                                                    (Panel.PANEL)Enum.Parse(typeof(Panel.PANEL), strArray2[13]),
                                                    (Panel.PANEL)Enum.Parse(typeof(Panel.PANEL), strArray2[14]),
                                                    int.Parse(strArray2[15]),
                                                    bool.Parse(strArray2[16]),
                                                    bool.Parse(strArray2[17]),
                                                    bool.Parse(strArray2[18]),
                                                    save);
                    }
                    m.AddEvent(battle);
                    m.AddEvent(new BgmLoad(this.sound, m, this, save));
                    m.AddEvent(new Fade(this.sound, m, 17, 0, 0, 0, 0, false, save));
                    this.encounts.Add(m);
                }
                else
                {
                    break;
                }
            }
            string A5 = reader.ReadLine();

            if (NSGame.Debug.MaskMapFile)
            {
                A5 = TCDEncodeDecode.EncMapScript(A5);
            }
            string[]             strArray3         = A5.Split(':');
            List <RandomMystery> randomMysteryList = new List <RandomMystery>();

            foreach (string str3 in strArray3)
            {
                if (str3 == "")
                {
                    break;
                }
                if (str3 == "random")
                {
                    continue;
                }
                string[] strArray2 = str3.Split(',');
                randomMysteryList.Add(new RandomMystery()
                {
                    itemType   = int.Parse(strArray2[0]),
                    itemNumber = int.Parse(strArray2[1]),
                    itemSub    = int.Parse(strArray2[2]),
                    getInfo    = ShanghaiEXE.Translate(strArray2[3])
                });
            }
            this.randomMystery = randomMysteryList.ToArray();
            string A6 = reader.ReadLine();

            if (NSGame.Debug.MaskMapFile)
            {
                str2 = TCDEncodeDecode.EncMapScript(A6);
            }
            var    eventIndex = 0;
            string A7;

            while ((A7 = reader.ReadLine()) != null)
            {
                if (NSGame.Debug.MaskMapFile)
                {
                    A7 = TCDEncodeDecode.EncMapScript(A7);
                }
                string[] strArray2 = A7.Split(':');
                if (strArray2[0] == "ID")
                {
                    string id = strArray2[1];
                    string A2 = reader.ReadLine();
                    if (NSGame.Debug.MaskMapFile)
                    {
                        A2 = TCDEncodeDecode.EncMapScript(A2);
                    }
                    string[] strArray4 = A2.Split(':');
                    Point    po        = new Point(int.Parse(strArray4[1]), int.Parse(strArray4[2]));
                    var      mapEvent  = new MapEventBase(s, this.parent, po, int.Parse(strArray4[3]), MapCharacterBase.ANGLE.UP, this, id, save, reader, this.mapname);
                    mapEvent.index = eventIndex;
                    this.Events.Add(mapEvent);
                }
                else
                {
                    string id = strArray2[1];
                    string A2 = reader.ReadLine();
                    if (NSGame.Debug.MaskMapFile)
                    {
                        A2 = TCDEncodeDecode.EncMapScript(A2);
                    }
                    string[]      strArray4 = A2.Split(':');
                    Point         po        = new Point(int.Parse(strArray4[1]), int.Parse(strArray4[2]));
                    int           floor     = int.Parse(strArray4[3]);
                    RandomMystery random    = new RandomMystery();
                    string        A3        = reader.ReadLine();
                    if (NSGame.Debug.MaskMapFile)
                    {
                        A3 = TCDEncodeDecode.EncMapScript(A3);
                    }
                    string[] strArray5 = A3.Split(':')[1].Split(',');
                    random.type       = int.Parse(strArray5[0]);
                    random.itemType   = int.Parse(strArray5[1]);
                    random.itemNumber = int.Parse(strArray5[2]);
                    random.itemSub    = int.Parse(strArray5[3]);
                    random.getInfo    = ShanghaiEXE.Translate(strArray5[4]);
                    random.flugNumber = int.Parse(strArray5[5]);
                    var mysteryData = new MysteryData(s, this.parent, po, floor, MapCharacterBase.ANGLE.UP, this, id, save, reader, random);
                    mysteryData.index = eventIndex;
                    this.Events.Add(mysteryData);
                }
                eventIndex++;
            }
            reader.Close();
            this.threadEnd = false;
            this.MapTexLoad();
            this.threadTexRead = new Thread(new ThreadStart(this.MapTexLoad));
            this.threadTexRead.Start();
            this.parent.eventmanagerParallel.events.Clear();
            this.parent.eventmanagerParallel.playevent = false;
        }