// 取得共用的元件 public Flyweight GetFlyweight(string Key,string Content) { if( m_Flyweights.ContainsKey( Key) ) return m_Flyweights[Key]; // 產生並設定內容 ConcreteFlyweight theFlyweight = new ConcreteFlyweight( Content ); m_Flyweights[Key] = theFlyweight; Debug.Log ("New ConcreteFlyweigh Key["+Key+"] Content["+Content+"]"); return theFlyweight; }
// 取得共用的元件 public Flyweight GetFlyweight(string Key, string Content) { if (m_Flyweights.ContainsKey(Key)) { return(m_Flyweights[Key]); } // 產生並設定內容 ConcreteFlyweight theFlyweight = new ConcreteFlyweight(Content); m_Flyweights[Key] = theFlyweight; Debug.Log("New ConcreteFlyweigh Key[" + Key + "] Content[" + Content + "]"); return(theFlyweight); }