Beispiel #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="UniqueItemViewModel" /> class.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="selectable">if set to <c>true</c> [selectable].</param>
 public UniqueItemViewModel(UniqueItem item, bool selectable)
     : base(item)
 {
     this._selectable      = selectable;
     this._item            = item;
     this._eventAggregator = IoC.Get <IEventAggregator>();
 }
Beispiel #2
0
    public void EquipThreadSafe(UniqueItem item)
    {
        //Debug.Log ("Equipped Thread Safe: " + item);

        //Debug.Log ("Current thread: "+Thread.CurrentThread.Name);
        EquipItemQueue.Enqueue(item);
    }
Beispiel #3
0
        public static void PlayVoice(FilterItems Filter, Item Item)
        {
            string NameToRead = Item.ItemActor.x004_Name;

            if (Item.ItemQuality == ItemQuality.Legendary)
            {
                try
                {
                    UniqueItem Legendary = UniqueItemsController.TryGet(Item.SNOItem.ActorName.ToLower());
                    NameToRead = (Item.AncientItem) ? "Ancient" + Legendary.ItemName : Legendary.ItemName;
                }
                catch
                {
                    // Unknown legendary...
                }
            }

            System.Threading.Thread Thread = new System.Threading.Thread(() =>
            {
                using (SpeechSynthesizer synthesizer = new SpeechSynthesizer())
                {
                    synthesizer.Volume = 100;
                    synthesizer.Rate   = 0;
                    synthesizer.SetOutputToDefaultAudioDevice();

                    synthesizer.Speak(NameToRead);
                }
            });

            Thread.Start();
        }
Beispiel #4
0
    public List <UniqueItem> ParseItemList(string s)
    {
        //Debug.Log ("Unique Item Parsing: " + s);

        List <UniqueItem> uitems = new List <UniqueItem>();

        s = s.Trim('[', ']');
        //Debug.Log (s);
        string[] itemlist = s.Split('.');
        foreach (var iteminfo in itemlist)
        {
            //Debug.Log (iteminfo);

            string[] itemstring = iteminfo.Split('+');
            //Debug.Log (itemstring[0]+","+itemstring[1]);

            //Debug.Log (int.Parse (itemstring [0]));
            //Debug.Log (int.Parse (itemstring [1]));
            //Debug.Log(itemDictionary.GetItem (int.Parse (itemstring [1])).itemName);

            UniqueItem uitem = new UniqueItem(
                int.Parse(itemstring [0]),
                itemDictionary.GetItem(int.Parse(itemstring [1]))
                );
            //Debug.Log ("Parsed:" + uitem.item.itemName);
            uitems.Add(uitem);
        }

        //Debug.Log ("items:"+uitems);

        return(uitems);
    }
        public void StoreUniqueItem()
        {
            var storageSlot = new ItemStorageSlot();

            var itemToAdd = new UniqueItem(new ProceduralItemTemplate());

            var result = storageSlot.AddItem(itemToAdd);

            var firstTransaction = result.Items[0];

            Assert.That(result.Status, Is.EqualTo(TransactionStatus.Complete));
            Assert.That(result.Items, Has.Count.EqualTo(1));
            Assert.That(result.Items[0], Is.EqualTo(new ItemTransaction()
            {
                Quantity      = 1,
                Item          = itemToAdd,
                FromInventory = null,
                ToInventory   = storageSlot
            }));

            Assert.AreEqual(TransactionStatus.Complete, result.Status);
            Assert.AreEqual(itemToAdd, storageSlot.CurrentItem);

            Assert.AreEqual(null, firstTransaction.FromInventory);
            Assert.AreEqual(storageSlot, firstTransaction.ToInventory);
        }
        static void RunSecondTask()
        {
            var firstItem  = new UniqueItem();
            var secondItem = new UniqueItem(10);
            var thirdItem  = new UniqueItem();

            Console.ReadKey();
        }
    public void initUniqueItems()
    {
        foreach (GameObject obj in uniqueSlots)
        {
            UniqueItem uniItem = obj.GetComponent <UniqueItem>();
            RawImage   img     = obj.GetComponent <RawImage>();
            //HAVE TO DO LIKE THIS AT THE MOMENT AS WE DONT HAVE ALL TEXTURES FILLED OUT
            if (img.texture != null)
            {
                Texture texture = obj.GetComponent <RawImage>().texture;

                if (texture.name == "boat")
                {
                    uniItem.SetUniqueItemParams("boat", "Fishermans Rowey", "An old rowboat used for basic fishing", texture, tooltipWindow);
                }
                else if (texture.name == "book")
                {
                    uniItem.SetUniqueItemParams("book", "Bee Compendium", "A must have for every budding beekeeper and bee enthusiast! It has many things to teach you about this world.", texture, tooltipWindow);
                }
                else if (texture.name == "pickaxe")
                {
                    uniItem.SetUniqueItemParams("pickaxe", "Glass Pickaxe", "A delicate pickaxe left behind from when the hills ran dry. Stronger than diamond.", texture, tooltipWindow);
                }
                else if (texture.name == "honeycomb")
                {
                    uniItem.SetUniqueItemParams("honeycomb", "Sticky Comb", "A luscious comb, sure to make the bees feel at home!", texture, tooltipWindow);
                }
                else if (texture.name == "sword")
                {
                    uniItem.SetUniqueItemParams("sword", "Shiny Sword", "A toy sword gleaming with intensity.", texture, tooltipWindow);
                }
                else if (texture.name == "rose")
                {
                    uniItem.SetUniqueItemParams("rose", "Eternal Rose", "A delicate flower which defies the hours. It never grows old or weary.", texture, tooltipWindow);
                }
                else if (texture.name == "robot")
                {
                    uniItem.SetUniqueItemParams("robot", "Compliment-O-Bot", "Once bent on destroying all sentient life, this little robot has been reprogrammed to endlessly bark out compliments out the user.", texture, tooltipWindow);
                }
                else if (texture.name == "shoe")
                {
                    uniItem.SetUniqueItemParams("shoe", "Yeezys", "A pair of squeak proof sneakers.", texture, tooltipWindow);
                }
                else if (texture.name == "cloak")
                {
                    uniItem.SetUniqueItemParams("cloak", "Null Magic Robe", "A special robe that protects the wearer from all kinds of unnatural effects!", texture, tooltipWindow);
                }
                else if (texture.name == "hole")
                {
                    uniItem.SetUniqueItemParams("hole", "Dimensional Rip", "What have you done...", texture, tooltipWindow);
                }
            }
            else
            {
                uniItem.SetUniqueItemParams("PLACEHOLDER", "PLACEHOLDER", "PLACEHOLDER", defaultTexture, tooltipWindow);
            }
        }
    }
