Example #1
0
 public static void InitBundleConfig(SLua.LuaTable luaConfig)
 {
     _allAsyncResBundleConfig.Clear();
     if (_allAsyncResDict.Count == 0)
     {
         return;
     }
     if (luaConfig == null)
     {
         return;
     }
     _allAsyncResBundleConfig = luaConfig.ToDictionary<string, string>();
 }
Example #2
0
    public void Init(SLua.LuaTable forbidWordTable)
    {
        forbidTree.Clear();

        var forbidWordDic = forbidWordTable.ToDictionary <string, string>();

        foreach (KeyValuePair <string, string> word in forbidWordDic)
        {
            var wordCharArray = RevisionWord(word.Value.Trim()).ToCharArray();
            if (wordCharArray.Length <= 0)
            {
                continue;
            }

            ForbidTreeNode rootNode;
            if (forbidTree.ContainsKey(wordCharArray[0]))
            {
                rootNode = forbidTree[wordCharArray[0]];
            }
            else
            {
                rootNode = new ForbidTreeNode();
                forbidTree[wordCharArray[0]] = rootNode;
            }

            for (int i = 1; i < wordCharArray.Length; i++)
            {
                if (rootNode.nextForbidNodes != null && rootNode.nextForbidNodes.ContainsKey(wordCharArray[i]))
                {
                    rootNode = rootNode.nextForbidNodes[wordCharArray[i]];
                }
                else
                {
                    if (rootNode.nextForbidNodes == null)
                    {
                        rootNode.nextForbidNodes = new Dictionary <char, ForbidTreeNode>();
                    }

                    var nextNode = new ForbidTreeNode();
                    rootNode.nextForbidNodes[wordCharArray[i]] = nextNode;
                    rootNode = nextNode;
                }
            }
            rootNode.wholeForbidWord = word.Value;
        }
    }