Пример #1
0
    void setState(BlenderState state, float delay = -1)
    {
        if (delay == -1)
        {
            switch (state)
            {
            case BlenderState.IDLE:
                if (_currentProduct != ItemTypes.UNKNOWN)
                {
                    _sprite.Stop();
                    Inventory.instance.addStuf(_currentProduct.ToString());
                    _currentProduct = ItemTypes.UNKNOWN;
                }

                resetToDefaults();
                indicator.Stop();
                indicator.gameObject.SetActive(false);
                break;

            case BlenderState.WORK_NORMAL:
                break;

            case BlenderState.WORK_DANGER:
                setState(BlenderState.BROCKEN, getAction("MAKE_ORANGE").actionTime);
                break;

            case BlenderState.BROCKEN:
                _sprite.Stop();

                brockenSprite.gameObject.SetActive(true);

                if (_currentProduct == ItemTypes.APPLE_JUCE)
                {
                    ContentManager.instance.configureObject(brockenSprite, settings.spriteAtlas, usettings.brockenAppleSprite);
                }
                else
                {
                    ContentManager.instance.configureObject(brockenSprite, settings.spriteAtlas, usettings.brockenOrangeSprite);
                }

                break;

            default:
                Logger.message(LogLevel.LOG_ERROR, "Unknown blender state - " + state.ToString());
                break;
            }

            _state = state;
        }
        else
        {
            _nextState = state;
            Invoke("onStateChanged", delay);
        }
    }
Пример #2
0
        public void CollectItem(ItemTypes _item)
        {
            Console.WriteLine("Player Recieved: " + _item.ToString());
            Item item = ItemOperators.extractControlFromType(_item);

            inventory.Add(item);
        }
Пример #3
0
    public static string GetRandomItem()
    {
        int       colorId = Random.Range(0, 6);
        ItemTypes value   = (ItemTypes)colorId;

        return(value.ToString());
    }
Пример #4
0
        public Item(ItemTypes type)
        {
            itemType = type;

            TextColor = Color4.White;
            ListText  = itemType.ToString();
        }
    void setState(CoffeeMachineState state, float delay = -1)
    {
        if (delay == -1)
        {
            switch (state)
            {
            case CoffeeMachineState.IDLE:
                if (_currentProduct != ItemTypes.UNKNOWN)
                {
                    Inventory.instance.addStuf(_currentProduct.ToString());
                    _currentProduct = ItemTypes.UNKNOWN;
                }

                indicator.Stop();
                indicator.gameObject.SetActive(false);
                resetToDefaults();
                break;

            case CoffeeMachineState.WORK_NORMAL:
                break;

            case CoffeeMachineState.WORK_DANGER:
                playTimerAnimation(timerRedAnimation);
                setState(CoffeeMachineState.BROCKEN, usettings.brockenTime);
                break;

            case CoffeeMachineState.BROCKEN:
                _sprite.Stop();

                break;

            default:
                Logger.message(LogLevel.LOG_ERROR, "Unknown coffee machine state - " + state.ToString());
                break;
            }

            _state = state;
        }
        else
        {
            _nextState = state;
            Invoke("onStateChanged", delay);
        }
    }
Пример #6
0
        /// <summary>
        /// Loads the documentation image. Output will be saved in DocumentationImage_Cache
        /// Process is Asynchrone
        /// </summary>
        IEnumerator LoadDocumentationImage()
        {
            if (string.IsNullOrEmpty(DocumentationImageUrl))
            {
                string screenshotFileName;
                string skin = EditorGUIUtility.isProSkin?"Dark":"Light";

                if (_Type == ItemTypes.Action)
                {
                    screenshotFileName    = _Name.Replace(".cs", ".png");
                    DocumentationImageUrl = string.Format(__ActionScreenShotUrlFormat__, _RepositoryFullNamePath, skin, screenshotFileName);
                }
                else
                {
                    screenshotFileName    = _Name.Replace("." + _Type.ToString().ToLower() + ".txt", ".png");
                    DocumentationImageUrl = string.Format(__PackageScreenShotUrlFormat__, _RepositoryFullNamePath, _FolderPath, skin, screenshotFileName);
                }
                DocumentationImageUrl = DocumentationImageUrl.Replace(" ", "%20");

                //Debug.Log(DocumentationImageUrl);
            }

            Debug.Log(_RepositoryFullNamePath);

            if (EcosystemBrowser.IsDebugOn)
            {
                Debug.Log("LoadDocumentation for <" + Name + "> url:" + DocumentationImageUrl);
            }

            DocumentationImageStatus = AsynchContentStatus.Downloading;
            WWW _www = new WWW(DocumentationImageUrl);

            while (!_www.isDone)
            {
                yield return(null);
            }

            if (string.IsNullOrEmpty(_www.error))
            {
                DocumentationImageStatus = AsynchContentStatus.Available;
                Texture2D _t2d = new Texture2D(2, 2);
                _www.LoadImageIntoTexture(_t2d);
                DocumentationImage_Cache[DocumentationImageUrl] = _t2d as Texture;
            }
            else
            {
                if (EcosystemBrowser.IsDebugOn)
                {
                    Debug.LogError("LoadDocumentation error for " + Name + " : " + _www.error);
                }
                DocumentationImageStatus = AsynchContentStatus.Unavailable;
            }

            yield break;
        }