Beispiel #8
0
    public void EquipSpcial(UniqueItem item)
    {
        //Debug.Log ("Equipped: " + item);
        //Debug.Log ("Current thread: "+Thread.CurrentThread.Name);


        item.item.Equip(this);
        //inventory.Add (item.id,item.item);
    }
Beispiel #9
0
        public override void UpdateWithItem(UniqueItem item)
        {
            UserModel model = item as UserModel;

            if (model != null)
            {
                UpdateUser(model.User);
            }
        }
Beispiel #10
0
        static void GenerateItemProperties(Item item)
        {
            if (item.quality == Item.Quality.Unique)
            {
                UniqueItem uniqueItem = SelectUniqueForItem(item);
                if (uniqueItem != null)
                {
                    GenerateUnique(item, uniqueItem);
                }
                else
                {
                    item.quality = Item.Quality.Rare;
                }
            }

            if (item.quality == Item.Quality.Set)
            {
                SetItem setItem = SelectSetItem(item);
                if (setItem != null)
                {
                    GenerateSetItem(item, setItem);
                }
                else
                {
                    item.quality = Item.Quality.Rare;
                }
            }

            if (item.quality == Item.Quality.Magic)
            {
                int rand = Random.Range(0, 4);
                if (rand < 2)
                {
                    var prefixes = MagicAffix.GetSpawnableAffixes(item, MagicAffix.prefixes);
                    var prefix   = prefixes[Random.Range(0, prefixes.Count)];
                    AddAffix(item, prefix);
                    item.name = prefix.name + " " + item.name;
                }
                if (rand != 1)
                {
                    var suffixes = MagicAffix.GetSpawnableAffixes(item, MagicAffix.suffixes);
                    var suffix   = suffixes[Random.Range(0, suffixes.Count)];
                    AddAffix(item, suffix);
                    item.name += " " + suffix.name;
                }
            }
            else if (item.quality == Item.Quality.Rare)
            {
                var affixes = MagicAffix.GetSpawnableAffixes(item, MagicAffix.all);
                for (int i = 0; i < 4; ++i)
                {
                    var affix = affixes[Random.Range(0, affixes.Count)];
                    AddAffix(item, affix);
                }
            }
        }
