Example #1
0
 internal EntityManager(SystemCollection _systemCollection)
 {
     systemCollection = _systemCollection;
     entities         = new IndexList <Entity>();
     deletedEntities  = new Queue <Entity>();
     currentEntity    = 0;
 }
Example #2
0
 public void InitializeSystems()
 {
     m_Systems = new SystemCollection();
     //玩家输入
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <PlayerInputSystem>());
     //管理角色的外观信息获取和模型加载
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <HandleRoleLooks>(m_GameWorld));
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <HandleRoleLooksNetRequest>(m_GameWorld));
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <HandleRoleLooksSpawnRequests>(m_GameWorld));
     //从输入获取主角的目标坐标
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <CreateTargetPosFromUserInputSystem>(m_GameWorld));
     //角色移动相关
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <MovementUpdateSystem>(m_GameWorld));
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <HandleMovementQueries>(m_GameWorld));
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <MovementHandleGroundCollision>(m_GameWorld));
     //判定所有节点和地面的关系
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <GroundTestSystem>(m_GameWorld));
     //上传角色坐标信息
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <UploadMainRolePosSystem>(m_GameWorld));
     // m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem<SkillSpawnSystem>(m_GameWorld));
     //管理 Timeline
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <TimelineSpawnSystem>(m_GameWorld));
     //管理 Animator
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <UpdateAnimatorSystem>(m_GameWorld));
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <ResetPosOffsetSystem>(m_GameWorld));
     //管理所有名字和血量条:Nameboard 对象
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <NameboardSystem>(m_GameWorld));
     //重置所有动作
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <ActionDataResetSystem>(m_GameWorld));
     //协调处理各种粒子或 shader 特效,解决特效间的冲突关系
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <EffectHarmonizeSys>(m_GameWorld));
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <BeHitEffectSys>(m_GameWorld));
     m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <SuckHPEffectSys>(m_GameWorld));
 }
Example #3
0
        public void InitializeSystems()
        {
            m_Systems = new SystemCollection();
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <PlayerInputSystem>());

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <HandleRoleLooks>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <HandleRoleLooksNetRequest>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <HandleRoleLooksSpawnRequests>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <CreateTargetPosFromUserInputSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <MovementUpdateSystem>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <HandleMovementQueries>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <GroundTestSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <UploadMainRolePosSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <SkillSpawnSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <TimelineSpawnSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <UpdateRoleAnimatorSystem>(m_GameWorld));

            // TimelineSpawnRequest.Create(m_GameWorld.GetEntityManager(), Entity.Null, "haha");
        }
Example #4
0
        private void OpenDocFile()
        {
            List <String> listGroup = new List <string> {
                "Общее описание ",
                "Функциональные требования ",
                "Требования к внешнему интерфейсу ",
                "Другие нефункциональные требования "
            };

            currentPage = 5;

            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                DocX doc       = DocX.Load(ofd.FileName);
                var  paragraph = doc.Paragraphs;
                var  parText   = paragraph[0];
                textBox1.Text = parText.Text;
                SystemCollection system = new SystemCollection();
                system.SystemName         = parText.Text;
                parText                   = paragraph[3];
                system.GeneralDescription = parText.Text;
                model.SystemCollections.Add(system);
                model.SaveChanges();
                textBox1.Text = "Please wait";
                ParseText(doc, 0, 5, system, listGroup[0]);
                ParseText(doc, 5, 6, system, listGroup[1]);
                ParseText(doc, 6, 10, system, listGroup[2]);
                ParseText(doc, 10, 14, system, listGroup[3]);
                textBox1.Text = system.GeneralDescription;
            }
            Alert("Success", Form_Alerts.enmType.Success);
            ShowList();
        }
Example #5
0
        private void StartSearch(string[] gArr)
        {
            // start the iteraton counter
            LocalIterationCount++;
            // get the number of words in the array
            int wordCount = gArr.Length;
            int c         = 0; // wordCount - 1;

            // starting with the first word, search against PlatformGames adding words until only 1 result is returned
            while (c <= wordCount - 1)
            {
                // build string from array
                string searchStr = BuildSearchString(gArr, c);

                List <ScraperMaster> list = SystemCollection.Where(a => a.GDBTitle.ToLower().Contains(searchStr)).ToList();

                if (list.Count == 1)
                {
                    // One game found and it is likely the right one - destroy the current SearchCollection and create a new one - exit the method
                    SearchCollection = new List <ScraperMaster>();
                    SearchCollection.AddRange(list);
                    LocalGameFound = true;
                    return;
                }
                if (list.Count == 0)
                {
                    // no records found - keep the current SearchCollection
                    break;
                }
                if (list.Count > 1)
                {
                    // multiple records matched - add to searchcollection
                    SearchCollection = new List <ScraperMaster>();
                    SearchCollection.AddRange(list);
                }
                c++;
            }

            // first search routine has finished.
            if (SearchCollection.Count > 1)
            {
                string newSearch = "";
                switch (LocalIterationCount)
                {
                case 1:
                    // proceed to second phase - try replacing some symbols
                    newSearch = BuildSearchString(gArr, wordCount - 1);
                    string[] newArr = BuildArray(newSearch.Replace(":", "").Replace("_", "").Replace("-", "").Replace("'", ""));
                    StartSearch(newArr);
                    break;

                case 2:
                    // proceed to 3rd phase - convert numbers to numerals
                    newSearch = BuildSearchString(gArr, wordCount - 1);
                    string[] newArr2 = BuildArray(newSearch.Replace("1", "I").Replace("2", "II").Replace("3", "III").Replace("4", "IV").Replace("5", "V").Replace("6", "VI").Replace("7", "VII").Replace("8", "VIII"));
                    StartSearch(newArr2);
                    break;
                }
            }
        }