Пример #7
0
		protected void Page_Load(object sender, EventArgs e)
		{
			sessionObject = (SessionObject)Session["SessionObject"];

			if (Request.QueryString["xID"] == null)
			{
				SessionObject.RedirectMessage = "No item type provided in URL.";
				Response.Redirect("~/PortalSelection.aspx", true);
			}
			else
			{
                itemType = (ItemTypes)Enum.Parse(typeof(ItemTypes), (String)Request.QueryString["xID"], true);
                switch (itemType)
				{
                    case ItemTypes.Addendum:
                        inpItemType.Value = itemType.ToString();
                        break;
                    case ItemTypes.Image:
                        inpItemType.Value = itemType.ToString();
                        break;
                    case ItemTypes.Item:
                        inpItemType.Value = itemType.ToString();
                        break;
                    case ItemTypes.Rubric:
                        inpItemType.Value = itemType.ToString();
                        break;
					case ItemTypes.RubricAnalytical:
                        inpItemType.Value = itemType.ToString();
						this.Title = "Analytical Rubric Identification";
						break;

					case ItemTypes.RubricHolistic:
                        inpItemType.Value = itemType.ToString();
						this.Title = "Custom Holistic Rubric Identification";
						break;

					default:
                        this.Title = itemType.ToString() + " Identification";
						break;
				}

				if (!IsPostBack)
				{
					SetControlVisibility();
					LoadGrades();
					LoadCourses();
					LoadItemBanks();
					LoadQuestionTypes();
					LoadAddendumTypes();
					LoadPassThruParms();
				}

				ScriptManager.RegisterStartupScript(this, typeof(string), "appClient", "var appClient = '" + AppClient() + "';", true);

			}
		}
Пример #8
0
    void SetCharges(int charges)
    {
        IInventoryItem item_config = LootBalance.GetBalance().GetItem(ChargeItemType);

        if (item_config == null)
        {
            Debug.LogWarning("CAN NOT FIND A CONSUMABLE FOR " + ChargeItemType.ToString());
            return;
        }

        m_unit.Inventory.AddItem(item_config, charges);
    }
Пример #9
0
        private InventoryCell GetHolderByType(ItemTypes itemType)
        {
            foreach (var holder in _holdersUI)
            {
                if (holder.ItemTypeUI == itemType)
                {
                    return(holder);
                }
            }

            Debug.LogWarning(itemType.ToString() + "not found");
            return(null);
        }
Пример #10
0
    public static string GetPlayerFacingString(ItemTypes type)
    {
        switch (type)
        {
        case ItemTypes.dust: return("Supplies");

        case ItemTypes.int_charge: return("Epi-Pen");

        case ItemTypes.rest_pack: return("Stim Pack");

        default: return(type.ToString());
        }
    }
 static void ListJobItems(TranslationJobStatus jobStatus, ItemTypes type)
 {
     Console.WriteLine("List items of types " + type.ToString());
     IEnumerable<TranslationItemInfo> items = jobStatus.GetItems(type);
     cc.ExecuteQuery();
     foreach (TranslationItemInfo item in items)
     {
         Console.WriteLine("TranslationId: " + item.TranslationId + "; Succeeded: " + item.Succeeded + "\n" +
                           "InputFile: " + item.InputFile + "; OutputFile: " + item.OutputFile + "\n" +
                           "Canceled: " + item.Canceled + "; Failed: " + item.Failed + "\n" +
                           "InProgress: " + item.InProgress + "; NotStarted: " + item.NotStarted + "\n" +
                           "; ErrorMessage " + item.ErrorMessage);
     }
 }
