示例#1
0
 public void Start()
 {
     foreach (var mod in SRModLoader.GetMods())
     {
         AddModInfo(mod.ModInfo);
     }
 }
示例#2
0
        public override List <string> GetAutoComplete(int argIndex, string argText)
        {
            if (argIndex == 0)
            {
                return(SRModLoader.GetMods().Where(x => x.Configs.Count > 0).Select(x => x.ModInfo.Id).ToList());
            }

            var strs = ConsoleWindow.cmdText.Split(' ');

            var mod = SRModLoader.GetMod(strs[1]);

            if (argIndex == 1)
            {
                return(mod?.Configs.Select(x => x.FileName).ToList());
            }

            var config = mod?.Configs.FirstOrDefault(x => x.FileName.ToLower() == strs[2].ToLower());

            if (argIndex == 2)
            {
                return(config?.Sections.Select(x => x.Name).ToList());
            }

            var section = config?.Sections.FirstOrDefault(x => x.Name.ToLower() == strs[3].ToLower());

            if (argIndex == 3)
            {
                return(section?.Elements.Select(x => x.Options.Name).ToList());
            }



            return(base.GetAutoComplete(argIndex, argText));
        }
示例#3
0
        internal static void Pull(ModdedSaveData data)
        {
            Clear();
            foreach (var mod in data.segments)
            {
                Debug.Log($"mod {mod.modid} has {mod.extendedData.Count} extended actor datas");
                foreach (var extendedDataTree in mod.extendedData)
                {
                    switch (extendedDataTree.idType)
                    {
                    case ExtendedDataTree.IdentifierType.ACTOR:
                        var          identifier = DataIdentifier.GetActorIdentifier(extendedDataTree.longIdentifier);
                        PreparedData pdata;
                        if (!preparedData.TryGetValue(identifier, out pdata))
                        {
                            pdata = new PreparedData()
                            {
                                Data = new CompoundDataPiece("root"), SourceType = PreparedData.PreparationSource.SPAWN
                            };
                            preparedData[identifier] = pdata;
                        }
                        extendedDataTree.dataPiece.DataList.Do((x) => pdata.Data.GetCompoundPiece(mod.modid).DataList.Add(x));
                        break;

                    default:
                        throw new NotImplementedException();
                    }
                }
                var actualMod = SRModLoader.GetMod(mod.modid);
                if (actualMod == null)
                {
                    continue;
                }
                worldSaveData.Add(actualMod, mod.extendedWorldData);
                SaveRegistry.GetSaveInfo(actualMod).WorldDataPreLoad(mod.extendedWorldData);
            }
            foreach (var v in SRModLoader.GetMods())
            {
                if (!worldSaveData.ContainsKey(v))
                {
                    var newData = new CompoundDataPiece("root");
                    worldSaveData.Add(v, newData);
                    SaveRegistry.GetSaveInfo(v).WorldDataPreLoad(newData);
                }
            }
        }