Example #6
0
        public void InitializeSystems()
        {
            m_Systems = new SystemCollection();
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <PlayerInputSystem>());

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <HandleRoleLooks>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <HandleRoleLooksNetRequest>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <HandleRoleLooksSpawnRequests>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <CreateTargetPosFromUserInputSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <MovementUpdateSystem>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <HandleMovementQueries>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <MovementHandleGroundCollision>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <GroundTestSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <UploadMainRolePosSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <SkillSpawnSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <TimelineSpawnSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <UpdateAnimatorSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <ResetPosOffsetSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <NameboardSystem>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <NameboardSpawnRequestSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateSystem <ActionDataResetSystem>(m_GameWorld));
        }
Example #7
0
        private void AdditionToGlossary(string s, SystemCollection system)
        {
            ILemmatizer   lmtz        = new LemmatizerPrebuiltFull(LanguagePrebuilt.Russian);
            List <String> wordsInText = new List <string>();

            wordsInText.AddRange(s.Split(new char[] { '.', '?', '!', '(', ')', ',', ':', ';', ' ' }, StringSplitOptions.RemoveEmptyEntries));
            for (int i = 0; i < wordsInText.Count; i++)
            {
                wordsInText[i] = wordsInText[i].ToLower();
                wordsInText[i] = lmtz.Lemmatize(wordsInText[i]);
                for (int w = 0; w < stopWords.Count; w++)
                {
                    if (wordsInText[i] == stopWords[w])
                    {
                        wordsInText.RemoveAt(i);
                        i--;
                        break;
                    }
                }
            }

            List <String> words = new List <string>();

            foreach (var a in wordsInText.Distinct <string>())
            {
                words.Add(a);
            }

            for (int i = 0; i < words.Count; i++)
            {
                bool           t = false;
                GlossarySystem glossarySystem = new GlossarySystem();

                var gos = (from p in model.GlossarySystems where p.SystemCollectionId == system.Id select p).ToList();
                for (int g = 0; g < gos.Count; g++)
                {
                    if (gos[g].WordGlossary == words[i])
                    {
                        glossarySystem = model.GlossarySystems.Find(gos[g].Id);
                        t = true;
                        break;
                    }
                }
                if (t != true)
                {
                    glossarySystem.WordGlossary       = words[i];
                    glossarySystem.SystemCollectionId = system.Id;
                    glossarySystem.WordValue          = 1;
                    glossarySystem.SystemCollection   = system;
                    model.GlossarySystems.Add(glossarySystem);
                    model.SaveChanges();
                }
                else
                {
                    glossarySystem.WordValue++;
                    model.SaveChanges();
                }
            }
        }
Example #8
0
    public static void CreateAbilityRequestSystems(GameWorld world, SystemCollection systems)
    {
        systems.Add(world.GetECSWorld().CreateSystem <Movement_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateSystem <Boost_RequestActive>(world));

        // Update main abilities
        systems.Add(world.GetECSWorld().CreateSystem <DefaultBehaviourController_Update>(world));
    }
Example #9
0
 public static void CreateAbilityStartSystems(GameWorld world, SystemCollection systems)
 {
     systems.Add(world.GetECSWorld().CreateManager <RocketJump_Update>(world));
     systems.Add(world.GetECSWorld().CreateManager <Sprint_Update>(world));
     systems.Add(world.GetECSWorld().CreateManager <AutoRifle_Update>(world));
     systems.Add(world.GetECSWorld().CreateManager <ProjectileLauncher_Update>(world));
     systems.Add(world.GetECSWorld().CreateManager <Chaingun_Update>(world));
     systems.Add(world.GetECSWorld().CreateManager <GrenadeLauncher_Update>(world));
     systems.Add(world.GetECSWorld().CreateManager <Melee_Update>(world));
     systems.Add(world.GetECSWorld().CreateManager <Emote_Update>(world));
     systems.Add(world.GetECSWorld().CreateManager <Dead_Update>(world));
 }
Example #10
0
        public void TestMethod1()
        {
            SystemCollection sysCollection = new SystemCollection();

            sysCollection.RegisterResource <Time>();
            sysCollection.RegisterResource <Counter>();
            TimeSystem ts = new TimeSystem();
            Count      c  = new Count();

            sysCollection.RegisterSystem(ts);
            sysCollection.RegisterSystem(c);
            sysCollection.RegisterSystem(new PrintTimeSystem(), ts);
            sysCollection.RegisterSystem(new PrintEven(), c);
            sysCollection.RegisterSystem(new PrintOdd(), c);
            sysCollection.StartSystems(15);
        }
Example #11
0
    public static void CreateAbilityRequestSystems(GameWorld world, SystemCollection systems)
    {
        systems.Add(world.GetECSWorld().CreateManager <Movement_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <RocketJump_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <Dead_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <AutoRifle_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <Chaingun_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <GrenadeLauncher_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <ProjectileLauncher_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <Sprint_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <Melee_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <Emote_RequestActive>(world));

        // Update main abilities
        systems.Add(world.GetECSWorld().CreateManager <DefaultBehaviourController_Update>(world));
    }
