Exemplo n.º 1
0
 // public
 public void initInf(int no, string name, unitData data, int ownerIdx, int index)
 {
     Debug.Log("name:" + name);
     itemInf = (item_representation)System.Activator.CreateInstance(System.Type.GetType(name));
     itemInf.init(data);
     ownerIndex = ownerIdx;
     itemIndex  = index;
     itemNo     = no;
 }
Exemplo n.º 2
0
 public void init(int itemNo, item_representation inf, GameObject panel)
 {
     no          = itemNo;
     Icon.sprite = ImageList.main.itemIcon[no];
     if (itemName != null)
     {
         itemName.text = inf.itemName;
     }
     if (itemCost != null)
     {
         itemCost.text = "" + inf.Price;
     }
     itemInf    = inf;
     this.panel = panel.GetComponent <itemPanel>();
 }
Exemplo n.º 3
0
    // Use this for initialization
    public void init()
    {
        objs = new List <GameObject>();
        List <int> unActive = new List <int>();

        for (int no = 0; no < itemList.main.objects.Count; no++)
        {
            item_representation inf = itemList.main.objects[no];
            if (inf != null && inf.Parts != null)
            {
                bool complete = true;
                foreach (int partno in inf.Parts)
                {
                    if (!dataWarehouse.main.nowData.itemInBag.Contains(partno))
                    {
                        complete = false;
                        break;
                    }
                }
                if (dataWarehouse.main.nowData.moneyLeft < inf.Price)
                {
                    complete = false;
                }
                if (complete)
                {
                    GameObject obj = Instantiate(strip, mainpanel.transform);
                    obj.GetComponent <compositeStrip>().init(no, true, itemPanel, updateStrips);
                    objs.Add(obj);
                }
                else
                {
                    unActive.Add(no);
                }
            }
        }
        foreach (int no in unActive)
        {
            GameObject obj = Instantiate(strip, mainpanel.transform);
            obj.GetComponent <compositeStrip>().init(no, false, itemPanel);
            objs.Add(obj);
        }
    }
Exemplo n.º 4
0
 public void init(int no, bool active, GameObject panel)
 {
     repre  = itemList.main.objects[no];
     itemNo = no;
     mainIcon.GetComponent <itemInMarket>().init(no, repre, panel);
     if (repre.Parts != null)
     {
         partIcons = new GameObject[repre.Parts.Count];
         foreach (int idx in repre.Parts)
         {
             GameObject obj = Instantiate(mainIcon, table.transform);
             obj.GetComponent <itemInMarket>().init(idx, itemList.main.objects[idx], panel);
         }
     }
     if (active)
     {
         GetComponent <Image>().color = Color.green;
         priceText.text = "" + repre.Price;
     }
     else
     {
         composButtom.SetActive(false);
     }
 }