public void generate(ITezCategoryFinalToken finalToken, out TezCategory category, TezEventExtension.Function <TezCategory> onGenerate) { if (!m_Dic.TryGetValue(finalToken.toName, out category)) { category = onGenerate(); m_Dic.Add(finalToken.toName, category); while (finalToken.toID >= m_List.Count) { m_List.Add(null); } m_List[finalToken.toID] = category; } }
/// <summary> /// 用FinalToken创建一个共用的Category /// </summary> private static TezCategory createCategory(ITezCategoryFinalToken finalToken) { Stack <ITezCategoryBaseToken> stack = new Stack <ITezCategoryBaseToken>(); ITezCategoryBaseToken temp_token = finalToken; while (temp_token != null) { stack.Push(temp_token); temp_token = temp_token.parent; } TezCategory category = new TezCategory(); category.setToken(stack.ToArray()); return(category); }
public static void generate(ITezCategoryRootToken rootToken, ITezCategoryFinalToken finalToken, out TezCategory category, TezEventExtension.Function <TezCategory> onGenerate) { if (!m_SlotDic.TryGetValue(rootToken.toName, out Slot slot)) { slot = new Slot(); while (rootToken.toID >= m_SlotList.Count) { m_SlotList.Add(null); } m_SlotList[rootToken.toID] = slot; m_SlotDic.Add(rootToken.toName, slot); } slot.generate(finalToken, out category, onGenerate); }