Пример #12
0
        public override string ToString()
        {
            string name = this.varname + " = (" + typecode.ToString() + ") ";

            switch (typecode)
            {
            case ItemTypes.Value:
            {
                name += val.ToString();
                break;
            }

            case ItemTypes.Float:
            {
                name += single.ToString();
                break;
            }

            case ItemTypes.Translation:
            {
                name += translation.ToString();
                break;
            }

            case ItemTypes.String:
            {
                name += str;
                break;
            }

            case ItemTypes.Array:
            {
                name += this.ei.Length.ToString() + " items";
                break;
            }

            case ItemTypes.Rotation:
            {
                name += rotation.ToString();
                break;
            }

            case ItemTypes.Binary:
            {
                name += Helper.BytesToHexList(data);
                break;
            }
            }
            return(name);
        }
    static void ListJobItems(TranslationJobStatus jobStatus, ItemTypes type)
    {
        Console.WriteLine("List items of types " + type.ToString());
        IEnumerable <TranslationItemInfo> items = jobStatus.GetItems(type);

        foreach (TranslationItemInfo item in items)
        {
            Console.WriteLine("TranslationId: " + item.TranslationId + "; Succeeded: " + item.Succeeded + "\n" +
                              "InputFile: " + item.InputFile + "; OutputFile: " + item.OutputFile + "\n" +
                              "Canceled: " + item.Canceled + "; Failed: " + item.Failed + "\n" +
                              "InProgress: " + item.InProgress + "; NotStarted: " + item.NotStarted + "\n" +
                              "; ErrorMessage " + item.ErrorMessage);
        }
    }
Пример #14
0
    public Items(ItemTypes _itemType, int _amount)
    {
        name          = _itemType.ToString();
        itemType      = _itemType;
        amount        = _amount;
        pendingAmount = amount;

        System.Random rand = new System.Random(name.GetHashCode());
        float         a    = rand.Next(1000) / 1000f;
        float         b    = rand.Next(1000) / 1000f;
        float         c    = rand.Next(1000) / 1000f;

        color       = new Color(a, b, c);
        coloredName = "<color=" + ColorTypeConverter.ToRGBHex(color) + ">" + name + "</color>";
    }
        private string ListJobItems(TranslationJobStatus jobStatus, ItemTypes type)
        {
            string result = "";

            result += "List items of types " + type.ToString() + "\n";
            IEnumerable <TranslationItemInfo> items = jobStatus.GetItems(type);

            cc.ExecuteQuery();
            foreach (TranslationItemInfo item in items)
            {
                result += "TranslationId: " + item.TranslationId + "; Succeeded: " + item.Succeeded + "\n" +
                          "     InputFile: " + item.InputFile + "; OutputFile: " + item.OutputFile + "\n" +
                          "     Canceled: " + item.Canceled + "; Failed: " + item.Failed + "\n" +
                          "     InProgress: " + item.InProgress + "; NotStarted: " + item.NotStarted + "\n" +
                          "; ErrorMessage " + item.ErrorMessage;
            }
            return(result);
        }
