Пример #1
0
    public bool    IsActionFull(int key)
    {
        DItem db    = ReadCfgItem.GetDataById(key);
        int   count = GTDataManager.Instance.GetItemCountById(key);

        return(count >= db.Data1);
    }
Пример #2
0
        public DoubleLinkedList(int capacity, IHuman data)
        {
            if (capacity < 0)
            {
                throw new IndexOutOfRangeException(nameof(capacity));
            }
            if (capacity == 0)
            {
                Initialize(new DItem(data));
                return;
            }

            DItem tmp = new DItem(data);

            Initialize(tmp);

            //Добавление в начало
            for (int i = 1; i < capacity; i++)
            {
                tmp          = new DItem(data);
                Tail.Next    = tmp;
                tmp.Previous = Tail;
                Tail         = tmp;
            }

            //Добавление в конец
            //for (int i = capacity; i > 1; i--)
            //{
            //    tmp = new DItem(data);
            //    Head.Previous = tmp;
            //    tmp.Next = Head;
            //    Head = tmp;
            //}
        }
Пример #3
0
    public static void ShowItemDialogById(int itemID)
    {
        DItem db = ReadCfgItem.GetDataById(itemID);

        switch (db.ItemType)
        {
        case EItemType.EQUIP:
            break;

        case EItemType.DRUG:
        case EItemType.MAT:
        case EItemType.ACTION:
        case EItemType.MONEY:
        case EItemType.KEY:
            GTWindowManager.Instance.OpenWindow(EWindowID.UIItemInfo);
            UIItemInfo itemInfo = (UIItemInfo)GTWindowManager.Instance.GetWindow(EWindowID.UIItemInfo);
            itemInfo.ShowViewById(itemID);
            break;

        case EItemType.GEM:
            break;

        case EItemType.CHIP:
            break;

        case EItemType.FASHION:
            break;

        case EItemType.EXP:
            break;

        case EItemType.BOX:
            break;
        }
    }
Пример #4
0
        public bool Remove(IHuman data)
        {
            if (Head == null)
            {
                return(false);
            }

            if (Head.Data == data)
            {
                Head = Head.Next;
                return(true);
            }

            DItem tmp = Head;

            while (tmp != null)
            {
                if (tmp.Data == data)
                {
                    tmp.Previous.Next = tmp.Next;
                    if (tmp != Tail)
                    {
                        tmp.Next.Previous = tmp.Previous;
                    }
                    return(true);
                }
                tmp = tmp.Next;
            }

            return(false);
        }
Пример #5
0
        public bool Remove(Gender gender)
        {
            if (Head == null)
            {
                return(false);
            }

            if (Head.Data.Gender == gender)
            {
                Head = Head.Next;
                return(true);
            }

            DItem tmp = Head;

            while (tmp != null)
            {
                if (tmp.Data.Gender == gender)
                {
                    tmp.Previous.Next = tmp.Next;
                    if (tmp != Tail)
                    {
                        tmp.Next.Previous = tmp.Previous;
                    }
                    return(true);
                }
                tmp = tmp.Next;
            }

            return(false);
        }
Пример #6
0
        public bool RemoveAll(int age)
        {
            if (Head == null)
            {
                return(false);
            }

            bool isRemoved = false;

            while (Head.Data.Age == age)
            {
                Head      = Head.Next;
                isRemoved = true;
            }

            DItem tmp = Head;

            while (tmp != null)
            {
                if (tmp.Data.Age == age)
                {
                    tmp.Previous.Next = tmp.Next;
                    if (tmp != Tail)
                    {
                        tmp.Next.Previous = tmp.Previous;
                    }
                    isRemoved = true;
                }
                tmp = tmp.Next;
            }

            return(isRemoved);
        }