Example #12
0
    internal SystemDataFilter(SystemCollection _sysCollection, Type[] _compRead, Type[] _compWrite, Type[] _compAddable, Type[] _compExclude, Type[] _rescRead, Type[] _rescWrite, bool _entityAccess, bool _entityDeleteAccess)
    {
        compRead    = new Dictionary <Type, IIndexed <IComponent> >();
        compWrite   = new Dictionary <Type, IIndexed <IComponent> >();
        compAddable = new Dictionary <Type, IIndexed <IComponent> >();
        rescRead    = new Dictionary <Type, IComponent>();
        rescWrite   = new Dictionary <Type, IComponent>();

        entityAccess       = _entityAccess;
        entityDeleteAccess = _entityDeleteAccess;
        if (entityAccess || entityDeleteAccess)
        {
            entityManager = _sysCollection.entityManager;
        }

        foreach (Type t in _compRead)
        {
            compRead.Add(t, _sysCollection.componentLUT[t]);
            validEntities = (validEntities ?? compRead[t].validBits).And(compRead[t].validBits);
        }
        foreach (Type t in _compWrite)
        {
            compWrite.Add(t, _sysCollection.componentLUT[t]);
            validEntities = (validEntities ?? compWrite[t].validBits).And(compWrite[t].validBits);
        }
        foreach (Type t in _compAddable)
        {
            compAddable.Add(t, _sysCollection.componentLUT[t]);
        }
        foreach (Type t in _compExclude)
        {
            if (_sysCollection.componentLUT.ContainsKey(t))
            {
                validEntities = (validEntities ?? _sysCollection.componentLUT[t].validBits.Not()).And(_sysCollection.componentLUT[t].validBits.Not());
            }
        }
        foreach (Type t in _rescRead)
        {
            rescRead.Add(t, _sysCollection.resourceLUT[t]);
        }
        foreach (Type t in _rescWrite)
        {
            rescWrite.Add(t, _sysCollection.resourceLUT[t]);
        }

        Reset();
    }
Example #13
0
        public void InitializeSystems()
        {
            m_Systems = new SystemCollection();
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <PlayerInputSystem>());

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <HandleRoleLooks>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <HandleRoleLooksNetRequest>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <HandleRoleLooksSpawnRequests>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <UpdateRoleTransformFromLooks>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <CreateTargetPosFromUserInputSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <TargetPosSystem>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <GroundTestSystem>(m_GameWorld));

            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <HandleLooksFollowLogicTransform>(m_GameWorld));
            m_Systems.Add(m_GameWorld.GetECSWorld().CreateManager <UploadMainRolePosSystem>(m_GameWorld));
        }
Example #14
0
    /// <summary>
    /// Used to combine multiple systemCollections into one large dispatcher
    /// </summary>
    /// <param name="addedCollection"></param>
    /// <param name="collectionDependencies"></param>
    public void AddSystemCollection(SystemCollection addedCollection, params SystemCollection[] collectionDependencies)
    {
        //Register the new components
        foreach (KeyValuePair <Type, IIndexed <IComponent> > kvp in addedCollection.componentLUT)
        {
            IIndexed <IComponent> newStorage = (IIndexed <IComponent>)Activator.CreateInstance(kvp.Value.GetType());
            if (componentLUT.ContainsKey(kvp.Key))
            {
                componentLUT[kvp.Key] = (newStorage.density > componentLUT[kvp.Key].density) ? newStorage as IIndexed <IComponent> : componentLUT[kvp.Key];
            }
            else
            {
                componentLUT.Add(kvp.Key, (IIndexed <IComponent>)Activator.CreateInstance(kvp.Value.GetType()));
            }
        }

        //Register the new resources
        foreach (KeyValuePair <Type, IComponent> kvp in addedCollection.resourceLUT)
        {
            if (!resourceLUT.ContainsKey(kvp.Key))
            {
                resourceLUT.Add(kvp.Key, kvp.Value);
            }
        }

        //Register the new systems
        foreach (KeyValuePair <ISystem, SystemDependencies> kvp in addedCollection.systems)
        {
            List <ISystem> depends = new List <ISystem>();
            foreach (SystemCollection SC in collectionDependencies)
            {
                foreach (ISystem SD in SC.systems.Keys)
                {
                    depends.Add(SD);
                }
            }
            depends.AddRange(kvp.Value.dependencies);
            RegisterSystem(kvp.Key, depends.ToArray());
        }

        //Combine startup events
        OnStart += addedCollection.OnStart;
    }
