public MyBindingContext()
        {
            Title        = "更多資料綁定主題";
            Message1     = "這是雙向綁定預設文字";
            Message2     = "這是單向綁定預設文字";
            MyItemObject = new MyItem
            {
                FirstName     = "Main FirstName",
                MySubItemData = new MySubItem
                {
                    FirstName = "Sub Firstname",
                }
            };

            MyItemList.Add(new MyItem()
            {
                FirstName = "FN1", LastName = "LN1"
            });
            MyItemList.Add(new MyItem()
            {
                FirstName = "FN2", LastName = "LN2"
            });
            MyItemList.Add(new MyItem()
            {
                FirstName = "FN3", LastName = "LN3"
            });

            Dict.Add("item1", 100);
            Dict.Add("item2", 120);
            Dict.Add("item3", 140);
            Dict.Add("item4", 160);
        }
示例#2
0
        void InitMyItemList(List <ItemFielInfo> itemList)
        {
            MyItemList.Clear();
            Grid.ClearChild();
            m_UIDraggablePanel.ResetPosition();
            int lineNumber = (itemList.Count / 3) + (itemList.Count % 3 > 0?1:0);
            int itemIndex  = 0;

            for (int line = 0; line < lineNumber; line++)
            {
                for (int row = 0; row < 3; row++)
                {
                    if (itemList.Count > itemIndex)
                    {
                        SigleUpgradeItem upgradItem = Grid.InstantiateNGUIObj(SingleUpgradeItemPrefab).GetComponent <SigleUpgradeItem>();
                        upgradItem.transform.localPosition = new Vector3(-110 + 110 * row, 210 - 110 * line, 0);
                        upgradItem.Init(itemList[itemIndex], OnMyItemClick);
                        MyItemList.Add(upgradItem);
                        itemIndex++;
                    }
                }
            }
//			if(itemList.Count>0)
//			{
//				OnMyItemClick(itemList[0]);//默认选中第一个
//			}
        }
示例#3
0
        void Init()
        {
            Grid.ClearChild();
            MyItemList.Clear();
            SelectItemList.Clear();
            List <ItemFielInfo> packItemList = ContainerInfomanager.Instance.GetPackItemList().Where(p => (!p.GetIfBesetJewel(1)) && (!p.GetIfBesetJewel(2)) && (p.LocalItemData._TradeFlag == 1)).ToList();

            // 所有已装备的装备本地信息
            List <EquipmentData> equipedDataList = new List <EquipmentData>();

            ContainerInfomanager.Instance.GetEquiptItemList().ApplyAllItem(P => equipedDataList.Add(P.LocalItemData as EquipmentData));

            packItemList.Sort((left, right) => {
                bool leftCanSelectFast  = IsCanFastSelect(left.LocalItemData, equipedDataList);
                bool rightCanSelectFast = IsCanFastSelect(right.LocalItemData, equipedDataList);

                if (leftCanSelectFast && !rightCanSelectFast)
                {
                    return(-1);
                }
                else if (!leftCanSelectFast && rightCanSelectFast)
                {
                    return(1);
                }
                else
                {
                    if (left.sSyncContainerGoods_SC.nPlace < right.sSyncContainerGoods_SC.nPlace)
                    {
                        return(-1);
                    }
                    else if (left.sSyncContainerGoods_SC.nPlace == right.sSyncContainerGoods_SC.nPlace)
                    {
                        return(0);
                    }
                    else
                    {
                        return(1);
                    }
                }
            });
            for (int i = 0; i < ContainerInfomanager.Instance.GetAllPackMaxNum(); i++)
            {
                int        indexX = i % 4;
                int        indexY = i / 4;
                GameObject newObj = CreatObjectToNGUI.InstantiateObj(SinglePackItemPrefab, Grid);
                newObj.transform.localScale    = new Vector3(0.85f, 0.85f, 1);
                newObj.transform.localPosition = new Vector3(-136 + 90 * indexX, 140 - 94 * indexY, 0);
                SinglePackItemSlot newItemSlot     = newObj.GetComponent <SinglePackItemSlot>();
                ItemFielInfo       newItemFielInfo = packItemList.Count > i?packItemList[i]:null;
                newItemSlot.Init(newItemFielInfo, false, SinglePackItemSlot.ItemStatus.Sell, OnItemCLick);
                MyItemList.Add(newItemSlot);

                //引导注入
                if (newItemFielInfo != null)
                {
                    newObj.RegisterBtnMappingId(newItemFielInfo.LocalItemData._goodID, UIType.Package, BtnMapId_Sub.Package_Cell);
                }
            }
            //UpdateSellBtnStatus();
        }
示例#4
0
 private void 新增()
 {
     MyItemList.Add(new MyItem
     {
         FirstName = "文君",
         LastName  = "簡",
         Age       = 19
     });
 }