public InventoryRecord(GameObject f, int c, string pfn, InventoryWindowController par)
        {
            parent        = par;
            frame         = f;
            pieceFileName = pfn;
            validTypes    = PieceTemplateController.ValidTypes(pfn);
            GameObject t = Instantiate(Resources.Load("Prefabs/PieceTemplate")) as GameObject;

            template = t.GetComponent <PieceTemplateController>();
            if (c > 0)
            {
                template.transform.SetParent(frame.transform, true);
                t.transform.SetAsFirstSibling();
                template.transform.localPosition = new Vector3(templateX, 0f, 0.01f);
                template.UpdateHitRect();
                template.ConfigureFromJSON(pfn);
                UpdateDescriptiveText();
                template.SetCount(c);
            }
            else
            {
                template = null;
                Destroy(t);
            }
        }
        public void Reconstruct(GameObject f, int c, string pfn)
        {
            if (template != null && template.gameObject != null)
            {
                Destroy(template.gameObject);
            }
            frame         = f;
            pieceFileName = pfn;
            GameObject t = Instantiate(Resources.Load("Prefabs/PieceTemplate")) as GameObject;

            template = t.GetComponent <PieceTemplateController>();
            if (c > 0)
            {
                template.transform.SetParent(frame.transform, true);
                t.transform.SetAsFirstSibling();
                template.transform.localPosition = new Vector3(templateX, 0f, 0.01f);
                template.UpdateHitRect();
                template.ConfigureFromJSON(pfn);
                UpdateDescriptiveText();
                template.SetCount(c);
            }
            else
            {
                template = null;
                Destroy(t);
            }
            if (f != null && GetCount() > 0)
            {
                SetCount(c);
            }
        }
 public void Reconstruct(GameObject f,int c, string pfn)
 {
     if(template.gameObject != null)
         Destroy (template.gameObject);
     frame = f;
     pieceFileName = pfn;
     GameObject t = Instantiate (Resources.Load ("Prefabs/PieceTemplate")) as GameObject;
     template = t.GetComponent<PieceTemplateController>();
     if(c > 0){
         template.transform.SetParent(frame.transform,true);
         t.transform.SetAsFirstSibling();
         template.transform.localPosition = new Vector3(templateX,0f,0.01f);
         template.UpdateHitRect();
         template.ConfigureFromJSON(pfn);
         UpdateDescriptiveText();
         template.SetCount(c);
     }else{
         template = null;
         Destroy (t);
     }
     if(f != null && GetCount() > 0){
         SetCount (c);
     }
 }