Пример #16
0
 public void TryAddPocket(ItemTypes pocketType)
 {
     if (inventory.Items.ContainsPocket(pocketType))
     {
         TabItem tabItem = new TabItem();
         tabItem.Tag = pocketType;
         if (previousPocket == pocketType)
         {
             previousPocketIndex = tabControlPockets.Items.Count;
         }
         StackPanel stackPanel = new StackPanel();
         stackPanel.SnapsToDevicePixels = true;
         stackPanel.Orientation         = Orientation.Horizontal;
         Image headerImage = new Image();
         headerImage.SnapsToDevicePixels = true;
         headerImage.UseLayoutRounding   = true;
         headerImage.Stretch             = Stretch.None;
         headerImage.Source = ResourceDatabase.GetImageFromName(pocketType.ToString() + "Tab");
         TextBlock headerName = new TextBlock();
         headerName.Text = ItemDatabase.GetPocketName(pocketType);
         headerName.VerticalAlignment = VerticalAlignment.Center;
         headerName.Margin            = new Thickness(2, 0, 0, 0);
         //stackPanel.Children.Add(headerImage);
         //stackPanel.Children.Add(headerName);
         tabItem.Header = headerImage;                // stackPanel;//ItemTable.GetPocketName(pocketType);
         ItemViewerTab inventoryTab = new ItemViewerTab();
         inventoryTab.Width  = Double.NaN;
         inventoryTab.Height = Double.NaN;
         tabItem.Content     = inventoryTab;
         tabControlPockets.Items.Add(tabItem);
         inventoryTab.LoadPocket(inventory.Items[pocketType]);
         tabs.Add(pocketType, inventoryTab);
         if (currentPocket == ItemTypes.Unknown)
         {
             currentPocket = pocketType;
         }
     }
 }
        //按分类查询
        public static List <Post> QueryByItemType(ItemTypes itemType)
        {
            string baseUrl = "https://localhost:5001/api/hunter/post/queryByItemType?"
                             + "itemType=" + itemType.ToString();
            HttpClient client = new HttpClient();

            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept
            .Add(new MediaTypeWithQualityHeaderValue("application/json"));

            var         task2 = client.GetStringAsync(baseUrl);
            List <Post> posts = JsonConvert.DeserializeObject <List <Post> >(task2.Result);

            foreach (var p in posts)
            {
                MemoryStream ms = new MemoryStream(p.imageByte);

                p.Image = Form3.ResizeImage(new Bitmap(ms), new Size(200, 200));
                ms.Close();
            }

            return(posts);
        }
Пример #18
0
 public Item(ItemTypes type, int number)
 {
     this.type = type;
     this.number = number;
     icon = (Texture2D)Resources.Load("Icons/"+type.ToString());
 }
Пример #19
0
    public Item CreateItem(int x, int y, ItemTypes type)
    {
        Transform parent = this.container.Find("Entities/Items");

        GameObject obj = GameObject.Instantiate(prefabs.items[type]);
        obj.transform.SetParent(parent, false);
        obj.name = type.ToString(); //"Item";
        Item item = obj.GetComponent<Item>();
        item.Init(this, x, y, Color.white);

        item.type = type;

        return item;
    }
