Example #1
0
    public void UnSet(int ItemID)
    {
        AccessoryItem Item = ItemManager.returnAccessoryItem(ItemID);

        Item.UnEquip();
        DataManager.Save();
    }
Example #2
0
        private void SetNewHat()
        {
            Accessories.AccessoryItems.Clear();
            AccessoryItem hat = new AccessoryItem(AccessoryPositon.Hat, _currentOffer.Category.CategoryId, _gender == "Female" ? true : false);

            Accessories.AccessoryItems.Add(hat);
        }
        /// <summary>
        /// Execute startup tasks
        /// </summary>
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            // Look through all sensors and start the first connected one.
            // This requires that a Kinect is connected at the time of app startup.
            // To make your app robust against plug/unplug,
            // it is recommended to use KinectSensorChooser provided in Microsoft.Kinect.Toolkit
            foreach (var potentialSensor in KinectSensor.KinectSensors)
            {
                if (potentialSensor.Status == KinectStatus.Connected)
                {
                    this.sensor = potentialSensor;
                    break;
                }
            }

            if (null != this.sensor)
            {
                // Turn on the color stream to receive color frames
                this.sensor.ColorStream.Enable(ColorImageFormat.RgbResolution1280x960Fps12);

                // Allocate space to put the pixels we'll receive
                this.colorPixels = new byte[this.sensor.ColorStream.FramePixelDataLength];

                // This is the bitmap we'll display on-screen
                this.colorBitmap = new WriteableBitmap(this.sensor.ColorStream.FrameWidth, this.sensor.ColorStream.FrameHeight, 96.0, 96.0, PixelFormats.Bgr32, null);

                // Set the image we display to point to the bitmap where we'll put the image data
                this.Image.Source = this.colorBitmap;

                // Add an event handler to be called whenever there is new color frame data
                this.sensor.ColorFrameReady += this.SensorColorFrameReady;

                this.sensor.SkeletonStream.Enable();
                this.sensor.SkeletonFrameReady += this.SkeletonFrameReady;

                AccessoryItem hat = new AccessoryItem(AccessoryPositon.Hat, "4.png");
                Accessories.AccessoryItems.Add(hat);

                Accessories.Start(sensor);

                // Start the sensor!
                try
                {
                    this.sensor.Start();
                }
                catch (IOException)
                {
                    this.sensor = null;
                }
            }

            if (null == this.sensor)
            {
                this.statusBarText.Text = Properties.Resources.NoKinectReady;
            }
        }
Example #4
0
 public void Set(int itemid)
 {
     ItemId = itemid;
     if (itemid != 9999)
     {
         AccessoryItem Item = ItemManager.returnAccessoryItem(itemid);
         Item.Equip();
     }
     DataManager.Save();
 }
        private void StartGreenScreenAndHat()
        {
            var helper = KinectHelper.Instance;

            GreenScreen.Start(helper.Sensor, false);// TODO wieder auf true sonst kein antialiasing
            Accessories.AccessoryItems.Clear();
            AccessoryItem hat = new AccessoryItem(AccessoryPositon.Hat, _currentOffer.Category.CategoryId, false);

            Accessories.AccessoryItems.Add(hat);
            Accessories.Start(helper.Sensor);
            helper.ReadyEvent += (s, _) => HelperReady();
        }
Example #6
0
    /// <summary>
    /// This function does the work and actually sets the UI labels, sprites, etc for this entry based on
    /// the incoming item data.
    /// </summary>
    public void Init(Item newItemData)
    {
        // set the proper values on the entry
        gameObject.name = newItemData.ID;

        // Cache this information
        itemData = (AccessoryItem)newItemData;

        string costText = newItemData.Cost.ToString();

        labelCost.text    = costText;
        labelName.text    = newItemData.Name;
        spriteIcon.sprite = SpriteCacheManager.GetSprite(newItemData.TextureName);

        CheckState();
    }
Example #7
0
    /// <summary>
    /// Gets the type of the accessory node.
    /// Given a accessory(ID), check the xml to see which type it is.
    /// </summary>
    /// <returns>The accessory node type.</returns>
    /// <param name="accessoryID">Accessory ID.</param>
    public string GetAccessoryNodeType(string accessoryID)
    {
        AccessoryItem itemDeco = (AccessoryItem)DataLoaderItems.GetItem(accessoryID);

        return(itemDeco.AccessoryType.ToString());
    }