Example #15
0
        public List <SearchOrdering> ShowPlatformGamesBySub(int systemId, GamesLibraryModel game)
        {
            // get gamesdb sub entry
            var subIdObj = GSystem.GetSubSystems()
                           .Where(a => a.systemName == game.System).FirstOrDefault();

            if (subIdObj == null)
            {
                // no sub found
                SystemCollection = PlatformGames.Where(a => GSystem.GetMedLaunchSystemIdFromGDBPlatformId(a.pid) == systemId).ToList();
            }
            else
            {
                // sub found
                SystemCollection = PlatformGames.Where(a => a.pid == subIdObj.theGamesDBPlatformId.First()).ToList();
            }

            // megadrive check
            if (game.System == "Sega Mega Drive/Genesis")
            {
                if (game.Country == "US" ||
                    game.Country == "USA")
                {
                    SystemCollection = SystemCollection.Where(a => a.pid == 18).ToList();
                }
                else if (game.Country == "EU" || game.Country == "EUR" ||
                         game.Country == "JP" || game.Country == "JAP" || game.Country == "JPN")
                {
                    SystemCollection = SystemCollection.Where(a => a.pid == 36).ToList();
                }
                else
                {
                    // show all games
                }
            }

            // Match all words and return a list ordered by higest matches
            List <SearchOrdering> searchResult = OrderByMatchedWords(StripSymbols(game.Game.ToLower()));

            return(searchResult);
        }
Example #16
0
    public static void CreateAbilityStartSystems(GameWorld world, SystemCollection systems)
    {
        // Ability request phase
        systems.Add(world.GetECSWorld().CreateManager <Sprint_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <AutoRifle_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <ProjectileLauncher_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <Chaingun_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <GrenadeLauncher_RequestActive>(world));
        systems.Add(world.GetECSWorld().CreateManager <Melee_RequestActive>(world));

        // Resolve active abilities
        systems.Add(world.GetECSWorld().CreateManager <AbilityCtrl_Update>(world));

        // Update active abilities
        systems.Add(world.GetECSWorld().CreateManager <Sprint_Update>(world));
        systems.Add(world.GetECSWorld().CreateManager <AutoRifle_Update>(world));
        systems.Add(world.GetECSWorld().CreateManager <ProjectileLauncher_Update>(world));
        systems.Add(world.GetECSWorld().CreateManager <Chaingun_Update>(world));
        systems.Add(world.GetECSWorld().CreateManager <GrenadeLauncher_Update>(world));
        systems.Add(world.GetECSWorld().CreateManager <Melee_Update>(world));
    }
        private void comboBoxSystems_SelectedIndexChanged(object sender, EventArgs e)
        {
            SystemCollection systemCollection = model.SystemCollections.Find(((SystemCollection)(comboBoxSystems.SelectedValue)).Id);

            textBoxDescription.Text = systemCollection.GeneralDescription;
        }
Example #18
0
 public static void CreateAbilityResolveSystems(GameWorld world, SystemCollection systems)
 {
     systems.Add(world.GetECSWorld().CreateManager <AutoRifle_HandleCollisionQuery>(world));
     systems.Add(world.GetECSWorld().CreateManager <RaiderRifle_HandleCollisionQuery>(world));
     systems.Add(world.GetECSWorld().CreateManager <Melee_HandleCollision>(world));
 }
Example #19
0
 public static void CreateHandleSpawnSystems(GameWorld world, SystemCollection systems, BundledResourceManager resourceManager, bool server)
 {
     systems.Add(world.GetECSWorld().CreateManager <HandleCharacterSpawn>(world, resourceManager, server)); // TODO (mogensh) needs to be done first as it creates presentation
     systems.Add(world.GetECSWorld().CreateManager <HandleAnimStateCtrlSpawn>(world));
 }
Example #20
0
 public static void CreateMovementResolveSystems(GameWorld world, SystemCollection systems)
 {
     systems.Add(world.GetECSWorld().CreateManager <HandleMovementQueries>(world));
     systems.Add(world.GetECSWorld().CreateManager <Movement_HandleCollision>(world));
 }
Example #21
0
 public static void CreateHandleSpawnSystems(GameWorld world, SystemCollection systems, BundledResourceManager resourceManager)
 {
     systems.Add(world.GetECSWorld().CreateManager <HandleAnimStateCtrlSpawn>(world));
     systems.Add(world.GetECSWorld().CreateManager <HandleCharacterSpawn>(world, resourceManager));
     systems.Add(world.GetECSWorld().CreateManager <AbilityCtrl_HandleSpawn>(world));
 }
Example #22
0
 public static void CreateControlledEntityChangedSystems(GameWorld world, SystemCollection systems)
 {
     systems.Add(world.GetECSWorld().CreateManager <AbilityCtrl_UpdateServerEntityComponent>(world));
 }
 internal ScorePage(Score score)
 {
     Score   = score;
     Systems = new SystemCollection(this);
 }