Beispiel #11
0
        public override CreateUserData Execute()
        {
            try
            {
                if (IsCreateNew)
                {
                    Data.ScorePoints = 0;
                }
                string imagePath = " ";
                if (Data.ProfileImage != null && !Data.ProfileImage.ToLower().StartsWith("http"))
                {
                    imagePath         = Data.ProfileImage;
                    Data.ProfileImage = null;
                }

                string serializedData = JsonConvert.SerializeObject(Data);

                string userId = UserId;

                if (IsCreateNew)
                {
                    //	var result = WebClient.PostStringAsync(QueryBuilder.Instance.GetUsersQuery (), serializedData).Result;
                    var result = KinveyWebClient.PostSignUpStringAsync(QueryBuilder.Instance.GetUsersKinveyQuery(), serializedData).Result;

                    UniqueItem uniqueItemId = JsonConvert.DeserializeObject <UniqueItem>(result);
                    userId = uniqueItemId.Id;
                }
                else
                {
                    if (!Data.IsEmpty())
                    {
                        AppProvider.Log.WriteLine(LogChannel.All, QueryBuilder.Instance.GetPostUserProfileChangesKinveyQuery(UserId) + " : " + serializedData);
                        var update = KinveyWebClient.PutStringAsync(QueryBuilder.Instance.GetPostUserProfileChangesKinveyQuery(UserId), serializedData).Result;
                    }
                }

                if (!string.IsNullOrEmpty(imagePath.Trim()))
                {
                    var postImageToPost = new PostImageKinveyBackgroundTask(imagePath, userId, KinveyImageType.User);

                    postImageToPost.Execute();
                    //Data.ProfileImage = postImageToPost.Execute();

                    //var response = WebClient.PutBytesAsync(QueryBuilder.Instance.GetUploadUserImageQuery (userId), imageContent).Result;
                }

                return(Data);
            }
            catch (Exception ex)
            {
                AppProvider.Log.WriteLine(LogChannel.Exception, ex);
                Exception = ex;
            }

            return(null);
        }
Beispiel #12
0
        public void StoreUniqueItem()
        {
            var storageSlot = new ItemStorageSlot();

            var itemToAdd = new UniqueItem(new ProceduralItemTemplate());

            storageSlot.AddItem(itemToAdd);

            Assert.AreEqual(itemToAdd, storageSlot.CurrentItem);
        }
Beispiel #13
0
        public static void Drop(UniqueItem uniqueItem, Vector3 pos)
        {
            var item = Item.Create(uniqueItem.code);

            item.quality    = Item.Quality.Unique;
            item.level      = uniqueItem.level;
            item.identified = false;
            GenerateUnique(item, uniqueItem);
            Loot.Create(pos, item);
        }
Beispiel #14
0
        public void UniqueInStringOrderTest()
        {
            var input = "AAAABBBCCDAABBB";

            char[] inputArray = input.ToCharArray();
            var    actual     = UniqueItem.UniqueInOrder(inputArray);
            var    expected   = "ABCDAB";

            CollectionAssert.AreEquivalent(expected.ToList(), actual.ToList());
        }
Beispiel #15
0
 protected virtual void OnResult(UniqueItem result)
 {
     if (result != null)
     {
         DbClient.Instance.DeleteItemData <T> (Data).ConfigureAwait(false);
         if (ListData != null)
         {
             ListData.DeleteOne(Data);
         }
     }
 }
Beispiel #16
0
        public void UniqueInListOrderTest()
        {
            var input = new List <double> {
                1.1, 2.2, 2.2, 3.3
            };
            var actual   = UniqueItem.UniqueInOrder(input);
            var expected = new List <double> {
                1.1, 2.2, 3.3
            };

            CollectionAssert.AreEquivalent(expected.ToList(), actual.ToList());
        }
        public void NoneOnTryAddUniqueItemAddedToOccupiedSlot()
        {
            var storageSlot = new ItemStorageSlot();

            var oldItem = new StackableItem(new ProceduralItemTemplate(), 15);
            var newItem = new UniqueItem(new ProceduralItemTemplate());

            storageSlot.AddItem(oldItem);

            var result = storageSlot.AddItem(newItem);

            Assert.That(result, Is.EqualTo(InventoryTransaction.None));
        }
        public void NoneOnTryAddUniqueItemAddedToOccupiedSlot()
        {
            var storageSlot = new ItemStorageSlot();

            var oldItem = new StackableItem(new ProceduralItemTemplate(), 15);
            var newItem = new UniqueItem(new ProceduralItemTemplate());

            storageSlot.AddItem(oldItem);

            var result = storageSlot.AddItem(newItem);

            Assert.AreEqual(TransactionStatus.None, result.Status);
        }