Пример #20
0
        public XmlNode GetXml(XmlDocument xDoc, XmlNode parent = null)
        {
            XmlNode xTableNode = XmlAdder.Element(xDoc, "Table", parent);

            XmlNode xTableInfo     = XmlAdder.Element(xDoc, "TableInfo", xTableNode);
            XmlNode xBaseRowHeight = XmlAdder.Element(xDoc, "BaseRowHeight", this.BaseRowHeight.ToString(), xTableInfo);

            XmlNode xColumns = XmlAdder.Element(xDoc, "Columns", xTableNode);

            for (int colIndex = 0; colIndex < this.ColumnCount; colIndex++)
            {
                XmlNode xColumn = XmlAdder.Element(xDoc, "Column", xColumns);

                IEasyGridColumn col      = Columns(colIndex);
                ItemTypes       itemType = col.ItemType;

                switch (itemType)
                {
                case ItemTypes.Button:
                {
                    EasyGridButtonColumn c = col as EasyGridButtonColumn;
                    XmlNode xProperties    = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "BaseText", c.Text, xProperties);
                }
                break;

                case ItemTypes.CheckBox:
                {
                    EasyGridCheckBoxColumn c = col as EasyGridCheckBoxColumn;
                    XmlNode xProperties      = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "TriState", c.ThreeState ? "true" : "false", xProperties);
                }
                break;

                case ItemTypes.CheckBoxGroup:
                {
                    EasyGridCheckBoxGroupColumn c = col as EasyGridCheckBoxGroupColumn;
                    XmlNode xProperties           = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    if (c.Items.Count > 0)
                    {
                        XmlNode multiSelItems = XmlAdder.Element(xDoc, "MultiSelItems", xProperties);
                        for (int i = 0; i < c.Items.Count; i++)
                        {
                            XmlNode multiSelItem = XmlAdder.Element(xDoc, "MultiSelItem", c.Items[i].Text, multiSelItems);
                            XmlAdder.Attribute(xDoc, "Checked", c.Items[i].Checked ? "true" : "false", multiSelItem);
                        }
                    }
                }
                break;

                case ItemTypes.CloseButton:
                {
                    EasyGridCloseButtonColumn c = col as EasyGridCloseButtonColumn;
                    XmlNode xProperties         = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "BaseText", c.Text, xProperties);
                }
                break;

                case ItemTypes.ComboBox:
                {
                    EasyGridComboBoxColumn c = col as EasyGridComboBoxColumn;
                    XmlNode xProperties      = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    if (c.Items.Count > 0)
                    {
                        XmlNode singleSelItems = XmlAdder.Element(xDoc, "SingleSelItems", xProperties);
                        for (int i = 0; i < c.Items.Count; i++)
                        {
                            XmlAdder.Element(xDoc, "SingleSelItem", c.Items.ElementAt(i), singleSelItems);
                        }
                    }
                }
                break;

                case ItemTypes.FileOpenBox:
                {
                    EasyGridFileOpenBoxColumn c = col as EasyGridFileOpenBoxColumn;

                    XmlNode xProperties = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "Editable", c.IsEditable?"true":"false", xProperties);
                    XmlAdder.Attribute(xDoc, "TextAlignMode", c.ColumnTextAlignMode.ToString(), xProperties);
                }
                break;

                case ItemTypes.Image:
                {
                    EasyGridImageColumn c           = col as EasyGridImageColumn;
                    XmlNode             xProperties = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TitleShowImage", c.SelectedIndex.ToString(), xProperties);
                    XmlImageList imgs = c.Images as XmlImageList;
                    if (imgs != null && imgs.Count > 0)
                    {
                        imgs.GetXml(xDoc, xProperties);
                    }
                }
                break;

                case ItemTypes.ImageButton:
                {
                    EasyGridImageButtonColumn c = col as EasyGridImageButtonColumn;
                    XmlNode xProperties         = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TitleShowImage", c.SelectedIndex.ToString(), xProperties);
                    XmlAdder.Attribute(xDoc, "ShowTitleText", c.HeaderText.Length > 0 ? "true" : "false", xProperties);
                    XmlAdder.Attribute(xDoc, "UseColumnTextForButtonValue", c.UseColumnTextForButtonValue.ToString(), xProperties);
                    XmlImageList imgs = c.Images as XmlImageList;
                    if (imgs != null && imgs.Count > 0)
                    {
                        imgs.GetXml(xDoc, xProperties);
                    }
                }
                break;

                case ItemTypes.ImageCheckBox:
                {
                    EasyGridImageCheckBoxColumn c = col as EasyGridImageCheckBoxColumn;
                    XmlNode xProperties           = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "InitValue", c.SelectedIndex.ToString(), xProperties);

                    XmlCheckImageList imgs = c.Images as XmlCheckImageList;
                    if (imgs != null && imgs.Count > 0)
                    {
                        imgs.GetXml(xDoc, xProperties);
                    }
                    else
                    {
                        if (c.Images.Count > 1)
                        {
                            if (c.Images.ElementAt(1).Equals(FormAdders.Properties.Resources.check_red))
                            {
                                XmlAdder.Attribute(xDoc, "CheckColor", CheckBoxColors.Red.ToString(), xProperties);
                            }
                            else
                            {
                                XmlAdder.Attribute(xDoc, "CheckColor", CheckBoxColors.Blue.ToString(), xProperties);
                            }
                        }
                        else
                        {
                            XmlAdder.Attribute(xDoc, "CheckColor", CheckBoxColors.Red.ToString(), xProperties);
                        }
                    }
                }
                break;

                case ItemTypes.KeyValue:
                {
                    EasyGridKeyValueColumn c = col as EasyGridKeyValueColumn;
                    XmlNode xProperties      = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TextAlignMode", c.ColumnTextAlignMode.ToString(), xProperties);
                }
                break;

                case ItemTypes.RadioButton:
                {
                    EasyGridRadioButtonColumn c = col as EasyGridRadioButtonColumn;
                    XmlNode xProperties         = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    if (c.Items.Count > 0)
                    {
                        XmlNode singleSelItems = XmlAdder.Element(xDoc, "SingleSelItems", xProperties);
                        for (int i = 0; i < c.Items.Count; i++)
                        {
                            XmlAdder.Element(xDoc, "SingleSelItem", c.Items[i].Text, singleSelItems);
                        }
                    }
                }
                break;

                case ItemTypes.TextBox:
                {
                    EasyGridTextBoxColumn c = col as EasyGridTextBoxColumn;
                    XmlNode xProperties     = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                    XmlAdder.Attribute(xDoc, "TextAlignMode", c.ColumnTextAlignMode.ToString(), xProperties);
                    XmlAdder.Attribute(xDoc, "Editable", c.IsEditable ? "true" : "false", xProperties);
                    XmlAdder.Attribute(xDoc, "IsAutoSort", c.SortMode == DataGridViewColumnSortMode.Automatic ? "true" : "false", xProperties);
                }
                break;

                case ItemTypes.Various:
                {
                    EasyGridVariousColumn c = col as EasyGridVariousColumn;
                    XmlNode xProperties     = XmlAdder.Element(xDoc, itemType.ToString() + "Properties", xColumn);
                    XmlAdder.Attribute(xDoc, "HeaderText", c.HeaderText, xProperties);
                }
                break;
                }
            }

            Rows.GetXml(xDoc, xTableNode);

            return(xTableNode);
        }