Example #24
0
        private void StartFuzzySearch(string searchStr, int manualIterator)
        {
            // start iterator
            if (manualIterator > 0)
            {
            }
            else
            {
                LocalIterationCount++;
                manualIterator = LocalIterationCount;
            }

            // setup fuzzystring options based on iteration
            List <FuzzyStringComparisonOptions> fuzzOptions = new List <FuzzyStringComparisonOptions>();
            FuzzyStringComparisonTolerance      tolerance;

            switch (manualIterator)
            {
            /* Iterations to widen the selection */
            // first auto iteration - strong matching using substring, subsequence and overlap coefficient
            case 1:
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseNormalizedLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubsequence);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroWinklerDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubstring);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseOverlapCoefficient);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseRatcliffObershelpSimilarity);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseSorensenDiceDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseTanimotoCoefficient);
                tolerance = FuzzyStringComparisonTolerance.Strong;
                break;

            // second iteration - same as the first but with normal matching
            case 2:
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseNormalizedLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubsequence);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroWinklerDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubstring);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseOverlapCoefficient);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseRatcliffObershelpSimilarity);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseSorensenDiceDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseTanimotoCoefficient);
                tolerance = FuzzyStringComparisonTolerance.Normal;
                break;

            // 3rd auto iteration - same as the first but with weak matching
            case 3:
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseNormalizedLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubsequence);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroWinklerDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubstring);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseOverlapCoefficient);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseRatcliffObershelpSimilarity);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseSorensenDiceDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseTanimotoCoefficient);
                tolerance = FuzzyStringComparisonTolerance.Weak;
                break;

            /* Iterations to narrow down selection */
            // first manual iteration
            case 100:
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseNormalizedLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubsequence);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroWinklerDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubstring);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseOverlapCoefficient);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseRatcliffObershelpSimilarity);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseSorensenDiceDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseTanimotoCoefficient);
                tolerance = FuzzyStringComparisonTolerance.Strong;
                break;

            default:
                // end and return
                return;
            }

            // Check whether the actual game name matches the search - if so return
            GDBPlatformGame gp = SystemCollection.Where(a => StripSymbols(a.GameTitle.ToLower()).Contains(searchStr)).FirstOrDefault();

            if (gp == null)
            {
            }
            else
            {
                SearchCollection = new List <GDBPlatformGame>();
                SearchCollection.Add(gp);
                WorkingSearchCollection = new List <GDBPlatformGame>();
                WorkingSearchCollection.Add(gp);
                return;
            }

            // iterate through each gamesdb game in the list
            foreach (GDBPlatformGame g in SystemCollection)
            {
                bool result = searchStr.ApproximatelyEquals(g.GameTitle, tolerance, fuzzOptions.ToArray());
                if (result == true)
                {
                    // match found - add to searchcollection
                    SearchCollection.Add(g);
                }
                else
                {
                    // match not found
                }
            }

            // check how many matches we have
            if (SearchCollection.Count == 1)
            {
                WorkingSearchCollection = new List <GDBPlatformGame>();
                WorkingSearchCollection.Add(SearchCollection.Single());
                return;
            }

            if (SearchCollection.Count > 1)
            {
                // add to working search collection
                WorkingSearchCollection.AddRange(SearchCollection.ToList());
                // clear SearchCollection
                //SearchCollection = new List<GDBPlatformGame>();

                // try the first word
                string[] arr     = BuildArray(searchStr);
                int      i       = 0;
                string   builder = "";
                while (i < arr.Length)
                {
                    if (i == 0)
                    {
                        builder += arr[i];
                    }
                    else
                    {
                        builder += " " + arr[i];
                    }
                    string b = StripSymbols(builder).ToLower();


                    var s = SystemCollection.Where(a => a.GameTitle.ToLower().Contains(b)).ToList();
                    if (s.Count == 1)
                    {
                        // one entry returned - this is the one to keep
                        WorkingSearchCollection = new List <GDBPlatformGame>();
                        //SearchCollection = new List<GDBPlatformGame>();
                        WorkingSearchCollection.Add(s.Single());
                        return;
                    }
                    if (s.Count > 1)
                    {
                        // still multiple entries returned - single match not found - continue
                        WorkingSearchCollection = new List <GDBPlatformGame>();
                        WorkingSearchCollection.AddRange(s);
                    }
                    if (s.Count == 0)
                    {
                        // no matches returned - this should never happen
                    }
                    i++;
                }

                // multiple matches found - run search again from the beginning but remove FIRST substring
                //StartFuzzySearch(searchStr, 100);
                return;

                /*
                 * string[] arr = BuildArray(searchStr);
                 * StartFuzzySearch(BuildSearchString(arr.Take(0).ToArray()), 1);
                 * // multiple matches found - run search again from the beginning but remove last substring
                 * StartFuzzySearch(BuildSearchString(arr.Take(arr.Count() - 1).ToArray()), 1);
                 */
            }
            if (SearchCollection.Count == 0)
            {
                // no matches found - run this method again with the next iterator (slightly weaker tolerance)
                StartFuzzySearch(searchStr, 0);
            }
        }