Пример #7
0
        public async Task <IActionResult> PutDItem(int id, DItem dItem)
        {
            if (id != dItem.Id)
            {
                return(BadRequest());
            }

            _context.Entry(dItem).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DItemExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Пример #8
0
        public void RemoveRange(int startIndex, int count)
        {
            if (startIndex < 0 || startIndex >= Count || (startIndex + count) > Count)
            {
                throw new IndexOutOfRangeException(nameof(startIndex));
            }
            if (count == 0)
            {
                return;
            }
            if (count < 0)
            {
                throw new NegativeCountException(nameof(count));
            }

            DItem tmp = Head;

            for (int i = 0; i < Count; i++)
            {
                if (i == startIndex)
                {
                    for (int j = 0; j < count; j++)
                    {
                        this.RemoveAt(i);
                    }
                }
                tmp = tmp.Next;
            }
        }
Пример #9
0
        public bool RemoveAll(Gender gender)
        {
            if (Head == null)
            {
                return(true);
            }

            bool isRemoved = false;

            while (Head.Data.Gender == gender)
            {
                Head      = Head.Next;
                isRemoved = true;
            }

            DItem tmp = Head;

            while (tmp != null)
            {
                if (tmp.Data.Gender == gender)
                {
                    tmp.Previous.Next = tmp.Next;
                    if (tmp != Tail)
                    {
                        tmp.Next.Previous = tmp.Previous;
                    }
                    isRemoved = true;
                }
                tmp = tmp.Next;
            }

            return(isRemoved);
        }
Пример #10
0
        public void Print()
        {
            if (Head == null)
            {
                Console.ForegroundColor = ConsoleColor.DarkRed;
                Console.WriteLine(">> LIST IS EMPTY <<");
                Console.ResetColor();
                return;
            }

            DItem  tmp = Head;
            Random rnd = new Random();

            while (tmp != null)
            {
                Console.ForegroundColor = ConsoleColor.DarkGray;
                if (tmp.Data == null)
                {
                    Console.WriteLine("NULL");
                    tmp = tmp.Next;
                    continue;
                }
                Console.Write(tmp.Data.GetType().Name.ToUpper() + " >> ");

                Console.ForegroundColor = (ConsoleColor)rnd.Next(1, 16);
                Console.WriteLine(tmp.ToString());
                tmp = tmp.Next;
            }
            Console.WriteLine();
            Console.ResetColor();
        }
Пример #11
0
    public bool Add(DItem item)
    {
        for (int i = 0; i < items.Length; i++)
        {
            if (items[i] == item)
            {
                quantities[i] += 1;
                imageObjs[i].GetComponent <DItemHolder>().quantity         = quantities[i];
                imageObjs[i].GetComponent <DItemHolder>().quanityText.text = quantities[i].ToString();
                return(true);
            }
        }

        for (int i = 0; i < items.Length; i++)
        {
            if (items[i] == null)
            {
                items[i]      = item;
                quantities[i] = 1;
                imageObjs[i].GetComponent <Image>().sprite                 = item.sprite;
                imageObjs[i].GetComponent <DItemHolder>().item             = item;
                imageObjs[i].GetComponent <DItemHolder>().quantity         = quantities[i];
                imageObjs[i].GetComponent <DItemHolder>().quanityText.text = quantities[i].ToString();
                return(true);
            }
        }

        return(false);
    }
Пример #12
0
    public bool UseItemById(int id, int num = 1)
    {
        DItem itemDB = ReadCfgItem.GetDataById(id);

        switch (itemDB.ItemType)
        {
        case EItemType.MONEY:
            return(UseMoney(id, num));

        case EItemType.ACTION:
            return(UseAction(id, num));

        case EItemType.PETSOUL:
            return(UseSoul(id, num));

        case EItemType.BOX:
        case EItemType.DRUG:
        case EItemType.KEY:
        case EItemType.MAT:
            return(UseBagItem(id, num));

        case EItemType.EXP:
            return(false);

        case EItemType.CHIP:
            return(UseBagChip(id, num));

        default:
            return(false);
        }
    }
Пример #13
0
    public int CompareBagItem(XItem x1, XItem x2)
    {
        DItem itemDB1 = ReadCfgItem.GetDataById(x1.Id);
        DItem itemDB2 = ReadCfgItem.GetDataById(x2.Id);

        if (itemDB1.ItemType != itemDB2.ItemType)
        {
            return(itemDB1.ItemType - itemDB2.ItemType);
        }
        if (itemDB1.Quality != itemDB2.Quality)
        {
            return(itemDB2.Quality - itemDB1.Quality);
        }
        if (itemDB1.ItemType == EItemType.EQUIP)
        {
            XEquip xe1 = DataDBSEquip.GetDataById(x1.Instance);
            XEquip xe2 = DataDBSEquip.GetDataById(x2.Instance);
            return(CompareBagEquip(xe1, xe2));
        }
        if (itemDB1.Id != itemDB2.Id)
        {
            return(itemDB2.Id - itemDB1.Id);
        }
        return(x1.Instance - x2.Instance);
    }
Пример #14
0
        // I
        // A/B1
        // A/B2
        // A/B1/C1
        public void Register(string Path, IDebuggerDrawItem Item)
        {
            var Paths = Path.Split('/');

            if (Paths.Length == 1)
            {
                Item.Name = Path;
                ItemList_.Add(Path, Item);
                return;
            }

            if (!ItemList_.ContainsKey(Paths[0]))
            {
                var GroupItem = new DebugGroupItem(Paths[0]);
                GroupItem.Register(Path.Substring(Paths[0].Length + 1), Item);
                ItemList_.Add(Paths[0], GroupItem);
            }
            else if (ItemList_[Paths[0]] is DebugGroupItem DItem)
            {
                DItem.Register(Path.Substring(Paths[0].Length + 1), Item);
            }
            else
            {
                var GroupItem = new DebugGroupItem(Paths[0]);
                GroupItem.Register(ItemList_[Paths[0]].Name, ItemList_[Paths[0]]);
                GroupItem.Register(Path.Substring(Paths[0].Length + 1), Item);
                ItemList_[Paths[0]] = GroupItem;
            }
        }
Пример #15
0
    private void OnAck_UseItem(MessageRecv obj)
    {
        System.IO.MemoryStream ms  = new System.IO.MemoryStream(obj.Data);
        AckUseItem             ack = Serializer.Deserialize <AckUseItem>(ms);

        int pos = ack.Pos;
        int num = ack.Num;
        int id  = ack.ID;

        XItem item   = DataDBSBagItem.GetDataById(pos);
        DItem itemDB = ReadCfgItem.GetDataById(item.Id);

        switch (itemDB.ItemType)
        {
        case EItemType.DRUG:
            GTDataManager.Instance.AddNewItem(itemDB.Data2, itemDB.Data1 * num);
            GTDataManager.Instance.UseItemById(itemDB.Id, num);
            break;

        case EItemType.BOX:
            break;
        }

        GTEventCenter.FireEvent(GTEventID.TYPE_BAG_USE_ITEM, id, num);
    }
Пример #16
0
        public async Task <ActionResult <DItem> > PostDItem(DItem dItem)
        {
            _context.DItems.Add(dItem);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetDItem", new { id = dItem.Id }, dItem));
        }
Пример #17
0
        public bool RemoveAll(string name)
        {
            if (Head == null)
            {
                return(false);
            }

            bool isRemoved = false;

            while (Head.Data.Name.ToLower() == name.ToLower())
            {
                Head      = Head.Next;
                isRemoved = true;
            }

            DItem tmp = Head;

            while (tmp != null)
            {
                if (tmp.Data.Name.ToLower() == name.ToLower())
                {
                    tmp.Previous.Next = tmp.Next;
                    if (tmp != Tail)
                    {
                        tmp.Next.Previous = tmp.Previous;
                    }
                    isRemoved = true;
                }
                tmp = tmp.Next;
            }

            return(isRemoved);
        }
Пример #18
0
    public bool    IsActionFull(EAction type)
    {
        DAction actDB = ReadCfgAction.GetDataById(type);
        DItem   db    = ReadCfgItem.GetDataById(actDB.ItemID);
        int     count = GTDataManager.Instance.GetActionCountByType(type);

        return(count >= db.Data1);
    }
    public DItemViewModel()
    {
        DItem di = new DItem()
        {
            itemName = "someName", amt = 1, amtType = "xf"
        };

        lv = new ObservableCollection <DItem>();
        lv.Add(di);
    }
Пример #20
0
        public IEnumerator <IHuman> GetEnumerator()
        {
            DItem tmp = Head;

            while (tmp != null)
            {
                yield return(tmp.Data);

                tmp = tmp.Next;
            }
        }
Пример #21
0
    private void ShowDialogueContent(DDialogue db)
    {
        string replaceName = string.Empty;

        switch (db.ContentType)
        {
        case EDialogueContentType.TYPE_NONE:
        {
            replaceName = string.Empty;
        }
        break;

        case EDialogueContentType.TYPE_PLAYER:
        {
            Character c = GTWorld.Main;
            replaceName = c == null ? string.Empty : c.Name;
        }
        break;

        case EDialogueContentType.TYPE_ACTOR:
        {
            DActor actorDB = ReadCfgActor.GetDataById(db.ContentID);
            replaceName = actorDB == null ? string.Empty : actorDB.Name;
        }
        break;

        case EDialogueContentType.TYPE_ITEM:
        {
            DItem itemDB = ReadCfgItem.GetDataById(db.ContentID);
            replaceName = itemDB == null ? string.Empty : itemDB.Name;
        }
        break;

        case EDialogueContentType.TYPE_MAP:
        {
            DCopyMainChapter worldDB = ReadCfgCopyMainChapter.GetDataById(db.ContentID);
            replaceName = worldDB == null ? string.Empty : worldDB.Name;
        }
        break;
        }
        dlgContent.text = db.Content.Replace("%p%", replaceName);

        switch (db.ContentShowType)
        {
        case EDialogueContentShowType.Normal:
            dlgContent.GetComponent <TypewriterEffect>().enabled = false;
            break;

        case EDialogueContentShowType.Effect:
            dlgContent.GetComponent <TypewriterEffect>().enabled = true;
            dlgContent.GetComponent <TypewriterEffect>().ResetToBeginning();
            break;
        }
    }
Пример #22
0
    public void ShowInfoById(int itemID)
    {
        DItem itemDB = ReadCfgItem.GetDataById(itemID);

        itemDesc.text = itemDB.Desc;
        itemNum.text  = string.Empty;
        GTItemHelper.ShowItemTexture(itemTexture, itemID);
        GTItemHelper.ShowItemName(itemName, itemID);
        GTItemHelper.ShowItemQuality(itemQuality, itemID);
        btnBatchUse.SetActive(false);
        btnUse.SetActive(false);
    }
Пример #23
0
    private void ShowCurrRelicsView2()
    {
        int     targetID = mCards[mCenterIndex].id;
        DRelics db       = ReadCfgRelics.GetDataById(targetID);
        XRelics relics   = DataDBSRelics.GetDataById(targetID);

        for (int i = 0; i < mRelicsCharges.Count; i++)
        {
            RelicsCharge tab    = mRelicsCharges[i];
            int          itemID = db.ArtificeCostID[i];
            DItem        itemDB = ReadCfgItem.GetDataById(itemID);
            GTItemHelper.ShowItemName(tab.itemName, itemID);
            GTItemHelper.ShowItemTexture(tab.itemTexture, itemID);
            GTItemHelper.ShowItemQuality(tab.itemQuality, itemID);
            tab.itemNum.text = GTTools.Format("当前拥有:[d96016]{0}[-]", GTDataManager.Instance.GetItemCountById(itemID));
            tab.tip.text     = GTTools.Format("充能一次加 [d96916]{0}[-] 点经验", itemDB.Data1);

            if (relics == null)
            {
                tab.chargeProgressValue.value = 0;
                tab.chargeProgressNum.text    = GTTools.Format("{0}/{1}", 0, db.LevelExp[0]);
            }
            else
            {
                int curExp = 0;
                switch (i + 1)
                {
                case 1:
                    curExp = relics.CurExp1;
                    break;

                case 2:
                    curExp = relics.CurExp2;
                    break;

                case 3:
                    curExp = relics.CurExp3;
                    break;
                }

                int maxExp = db.LevelExp[relics.Level];
                GTItemHelper.ShowProgressSlider(tab.chargeProgressValue, curExp, maxExp);
                tab.chargeProgressNum.text = GTTools.Format("{0}/{1}", curExp, maxExp);
            }

            int index = i + 1;
            UIEventListener.Get(tab.btn).onClick = delegate(GameObject go)
            {
                GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK);
                GTNetworkSend.Instance.TryChargeRelics(targetID, index);
            };
        }
    }
