Example #1
0
    public void Init()
    {
        mCraftItem = GetComponentInChildren <CraftItemSlot>();
        mResource  = GetComponentsInChildren <CraftResourceSlot>().ToList();
        mAccept    = GetComponentInChildren <CraftStart>();
        mProcess   = transform.Find("Crafting_Cover").GetComponentInChildren <CraftProcess>();

        mCraftItem.Init();
        mCraftItem.resourceHandler += SetCurItem;
        mProcess.ResetHandler      += mCraftItem.ResetSlot;

        for (int i = 0; i < mResource.Count; i++)
        {
            mResource[i].Init(i);
            mProcess.ResetHandler += mResource[i].ResetSlot;
        }
        mAccept.Init();
        mProcess.ResetHandler += mAccept.ResetStart;
        mProcess.Init();

        SelectItem select = transform.parent.parent.Find("SelectWindow").GetComponent <SelectItem>();

        select.SetCraftHandler += mCraftItem.SetSlot;

        for (int i = 0; i < mResource.Count; i++)
        {
            select.SetCraftHandler += mResource[i].SetSlot;
        }

        mProcess.ResetHandler += select.HideWindow;
    }
Example #2
0
    public void Init()
    {
        btnImage = GetComponent <Image>();
        SetColor(Color.red);

        CraftItemSlot _itemSlot = transform.parent.GetComponentInChildren <CraftItemSlot>();

        _itemSlot.resourceHandler += SetRecipe;

        mResource = transform.parent.GetComponentsInChildren <CraftResourceSlot>();

        for (int i = 0; i < mResource.Length; i++)
        {
            mResource[i].AcceptHandler += ChkAccept;
        }

        mAudio = GetComponent <AudioSource>();
    }