コード例 #1
0
ファイル: UIUtility.cs プロジェクト: PenpenLi/BIG_HEAD
    public static void GetNormalCard(Transform parent, int cardId, int count, Vector3 eulerAngles, Vector3 scale, Vector3 pos, Action <UINormalCard> callback)
    {
        ItemTableSetting cardData = ItemTableSettings.Get(cardId);

        if (cardData == null)
        {
            Debug.LogError("非法ID:" + cardId);
            return;
        }
        UIItemTableSetting uiItem = UIItemTableSettings.Get(1);

        ResourceManager.LoadGameObject(uiItem.Path,
                                       (p, u, go) =>
        {
            go.transform.parent           = parent;
            go.transform.localEulerAngles = eulerAngles;
            go.transform.localScale       = scale;
            go.transform.position         = pos;
            go.SetActive(true);
            UINormalCard normalCard = go.GetComponent <UINormalCard>();
            normalCard.SetCard(cardId, count);
            if (callback != null)
            {
                callback(normalCard);
            }
        },
                                       (p, u) =>
        {
            Debug.LogError("加载失败!");
        });
    }
コード例 #2
0
ファイル: UIFormBase.cs プロジェクト: PenpenLi/BIG_HEAD
 /// <summary>
 /// 这个方法不允许调用,uimodule专用
 /// </summary>
 public void Init(UIFormTableSetting table, object userdata)
 {
     Table = table;
     state = UIFormState.Hide;
     OnInit(userdata);
     isOpen = false;
     if (table.Title != 0)
     {
         UIItemTableSetting uiItem = UIItemTableSettings.Get(2);
         ResourceManager.LoadGameObject(uiItem.Path,
                                        (p, data, go) =>
         {
             go.transform.parent               = transform;
             go.transform.localPosition        = Vector3.zero;
             go.transform.localScale           = Vector3.one;
             go.GetComponent <UIPanel>().depth = StartDepth + 1;
             UIEventListener.Get(go.transform.Find("btnClose").gameObject).onClick = (btn) => { UIModule.Instance.CloseForm(this); };
             go.transform.Find("btnClose").GetComponent <UILabel>().text           = I18N.Get(table.Title);
         },
                                        (p, data) => { });
     }
 }