Пример #24
0
    public static void ShowItemQuality(UISprite sprite, int itemID)
    {
        if (sprite == null)
        {
            return;
        }
        DItem    itemDB = ReadCfgItem.GetDataById(itemID);
        DQuality db     = ReadCfgQuality.GetDataById(itemDB.Quality);

        sprite.gameObject.SetActive(true);
        sprite.spriteName = db.Icon;
    }
Пример #25
0
 public static bool CheckItemEnongh(int itemID, int costNum)
 {
     if (itemID == 0)
     {
         return(true);
     }
     if (GTDataManager.Instance.GetItemCountById(itemID) < costNum)
     {
         DItem itemDB = ReadCfgItem.GetDataById(itemID);
         GTItemHelper.ShowTip("物品不足:" + itemDB.Name);
         return(false);
     }
     return(true);
 }
Пример #26
0
        public bool Contains(IHuman data)
        {
            DItem tmp = Head;

            while (tmp != null)
            {
                if (tmp.Data == data)
                {
                    return(true);
                }
                tmp = tmp.Next;
            }
            return(false);
        }
Пример #27
0
        public bool Contains(string name)
        {
            DItem tmp = Head;

            while (tmp != null)
            {
                if (tmp.Data.Name.ToLower() == name.ToLower())
                {
                    return(true);
                }
                tmp = tmp.Next;
            }
            return(false);
        }
Пример #28
0
        public bool Contains(int age)
        {
            DItem tmp = Head;

            while (tmp != null)
            {
                if (tmp.Data.Age == age)
                {
                    return(true);
                }
                tmp = tmp.Next;
            }
            return(false);
        }
Пример #29
0
    public static void ShowItemChip(GameObject go, int itemID)
    {
        if (go == null)
        {
            return;
        }
        DItem itemDB = ReadCfgItem.GetDataById(itemID);

        if (itemDB == null)
        {
            return;
        }
        go.SetActive(itemDB.ItemType == EItemType.CHIP);
    }
Пример #30
0
        public bool Contains(Gender gender)
        {
            DItem tmp = Head;

            while (tmp != null)
            {
                if (tmp.Data.Gender == gender)
                {
                    return(true);
                }
                tmp = tmp.Next;
            }
            return(false);
        }