Example #8
0
    public static void SetupData()
    {
        allItems = new Dictionary <ItemType, Dictionary <string, Item> >();

        //Load all item xml files
        UnityEngine.Object[] files = Resources.LoadAll("Items", typeof(TextAsset));
        foreach (TextAsset file in files)
        {
            string xmlString = file.text;

            //Create XMLParser instance
            XMLParser xmlParser = new XMLParser(xmlString);

            //Call the parser to build the IXMLNode objects
            XMLElement xmlElement = xmlParser.Parse();

            //Get item type
            ItemType itemType = (ItemType)Enum.Parse(typeof(ItemType), xmlElement.value);

            //Create dictionary to store data
            Dictionary <string, Item> categoryItem = new Dictionary <string, Item>();

            //Go through all child node of xmlElement (the parent of the file)
            for (int i = 0; i < xmlElement.Children.Count; i++)
            {
                IXMLNode childNode = xmlElement.Children[i];

                //Get id
                Hashtable hashAttr = XMLUtils.GetAttributes(childNode);
                string    itemID   = (string)hashAttr["ID"];

                //Get Item properties from xml node
                Hashtable hashItemData = XMLUtils.GetChildren(childNode);

                Item item = null;
                switch (itemType)
                {
                case ItemType.Foods:
                    item = new FoodItem(itemID, itemType, hashItemData);
                    break;

                case ItemType.Usables:
                    item = new UsableItem(itemID, itemType, hashItemData);
                    break;

                case ItemType.Decorations:
                    item = new DecorationItem(itemID, itemType, hashItemData);
                    break;

                case ItemType.Accessories:
                    item = new AccessoryItem(itemID, itemType, hashItemData);
                    break;
                }

                if (!categoryItem.ContainsKey(itemID))
                {
                    categoryItem.Add(itemID, item);
                }
                else
                {
                    Debug.LogError(itemID + " already in items dict");
                }
            }

            //Store dictionary into all Items
            allItems.Add(itemType, categoryItem);
        }
    }
Example #9
0
    /// <summary>
    /// Gets the name of the accessory item prefab.
    /// </summary>
    /// <returns>The accessory item prefab name.</returns>
    /// <param name="itemID">Item ID.</param>
    public static string GetAccessoryItemPrefabName(string itemID)
    {
        AccessoryItem item = (AccessoryItem)GetItem(itemID);

        return(item.PrefabName);
    }
Example #10
0
        private void _loadData()
        {
            try {
                var data1 = _multiGrf.GetData(ProjectConfiguration.SyncAccId);
                var data2 = _multiGrf.GetData(ProjectConfiguration.SyncAccName);

                var accId   = new LuaParser(data1, true, p => new Lub(p).Decompile(), EncodingService.DetectEncoding(data1), EncodingService.DisplayEncoding);
                var accName = new LuaParser(data2, true, p => new Lub(p).Decompile(), EncodingService.DetectEncoding(data2), EncodingService.DisplayEncoding);

                var accIdT   = LuaHelper.GetLuaTable(accId, "ACCESSORY_IDs");
                var accNameT = LuaHelper.GetLuaTable(accName, "AccNameTable");

                Dictionary <int, AccessoryItem> viewIds = new Dictionary <int, AccessoryItem>();

                foreach (var pair in accIdT)
                {
                    int ival;

                    if (Int32.TryParse(pair.Value, out ival))
                    {
                        viewIds[ival] = new AccessoryItem {
                            Id = ival, AccId = pair.Key
                        };
                    }
                }

                int notFound = -1;

                foreach (var pair in accNameT)
                {
                    int ival;

                    string key = pair.Key.Replace("ACCESSORY_IDs.", "").Trim('[', ']');

                    var    bind    = viewIds.Values.FirstOrDefault(p => p.AccId == key);
                    string texture = pair.Value.Replace("\"_", "").Trim('\"');

                    if (bind.Id == 0 && bind.Texture == null && bind.AccId == null)
                    {
                        string id = pair.Key.Trim('[', ']');

                        if (Int32.TryParse(id, out ival))
                        {
                            bind.Texture     = texture;
                            bind.Id          = ival;
                            viewIds[bind.Id] = bind;
                        }
                        else
                        {
                            viewIds[notFound] = new AccessoryItem {
                                Id = notFound, AccId = key, Texture = texture
                            };
                            notFound--;
                        }
                    }
                    else
                    {
                        bind.Texture     = texture;
                        viewIds[bind.Id] = bind;
                    }
                }

                _obItems = new ObservableCollection <AccessoryItemView>(viewIds.OrderBy(p => p.Key).ToList().Select(p => new AccessoryItemView(p.Value)).ToList());
                _dataGrid.ItemsSource           = _obItems;
                _dataGrid.CanUserAddRows        = true;
                _dataGrid.CanUserDeleteRows     = true;
                _dataGrid.IsReadOnly            = false;
                _dataGrid.CanUserReorderColumns = false;
                _dataGrid.CanUserResizeColumns  = false;
                _dataGrid.CanUserSortColumns    = true;
                _dataGrid.SelectionMode         = Microsoft.Windows.Controls.DataGridSelectionMode.Extended;
                _dataGrid.SelectionUnit         = Microsoft.Windows.Controls.DataGridSelectionUnit.CellOrRowHeader;
                _dataGrid.CanUserResizeRows     = false;

                _dataGrid.KeyDown += new KeyEventHandler(_dataGrid_KeyDown);

                if (_obItems.Count > 0)
                {
                    _dataGrid.ScrollIntoView(_obItems.Last());
                }
            }
            catch (Exception err) {
                ErrorHandler.HandleException("Couldn't load the table files.", err);
            }
        }