Example #25
0
        private void ParseText(DocX doc, int m, int l, SystemCollection system, string sGroup)
        {
            List <String> listIndex = new List <string> {
                "КП-",
                "ОС-",
                "ОДР-",
                "ДП-",
                "ПЗ-",
                "ФС-",
                "ИП-",
                "ИО-",
                "ПИ-",
                "ИПД-",
                "ТП-",
                "ТОТ-",
                "ТБ-",
                "АКПО-"
            };
            List <String> listName = new List <string> {
                "Классы и характеристики пользователей",
                "Операционная среда",
                "Ограничения дизайна и реализации",
                "Документация для пользователей",
                "Предположения и зависимости",
                "Функции системы",
                "Интерфейсы пользователей",
                "Интерфейсы оборудования",
                "Программные интерфейсы",
                "Интерфейсы передачи данных",
                "Требования к производительности",
                "Требования к охране труда",
                "Требования к безопасности",
                "Атрибуты качества ПО"
            };

            var         paragraph = doc.Paragraphs;
            GroupDemand group     = new GroupDemand();

            group.GroupName          = sGroup + system.SystemName;
            group.SystemCollectionId = system.Id;
            group.SystemCollection   = system;
            model.GroupDemands.Add(group);
            model.SaveChanges();
            for (int j = m; j < l; j++)
            {
                TypeDemand typeDemand = new TypeDemand();
                typeDemand.TymeName      = listName[j];
                typeDemand.GroupDemandId = group.Id;
                typeDemand.GroupDemand   = group;
                model.TypeDemands.Add(typeDemand);
                model.SaveChanges();
                for (int k = 1; k < paragraph.Count; k++)
                {
                    if (currentPage < paragraph.Count)
                    {
                        var             parText = paragraph[currentPage];
                        string          s       = parText.Text;
                        Regex           regex   = new Regex(listIndex[j] + k + ".");
                        MatchCollection matches = regex.Matches(s);
                        if (matches.Count > 0)
                        {
                            DemandDescription description = new DemandDescription();
                            description.Description  = s;
                            description.TypeDemandId = typeDemand.Id;
                            description.TypeDemand   = typeDemand;
                            model.DemandDescriptions.Add(description);
                            model.SaveChanges();
                            AdditionToGlossary(s, system);
                            currentPage++;
                        }
                        else
                        {
                            if (k == 1)
                            {
                                DemandDescription description = new DemandDescription();
                                description.Description  = s;
                                description.TypeDemandId = typeDemand.Id;
                                description.TypeDemand   = typeDemand;
                                model.DemandDescriptions.Add(description);
                                model.SaveChanges();
                                AdditionToGlossary(s, system);
                                currentPage++;
                            }
                            else
                            {
                                currentPage++;
                                break;
                            }
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            currentPage++;
        }
Example #26
0
        /// <summary>
        /// Fuzzy string matching (not currently used)
        /// </summary>
        /// <param name="searchStr"></param>
        /// <param name="manualIterator"></param>
        private void StartFuzzySearch(string searchStr, int manualIterator)
        {
            // start iterator
            if (manualIterator > 0)
            {
            }
            else
            {
                LocalIterationCount++;
                manualIterator = LocalIterationCount;
            }

            // setup fuzzystring options based on iteration
            List <FuzzyStringComparisonOptions> fuzzOptions = new List <FuzzyStringComparisonOptions>();
            FuzzyStringComparisonTolerance      tolerance;

            switch (manualIterator)
            {
            /* Iterations to widen the selection */
            // first auto iteration - strong matching using substring, subsequence and overlap coefficient
            case 1:
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseNormalizedLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubsequence);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroWinklerDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubstring);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseOverlapCoefficient);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseRatcliffObershelpSimilarity);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseSorensenDiceDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseTanimotoCoefficient);
                tolerance = FuzzyStringComparisonTolerance.Normal;
                break;

            // second iteration - same as the first but with normal matching
            case 2:
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseNormalizedLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubsequence);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroWinklerDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubstring);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseOverlapCoefficient);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseRatcliffObershelpSimilarity);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseSorensenDiceDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseTanimotoCoefficient);
                tolerance = FuzzyStringComparisonTolerance.Normal;
                break;

            // 3rd auto iteration - same as the first but with weak matching
            case 3:
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseNormalizedLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubsequence);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroWinklerDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubstring);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseOverlapCoefficient);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseRatcliffObershelpSimilarity);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseSorensenDiceDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseTanimotoCoefficient);
                tolerance = FuzzyStringComparisonTolerance.Weak;
                break;

            /* Iterations to narrow down selection */
            // first manual iteration
            case 100:
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseNormalizedLevenshteinDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubsequence);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaccardDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseHammingDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseJaroWinklerDistance);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseLongestCommonSubstring);
                //fuzzOptions.Add(FuzzyStringComparisonOptions.UseOverlapCoefficient);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseRatcliffObershelpSimilarity);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseSorensenDiceDistance);
                fuzzOptions.Add(FuzzyStringComparisonOptions.UseTanimotoCoefficient);
                tolerance = FuzzyStringComparisonTolerance.Strong;
                break;

            default:
                // end and return
                return;
            }

            // iterate through each gamesdb game in the list
            foreach (ScraperMaster g in SystemCollection)
            {
                bool result = searchStr.ApproximatelyEquals(g.GDBTitle, tolerance, fuzzOptions.ToArray());
                if (result == true)
                {
                    // match found - add to searchcollection
                    SearchCollection.Add(g);
                }
                else
                {
                    // match not found
                }
            }

            if (SearchCollection.Count == 1)
            {
                WorkingSearchCollection = SearchCollection;
                return;
            }

            // Check whether the actual game name contains the actual search
            //GDBPlatformGame gp = SystemCollection.Where(a => StripSymbols(a.GameTitle.ToLower()).Contains(searchStr)).FirstOrDefault();
            List <ScraperMaster> gp = SystemCollection.Where(a => AddTrailingWhitespace(a.GDBTitle.ToLower()).Contains(AddTrailingWhitespace(SearchString))).ToList();

            if (gp == null)
            {
                // nothing found - proceed to other searches
            }
            else
            {
                if (gp.Count > 1)
                {
                    // multiples found - wipe out search collection and create a new one
                    SearchCollection = new List <ScraperMaster>();
                    SearchCollection.AddRange(gp);
                }
                else
                {
                    // only 1 entry found - return
                    SearchCollection = new List <ScraperMaster>();
                    SearchCollection.AddRange(gp);
                    WorkingSearchCollection = new List <ScraperMaster>();
                    WorkingSearchCollection.AddRange(gp);
                    return;
                }
            }


            // we should now have a pretty wide SearchCollection - count how many matched words
            Dictionary <ScraperMaster, int> totals = new Dictionary <ScraperMaster, int>();

            foreach (ScraperMaster g in SearchCollection)
            {
                int matchingWords = 0;
                // get total substrings in search string
                string[] arr          = BuildArray(searchStr);
                int      searchLength = arr.Length;

                // get total substrings in result string
                string[] rArr         = BuildArray(g.GDBTitle);
                int      resultLength = rArr.Length;

                // find matching words
                foreach (string s in arr)
                {
                    int i = 0;
                    while (i < resultLength)
                    {
                        if (StripSymbols(s) == StripSymbols(rArr[i]))
                        {
                            matchingWords++;
                            break;
                        }
                        i++;
                    }
                }
                // add to dictionary with count
                totals.Add(g, matchingWords);
            }

            // order dictionary
            totals.OrderByDescending(a => a.Value);
            // get max value
            var maxValueRecord = totals.OrderByDescending(v => v.Value).FirstOrDefault();
            int maxValue       = maxValueRecord.Value;
            // select all records that have the max value
            List <ScraperMaster> matches = (from a in totals
                                            where a.Value == maxValue
                                            select a.Key).ToList();

            if (matches.Count == 1)
            {
                // single match found
                WorkingSearchCollection = new List <ScraperMaster>();
                WorkingSearchCollection.AddRange(matches);
                return;
            }

            // run levenshetein fuzzy search on SearchCollection - 10 iterations
            int levCount = 0;

            while (levCount <= 10)
            {
                levCount++;
                double it = Convert.ToDouble(levCount) / 10;
                List <ScraperMaster> found = FuzzySearch.FSearch(searchStr, SearchCollection, it);
                //WorkingSearchCollection = new List<GDBPlatformGame>();

                if (found.Count == 1)
                {
                    // one entry returned
                    WorkingSearchCollection = new List <ScraperMaster>();
                    WorkingSearchCollection.AddRange(found);
                    return;
                }
                if (found.Count > 1)
                {
                    // multiple entries returned
                }

                if (found.Count == 0)
                {
                }

                //WorkingSearchCollection.AddRange(found);
                //return;
            }

            //return;

            // check how many matches we have
            if (SearchCollection.Count == 1)
            {
                WorkingSearchCollection = new List <ScraperMaster>();
                WorkingSearchCollection.Add(SearchCollection.Single());
                return;
            }

            if (SearchCollection.Count > 1)
            {
                // add to working search collection
                WorkingSearchCollection.AddRange(SearchCollection.ToList());
                // clear SearchCollection
                //SearchCollection = new List<GDBPlatformGame>();

                // try the first word
                string[] arr     = BuildArray(searchStr);
                int      i       = 0;
                string   builder = "";
                while (i < arr.Length)
                {
                    if (i == 0)
                    {
                        builder += arr[i];
                    }
                    else
                    {
                        builder += " " + arr[i];
                    }
                    string b = StripSymbols(builder).ToLower();


                    var s = SystemCollection.Where(a => a.GDBTitle.ToLower().Contains(b)).ToList();
                    if (s.Count == 1)
                    {
                        // one entry returned - this is the one to keep
                        WorkingSearchCollection = new List <ScraperMaster>();
                        //SearchCollection = new List<GDBPlatformGame>();
                        WorkingSearchCollection.Add(s.Single());
                        return;
                    }
                    if (s.Count > 1)
                    {
                        // still multiple entries returned - single match not found - continue
                        WorkingSearchCollection = new List <ScraperMaster>();
                        WorkingSearchCollection.AddRange(s);
                        //SearchCollection = new List<GDBPlatformGame>();
                    }
                    if (s.Count == 0)
                    {
                        // no matches returned - this should never happen
                    }
                    i++;
                }

                // multiple matches found - run search again from the beginning but remove FIRST substring
                //StartFuzzySearch(searchStr, 100);
                return;

                /*
                 * string[] arr = BuildArray(searchStr);
                 * StartFuzzySearch(BuildSearchString(arr.Take(0).ToArray()), 1);
                 * // multiple matches found - run search again from the beginning but remove last substring
                 * StartFuzzySearch(BuildSearchString(arr.Take(arr.Count() - 1).ToArray()), 1);
                 */
            }
            if (SearchCollection.Count == 0)
            {
                // no matches found - run this method again with the next iterator (slightly weaker tolerance)
                StartFuzzySearch(searchStr, 0);
            }
        }