Пример #21
0
 public string WriteItemType()
 {
     return(itemType.ToString());
 }
Пример #22
0
    static public void MakeItem(LootStats ls, ItemTypes slot, int iLvl, int rarity)
    {
        string         name     = slot.ToString();
        List <ItemMod> itemMods = new List <ItemMod>();

        string image_name = name;
        int    width      = 1;
        int    height     = 1;

        ItemSizeByType(slot, ref width, ref height);

        if (ItemSubTypesBySlot.ContainsKey(slot))
        {
            ItemSubType sub = ItemSubTypesBySlot[slot][Random.Range(0, ItemSubTypesBySlot[slot].Length)];
            name       = sub.Name;
            width      = sub.Width;
            height     = sub.Height;
            image_name = sub.Image;
        }

        int numPrefixes = Random.Range(0, rarity + 1);

        if (slot == ItemTypes.Weapon && numPrefixes == 0)
        {
            numPrefixes = 1;
        }

        int numSuffixes = rarity - numPrefixes;

        if (numPrefixes > 3)
        {
            numSuffixes += numPrefixes - 3;
            numPrefixes  = 3;
        }
        else if (numSuffixes > 3)
        {
            numPrefixes += numSuffixes - 3;
            numSuffixes  = 3;
        }

        List <ItemModChart> legalPrefs = ModsOfLevel(prefixes, iLvl);

        if (slot == ItemTypes.Potion)
        {
            rarity      = 2;
            numPrefixes = 1;
            numSuffixes = 0;

            legalPrefs = ModsOfLevel(PotionPrefixes, iLvl);
        }

        if (slot == ItemTypes.Weapon)
        {
            numPrefixes--;
        }

        for (int i = 0; i < numPrefixes; i++)
        {
            int r     = Random.Range(0, legalPrefs.Count);
            int value = Mathf.CeilToInt(legalPrefs[r].Value * Random.Range(0.5f, 1.0f));

            if (value == 0)
            {
                value = -1;
            }

            itemMods.Add(
                new ItemMod(
                    legalPrefs[r].Stat,
                    value
                    )
                );

            name = legalPrefs[r].Name + " " + name;
            legalPrefs.RemoveAt(r);
        }

        if (slot == ItemTypes.Weapon)
        {
            List <ItemModChart> legalWeaponPrefs = ModsOfLevel(WeaponPrefixes, iLvl);
            int r = Random.Range(0, legalWeaponPrefs.Count);

            itemMods.Add(
                new ItemMod(
                    legalWeaponPrefs[r].Stat,
                    Mathf.CeilToInt(legalWeaponPrefs[r].Value * Random.Range(0.5f, 1.0f))
                    )
                );

            name = legalWeaponPrefs[r].Name + " " + name;
            legalWeaponPrefs.RemoveAt(r);
        }


        List <ItemModChart> legalSuffs = ModsOfLevel(suffixes, iLvl);

        for (int i = 0; i < numSuffixes; i++)
        {
            int r = Random.Range(0, legalSuffs.Count);

            itemMods.Add(
                new ItemMod(
                    legalSuffs[r].Stat,
                    Mathf.CeilToInt(legalSuffs[r].Value * Random.Range(0.5f, 1.0f))
                    )
                );

            if (i == 0)
            {
                name += " of ";
            }
            else
            {
                name += " and ";
            }

            name += legalSuffs[r].Name;

            legalSuffs.RemoveAt(r);
        }


        // Copy all the data into the gameobject
        ls.gameObject.name = name;


        Image img = ls.transform.Find("Image").GetComponent <Image>();

        img.sprite = Resources.Load <Sprite>("ItemGFX/" + image_name);

        if (img.sprite == null)
        {
            Debug.Log("No sprite for: " + "ItemGFX/" + image_name);
        }

        img.color = Random.ColorHSV(0f, 1f, 0f, 0.5f, 0.8f, 1.0f);

        //if(img.sprite!= null)
        //    img.SetNativeSize();
        img.GetComponent <RectTransform>().sizeDelta = new Vector2(50 * width, 50 * height);

        ls.itemType = slot;
        ls.itemMods = itemMods.ToArray();
        ls.Rarity   = rarity;

        Loot loot = ls.GetComponent <Loot>();

        loot.GridWidth  = width;
        loot.GridHeight = height;

        RectTransform rt = ls.GetComponent <RectTransform>();

        rt.sizeDelta = new Vector2(50 * width, 50 * height);
    }
        public PubItemsViewModel GetPubItems(string ItemName, bool ItemOnSale, int PageNumber, ItemTypes TypeOfItem) //get pub items - item type, if on sale and name
        {
            SqlParameter @outputParam = new SqlParameter {
                ParameterName = "@outputParam", SqlDbType = SqlDbType.Int, Direction = ParameterDirection.Output
            };

            var results = GetPubItemsResults.FromSqlRaw("EXEC @outputParam=Get_PubItems @ItemName, @ItemOnSale, @PageNumber, @ItemsPerPage, @ItemType", //fetch pub items, output param returns the total number of results from the query
                                                        outputParam,
                                                        new SqlParameter("@ItemName", (object)ItemName ?? DBNull.Value),
                                                        new SqlParameter("@PageNumber", PageNumber),
                                                        new SqlParameter("@ItemsPerPage", GlobalConstants.ItemsPerPage),
                                                        new SqlParameter("@ItemOnSale", ItemOnSale),
                                                        new SqlParameter("@ItemType", TypeOfItem.ToString())).ToList();

            return(new PubItemsViewModel {
                PubItemsList = ConvertPubItemResultsToPubItems(results), RowCount = (int)@outputParam.Value
            });
        }