Beispiel #19
0
        private void Offbutton_Click(object sender, RoutedEventArgs e)
        {
            IPartServices       IPS  = new PartServices(Properties.Settings.Default.db);
            IUniqueItemServices IUIS = new UniqueItemServices(Properties.Settings.Default.db);

            string input_PartNr   = PartNrtextBox.Text;
            string input_UniqueNr = UniqueNrtextBox.Text;

            if (string.IsNullOrEmpty(input_PartNr))
            {
                MessageBox.Show("零件编号不能为空");
            }
            if (string.IsNullOrEmpty(input_UniqueNr))
            {
                MessageBox.Show("零件唯一吗不能为空");
            }

            Part pak = IPS.SearchByNr(input_PartNr);

            if (string.IsNullOrEmpty(pak.PartNr))
            {
                MessageBox.Show("该零件不存在");
            }

            UniqueItem UIK = IUIS.SearchByUniqNr(input_UniqueNr);

            if (UIK != null)
            {
                MessageBox.Show("该唯一码已被占用");
            }

            UniqueItem InsertUI = new UniqueItem
            {
                PartNr    = input_PartNr,
                UniqNr    = input_UniqueNr,
                CreatedAt = DateTime.Now,
                State     = 0
            };
            bool IsInsertOk = IUIS.Create(InsertUI);

            if (IsInsertOk)
            {
                string mean = "下线成功";
                MessageBox.Show(mean);
            }
            else
            {
                string mean = "下线失败";
                MessageBox.Show(mean);
            }
        }
Beispiel #20
0
        public void MoveEmptyToUniqueSlot()
        {
            var toItem = new UniqueItem(new ProceduralItemTemplate());

            var fromSlot = new ItemStorageSlot();
            var toSlot   = new ItemStorageSlot();

            toSlot.AddItem(toItem);

            fromSlot.MoveInto(toSlot);

            Assert.AreEqual(null, fromSlot.CurrentItem);
            Assert.AreEqual(toItem, toSlot.CurrentItem);
        }
 public void createDict()
 {
     if (itemTruth == null)
     {
         itemTruth = new Dictionary <string, bool>();
     }
     itemTruth.Clear();
     //itemTruth = new Dictionary<string, bool>(); //HAVE TO REININT DICT
     foreach (GameObject obj in uniqueSlots)
     {
         UniqueItem item = obj.GetComponentInChildren <UniqueItem>();
         itemTruth.Add(item.uniqueName, item.activated);
     }
 }
        public void DragUniqueToEmpty()
        {
            var fromItem = new UniqueItem(new ProceduralItemTemplate());

            var fromSlot = new ItemStorageSlot();
            var toSlot   = new ItemStorageSlot();

            fromSlot.AddItem(fromItem);

            fromSlot.DragInto(toSlot);

            Assert.AreEqual(null, fromSlot.CurrentItem);
            Assert.AreEqual(fromItem, toSlot.CurrentItem);
        }
Beispiel #23
0
 public void buyUniqueItem(string nam)
 {
     //set bought variable to true for the item with name nam
     foreach (GameObject obj in backpack.uniqueSlots)
     {
         UniqueItem item = obj.GetComponentInChildren <UniqueItem>();
         if (item.uniqueName == nam)
         {
             item.activated = true;
             backpack.updateTextures();
             backpack.createDict();
             return;
         }
     }
 }
Beispiel #24
0
        public void DragEmptyToUnique()
        {
            var toItem = new UniqueItem(new ProceduralItemTemplate());

            var fromSlot = new ItemStorageSlot();
            var toSlot   = new ItemStorageSlot();

            toSlot.AddItem(toItem);

            var result = fromSlot.DragInto(toSlot);

            Assert.That(result, Is.EqualTo(InventoryTransaction.None));
            Assert.That(fromSlot.CurrentItem, Is.Null);
            Assert.That(toSlot.CurrentItem, Is.EqualTo(toItem));
        }
