コード例 #1
0
 internal static void InitializeQueuedItemMap(
     GameSession game,
     StationInfo station,
     Dictionary <ModuleEnums.StationModuleType, int> queuedItemMap)
 {
     queuedItemMap.Clear();
     foreach (StationModules.StationModule uniqueStationModule in StationModuleQueue.EnumerateUniqueStationModules(game, station))
     {
         queuedItemMap.Add(uniqueStationModule.SMType, 0);
     }
 }
コード例 #2
0
        internal static void ConfirmStationQueuedItems(
            GameSession game,
            StationInfo station,
            Dictionary <ModuleEnums.StationModuleType, int> queuedItemMap)
        {
            List <LogicalModuleMount> stationModuleMounts = game.GetAvailableStationModuleMounts(station);

            foreach (KeyValuePair <ModuleEnums.StationModuleType, int> keyValuePair in queuedItemMap.ToList <KeyValuePair <ModuleEnums.StationModuleType, int> >())
            {
                KeyValuePair <ModuleEnums.StationModuleType, int> thing = keyValuePair;
                int num = thing.Value;
                while (num > 0)
                {
                    List <DesignModuleInfo>   list1   = game.GameDatabase.GetQueuedStationModules(station.DesignInfo.DesignSections[0]).ToList <DesignModuleInfo>();
                    List <DesignModuleInfo>   modules = station.DesignInfo.DesignSections[0].Modules;
                    List <LogicalModuleMount> list2   = stationModuleMounts.Where <LogicalModuleMount>((Func <LogicalModuleMount, bool>)(x => x.ModuleType == AssetDatabase.StationModuleTypeToMountTypeMap[thing.Key].ToString())).ToList <LogicalModuleMount>();
                    bool flag = false;
                    foreach (LogicalModuleMount logicalModuleMount in list2)
                    {
                        LogicalModuleMount mount = logicalModuleMount;
                        if (list1.Where <DesignModuleInfo>((Func <DesignModuleInfo, bool>)(x => x.MountNodeName == mount.NodeName)).Count <DesignModuleInfo>() == 0 && modules.Where <DesignModuleInfo>((Func <DesignModuleInfo, bool>)(x => x.MountNodeName == mount.NodeName)).Count <DesignModuleInfo>() == 0)
                        {
                            List <PlayerInfo> list3                = game.GameDatabase.GetPlayerInfos().ToList <PlayerInfo>();
                            Player            playerObject         = game.GetPlayerObject(station.PlayerID);
                            string            moduleFactionDefault = StationModuleQueue.GetModuleFactionDefault(thing.Key, playerObject.Faction);
                            int moduleId = game.GameDatabase.GetModuleID(game.AssetDatabase.GetStationModuleAsset(thing.Key, moduleFactionDefault), list3.First <PlayerInfo>((Func <PlayerInfo, bool>)(x => game.GameDatabase.GetFactionName(x.FactionID) == moduleFactionDefault)).ID);
                            game.GameDatabase.InsertQueuedStationModule(station.DesignInfo.DesignSections[0].ID, moduleId, new int?(), mount.NodeName, thing.Key);
                            --num;
                            flag = true;
                            break;
                        }
                    }
                    if (!flag)
                    {
                        break;
                    }
                }
                queuedItemMap[thing.Key] = 0;
            }
        }