Пример #24
0
 public Item(ItemTypes type)
 {
     this.type   = type;
     this.number = 1;
     icon        = (Texture2D)Resources.Load("Icons/" + type.ToString());
 }
Пример #25
0
 public ProductionItem(ItemTypes _type, int amount)
 {
     name             = _type.ToString();
     itemType         = _type;
     productionAmount = amount;
 }
Пример #26
0
 public static string TranslateItemType(ItemTypes itemType) => itemType.ToString();
        public PubItems GetRandomPubItem(ItemTypes Type, bool ItemOnSale) //get pub items - just the item name
        {
            var results = GetPubItemsResults.FromSqlRaw("EXEC Get_RandomPubItem @ItemOnSale,@ItemType",
                                                        new SqlParameter("@ItemOnSale", ItemOnSale),
                                                        new SqlParameter("@ItemType", Type.ToString())).ToList();

            if (results.Count() > 0)
            {
                return(ConvertItemResultsToPubItems(results.First()));
            }
            else
            {
                return(null); //no results returned - user ID dosen't exist in DB so give nothing.
            }
        }
 private string ListJobItems(TranslationJobStatus jobStatus, ItemTypes type)
 {
     string result = "";
     result += "List items of types " + type.ToString() + "\n";
     IEnumerable<TranslationItemInfo> items = jobStatus.GetItems(type);
     cc.ExecuteQuery();
     foreach (TranslationItemInfo item in items)
     {
         result += "TranslationId: " + item.TranslationId + "; Succeeded: " + item.Succeeded + "\n" +
                           "     InputFile: " + item.InputFile + "; OutputFile: " + item.OutputFile + "\n" +
                           "     Canceled: " + item.Canceled + "; Failed: " + item.Failed + "\n" +
                           "     InProgress: " + item.InProgress + "; NotStarted: " + item.NotStarted + "\n" +
                           "; ErrorMessage " + item.ErrorMessage;
     }
     return result;
 }
