示例#1
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         int       i          = Random.Range(0, 10);
         ItemOwner _itemowner = new ItemOwner(i, i * 100, i + "A", 10);
         AddItemOwner(_itemowner);
         Display();
     }
     else if (Input.GetKeyDown(KeyCode.Alpha2))
     {
         Debug.Log("Remove > " + listIdx);
         if (dicItemOwner.ContainsKey(listIdx))
         {
             dicItemOwner.Remove(listIdx);
         }
         Display();
     }
     else if (Input.GetKeyDown(KeyCode.Alpha3))
     {
         Debug.Log("Use > " + listIdx);
         UseItemOwner(listIdx, useCnt);
         Display();
     }
 }
示例#2
0
        void Start()
        {
            ItemOwner _itemowner;

            for (int i = 0; i < 2; i++)
            {
                _itemowner = new ItemOwner(i, i * 100, i + "A", 1);
                dicItemOwner.Add(
                    _itemowner.listIdx.ToString(),
                    _itemowner
                    );
            }

            Display();
        }
示例#3
0
        void AddItemOwner(ItemOwner _itemowner)
        {
            if (dicItemOwner.ContainsKey(_itemowner.listIdx.ToString()))
            {
                Debug.Log(" Exist > Plus");

                dicItemOwner [_itemowner.listIdx.ToString()].AddCnt(_itemowner.cnt);
            }
            else
            {
                Debug.Log(" Not Exist > Add");
                dicItemOwner.Add(
                    _itemowner.listIdx.ToString(),
                    _itemowner
                    );
            }
        }
示例#4
0
        void Start()
        {
            ItemOwner _itemowner;

            for (int i = 0; i < 5; i++)
            {
                _itemowner = new ItemOwner(i, i * 100, i + "A");
                listItemOwner.Add(_itemowner);
            }

            GiftItem _giftitem;

            for (int i = 0; i < 5; i++)
            {
                _giftitem = new GiftItem(i, i * 100, i + 1, i + "A");
                listGiftItem.Add(_giftitem);
                Debug.Log(i);
            }
        }
示例#5
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha1))
     {
         Debug.Log("alpha1");
         int       rdm        = Random.Range(5, 20);
         ItemOwner _itemowner = new ItemOwner(rdm, rdm * 100, rdm + "B");
         listItemOwner.Add(_itemowner);
     }
     else if (Input.GetKeyDown(KeyCode.Alpha2))
     {
         Debug.Log("alpha2");
         if (listItemOwner.Count > 0)
         {
             int _idx = Random.Range(0, listItemOwner.Count);
             listItemOwner.RemoveAt(_idx);
         }
     }
     else if (Input.GetKeyDown(KeyCode.A))
     {
         listItemOwner[idxItemOwner].Display();
     }
     else if (Input.GetKeyDown(KeyCode.Alpha3))
     {
         int      rdm       = Random.Range(5, 20);
         GiftItem _giftitem = new GiftItem(rdm, rdm * 100, rdm + 1, rdm + "B");
         listGiftItem.Add(_giftitem);
     }
     else if (Input.GetKeyDown(KeyCode.Alpha4))
     {
         Debug.Log("alpha4");
         if (listGiftItem.Count > 0)
         {
             listGiftItem.RemoveAt(listGiftItem.Count - 1);
         }
     }
     else if (Input.GetKeyDown(KeyCode.B))
     {
         listGiftItem[idxGiftItem].Display();
     }
 }
示例#6
0
        bool UseItemOwner(string _listIdx, int _useCnt)
        {
            if (dicItemOwner.ContainsKey(listIdx))
            {
                ItemOwner _owner = dicItemOwner [listIdx];
                if (_owner.CheckCnt(_useCnt))
                {
                    _owner.UseItem(_useCnt);
                    Debug.Log("Use > " + _useCnt);
                    return(true);
                }
                else
                {
                    Debug.Log("Lack Item > " + _useCnt);
                }
            }
            else
            {
                Debug.Log("Not own > " + _useCnt);
            }

            return(false);
        }