Beispiel #1
0
    public static void ParseData(string content, string fileName)
    {
        metaData = new Dictionary <int, MoreCardsRewardData>();

        CSVParser parser = new CSVParser();

        if (!parser.Parse(content))
        {
            ClientLog.Instance.LogError("MoreCardsRewardData" + ConfigLoader.Instance.csvext + "解析错误");
            return;
        }

        int recordCounter        = parser.GetRecordCounter();
        MoreCardsRewardData data = null;

        for (int i = 0; i < recordCounter; ++i)
        {
            data          = new MoreCardsRewardData();
            data.id_      = parser.GetInt(i, "id");
            data.itemid_  = parser.GetInt(i, "reward");
            data.itemnum_ = parser.GetInt(i, "num");
            data.type     = parser.GetInt(i, "type");
            if (metaData.ContainsKey(data.id_))
            {
                ClientLog.Instance.LogError("MoreCardsRewardData" + ConfigLoader.Instance.csvext + "ID重复");
                return;
            }
            metaData[data.id_] = data;
        }
        parser.Dispose();
        parser = null;
    }
Beispiel #2
0
    void addItem()
    {
        for (int i = 0; i < MoreCardsRewardData.GetRewardData().Count; i++)
        {
            GameObject go = GameObject.Instantiate(item) as GameObject;
            go.SetActive(true);
            go.transform.parent     = grid.transform;
            go.transform.localScale = Vector3.one;
            UISprite   sp  = go.GetComponent <UISprite>();
            ItemData   itd = ItemData.GetData(MoreCardsRewardData.GetRewardData()[i].itemid_);
            UILabel [] las = go.GetComponentsInChildren <UILabel>();
            for (int j = 0; j < las.Length; j++)
            {
                if (las[j].name.Equals("nameLabel"))
                {
                    las[j].text = itd.name_;
                }
//				if(las[j].name.Equals("numLabel"))
//				{
//					las[j].text = MoreCardsRewardData.rewardItemNums[i].ToString();
//				}
            }
            //HeadIconLoader.Instance.LoadIcon (itd.icon_, sp);
            ItemCellUI itc = UIManager.Instance.AddItemCellUI(sp, (uint)MoreCardsRewardData.GetRewardData()[i].itemid_);
            itc.ItemCount = MoreCardsRewardData.GetRewardData()[i].itemnum_;
            itc.showTips  = true;
        }

        grid.Reposition();
    }
Beispiel #3
0
 void Start()
 {
     item.gameObject.SetActive(false);
     listPanel_         = ListView_.gameObject.GetComponent <UIPanel>();
     listDragArea_      = ListView_.gameObject.GetComponent <BoxCollider>();
     listDragArea_.size = new Vector3(listPanel_.GetViewSize().x, listPanel_.GetViewSize().y, 0);
     addItem();
     MoreCardsRewardData.GetRewardData();
     UIManager.SetButtonEventHandler(closeBtn.gameObject, EnumButtonEvent.OnClick, OnClickClose, 0, 0);
 }
Beispiel #4
0
 static int CardsRewardDataSort(MoreCardsRewardData crd, MoreCardsRewardData crd1)
 {
     if (crd.type > crd1.type)
     {
         return(-1);
     }
     else
     {
         return(0);
     }
 }
Beispiel #5
0
    public void SetData(int rewardid)
    {
        if (icon != null)
        {
            HeadIconLoader.Instance.Delete(icon.name);
        }
        MoreCardsRewardData mcrd = MoreCardsRewardData.GetData(rewardid);

        if (mcrd != null)
        {
            reward         = new COM_Item();
            reward.itemId_ = (uint)mcrd.itemid_;
            reward.stack_  = (short)mcrd.itemnum_;
        }
        UpdateContent();
    }