Пример #29
0
        //Checks
        private void itemSelectClickedOn(object sender, EventArgs e)
        {
            //Console.WriteLine("Item Selected");
            //Get reference to item or tool being selected
            Utils.nonAntialiasingPictureBox itemSelected = (Utils.nonAntialiasingPictureBox)sender;
            //Add new 'items required' if tool is clicked on
            if (itemSelected.Name.Contains("Select"))
            {
                toolToCraft = itemSelected;
                List <ItemTypes> required = extractRequiredItems(itemSelected.Name);
                int multiplier            = 0;

                itemInSlots = 0;
                //Remove previous 'items required'
                for (int i = this.Controls.Count - 1; i >= 0; i--)
                {
                    Control control = this.Controls[i];
                    if (control.Name.Contains("Collect") || control.Name.Contains("Craft"))
                    {
                        this.Controls.Remove(control);
                    }
                }

                //Add new items required
                foreach (ItemTypes itemType in required)
                {
                    Item item = ItemOperators.extractControlFromType(itemType);
                    Utils.nonAntialiasingPictureBox itemReq = new Utils.nonAntialiasingPictureBox();
                    setItemSelectInfo(itemReq, new Point(40 + (itemSelectSize + 32) * multiplier /*algebra - YEAH!*/, lblRequiredItemsTitle.Bottom + 10), itemType.ToString() + "ToCollect", item);
                    multiplier++;
                    this.Controls.Add(itemReq);
                }
            }
            //Moves item to crafting 'equation' if player has it
            else if (itemSelected.Name.Contains("ToCollect"))
            {
                ItemTypes itemType = extractRequiredItemType(itemSelected.Name);
                int       spot     = (itemSelected.Location.X - 40) / (itemSelectSize + 32);
                if (levelHandler.player.HasItem(itemType))
                {
                    itemSelected.Hide();
                    itemSelected.Location = new Point(60 + (140 * spot), 220);
                    itemSelected.Size     = new Size(75, 75);
                    itemSelected.Show();
                    itemInSlots++;
                    itemSelected.Name = itemType.ToString() + "Collected";
                    //Show output tool if 'equation' is complete
                    if (itemInSlots >= 2)
                    {
                        lblClickHere.Show();
                        ItemTypes selectedToolType = extractItemToCraft(toolToCraft.Name);
                        Item      tool             = ItemOperators.extractControlFromType(selectedToolType);
                        Utils.nonAntialiasingPictureBox itemCrafted = new Utils.nonAntialiasingPictureBox();
                        setItemSelectInfo(itemCrafted, new Point(375, 220), selectedToolType.ToString() + "ToCraft", tool);
                        itemCrafted.Size   = new Size(75, 75);
                        itemCrafted.Click += collectItem;
                        this.Controls.Add(itemCrafted);
                    }
                }
            }
            //Move tool out of equation
            else if (itemSelected.Name.Contains("Collected"))
            {
                lblClickHere.Hide();
                ItemTypes itemType = extractRequiredItemType(itemSelected.Name);
                int       spot     = (itemSelected.Location.X - 60) / 140;
                itemSelected.Hide();
                itemSelected.Location = new Point(40 + (itemSelectSize + 32) * spot, lblRequiredItemsTitle.Bottom + 10);
                itemSelected.Size     = new Size(itemSelectSize, itemSelectSize);
                itemSelected.Show();
                itemInSlots--;
                itemSelected.Name = itemType.ToString() + "ToCollect";

                //Remove equation output if there
                for (int i = this.Controls.Count - 1; i >= 0; i--)
                {
                    Control control = this.Controls[i];
                    if (control.Name.Contains("Craft"))
                    {
                        control.Click -= collectItem;
                        this.Controls.Remove(control);
                    }
                }
            }
        }
Пример #30
0
 public ItemForEdit(int id, ItemTypes type)
 {
     this.id   = id;
     this.type = type;
     this.name = type.ToString();
 }