Esempio n. 1
0
 void AddItem(List <SkillData> datas)
 {
     for (int i = 0; i < datas.Count; i++)
     {
         GameObject clone = GameObject.Instantiate(item) as GameObject;
         clone.SetActive(true);
         BabyLearningCell lCell = clone.GetComponent <BabyLearningCell>();
         lCell.SkpData                 = datas[i];
         clone.transform.parent        = grid.transform;
         clone.transform.localPosition = Vector3.zero;
         clone.transform.localScale    = Vector3.one;
         itemList.Add(clone);
         UIManager.SetButtonEventHandler(clone, EnumButtonEvent.OnClick, OnClickBtn, datas[i]._Id, datas[i]._Level);
         if (i == 0)
         {
             GuideManager.Instance.RegistGuideAim(clone, GuideAimType.GAT_FirstLearningBabySkill);
         }
     }
     grid.repositionNow = true;
     if (itemList.Count != 0 && itemList != null)
     {
         BabySkillInfo    sinfo = babySkillInfo.GetComponent <BabySkillInfo>();
         BabyLearningCell lCell = itemList[0].GetComponent <BabyLearningCell>();
         sinfo.SkpData = lCell.SkpData;
         SkillId       = lCell.SkpData._Id;
         newLevel      = lCell.SkpData._Level;
     }
 }
Esempio n. 2
0
    void OnClickBtn(ButtonScript obj, object args, int param1, int param2)
    {
        SkillId  = param1;
        newLevel = param2;
        BabyLearningCell lCell = obj.GetComponent <BabyLearningCell>();
        BabySkillInfo    info  = babySkillInfo.GetComponent <BabySkillInfo>();

        if (_curLearningCell != null)
        {
            _curLearningCell.rasp.gameObject.SetActive(false);
        }
        _curLearningCell = lCell;
        lCell.rasp.gameObject.SetActive(true);
        info.SkpData = lCell.SkpData;
        GuideManager.Instance.ProcEvent(ScriptGameEvent.SGE_ClickBabyLearningSkill);
    }