Example #27
0
 public static void CreateHandleDespawnSystems(GameWorld world, SystemCollection systems)
 {
     systems.Add(world.GetECSWorld().CreateManager <HandleAnimStateCtrlDespawn>(world));
     systems.Add(world.GetECSWorld().CreateManager <HandleCharacterDespawn>(world));
 }
Example #28
0
 public static void CreateMovementStartSystems(GameWorld world, SystemCollection systems)
 {
     systems.Add(world.GetECSWorld().CreateManager <GroundTest>(world));
     systems.Add(world.GetECSWorld().CreateManager <Movement_Update>(world));
 }
Example #29
0
 public static void CreateHandleDespawnSystems(GameWorld world, SystemCollection systems)
 {
     systems.Add(world.GetECSWorld().CreateManager <HandleCharacterDespawn>(world));  // TODO (mogens) HandleCharacterDespawn dewpans char presentation and needs to be called before other HandleDespawn. How do we ensure this ?
     systems.Add(world.GetECSWorld().CreateManager <HandleAnimStateCtrlDespawn>(world));
 }
Example #30
0
        public ICollection <ScraperMaster> SearchGameLocal(string gameName, int systemId, int gameId)
        {
            SearchString            = gameName;
            LocalIterationCount     = 0;
            WorkingSearchCollection = new List <ScraperMaster>();
            SearchCollection        = new List <ScraperMaster>();

            if (gameName == null || gameName.Trim() == "")
            {
                return(SearchCollection);
            }

            if (systemId == 0 || gameId == 0)
            {
                return(SearchCollection);
            }

            if (SearchString.Contains("[PD]") || SearchString.Contains("(PD)") || SearchString.Contains("SC-3000") || SearchString.Contains("BIOS"))
            {
                // ignore public domain games
                return(SearchCollection);
            }

            // convert pce-cd systemid
            if (systemId == 18)
            {
                systemId = 7;
            }

            // get a list with all games for this system

            Game gam = Game.GetGame(gameId);

            if (gam.subSystemId != null && gam.subSystemId > 0)
            {
                // sub found
                var sub = GSystem.GetSubSystems().Where(a => a.systemId == gam.subSystemId.Value).FirstOrDefault();
                SystemCollection = PlatformGames.Where(a => a.pid == sub.theGamesDBPlatformId.First()).ToList();
            }
            else
            {
                //sub not found
                SystemCollection = PlatformGames.Where(a => GSystem.GetMedLaunchSystemIdFromGDBPlatformId(a.pid) == systemId).ToList();
            }

            // genesis/megadrive region selection
            if (gam.systemId == 4)
            {
                if (
                    gam.Country != null &&
                    (
                        gam.Country.ToUpper() == "US" ||
                        gam.Country.ToUpper() == "USA" ||
                        gam.Country.ToUpper() == "U"
                    )
                    )
                {
                    SystemCollection = SystemCollection.Where(a => a.pid == 18).ToList();
                }
                else if
                (
                    gam.Country != null &&
                    (
                        gam.Country.ToUpper() == "EU" ||
                        gam.Country.ToUpper() == "EUR" ||
                        gam.Country.ToUpper() == "EUROPE" ||
                        gam.Country.ToUpper() == "JP" ||
                        gam.Country.ToUpper() == "JAP" ||
                        gam.Country.ToUpper() == "J" ||
                        gam.Country.ToUpper() == "JPN"
                    )
                )
                {
                    SystemCollection = SystemCollection.Where(a => a.pid == 36).ToList();
                }
                else
                {
                    // Region not detected - use globalsettings choice
                    if (_GlobalSettings.preferGenesis == true)
                    {
                        SystemCollection = SystemCollection.Where(a => a.pid == 18).ToList();
                    }
                    else
                    {
                        SystemCollection = SystemCollection.Where(a => a.pid == 36).ToList();
                    }
                }
            }


            // Match all words and return a list ordered by higest matches
            List <SearchOrdering> searchResult = OrderByMatchedWords(StripSymbols(gameName.ToLower()));

            // get max value in the list
            var maxValueRecord = searchResult.OrderByDescending(v => v.Matches).FirstOrDefault();

            if (maxValueRecord == null)
            {
                SearchCollection = (from a in searchResult
                                    select a.Game).ToList();
            }
            else
            {
                int maxValue = maxValueRecord.Matches;
                // select all records that have the max value

                List <SearchOrdering> matches = (from a in searchResult
                                                 where (a.Matches == maxValue) // || a.Matches == maxValue - 1)
                                                 select a).ToList();
                SearchCollection = (from a in matches
                                    select a.Game).ToList();
                if (matches.Count == 1)
                {
                    // single entry returned
                    List <ScraperMaster> single = (from a in matches
                                                   select a.Game).ToList();
                    return(single);
                }
                if (matches.Count == 0)
                {
                    return(null);
                }
            }


            // Multiple records returned - continue

            // match order of words starting with the first and incrementing
            List <ScraperMaster> m = MatchOneWordAtATime(SearchCollection, StripSymbols(gameName.ToLower()));

            if (m.Count == 1)
            {
                return(m);
            }
            if (m.Count > 1)
            {
                SearchCollection = m;
            }


            if (SearchCollection.Count == 2 && _GlobalSettings.preferGenesis == true)
            {
                // 2 records returned - check whether they match exactly
                string first = (from a in SearchCollection
                                select a.GDBTitle).First();
                string last = (from a in SearchCollection
                               select a.GDBTitle).Last();
                if (first == last)
                {
                    // looks like the same game - perhaps different systems on the games db (ie - Megadrive / Genesis) - return the first result
                    ScraperMaster pg = (from a in SearchCollection
                                        select a).First();
                    List <ScraperMaster> l = new List <ScraperMaster>();
                    l.Add(pg);
                    return(l);
                }
            }

            // still no definiate match found
            // run levenshetein fuzzy search on SearchCollection - 10 iterations
            List <ScraperMaster> lg = LevenIteration(SearchCollection, StripSymbols(gameName.ToLower()));

            return(lg);
        }