Пример #1
0
 /// <summary>
 /// 法宝之间的切换
 /// </summary>
 void OnUITogChange(GameObject go)
 {
     for (int i = 0; i < magicGoList.Count; i++)
     {
         if (magicGoList[i].GetComponent <UIToggle>().value)
         {
             //刷新法宝属性
             magicAttributeUI.SetMagicAttribute(refList[i]);
             //刷新提升界面
             changeUI.SetMagicAttributeChange(refList[i]);
             //把点击的是哪个法宝存储起来
             MagicToggleUI magicToggleUI = magicGoList[i].GetComponent <MagicToggleUI>();
             if (magicToggleUI != null)
             {
                 clickMagic = magicToggleUI.GetData.Type;
             }
             //标签开关
             magicGoList[i].transform.FindChild("TagSprite").gameObject.SetActive(true);
             //预览模型
             if (model != null && magicToggleUI != null)
             {
                 //model.configID = magicToggleUI.GetData.ItemID;
                 //model.StartLoad();
                 GameCenter.previewManager.TryPreviewSingleEquipment(new EquipmentInfo(magicToggleUI.GetData.ItemID, EquipmentBelongTo.PREVIEW), model);
             }
         }
         else if (!magicGoList[i].GetComponent <UIToggle>().value)
         {
             magicGoList[i].transform.FindChild("TagSprite").gameObject.SetActive(false);
         }
     }
     //刷新按钮
     RefshButton();
     LabelDes();
 }
Пример #2
0
    /// <summary>
    /// 创建法宝
    /// </summary>
    void CreateMagicUI()
    {
        int index = 0;

        foreach (MagicWeaponInfo data in MagicListDic.Values)
        {
            GameObject go = GameObject.Instantiate(magicGo);
            go.transform.parent        = magicGo.transform.parent;
            go.transform.localScale    = Vector3.one;
            go.transform.localPosition = new Vector3(142, 24 - index * 76, 0);
            //默认是选中虚灵珠
            if (index == 0)
            {
                go.GetComponent <UIToggle>().startsActive = true;
            }
            //EventDelegate.Remove(go.GetComponent<UIToggle>().onChange, OnUITogChange);
            //EventDelegate.Add(go.GetComponent<UIToggle>().onChange, OnUITogChange);
            magicGoList.Add(go);
            refList.Add(data);
            MagicToggleUI magicToggleUI = go.GetComponent <MagicToggleUI>();
            if (magicToggleUI != null)
            {
                magicToggleUI.SetMagicInfo(data);
            }
            index++;
        }
        magicGo.SetActive(false);
    }