Beispiel #25
0
        public void NoneOnTryAddUniqueItemAddedToOccupiedSlot()
        {
            var storageSlot = new ItemStorageSlot();

            var oldItem = new StackableItem(new ProceduralItemTemplate(), 15);
            var newItem = new UniqueItem(new ProceduralItemTemplate());

            storageSlot.AddItem(oldItem);

            var result = storageSlot.AddItem(newItem);

            Assert.AreEqual(0, result.Quantity);
            Assert.AreEqual(InventoryResult.OperationStatus.None, result.Status);
            Assert.AreEqual(null, result.ItemAdded);
        }
 public void updateTextures()
 {
     foreach (GameObject obj in uniqueSlots)
     {
         UniqueItem item = obj.GetComponentInChildren <UniqueItem>();
         if (!item.activated)
         {
             obj.GetComponentInChildren <RawImage>().texture = defaultTexture;
         }
         else
         {
             obj.GetComponentInChildren <RawImage>().texture = item.texture;
         }
     }
 }
Beispiel #27
0
        public BasicMessage OutComingByUniqNr(string UniqNr)
        {
            if (string.IsNullOrEmpty(UniqNr))
            {
                Message.MsgText = "唯一码不能为空";
                Message.Result  = false;
                return(Message);
            }
            if (UniqRep.UnqiNrExist(UniqNr) == false)
            {
                Message.MsgText = "唯一码在UniqItem表中不存在";
                Message.Result  = false;
                return(Message);
            }
            UniqueItem UI = UniqRep.SearchByUniqNr(UniqNr);
            Storage    Sg = SaRep.SearchByUniqueNr(UniqNr);

            if (string.IsNullOrEmpty(Sg.PositionNr))
            {
                Message.MsgText = "PositionNr在Storage表中不存在";
                Message.Result  = false;
                return(Message);
            }
            bool DeRe = SaRep.Delete(Sg);

            if (DeRe)
            {
                bool OutMoRe = CreateOutcomingMovement(Sg.PositionNr, UI.CreatedAt);
                if (OutMoRe)
                {
                    Message.MsgText = "出库成功,并且写入Movement表";
                    Message.Result  = true;
                    return(Message);
                }
                else
                {
                    Message.MsgText = "出库成功,但无法写入Movement表";
                    Message.Result  = false;
                    return(Message);
                }
            }
            else
            {
                Message.MsgText = "出库失败";
                Message.Result  = false;
                return(Message);
            }
        }
        public void DragUniqueToStackable()
        {
            var fromItem = new UniqueItem(new ProceduralItemTemplate());
            var toItem   = new StackableItem(new ProceduralItemTemplate(), 5);

            var fromSlot = new ItemStorageSlot();
            var toSlot   = new ItemStorageSlot();

            fromSlot.AddItem(fromItem);
            toSlot.AddItem(toItem);

            fromSlot.DragInto(toSlot);

            Assert.AreEqual(toItem, fromSlot.CurrentItem);
            Assert.AreEqual(fromItem, toSlot.CurrentItem);
        }
        public void StoreUniqueItem()
        {
            var storageSlot = new ItemStorageSlot();

            var itemToAdd = new UniqueItem(new ProceduralItemTemplate());

            var result = storageSlot.AddItem(itemToAdd);

            var firstTransaction = result.Items[0];

            Assert.AreEqual(TransactionStatus.Complete, result.Status);
            Assert.AreEqual(itemToAdd, storageSlot.CurrentItem);

            Assert.AreEqual(null, firstTransaction.FromInventory);
            Assert.AreEqual(storageSlot, firstTransaction.ToInventory);
        }
        static void Main(string[] args)
        {
            Console.WriteLine("с какого номера хотете начать? ");

            int number = Convert.ToInt32(Console.ReadLine());

            if (number != 0)
            {
                UniqueItem.counter = number;
            }
            UniqueItem uniqueItem1 = new UniqueItem();
            UniqueItem uniqueItem2 = new UniqueItem();
            UniqueItem uniqueItem3 = new UniqueItem();
            UniqueItem uniqueItem4 = new UniqueItem();

            UniqueItem.CounterOfUsers();
        }